Skip to content

Types

Types covering the Contract ABI and EIP-712 Typed Data Specifications.

Abi

Type matching the Contract ABI Specification

import { 
type Abi = readonly (AbiConstructor | AbiError | AbiEvent | AbiFallback | AbiFunction | AbiReceive)[]
Abi
} from 'abitype'

AbiConstructor

ABI Constructor type

import { 
type AbiConstructor = { type: "constructor"; inputs: readonly AbiParameter[]; payable?: boolean | undefined; stateMutability: Extract<AbiStateMutability, "payable" | "nonpayable">; }

ABI "constructor" type

AbiConstructor
} from 'abitype'

AbiError

ABI Error type

import { 
type AbiError = { type: "error"; inputs: readonly AbiParameter[]; name: string; }

ABI "error" type

AbiError
} from 'abitype'

AbiEvent

ABI Event type

import { 
type AbiEvent = { type: "event"; anonymous?: boolean | undefined; inputs: readonly AbiEventParameter[]; name: string; }

ABI "event" type

AbiEvent
} from 'abitype'

AbiFallback

ABI Fallback type

import { 
type AbiFallback = { type: "fallback"; payable?: boolean | undefined; stateMutability: Extract<AbiStateMutability, "payable" | "nonpayable">; }

ABI "fallback" type

AbiFallback
} from 'abitype'

AbiFunction

ABI Function type

import { 
type AbiFunction = { type: "function"; constant?: boolean | undefined; gas?: number | undefined; inputs: readonly AbiParameter[]; name: string; outputs: readonly AbiParameter[]; payable?: boolean | undefined; stateMutability: AbiStateMutability; }

ABI "function" type

AbiFunction
} from 'abitype'

AbiInternalType

Representation used by Solidity compiler (e.g. 'string', 'int256', 'struct Foo')

import { 
type AbiInternalType = string
AbiInternalType
} from 'abitype'

AbiItemType

"type" name for Abi items (e.g. 'type': 'function' for AbiFunction)

import { 
type AbiInternalType = string
AbiInternalType
} from 'abitype'

AbiParameter

inputs and outputs item for ABI functions, errors, and constructors

import { 
type AbiParameter = { type: string; name?: string | undefined | undefined; internalType?: string | undefined; } | { type: "tuple" | `tuple[${string}]`; name?: string | undefined | undefined; internalType?: string | undefined; components: readonly AbiParameter[]; }
AbiParameter
} from 'abitype'

AbiEventParameter

inputs for ABI events

import { 
type AbiEventParameter = AbiParameter & { indexed?: boolean | undefined; }
AbiEventParameter
} from 'abitype'

AbiParameterKind

Kind of ABI parameter: 'inputs' | 'outputs'

import { 
type AbiParameterKind = "inputs" | "outputs"

Kind of AbiParameter

AbiParameterKind
} from 'abitype'

AbiReceive

ABI Receive type

import { 
type AbiReceive = { type: "receive"; stateMutability: Extract<AbiStateMutability, "payable">; }

ABI "receive" type

AbiReceive
} from 'abitype'

AbiStateMutability

ABI Function behavior

import { 
type AbiStateMutability = "pure" | "view" | "nonpayable" | "payable"

State mutability for AbiFunction

AbiStateMutability
} from 'abitype'

AbiType

ABI canonical types

import { 
type AbiType = "string" | "function" | "address" | "bool" | "bytes" | "bytes1" | "bytes2" | "bytes3" | "bytes4" | "bytes5" | "bytes6" | "bytes7" | "bytes8" | "bytes9" | "bytes10" | "bytes11" | "bytes12" | "bytes13" | "bytes14" | "bytes15" | "bytes16" | "bytes17" | "bytes18" | "bytes19" | "bytes20" | "bytes21" | "bytes22" | "bytes23" | "bytes24" | "bytes25" | "bytes26" | "bytes27" | "bytes28" | "bytes29" | "bytes30" | "bytes31" | "bytes32" | "int" | "int8" | "int16" | "int24" | "int32" | "int40" | "int48" | "int56" | "int64" | "int72" | "int80" | "int88" | "int96" | ... 54 more ... | SolidityArray
AbiType
} from 'abitype'

Solidity types

Solidity types as template strings

import {
  
type SolidityAddress = "address"
SolidityAddress
,
type SolidityArray = `string[${string}]` | `function[${string}]` | `address[${string}]` | `bool[${string}]` | `bytes[${string}]` | `bytes1[${string}]` | `bytes2[${string}]` | `bytes3[${string}]` | `bytes4[${string}]` | `bytes5[${string}]` | `bytes6[${string}]` | `bytes7[${string}]` | `bytes8[${string}]` | `bytes9[${string}]` | `bytes10[${string}]` | `bytes11[${string}]` | `bytes12[${string}]` | `bytes13[${string}]` | `bytes14[${string}]` | `bytes15[${string}]` | `bytes16[${string}]` | `bytes17[${string}]` | `bytes18[${string}]` | `bytes19[${string}]` | `bytes20[${string}]` | `bytes21[${string}]` | `bytes22[${string}]` | `bytes23[${string}]` | `bytes24[${string}]` | `bytes25[${string}]` | `bytes26[${string}]` | `bytes27[${string}]` | `bytes28[${string}]` | `bytes29[${string}]` | `bytes30[${string}]` | `bytes31[${string}]` | `bytes32[${string}]` | `int[${string}]` | `int8[${string}]` | `int16[${string}]` | `int24[${string}]` | `int32[${string}]` | `int40[${string}]` | `int48[${string}]` | `int56[${string}]` | `int64[${string}]` | `int72[${string}]` | `int80[${string}]` | `int88[${string}]` | `int96[${string}]` | `int104[${string}]` | ... 52 more ... | `tuple[${string}]`
SolidityArray
,
type SolidityBool = "bool"
SolidityBool
,
type SolidityBytes = "bytes" | "bytes1" | "bytes2" | "bytes3" | "bytes4" | "bytes5" | "bytes6" | "bytes7" | "bytes8" | "bytes9" | "bytes10" | "bytes11" | "bytes12" | "bytes13" | "bytes14" | "bytes15" | "bytes16" | "bytes17" | "bytes18" | "bytes19" | "bytes20" | "bytes21" | "bytes22" | "bytes23" | "bytes24" | "bytes25" | "bytes26" | "bytes27" | "bytes28" | "bytes29" | "bytes30" | "bytes31" | "bytes32"
SolidityBytes
,
type SolidityFunction = "function"
SolidityFunction
,
type SolidityInt = "int" | "int8" | "int16" | "int24" | "int32" | "int40" | "int48" | "int56" | "int64" | "int72" | "int80" | "int88" | "int96" | "int104" | "int112" | "int120" | "int128" | "int136" | "int144" | "int152" | "int160" | "int168" | "int176" | "int184" | "int192" | "int200" | "int208" | "int216" | "int224" | "int232" | "int240" | "int248" | "int256" | "uint" | "uint8" | "uint16" | "uint24" | "uint32" | "uint40" | "uint48" | "uint56" | "uint64" | "uint72" | "uint80" | "uint88" | "uint96" | "uint104" | "uint112" | "uint120" | "uint128" | "uint136" | "uint144" | ... 13 more ... | "uint256"
SolidityInt
,
type SolidityString = "string"
SolidityString
,
type SolidityTuple = "tuple"
SolidityTuple
,
} from 'abitype'

TypedData

EIP-712 Typed Data Specification

import { 
type TypedData = { [x: string]: readonly TypedDataParameter[]; [x: `string[${string}]`]: undefined; [x: `function[${string}]`]: undefined; [x: `address[${string}]`]: undefined; [x: `bool[${string}]`]: undefined; [x: `bytes[${string}]`]: undefined; [x: `bytes1[${string}]`]: undefined; [x: `bytes2[${string}]`]: undefined; [x: `bytes3[${string}]`]: undefined; [x: `bytes4[${string}]`]: undefined; [x: `bytes5[${string}]`]: undefined; [x: `bytes6[${string}]`]: undefined; [x: `bytes7[${string}]`]: undefined; [x: `bytes8[${string}]`]: undefined; [x: `bytes9[${string}]`]: undefined; [x: `bytes10[${string}]`]: undefined; [x: `bytes11[${string}]`]: undefined; [x: `bytes12[${string}]`]: undefined; [x: `bytes13[${string}]`]: undefined; [x: `bytes14[${string}]`]: undefined; [x: `bytes15[${string}]`]: undefined; [x: `bytes16[${string}]`]: undefined; [x: `bytes17[${string}]`]: undefined; [x: `bytes18[${string}]`]: undefined; [x: `bytes19[${string}]`]: undefined; [x: `bytes20[${string}]`]: undefined; [x: `bytes21[${string}]`]: undefined; [x: `bytes22[${string}]`]: undefined; [x: `bytes23[${string}]`]: undefined; [x: `bytes24[${string}]`]: undefined; [x: `bytes25[${string}]`]: undefined; [x: `bytes26[${string}]`]: undefined; [x: `bytes27[${string}]`]: undefined; [x: `bytes28[${string}]`]: undefined; [x: `bytes29[${string}]`]: undefined; [x: `bytes30[${string}]`]: undefined; [x: `bytes31[${string}]`]: undefined; [x: `bytes32[${string}]`]: undefined; [x: `int[${string}]`]: undefined; [x: `int8[${string}]`]: undefined; [x: `int16[${string}]`]: undefined; [x: `int24[${string}]`]: undefined; [x: `int32[${string}]`]: undefined; [x: `int40[${string}]`]: undefined; [x: `int48[${string}]`]: undefined; [x: `int56[${string}]`]: undefined; [x: `int64[${string}]`]: undefined; [x: `int72[${string}]`]: undefined; [x: `int80[${string}]`]: undefined; [x: `int88[${string}]`]: undefined; [x: `int96[${string}]`]: undefined; [x: `int104[${string}]`]: undefined; [x: `int112[${string}]`]: undefined; [x: `int120[${string}]`]: undefined; [x: `int128[${string}]`]: undefined; [x: `int136[${string}]`]: undefined; [x: `int144[${string}]`]: undefined; [x: `int152[${string}]`]: undefined; [x: `int160[${string}]`]: undefined; [x: `int168[${string}]`]: undefined; [x: `int176[${string}]`]: undefined; [x: `int184[${string}]`]: undefined; [x: `int192[${string}]`]: undefined; [x: `int200[${string}]`]: undefined; [x: `int208[${string}]`]: undefined; [x: `int216[${string}]`]: undefined; [x: `int224[${string}]`]: undefined; [x: `int232[${string}]`]: undefined; [x: `int240[${string}]`]: undefined; [x: `int248[${string}]`]: undefined; [x: `int256[${string}]`]: undefined; [x: `uint[${string}]`]: undefined; [x: `uint8[${string}]`]: undefined; [x: `uint16[${string}]`]: undefined; [x: `uint24[${string}]`]: undefined; [x: `uint32[${string}]`]: undefined; [x: `uint40[${string}]`]: undefined; [x: `uint48[${string}]`]: undefined; [x: `uint56[${string}]`]: undefined; [x: `uint64[${string}]`]: undefined; [x: `uint72[${string}]`]: undefined; [x: `uint80[${string}]`]: undefined; [x: `uint88[${string}]`]: undefined; [x: `uint96[${string}]`]: undefined; [x: `uint104[${string}]`]: undefined; [x: `uint112[${string}]`]: undefined; [x: `uint120[${string}]`]: undefined; [x: `uint128[${string}]`]: undefined; [x: `uint136[${string}]`]: undefined; [x: `uint144[${string}]`]: undefined; [x: `uint152[${string}]`]: undefined; [x: `uint160[${string}]`]: undefined; [x: `uint168[${string}]`]: undefined; [x: `uint176[${string}]`]: undefined; [x: `uint184[${string}]`]: undefined; [x: `uint192[${string}]`]: undefined; [x: `uint200[${string}]`]: undefined; [x: `uint208[${string}]`]: undefined; [x: `uint216[${string}]`]: undefined; [x: `uint224[${string}]`]: undefined; [x: `uint232[${string}]`]: undefined; [x: `uint240[${string}]`]: undefined; [x: `uint248[${string}]`]: undefined; [x: `uint256[${string}]`]: undefined; ... 99 more ...; uint256?: undefined; }

EIP-712 Typed Data Specification

TypedData
} from 'abitype'

TypedDataDomain

EIP-712 Domain

import { 
type TypedDataDomain = { chainId?: number | bigint | undefined; name?: string | undefined; salt?: ResolvedRegister["bytesType"]["outputs"] | undefined; verifyingContract?: Address | undefined; version?: string | undefined; }
TypedDataDomain
} from 'abitype'

TypedDataParameter

Entry in TypedData type items

import { 
type TypedDataParameter = { name: string; type: TypedDataType | keyof TypedData | `${keyof TypedData}[${string | ""}]`; }
TypedDataParameter
} from 'abitype'

TypedDataType

Subset of AbiType that excludes tuple and function

import { 
type TypedDataType = "string" | "address" | "bool" | "bytes" | "bytes1" | "bytes2" | "bytes3" | "bytes4" | "bytes5" | "bytes6" | "bytes7" | "bytes8" | "bytes9" | "bytes10" | "bytes11" | "bytes12" | "bytes13" | "bytes14" | "bytes15" | "bytes16" | "bytes17" | "bytes18" | "bytes19" | "bytes20" | "bytes21" | "bytes22" | "bytes23" | "bytes24" | "bytes25" | "bytes26" | "bytes27" | "bytes28" | "bytes29" | "bytes30" | "bytes31" | "bytes32" | "int8" | "int16" | "int24" | "int32" | "int40" | "int48" | "int56" | "int64" | "int72" | "int80" | "int88" | "int96" | "int104" | "int112" | ... 152 more ... | `uint256[${string}]`
TypedDataType
} from 'abitype'