Skip to main content
Decodes calldata into a structured form with parsed selector, signature, and ABI-decoded parameters.

Signature

Parameters

  • calldata - CallData instance to decode
  • abi - ABI specification with function definitions

Returns

CallDataDecoded - Structured object with:
  • selector: 4-byte function identifier
  • signature: Human-readable function signature (optional)
  • parameters: Array of decoded ABI values

Examples

CallDataDecoded Structure

Fields

selector: First 4 bytes identifying the function
  • Computed from keccak256(signature)
  • Always present even without ABI
signature: Human-readable function name and types
  • Example: "transfer(address,uint256)"
  • Useful for debugging and logging
  • Optional (null if ABI unavailable)
parameters: Typed parameter values
  • Array of decoded ABI values (Address, Uint256, etc.)
  • Preserves type information
  • Empty array if no parameters

Validation

Validates calldata against ABI:

Use Cases

Transaction Analysis

Event Indexing

Smart Contract Testing

Performance

Decoding optimized in WASM:

Error Handling

Decode can fail for multiple reasons:

Memory Management (Zig)

In Zig, decoded parameters own allocated memory: