ethers.js/docs.wrm/api/utils/encoding.wrm

50 lines
1.7 KiB
Plaintext
Raw Normal View History

2020-02-25 22:57:11 +03:00
_section: Encoding Utilities @<encoding>
2020-01-10 09:01:00 +03:00
2020-05-08 10:24:40 +03:00
_subsection: Base58 @<Bse58> @SRC<basex:Base58>
2020-01-10 09:01:00 +03:00
2020-02-18 01:56:13 +03:00
_property: ethers.utils.base58.decode(textData) => Uin8Array
2020-01-10 09:01:00 +03:00
Return a typed Uint8Array representation of //textData// decoded using
base-58 encoding.
2020-02-18 01:56:13 +03:00
_property: ethers.utils.base58.encode(aBytesLike) => string
2020-01-10 09:01:00 +03:00
Return //aBytesLike// encoded as a string using the base-58 encoding.
2020-05-08 10:24:40 +03:00
_subsection: Base64 @<Base64>
2020-02-18 01:56:13 +03:00
2020-02-25 22:57:11 +03:00
_property: ethers.utils.base64.decode(textData) => Uin8Array @SRC<base64>
2020-01-10 09:01:00 +03:00
Return a typed Uint8Array representation of //textData// decoded using
base-64 encoding.
2020-02-25 22:57:11 +03:00
_property: ethers.utils.base64.encode(aBytesLike) => string @SRC<base64>
2020-01-10 09:01:00 +03:00
Return //aBytesLike// encoded as a string using the base-64 encoding.
2020-02-18 01:56:13 +03:00
2020-05-08 10:24:40 +03:00
_subsection: Recursive-Length Prefix @<rlp--methods>
2020-02-18 01:56:13 +03:00
The [[link-rlp]] encoding is used throughout Ethereum to serialize nested
structures of Arrays and data.
2020-05-08 10:24:40 +03:00
_property: ethers.utils.RLP.encode(dataObject) => string<[[DataHexString]]> @<utils-rlpEncode> @SRC<rlp>
2020-02-18 01:56:13 +03:00
Encode a structured Data Object into its RLP-encoded representation.
2020-05-08 10:24:40 +03:00
Each Data component may be an valid [[BytesLike]].
2020-02-18 01:56:13 +03:00
2020-05-08 10:24:40 +03:00
_property: ethers.utils.RLP.decode(aBytesLike) => [DataObject](rlp--dataobject) @<utils.rlpDecode> @SRC<rlp>
2020-02-18 01:56:13 +03:00
Decode an RLP-encoded //aBytesLike// into its structured Data Object.
2020-05-08 10:24:40 +03:00
All Data components will be returned as a [[DataHexString]].
2020-02-18 01:56:13 +03:00
2020-05-08 10:24:40 +03:00
_heading: Data Object @<rlp--dataobject>
2020-02-18 01:56:13 +03:00
A **Data Object** is a recursive structure which is used to serialize many
internal structures in Ethereum. Each **Data Object** can either be:
- Binary Data
- An Array of **Data Objects** (i.e. this recursively includes Nesting)
_definition: **Examples**
- ``"0x1234"``
- ``[ "0x1234", [ "0xdead", "0xbeef" ], [ ] ]``