Encoding Utilities

The Encoding Utilities - base58 and base64 are directly imported from The Ethers Project. The complete documentation can be found in the official ethers docs.

Base58

hethers.utils.base58.decode( textData ) ⇒ Uint8Array

Return a typed Uint8Array representation of textData decoded using base-58 encoding.

base58.decode("TzMhH");
// Uint8Array [ 18, 52, 86, 120 ]

hethers.utils.base58.encode( aBytesLike ) ⇒ string

Return aBytesLike encoded as a string using the base-58 encoding.

base58.encode("0x12345678");
// 'TzMhH'

base58.encode([ 0x12, 0x34, 0x56, 0x78 ]);
// 'TzMhH'

Base64

hethers.utils.base64.decode( textData ) ⇒ Uint8Array

Return a typed Uint8Array representation of textData decoded using base-64 encoding.

base64.decode("EjQ=");
// Uint8Array [ 18, 52 ]

hethers.utils.base64.encode( aBytesLike ) ⇒ string

Return aBytesLike encoded as a string using the base-64 encoding.

base64.encode("0x1234");
// 'EjQ='

base64.encode([ 0x12, 0x34 ]);
// 'EjQ='

Last updated