Pre-release — The API surface may change. Unaudited.
Callcium LogoCallcium
API

Descriptor

ABI descriptor model and coder.

Descriptor

Inspect and navigate raw descriptor bytes.

Git Source

Methods

paramCount

Return paramCount from header byte 1.

function paramCount(desc: Uint8Array): number;

Parameters

NameTypeDescription
descUint8Array-

Returns

number

paramOffset

Return byte offset of the N-th top-level param (0-indexed).

function paramOffset(desc: Uint8Array, index: number): number;

Parameters

NameTypeDescription
descUint8Array-
indexnumber-

Returns

number

inspect

Inspect the type node at a given byte offset.

function inspect(desc: Uint8Array, offset: number): TypeInfo;

Parameters

NameTypeDescription
descUint8ArrayRaw descriptor bytes.
offsetnumberByte position of the node.

Returns

TypeInfo — typeCode, isDynamic, and staticSize in bytes.

typeAt

Resolve the type at a calldata path (array of step indices).

The first step selects a top-level param. Each subsequent step descends into the current node: for tuples it selects a field, for arrays it advances to the element descriptor.

function typeAt(desc: Uint8Array, steps: number[]): TypeInfo;

Parameters

NameTypeDescription
descUint8ArrayRaw descriptor bytes.
stepsnumber[]Path steps, length >= 1.

Returns

TypeInfo — TypeInfo for the node at the resolved path.

tupleFieldOffset

Return the byte offset of the fieldIndex-th field inside a tuple node. Starts at the first field and skips fieldIndex nodes using nodeLength.

function tupleFieldOffset(desc: Uint8Array, tupleOffset: number, fieldIndex: number): number;

Parameters

NameTypeDescription
descUint8Array-
tupleOffsetnumber-
fieldIndexnumber-

Returns

number

tupleFieldCount

Return tuple field count at a tuple node offset.

function tupleFieldCount(desc: Uint8Array, offset: number): number;

Parameters

NameTypeDescription
descUint8ArrayRaw descriptor bytes.
offsetnumberByte position of the tuple node.

Returns

number

staticArrayLength

Return static array length at a static array node offset.

function staticArrayLength(desc: Uint8Array, offset: number): number;

Parameters

NameTypeDescription
descUint8ArrayRaw descriptor bytes.
offsetnumberByte position of the static array node.

Returns

number

nodeLength

Return the byte length of the node at offset. Elementary nodes occupy exactly one byte; composite nodes encode their length in the lower 12 bits of the 24-bit meta field.

function nodeLength(desc: Uint8Array, offset: number): number;

Parameters

NameTypeDescription
descUint8Array-
offsetnumber-

Returns

number

arrayElementOffset

Return the byte offset of the array element descriptor.

function arrayElementOffset(offset: number): number;

Parameters

NameTypeDescription
offsetnumberByte position of the array node (static or dynamic).

Returns

number

DescriptorCoder

Encode and decode descriptors.

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, e.g. "address,uint256,(bool,bytes32)[],string".

Returns

Uint8Array — Binary descriptor bytes starting with the version+paramCount header.

toTypes

Reconstruct a comma-separated list of ABI type strings from a binary descriptor.

Inverse of fromTypes: toTypes(fromTypes(s)) returns s for any valid input.

function toTypes(desc: Uint8Array): string;

Parameters

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

Returns

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

Types

TypeInfo

Structural type information extracted from a descriptor node.

Git Source

On this page