When sending values to or receiving values from a Contract, the data is generally encoded using the ABI standard.
The AbiCoder provides a utility to encode values to ABI data and decode values from ABI data.
Most of the time, developers should favour the Contract class, which further abstracts a lot of the finer details of ABI data.
About AbiCoder
Returns the shared singleton instance of a default AbiCoder.
On the first call, the instance is created internally.
Decode the ABI data as the types into values.
If loose decoding is enabled, then strict padding is not enforced. Some older versions of Solidity incorrectly padded event data emitted from external functions.
Encode the values as the types into ABI data.
Get the default values for the given types.
For example, a uint is by default 0 and bool is by default false.
Returns an ethers-compatible CALL_EXCEPTION Error for the given result data for the CallExceptionAction action against the Transaction tx.
About frgaments...
The format to serialize the output as.
The type of a Fragment.
When walking asynchronously a ParamType, this is called on each component.
A Fragment which represents a Custom Error.
The Custom Error selector.
The Event topic hash.
If the function can be sent value during invocation.
An abstract class to represent An individual fragment from a parse ABI.
The type of the fragment.
Creates a new Fragment for obj, wich can be any supported ABI frgament type.
Returns a string representation of this fragment.
Returns true if value is a ConstructorFragment.
Returns true if value is an ErrorFragment.
Returns true if value is an EventFragment.
Returns true if value is a FunctionFragment.
Returns true if value is a StructFragment.
A Fragment which represents a method.
If the function is constant (e.g. pure or view functions).
The amount of gas to send when calling this function
The returned types for the result of calling this function.
If the function can be sent value during invocation.
The Function selector.
The state mutability (e.g. payable, nonpayable, view or pure)
A fragment for a method, event or error in a JSON API.
If the event is anonymous.
If the function is constant.
The gas limit to use when sending a transaction for this function.
The input parameters.
The name of the error, event, function, etc.
The output parameters.
If the function is payable.
The mutability state of the function.
The type of the fragment (e.g. event, "function", etc.)
A type description in a JSON API.
The components for a tuple.
If the parameter is indexed.
The internal Solidity type.
The parameter name.
The type of the parameter.
An abstract class to represent An individual fragment which has a name from a parse ABI.
The name of the fragment.
The type of each child in the array.
For non-array types (see ParamType_isArray) this is null.
The array length, or -1 for dynamic-lengthed arrays.
For non-array types (see ParamType_isArray) this is null.
The base type (e.g. "address", "tuple", "array")
The components for the tuple.
For non-tuple types (see ParamType_isTuple) this is null.
True if the parameters is indexed.
For non-indexable types (see ParamType_isIndexable) this is null.
The local name of the parameter (or "" if unbound)
The fully qualified type (e.g. "address", "tuple(address)", "uint256[3][]")
Creates a new ParamType for obj.
If allowIndexed then the indexed keyword is permitted, otherwise the indexed keyword will throw an error.
Return a string representation of this type.
For example,
sighash" => "(uint256,address)"
"minimal" => "tuple(uint256,address) indexed"
"full" => "tuple(uint256 foo, address bar) indexed baz"
Returns true if this is an Array type.
This provides a type gaurd ensuring that arrayChildren and arrayLength are non-null.
Returns true if this is an Indexable type.
This provides a type gaurd ensuring that indexed is non-null.
Returns true if this is a Tuple type.
This provides a type gaurd ensuring that components is non-null.
Walks the ParamType with value, calling process on each type, destructing the value recursively.
Walks the ParamType with value, asynchronously calling process on each type, destructing the value recursively.
This can be used to resolve ENS naes by walking and resolving each "address" type.
Returns true if value is a ParamType.
A Fragment which represents a structure.