Skill — Copyable reference implementation. Use as-is or customize. See Skills Philosophy.
Ethers-style Interface
A copyable reference implementation that follows ethers v6 Interface patterns, built on Voltaire primitives.Overview
This Skill provides:- Interface: Main ABI abstraction with ethers v6 API
- Fragment classes: FunctionFragment, EventFragment, ErrorFragment
- Encoding/Decoding: Function data, event logs, error results
- Parsing: Parse transactions, logs, and errors from raw data
Quick Start
Encoding Function Calls
Encode function call data for transactiondata field:
Decoding Function Data
Decode function call data back to arguments:Event Encoding/Decoding
Encode event logs for testing or mocking:Error Encoding/Decoding
Handle custom error reverts:Parsing Raw Data
Parse unknown data to discover its type:Fragment Inspection
Inspect ABI fragments:Human-Readable Format
Convert ABI to human-readable format:Constructor Encoding
Encode constructor arguments for deployment:Filter Topics
Create filter topics foreth_getLogs:
Fragment Classes
Work with fragments directly:ParamType
Inspect parameter types:Source Code
Full implementation available at:examples/ethers-interface/Interface.js- Main Interface classexamples/ethers-interface/Fragment.js- Fragment classesexamples/ethers-interface/errors.ts- Error classesexamples/ethers-interface/EthersInterfaceTypes.ts- TypeScript typesexamples/ethers-interface/EthersInterface.test.ts- Comprehensive tests
API Reference
Interface
| Method | Description |
|---|---|
encodeFunctionData(name, values?) | Encode function call data |
decodeFunctionData(name, data) | Decode function call params |
decodeFunctionResult(name, data) | Decode function return data |
encodeFunctionResult(name, values?) | Encode function return data |
encodeEventLog(name, values) | Encode event log |
decodeEventLog(name, data, topics?) | Decode event log |
encodeFilterTopics(name, values) | Encode filter topics |
encodeErrorResult(name, values?) | Encode error data |
decodeErrorResult(name, data) | Decode error data |
encodeDeploy(values?) | Encode constructor args |
parseTransaction(tx) | Parse transaction data |
parseLog(log) | Parse event log |
parseError(data) | Parse error data |
getFunction(key, values?) | Get function fragment |
getEvent(key, values?) | Get event fragment |
getError(key, values?) | Get error fragment |
forEachFunction(cb) | Iterate functions |
forEachEvent(cb) | Iterate events |
forEachError(cb) | Iterate errors |
format(minimal?) | Human-readable ABI |
formatJson() | JSON ABI string |
FunctionFragment
| Property | Description |
|---|---|
name | Function name |
selector | 4-byte selector (hex) |
inputs | Input parameters |
outputs | Output parameters |
stateMutability | pure/view/nonpayable/payable |
constant | Is view/pure |
payable | Can receive ether |
EventFragment
| Property | Description |
|---|---|
name | Event name |
topicHash | 32-byte topic hash |
inputs | Event parameters |
anonymous | Is anonymous event |
ErrorFragment
| Property | Description |
|---|---|
name | Error name |
selector | 4-byte selector |
inputs | Error parameters |

