Try it Live
Run ABI examples in the interactive playground
Abi
Complete Application Binary Interface (ABI) encoding and decoding with type safety for Ethereum smart contracts.Overview
Branded array of ABI items (functions, events, errors, constructors). Zero-overhead design supports both tree-shakeable methods and class instances, following the same pattern as Address.Quick Start
- Encode Function Call
- Decode Event Log
- Parse Full ABI
Types
- Abi
- Parameter
- AbiType
- Item Types
API Documentation
Core Concepts
Fundamentals
Learn ABI encoding structure, selectors, and data layout
ABI Types
Function, Event, Error, Constructor type definitions
Encoding Guide
ABI encoding and decoding mechanics
Selectors & Signatures
Function selectors and event topic hashes
Usage Patterns
Common patterns: contract calls, log parsing
Top-Level Methods
format
Format ABI item to human-readable signature
formatWithArgs
Format with concrete argument values
getItem
Find ABI item by name and type
encode
Generic ABI encoding for any item type
decode
Generic ABI decoding for any item type
decodeData
Decode without selector prefix
parseLogs
Parse multiple event logs using full ABI
Function Methods
getSelector
Get function selector (4 bytes)
getSignature
Get human-readable function signature
encodeParams
Encode function input parameters
decodeParams
Decode function input parameters
encodeResult
Encode function return values
decodeResult
Decode function return values
GetSelector
Factory for custom keccak256
Event Methods
getSelector
Get event selector (32 bytes, topic0)
getSignature
Get human-readable event signature
encodeTopics
Encode indexed parameters to topics
decodeLog
Decode event log data and topics
GetSelector
Factory for custom keccak256
EncodeTopics
Factory for custom keccak256
Error Methods
getSelector
Get error selector (4 bytes)
getSignature
Get human-readable error signature
encodeParams
Encode error parameters
decodeParams
Decode error parameters
GetSelector
Factory for custom keccak256
Constructor Methods
encodeParams
Encode constructor parameters for deployment
decodeParams
Decode constructor parameters from bytecode
Item Utilities
isFunction
Type guard: check if item is function
isEvent
Type guard: check if item is event
isError
Type guard: check if item is error
isConstructor
Type guard: check if item is constructor
isFallback
Type guard: check if item is fallback
isReceive
Type guard: check if item is receive
format
Format ABI item to signature string
formatWithArgs
Format with concrete argument values
getItem
Get specific item from ABI by name/type
ABI JSON Format
Contract ABIs are typically JSON arrays describing the contract interface:Error Types
Tree-Shaking
Import only what you need for optimal bundle size:Sub-Namespaces
The Abi module is organized into specialized sub-namespaces:- Function - Function encoding/decoding and selectors
- Event - Event log encoding/decoding and topics
- Error - Custom error encoding/decoding
- Constructor - Constructor parameter encoding
- Wasm - WASM-accelerated implementations
Related Types
- Keccak256 - Keccak256 hashing used for selectors and signatures
- Address - 20-byte Ethereum addresses used in ABI encoding
- Uint - Unsigned integer types used in ABI encoding
- Bytes - Fixed and dynamic byte arrays in ABI encoding
Specification References
- Solidity ABI Specification - Official ABI encoding specification
- Contract ABI Specification - JSON ABI format
- EIP-712 - Typed structured data hashing and signing

