@tevm/voltaire / primitives/Abi
primitives/Abi
Namespaces
Classes
Abi
Defined in: src/primitives/Abi/Abi.js:36 Factory function for creating Abi instancesSee
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Param
ABI itemsThrows
Example
Constructors
Constructor
new Abi(Defined in: src/primitives/Abi/Abi.js:36 Factory function for creating Abi instancesitems):Abi
Parameters
items
readonlyItem[]
ABI items
Returns
Abi
Abi instance
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
Example
Properties
Constructor
Defined in: src/primitives/Abi/Abi.js:71staticConstructor:Constructor
decode()
Defined in: src/primitives/Abi/Abi.js:55 Decode function return values (branded ABI method)staticdecode: (this,functionName,data) => readonlyunknown[]
Parameters
this
readonlyItem[]
functionName
string
Function name
data
Uint8Array<ArrayBufferLike>
Encoded return data
Returns
readonlyunknown[]
Decoded return values
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
If function not found in ABIExample
decodeData()
Defined in: src/primitives/Abi/Abi.js:56 Decode function call data and identify function (branded ABI method)staticdecodeData: (this,data) =>object
Parameters
this
readonlyItem[]
data
Uint8Array<ArrayBufferLike>
Encoded function call data
Returns
object
Decoded function name and arguments
args
args: readonly unknown[]
functionName
functionName: string
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
If data is too short to contain selectorThrows
If function with selector not found in ABIExample
decodeParameters()
Defined in: src/primitives/Abi/Abi.js:61staticdecodeParameters: <TParams>(params,data) =>ParametersToPrimitiveTypes<TParams>
Type Parameters
TParams
TParams extends readonly Parameter[]
Parameters
params
TParams
data
Uint8Array<ArrayBufferLike>
Returns
ParametersToPrimitiveTypes<TParams>
DecodeParameters()
Defined in: src/primitives/Abi/Abi.js:65staticDecodeParameters: <TParams>(params,data) =>ParametersToPrimitiveTypes<TParams>
Type Parameters
TParams
TParams extends readonly Parameter[]
Parameters
params
TParams
data
Uint8Array<ArrayBufferLike>
Returns
ParametersToPrimitiveTypes<TParams>
encode()
Defined in: src/primitives/Abi/Abi.js:54 Encode function call data (branded ABI method)staticencode: (this,functionName,args) =>Uint8Array<ArrayBufferLike>
Parameters
this
readonlyItem[]
functionName
string
Function name to encode
args
readonlyunknown[]
Function arguments
Returns
Uint8Array<ArrayBufferLike>
Encoded function call data
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
If function not found in ABIExample
encodeParameters()
Defined in: src/primitives/Abi/Abi.js:60staticencodeParameters: <TParams>(params,values) =>Uint8Array<ArrayBufferLike>
Type Parameters
TParams
TParams extends readonly Parameter[]
Parameters
params
TParams
values
ParametersToPrimitiveTypes<TParams>
Returns
Uint8Array<ArrayBufferLike>
Error
Defined in: src/primitives/Abi/Abi.js:70staticError:object
decodeParams()
decodeParams: <Decode error parameters from encoded dataTName,TInputs>(error,data) =>ParametersToPrimitiveTypes<TInputs>
Type Parameters
TName
TName extends string
TInputs
TInputs extends readonly ParameterType<AbiType, string, string>[]
Parameters
error
ErrorType<TName, TInputs>
ABI error definition
data
Uint8Array<ArrayBufferLike>
Encoded error data with selector prefix
Returns
ParametersToPrimitiveTypes<TInputs>
Decoded parameter values
Throws
If data is too short for selectorThrows
If selector doesn’t match expectedExample
encodeParams()
encodeParams: <Encode error parameters with selector prefixTName,TInputs>(error,args) =>Uint8Array<ArrayBufferLike>
Type Parameters
TName
TName extends string
TInputs
TInputs extends readonly ParameterType<AbiType, string, string>[]
Parameters
error
ErrorType<TName, TInputs>
ABI error definition
args
ParametersToPrimitiveTypes<TInputs>
Parameter values to encode
Returns
Uint8Array<ArrayBufferLike>
Encoded error data with 4-byte selector prefix
Example
getSelector()
getSelector: (error) =>Uint8Array
Parameters
error
any
Returns
Uint8Array
GetSelector()
GetSelector: (Factory: Get the 4-byte selector for an errordeps) => (error) =>Uint8Array
Parameters
deps
Crypto dependencieskeccak256String
(str) => Uint8Array
Keccak256 hash function for strings
Returns
Function that computes error selector(error):Uint8Array
Parameters
error
any
Returns
Uint8Array
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Example
getSignature()
getSignature: <Get the signature string for an error (e.g., “MyError(uint256,address)“)TName,TInputs>(error) =>string
Type Parameters
TName
TName extends string
TInputs
TInputs extends readonly ParameterType<AbiType, string, string>[]
Parameters
error
ErrorType<TName, TInputs>
ABI error definition
Returns
string
Error signature string
Example
Event
Defined in: src/primitives/Abi/Abi.js:69staticEvent:object
decodeLog()
decodeLog: (Decode event log data and topics into event argumentsevent,data,topics) =>DecodeLogResult<any>
Parameters
event
EventType<string, readonly Parameter[]>
Event definition
data
Uint8Array<ArrayBufferLike>
Log data bytes
topics
readonlyHashType[]
Log topics
Returns
DecodeLogResult<any>
Decoded event arguments
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
If topics are missing or invalidThrows
If event selector doesn’t match topic0Example
DecodeLog()
DecodeLog: (Decode event log data and topics into event argumentsevent,data,topics) =>DecodeLogResult<any> =decodeLog
Parameters
event
EventType<string, readonly Parameter[]>
Event definition
data
Uint8Array<ArrayBufferLike>
Log data bytes
topics
readonlyHashType[]
Log topics
Returns
DecodeLogResult<any>
Decoded event arguments
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
If topics are missing or invalidThrows
If event selector doesn’t match topic0Example
encodeTopics()
encodeTopics: (event,args) => (HashType|null)[]
Parameters
event
any
args
any
Returns
(HashType | null)[]
EncodeTopics()
EncodeTopics: (Factory: Encode event arguments into topics arraydeps) => (event,args) => (HashType|null)[]
Parameters
deps
Crypto dependencieskeccak256
(data) => Uint8Array
Keccak256 hash function
keccak256String
(str) => Uint8Array
Keccak256 hash function for strings
Returns
Function that encodes event topics(event,args): (HashType|null)[]
Parameters
event
any
args
any
Returns
(HashType | null)[]
Example
getSelector()
getSelector: (Factory function for creating Event instances Note: Event is a plain object, not a class instance This namespace provides convenient methods for working with eventsevent) =>HashType
Parameters
event
any
Returns
HashType
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
Example
GetSelector()
GetSelector: (Factory: Get event selector (keccak256 hash of signature)deps) => (event) =>HashType
Parameters
deps
Crypto dependencieskeccak256String
(str) => Uint8Array
Keccak256 hash function for strings
Returns
Function that computes event selector(event):HashType
Parameters
event
any
Returns
HashType
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Example
getSignature()
getSignature: (Get event signature string (e.g., “Transfer(address,address,uint256)“)event) =>string
Parameters
event
EventType<string, readonly Parameter[]>
Event definition
Returns
string
Event signature
Example
Signature()
Signature: (Get event signature string (e.g., “Transfer(address,address,uint256)“)event) =>string=getSignature
Parameters
event
EventType<string, readonly Parameter[]>
Event definition
Returns
string
Event signature
Example
Topics()
Topics: (event,args) => (HashType|null)[] =encodeTopics
Parameters
event
any
args
any
Returns
(HashType | null)[]
format()
Defined in: src/primitives/Abi/Abi.js:52 Format an ABI item as a human-readable stringstaticformat: (item) =>string
Parameters
item
Item
ABI item to format
Returns
string
Formatted string representation
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
Example
formatWithArgs()
Defined in: src/primitives/Abi/Abi.js:53 Format an ABI item with arguments as a human-readable stringstaticformatWithArgs: (item,args) =>string
Parameters
item
Item
ABI item to format
args
readonlyunknown[]
Arguments to display
Returns
string
Formatted string with arguments
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
Example
Function
Defined in: src/primitives/Abi/Abi.js:68staticFunction: typeofFunction
getItem()
Defined in: src/primitives/Abi/Abi.js:51 Get a specific ABI item by name and optional typestaticgetItem: <TAbi,TName,TType>(abi,name,type?) =>Extract<TAbi[number], {name:TName; }> |undefined
Type Parameters
TAbi
TAbi extends readonly Item[]
TName
TName extends string
TType
TType extends "function" | "event" | "constructor" | "error" | "fallback" | "receive" | undefined
Parameters
abi
TAbi
ABI array to search
name
TName
Name of the item to find
type?
TType
Optional type filter (function, event, error, constructor)
Returns
Extract<TAbi[number], { name: TName; }> | undefined
The found item or undefined
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
Example
Item
Defined in: src/primitives/Abi/Abi.js:72staticItem:Item
Parameters()
Defined in: src/primitives/Abi/Abi.js:64staticParameters: <TParams>(params,values) =>Uint8Array<ArrayBufferLike>
Type Parameters
TParams
TParams extends readonly Parameter[]
Parameters
params
TParams
values
ParametersToPrimitiveTypes<TParams>
Returns
Uint8Array<ArrayBufferLike>
parseLogs()
Defined in: src/primitives/Abi/Abi.js:57 Parse event logs (branded ABI method)staticparseLogs: (this,logs) => readonlyobject[]
Parameters
this
readonlyItem[]
logs
readonlyobject[]
Array of log objects
Returns
readonlyobject[]
Parsed event logs
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
Example
Methods
decode()
decode(Defined in: src/primitives/Abi/Abi.js:107functionName,data): readonlyunknown[]
Parameters
functionName
string
data
Uint8Array<ArrayBufferLike>
Returns
readonlyunknown[]
decodeData()
decodeData(Defined in: src/primitives/Abi/Abi.js:112data):object
Parameters
data
Uint8Array<ArrayBufferLike>
Returns
object
args
args: readonly unknown[]
functionName
functionName: string
encode()
encode(Defined in: src/primitives/Abi/Abi.js:102functionName,args):Uint8Array<ArrayBufferLike>
Parameters
functionName
string
args
unknown[]
Returns
Uint8Array<ArrayBufferLike>
format()
format(): any
Defined in: src/primitives/Abi/Abi.js:83
Returns
any
formatWithArgs()
formatWithArgs(Defined in: src/primitives/Abi/Abi.js:90args):any
Parameters
args
Record<string, unknown[]>
Returns
any
getConstructor()
getConstructor(): any
Defined in: src/primitives/Abi/Abi.js:137
Returns
any
getError()
getError(Defined in: src/primitives/Abi/Abi.js:133name):any
Parameters
name
string
Returns
any
getEvent()
getEvent(Defined in: src/primitives/Abi/Abi.js:128name):any
Parameters
name
string
Returns
any
getFallback()
getFallback(): any
Defined in: src/primitives/Abi/Abi.js:143
Returns
any
getFunction()
getFunction(Defined in: src/primitives/Abi/Abi.js:123name):any
Parameters
name
string
Returns
any
getItem()
getItem(Defined in: src/primitives/Abi/Abi.js:79name,type?):any
Parameters
name
string
type?
"function" | "event" | "constructor" | "error" | "fallback" | "receive"
Returns
any
getReceive()
getReceive(): any
Defined in: src/primitives/Abi/Abi.js:149
Returns
any
parseLogs()
parseLogs(Defined in: src/primitives/Abi/Abi.js:117logs): readonlyobject[]
Parameters
logs
readonlyobject[]
Returns
readonlyobject[]
toString()
toString(): string
Defined in: src/primitives/Abi/Abi.js:162
Returns
string
from()
Defined in: src/primitives/Abi/Abi.js:44staticfrom(items):any
Parameters
items
readonlyItemType[]
Returns
any
Type Aliases
WrappedErrorType
WrappedErrorType = object
Defined in: src/primitives/Abi/error/wrapped/WrappedErrorType.ts:14
ERC-7751 Wrapped Error type
Represents a wrapped execution error with additional context about the failing contract,
function, and original revert reason.
See
https://eips.ethereum.org/EIPS/eip-7751Since
0.0.0Properties
details
details: BytesType
Defined in: src/primitives/Abi/error/wrapped/WrappedErrorType.ts:22
Additional error details/context
reason
reason: BytesType
Defined in: src/primitives/Abi/error/wrapped/WrappedErrorType.ts:20
Original revert reason data
selector
selector: SelectorType
Defined in: src/primitives/Abi/error/wrapped/WrappedErrorType.ts:18
Function selector that was called
target
target: AddressType
Defined in: src/primitives/Abi/error/wrapped/WrappedErrorType.ts:16
Address of contract that reverted
Variables
ERC1155InsufficientBalance
Defined in: src/primitives/Abi/error/standards/ERC1155Errors.ts:14 Insufficient balance for transfer error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId)constERC1155InsufficientBalance:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"sender";type:"address"; }, {name:"balance";type:"uint256"; }, {name:"needed";type:"uint256"; }, {name:"tokenId";type:"uint256"; }]
name
readonlyname:"ERC1155InsufficientBalance"="ERC1155InsufficientBalance"
type
readonlytype:"error"="error"
ERC1155InvalidApprover
Defined in: src/primitives/Abi/error/standards/ERC1155Errors.ts:62 Invalid approver address error ERC1155InvalidApprover(address approver)constERC1155InvalidApprover:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"approver";type:"address"; }]
name
readonlyname:"ERC1155InvalidApprover"="ERC1155InvalidApprover"
type
readonlytype:"error"="error"
ERC1155InvalidArrayLength
Defined in: src/primitives/Abi/error/standards/ERC1155Errors.ts:82 Array length mismatch error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength)constERC1155InvalidArrayLength:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"idsLength";type:"uint256"; }, {name:"valuesLength";type:"uint256"; }]
name
readonlyname:"ERC1155InvalidArrayLength"="ERC1155InvalidArrayLength"
type
readonlytype:"error"="error"
ERC1155InvalidOperator
Defined in: src/primitives/Abi/error/standards/ERC1155Errors.ts:72 Invalid operator address error ERC1155InvalidOperator(address operator)constERC1155InvalidOperator:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"operator";type:"address"; }]
name
readonlyname:"ERC1155InvalidOperator"="ERC1155InvalidOperator"
type
readonlytype:"error"="error"
ERC1155InvalidReceiver
Defined in: src/primitives/Abi/error/standards/ERC1155Errors.ts:39 Invalid receiver address error ERC1155InvalidReceiver(address receiver)constERC1155InvalidReceiver:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"receiver";type:"address"; }]
name
readonlyname:"ERC1155InvalidReceiver"="ERC1155InvalidReceiver"
type
readonlytype:"error"="error"
ERC1155InvalidSender
Defined in: src/primitives/Abi/error/standards/ERC1155Errors.ts:29 Invalid sender address error ERC1155InvalidSender(address sender)constERC1155InvalidSender:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"sender";type:"address"; }]
name
readonlyname:"ERC1155InvalidSender"="ERC1155InvalidSender"
type
readonlytype:"error"="error"
ERC1155MissingApprovalForAll
Defined in: src/primitives/Abi/error/standards/ERC1155Errors.ts:49 Missing approval for all tokens error ERC1155MissingApprovalForAll(address operator, address owner)constERC1155MissingApprovalForAll:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"operator";type:"address"; }, {name:"owner";type:"address"; }]
name
readonlyname:"ERC1155MissingApprovalForAll"="ERC1155MissingApprovalForAll"
type
readonlytype:"error"="error"
ERC20InsufficientAllowance
Defined in: src/primitives/Abi/error/standards/ERC20Errors.ts:48 Insufficient allowance for transfer error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed)constERC20InsufficientAllowance:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"spender";type:"address"; }, {name:"allowance";type:"uint256"; }, {name:"needed";type:"uint256"; }]
name
readonlyname:"ERC20InsufficientAllowance"="ERC20InsufficientAllowance"
type
readonlytype:"error"="error"
ERC20InsufficientBalance
Defined in: src/primitives/Abi/error/standards/ERC20Errors.ts:14 Insufficient balance for transfer error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed)constERC20InsufficientBalance:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"sender";type:"address"; }, {name:"balance";type:"uint256"; }, {name:"needed";type:"uint256"; }]
name
readonlyname:"ERC20InsufficientBalance"="ERC20InsufficientBalance"
type
readonlytype:"error"="error"
ERC20InvalidApprover
Defined in: src/primitives/Abi/error/standards/ERC20Errors.ts:62 Invalid approver address error ERC20InvalidApprover(address approver)constERC20InvalidApprover:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"approver";type:"address"; }]
name
readonlyname:"ERC20InvalidApprover"="ERC20InvalidApprover"
type
readonlytype:"error"="error"
ERC20InvalidReceiver
Defined in: src/primitives/Abi/error/standards/ERC20Errors.ts:38 Invalid receiver address error ERC20InvalidReceiver(address receiver)constERC20InvalidReceiver:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"receiver";type:"address"; }]
name
readonlyname:"ERC20InvalidReceiver"="ERC20InvalidReceiver"
type
readonlytype:"error"="error"
ERC20InvalidSender
Defined in: src/primitives/Abi/error/standards/ERC20Errors.ts:28 Invalid sender address error ERC20InvalidSender(address sender)constERC20InvalidSender:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"sender";type:"address"; }]
name
readonlyname:"ERC20InvalidSender"="ERC20InvalidSender"
type
readonlytype:"error"="error"
ERC20InvalidSpender
Defined in: src/primitives/Abi/error/standards/ERC20Errors.ts:72 Invalid spender address error ERC20InvalidSpender(address spender)constERC20InvalidSpender:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"spender";type:"address"; }]
name
readonlyname:"ERC20InvalidSpender"="ERC20InvalidSpender"
type
readonlytype:"error"="error"
ERC721IncorrectOwner
Defined in: src/primitives/Abi/error/standards/ERC721Errors.ts:34 Sender is not the owner error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner)constERC721IncorrectOwner:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"sender";type:"address"; }, {name:"tokenId";type:"uint256"; }, {name:"owner";type:"address"; }]
name
readonlyname:"ERC721IncorrectOwner"="ERC721IncorrectOwner"
type
readonlytype:"error"="error"
ERC721InsufficientApproval
Defined in: src/primitives/Abi/error/standards/ERC721Errors.ts:68 Insufficient approval for operation error ERC721InsufficientApproval(address operator, uint256 tokenId)constERC721InsufficientApproval:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"operator";type:"address"; }, {name:"tokenId";type:"uint256"; }]
name
readonlyname:"ERC721InsufficientApproval"="ERC721InsufficientApproval"
type
readonlytype:"error"="error"
ERC721InvalidApprover
Defined in: src/primitives/Abi/error/standards/ERC721Errors.ts:81 Invalid approver address error ERC721InvalidApprover(address approver)constERC721InvalidApprover:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"approver";type:"address"; }]
name
readonlyname:"ERC721InvalidApprover"="ERC721InvalidApprover"
type
readonlytype:"error"="error"
ERC721InvalidOperator
Defined in: src/primitives/Abi/error/standards/ERC721Errors.ts:91 Invalid operator address error ERC721InvalidOperator(address operator)constERC721InvalidOperator:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"operator";type:"address"; }]
name
readonlyname:"ERC721InvalidOperator"="ERC721InvalidOperator"
type
readonlytype:"error"="error"
ERC721InvalidOwner
Defined in: src/primitives/Abi/error/standards/ERC721Errors.ts:14 Invalid owner address error ERC721InvalidOwner(address owner)constERC721InvalidOwner:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"owner";type:"address"; }]
name
readonlyname:"ERC721InvalidOwner"="ERC721InvalidOwner"
type
readonlytype:"error"="error"
ERC721InvalidReceiver
Defined in: src/primitives/Abi/error/standards/ERC721Errors.ts:58 Invalid receiver address error ERC721InvalidReceiver(address receiver)constERC721InvalidReceiver:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"receiver";type:"address"; }]
name
readonlyname:"ERC721InvalidReceiver"="ERC721InvalidReceiver"
type
readonlytype:"error"="error"
ERC721InvalidSender
Defined in: src/primitives/Abi/error/standards/ERC721Errors.ts:48 Invalid sender address error ERC721InvalidSender(address sender)constERC721InvalidSender:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"sender";type:"address"; }]
name
readonlyname:"ERC721InvalidSender"="ERC721InvalidSender"
type
readonlytype:"error"="error"
ERC721NonexistentToken
Defined in: src/primitives/Abi/error/standards/ERC721Errors.ts:24 Token does not exist error ERC721NonexistentToken(uint256 tokenId)constERC721NonexistentToken:object
Type Declaration
inputs
readonlyinputs: readonly [{name:"tokenId";type:"uint256"; }]
name
readonlyname:"ERC721NonexistentToken"="ERC721NonexistentToken"
type
readonlytype:"error"="error"
Interface
Defined in: src/primitives/Abi/interface/index.ts:19constInterface:object
Type Declaration
ERC1155_INTERFACE_ID
ERC1155_INTERFACE_ID: SelectorType
ERC-1155 Multi Token Standard interface ID
See
https://eips.ethereum.org/EIPS/eip-1155ERC165_INTERFACE_ID
ERC165_INTERFACE_ID: SelectorType
ERC-165 supportsInterface(bytes4) interface ID
See
https://eips.ethereum.org/EIPS/eip-165ERC20_INTERFACE_ID
ERC20_INTERFACE_ID: SelectorType
ERC-20 Token Standard interface ID
See
https://eips.ethereum.org/EIPS/eip-20ERC721_INTERFACE_ID
ERC721_INTERFACE_ID: SelectorType
ERC-721 Non-Fungible Token Standard interface ID
See
https://eips.ethereum.org/EIPS/eip-721getInterfaceId()
getInterfaceId: (Calculate ERC-165 interface ID from function selectors Interface ID is computed by XORing all function selectors in the interface. Per ERC-165 specification.selectors) =>SelectorType
Parameters
selectors
SelectorLike[]
Array of function selectors
Returns
SelectorType
Interface ID (4-byte XOR result)
Throws
If no selectors providedSee
https://eips.ethereum.org/EIPS/eip-165Example
WRAPPED_ERROR_SELECTOR
Defined in: src/primitives/Abi/error/wrapped/constants.js:11 ERC-7751 WrappedError selector Selector for: error WrappedError(address target, bytes4 selector, bytes reason, bytes details)constWRAPPED_ERROR_SELECTOR:SelectorType
See
https://eips.ethereum.org/EIPS/eip-7751WrappedError
Defined in: src/primitives/Abi/error/wrapped/index.ts:21constWrappedError:object
Type Declaration
decodeWrappedError()
decodeWrappedError: (Decode ERC-7751 wrapped error data Decodes a WrappedError from encoded bytes following the ERC-7751 specification. Expects data to start with the WrappedError selector (0x90bfb865).data) =>WrappedErrorType
Parameters
data
Uint8Array<ArrayBufferLike>
Encoded error data (selector + ABI-encoded params)
Returns
WrappedErrorType
Decoded wrapped error
Throws
If selector doesn’t match or data is invalidSee
https://eips.ethereum.org/EIPS/eip-7751Example
encodeWrappedError()
encodeWrappedError: (Encode ERC-7751 wrapped error data Encodes a WrappedError following the ERC-7751 specification: error WrappedError(address target, bytes4 selector, bytes reason, bytes details)wrappedError) =>Uint8Array<ArrayBufferLike>
Parameters
wrappedError
WrappedErrorType
Wrapped error data
Returns
Uint8Array<ArrayBufferLike>
Encoded error data (selector + ABI-encoded params)
See
https://eips.ethereum.org/EIPS/eip-7751Example
WRAPPED_ERROR_SELECTOR
WRAPPED_ERROR_SELECTOR: SelectorType
ERC-7751 WrappedError selector
Selector for: error WrappedError(address target, bytes4 selector, bytes reason, bytes details)
See
https://eips.ethereum.org/EIPS/eip-7751Functions
decode()
decode(Defined in: src/primitives/Abi/decode.js:23 Decode function return values (branded ABI method)this,functionName,data): readonlyunknown[]
Parameters
this
readonlyItem[]
functionName
string
Function name
data
Uint8Array<ArrayBufferLike>
Encoded return data
Returns
readonlyunknown[]
Decoded return values
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
If function not found in ABIExample
decodeData()
decodeData(Defined in: src/primitives/Abi/decodeData.js:25 Decode function call data and identify function (branded ABI method)this,data):object
Parameters
this
readonlyItem[]
data
Uint8Array<ArrayBufferLike>
Encoded function call data
Returns
object
Decoded function name and arguments
args
args: readonly unknown[]
functionName
functionName: string
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
If data is too short to contain selectorThrows
If function with selector not found in ABIExample
decodeParameters()
decodeParameters<Defined in: src/primitives/Abi/decodeParameters.js:14TParams>(params,data):ParametersToPrimitiveTypes<TParams>
Type Parameters
TParams
TParams extends readonly Parameter[]
Parameters
params
TParams
data
Uint8Array<ArrayBufferLike>
Returns
ParametersToPrimitiveTypes<TParams>
DecodeParameters()
DecodeParameters<Defined in: src/primitives/Abi/decodeParameters.js:14TParams>(params,data):ParametersToPrimitiveTypes<TParams>
Type Parameters
TParams
TParams extends readonly Parameter[]
Parameters
params
TParams
data
Uint8Array<ArrayBufferLike>
Returns
ParametersToPrimitiveTypes<TParams>
decodeWrappedError()
decodeWrappedError(Defined in: src/primitives/Abi/error/wrapped/decodeWrappedError.js:26 Decode ERC-7751 wrapped error data Decodes a WrappedError from encoded bytes following the ERC-7751 specification. Expects data to start with the WrappedError selector (0x90bfb865).data):WrappedErrorType
Parameters
data
Uint8Array<ArrayBufferLike>
Encoded error data (selector + ABI-encoded params)
Returns
WrappedErrorType
Decoded wrapped error
Throws
If selector doesn’t match or data is invalidSee
https://eips.ethereum.org/EIPS/eip-7751Example
encode()
encode(Defined in: src/primitives/Abi/encode.js:22 Encode function call data (branded ABI method)this,functionName,args):Uint8Array<ArrayBufferLike>
Parameters
this
readonlyItem[]
functionName
string
Function name to encode
args
readonlyunknown[]
Function arguments
Returns
Uint8Array<ArrayBufferLike>
Encoded function call data
See
https://voltaire.tevm.sh/primitives/abiSince
0.0.0Throws
If function not found in ABIExample
encodeParameters()
encodeParameters<Defined in: src/primitives/Abi/encodeParameters.js:15TParams>(params,values):Uint8Array<ArrayBufferLike>
Type Parameters
TParams
TParams extends readonly Parameter[]
Parameters
params
TParams
values
ParametersToPrimitiveTypes<TParams>
Returns
Uint8Array<ArrayBufferLike>
encodeWrappedError()
encodeWrappedError(Defined in: src/primitives/Abi/error/wrapped/encodeWrappedError.js:27 Encode ERC-7751 wrapped error data Encodes a WrappedError following the ERC-7751 specification: error WrappedError(address target, bytes4 selector, bytes reason, bytes details)wrappedError):Uint8Array<ArrayBufferLike>
Parameters
wrappedError
WrappedErrorType
Wrapped error data
Returns
Uint8Array<ArrayBufferLike>
Encoded error data (selector + ABI-encoded params)
See
https://eips.ethereum.org/EIPS/eip-7751Example
Parameters()
Parameters<Defined in: src/primitives/Abi/encodeParameters.js:15TParams>(params,values):Uint8Array<ArrayBufferLike>
Type Parameters
TParams
TParams extends readonly Parameter[]
Parameters
params
TParams
values
ParametersToPrimitiveTypes<TParams>
Returns
Uint8Array<ArrayBufferLike>
parseLogs()
parseLogs(Defined in: src/primitives/Abi/parseLogs.js:21 Parse event logs (branded ABI method)this,logs): readonlyobject[]
Parameters
this
readonlyItem[]
logs
readonlyobject[]
Array of log objects
Returns
readonlyobject[]
Parsed event logs

