API
Descriptor
ABI descriptor coder.
DescriptorCoder
Encode descriptors from type strings, inspect them and read their type strings back.
Methods
fromTypes
Encode a comma-separated list of ABI type strings into a binary descriptor.
function fromTypes(typesCsv: string): Uint8Array;Parameters
| Name | Type | Description |
|---|---|---|
typesCsv | string | Comma-separated ABI type strings, for example "address,uint256,(bool,bytes32)[],string". |
Returns
Uint8Array — Binary descriptor bytes starting with the version+paramCount header.
inspect
Inspect a binary descriptor: its header fields and its parameters as a tree of nodes, each with the bytes it spans.
function inspect(desc: Uint8Array): DecodedDescriptor;Parameters
| Name | Type | Description |
|---|---|---|
desc | Uint8Array | Binary descriptor bytes (with version+paramCount header). |
Returns
DecodedDescriptor — The decoded descriptor.
toTypes
Reconstruct a comma-separated list of ABI type strings from a binary descriptor. fromTypes(toTypes(desc)) returns
desc for every descriptor inspect accepts.
function toTypes(desc: Uint8Array): string;Parameters
| Name | Type | Description |
|---|---|---|
desc | Uint8Array | Binary descriptor bytes (with version+paramCount header). |
Returns
string — Comma-separated ABI type strings, for example "address,uint256,(bool,bytes32)[]".