ParamType
Each input and output of a Fragment is an Array of ParamType.
Properties
Property | Modifier | Type | Description |
---|---|---|---|
arrayChildren | readonly | null | ParamType | The type of each child in the array. For non-array types this is null . |
arrayLength | readonly | null | number | The array length, or -1 for dynamic-lengthed arrays.For non-array types this is null . |
baseType | readonly | string | The base type (e.g. "address" , "tuple" , "array" ) |
components | readonly | null | readonly ParamType [] | The components for the tuple. For non-tuple types this is null . |
indexed | readonly | null | boolean | True if the parameters is indexed. For non-indexable types this is null . |
name | readonly | string | The local name of the parameter (or "" if unbound) |
type | readonly | string | The fully qualified type (e.g. "address" , "tuple(address)" , "uint256[3][]" ) |
Methods
format()
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"
Parameters
Parameter | Type |
---|---|
format ? | FormatType |
Returns
string
The formatted type.
Source
isArray()
This provides a type guard ensuring that arrayChildren and arrayLength are non-null.
Returns
this is ParamType & Object
True if this is an Array type.
Source
isIndexable()
This provides a type guard ensuring that indexed is non-null.
Returns
this is ParamType & Object
True if this is an Indexable type.
Source
isTuple()
This provides a type guard ensuring that components is non-null.
Returns
this is ParamType & Object
True if this is a Tuple type.
Source
walk()
Walks the ParamType with value
, calling process
on each type, destructing the value
recursively.
Parameters
Parameter | Type |
---|---|
value | any |
process | ParamTypeWalkFunc |
Returns
any
Source
walkAsync()
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.
Parameters
Parameter | Type |
---|---|
value | any |
process | ParamTypeWalkAsyncFunc |
Returns
Promise
<any
>
Source
from()
Creates a new ParamType for obj
.
If allowIndexed
then the indexed
keyword is permitted, otherwise the indexed
keyword will throw an error.
Parameters
Parameter | Type |
---|---|
obj | any |
allowIndexed ? | boolean |
Returns
Source
isParamType()
Returns true if value
is a ParamType.
Parameters
Parameter | Type |
---|---|
value | any |
Returns
value is ParamType
Source
Was this page helpful?