Each input and output of a Fragment is an Array of ParamType.

Properties

PropertyModifierTypeDescription
arrayChildrenreadonlynull | ParamTypeThe type of each child in the array.

For non-array types this is null.
arrayLengthreadonlynull | numberThe array length, or -1 for dynamic-lengthed arrays.

For non-array types this is null.
baseTypereadonlystringThe base type (e.g. "address", "tuple", "array")
componentsreadonlynull | readonly ParamType[]The components for the tuple.

For non-tuple types this is null.
indexedreadonlynull | booleanTrue if the parameters is indexed.

For non-indexable types this is null.
namereadonlystringThe local name of the parameter (or "" if unbound)
typereadonlystringThe fully qualified type (e.g. "address", "tuple(address)", "uint256[3][]")

Methods

format()

format(format?): string

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

ParameterType
format?FormatType

Returns

string

The formatted type.

Source

abi/fragments.ts:707


isArray()

isArray(): this is ParamType & Object

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

abi/fragments.ts:768


isIndexable()

isIndexable(): this is ParamType & Object

This provides a type guard ensuring that indexed is non-null.

Returns

this is ParamType & Object

True if this is an Indexable type.

Source

abi/fragments.ts:786


isTuple()

isTuple(): this is ParamType & Object

This provides a type guard ensuring that components is non-null.

Returns

this is ParamType & Object

True if this is a Tuple type.

Source

abi/fragments.ts:777


walk()

walk(value, process): any

Walks the ParamType with value, calling process on each type, destructing the value recursively.

Parameters

ParameterType
valueany
processParamTypeWalkFunc

Returns

any

Source

abi/fragments.ts:793


walkAsync()

walkAsync(value, process): Promise<any>

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

ParameterType
valueany
processParamTypeWalkAsyncFunc

Returns

Promise<any>

Source

abi/fragments.ts:903


from()

static from(obj, allowIndexed?): ParamType

Creates a new ParamType for obj.

If allowIndexed then the indexed keyword is permitted, otherwise the indexed keyword will throw an error.

Parameters

ParameterType
objany
allowIndexed?boolean

Returns

ParamType

Source

abi/fragments.ts:920


isParamType()

static isParamType(value): value is ParamType

Returns true if value is a ParamType.

Parameters

ParameterType
valueany

Returns

value is ParamType

Source

abi/fragments.ts:1015