Signature
- Namespace
- Class
Parameters
- calldata - CallData instance to decode
- abi - ABI specification with function definitions
Returns
CallDataDecoded - Structured object with:
selector: 4-byte function identifiersignature: Human-readable function signature (optional)parameters: Array of decoded ABI values
Examples
- ERC20 Transfer
- Type-Safe Access
- With Structs
- Dynamic Arrays
CallDataDecoded Structure
Fields
selector: First 4 bytes identifying the function- Computed from
keccak256(signature) - Always present even without ABI
- Example:
"transfer(address,uint256)" - Useful for debugging and logging
- Optional (null if ABI unavailable)
- 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:- Unknown Function
- Invalid Encoding
- Safe Decoding
Memory Management (Zig)
In Zig, decoded parameters own allocated memory:Related
- encode - Encode function call
- Decoded Form - CallDataDecoded details
- Abi - ABI encoding and decoding
- getSelector - Extract selector

