Skip to content

Commit 7d0b33d

Browse files
committed
docs: more details on various APIs.
1 parent 173f4d4 commit 7d0b33d

File tree

8 files changed

+90
-7
lines changed

8 files changed

+90
-7
lines changed

docs.wrm/api/contract/contract.wrm

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,24 @@ The //overrides// object for write methods may include any of:
183183
- ``overrides.value`` - the amount of ether (in wei) to forward with the call
184184
- ``overrides.nonce`` - the nonce to use for the [[Signer]]
185185

186+
If the ``wait()`` method on the returned [[providers-TransactionResponse]]
187+
is called, there will be additional properties on the receipt:
188+
189+
- ``receipt.events`` - an array of the logs, with additional properties
190+
(if the ABI included a description for the events)
191+
- ``receipt.events[n].args`` - the parsed arguments
192+
- ``receipt.events[n].decode`` - a method that can be used to parse the
193+
log topics and data (this was used to compute ``args``)
194+
- ``receipt.events[n].event`` - the name of the event
195+
- ``receipt.events[n].eventSignature`` - the full signature of the event
196+
- ``receipt.removeListener()`` - a method to remove the listener that trigger
197+
this event
198+
- ``receipt.getBlock()`` - a method to return the [Block](providers-Block) this event occurred in
199+
- ``receipt.getTransaction()`` - a method to return the
200+
[Transaction](providers-TransactionResponse) this event occurred in
201+
- ``receipt.getTransactionReceipt()`` - a method to return the
202+
[Transaction Receipt](providers-TransactionReceipt) this event occurred in
203+
186204

187205
_heading: Write Methods Analysis @<Contract--check>
188206

docs.wrm/api/providers/other.wrm

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
_section: Other Providers
22

3-
Others...
4-
53
_subsection: FallbackProvider @<FallbackProvider> @INHERIT<[[Provider]]> @SRC<providers/fallback-provider:class.FallbackProvider>
64

75
The **FallbackProvider** is the most advanced [[Provider]] available in

docs.wrm/api/providers/provider.wrm

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
_section: Provider @<Provider>
22

3-
Explain what a provider is...
3+
A **Provider** in ethers is a read-only abstraction to
4+
access the blockchain data.
5+
6+
_note: Coming from Web3.js?
7+
If you are coming from Web3.js, this is one of the biggest
8+
differences you will encounter using ethers.
9+
10+
The ethers library creates a strong division between the
11+
operation a **Provider** can perform and those of a [[Signer]],
12+
which Web3.js lumps together.
13+
14+
This separation of concerns and a stricted subset of Provider
15+
operations allows for a larger variety of backends, a more
16+
consistent API and ensures other libraries to operate without
17+
being able to rely on any underlying assumption.
418

519
_subsection: Accounts Methods @<Provider--account-methods>
620

docs.wrm/api/utils/bytes.wrm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
_section: Byte Manipulation
22

3-
Tra la la...
3+
While there are many high-level APIs for interacting with
4+
Ethereum, such as [Contracts](Contract) and [Providers](Provider),
5+
a lot of the low level access requires byte manipulation
6+
operations.
7+
8+
Many of these operations are used internally, but can also be
9+
used to help normalize binary data representations from the
10+
output of various functions and methods.
411

512
_subsection: Types
613

docs.wrm/api/utils/hdnode.wrm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
_section: HD Wallet @<hdnodes>
22

3-
TODO: Explain [BIP32](link-bip-32) [BIP-39](link-bip-39) and whatnot here...
3+
The Hierarchal Desterministic (HD) Wallet was a standard
4+
created for Bitcoin, but lends itself well to a wide variety of
5+
Blockchains which rely on secp256k1 private keys.
6+
7+
For a more detailed technical understanding:
8+
9+
- [BIP-32](link-bip-32) - the hierarchal deterministic description
10+
- [BIP-39](link-bip-39) - the method used to derive the BIP-32 seed
11+
from human-readable sequences of words (i.e. a mnemonic)
12+
- [BIP-44](link-bip-44) - a standard defined to make BIP-32 easy
13+
to adapt to any future compatible blockchain
414

515
_subsection: Types
616

docs.wrm/api/utils/properties.wrm

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,40 @@
11
_section: Property Utilities
22

3-
_property: ethers.utils.checkProperties() => void
3+
This is a collection of utility functions used for handling
4+
properties in a platform-safe way.
5+
6+
The next major version of ethers will no longer be compatible
7+
with ES3, so many of these will be removed in favor of the
8+
built-in options available in ES2015 and above.
9+
10+
_property: ethers.utils.checkProperties(object, check) => void
11+
12+
Checks that //object// only contains properties included
13+
in //check//, and throws [INVALID_ARGUMENT](errors--invalid-argument) if not.
414

515
_property: ethers.utils.deepCopy(anObject) => any
16+
17+
Creates a recursive copy of //anObject//. Frozen (i.e. and other known
18+
immutable) objects are copied by reference.
19+
620
_property: ethers.utils.defineReadOnly(anObject, name, value) => void
21+
22+
Uses the ``Object.defineProperty`` method to set a read-only property
23+
on an object.
24+
725
_property: ethers.utils.getStatic(aConstructor, key) => any
26+
27+
Recursively check for a static method //key// on an inheritance chain
28+
from //aConstructor// to all ancestors.
29+
30+
This is used to mimic behaviour in other languages where ``this`` in
31+
a static method will also search ancestors.
32+
833
_property: ethers.utils.resolveProperties(anObject) => Promise<any> @<utils-resolveproperties> @SRC<properties>
34+
35+
Retruns a Promise which resolves all child values on //anObject//.
36+
937
_property: ethers.utils.shallowCopy(anObject) => any
38+
39+
Returns a shallow copy of //anObject//. This is the same as
40+
using ``Object.assign({ }, anObject)``.

docs.wrm/api/utils/strings.wrm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
_section: Strings @<strings>
22

3-
Tra la la
3+
A **String** is a representation of a human-readable input of output,
4+
which are often taken for granted.
45

6+
When dealing with blockchains, properly handling human-readable and
7+
human-provided data is important to prevent loss of funds, assets,
8+
incorrect permissions, etc.
59

610
_subsection: Bytes32String @<Bytes32String>
711

docs.wrm/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ module.exports = {
262262
"link-eip-2304": { name: "EIP-2304", url: "https:/\/eips.ethereum.org/EIPS/eip-2304" },
263263
"link-bip-39": { name: "BIP-39", url: "https:/\/en.bitcoin.it/wiki/BIP_0039" },
264264
"link-bip-32": { name: "BIP-32", url: "https:/\/github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" },
265+
"link-bip-44": { name: "BIP-44", url: "https:/\/en.bitcoin.it/wiki/BIP_0044" },
265266

266267
"link-npm-elliptic": { name: "elliptic", url: "https:/\/www.npmjs.com/package/elliptic" },
267268
"link-npm-ethersproject-shims": { name: "Shims", url: "https:/\/www.npmjs.com/package/@ethersproject/shims" },

0 commit comments

Comments
 (0)