Callcium
API

Descriptor

ABI descriptor coder.

DescriptorCoder

Encode descriptors from type strings, inspect them and read their type strings back.

Git Source

Methods

fromTypes

Encode a comma-separated list of ABI type strings into a binary descriptor.

function fromTypes(typesCsv: string): Uint8Array;

Parameters

NameTypeDescription
typesCsvstringComma-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

NameTypeDescription
descUint8ArrayBinary 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

NameTypeDescription
descUint8ArrayBinary descriptor bytes (with version+paramCount header).

Returns

string — Comma-separated ABI type strings, for example "address,uint256,(bool,bytes32)[]".

On this page