From 184c459fab0d089a8a879584b72e5eb3560b33ce Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Fri, 13 Dec 2019 22:05:10 -0500 Subject: [PATCH] Updating docs. --- docs.wrm/api/utils/address.wrm | 27 ++-- docs.wrm/api/utils/bytes.wrm | 109 ++++++++-------- docs.wrm/api/utils/constants.wrm | 18 +-- docs.wrm/api/utils/display-logic.wrm | 10 +- docs.wrm/api/utils/hashing.wrm | 26 ++-- docs.wrm/api/utils/strings.wrm | 16 +-- docs.wrm/concepts/events.wrm | 4 + docs.wrm/concepts/gas.wrm | 5 +- docs.wrm/config.json | 6 + docs.wrm/documentation/examples.txt | 1 + docs.wrm/getting-started.wrm | 2 +- docs.wrm/hacking.wrm | 58 +++++++++ docs.wrm/importing-browser.txt | 2 +- docs/README.md | 4 +- docs/api/README.md | 3 +- docs/api/contract/index.html | 8 +- docs/api/index.html | 6 +- docs/api/providers/README.md | 3 +- docs/api/providers/api-providers/README.md | 38 +++++- docs/api/providers/api-providers/index.html | 23 ++-- docs/api/providers/index.html | 12 +- .../api/providers/jsonrpc-provider/index.html | 16 +-- docs/api/providers/other/index.html | 18 +-- docs/api/providers/provider/README.md | 26 +--- docs/api/providers/provider/index.html | 78 ++++++------ docs/api/providers/types/index.html | 36 +++--- docs/api/signer/README.md | 11 +- docs/api/signer/index.html | 24 ++-- docs/api/utils/address/README.md | 19 ++- docs/api/utils/address/index.html | 16 +-- docs/api/utils/bignumber/README.md | 56 ++------- docs/api/utils/bignumber/index.html | 96 +++++++------- docs/api/utils/bytes/README.md | 117 ++++++++---------- docs/api/utils/bytes/index.html | 88 ++++++------- docs/api/utils/constants/README.md | 23 ++-- docs/api/utils/constants/index.html | 32 ++--- docs/api/utils/display-logic/index.html | 26 ++-- docs/api/utils/fixednumber/index.html | 52 ++++---- docs/api/utils/hashing/README.md | 28 ++--- docs/api/utils/hashing/index.html | 38 +++--- docs/api/utils/index.html | 6 +- docs/api/utils/strings/README.md | 8 +- docs/api/utils/strings/index.html | 34 ++--- docs/concepts/README.md | 3 +- docs/concepts/events/README.md | 9 +- docs/concepts/events/index.html | 8 +- docs/concepts/gas/README.md | 4 +- docs/concepts/gas/index.html | 12 +- docs/concepts/index.html | 6 +- docs/contributing/index.html | 8 +- docs/cookbook/index.html | 6 +- docs/documentation/README.md | 3 +- docs/documentation/index.html | 36 +++--- docs/getting-started/README.md | 6 +- docs/getting-started/index.html | 18 +-- docs/hacking/README.md | 70 +++++++++++ docs/hacking/index.html | 13 ++ docs/index.html | 16 +-- docs/license/index.html | 8 +- docs/migration/index.html | 10 +- docs/static/link.svg | 15 +++ docs/static/style.css | 100 ++++++++++++++- docs/testing/index.html | 6 +- packages/constants/src.ts/index.ts | 7 +- 64 files changed, 927 insertions(+), 666 deletions(-) create mode 100644 docs.wrm/hacking.wrm create mode 100644 docs/hacking/README.md create mode 100644 docs/hacking/index.html create mode 100644 docs/static/link.svg diff --git a/docs.wrm/api/utils/address.wrm b/docs.wrm/api/utils/address.wrm index d3c8c37a7..97a675a1a 100644 --- a/docs.wrm/api/utils/address.wrm +++ b/docs.wrm/api/utils/address.wrm @@ -4,18 +4,27 @@ _section: Addresses Explain addresses,formats and checksumming here. -Also see: [Constants.AddressZero](constants) +Also see: [constants.AddressZero](constants) _heading: Functions -_property: utils.getAddress(address) => string -TODO -_property: utils.isAddress(address) => boolean -TODO +_property: utils.getAddress(address) => string @ @TS +Returns //address// as a Checksum Address. -_property: utils.getIcapAddress(address) => string -TODO +If //address// is an invalid 40-nibble [[hexstring]] or if it contains mixed case and +the checksum is invalid, an InvalidArgument Error is throw. -_property: utils.getContractAddress(transaction) => string -TODO +The value of //address// may be any supported address format. + + +_property: utils.isAddress(address) => boolean @ @TS +Returns true if //address// is valid (in any supported format). + +_property: utils.getIcapAddress(address) => string @ @TS +Returns //address// as an ICAP address. Supports the same restrictions as +[utils.getAddress](utils-getAddress). + +_property: utils.getContractAddress(transaction) => string @ @TS +Returns the contract address that would result if //transaction// was +used to deploy a contract. diff --git a/docs.wrm/api/utils/bytes.wrm b/docs.wrm/api/utils/bytes.wrm index 0b60c722a..b59d7cf93 100644 --- a/docs.wrm/api/utils/bytes.wrm +++ b/docs.wrm/api/utils/bytes.wrm @@ -8,20 +8,27 @@ _subsection: Types _heading: Bytes @ -A Bytes object is any object which is an -[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) or -[TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) with +A **Bytes** is any object which is an +[Array](https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) or +[TypedArray](https:/\/developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) with each value in the valid byte range (i.e. between 0 and 255 inclusive), or is an Object with a ``length`` property where each indexed property is in the valid byte range. _heading: BytesLike @ -A **BytesLike** can be either a [[bytes]] or a [[hexstring]]. +A **BytesLike** can be either a [[bytes]] or a [[datahexstring]]. + +_heading: DataHexstring @ + +A **DataHexstring** is identical to a [[hexstring]] except that it has +an even number of nibbles, and therefore is a valid representation of +binary data as a string. _heading: Hexstring @ -A **hexstring** is a string which has a ``0x`` prefix followed by +A **hexstring** is a string which has a ``0x`` prefix followed by any +number of nibbles (i.e. case-insensitive hexidecumal characters, ``0-9`` and ``a-f``). _heading: Signature @ @@ -35,37 +42,36 @@ _heading: SignatureLike @ A **SignatureLike** is similar to a [[signature]], except redundant properties may be omitted. -For example, if *_vs* is specified, **(r, s)** and **v** can be omitted. Likewise, -if **recoverParam** is provided, **v** can be omitted (as it can be computed). +For example, if **_vs** is specified, **s** and **v** may be omitted. Likewise, +if **recoveryParam** is provided, **v** may be omitted (as in these cases the +missing values can be computed). _subsection: Inspection -_property: utils.isBytes(object) => boolean +_property: utils.isBytes(object) => boolean @ @TS Returns true if and only if //object// is a valid [[bytes]]. -_property: utils.isBytesLike(object) => boolean -Returns true if and only if //object// is a [[bytes]] or an Array or TypedArray -where each value is a valid byte (i.e. between 0 and 255 inclusive). +_property: utils.isBytesLike(object) => boolean @ @TS +Returns true if and only if //object// is a [[bytes]] or [[datahexstring]]. -_property: utils.isHexString(object, [ length ] ) => boolean -Returns true if and only if //object// is a valid hex string; -if //length// is specified the length (in bytes) is also verified. +_property: utils.isHexString(object, [ length ] ) => boolean @ @TS +Returns true if and only if //object// is a valid hex string. +If //length// is specified and //object// is not a valid [[datahexstring]] of +//length// bytes, an InvalidArgument error is thrown. _subsection: Converting between Arrays and Hexstrings -_property: utils.arrayify(hexstringOrArrayish [ , options ]) => Uint8Array -Converts //hexstringOrArrayish// to a Uint8Array. If a [[hexstring]] -is passed in, the length must be even. +_property: utils.arrayify(datahexstringOrArrayish [ , options ]) => Uint8Array @ @TS +Converts //datahexstringOrArrayish// to a Uint8Array. -_property: utils.hexlify(hexstringOrArrayish) => string -Converts //hexstringOrArrayish// to a [[hexstring]]. The result -will always be zero-padded to even length. +_property: utils.hexlify(hexstringOrArrayish) => string @ @TS +Converts //hexstringOrArrayish// to a [[datahexstring]]. -_property: utils.hexValue(aBigNumberish) => string -Converts //aBigNumberish// to a [[hexstring]], with no unecessary leading -zeros. The result of this function can be of odd-length. +_property: utils.hexValue(aBigNumberish) => string @ @TS +Converts //aBigNumberish// to a [[hexstring]], with no __unnecessary__ leading +zeros. _heading: Examples @@ -74,48 +80,51 @@ _code: bytes-conversion.js _subsection: Array Manipulation -_property: utils.concat(arrayOfBytesLike) => Uint8Array -Concatenates all the [[byteslike]] in //arrayOfBytesLike// -into a single Uint8Array. +_property: utils.concat(arrayOfBytesLike) => Uint8Array @ @TS +Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single Uint8Array. -_property: utils.stripZeros(aBytesLike) => Uint8Array -Concatenates all the [[byteslike]] in //arrayOfBytesLike// +_property: utils.stripZeros(aBytesLike) => Uint8Array @ @TS +Returns a Uint8Array with all leading ``0`` bytes of //aBtyesLike// removed. -_property: utils.zeroPad(aBytesLike, length) => Uint8Array -Concatenates all the [[byteslike]] in //arrayOfBytesLike// +_property: utils.zeroPad(aBytesLike, length) => Uint8Array @ @TS +Retutns a Uint8Array of the data in //aBytesLike// with ``0`` bytes prepended to +//length// bytes long. + +If //aBytesLike// is already longer than //length// bytes long, an InvalidArgument +error will be thrown. _subsection: Hexstring Manipulation -_property: utils.hexConcat(arrayOfBytesLike) => string -Concatenates all the [[byteslike]] in //arrayOfBytesLike// -into a single [[hexstring]] +_property: utils.hexConcat(arrayOfBytesLike) => [[datahexstring]] @ @TS +Concatenates all the [[byteslike]] in //arrayOfBytesLike// into a single [[datahexstring]] -_property: utils.hexDataLength(aBytesLike) => number +_property: utils.hexDataLength(aBytesLike) => [[datahexstring]] @ @TS Returns the length (in bytes) of //aBytesLike//. -This will **throw and error** if //aBytesLike// is a [[hexstring]] -but is of odd-length. +_property: utils.hexDataSlice(aBytesLike, offset [ , endOffset ] ) => [[datahexstring]] @ @TS +Returns a [[datahexstring]] representation of a slice of //aBytesLike//, from +//offset// (in bytes) to //endOffset// (in bytes). If //endOffset// is +omitted, the length of //aBytesLike// is used. -_property: utils.hexDataSlice(aBytesLike, offset [ , endOffset ] ) => string -Returns the length (in bytes) of //aBytesLike//. +_property: utils.hexStripZeros(aBytesLike) => [[hexstring]] @ @TS +Returns a [[hexstring]] representation of //aBytesLike// with all +leading zeros removed. -_property: utils.hexStripZeros(aBytesLike) => string -@TODO +_property: utils.hexZeroPad(aBytesLike, length) => [[datahexstring]] @ @TS +Returns a [[datahexstring]] representation of //aBytesLike// padded to //length// bytes. -_property: utils.hexZeroPad(aBytesLike, length) => string -@TODO +If //aBytesLike// is already longer than //length// bytes long, an InvalidArgument +error will be thrown. _subsection: Signature Conversion -_property: utils.joinSignature(aSignatureLike) => string -Return the flat-format of a [[signaturelike]], which is -65 bytes (130 nibbles) long, concatenating the **r**, **s** and **v** -of a Signature. +_property: utils.joinSignature(aSignatureLike) => [[datahexstring]] @ @TS +Return the flat-format of //aSignaturelike//, which is 65 bytes (130 nibbles) +long, concatenating the **r**, **s** and (normalized) **v** of a Signature. -_property: utils.splitSignature(aSignatureLikeOrBytesLike) => Signature -Return the full expanded-format of a [[signaturelike]] or -a flat-format [[hexstring]]. Any missing properties will be -computed. +_property: utils.splitSignature(aSignatureLikeOrBytesLike) => [[signature]] @ @TS +Return the full expanded-format of //aSignaturelike// or a flat-format [[datahexstring]]. +Any missing properties will be computed. diff --git a/docs.wrm/api/utils/constants.wrm b/docs.wrm/api/utils/constants.wrm index d840e81be..0823da578 100644 --- a/docs.wrm/api/utils/constants.wrm +++ b/docs.wrm/api/utils/constants.wrm @@ -11,38 +11,38 @@ _code: constants-import.js _subsection: Bytes -_property: constants.AddressZero +_property: constants.AddressZero => [[datahexstring]] @ @TS The Address Zero, which is 20 bytes (40 nibbles) of zero. -_property: constants.HashZero +_property: constants.HashZero => [[datahexstring]] @ @TS The Hash Zero, which is 32 bytes (64 nibbles) of zero. _subsection: Strings -_property: constants.EtherSymbol +_property: constants.EtherSymbol => string @ @TS The Ether symbol, **Ξ**. _subsection: BigNumber -_property: constants.NegativeOne +_property: constants.NegativeOne => [[bignumber]] @ @TS The BigNumber value representing ``"-1"``. -_property: constants.Zero +_property: constants.Zero => [[bignumber]] @ @TS The BigNumber value representing ``"0"``. -_property: constants.One +_property: constants.One => [[bignumber]] @ @TS The BigNumber value representing ``"1"``. -_property: constants.Two +_property: constants.Two => [[bignumber]] @ @TS The BigNumber value representing ``"2"``. -_property: constants.WeiPerEther +_property: constants.WeiPerEther => [[bignumber]] @ @TS The BigNumber value representing ``"1000000000000000000"``, which is the number of Wei per Ether. -_property: constants.MaxUint256 +_property: constants.MaxUint256 => [[bignumber]] @ @TS The BigNumber value representing the maximum ``uint256`` value. diff --git a/docs.wrm/api/utils/display-logic.wrm b/docs.wrm/api/utils/display-logic.wrm index 6004afb34..560fc040c 100644 --- a/docs.wrm/api/utils/display-logic.wrm +++ b/docs.wrm/api/utils/display-logic.wrm @@ -46,23 +46,23 @@ _subsection: Functions _heading: Formatting -_property: utils.commify(value) => string +_property: utils.commify(value) => string @ @TS Returns a string with value grouped by 3 digits, separated by ``,``. _heading: Conversion @ -_property: utils.formatUnits(value [ , unit = "ether" ] ) => string +_property: utils.formatUnits(value [ , unit = "ether" ] ) => string @ @TS Returns a string representation of //value// formatted with //unit// digits (if it is a number) or to the unit specified (if a string). -_property: utils.formatEther(value) => string +_property: utils.formatEther(value) => string @ @TS The equivalent to calling ``formatUnits(value, "ether")``. -_property: utils.parseUnits(value [ , unit = "ether" ] ) => [BigNumber](bignumber) +_property: utils.parseUnits(value [ , unit = "ether" ] ) => [BigNumber](bignumber) @ @TS Returns a [BigNumber](bignumber) representation of //value//, parsed with //unit// digits (if it is a number) or from the unit specified (if a string). -_property: utils.parseEther(value) => [BigNumber](bignumber) +_property: utils.parseEther(value) => [BigNumber](bignumber) @ @TS The equivalent to calling ``parseUnits(value, "ether")``. diff --git a/docs.wrm/api/utils/hashing.wrm b/docs.wrm/api/utils/hashing.wrm index e6e00dc6d..3f47bc36b 100644 --- a/docs.wrm/api/utils/hashing.wrm +++ b/docs.wrm/api/utils/hashing.wrm @@ -10,43 +10,43 @@ _subsection: Cryptographic Hashing The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_hash_function) are a specific family of hash functions. -_property: utils.keccak256(aBytesLike) => string +_property: utils.keccak256(aBytesLike) => [[datahexstring]] @ @TS Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest //aBytesLike//. -_property: utils.ripemd160(aBytesLike) => string +_property: utils.ripemd160(aBytesLike) => [[datahexstring]] @ @TS Returns the [RIPEMD-160](https://en.m.wikipedia.org/wiki/RIPEMD) digest of //aBytesLike//. -_property: utils.sha256(aBytesLike) => string +_property: utils.sha256(aBytesLike) => [[datahexstring]] @ @TS Returns the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//. -_property: utils.sha512(aBytesLike) => string +_property: utils.sha512(aBytesLike) => [[datahexstring]] @ @TS Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of //aBytesLike//. -_property: utils.computeHmac(algorithm, key, data) => string +_property: utils.computeHmac(algorithm, key, data) => [[datahexstring]] @ @TS Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of //data// with //key// using the [Algorithm](supported-algorithm) //algorithm//. _heading: HMAC Supported Algorithms @ -_property: utils.SupportedAlgorithms.sha256 +_property: utils.SupportedAlgorithms.sha256 => string Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm. -_property: utils.SupportedAlgorithms.sha512 +_property: utils.SupportedAlgorithms.sha512 => string Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm. _subsection: Common Hashing Helpers -_property: utils.hashMessage(message) => string +_property: utils.hashMessage(message) => [[datahexstring]] @ @TS Computes the Ethereum message digest of //message//. Ethereum messages are converted to UTF-8 bytes and prefixed with ``\x19Ethereum Signed Message:`` and the length of //message//. -_property: utils.id(text) => string +_property: utils.id(text) => [[datahexstring]] @ @TS The Ethereum Identity function computs the keccak256 hash of the //text// bytes. -_property: utils.namehash(name) => string +_property: utils.namehash(name) => [[datahexstring]] @ @TS Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of //name//. @@ -56,15 +56,15 @@ When using the Solidity ``abi.packEncoded(...)`` function, a non-standard //tightly packed// version of encoding is used. These functions implement the tightly packing algorithm. -_property: utils.solidityPack(arrayOfTypes, arrayOfValues) => string +_property: utils.solidityPack(arrayOfTypes, arrayOfValues) => [[datahexstring]] @ @TS Returns the non-standard encoded //arrayOfValues// packed according to their respecive type in //arrayOfTypes//. -_property: utils.solidityKeccak256(arrayOfTypes, arrayOfValues) => string +_property: utils.solidityKeccak256(arrayOfTypes, arrayOfValues) => [[datahexstring]] @ @TS Returns the KECCAK256 of the non-standard encoded //arrayOfValues// packed according to their respective type in //arrayOfTypes//. -_property: utils.soliditySha256(arrayOfTypes, arrayOfValues) => string +_property: utils.soliditySha256(arrayOfTypes, arrayOfValues) => [[datahexstring]] @ @TS Returns the SHA2-256 of the non-standard encoded //arrayOfValues// packed according to their respective type in //arrayOfTypes//. diff --git a/docs.wrm/api/utils/strings.wrm b/docs.wrm/api/utils/strings.wrm index 24a7b250a..e1522a975 100644 --- a/docs.wrm/api/utils/strings.wrm +++ b/docs.wrm/api/utils/strings.wrm @@ -17,25 +17,25 @@ single word (32 bytes). Since we need only a single byte for the null termination, we can store strings up to 31 bytes long in a word. -_definition: **Note:** +_note: Note Strings that are 31 __//bytes//__ long may contain fewer than 31 __//characters//__, since UTF-8 requires multiple bytes to encode international characters. -_property: utils.parseBytes32String(aBytesLike) => string +_property: utils.parseBytes32String(aBytesLike) => string @ @TS Returns the decoded string represented by the ``Bytes32`` encoded data. -_property: utils.formatBytes32String(text) => string +_property: utils.formatBytes32String(text) => string @ @TS Returns a ``bytes32`` string representation of //text//. If the length of //text// exceeds 31 bytes, it will throw an error. _subsection: UTF-8 Strings @ -_property: utils.toUtf8Bytes(text [ , form = current ] ) => Uint8Array +_property: utils.toUtf8Bytes(text [ , form = current ] ) => Uint8Array @ @TS Returns the UTF-8 bytes of //text//, optionally normalizing it using the [[unicode-normalization-form]] //form//. -_property: utils.toUtf8CodePoints(aBytesLike [ , form = current ] ) => Array +_property: utils.toUtf8CodePoints(aBytesLike [ , form = current ] ) => Array @ @TS Returns the Array of codepoints of //aBytesLike//, optionally normalizing it using the [[unicode-normalization-form]] //form//. @@ -44,7 +44,7 @@ its codepoint, accounting for surrogate pairs. This should not be confused with ``string.split("")``, which destroys surrogate pairs, spliting between each UTF-16 codeunit instead. -_property: utils.toUtf8String(aBytesLike [ , ignoreErrors = false ] ) => string +_property: utils.toUtf8String(aBytesLike [ , ignoreErrors = false ] ) => string @ @TS Returns the string represented by the UTF-8 bytes of //aBytesLike//. This will throw an error for invalid surrogates, overlong sequences or other UTF-8 issues, unless //ignoreErrors// is specified. @@ -86,7 +86,7 @@ _property: utils.UnicodeNormalizationForm.NFKD The Decomposed Normalization Form with Canonical Equivalence. See NFKC for more an example. -_definition: **Note:** +_note: Note Only certain specified characters are folded in Canonical Equivalence, and thus -it should not be considered a method to acheive //any// level of security from +it should **not** be considered a method to acheive //any// level of security from [homoglyph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack). diff --git a/docs.wrm/concepts/events.wrm b/docs.wrm/concepts/events.wrm index 3e93c8a72..7742bcd19 100644 --- a/docs.wrm/concepts/events.wrm +++ b/docs.wrm/concepts/events.wrm @@ -3,3 +3,7 @@ _title: Events _section: Events Explain how topics and such work + +_subsection: Solidity Topics + +How to compute the topic... diff --git a/docs.wrm/concepts/gas.wrm b/docs.wrm/concepts/gas.wrm index 5c8e02ef8..125bbcb42 100644 --- a/docs.wrm/concepts/gas.wrm +++ b/docs.wrm/concepts/gas.wrm @@ -1,6 +1,8 @@ _title: Gas -_section: Gas +_section: Gas @ + +Explain attack vectors _subsection: Gas Price @ @@ -10,4 +12,3 @@ processed. _subsection: Gas Limit @ - diff --git a/docs.wrm/config.json b/docs.wrm/config.json index c44f8b1aa..be61cadab 100644 --- a/docs.wrm/config.json +++ b/docs.wrm/config.json @@ -5,5 +5,11 @@ "link": "https://docs-beta.ethers.io", "markdown": { "banner": "-----\n\nDocumentation: [html](https://docs-beta.ethers.io/)\n\n-----\n\n" + }, + "source": { + "path": "../packages/", + "include": "packages/.*/src.ts/", + "exclude": "/node_modules/|src.ts/.*browser.*", + "link": "https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages$FILENAME#L$LINE" } } diff --git a/docs.wrm/documentation/examples.txt b/docs.wrm/documentation/examples.txt index 49d0e5797..f9641fed2 100644 --- a/docs.wrm/documentation/examples.txt +++ b/docs.wrm/documentation/examples.txt @@ -20,4 +20,5 @@ _toc: _null: This breaks out of a directive. For example, to end a + _definition and reset the indentation. diff --git a/docs.wrm/getting-started.wrm b/docs.wrm/getting-started.wrm index 6fb640418..d3d2b8c51 100644 --- a/docs.wrm/getting-started.wrm +++ b/docs.wrm/getting-started.wrm @@ -23,7 +23,7 @@ _code: importing-node.source _heading: Web Browser It is generally better practice (for security reasons) to copy the -[ethers library](https://cdn.ethers.io/lib/ethers-5.0.min.js) to +[ethers library](https://cdn.ethers.io/lib/ethers-5.0.esm.min.js) to your own webserver and serve it yourself. For quick demos or prototyping though, it can be loaded in your diff --git a/docs.wrm/hacking.wrm b/docs.wrm/hacking.wrm new file mode 100644 index 000000000..fa706aefc --- /dev/null +++ b/docs.wrm/hacking.wrm @@ -0,0 +1,58 @@ +_title: Hacking + +_section: Hacking + +Things to keep in mind: + + +_heading: Supported Platforms + +... + +_heading: Dependencies + +Adding a dependency is non-trivial and will require fairly convincing +arguments. + +Further, **ALL** dependencies for ethers, **must** be MIT licensed or +public domain (CC0). + +All contributions to ethers are then included under the MIT license. + + +_heading: Printable ASCII (7-bit) Characters + +All source and documentation files should ONLY use the printable ASCII +set. + +This is for several reasons, bu... + +- Transmission over certain HTTP servers and proxies can mangle + UTF-8 data +- Certain editors on some platforms, or in certain terminals cannot + handle UTF-8 characters elegantly +- The ability to enter non-ASCII characters on some platforms require + special keyboards, input devices or input methods to be installed, + which either not be supported, or may require administrative + priviledges. + + +_heading: License + +MIT... + + +_heading: Other Considerations + +A common argument to Pull Requests is that they are simple, backwards compatible +and + +It is important to remember that a small change is something that +we are required to support in perpetuity. + +For example, adding support for an obscure platform, such as adding a dot-file +to the root of the package, now carries the implication that we will continue +keeping that dot-file up-to-date as new versions of that platform are released. + + + diff --git a/docs.wrm/importing-browser.txt b/docs.wrm/importing-browser.txt index 41732d022..2e212d7be 100644 --- a/docs.wrm/importing-browser.txt +++ b/docs.wrm/importing-browser.txt @@ -1,2 +1,2 @@ - diff --git a/docs/README.md b/docs/README.md index 6bc5c4694..89cbcca63 100644 --- a/docs/README.md +++ b/docs/README.md @@ -45,6 +45,7 @@ Developer Documentation * [Importing](getting-started) * [Concepts](concepts) * [Events](concepts/events) + * [Solidity Topics](concepts/events) * [Gas](concepts/gas) * [Gas Price](concepts/gas) * [Gas Limit](concepts/gas) @@ -73,6 +74,7 @@ Developer Documentation * [InfuraProvider](api/providers/api-providers) * [NodesmithProvider](api/providers/api-providers) * [AlchemyProvider](api/providers/api-providers) + * [CloudfrontProvider](api/providers/api-providers) * [Other Providers](api/providers/other) * [FallbackProvider](api/providers/other) * [IpcProvider](api/providers/other) @@ -141,4 +143,4 @@ older versions of the library. ----- -**Content Hash:** 6abeb4fa3f15b3443d89a26a6b0320f602a12368bc5ebbfb14a6cce682836167 \ No newline at end of file +**Content Hash:** f1da4df3feeb06a567657ae41d8498ea3315f68d05dc2f9e86c2858b5d2b2f89 \ No newline at end of file diff --git a/docs/api/README.md b/docs/api/README.md index dd54277aa..6c8267955 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -36,6 +36,7 @@ Here... * [InfuraProvider](providers/api-providers) * [NodesmithProvider](providers/api-providers) * [AlchemyProvider](providers/api-providers) + * [CloudfrontProvider](providers/api-providers) * [Other Providers](providers/other) * [FallbackProvider](providers/other) * [IpcProvider](providers/other) @@ -80,4 +81,4 @@ Here... ----- -**Content Hash:** cbd0b8ac4ada4bfee211c0553ac53e171a6900127d874743a0dedf7fa30618f3 \ No newline at end of file +**Content Hash:** 82f760f38f47d32016d3fca512c5dc75539d885d13138f1faa15f4be82edf8aa \ No newline at end of file diff --git a/docs/api/contract/index.html b/docs/api/contract/index.html index 316431dc4..2baadd28b 100644 --- a/docs/api/contract/index.html +++ b/docs/api/contract/index.html @@ -1,6 +1,6 @@ -Contracts
+Contracts
-

Contracts

+

Contracts

Explain what contracts are...

-

Buckets

-
\ No newline at end of file +

Buckets

+
\ No newline at end of file diff --git a/docs/api/index.html b/docs/api/index.html index 567b657b2..5b948eac6 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -1,4 +1,4 @@ -Application Programming Interface
-

Application Programming Interface (API)

+Application Programming Interface \ No newline at end of file +
\ No newline at end of file diff --git a/docs/api/providers/README.md b/docs/api/providers/README.md index 54a26ab71..9b81df842 100644 --- a/docs/api/providers/README.md +++ b/docs/api/providers/README.md @@ -73,6 +73,7 @@ Provider Documentation * [InfuraProvider](api-providers) * [NodesmithProvider](api-providers) * [AlchemyProvider](api-providers) + * [CloudfrontProvider](api-providers) * [Other Providers](other) * [FallbackProvider](other) * [IpcProvider](other) @@ -84,4 +85,4 @@ Provider Documentation ----- -**Content Hash:** b15d8a2febb07abbbd784242c47575fbbb097f24643997ce30625c2e88adb095 \ No newline at end of file +**Content Hash:** 4bae65aa1521a7ecf045f950c9a702ad597d83095d079e66a5abbd327373877c \ No newline at end of file diff --git a/docs/api/providers/api-providers/README.md b/docs/api/providers/api-providers/README.md index ad627d0eb..3c964f12b 100644 --- a/docs/api/providers/api-providers/README.md +++ b/docs/api/providers/api-providers/README.md @@ -24,30 +24,58 @@ EtherscanProvider ----------------- -Tra la la... +The **EtherscanProvider** is backed by a combination of the various +[Etherscan APIs](https://etherscan.io/apis). + + +#### *provider* . **getHistory** ( address ) **=>** *Array< History >* + + + + InfuraProvider -------------- -Tra la la... +The **InfuraProvider** is backed by the popular [INFURA](https://infura.io) +Ethereum service. + +It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby, +Görli and Kovan). NodesmithProvider ----------------- -Tra la la... +The **NodesmithProvider** is backed by [Nodesmith](https://nodesmith.io). + +It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby, +Görli and Kovan), as well as the Ethereum-like network [Aion](https://aion.network). AlchemyProvider --------------- -Tra la la... +The **AlchemtProvider** is backed by [Alchemy](https://alchemyapi.io). + +It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby, +Görli and Kovan). + + +CloudfrontProvider +------------------ + + +The CloudfrontProvider is backed by the +[Cloudflare Ethereum Gateway](https://developers.cloudflare.com/distributed-web/ethereum-gateway/). + +It only supports Mainnet (homestead). ----- -**Content Hash:** 9669eaaa1c2e9a31256fdd49e1b7f79550f064056b1bfd67a8cef6c7b5f8d473 \ No newline at end of file +**Content Hash:** 2e1dfa80bd4ab1ba02610654b00ee4250a89758a496670822e7950d5db449b1c \ No newline at end of file diff --git a/docs/api/providers/api-providers/index.html b/docs/api/providers/api-providers/index.html index 487f82245..b962180f3 100644 --- a/docs/api/providers/api-providers/index.html +++ b/docs/api/providers/api-providers/index.html @@ -1,11 +1,14 @@ -API Providers
-

API Providers

+API Providers
+

API Providers

There are many services which offer a web API for accessing the Ethereum Blockchain. These Providers allow connecting to them, which simplifies development, since you do not need to run your own instance or cluster of Ethereum nodes.

However, this reliance on third-party services can reduce resiliance, security and increase the amount of required trust. To mitigate these issues, it is recommended you use a Default Provider.

-

EtherscanProvider

-

Tra la la...

-

InfuraProvider

-

Tra la la...

-

NodesmithProvider

-

Tra la la...

-

AlchemyProvider

-

Tra la la...

\ No newline at end of file +

EtherscanProvider

+

The EtherscanProvider is backed by a combination of the various Etherscan APIs.

+
provider . getHistory ( address ) Array< History >

+

InfuraProvider

+

The InfuraProvider is backed by the popular INFURA Ethereum service.

It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby, Görli and Kovan).

+

NodesmithProvider

+

The NodesmithProvider is backed by Nodesmith.

It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby, Görli and Kovan), as well as the Ethereum-like network Aion.

+

AlchemyProvider

+

The AlchemtProvider is backed by Alchemy.

It supports Mainnet (homestead) and all common testnets (Ropsten, Rinkeby, Görli and Kovan).

+

CloudfrontProvider

+

The CloudfrontProvider is backed by the Cloudflare Ethereum Gateway.

It only supports Mainnet (homestead).

\ No newline at end of file diff --git a/docs/api/providers/index.html b/docs/api/providers/index.html index 1cdb56120..6b16e4c0c 100644 --- a/docs/api/providers/index.html +++ b/docs/api/providers/index.html @@ -1,9 +1,9 @@ -Providers
-

Providers

+Providers
+

Providers

A Provider is an abstraction of a connection to the Ethereum network, providing a concise, consistent interface to standard Ethereum node functionality.

The ethers.js library provides several options which should cover the vast majority of use-cases, but also includes the necessary functions and classes for sub-classing if a more custom configuration is necessary.

Most users should be able to simply use the Default Provider.

-

Default Provider

+

Default Provider

The default provider is the safest, easiest way to begin developing on Ethereum, and it is also robust enough for use in production.

It creates a FallbackProvider connected to as many backend services as possible. When a request is made, it is sent to multiple backends simulatenously. As responses from each backend are returned, they are checked that they agree. Once a quorum has been reached (i.e. enough of the backends agree), the response is provided to your application.

This ensures that if a backend has become out-of-sync, or if it has been compromised that its responses are dropped in favor of responses that match the majority.

-
ethers . getDefaultProvider ( [ network ] ) Provider

Returns a new Provider, backed by multiple services, connected to network. Is no network is provided, homestead (i.e. mainnet) is used.

-

Provider Documentation

+
ethers . getDefaultProvider ( [ network ] ) Provider

Returns a new Provider, backed by multiple services, connected to network. Is no network is provided, homestead (i.e. mainnet) is used.

+

Provider Documentation

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/api/providers/jsonrpc-provider/index.html b/docs/api/providers/jsonrpc-provider/index.html index 26c42e053..3cc54a18a 100644 --- a/docs/api/providers/jsonrpc-provider/index.html +++ b/docs/api/providers/jsonrpc-provider/index.html @@ -1,11 +1,11 @@ -JSON-RPC Provider
-

JSON-RPC Provider

+JSON-RPC Provider
+

JSON-RPC Provider

Explain here...

-

JsonRpcProvider

+

JsonRpcProvider

TODO...

-
provider . getSigner ( [ addressOrIndex ] ) JsonRpcSigner

Returns a JsonRpcSigner which is managed by this Ethereum node, at addressOrIndex. If no addressOrIndex is provided, the first account (account #0) is used.

-
provider . getUncheckSigner ( [ addressOrIndex ] ) JsonRpcUncheckedSigner

-

JsonRpcSigner

+
provider . getSigner ( [ addressOrIndex ] ) JsonRpcSigner

Returns a JsonRpcSigner which is managed by this Ethereum node, at addressOrIndex. If no addressOrIndex is provided, the first account (account #0) is used.

+
provider . getUncheckSigner ( [ addressOrIndex ] ) JsonRpcUncheckedSigner

+

JsonRpcSigner

TODO... Explain

-

JsonRpcUncheckedSigner

-

TODO... Explain

\ No newline at end of file +

JsonRpcUncheckedSigner

+

TODO... Explain

\ No newline at end of file diff --git a/docs/api/providers/other/index.html b/docs/api/providers/other/index.html index 4107417d2..36fe20985 100644 --- a/docs/api/providers/other/index.html +++ b/docs/api/providers/other/index.html @@ -1,12 +1,12 @@ -Other Providers
-

Other Providers

+Other Providers
+

Other Providers

Others...

-

FallbackProvider

+

FallbackProvider

Explain...

-

Properties

+

Properties

-
provider . providers Array< Provider >

The list of Providers this is connected to.

-
provider . quorum number

The quorum the backend responses must agree upon before a result will be resolved. By default this is half the sum of the weights.

-
provider . weights Array< number >

The weight each of the Providers adds to a results acceptance.

-

IpcProvider

-

Explain...

\ No newline at end of file +
provider . providers Array< Provider >

The list of Providers this is connected to.

+
provider . quorum number

The quorum the backend responses must agree upon before a result will be resolved. By default this is half the sum of the weights.

+
provider . weights Array< number >

The weight each of the Providers adds to a results acceptance.

+

IpcProvider

+

Explain...

\ No newline at end of file diff --git a/docs/api/providers/provider/README.md b/docs/api/providers/provider/README.md index d61b4dc28..d396191f4 100644 --- a/docs/api/providers/provider/README.md +++ b/docs/api/providers/provider/README.md @@ -53,21 +53,7 @@ sent to the network. ```javascript -// Get the balance for an account... -provider.getBalance("ricmoo.firefly.eth"); -// { Promise: { BigNumber: "3446592266910605872" } } - -// Get the code for a contract... -provider.getCode("registrar.firefly.eth"); -// { Promise: "0x606060405236156100885763ffffffff60e060020a60003504166369fe0e2d81146100fa578063704b6c021461010f57806379502c551461012d578063bed866f614610179578063c37067fa1461019e578063c66485b2146101ab578063d80528ae146101c9578063ddca3f43146101f7578063f2c298be14610219578063f3fef3a314610269575b6100f85b6000808052600760209081527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df80543490810190915560408051918252517fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af929181900390910190a25b565b005b341561010257fe5b6100f860043561028a565b005b341561011757fe5b6100f8600160a060020a03600435166102ec565b005b341561013557fe5b61013d610558565b60408051600160a060020a0396871681526020810195909552928516848401526060840191909152909216608082015290519081900360a00190f35b341561018157fe5b61018c600435610580565b60408051918252519081900360200190f35b6100f8600435610595565b005b34156101b357fe5b6100f8600160a060020a03600435166105e6565b005b34156101d157fe5b6101d9610676565b60408051938452602084019290925282820152519081900360600190f35b34156101ff57fe5b61018c61068d565b60408051918252519081900360200190f35b6100f8600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061069495505050505050565b005b341561027157fe5b6100f8600160a060020a0360043516602435610ab2565b005b60025433600160a060020a039081169116146102a65760006000fd5b600454604080519182526020820183905280517f854231545a00e13c316c82155f2b8610d638e9ff6ebc4930676f84a5af08a49a9281900390910190a160048190555b50565b60025433600160a060020a039081169116146103085760006000fd5b60025460408051600160a060020a039283168152918316602083015280517fbadc9a52979e89f78b7c58309537410c5e51d0f63a0a455efe8d61d2b474e6989281900390910190a16002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911790915560008054604080516020908101849052815160e060020a6302571be30281527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152915192909416936302571be39360248084019492938390030190829087803b15156103e957fe5b60325a03f115156103f657fe5b50505060405180519050600160a060020a0316631e83409a826000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b151561045f57fe5b60325a03f1151561046c57fe5b50506040805160008054600354602093840183905284517f0178b8bf00000000000000000000000000000000000000000000000000000000815260048101919091529351600160a060020a039091169450630178b8bf9360248082019493918390030190829087803b15156104dd57fe5b60325a03f115156104ea57fe5b505060408051805160035460025460e860020a62d5fa2b0284526004840191909152600160a060020a03908116602484015292519216925063d5fa2b0091604480830192600092919082900301818387803b151561054457fe5b60325a03f1151561055157fe5b5050505b50565b600054600354600254600454600154600160a060020a039485169492831692165b9091929394565b6000818152600760205260409020545b919050565b6000818152600760209081526040918290208054349081019091558251908152915183927fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af92908290030190a25b50565b60025433600160a060020a039081169116146106025760006000fd5b60015460408051600160a060020a039283168152918316602083015280517f279875333405c968e401e3bc4e71d5f8e48728c90f4e8180ce28f74efb5669209281900390910190a16001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600654600554600160a060020a033016315b909192565b6004545b90565b80516001820190600080808060048510806106af5750601485115b156106ba5760006000fd5b600093505b8484101561072a57855160ff16925060618310806106e05750607a8360ff16115b80156106fc575060308360ff1610806106fc575060398360ff16115b5b801561070d57508260ff16602d14155b156107185760006000fd5b6001909501945b6001909301926106bf565b60045434101561073a5760006000fd5b866040518082805190602001908083835b6020831061076a5780518252601f19909201916020918201910161074b565b51815160209384036101000a60001901801990921691161790526040805192909401829003822060035483528282018190528451928390038501832060008054948401819052865160e060020a6302571be3028152600481018390529651929a509098509650600160a060020a0390921694506302571be393602480820194509192919082900301818787803b15156107ff57fe5b60325a03f1151561080c57fe5b505060405151600160a060020a031691909114905061082b5760006000fd5b60008054600354604080517f06ab5923000000000000000000000000000000000000000000000000000000008152600481019290925260248201869052600160a060020a03308116604484015290519216926306ab59239260648084019382900301818387803b151561089a57fe5b60325a03f115156108a757fe5b505060008054600154604080517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101879052600160a060020a0392831660248201529051919092169350631896f70a9260448084019391929182900301818387803b151561091657fe5b60325a03f1151561092357fe5b50506001546040805160e860020a62d5fa2b02815260048101859052600160a060020a033381166024830152915191909216925063d5fa2b009160448082019260009290919082900301818387803b151561097a57fe5b60325a03f1151561098757fe5b505060008054604080517f5b0fc9c300000000000000000000000000000000000000000000000000000000815260048101869052600160a060020a0333811660248301529151919092169350635b0fc9c39260448084019391929182900301818387803b15156109f357fe5b60325a03f11515610a0057fe5b505060058054349081019091556006805460010190556000838152600760209081526040918290208054840190558151600160a060020a03331681529081019290925280518493507f179ef3319e6587f6efd3157b34c8b357141528074bcb03f9903589876168fa149281900390910190a260408051348152905182917fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af919081900360200190a25b50505050505050565b60025433600160a060020a03908116911614610ace5760006000fd5b604051600160a060020a0383169082156108fc029083906000818181858888f193505050501515610aff5760006000fd5b60408051600160a060020a03841681526020810183905281517fac375770417e1cb46c89436efcf586a74d0298fee9838f66a38d40c65959ffda929181900390910190a15b50505600a165627a7a723058205c3628c01dc80233f51979d91a76cec2a25d84e86c9838d34672734ca2232b640029" } - -// Get the storage value at position 0... -provider.getStorageAt("registrar.firefly.eth", 0) -// { Promise: "0x000000000000000000000000314159265dd8dbb310642f98f50c066173c1259b" } - -// Get transaction count of an account... -provider.getTransactionCount("ricmoo.firefly.eth"); -// { Promise: 531 } +Skipping JavaScript Evaluation. ``` @@ -123,13 +109,7 @@ not have an address configured, `null` is returned. ```javascript -// Reverse lookup of an ENS by address... -provider.lookupAddress("0x6fC21092DA55B392b045eD78F4732bff3C580e2c"); -// { Promise: "registrar.firefly.eth" } - -// Lookup an address of an ENS name... -provider.resolveName("ricmoo.firefly.eth"); -// { Promise: "0x8ba1f109551bD432803012645Ac136ddd64DBA72" } +Skipping JavaScript Evaluation. ``` @@ -293,4 +273,4 @@ Returns true if and only if *object* is a Provider. ----- -**Content Hash:** 3058ddf4bd47707a1887377afc48a0dffedfbfbebf06929a92274e266c9dc196 \ No newline at end of file +**Content Hash:** 95fe0eed62718e6b1f1836b94380b8dd580d48931b261723c8100531c1f570c2 \ No newline at end of file diff --git a/docs/api/providers/provider/index.html b/docs/api/providers/provider/index.html index 300232a6d..3fc310be1 100644 --- a/docs/api/providers/provider/index.html +++ b/docs/api/providers/provider/index.html @@ -1,51 +1,51 @@ -Abstract Provider
-

Provider

+Abstract Provider
+

Provider

Explain what a provider is...

-

Accounts Methods

+

Accounts Methods

-
provider . getBalance ( address [ , blockTag = "latest" ] ) Promise< BigNumber >

Returns the balance of address as of the blockTag block height.

-
provider . getCode ( address [ , blockTag = "latest" ] ) Promise< Hexstring >

Returns the contract code of address as of the blockTag block height. If there is no contract currently deployed, the result is 0x.

-
provider . getStorageAt ( address , position [ , blockTag = "latest" ] ) Promise< Hexstring >

Returns the Bytes32 value of the position at address, as of the blockTag.

-
provider . getTransactionCount ( address [ , blockTag = "latest" ] ) Promise< number >

Returns the number of transactions address has ever sent, as of blockTag. This value is required to be the nonce for the next transaction from address sent to the network.

-

Examples

+
provider . getBalance ( address [ , blockTag = "latest" ] ) Promise< BigNumber >

Returns the balance of address as of the blockTag block height.

+
provider . getCode ( address [ , blockTag = "latest" ] ) Promise< Hexstring >

Returns the contract code of address as of the blockTag block height. If there is no contract currently deployed, the result is 0x.

+
provider . getStorageAt ( address , position [ , blockTag = "latest" ] ) Promise< Hexstring >

Returns the Bytes32 value of the position at address, as of the blockTag.

+
provider . getTransactionCount ( address [ , blockTag = "latest" ] ) Promise< number >

Returns the number of transactions address has ever sent, as of blockTag. This value is required to be the nonce for the next transaction from address sent to the network.

+

Examples

-

// Get the balance for an account...
provider.getBalance("ricmoo.firefly.eth");
// { Promise: { BigNumber: "3446592266910605872" } }

// Get the code for a contract...
provider.getCode("registrar.firefly.eth");
// { Promise: "0x606060405236156100885763ffffffff60e060020a60003504166369fe0e2d81146100fa578063704b6c021461010f57806379502c551461012d578063bed866f614610179578063c37067fa1461019e578063c66485b2146101ab578063d80528ae146101c9578063ddca3f43146101f7578063f2c298be14610219578063f3fef3a314610269575b6100f85b6000808052600760209081527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df80543490810190915560408051918252517fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af929181900390910190a25b565b005b341561010257fe5b6100f860043561028a565b005b341561011757fe5b6100f8600160a060020a03600435166102ec565b005b341561013557fe5b61013d610558565b60408051600160a060020a0396871681526020810195909552928516848401526060840191909152909216608082015290519081900360a00190f35b341561018157fe5b61018c600435610580565b60408051918252519081900360200190f35b6100f8600435610595565b005b34156101b357fe5b6100f8600160a060020a03600435166105e6565b005b34156101d157fe5b6101d9610676565b60408051938452602084019290925282820152519081900360600190f35b34156101ff57fe5b61018c61068d565b60408051918252519081900360200190f35b6100f8600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284375094965061069495505050505050565b005b341561027157fe5b6100f8600160a060020a0360043516602435610ab2565b005b60025433600160a060020a039081169116146102a65760006000fd5b600454604080519182526020820183905280517f854231545a00e13c316c82155f2b8610d638e9ff6ebc4930676f84a5af08a49a9281900390910190a160048190555b50565b60025433600160a060020a039081169116146103085760006000fd5b60025460408051600160a060020a039283168152918316602083015280517fbadc9a52979e89f78b7c58309537410c5e51d0f63a0a455efe8d61d2b474e6989281900390910190a16002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911790915560008054604080516020908101849052815160e060020a6302571be30281527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e26004820152915192909416936302571be39360248084019492938390030190829087803b15156103e957fe5b60325a03f115156103f657fe5b50505060405180519050600160a060020a0316631e83409a826000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b151561045f57fe5b60325a03f1151561046c57fe5b50506040805160008054600354602093840183905284517f0178b8bf00000000000000000000000000000000000000000000000000000000815260048101919091529351600160a060020a039091169450630178b8bf9360248082019493918390030190829087803b15156104dd57fe5b60325a03f115156104ea57fe5b505060408051805160035460025460e860020a62d5fa2b0284526004840191909152600160a060020a03908116602484015292519216925063d5fa2b0091604480830192600092919082900301818387803b151561054457fe5b60325a03f1151561055157fe5b5050505b50565b600054600354600254600454600154600160a060020a039485169492831692165b9091929394565b6000818152600760205260409020545b919050565b6000818152600760209081526040918290208054349081019091558251908152915183927fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af92908290030190a25b50565b60025433600160a060020a039081169116146106025760006000fd5b60015460408051600160a060020a039283168152918316602083015280517f279875333405c968e401e3bc4e71d5f8e48728c90f4e8180ce28f74efb5669209281900390910190a16001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b600654600554600160a060020a033016315b909192565b6004545b90565b80516001820190600080808060048510806106af5750601485115b156106ba5760006000fd5b600093505b8484101561072a57855160ff16925060618310806106e05750607a8360ff16115b80156106fc575060308360ff1610806106fc575060398360ff16115b5b801561070d57508260ff16602d14155b156107185760006000fd5b6001909501945b6001909301926106bf565b60045434101561073a5760006000fd5b866040518082805190602001908083835b6020831061076a5780518252601f19909201916020918201910161074b565b51815160209384036101000a60001901801990921691161790526040805192909401829003822060035483528282018190528451928390038501832060008054948401819052865160e060020a6302571be3028152600481018390529651929a509098509650600160a060020a0390921694506302571be393602480820194509192919082900301818787803b15156107ff57fe5b60325a03f1151561080c57fe5b505060405151600160a060020a031691909114905061082b5760006000fd5b60008054600354604080517f06ab5923000000000000000000000000000000000000000000000000000000008152600481019290925260248201869052600160a060020a03308116604484015290519216926306ab59239260648084019382900301818387803b151561089a57fe5b60325a03f115156108a757fe5b505060008054600154604080517f1896f70a00000000000000000000000000000000000000000000000000000000815260048101879052600160a060020a0392831660248201529051919092169350631896f70a9260448084019391929182900301818387803b151561091657fe5b60325a03f1151561092357fe5b50506001546040805160e860020a62d5fa2b02815260048101859052600160a060020a033381166024830152915191909216925063d5fa2b009160448082019260009290919082900301818387803b151561097a57fe5b60325a03f1151561098757fe5b505060008054604080517f5b0fc9c300000000000000000000000000000000000000000000000000000000815260048101869052600160a060020a0333811660248301529151919092169350635b0fc9c39260448084019391929182900301818387803b15156109f357fe5b60325a03f11515610a0057fe5b505060058054349081019091556006805460010190556000838152600760209081526040918290208054840190558151600160a060020a03331681529081019290925280518493507f179ef3319e6587f6efd3157b34c8b357141528074bcb03f9903589876168fa149281900390910190a260408051348152905182917fdb7750418f9fa390aaf85d881770065aa4adbe46343bcff4ae573754c829d9af919081900360200190a25b50505050505050565b60025433600160a060020a03908116911614610ace5760006000fd5b604051600160a060020a0383169082156108fc029083906000818181858888f193505050501515610aff5760006000fd5b60408051600160a060020a03841681526020810183905281517fac375770417e1cb46c89436efcf586a74d0298fee9838f66a38d40c65959ffda929181900390910190a15b50505600a165627a7a723058205c3628c01dc80233f51979d91a76cec2a25d84e86c9838d34672734ca2232b640029" }

// Get the storage value at position 0...
provider.getStorageAt("registrar.firefly.eth", 0)
// { Promise: "0x000000000000000000000000314159265dd8dbb310642f98f50c066173c1259b" }

// Get transaction count of an account...
provider.getTransactionCount("ricmoo.firefly.eth");
// { Promise: 531 }
+
Skipping JavaScript Evaluation.
-

Blocks Methods

+

Blocks Methods

-
provider . getBlock ( block ) Promise< Block >

Get the block from the network, where the result.transactions is a list of transaction hashes.

-
provider . getBlockWithTransactions ( block ) Promise< BlockWithTransactions >

Get the block from the network, where the result.transactions is an Array of TransactionResponse objects.

-

Ethereum Naming Service (ENS) Methods

+
provider . getBlock ( block ) Promise< Block >

Get the block from the network, where the result.transactions is a list of transaction hashes.

+
provider . getBlockWithTransactions ( block ) Promise< BlockWithTransactions >

Get the block from the network, where the result.transactions is an Array of TransactionResponse objects.

+

Ethereum Naming Service (ENS) Methods

TODO: Explain ENS here...

-
provider . lookupAddress ( address ) Promise< string >

Performs a reverse lookup of the address in ENS using the Reverse Registrar. If the name does not exist, or the forward lookup does not match, null is returned.

-
provider . resovleName ( name ) Promise< string >

Looks up the address of name. If the name is not owned, or does not have a Resolver configured, or the Resolver does not have an address configured, null is returned.

-

Examples

+
provider . lookupAddress ( address ) Promise< string >

Performs a reverse lookup of the address in ENS using the Reverse Registrar. If the name does not exist, or the forward lookup does not match, null is returned.

+
provider . resovleName ( name ) Promise< string >

Looks up the address of name. If the name is not owned, or does not have a Resolver configured, or the Resolver does not have an address configured, null is returned.

+

Examples

-

// Reverse lookup of an ENS by address...
provider.lookupAddress("0x6fC21092DA55B392b045eD78F4732bff3C580e2c");
// { Promise: "registrar.firefly.eth" }

// Lookup an address of an ENS name...
provider.resolveName("ricmoo.firefly.eth");
// { Promise: "0x8ba1f109551bD432803012645Ac136ddd64DBA72" }

+
Skipping JavaScript Evaluation.
-

Logs Methods

+

Logs Methods

-
provider . getLogs ( filter ) Promise< Array< Log > >

Returns the Array of Log matching the filter.

Keep in mind that many backends will discard old events, and that requests which are too broad may get dropped as they require too many resources to execute the query.

-

Network Status Methods

+
provider . getLogs ( filter ) Promise< Array< Log > >

Returns the Array of Log matching the filter.

Keep in mind that many backends will discard old events, and that requests which are too broad may get dropped as they require too many resources to execute the query.

+

Network Status Methods

-
provider . getNetwork ( ) Promise< Network >

Returns the Network this Provider is connected to.

-
provider . getBlockNumber ( ) Promise< number >

Returns the block number (or height) of the most recently mined block.

-
provider . getGasPrice ( ) Promise< BigNumber >

Returns a best guess of the Gas Price to use in a transaction.

-

Transactions Methods

+
provider . getNetwork ( ) Promise< Network >

Returns the Network this Provider is connected to.

+
provider . getBlockNumber ( ) Promise< number >

Returns the block number (or height) of the most recently mined block.

+
provider . getGasPrice ( ) Promise< BigNumber >

Returns a best guess of the Gas Price to use in a transaction.

+

Transactions Methods

-
provider . call ( transaction [ , blockTag = "latest" ] ) Promise< Hexstring >

Returns the result of executing the transaction, using call. A call does not require any ether, but cannot change any state. This is useful for calling gettings on Contracts.

-
provider . estimateGas ( transaction ) Promise< BigNumber >

Returns an estimate of the amount of gas that would be required to submit transaction to the network.

An estimate may not be accurate since there could be another transaction on the network that was not accounted for, but after being mined affected relevant state.

-
provider . sendTransaction ( transaction ) Promise< TransactionResponse >

Submits transaction to the network to be mined. The transaction must be signed, and be valid (i.e. the nonce is correct and the account has sufficient balance to pay for the transaction).

-
provider . waitForTransaction ( transactionHash ) Promise< TransactionReceipt >

Returns a Promise which will not resolve until transactionHash is mined.

-

Event Emitter Methods

+
provider . call ( transaction [ , blockTag = "latest" ] ) Promise< Hexstring >

Returns the result of executing the transaction, using call. A call does not require any ether, but cannot change any state. This is useful for calling gettings on Contracts.

+
provider . estimateGas ( transaction ) Promise< BigNumber >

Returns an estimate of the amount of gas that would be required to submit transaction to the network.

An estimate may not be accurate since there could be another transaction on the network that was not accounted for, but after being mined affected relevant state.

+
provider . sendTransaction ( transaction ) Promise< TransactionResponse >

Submits transaction to the network to be mined. The transaction must be signed, and be valid (i.e. the nonce is correct and the account has sufficient balance to pay for the transaction).

+
provider . waitForTransaction ( transactionHash ) Promise< TransactionReceipt >

Returns a Promise which will not resolve until transactionHash is mined.

+

Event Emitter Methods

Explain events here...

-
provider . on ( eventName , listener ) this

Add a listener to be triggered for each eventName.

-
provider . once ( eventName , listener ) this

Add a listener to be triggered for only the next eventName, at which time it be removed.

-
provider . emit ( eventName , ...args ) boolean

Notify all listeners of eventName, passing args to each listener. This is generally only used internally.

-
provider . off ( eventName [ , listener ] ) this

Remove a listener for eventName. If no listener is provided, all listeners for eventName are removed.

-
provider . removeAllListeners ( [ eventName ] ) this

Remove all the listeners for eventName. If no eventName is provided, all events are removed.

-
provider . listenerCount ( [ eventName ] ) number

Returns the number of listeners for eventName. If no eventName is provided, the total number of listeners is returned.

-
provider . listeners ( eventName ) Array< Listener >

Returns the list of Listeners for eventName.

-

Inspection Methods

- -
Provider . isProvider ( object ) boolean

Returns true if and only if object is a Provider.

\ No newline at end of file +
provider . on ( eventName , listener ) this

Add a listener to be triggered for each eventName.

+
provider . once ( eventName , listener ) this

Add a listener to be triggered for only the next eventName, at which time it be removed.

+
provider . emit ( eventName , ...args ) boolean

Notify all listeners of eventName, passing args to each listener. This is generally only used internally.

+
provider . off ( eventName [ , listener ] ) this

Remove a listener for eventName. If no listener is provided, all listeners for eventName are removed.

+
provider . removeAllListeners ( [ eventName ] ) this

Remove all the listeners for eventName. If no eventName is provided, all events are removed.

+
provider . listenerCount ( [ eventName ] ) number

Returns the number of listeners for eventName. If no eventName is provided, the total number of listeners is returned.

+
provider . listeners ( eventName ) Array< Listener >

Returns the list of Listeners for eventName.

+

Inspection Methods

+ +
Provider . isProvider ( object ) boolean

Returns true if and only if object is a Provider.

\ No newline at end of file diff --git a/docs/api/providers/types/index.html b/docs/api/providers/types/index.html index 8d82a9854..96c902f4f 100644 --- a/docs/api/providers/types/index.html +++ b/docs/api/providers/types/index.html @@ -1,33 +1,33 @@ -Types
-

Types

+Types
+

Types

-

BlockTag

+

BlockTag

A BlockTag specifies a specific location in the Blockchain.

  • "latest" – The most recently mined block
  • "earliest" – Block #0
  • "pending" – The block currently being prepared for mining; not all operations support this BlockTag
  • number – The block at this height
  • a negative number – The block this many blocks ago
-

Network

+

Network

A Network represents an Etherem network.

  • name – The human-readable name of the network
  • chainId – The Chain ID of the network
  • ensAddress – The address at which the ENS registry is deployed
-

Blocks

+

Blocks

-

Block

+

Block

TODO

-

BlockWithTransactions

+

BlockWithTransactions

TODO

-

Events and Logs

+

Events and Logs

-

EventFilter

+

EventFilter

TODO

-

EventType

+

EventType

TODO

-

Filter

+

Filter

TODO

-

FilterByBlockHash

+

FilterByBlockHash

TODO

-

Log

+

Log

A network...

-

Transactions

+

Transactions

-

TransactionRequest

+

TransactionRequest

A transaction request describes a transaction that is to be sent to the network or otherwise processed.

It contains the fields:

  • to — target address
  • from — target address
  • nonce — target address
  • gasLimit — target address
  • gasPrice — target address
  • data — target address
  • value — target address
  • chainId — target address

All fields are optional and may be a promise which resolves to the required type.

-

TransactionResponse

+

TransactionResponse

A TransactionResponse ..

-

TransactionReceipt

-

TODO

\ No newline at end of file +

TransactionReceipt

+

TODO

\ No newline at end of file diff --git a/docs/api/signer/README.md b/docs/api/signer/README.md index 289d8e47d..d7209abe5 100644 --- a/docs/api/signer/README.md +++ b/docs/api/signer/README.md @@ -17,7 +17,7 @@ Signer -#### *signer* . **connect** ( provider ) **=>** *Signer* +#### *signer* . **connect** ( provider ) **=>** *[Signer](./)* TODO @@ -28,14 +28,14 @@ TODO -#### *signer* . **getBalance** ( [ blockTag="latest" ] ) **=>** *Promise(BigNumber)* +#### *signer* . **getBalance** ( [ blockTag="latest" ] ) **=>** *Promise< [BigNumber](../utils/bignumber) >* TODO -#### *signer* . **getTransactionCount** ( [ blockTag="latest" ] ) **=>** *Promise(number)* +#### *signer* . **getTransactionCount** ( [ blockTag="latest" ] ) **=>** *Promise< number >* TODO @@ -46,7 +46,8 @@ Wallet inherits Signer ---------------------- -Wallet is... +The Wallet class inherits [Signer](./) and can sign transactions and messages +using a private key as a standard Externally Owned Account (EOA). ### Creating an Instance @@ -69,4 +70,4 @@ TODO ----- -**Content Hash:** 08ec198fa4ab407a1bed0a705073d7f40a6c3969b8e922961939fd8e009ca1ed \ No newline at end of file +**Content Hash:** 62c0d9640e683e41970dc1c779bd3b59ed08c27d99e15f6b51e7bae31ac1975e \ No newline at end of file diff --git a/docs/api/signer/index.html b/docs/api/signer/index.html index 6c47316ad..0eb1955fe 100644 --- a/docs/api/signer/index.html +++ b/docs/api/signer/index.html @@ -1,16 +1,16 @@ -Signer
-

Signers

+Signer
+

Signers

Tra la la...

-

Signer

+

Signer

-
signer . connect ( provider ) Signer

TODO

-

Blockchain Methods

+
signer . connect ( provider ) Signer

TODO

+

Blockchain Methods

-
signer . getBalance ( [ blockTag = "latest" ] ) Promise(BigNumber)

TODO

-
signer . getTransactionCount ( [ blockTag = "latest" ] ) Promise(number)

TODO

-

Wallet inherits Signer

-

Wallet is...

-

Creating an Instance

+
signer . getBalance ( [ blockTag = "latest" ] ) Promise< BigNumber >

TODO

+
signer . getTransactionCount ( [ blockTag = "latest" ] ) Promise< number >

TODO

+

Wallet inherits Signer

+

The Wallet class inherits Signer and can sign transactions and messages using a private key as a standard Externally Owned Account (EOA).

+

Creating an Instance

-
new ethers . Wallet ( privateKey [ , provider ] )

TODO

-
Wallet . fromEncryptedJson ( json , password )

TODO

\ No newline at end of file +
new ethers . Wallet ( privateKey [ , provider ] )

TODO

+
Wallet . fromEncryptedJson ( json , password )

TODO

\ No newline at end of file diff --git a/docs/api/utils/address/README.md b/docs/api/utils/address/README.md index d2c640714..06fc12769 100644 --- a/docs/api/utils/address/README.md +++ b/docs/api/utils/address/README.md @@ -11,7 +11,7 @@ Addresses Explain addresses,formats and checksumming here. -Also see: [Constants.AddressZero](../constants) +Also see: [constants.AddressZero](../constants) ### Functions @@ -20,32 +20,39 @@ Also see: [Constants.AddressZero](../constants) #### *utils* . **getAddress** ( address ) **=>** *string* -TODO +Returns *address* as a Checksum Address. + +If *address* is an invalid 40-nibble [Hexstring](../bytes) or if it contains mixed case and +the checksum is invalid, an InvalidArgument Error is throw. + +The value of *address* may be any supported address format. #### *utils* . **isAddress** ( address ) **=>** *boolean* -TODO +Returns true if *address* is valid (in any supported format). #### *utils* . **getIcapAddress** ( address ) **=>** *string* -TODO +Returns *address* as an ICAP address. Supports the same restrictions as +[utils.getAddress](./). #### *utils* . **getContractAddress** ( transaction ) **=>** *string* -TODO +Returns the contract address that would result if *transaction* was +used to deploy a contract. ----- -**Content Hash:** 0e138a3fe39efa87749ebc8290d153f705d26e547a38b7dce5f4d85603264d24 \ No newline at end of file +**Content Hash:** 2dd561245955594d7080796077503064181258304572112d320139ae2594f383 \ No newline at end of file diff --git a/docs/api/utils/address/index.html b/docs/api/utils/address/index.html index a4230c001..ae28ec45b 100644 --- a/docs/api/utils/address/index.html +++ b/docs/api/utils/address/index.html @@ -1,9 +1,9 @@ -Addresses
-

Addresses

-

Explain addresses,formats and checksumming here.

Also see: Constants.AddressZero

-

Functions

+Addresses
+

Addresses

+

Explain addresses,formats and checksumming here.

Also see: constants.AddressZero

+

Functions

-
utils . getAddress ( address ) string

TODO

-
utils . isAddress ( address ) boolean

TODO

-
utils . getIcapAddress ( address ) string

TODO

-
utils . getContractAddress ( transaction ) string

TODO

\ No newline at end of file +
utils . getAddress ( address ) string

Returns address as a Checksum Address.

If address is an invalid 40-nibble Hexstring or if it contains mixed case and the checksum is invalid, an InvalidArgument Error is throw.

The value of address may be any supported address format.

+
utils . isAddress ( address ) boolean

Returns true if address is valid (in any supported format).

+
utils . getIcapAddress ( address ) string

Returns address as an ICAP address. Supports the same restrictions as utils.getAddress.

+
utils . getContractAddress ( transaction ) string

Returns the contract address that would result if transaction was used to deploy a contract.

\ No newline at end of file diff --git a/docs/api/utils/bignumber/README.md b/docs/api/utils/bignumber/README.md index a6746c9a4..ebcb7c843 100644 --- a/docs/api/utils/bignumber/README.md +++ b/docs/api/utils/bignumber/README.md @@ -108,44 +108,7 @@ Returns an instance of a **BigNumber** for *aBigNumberish*. ```javascript -// From a decimal string... -BigNumber.from("42") -// { BigNumber: "42" } - -// From a hexstring... -BigNumber.from("0x2a") -// { BigNumber: "42" } - -// From a negative hexstring... -BigNumber.from("-0x2a") -// { BigNumber: "-42" } - -// From an Array (or Uint8Array)... -BigNumber.from([ 42 ]) -// { BigNumber: "42" } - -// From an existing BigNumber... -let one1 = constants.One; -let one2 = BigNumber.from(one1) - -one2 -// { BigNumber: "1" } - -// ...which returns the same instance -one1 === one2 -// true - -// From a (safe) number... -BigNumber.from(42) -// { BigNumber: "42" } - -// From a ES2015 BigInt... (only on platforms with BigInt support) -BigNumber.from(42n) -// { BigNumber: "42" } - -// Numbers outside the safe range fail: -BigNumber.from(Number.MAX_SAFE_INTEGER); -// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, version=bignumber/5.0.0-beta.129) +Skipping JavaScript Evaluation. ``` @@ -223,9 +186,9 @@ the *bitcount* least significant bits set to zero. [Two's Complicment](https://en.wikipedia.org/wiki/Two%27s_complement) -is a method used to encode and decode fixed-width values which can be -positive or negative, without requiring a separate sign bit. Most users -will not need to interact with these. +is an elegant method used to encode and decode fixed-width signed values +while efficiently preserving mathematic operations. +Most users will not need to interact with these. #### *bignumber* . **fromTwos** ( bitwidth ) **=>** *[BigNumber](./)* @@ -333,11 +296,7 @@ Returns true if and only if the *object* is a BigNumber object. ```javascript -let a = BigNumber.from(42); -let b = BigNumber.from("91"); - - a.mul(b); - // { BigNumber: "3822" } +Skipping JavaScript Evaluation. ``` @@ -369,8 +328,7 @@ To demonstrate how this may be an issue in your code, consider: ```javascript -(Number.MAX_SAFE_INTEGER + 2 - 2) == (Number.MAX_SAFE_INTEGER) -// false +Skipping JavaScript Evaluation. ``` @@ -386,4 +344,4 @@ mathematical operations handled safely. ----- -**Content Hash:** 269c8464ff80c77316617cbfa4e9a195d742f829a23911fecf0bba16961f81ae \ No newline at end of file +**Content Hash:** 76be4f72801f0d772c1ebe1acff4c41f6d52ed96f603de4b168f12d099470273 \ No newline at end of file diff --git a/docs/api/utils/bignumber/index.html b/docs/api/utils/bignumber/index.html index 755e9093e..b6038b88d 100644 --- a/docs/api/utils/bignumber/index.html +++ b/docs/api/utils/bignumber/index.html @@ -1,65 +1,65 @@ -Big Number
-

BigNumber

+Big Number
+

BigNumber

Explain about BigNumber here...

-

Importing

+

Importing

/////
// CommonJS:

// From the Umbrella ethers package...
const { BigNumber } = require("ethers");

// From the bignumber pacakge...
const { BigNumber } = require("@ethersproject/bignumber");


/////
// ES6 and TypeScript:

// From the Umbrella ethers package...
import { BigNumber } from "ethers";

// From the bignumber pacakge...
import { BigNumber } from "@ethersproject/bignumber";
-

Types

+

Types

-

BigNumberish

+

BigNumberish

Many functions and methods in this library take in values which can be non-ambiguously and safely converted to a BigNumber. These values can be sepcified as:

-
string

A hexstring or a decimal string, either of which may be negative.

-
BytesLike

A BytesLike Object, such as an Array or Uint8Array.

-
BigNumber

An existing BigNumber instance.

-
number

A number that is within the safe range for JavaScript numbers.

-
BigInt

A JavaScript BigInt object, on environments that support BigInt.

-

Creating Instances

+
string

A hexstring or a decimal string, either of which may be negative.

+
BytesLike

A BytesLike Object, such as an Array or Uint8Array.

+
BigNumber

An existing BigNumber instance.

+
number

A number that is within the safe range for JavaScript numbers.

+
BigInt

A JavaScript BigInt object, on environments that support BigInt.

+

Creating Instances

The constructor of BigNumber cannot be called directly. Instead, Use the static BigNumber.from.

-
BigNumber . from ( aBigNumberish ) BigNumber

Returns an instance of a BigNumber for aBigNumberish.

-

Examples:

+
BigNumber . from ( aBigNumberish ) BigNumber

Returns an instance of a BigNumber for aBigNumberish.

+

Examples:

-

// From a decimal string...
BigNumber.from("42")
// { BigNumber: "42" }

// From a hexstring...
BigNumber.from("0x2a")
// { BigNumber: "42" }

// From a negative hexstring...
BigNumber.from("-0x2a")
// { BigNumber: "-42" }

// From an Array (or Uint8Array)...
BigNumber.from([ 42 ])
// { BigNumber: "42" }

// From an existing BigNumber...
let one1 = constants.One;
let one2 = BigNumber.from(one1)

one2
// { BigNumber: "1" }

// ...which returns the same instance
one1 === one2
// true

// From a (safe) number...
BigNumber.from(42)
// { BigNumber: "42" }

// From a ES2015 BigInt... (only on platforms with BigInt support)
BigNumber.from(42n)
// { BigNumber: "42" }

// Numbers outside the safe range fail:
BigNumber.from(Number.MAX_SAFE_INTEGER);
// Error: overflow (fault="overflow", operation="BigNumber.from", value=9007199254740991, version=bignumber/5.0.0-beta.129)
+
Skipping JavaScript Evaluation.
-

Methods

+

Methods

The BigNumber class is immutable, so no operations can change the value it represents.

-

Math Operations

+

Math Operations

-
bignumber . add ( otherValue ) BigNumber

Returns a BigNumber with the value of bignumber + otherValue.

-
bignumber . sub ( otherValue ) BigNumber

Returns a BigNumber with the value of bignumber otherValue.

-
bignumber . mul ( otherValue ) BigNumber

Returns a BigNumber with the value of bignumber × otherValue.

-
bignumber . div ( divisor ) BigNumber

Returns a BigNumber with the value of bignumber ÷ divisor.

-
bignumber . mod ( divisor ) BigNumber

Returns a BigNumber with the value of the remainder of bignumber ÷ divisor.

-
bignumber . pow ( exponent ) BigNumber

Returns a BigNumber with the value of bignumber to the power of exponent.

-
bignumber . abs ( ) BigNumber

Returns a BigNumber with the absolute value of bignumber.

-
bignumber . maskn ( bitcount ) BigNumber

Returns a BigNumber with the value of bignumber with bits beyond the bitcount least significant bits set to zero.

-

Two's Compliment

-

Two's Complicment is a method used to encode and decode fixed-width values which can be positive or negative, without requiring a separate sign bit. Most users will not need to interact with these.

-
bignumber . fromTwos ( bitwidth ) BigNumber

Returns a BigNumber with the value of bignumber converted from twos-compliment with bitwidth.

-
bignumber . toTwos ( bitwidth ) BigNumber

Returns a BigNumber with the value of bignumber converted to twos-compliment with bitwidth.

-

Comparison and Equivalence

+
bignumber . add ( otherValue ) BigNumber

Returns a BigNumber with the value of bignumber + otherValue.

+
bignumber . sub ( otherValue ) BigNumber

Returns a BigNumber with the value of bignumber otherValue.

+
bignumber . mul ( otherValue ) BigNumber

Returns a BigNumber with the value of bignumber × otherValue.

+
bignumber . div ( divisor ) BigNumber

Returns a BigNumber with the value of bignumber ÷ divisor.

+
bignumber . mod ( divisor ) BigNumber

Returns a BigNumber with the value of the remainder of bignumber ÷ divisor.

+
bignumber . pow ( exponent ) BigNumber

Returns a BigNumber with the value of bignumber to the power of exponent.

+
bignumber . abs ( ) BigNumber

Returns a BigNumber with the absolute value of bignumber.

+
bignumber . maskn ( bitcount ) BigNumber

Returns a BigNumber with the value of bignumber with bits beyond the bitcount least significant bits set to zero.

+

Two's Compliment

+

Two's Complicment is an elegant method used to encode and decode fixed-width signed values while efficiently preserving mathematic operations. Most users will not need to interact with these.

+
bignumber . fromTwos ( bitwidth ) BigNumber

Returns a BigNumber with the value of bignumber converted from twos-compliment with bitwidth.

+
bignumber . toTwos ( bitwidth ) BigNumber

Returns a BigNumber with the value of bignumber converted to twos-compliment with bitwidth.

+

Comparison and Equivalence

-
bignumber . eq ( otherValue ) boolean

Returns true if and only if the value of bignumber is equal to otherValue.

-
bignumber . lt ( otherValue ) boolean

Returns true if and only if the value of bignumber < otherValue.

-
bignumber . lte ( otherValue ) boolean

Returns true if and only if the value of bignumber otherValue.

-
bignumber . gt ( otherValue ) boolean

Returns true if and only if the value of bignumber > otherValue.

-
bignumber . gte ( otherValue ) boolean

Returns true if and only if the value of bignumber otherValue.

-
bignumber . isZero ( ) boolean

Returns true if and only if the value of bignumber is zero.

-

Conversion

+
bignumber . eq ( otherValue ) boolean

Returns true if and only if the value of bignumber is equal to otherValue.

+
bignumber . lt ( otherValue ) boolean

Returns true if and only if the value of bignumber < otherValue.

+
bignumber . lte ( otherValue ) boolean

Returns true if and only if the value of bignumber otherValue.

+
bignumber . gt ( otherValue ) boolean

Returns true if and only if the value of bignumber > otherValue.

+
bignumber . gte ( otherValue ) boolean

Returns true if and only if the value of bignumber otherValue.

+
bignumber . isZero ( ) boolean

Returns true if and only if the value of bignumber is zero.

+

Conversion

-
bignumber . toNumber ( ) number

Returns the value of bignumber as a JavaScript value.

This will throw an error if the value is greater than or equal to Number.MAX_SAFE_INTEGER or less than or equal to Number.MIN_SAFE_INTEGER.

-
bignumber . toString ( ) string

Returns the value of bignumber as a base-10 string.

-
bignumber . toHexString ( ) string

Returns the value of bignumber as a base-16, `0x`-prefixed hexstring.

-

Inspection

+
bignumber . toNumber ( ) number

Returns the value of bignumber as a JavaScript value.

This will throw an error if the value is greater than or equal to Number.MAX_SAFE_INTEGER or less than or equal to Number.MIN_SAFE_INTEGER.

+
bignumber . toString ( ) string

Returns the value of bignumber as a base-10 string.

+
bignumber . toHexString ( ) string

Returns the value of bignumber as a base-16, `0x`-prefixed hexstring.

+

Inspection

-
BigNumnber . isBigNumber ( object ) boolean

Returns true if and only if the object is a BigNumber object.

-

Examples

+
BigNumnber . isBigNumber ( object ) boolean

Returns true if and only if the object is a BigNumber object.

+

Examples

-

let a = BigNumber.from(42);
let b = BigNumber.from("91");

a.mul(b);
// { BigNumber: "3822" }
+
Skipping JavaScript Evaluation.
-

Notes

+

Notes

A few short notes on numbers...

-

Why can't I just use numbers?

-

The first problem many encounter when dealing with Ethereum is the concept of numbers. Most common currencies are broken down with very little granularity. For example, there are only 100 cents in a single dollar. However, there are 1018 wei in a single ether.

JavaScript uses IEEE 754 double-precision binary floating point numbers to represent numeric values. As a result, there are holes in the integer set after 9,007,199,254,740,991; which is problematic for Ethereum because that is only around 0.009 ether (in wei), which means any value over that will begin to experience rounding errors.

To demonstrate how this may be an issue in your code, consider:

-
(Number.MAX_SAFE_INTEGER + 2 - 2) == (Number.MAX_SAFE_INTEGER)
// false
-

To remedy this, all numbers (which can be large) are stored and manipulated as Big Numbers.

The functions parseEther( etherString ) and formatEther( wei ) can be used to convert between string representations, which are displayed to or entered by the user and Big Number representations which can have mathematical operations handled safely.

\ No newline at end of file +

Why can't I just use numbers?

+

The first problem many encounter when dealing with Ethereum is the concept of numbers. Most common currencies are broken down with very little granularity. For example, there are only 100 cents in a single dollar. However, there are 1018 wei in a single ether.

JavaScript uses IEEE 754 double-precision binary floating point numbers to represent numeric values. As a result, there are holes in the integer set after 9,007,199,254,740,991; which is problematic for Ethereum// because that is only around 0.009 ether (in wei), which means any value over that will begin to experience rounding errors.

To demonstrate how this may be an issue in your code, consider:

+
Skipping JavaScript Evaluation.
+

To remedy this, all numbers (which can be large) are stored and manipulated as Big Numbers.

The functions parseEther( etherString ) and formatEther( wei ) can be used to convert between string representations, which are displayed to or entered by the user and Big Number representations which can have mathematical operations handled safely.

\ No newline at end of file diff --git a/docs/api/utils/bytes/README.md b/docs/api/utils/bytes/README.md index 88e40112a..7dee7ac39 100644 --- a/docs/api/utils/bytes/README.md +++ b/docs/api/utils/bytes/README.md @@ -20,7 +20,7 @@ Types ### Bytes -A Bytes object is any object which is an +A **Bytes** is any object which is an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) or [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) with each value in the valid byte range (i.e. between 0 and 255 inclusive), @@ -31,13 +31,22 @@ is in the valid byte range. ### BytesLike -A **BytesLike** can be either a [Bytes](./) or a [Hexstring](./). +A **BytesLike** can be either a [Bytes](./) or a [DataHexstring](./). + + +### DataHexstring + + +A **DataHexstring** is identical to a [Hexstring](./) except that it has +an even number of nibbles, and therefore is a valid representation of +binary data as a string. ### Hexstring -A **hexstring** is a string which has a `0x` prefix followed by +A **hexstring** is a string which has a `0x` prefix followed by any +number of nibbles (i.e. case-insensitive hexidecumal characters, `0-9` and `a-f`). ### Signature @@ -57,8 +66,9 @@ A **hexstring** is a string which has a `0x` prefix followed by A **SignatureLike** is similar to a [Signature](./), except redundant properties may be omitted. -For example, if *_vs* is specified, **(r, s)** and **v** can be omitted. Likewise, -if **recoverParam** is provided, **v** can be omitted (as it can be computed). +For example, if **_vs** is specified, **s** and **v** may be omitted. Likewise, +if **recoveryParam** is provided, **v** may be omitted (as in these cases the +missing values can be computed). Inspection @@ -75,16 +85,16 @@ Returns true if and only if *object* is a valid [Bytes](./). #### *utils* . **isBytesLike** ( object ) **=>** *boolean* -Returns true if and only if *object* is a [Bytes](./) or an Array or TypedArray -where each value is a valid byte (i.e. between 0 and 255 inclusive). +Returns true if and only if *object* is a [Bytes](./) or [DataHexstring](./). #### *utils* . **isHexString** ( object , [ length ] ) **=>** *boolean* -Returns true if and only if *object* is a valid hex string; -if *length* is specified the length (in bytes) is also verified. +Returns true if and only if *object* is a valid hex string. +If *length* is specified and *object* is not a valid [DataHexstring](./) of +*length* bytes, an InvalidArgument error is thrown. @@ -94,26 +104,24 @@ Converting between Arrays and Hexstrings -#### *utils* . **arrayify** ( hexstringOrArrayish [ , options ] ) **=>** *Uint8Array* +#### *utils* . **arrayify** ( datahexstringOrArrayish [ , options ] ) **=>** *Uint8Array* -Converts *hexstringOrArrayish* to a Uint8Array. If a [Hexstring](./) -is passed in, the length must be even. +Converts *datahexstringOrArrayish* to a Uint8Array. #### *utils* . **hexlify** ( hexstringOrArrayish ) **=>** *string* -Converts *hexstringOrArrayish* to a [Hexstring](./). The result -will always be zero-padded to even length. +Converts *hexstringOrArrayish* to a [DataHexstring](./). #### *utils* . **hexValue** ( aBigNumberish ) **=>** *string* -Converts *aBigNumberish* to a [Hexstring](./), with no unecessary leading -zeros. The result of this function can be of odd-length. +Converts *aBigNumberish* to a [Hexstring](./), with no *unnecessary* leading +zeros. @@ -123,29 +131,7 @@ zeros. The result of this function can be of odd-length. ```javascript -// Convert a hexstring to a Uint8Array -arrayify("0x1234") -// [ 18, 52 ] - -// Convert an Array to a hexstring -hexlify([1, 2, 3, 4]) -// 0x01020304 - -// Convert an Object to a hexstring -hexlify({ length: 2, "0": 1, "1": 2 }) -// 0x0102 - -// Convert an Array to a hexstring -hexlify([ 1 ]) -// 0x01 - -// Convert a number to a stripped hex value -hexValue(1) -// 0x1 - -// Convert an Array to a stripped hex value -hexValue([ 1, 2 ]) -// 0x102 +Skipping JavaScript Evaluation. ``` @@ -157,22 +143,25 @@ Array Manipulation #### *utils* . **concat** ( arrayOfBytesLike ) **=>** *Uint8Array* -Concatenates all the [BytesLike](./) in *arrayOfBytesLike* -into a single Uint8Array. +Concatenates all the [BytesLike](./) in *arrayOfBytesLike* into a single Uint8Array. #### *utils* . **stripZeros** ( aBytesLike ) **=>** *Uint8Array* -Concatenates all the [BytesLike](./) in *arrayOfBytesLike* +Returns a Uint8Array with all leading `0` bytes of *aBtyesLike* removed. #### *utils* . **zeroPad** ( aBytesLike , length ) **=>** *Uint8Array* -Concatenates all the [BytesLike](./) in *arrayOfBytesLike* +Retutns a Uint8Array of the data in *aBytesLike* with `0` bytes prepended to +*length* bytes long. + +If *aBytesLike* is already longer than *length* bytes long, an InvalidArgument +error will be thrown. @@ -182,41 +171,43 @@ Hexstring Manipulation -#### *utils* . **hexConcat** ( arrayOfBytesLike ) **=>** *string* +#### *utils* . **hexConcat** ( arrayOfBytesLike ) **=>** *[DataHexstring](./)* -Concatenates all the [BytesLike](./) in *arrayOfBytesLike* -into a single [Hexstring](./) +Concatenates all the [BytesLike](./) in *arrayOfBytesLike* into a single [DataHexstring](./) -#### *utils* . **hexDataLength** ( aBytesLike ) **=>** *number* +#### *utils* . **hexDataLength** ( aBytesLike ) **=>** *[DataHexstring](./)* Returns the length (in bytes) of *aBytesLike*. -This will **throw and error** if *aBytesLike* is a [Hexstring](./) -but is of odd-length. +#### *utils* . **hexDataSlice** ( aBytesLike , offset [ , endOffset ] ) **=>** *[DataHexstring](./)* -#### *utils* . **hexDataSlice** ( aBytesLike , offset [ , endOffset ] ) **=>** *string* +Returns a [DataHexstring](./) representation of a slice of *aBytesLike*, from +*offset* (in bytes) to *endOffset* (in bytes). If *endOffset* is +omitted, the length of *aBytesLike* is used. -Returns the length (in bytes) of *aBytesLike*. +#### *utils* . **hexStripZeros** ( aBytesLike ) **=>** *[Hexstring](./)* -#### *utils* . **hexStripZeros** ( aBytesLike ) **=>** *string* +Returns a [Hexstring](./) representation of *aBytesLike* with all +leading zeros removed. -@TODO +#### *utils* . **hexZeroPad** ( aBytesLike , length ) **=>** *[DataHexstring](./)* -#### *utils* . **hexZeroPad** ( aBytesLike , length ) **=>** *string* +Returns a [DataHexstring](./) representation of *aBytesLike* padded to *length* bytes. -@TODO +If *aBytesLike* is already longer than *length* bytes long, an InvalidArgument +error will be thrown. @@ -226,24 +217,22 @@ Signature Conversion -#### *utils* . **joinSignature** ( aSignatureLike ) **=>** *string* +#### *utils* . **joinSignature** ( aSignatureLike ) **=>** *[DataHexstring](./)* -Return the flat-format of a [SignatureLike](./), which is -65 bytes (130 nibbles) long, concatenating the **r**, **s** and **v** -of a Signature. +Return the flat-format of *aSignaturelike*, which is 65 bytes (130 nibbles) +long, concatenating the **r**, **s** and (normalized) **v** of a Signature. -#### *utils* . **splitSignature** ( aSignatureLikeOrBytesLike ) **=>** *Signature* +#### *utils* . **splitSignature** ( aSignatureLikeOrBytesLike ) **=>** *[Signature](./)* -Return the full expanded-format of a [SignatureLike](./) or -a flat-format [Hexstring](./). Any missing properties will be -computed. +Return the full expanded-format of *aSignaturelike* or a flat-format [DataHexstring](./). +Any missing properties will be computed. ----- -**Content Hash:** 1e52066c61f8794d858f02fb8164b146c9379968b0e0ab90efeb2fe16831599f \ No newline at end of file +**Content Hash:** fce7a8c85402ef3d94ffe261157fa3e0644c5c5d0641d9de7820a9a798bcb6c7 \ No newline at end of file diff --git a/docs/api/utils/bytes/index.html b/docs/api/utils/bytes/index.html index 902bf5b0c..8fb78207f 100644 --- a/docs/api/utils/bytes/index.html +++ b/docs/api/utils/bytes/index.html @@ -1,45 +1,47 @@ -Byte Manipulation
-

Byte Manipulation

+Byte Manipulation
+

Byte Manipulation

Tra la la...

-

Types

- -

Bytes

-

A Bytes object is any object which is an Array or TypedArray with each value in the valid byte range (i.e. between 0 and 255 inclusive), or is an Object with a length property where each indexed property is in the valid byte range.

-

BytesLike

-

A BytesLike can be either a Bytes or a Hexstring.

-

Hexstring

-

A hexstring is a string which has a 0x prefix followed by

-

Signature

+

Types

+ +

Bytes

+

A Bytes is any object which is an Array or TypedArray with each value in the valid byte range (i.e. between 0 and 255 inclusive), or is an Object with a length property where each indexed property is in the valid byte range.

+

BytesLike

+

A BytesLike can be either a Bytes or a DataHexstring.

+

DataHexstring

+

A DataHexstring is identical to a Hexstring except that it has an even number of nibbles, and therefore is a valid representation of binary data as a string.

+

Hexstring

+

A hexstring is a string which has a 0x prefix followed by any number of nibbles (i.e. case-insensitive hexidecumal characters, 0-9 and a-f).

+

Signature

  • r and s — The x co-ordinate of r and the s value of the signature
  • v — The parity of the y co-ordinate of r
  • _vs — The compact representation of the (r, s) and v
  • recoveryParam — The normalized (i.e. 0 or 1) value of v
-

SignatureLike

-

A SignatureLike is similar to a Signature, except redundant properties may be omitted.

For example, if *_vs* is specified, (r, s) and v can be omitted. Likewise, if recoverParam is provided, v can be omitted (as it can be computed).

-

Inspection

- -
utils . isBytes ( object ) boolean

Returns true if and only if object is a valid Bytes.

-
utils . isBytesLike ( object ) boolean

Returns true if and only if object is a Bytes or an Array or TypedArray where each value is a valid byte (i.e. between 0 and 255 inclusive).

-
utils . isHexString ( object , [ length ] ) boolean

Returns true if and only if object is a valid hex string; if length is specified the length (in bytes) is also verified.

-

Converting between Arrays and Hexstrings

- -
utils . arrayify ( hexstringOrArrayish [ , options ] ) Uint8Array

Converts hexstringOrArrayish to a Uint8Array. If a Hexstring is passed in, the length must be even.

-
utils . hexlify ( hexstringOrArrayish ) string

Converts hexstringOrArrayish to a Hexstring. The result will always be zero-padded to even length.

-
utils . hexValue ( aBigNumberish ) string

Converts aBigNumberish to a Hexstring, with no unecessary leading zeros. The result of this function can be of odd-length.

-

Examples

- -

// Convert a hexstring to a Uint8Array
arrayify("0x1234")
// [ 18, 52 ]

// Convert an Array to a hexstring
hexlify([1, 2, 3, 4])
// 0x01020304

// Convert an Object to a hexstring
hexlify({ length: 2, "0": 1, "1": 2 })
// 0x0102

// Convert an Array to a hexstring
hexlify([ 1 ])
// 0x01

// Convert a number to a stripped hex value
hexValue(1)
// 0x1

// Convert an Array to a stripped hex value
hexValue([ 1, 2 ])
// 0x102
- -

Array Manipulation

- -
utils . concat ( arrayOfBytesLike ) Uint8Array

Concatenates all the BytesLike in arrayOfBytesLike into a single Uint8Array.

-
utils . stripZeros ( aBytesLike ) Uint8Array

Concatenates all the BytesLike in arrayOfBytesLike

-
utils . zeroPad ( aBytesLike , length ) Uint8Array

Concatenates all the BytesLike in arrayOfBytesLike

-

Hexstring Manipulation

- -
utils . hexConcat ( arrayOfBytesLike ) string

Concatenates all the BytesLike in arrayOfBytesLike into a single Hexstring

-
utils . hexDataLength ( aBytesLike ) number

Returns the length (in bytes) of aBytesLike.

This will throw and error if aBytesLike is a Hexstring but is of odd-length.

-
utils . hexDataSlice ( aBytesLike , offset [ , endOffset ] ) string

Returns the length (in bytes) of aBytesLike.

-
utils . hexStripZeros ( aBytesLike ) string

@TODO

-
utils . hexZeroPad ( aBytesLike , length ) string

@TODO

-

Signature Conversion

- -
utils . joinSignature ( aSignatureLike ) string

Return the flat-format of a SignatureLike, which is 65 bytes (130 nibbles) long, concatenating the r, s and v of a Signature.

-
utils . splitSignature ( aSignatureLikeOrBytesLike ) Signature

Return the full expanded-format of a SignatureLike or a flat-format Hexstring. Any missing properties will be computed.

\ No newline at end of file +

SignatureLike

+

A SignatureLike is similar to a Signature, except redundant properties may be omitted.

For example, if _vs is specified, s and v may be omitted. Likewise, if recoveryParam is provided, v may be omitted (as in these cases the missing values can be computed).

+

Inspection

+ +
utils . isBytes ( object ) boolean

Returns true if and only if object is a valid Bytes.

+
utils . isBytesLike ( object ) boolean

Returns true if and only if object is a Bytes or DataHexstring.

+
utils . isHexString ( object , [ length ] ) boolean

Returns true if and only if object is a valid hex string. If length is specified and object is not a valid DataHexstring of length bytes, an InvalidArgument error is thrown.

+

Converting between Arrays and Hexstrings

+ +
utils . arrayify ( datahexstringOrArrayish [ , options ] ) Uint8Array

Converts datahexstringOrArrayish to a Uint8Array.

+
utils . hexlify ( hexstringOrArrayish ) string

Converts hexstringOrArrayish to a DataHexstring.

+
utils . hexValue ( aBigNumberish ) string

Converts aBigNumberish to a Hexstring, with no unnecessary leading zeros.

+

Examples

+ +
Skipping JavaScript Evaluation.
+ +

Array Manipulation

+ +
utils . concat ( arrayOfBytesLike ) Uint8Array

Concatenates all the BytesLike in arrayOfBytesLike into a single Uint8Array.

+
utils . stripZeros ( aBytesLike ) Uint8Array

Returns a Uint8Array with all leading 0 bytes of aBtyesLike removed.

+
utils . zeroPad ( aBytesLike , length ) Uint8Array

Retutns a Uint8Array of the data in aBytesLike with 0 bytes prepended to length bytes long.

If aBytesLike is already longer than length bytes long, an InvalidArgument error will be thrown.

+

Hexstring Manipulation

+ +
utils . hexConcat ( arrayOfBytesLike ) DataHexstring

Concatenates all the BytesLike in arrayOfBytesLike into a single DataHexstring

+
utils . hexDataLength ( aBytesLike ) DataHexstring

Returns the length (in bytes) of aBytesLike.

+
utils . hexDataSlice ( aBytesLike , offset [ , endOffset ] ) DataHexstring

Returns a DataHexstring representation of a slice of aBytesLike, from offset (in bytes) to endOffset (in bytes). If endOffset is omitted, the length of aBytesLike is used.

+
utils . hexStripZeros ( aBytesLike ) Hexstring

Returns a Hexstring representation of aBytesLike with all leading zeros removed.

+
utils . hexZeroPad ( aBytesLike , length ) DataHexstring

Returns a DataHexstring representation of aBytesLike padded to length bytes.

If aBytesLike is already longer than length bytes long, an InvalidArgument error will be thrown.

+

Signature Conversion

+ +
utils . joinSignature ( aSignatureLike ) DataHexstring

Return the flat-format of aSignaturelike, which is 65 bytes (130 nibbles) long, concatenating the r, s and (normalized) v of a Signature.

+
utils . splitSignature ( aSignatureLikeOrBytesLike ) Signature

Return the full expanded-format of aSignaturelike or a flat-format DataHexstring. Any missing properties will be computed.

\ No newline at end of file diff --git a/docs/api/utils/constants/README.md b/docs/api/utils/constants/README.md index 3aa493d42..92e834637 100644 --- a/docs/api/utils/constants/README.md +++ b/docs/api/utils/constants/README.md @@ -17,8 +17,7 @@ The **ethers.contants** Object contains commonly used values. ```javascript -//const { constants } = require("ethers"); -// const { constants } = require("@ethersproject/constants"); +Skipping JavaScript Evaluation. ``` @@ -28,14 +27,14 @@ Bytes -#### *constants* . **AddressZero** +#### *constants* . **AddressZero** **=>** *[DataHexstring](../bytes)* The Address Zero, which is 20 bytes (40 nibbles) of zero. -#### *constants* . **HashZero** +#### *constants* . **HashZero** **=>** *[DataHexstring](../bytes)* The Hash Zero, which is 32 bytes (64 nibbles) of zero. @@ -47,7 +46,7 @@ Strings -#### *constants* . **EtherSymbol** +#### *constants* . **EtherSymbol** **=>** *string* The Ether symbol, **Ξ**. @@ -59,35 +58,35 @@ BigNumber -#### *constants* . **NegativeOne** +#### *constants* . **NegativeOne** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"-1"`. -#### *constants* . **Zero** +#### *constants* . **Zero** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"0"`. -#### *constants* . **One** +#### *constants* . **One** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"1"`. -#### *constants* . **Two** +#### *constants* . **Two** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"2"`. -#### *constants* . **WeiPerEther** +#### *constants* . **WeiPerEther** **=>** *[BigNumber](../bignumber)* The BigNumber value representing `"1000000000000000000"`, which is the number of Wei per Ether. @@ -95,7 +94,7 @@ number of Wei per Ether. -#### *constants* . **MaxUint256** +#### *constants* . **MaxUint256** **=>** *[BigNumber](../bignumber)* The BigNumber value representing the maximum `uint256` value. @@ -104,4 +103,4 @@ The BigNumber value representing the maximum `uint256` value. ----- -**Content Hash:** a781a8990aec282632e70ebc003a711adf5bc7773243aed727fc37a0934097f7 \ No newline at end of file +**Content Hash:** 11a9a2e37a2a553b79931caf5374bcd894edf343a897c4253ddeaf4d2f8e1213 \ No newline at end of file diff --git a/docs/api/utils/constants/index.html b/docs/api/utils/constants/index.html index 6e5df998c..ea4bf5ffc 100644 --- a/docs/api/utils/constants/index.html +++ b/docs/api/utils/constants/index.html @@ -1,22 +1,22 @@ -Constants
-

Constants

+Constants
+

Constants

The ethers.contants Object contains commonly used values.

-

Importing

+

Importing

-

//const { constants } = require("ethers");
// const { constants } = require("@ethersproject/constants");
+
Skipping JavaScript Evaluation.
-

Bytes

+

Bytes

-
constants . AddressZero

The Address Zero, which is 20 bytes (40 nibbles) of zero.

-
constants . HashZero

The Hash Zero, which is 32 bytes (64 nibbles) of zero.

-

Strings

+
constants . AddressZero DataHexstring

The Address Zero, which is 20 bytes (40 nibbles) of zero.

+
constants . HashZero DataHexstring

The Hash Zero, which is 32 bytes (64 nibbles) of zero.

+

Strings

-
constants . EtherSymbol

The Ether symbol, Ξ.

-

BigNumber

+
constants . EtherSymbol string

The Ether symbol, Ξ.

+

BigNumber

-
constants . NegativeOne

The BigNumber value representing "-1".

-
constants . Zero

The BigNumber value representing "0".

-
constants . One

The BigNumber value representing "1".

-
constants . Two

The BigNumber value representing "2".

-
constants . WeiPerEther

The BigNumber value representing "1000000000000000000", which is the number of Wei per Ether.

-
constants . MaxUint256

The BigNumber value representing the maximum uint256 value.

\ No newline at end of file +
constants . NegativeOne BigNumber

The BigNumber value representing "-1".

+
constants . Zero BigNumber

The BigNumber value representing "0".

+
constants . One BigNumber

The BigNumber value representing "1".

+
constants . Two BigNumber

The BigNumber value representing "2".

+
constants . WeiPerEther BigNumber

The BigNumber value representing "1000000000000000000", which is the number of Wei per Ether.

+
constants . MaxUint256 BigNumber

The BigNumber value representing the maximum uint256 value.

\ No newline at end of file diff --git a/docs/api/utils/display-logic/index.html b/docs/api/utils/display-logic/index.html index b3817de7d..2c1964070 100644 --- a/docs/api/utils/display-logic/index.html +++ b/docs/api/utils/display-logic/index.html @@ -1,20 +1,20 @@ -Display Logic and Input
-

Display Logic and Input

+Display Logic and Input
+

Display Logic and Input

When creating an Application, it is useful to convert between user-friendly strings (usually displaying ether) and the machine-readable values that contracts and maths depend on (usually in wei).

For example, a Wallet may specify the balance in ether, and gas prices in gwei for the User Interface, but when sending a transaction, both must be specified in wei.

The parseUnits will parse a string representing ether, such as 1.1 into a BigNumber in wei, and is useful when a user types in a value, such as sending 1.1 ether.

The formatUnits will format a BigNumberish into a string, which is useful when displaying a balance.

-

Units

+

Units

-

Decimal Count

+

Decimal Count

The unit specified may be an integer, which indicates how many decimal place the unit has. For example, 1 ether has 18 decimal places for wei, and if this library were used with Bitcoin, 1 BTC has 8 decimal places for satoshis.

-

Named Units

+

Named Units

In addition to specifying unit as a number of decimals, there are several common units, which can be passed in as a string:

  • wei — 0
  • kwei — 3
  • mwei — 6
  • gwei — 9
  • szabo — 12
  • finney — 15
  • ether — 18
-

Functions

+

Functions

-

Formatting

+

Formatting

-
utils . commify ( value ) string

Returns a string with value grouped by 3 digits, separated by ,.

-

Conversion

+
utils . commify ( value ) string

Returns a string with value grouped by 3 digits, separated by ,.

+

Conversion

-
utils . formatUnits ( value [ , unit = "ether" ] ) string

Returns a string representation of value formatted with unit digits (if it is a number) or to the unit specified (if a string).

-
utils . formatEther ( value ) string

The equivalent to calling formatUnits(value, "ether").

-
utils . parseUnits ( value [ , unit = "ether" ] ) BigNumber

Returns a BigNumber representation of value, parsed with unit digits (if it is a number) or from the unit specified (if a string).

-
utils . parseEther ( value ) BigNumber

The equivalent to calling parseUnits(value, "ether").

\ No newline at end of file +
utils . formatUnits ( value [ , unit = "ether" ] ) string

Returns a string representation of value formatted with unit digits (if it is a number) or to the unit specified (if a string).

+
utils . formatEther ( value ) string

The equivalent to calling formatUnits(value, "ether").

+
utils . parseUnits ( value [ , unit = "ether" ] ) BigNumber

Returns a BigNumber representation of value, parsed with unit digits (if it is a number) or from the unit specified (if a string).

+
utils . parseEther ( value ) BigNumber

The equivalent to calling parseUnits(value, "ether").

\ No newline at end of file diff --git a/docs/api/utils/fixednumber/index.html b/docs/api/utils/fixednumber/index.html index 2ad5311c6..40705fe4f 100644 --- a/docs/api/utils/fixednumber/index.html +++ b/docs/api/utils/fixednumber/index.html @@ -1,35 +1,35 @@ -Fixed Number
-

FixedNumber

+Fixed Number
+

FixedNumber

-

Types

+

Types

-

FixedFormat

+

FixedFormat

TODO

-
"fixed"

A shorthand for fixed128x80.

-

Creating Instances

+
"fixed"

A shorthand for fixed128x80.

+

Creating Instances

The FixedNumber constructor cannot be called directly. There are several static methods for creating a FixedNumber.

-
BigNumber . from ( value [ , format = "fixed" ] ) FixedNumber

Returns an instance of a FixedNumber for value as a format.

-
BigNumber . fromBytes ( aBytesLike [ , format = "fixed" ] ) FixedNumber

Returns an instance of a FixedNumber for value as a format.

-
BigNumber . fromString ( value [ , format = "fixed" ] ) FixedNumber

Returns an instance of a FixedNumber for value as a format. The value must not contain more decimals than the format permits.

-
BigNumber . fromValue ( value [ , decimals = 0 [ , format = "fixed" ] ] ) FixedNumber

Returns an instance of a FixedNumber for value with decimals as a format.

-

Properties

+
BigNumber . from ( value [ , format = "fixed" ] ) FixedNumber

Returns an instance of a FixedNumber for value as a format.

+
BigNumber . fromBytes ( aBytesLike [ , format = "fixed" ] ) FixedNumber

Returns an instance of a FixedNumber for value as a format.

+
BigNumber . fromString ( value [ , format = "fixed" ] ) FixedNumber

Returns an instance of a FixedNumber for value as a format. The value must not contain more decimals than the format permits.

+
BigNumber . fromValue ( value [ , decimals = 0 [ , format = "fixed" ] ] ) FixedNumber

Returns an instance of a FixedNumber for value with decimals as a format.

+

Properties

-
fixednumber . format

The FixedFormat of fixednumber.

-

Methods

+
fixednumber . format

The FixedFormat of fixednumber.

+

Methods

-

Math Operations

+

Math Operations

-
fixednumber . addUnsafe ( otherValue ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue + otherValue.

-
fixednumber . subUnsafe ( otherValue ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue otherValue.

-
fixednumber . mulUnsafe ( otherValue ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue × otherValue.

-
fixednumber . divUnsafe ( otherValue ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue ÷ otherValue.

-
fixednumber . round ( [ decimals = 0 ] ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue rounded to decimals.

-

Conversion

+
fixednumber . addUnsafe ( otherValue ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue + otherValue.

+
fixednumber . subUnsafe ( otherValue ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue otherValue.

+
fixednumber . mulUnsafe ( otherValue ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue × otherValue.

+
fixednumber . divUnsafe ( otherValue ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue ÷ otherValue.

+
fixednumber . round ( [ decimals = 0 ] ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue rounded to decimals.

+

Conversion

-
fixednumber . toFormat ( format ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue with format.

-
fixednumber . toHexString ( ) string

Returns a Hexstring representation of fixednumber.

-
fixednumber . toString ( ) string

Returns a string representation of fixednumber.

-
fixednumber . toUnsafeFloat ( ) float

Returns a floating-point JavaScript number value of fixednumber. Due to rounding in JavaScript numbers, the value is only approximate.

-

Inspection

+
fixednumber . toFormat ( format ) FixedNumber

Returns a new FixedNumber with the value of fixedvalue with format.

+
fixednumber . toHexString ( ) string

Returns a Hexstring representation of fixednumber.

+
fixednumber . toString ( ) string

Returns a string representation of fixednumber.

+
fixednumber . toUnsafeFloat ( ) float

Returns a floating-point JavaScript number value of fixednumber. Due to rounding in JavaScript numbers, the value is only approximate.

+

Inspection

-
BigNumber . isFixedNumber ( value ) boolean

Returns true if and only if value is a FixedNumber.

\ No newline at end of file +
BigNumber . isFixedNumber ( value ) boolean

Returns true if and only if value is a FixedNumber.

\ No newline at end of file diff --git a/docs/api/utils/hashing/README.md b/docs/api/utils/hashing/README.md index d6451f5c4..a459b20a7 100644 --- a/docs/api/utils/hashing/README.md +++ b/docs/api/utils/hashing/README.md @@ -20,35 +20,35 @@ The [Cryptographic Hash Functions](https://en.wikipedia.org/wiki/Cryptographic_h are a specific family of hash functions. -#### *utils* . **keccak256** ( aBytesLike ) **=>** *string* +#### *utils* . **keccak256** ( aBytesLike ) **=>** *[DataHexstring](../bytes)* Returns the [KECCAK256](https://en.wikipedia.org/wiki/SHA-3) digest *aBytesLike*. -#### *utils* . **ripemd160** ( aBytesLike ) **=>** *string* +#### *utils* . **ripemd160** ( aBytesLike ) **=>** *[DataHexstring](../bytes)* Returns the [RIPEMD-160](https://en.m.wikipedia.org/wiki/RIPEMD) digest of *aBytesLike*. -#### *utils* . **sha256** ( aBytesLike ) **=>** *string* +#### *utils* . **sha256** ( aBytesLike ) **=>** *[DataHexstring](../bytes)* Returns the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*. -#### *utils* . **sha512** ( aBytesLike ) **=>** *string* +#### *utils* . **sha512** ( aBytesLike ) **=>** *[DataHexstring](../bytes)* Returns the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) digest of *aBytesLike*. -#### *utils* . **computeHmac** ( algorithm , key , data ) **=>** *string* +#### *utils* . **computeHmac** ( algorithm , key , data ) **=>** *[DataHexstring](../bytes)* Returns the [HMAC](https://en.wikipedia.org/wiki/HMAC) of *data* with *key* using the [Algorithm](./) *algorithm*. @@ -60,14 +60,14 @@ using the [Algorithm](./) *algorithm*. -#### *utils* . *SupportedAlgorithms* . **sha256** +#### *utils* . *SupportedAlgorithms* . **sha256** **=>** *string* Use the [SHA2-256](https://en.wikipedia.org/wiki/SHA-2) hash algorithm. -#### *utils* . *SupportedAlgorithms* . **sha512** +#### *utils* . *SupportedAlgorithms* . **sha512** **=>** *string* Use the [SHA2-512](https://en.wikipedia.org/wiki/SHA-2) hash algorithm. @@ -79,7 +79,7 @@ Common Hashing Helpers -#### *utils* . **hashMessage** ( message ) **=>** *string* +#### *utils* . **hashMessage** ( message ) **=>** *[DataHexstring](../bytes)* Computes the Ethereum message digest of *message*. Ethereum messages are converted to UTF-8 bytes and prefixed with `x19Ethereum Signed Message:` @@ -88,14 +88,14 @@ and the length of *message*. -#### *utils* . **id** ( text ) **=>** *string* +#### *utils* . **id** ( text ) **=>** *[DataHexstring](../bytes)* The Ethereum Identity function computs the keccak256 hash of the *text* bytes. -#### *utils* . **namehash** ( name ) **=>** *string* +#### *utils* . **namehash** ( name ) **=>** *[DataHexstring](../bytes)* Returns the [ENS Namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names) of *name*. @@ -111,7 +111,7 @@ When using the Solidity `abi.packEncoded(...)` function, a non-standard the tightly packing algorithm. -#### *utils* . **solidityPack** ( arrayOfTypes , arrayOfValues ) **=>** *string* +#### *utils* . **solidityPack** ( arrayOfTypes , arrayOfValues ) **=>** *[DataHexstring](../bytes)* Returns the non-standard encoded *arrayOfValues* packed according to their respecive type in *arrayOfTypes*. @@ -119,7 +119,7 @@ their respecive type in *arrayOfTypes*. -#### *utils* . **solidityKeccak256** ( arrayOfTypes , arrayOfValues ) **=>** *string* +#### *utils* . **solidityKeccak256** ( arrayOfTypes , arrayOfValues ) **=>** *[DataHexstring](../bytes)* Returns the KECCAK256 of the non-standard encoded *arrayOfValues* packed according to their respective type in *arrayOfTypes*. @@ -127,7 +127,7 @@ according to their respective type in *arrayOfTypes*. -#### *utils* . **soliditySha256** ( arrayOfTypes , arrayOfValues ) **=>** *string* +#### *utils* . **soliditySha256** ( arrayOfTypes , arrayOfValues ) **=>** *[DataHexstring](../bytes)* Returns the SHA2-256 of the non-standard encoded *arrayOfValues* packed according to their respective type in *arrayOfTypes*. @@ -137,4 +137,4 @@ according to their respective type in *arrayOfTypes*. ----- -**Content Hash:** 65dd2158ef160da7be3291c8e7aac15df2de683869df9c31b8efdaa39551b3e4 \ No newline at end of file +**Content Hash:** 53b7b2b1fe243aebd3d5ff29c578538d0d068b0ff60b3426f7208cbf9f13d312 \ No newline at end of file diff --git a/docs/api/utils/hashing/index.html b/docs/api/utils/hashing/index.html index 8140b6cd8..10d34d990 100644 --- a/docs/api/utils/hashing/index.html +++ b/docs/api/utils/hashing/index.html @@ -1,24 +1,24 @@ -Hashing
-

Hashing Algorithms

+Hashing
+

Hashing Algorithms

Explain what hash functions are?

-

Cryptographic Hashing

+

Cryptographic Hashing

The Cryptographic Hash Functions are a specific family of hash functions.

-
utils . keccak256 ( aBytesLike ) string

Returns the KECCAK256 digest aBytesLike.

-
utils . ripemd160 ( aBytesLike ) string

Returns the RIPEMD-160 digest of aBytesLike.

-
utils . sha256 ( aBytesLike ) string

Returns the SHA2-256 digest of aBytesLike.

-
utils . sha512 ( aBytesLike ) string

Returns the SHA2-512 digest of aBytesLike.

-
utils . computeHmac ( algorithm , key , data ) string

Returns the HMAC of data with key using the Algorithm algorithm.

-

HMAC Supported Algorithms

+
utils . keccak256 ( aBytesLike ) DataHexstring

Returns the KECCAK256 digest aBytesLike//.

+
utils . ripemd160 ( aBytesLike ) DataHexstring

Returns the RIPEMD-160 digest of aBytesLike//.

+
utils . sha256 ( aBytesLike ) DataHexstring

Returns the SHA2-256 digest of aBytesLike//.

+
utils . sha512 ( aBytesLike ) DataHexstring

Returns the SHA2-512 digest of aBytesLike//.

+
utils . computeHmac ( algorithm , key , data ) DataHexstring

Returns the HMAC of data with key using the Algorithm algorithm//.

+

HMAC Supported Algorithms

-
utils . SupportedAlgorithms . sha256

Use the SHA2-256 hash algorithm.

-
utils . SupportedAlgorithms . sha512

Use the SHA2-512 hash algorithm.

-

Common Hashing Helpers

+
utils . SupportedAlgorithms . sha256 string

Use the SHA2-256 hash algorithm.

+
utils . SupportedAlgorithms . sha512 string

Use the SHA2-512 hash algorithm.

+

Common Hashing Helpers

-
utils . hashMessage ( message ) string

Computes the Ethereum message digest of message. Ethereum messages are converted to UTF-8 bytes and prefixed with x19Ethereum Signed Message: and the length of message.

-
utils . id ( text ) string

The Ethereum Identity function computs the keccak256 hash of the text bytes.

-
utils . namehash ( name ) string

Returns the ENS Namehash of name.

-

Solidity Hashing Algorithms

+
utils . hashMessage ( message ) DataHexstring

Computes the Ethereum message digest of message. Ethereum messages are converted to UTF-8 bytes and prefixed with x19Ethereum Signed Message: and the length of message.

+
utils . id ( text ) DataHexstring

The Ethereum Identity function computs the keccak256 hash of the text bytes.

+
utils . namehash ( name ) DataHexstring

Returns the ENS Namehash of name//.

+

Solidity Hashing Algorithms

When using the Solidity abi.packEncoded(...) function, a non-standard tightly packed version of encoding is used. These functions implement the tightly packing algorithm.

-
utils . solidityPack ( arrayOfTypes , arrayOfValues ) string

Returns the non-standard encoded arrayOfValues packed according to their respecive type in arrayOfTypes.

-
utils . solidityKeccak256 ( arrayOfTypes , arrayOfValues ) string

Returns the KECCAK256 of the non-standard encoded arrayOfValues packed according to their respective type in arrayOfTypes.

-
utils . soliditySha256 ( arrayOfTypes , arrayOfValues ) string

Returns the SHA2-256 of the non-standard encoded arrayOfValues packed according to their respective type in arrayOfTypes.

\ No newline at end of file +
utils . solidityPack ( arrayOfTypes , arrayOfValues ) DataHexstring

Returns the non-standard encoded arrayOfValues packed according to their respecive type in arrayOfTypes.

+
utils . solidityKeccak256 ( arrayOfTypes , arrayOfValues ) DataHexstring

Returns the KECCAK256 of the non-standard encoded arrayOfValues packed according to their respective type in arrayOfTypes.

+
utils . soliditySha256 ( arrayOfTypes , arrayOfValues ) DataHexstring

Returns the SHA2-256 of the non-standard encoded arrayOfValues packed according to their respective type in arrayOfTypes.

\ No newline at end of file diff --git a/docs/api/utils/index.html b/docs/api/utils/index.html index 7b6d73a41..f00286e48 100644 --- a/docs/api/utils/index.html +++ b/docs/api/utils/index.html @@ -1,4 +1,4 @@ -Utilities
-

Utilities

+Utilities \ No newline at end of file +
\ No newline at end of file diff --git a/docs/api/utils/strings/README.md b/docs/api/utils/strings/README.md index d481cb0c5..57257b2e7 100644 --- a/docs/api/utils/strings/README.md +++ b/docs/api/utils/strings/README.md @@ -27,7 +27,7 @@ null termination, we can store strings up to 31 bytes long in a word. -#### **Note:** +#### Note Strings that are 31 **bytes** long may contain fewer than 31 **characters**, since UTF-8 requires multiple bytes to encode international characters. @@ -143,10 +143,10 @@ See NFKC for more an example. -#### **Note:** +#### Note Only certain specified characters are folded in Canonical Equivalence, and thus -it should not be considered a method to acheive *any* level of security from +it should **not** be considered a method to acheive *any* level of security from [homoglyph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack). @@ -154,4 +154,4 @@ it should not be considered a method to acheive *any* level of security from ----- -**Content Hash:** 74002cd3d9368872b5618f68967deac34a4d1aeafeeac6ddb5c1d06a450180c9 \ No newline at end of file +**Content Hash:** e38fe18f76e58587f7ed1c4558a5b3ec177eee1a5e71b4c88fa6d496154fdd8a \ No newline at end of file diff --git a/docs/api/utils/strings/index.html b/docs/api/utils/strings/index.html index 99748b178..3021930af 100644 --- a/docs/api/utils/strings/index.html +++ b/docs/api/utils/strings/index.html @@ -1,21 +1,21 @@ -Strings
-

Strings

+Strings
+

Strings

Tra la la

-

Bytes32String

+

Bytes32String

A string in Solidity is length prefixed with its 256-bit (32 byte) length, which means that even short strings require 2 words (64 bytes) of storage.

In many cases, we deal with short strings, so instead of prefixing the string with its length, we can null-terminate it and fit it in a single word (32 bytes). Since we need only a single byte for the null termination, we can store strings up to 31 bytes long in a word.

-
Note:

Strings that are 31 bytes long may contain fewer than 31 characters, since UTF-8 requires multiple bytes to encode international characters.

-
utils . parseBytes32String ( aBytesLike ) string

Returns the decoded string represented by the Bytes32 encoded data.

-
utils . formatBytes32String ( text ) string

Returns a bytes32 string representation of text. If the length of text exceeds 31 bytes, it will throw an error.

-

UTF-8 Strings

+
Note

Strings that are 31 bytes long may contain fewer than 31 characters, since UTF-8 requires multiple bytes to encode international characters.

+
utils . parseBytes32String ( aBytesLike ) string

Returns the decoded string represented by the Bytes32 encoded data.

+
utils . formatBytes32String ( text ) string

Returns a bytes32 string representation of text. If the length of text exceeds 31 bytes, it will throw an error.

+

UTF-8 Strings

-
utils . toUtf8Bytes ( text [ , form = current ] ) Uint8Array

Returns the UTF-8 bytes of text, optionally normalizing it using the UnicodeNormalizationForm form.

-
utils . toUtf8CodePoints ( aBytesLike [ , form = current ] ) Array< number >

Returns the Array of codepoints of aBytesLike, optionally normalizing it using the UnicodeNormalizationForm form.

Note: This function correctly splits each user-perceived character into its codepoint, accounting for surrogate pairs. This should not be confused with string.split(""), which destroys surrogate pairs, spliting between each UTF-16 codeunit instead.

-
utils . toUtf8String ( aBytesLike [ , ignoreErrors = false ] ) string

Returns the string represented by the UTF-8 bytes of aBytesLike. This will throw an error for invalid surrogates, overlong sequences or other UTF-8 issues, unless ignoreErrors is specified.

-

UnicodeNormalizationForm

+
utils . toUtf8Bytes ( text [ , form = current ] ) Uint8Array

Returns the UTF-8 bytes of text, optionally normalizing it using the UnicodeNormalizationForm form.

+
utils . toUtf8CodePoints ( aBytesLike [ , form = current ] ) Array< number >

Returns the Array of codepoints of aBytesLike, optionally normalizing it using the UnicodeNormalizationForm form.

Note: This function correctly splits each user-perceived character into its codepoint, accounting for surrogate pairs. This should not be confused with string.split(""), which destroys surrogate pairs, spliting between each UTF-16 codeunit instead.

+
utils . toUtf8String ( aBytesLike [ , ignoreErrors = false ] ) string

Returns the string represented by the UTF-8 bytes of aBytesLike. This will throw an error for invalid surrogates, overlong sequences or other UTF-8 issues, unless ignoreErrors is specified.

+

UnicodeNormalizationForm

There are several commonly used forms when normalizing UTF-8 data, which allow strings to be compared or hashed in a stable way.

-
utils . UnicodeNormalizationForm . current

Maintain the current normalization form.

-
utils . UnicodeNormalizationForm . NFC

The Composed Normalization Form. This form uses single codepoints which represent the fully composed character.

For example, the é is a single codepoint, 0x00e9.

-
utils . UnicodeNormalizationForm . NFD

The Decomposed Normalization Form. This form uses multiple codepoints (when necessary) to compose a character.

For example, the é is made up of two codepoints, "0x0065" (which is the letter "e") and "0x0301" which is a special diacritic UTF-8 codepoint which indicates the previous character should have an acute accent.

-
utils . UnicodeNormalizationForm . NFKC

The Composed Normalization Form with Canonical Equivalence. The Canonical representation folds characters which have the same syntactic representation but different semantic meaning.

For example, the Roman Numeral I, which has a UTF-8 codepoint "0x2160", is folded into the capital letter I, "0x0049".

-
utils . UnicodeNormalizationForm . NFKD

The Decomposed Normalization Form with Canonical Equivalence. See NFKC for more an example.

-
Note:

Only certain specified characters are folded in Canonical Equivalence, and thus it should not be considered a method to acheive any level of security from homoglyph attacks.

\ No newline at end of file +
utils . UnicodeNormalizationForm . current

Maintain the current normalization form.

+
utils . UnicodeNormalizationForm . NFC

The Composed Normalization Form. This form uses single codepoints which represent the fully composed character.

For example, the é is a single codepoint, 0x00e9.

+
utils . UnicodeNormalizationForm . NFD

The Decomposed Normalization Form. This form uses multiple codepoints (when necessary) to compose a character.

For example, the é is made up of two codepoints, "0x0065" (which is the letter "e") and "0x0301" which is a special diacritic UTF-8 codepoint which indicates the previous character should have an acute accent.

+
utils . UnicodeNormalizationForm . NFKC

The Composed Normalization Form with Canonical Equivalence. The Canonical representation folds characters which have the same syntactic representation but different semantic meaning.

For example, the Roman Numeral I, which has a UTF-8 codepoint "0x2160", is folded into the capital letter I, "0x0049".

+
utils . UnicodeNormalizationForm . NFKD

The Decomposed Normalization Form with Canonical Equivalence. See NFKC for more an example.

+
Note

Only certain specified characters are folded in Canonical Equivalence, and thus it should not be considered a method to acheive any level of security from homoglyph attacks.

\ No newline at end of file diff --git a/docs/concepts/README.md b/docs/concepts/README.md index 0161cc00f..633c0442a 100644 --- a/docs/concepts/README.md +++ b/docs/concepts/README.md @@ -14,6 +14,7 @@ which developers can make use of or should be aware of. * [Events](events) + * [Solidity Topics](events) * [Gas](gas) * [Gas Price](gas) * [Gas Limit](gas) @@ -21,4 +22,4 @@ which developers can make use of or should be aware of. ----- -**Content Hash:** ad59f45600332d936821db1fa0d0eeabdab5b4f252e1e815de525b4d1b9a9a7b \ No newline at end of file +**Content Hash:** 1846ad5571101be31cf9617167b5cc53338c83c0fc9389da19c8dd9d4153558b \ No newline at end of file diff --git a/docs/concepts/events/README.md b/docs/concepts/events/README.md index 979b3bb0c..fd6fcc1ad 100644 --- a/docs/concepts/events/README.md +++ b/docs/concepts/events/README.md @@ -12,6 +12,13 @@ Events Explain how topics and such work +Solidity Topics +--------------- + + +How to compute the topic... + + ----- -**Content Hash:** 4b045e823bf9863272ddb1c5a8460bc461de2ad262503dc27829b64b57344d46 \ No newline at end of file +**Content Hash:** 1334c1751891f09ab9349dcc5b7e6705ef823cd7b15a18433c053c764c6b9042 \ No newline at end of file diff --git a/docs/concepts/events/index.html b/docs/concepts/events/index.html index c39b914e7..c2cf8ef23 100644 --- a/docs/concepts/events/index.html +++ b/docs/concepts/events/index.html @@ -1,3 +1,5 @@ -Events
-

Events

-

Explain how topics and such work

\ No newline at end of file +Events
+

Events

+

Explain how topics and such work

+

Solidity Topics

+

How to compute the topic...

\ No newline at end of file diff --git a/docs/concepts/gas/README.md b/docs/concepts/gas/README.md index 7ae0d8b5d..e6696e2da 100644 --- a/docs/concepts/gas/README.md +++ b/docs/concepts/gas/README.md @@ -9,6 +9,8 @@ Gas === +Explain attack vectors + Gas Price --------- @@ -26,4 +28,4 @@ Gas Limit ----- -**Content Hash:** 4cc3001196d861faac19ebc393e002ce9e6f24702b66bac62ef8f9185625b3dc \ No newline at end of file +**Content Hash:** 2805374ab42eae31d185e96ae9308f0661dc826d460b33005a86f62fc2f17703 \ No newline at end of file diff --git a/docs/concepts/gas/index.html b/docs/concepts/gas/index.html index a1833329a..05b5c3ca1 100644 --- a/docs/concepts/gas/index.html +++ b/docs/concepts/gas/index.html @@ -1,7 +1,7 @@ -Gas
-

Gas

- -

Gas Price

+Gas
+

Gas

+

Explain attack vectors

+

Gas Price

The gas price is used somewhat like a bid, indicating an amount you are willing to pay (per unit of execution) to have your transaction processed.

-

Gas Limit

-
\ No newline at end of file +

Gas Limit

+
\ No newline at end of file diff --git a/docs/concepts/index.html b/docs/concepts/index.html index 9b5640560..ffd4471c0 100644 --- a/docs/concepts/index.html +++ b/docs/concepts/index.html @@ -1,4 +1,4 @@ -Concepts
-

Concepts

+Concepts
+

Concepts

This is a very breif overview of some aspects of Ethereum which developers can make use of or should be aware of.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/contributing/index.html b/docs/contributing/index.html index 571c68a8d..1b6bc6f7e 100644 --- a/docs/contributing/index.html +++ b/docs/contributing/index.html @@ -1,5 +1,5 @@ -Contributing and Hacking
-

Contributing and Hacking

+Contributing and Hacking
+

Contributing and Hacking

The ethers.js library is something that I've written out of necessity, and has grown somewhat organically over time.

Many things are the way they are for good (at the time, at least) reasons, but I always welcome criticism, and am completely willing to have my mind changed on things.

So, pull requests are always welcome, but please keep a few points in mind:

  • Backwards-compatibility-breaking changes will not be accepted; they may be considered for the next major version
  • Security is important; adding dependencies require fairly convincing arguments as to why
  • The library aims to be lean, so keep an eye on the dist/ethers.min.js file size before and after your changes
  • Add test cases for both expected and unexpected input
  • Any new features need to be supported by me (future issues, documentation, testing, migration), so anything that is overly complicated or specific may not be accepted

In general, please start an issue before beginning a pull request, so we can have a public discussion and figure out the best way to address to problem/feature. :)

-

Building

-

use npm run auto-build

use npm run update-version

\ No newline at end of file +

Building

+

use npm run auto-build

use npm run update-version

\ No newline at end of file diff --git a/docs/cookbook/index.html b/docs/cookbook/index.html index 0a87689a0..a64d123b8 100644 --- a/docs/cookbook/index.html +++ b/docs/cookbook/index.html @@ -1,3 +1,3 @@ -Cookbook
-

Cookbook

-

Cooking...

\ No newline at end of file +Cookbook
+

Cookbook

+

Cooking...

\ No newline at end of file diff --git a/docs/documentation/README.md b/docs/documentation/README.md index 3dd224652..b174328ed 100644 --- a/docs/documentation/README.md +++ b/docs/documentation/README.md @@ -149,6 +149,7 @@ _toc: _null: This breaks out of a directive. For example, to end a + _definition and reset the indentation. ``` @@ -194,4 +195,4 @@ This is a self-titled link [[https://ethereumorg]] and this ----- -**Content Hash:** 6cc55a98e7a50c76c8b27fbc7aae97bebaf9355a40b9c44a568f2f7fd927da57 \ No newline at end of file +**Content Hash:** 2d45e62661589ea3cdf50cc4da9faf63c33b7385840b31fddaf9d3cbe35d6015 \ No newline at end of file diff --git a/docs/documentation/index.html b/docs/documentation/index.html index 06fd35841..da74d31e7 100644 --- a/docs/documentation/index.html +++ b/docs/documentation/index.html @@ -1,27 +1,27 @@ -Flatworm Docs
-

Flatworm Docs

-

The Flatworm Docs rendering script is designed to be very simple, but provide enough formatting necessary for documenting JavaScript libraries.

A lot of its inspiration came from Read the Docs and the Sphinx project.

-

Fragments

+Flatworm Docs
+

Flatworm Docs

+

The Flatworm Docs rendering script is designed to be very simple, but provide enough formatting necessary for documenting JavaScript libraries.

A lot of its inspiration came from Read the Docs and the Sphinx project.

+

Fragments

Flatworm Docs are made up of fragments. A fragment is either a lone body of markdown text, or a directive for specialized formatting, which may itself have body.

-

Directive Format

+

Directive Format

_DIRECTIVE: VALUE @<LINK>
BODY

DIRECTIVE: The directive name
VALUE:     Optional; the value to pass to the directive
LINK:      Optional; a name for internal linking
BODY:      Optional; the directive body (certain directives only)
-

Flatworm Directives

+

Flatworm Directives

-
_section: TITLE

A section has its TITLE in an H1 font. Sections are linked to in Table of Contents and have a dividing line drawn above them. If an option is specified, it is avaialble as a name for intern linking. There should only be one _section: per page.

-
_subsection: TITLE

A subsection has its TITLE in an H2 font. Subsections are linked to in Table of Contents and have a dividing line drawn above them. If an option is specified, it is avaialble as a name for internal linking.

-
_heading: TITLE

A heading has its TITLE in an H3 font. If an option is specified, it is available as a name for internal linking.

-
_definition: TERM

A definition has its TERM bolded and the markdown body is indented.

-
_property: SIGNATURE

A property has its JavaScript SIGNATURE formatted and the markdown body is indented.

-
_code: FILENAME

A code reads the FILENAME and depending on the extension adjusts it.

For JavaScript files, the file is executed, with //! replaced with the result of the last statement and //!error is replaced with the throw error. If the error state does not agree, rendering fails.

-
_toc:

A toc injects a Table of Contents, loading each line of the body as a filename and recursively loads the toc if present, otherwise all the sections and subsections.

-
_null:

A null is used to terminated a directive. For example, after a definition, the bodies are indented, so a null can be used to reset the indentation.

-

Examples

+
_section: TITLE

A section has its TITLE in an H1 font. Sections are linked to in Table of Contents and have a dividing line drawn above them. If an option is specified, it is avaialble as a name for intern linking. There should only be one _section: per page.

+
_subsection: TITLE

A subsection has its TITLE in an H2 font. Subsections are linked to in Table of Contents and have a dividing line drawn above them. If an option is specified, it is avaialble as a name for internal linking.

+
_heading: TITLE

A heading has its TITLE in an H3 font. If an option is specified, it is available as a name for internal linking.

+
_definition: TERM

A definition has its TERM bolded and the markdown body is indented.

+
_property: SIGNATURE

A property has its JavaScript SIGNATURE formatted and the markdown body is indented.

+
_code: FILENAME

A code reads the FILENAME and depending on the extension adjusts it.

For JavaScript files, the file is executed, with //! replaced with the result of the last statement and //!error is replaced with the throw error. If the error state does not agree, rendering fails.

+
_toc:

A toc injects a Table of Contents, loading each line of the body as a filename and recursively loads the toc if present, otherwise all the sections and subsections.

+
_null:

A null is used to terminated a directive. For example, after a definition, the bodies are indented, so a null can be used to reset the indentation.

+

Examples

-
_section: Hello World @<link-to-this-section>

_subsection: Some Example @<link-to-this-subsection>

_heading: Large Bold Text @<link-to-this-heading>

_definition: Flatworm
A phylum of relatively **simple** bilaterian, unsegmented,
soft-bodied invertebrates.

_property: String.fromCharCode(code) => string
Returns a string created from //code//, a sequence of
UTF-16 code units.

_code: filename.js

_toc:
    some-file
    some-directory

_null:
This breaks out of a directive. For example, to end a
_definition and reset the indentation.
+
_section: Hello World @<link-to-this-section>

_subsection: Some Example @<link-to-this-subsection>

_heading: Large Bold Text @<link-to-this-heading>

_definition: Flatworm
A phylum of relatively **simple** bilaterian, unsegmented,
soft-bodied invertebrates.

_property: String.fromCharCode(code) => string
Returns a string created from //code//, a sequence of
UTF-16 code units.

_code: filename.js

_toc:
    some-file
    some-directory

_null:
This breaks out of a directive. For example, to end a

_definition and reset the indentation.
-

Markdown

+

Markdown

The markdown is simple and does not have the flexibility of other dialects, but allows for bold, italic, underlined, monospaced, super-scripted text, supporting links and lists.

**bold text**

//italic text//

__underlined text__

``monospace code``

^^superscript text^^

- This is a list
- With bullet points
- With a total of three items

This is separated by -- an en-dash.

This is separated by --- an em-dash.

This is a [Link to Ethereum](https://ethereum.org) and this
is an [Internal Link](some-link).

This is a self-titled link [[https://ethereumorg]] and this
[[some-link]] will use the title from its directives value.
-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/getting-started/README.md b/docs/getting-started/README.md index daf5bd1d9..dcd8be492 100644 --- a/docs/getting-started/README.md +++ b/docs/getting-started/README.md @@ -50,7 +50,7 @@ const { ethers } = require("ethers"); It is generally better practice (for security reasons) to copy the -[ethers library](https://cdn.ethers.io/lib/ethers-5.0.min.js) to +[ethers library](https://cdn.ethers.io/lib/ethers-5.0.esm.min.js) to your own webserver and serve it yourself. For quick demos or prototyping though, it can be loaded in your @@ -58,7 +58,7 @@ Web Applications from our CDN. ``` - ``` @@ -66,4 +66,4 @@ Web Applications from our CDN. ----- -**Content Hash:** 01b739e7d4410ec57652b8058ae7a5902107ce0b170ecd3550cbc97f4d287fd8 \ No newline at end of file +**Content Hash:** a78889cf0b1215b8268f76e5cef5869b2b592e56a5ce062d58dfcc4f5b93159d \ No newline at end of file diff --git a/docs/getting-started/index.html b/docs/getting-started/index.html index e24301fc9..a9b0c1d4f 100644 --- a/docs/getting-started/index.html +++ b/docs/getting-started/index.html @@ -1,17 +1,17 @@ -Getting Started
-

Getting Started

+Getting Started
+

Getting Started

-

Installing

+

Installing

The various Classes and Functions are available to be imported manually from sub-packages under the @ethersproject but for most projects, the umbrella package is the easiest way to get started.

/home/ricmoo> npm install --save ethers@next
-

Importing

+

Importing

-

Node.js

+

Node.js

// CommonJS
const { ethers } = require("ethers");

// ES6 or TypeScript
const { ethers } = require("ethers");
-

Web Browser

-

It is generally better practice (for security reasons) to copy the ethers library to your own webserver and serve it yourself.

For quick demos or prototyping though, it can be loaded in your Web Applications from our CDN.

-
<script src="https://cdn.ethers.io/lib/ethers-5.0.min.js"
        type="application/javascipt"></script>
-
\ No newline at end of file +

Web Browser

+

It is generally better practice (for security reasons) to copy the ethers library to your own webserver and serve it yourself.

For quick demos or prototyping though, it can be loaded in your Web Applications from our CDN.

+
<script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
        type="application/javascipt"></script>
+
\ No newline at end of file diff --git a/docs/hacking/README.md b/docs/hacking/README.md new file mode 100644 index 000000000..c279bd4e4 --- /dev/null +++ b/docs/hacking/README.md @@ -0,0 +1,70 @@ +----- + +Documentation: [html](https://docs-beta.ethers.io/) + +----- + + +Hacking +======= + + +Things to keep in mind: + + +### Supported Platforms + + +... + + +### Dependencies + + +Adding a dependency is non-trivial and will require fairly convincing +arguments. + +Further, **ALL** dependencies for ethers, **must** be MIT licensed or +public domain (CC0). + +All contributions to ethers are then included under the MIT license. + + +### Printable ASCII (7-bit) Characters + + +All source and documentation files should ONLY use the printable ASCII +set. + +This is for several reasons, bu... + + + +* Transmission over certain HTTP servers and proxies can mangle UTF-8 data +* Certain editors on some platforms, or in certain terminals cannot handle UTF-8 characters elegantly +* The ability to enter non-ASCII characters on some platforms require special keyboards, input devices or input methods to be installed, which either not be supported, or may require administrative priviledges. + + +### License + + +MIT... + + +### Other Considerations + + +A common argument to Pull Requests is that they are simple, backwards compatible +and + +It is important to remember that a small change is something that +we are required to support in perpetuity. + +For example, adding support for an obscure platform, such as adding a dot-file +to the root of the package, now carries the implication that we will continue +keeping that dot-file up-to-date as new versions of that platform are released. + + + +----- +**Content Hash:** 55f49a4430f6cc2ae9ca51a5932a710217a99e253a57173223b869e4378ab8bd \ No newline at end of file diff --git a/docs/hacking/index.html b/docs/hacking/index.html new file mode 100644 index 000000000..24b1705d9 --- /dev/null +++ b/docs/hacking/index.html @@ -0,0 +1,13 @@ +Hacking
+

Hacking

+

Things to keep in mind:

+

Supported Platforms

+

...

+

Dependencies

+

Adding a dependency is non-trivial and will require fairly convincing arguments.

Further, ALL dependencies for ethers, must be MIT licensed or public domain (CC0).

All contributions to ethers are then included under the MIT license.

+

Printable ASCII (7-bit) Characters

+

All source and documentation files should ONLY use the printable ASCII set.

This is for several reasons, bu...

  • Transmission over certain HTTP servers and proxies can mangle UTF-8 data
  • Certain editors on some platforms, or in certain terminals cannot handle UTF-8 characters elegantly
  • The ability to enter non-ASCII characters on some platforms require special keyboards, input devices or input methods to be installed, which either not be supported, or may require administrative priviledges.
+

License

+

MIT...

+

Other Considerations

+

A common argument to Pull Requests is that they are simple, backwards compatible and

It is important to remember that a small change is something that we are required to support in perpetuity.

For example, adding support for an obscure platform, such as adding a dot-file to the root of the package, now carries the implication that we will continue keeping that dot-file up-to-date as new versions of that platform are released.

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 1ccc8dba8..7a3bb89ea 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,10 +1,10 @@ -Documentation
-

What is ethers?

+Documentation
+

What is ethers?

The ethers.js library aims to be a complete and compact library for interacting with the Ethereum Blockchain and its ecosystem. It was originally designed for use with ethers.io and has since expanded into a much more general-purpose library.

-

Features

-
  • Keep your private keys in your client, safe and sound
  • Import and export JSON wallets (Geth, Parity and crowdsale)
  • Import and export BIP 39 mnemonic phrases (12 word backup phrases) and HD Wallets (English, Italian, Japanese, Korean, Simplified Chinese, Traditional Chinese; more coming soon)
  • Meta-classes create JavaScript objects from any contract ABI, including ABIv2 and Human-Readable ABI
  • Connect to Ethereum nodes over JSON-RPC, INFURA, Etherscan, Nodesmith, Alchemy, or MetaMask.
  • ENS names are first-class citizens; they can be used anywhere an Ethereum addresses can be used
  • Tiny (~88kb compressed; 284kb uncompressed)
  • Complete functionality for all your Ethereum needs
  • Extensive documentation
  • Large collection of test cases which are maintained and added to
  • Fully TypeScript ready, with definition files and full TypeScript source
  • MIT License (including ALL dependencies); completely open source to do with as you please
-

Developer Documentation

+

Features

+
  • Keep your private keys in your client, safe and sound
  • Import and export JSON wallets (Geth, Parity and crowdsale)
  • Import and export BIP 39 mnemonic phrases (12 word backup phrases) and HD Wallets (English, Italian, Japanese, Korean, Simplified Chinese, Traditional Chinese; more coming soon)
  • Meta-classes create JavaScript objects from any contract ABI, including ABIv2 and Human-Readable ABI
  • Connect to Ethereum nodes over JSON-RPC, INFURA, Etherscan, Nodesmith, Alchemy, or MetaMask.
  • ENS names are first-class citizens; they can be used anywhere an Ethereum addresses can be used
  • Tiny (~88kb compressed; 284kb uncompressed)
  • Complete functionality for all your Ethereum needs
  • Extensive documentation
  • Large collection of test cases which are maintained and added to
  • Fully TypeScript ready, with definition files and full TypeScript source
  • MIT License (including ALL dependencies); completely open source to do with as you please
+

Developer Documentation

- -

Legacy Documentation

-

This section will be kept up to date, linking to documentation of older versions of the library.

\ No newline at end of file + +

Legacy Documentation

+

This section will be kept up to date, linking to documentation of older versions of the library.

\ No newline at end of file diff --git a/docs/license/index.html b/docs/license/index.html index 4c6fffca1..e5dbf4d0a 100644 --- a/docs/license/index.html +++ b/docs/license/index.html @@ -1,5 +1,5 @@ -License and Copyright
-

License and Copyright

+License and Copyright
+

License and Copyright

The ethers library (including all dependencies) are available under the MIT License, which permits a wide variety of uses.

-

MIT License

-

Copyright © 2019 Richard Moore.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

\ No newline at end of file +

MIT License

+

Copyright © 2019 Richard Moore.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

\ No newline at end of file diff --git a/docs/migration/index.html b/docs/migration/index.html index c90d5bb35..4d86cefe3 100644 --- a/docs/migration/index.html +++ b/docs/migration/index.html @@ -1,7 +1,7 @@ -Migration Guide
-

Migration Guide

+Migration Guide
+

Migration Guide

Migratimg...

-

From Web3

+

From Web3

test

-

From ethers v4

-

test

\ No newline at end of file +

From ethers v4

+

test

\ No newline at end of file diff --git a/docs/static/link.svg b/docs/static/link.svg new file mode 100644 index 000000000..692a38d1d --- /dev/null +++ b/docs/static/link.svg @@ -0,0 +1,15 @@ + + + + + diff --git a/docs/static/style.css b/docs/static/style.css index 20496444e..d4adcbec3 100644 --- a/docs/static/style.css +++ b/docs/static/style.css @@ -312,6 +312,60 @@ div.breadcrumbs span.current { width: 800px; } +.show-anchors > div { + position: relative; +} + +.show-anchors > div > .anchors { + display: block; + height: 100%; + position: absolute; + pointer-events: none; + top: 0; + width: 100%; +} + +.anchors a { + height: 50px; + position: absolute; + line-height: 50px; + pointer-events: auto; + transition: opacity 0.3s linear; + top: 50%; +} + +.anchors a.self { + background: url(./link.svg) center no-repeat; + left: -8px; + opacity: 0; + transform: translate(-100%, -50%); + width: 20px; +} + +.show-anchors:hover > div > .anchors a.self { + opacity: 0.3; +} + +.show-anchors > div > .anchors a.self:hover { + opacity: 1; +} + +.anchors a.source { + right: 0; + opacity: 0.3; + transform: translate(100%, -50%); +} + +.show-anchors:hover > div > .anchors a.source { + opacity: 1; +} + +.anchors a.source:hover { + opacity: 1; +} + + + .definition { margin: 10px 0 0 15px; padding: 10px 0 0 15px; @@ -323,13 +377,53 @@ div.breadcrumbs span.current { .definition .term { font-size: 110%; - dddfont-weight: bold; } +.definition.container-box { + border-radius: 5px; + left: 15px; + margin-bottom: 30px; + margin-top: 30px; + padding: 0; + position: relative; + width: 90%; +} + +.definition.container-box .term { + color: #fff; + font-size: 16px; + font-weight: bold; + padding: 5px 15px; +} + +.definition.container-box p { + font-size: 16px; + padding: 10px 30px; +} + +.definition.container-box.note { + border: 2px solid #184e80; +} + +.definition.container-box.note .term { + background-color: #65a9e9; + ddd-border: 2px solid #184e80; +} + + +.definition.container-box.warning { + border: 2px solid #804e18; +} + +.definition.container-box.warning .term { + background-color: #cf7a00; +} + + code.inline { background: #eef; - dddpadding-left: 5px; - dddpadding-right: 5px; + padding-left: 5px; + padding-right: 5px; } .property { diff --git a/docs/testing/index.html b/docs/testing/index.html index b20428f63..00e2995fd 100644 --- a/docs/testing/index.html +++ b/docs/testing/index.html @@ -1,3 +1,3 @@ -Testing
-

Testing

-

Here goes info about testing

\ No newline at end of file +Testing
+

Testing

+

Here goes info about testing

\ No newline at end of file diff --git a/packages/constants/src.ts/index.ts b/packages/constants/src.ts/index.ts index 754744e61..56a9accc7 100644 --- a/packages/constants/src.ts/index.ts +++ b/packages/constants/src.ts/index.ts @@ -5,11 +5,8 @@ import { BigNumber } from "@ethersproject/bignumber"; const AddressZero = "0x0000000000000000000000000000000000000000"; const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; -// NFKD (decomposed) -//const EtherSymbol = "\uD835\uDF63"; - -// NFKC (composed) -const EtherSymbol = "\u039e"; +// NFKC (composed) // (decomposed) +const EtherSymbol = "\u039e"; // "\uD835\uDF63"; const NegativeOne: BigNumber = BigNumber.from(-1); const Zero: BigNumber = BigNumber.from(0);