#
AbiCoder
source

The AbiCoder is a collection of Coders which can be used to encode and decode the binary data formats used to interoperate between the EVM and higher level libraries.

Most developers will never need to use this class directly, since the Interface class greatly simplifies these operations.

##
Creating Instance

For the most part, there should never be a need to manually create an instance of an AbiCoder, since one is created with the default coercion function when the library is loaded which can be used universally.

This is likely only needed by those with specific needs to override how values are coerced after they are decoded from their binary format.

new ethers.utils.AbiCoder( [ coerceFunc ] )
source

Create a new AbiCoder instance, which will call the coerceFunc on every decode, where the result of the call will be used in the Result.

The function signature is `(type, value)`, where the type is the string describing the type and the value is the processed value from the underlying Coder.

If the callback throws, the Result will contain a property that when accessed will throw, allowing for higher level libraries to recover from data errors.

ethers.utils.defaultAbiCoder ⇒ AbiCoder

An AbiCoder created when the library is imported which is used by the Interface.

##
Coding Methods

abiCoder.encode( types , values ) ⇒ string< DataHexString >
source

Encode the array values according to the array of types, each of which may be a string or a ParamType.

abiCoder.decode( types , data ) ⇒ Result
source

Decode the data according to the array of types, each of which may be a string or ParamType.

The content of this site is licensed under the Creative Commons License. Generated on February 8, 2021, 3:25pm.