Skip to content

Human-Readable ABI

Human-Readable ABIs compress JSON ABIs into signatures that are nicer to read and less verbose to write. For example:

ts
const abi = [
  'constructor()',
  'function balanceOf(address owner) view returns (uint256)',
  'event Transfer(address indexed from, address indexed to, uint256 amount)',
  'error ApprovalCallerNotOwnerNorApproved()',
] as const
const abi = [
  'constructor()',
  'function balanceOf(address owner) view returns (uint256)',
  'event Transfer(address indexed from, address indexed to, uint256 amount)',
  'error ApprovalCallerNotOwnerNorApproved()',
] as const
ts
const abi = [
  {
    inputs: [],
    stateMutability: 'nonpayable',
    type: 'constructor',
  },
  {
    inputs: [{ name: 'owner', type: 'address' }],
    name: 'balanceOf',
    outputs: [{ type: 'uint256' }],
    stateMutability: 'view',
    type: 'function',
  },
  {
    inputs: [
      {
        name: 'from',
        type: 'address',
        indexed: true,
      },
      { name: 'to', type: 'address', indexed: true },
      {
        name: 'tokenId',
        type: 'uint256',
        indexed: true,
      },
    ],
    name: 'Transfer',
    type: 'event',
  },
  { inputs: [], name: 'ApprovalCallerNotOwnerNorApproved', type: 'error' },
] as const
const abi = [
  {
    inputs: [],
    stateMutability: 'nonpayable',
    type: 'constructor',
  },
  {
    inputs: [{ name: 'owner', type: 'address' }],
    name: 'balanceOf',
    outputs: [{ type: 'uint256' }],
    stateMutability: 'view',
    type: 'function',
  },
  {
    inputs: [
      {
        name: 'from',
        type: 'address',
        indexed: true,
      },
      { name: 'to', type: 'address', indexed: true },
      {
        name: 'tokenId',
        type: 'uint256',
        indexed: true,
      },
    ],
    name: 'Transfer',
    type: 'event',
  },
  { inputs: [], name: 'ApprovalCallerNotOwnerNorApproved', type: 'error' },
] as const

ABIType contains parallel type-level and runtime utilities for parsing and formatting human-readable ABIs, ABI items, and ABI parameters.

Signature Types

For the most part, human-readable signatures match their Solidity counterparts and support function, event, error, struct, constructor, fallback, and receive types.

Functions

Function signatures match the following format:

ts
function name(inputs) scope mutability returns (outputs)
function name(inputs) scope mutability returns (outputs)
  • name function name.
  • inputs function input parameters (optional).
  • scope function scope (optional). Only supports 'public' | 'external'.
  • mutability function state mutability (optional). Supports AbiStateMutability.
  • outputs function outputs (optional).

Examples

ts
'function mint()' // name
'function withdraw(uint wad)' // name, inputs
'function activate() public' // name, scope
'function deposit() payable' // name, mutability
'function name() returns (string)' // name, outputs
'function tokenURI(uint256 tokenId) pure returns (string)' // name, inputs, mutability, outputs
'function mint()' // name
'function withdraw(uint wad)' // name, inputs
'function activate() public' // name, scope
'function deposit() payable' // name, mutability
'function name() returns (string)' // name, outputs
'function tokenURI(uint256 tokenId) pure returns (string)' // name, inputs, mutability, outputs

Events

Event signatures match the following format:

ts
event name(inputs)
event name(inputs)
  • name event name.
  • inputs event input parameters (optional). Parameters support the indexed modifier.

Examples

ts
'event Mint()' // name
'event Transfer(bytes32 indexed node, address owner)' // name, inputs
'event Mint()' // name
'event Transfer(bytes32 indexed node, address owner)' // name, inputs

Errors

Error signatures match the following format:

ts
error name(inputs)
error name(inputs)
  • name error name.
  • inputs error input parameters (optional).

Examples

ts
'event CriteriaNotEnabledForItem()' // name
'event InvalidRestrictedOrder(bytes32 orderHash)' // name, inputs
'event CriteriaNotEnabledForItem()' // name
'event InvalidRestrictedOrder(bytes32 orderHash)' // name, inputs

Structs

Struct signatures match the following format:

ts
struct Name { properties }
struct Name { properties }
  • Name struct name.
  • properties struct properties (colon-separated).

Examples

ts
'struct AdditionalRecipient { uint256; address; }' // unnamed properties
'struct AdditionalRecipient { uint256 amount; address recipient; }' // named properties
'struct AdditionalRecipient { uint256; address; }' // unnamed properties
'struct AdditionalRecipient { uint256 amount; address recipient; }' // named properties

Constructor

Constructor signatures match the following format:

ts
constructor(parameters) mutability
constructor(parameters) mutability
  • parameters constructor parameters (optional).
  • mutability constructor state mutability (optional). Supports 'payable'.

Examples

ts
'constructor()' // empty parameters
'constructor(address conduitController)' // name, parameters
'constructor(address conduitController) payable' // name, parameters, mutability
'constructor()' // empty parameters
'constructor(address conduitController)' // name, parameters
'constructor(address conduitController) payable' // name, parameters, mutability

Fallback

Fallback signatures match the following format:

ts
fallback() scope mutability
fallback() scope mutability

Examples

ts
'fallback() external' // scope
'fallback() external payable' // scope, mutability
'fallback() external' // scope
'fallback() external payable' // scope, mutability
  • scope fallback scope. Supports 'external'.
  • mutability fallback state mutability (optional). Supports 'payable'.

Receive

Receive signatures match the following format:

ts
receive() external payable
receive() external payable

Examples

ts
'receive() external payable'
'receive() external payable'

Syntax Rules

Some additional rules that apply to human-readable ABIs:

  • Whitespace matters. This allows us to infer TypeScript types at the type-level and make sure signatures are valid. For example, 'function name() returns (string)' is valid, but 'function name()returns(string)' is not.
  • No semi-colons. This is a stylistic choice to make signatures more readable.
  • No recursive structs. Structs can reference other structs, but not themselves or other structs in a circular way. For example, ['struct A { B; }', 'struct B { string; }'] is valid, but 'struct A { A; }' and ['struct A { B; }', 'struct B { A; }'] are not valid.
  • Modifier keywords. Modifier keywords like 'calldata', 'memory', and 'storage' are ignored when parsing signatures. For example, 'function name(string calldata)' is valid and 'calldata' will be ignored when parsing the signature.
  • Inline tuples. Inline tuples are supported for function inputs and outputs, error, event, and constructor inputs, and struct properties. For example, '(uint256, string)' is valid and corresponds to the following JSON ABI parameter: { type: 'tuple', components: [{ type: 'uint256' }, { type: 'string' }] }. You can also nest inline tuples inside inline tuples.
  • Named and unnamed parameters. Named and unnamed parameters/properties are both supported. For example, 'string foo' is named and 'string' is unnamed.

Types

Types for parsing and formatting human-readable ABIs.

ParseAbi

Parses human-readable ABI into JSON Abi.

NameDescriptionType
TSignaturesHuman-Readable ABI.string[]
returnsParsed AbiTAbi (inferred)

Example

ts
ts
import { ParseAbi } from 'abitype'
 
type Result = ParseAbi<[
type Result = readonly [{ readonly name: "balanceOf"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "owner"; }]; readonly outputs: readonly [{ readonly type: "uint256"; }]; }, { ...; }]
'function balanceOf(address owner) view returns (uint256)',
'event Transfer(address indexed from, address indexed to, uint256 amount)',
]>
Try
ts
import { ParseAbi } from 'abitype'
 
type Result = ParseAbi<[
type Result = readonly [{ readonly name: "balanceOf"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "owner"; }]; readonly outputs: readonly [{ readonly type: "uint256"; }]; }, { ...; }]
'function balanceOf(address owner) view returns (uint256)',
'event Transfer(address indexed from, address indexed to, uint256 amount)',
]>
Try

ParseAbiItem

Parses human-readable ABI item (e.g. error, event, function) into ABI item.

NameDescriptionType
TSignatureHuman-Readable ABI item.string[]
returnsParsed ABI itemTAbiItem (inferred)

Example

ts
ts
import { ParseAbiItem } from 'abitype'
 
type Result = ParseAbiItem<
type Result = { readonly name: "balanceOf"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "owner"; }]; readonly outputs: readonly [{ readonly type: "uint256"; }]; }
'function balanceOf(address owner) view returns (uint256)'
>
 
 
type ResultStruct = ParseAbiItem<[
type ResultStruct = { readonly name: "foo"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }]; readonly outputs: readonly [...]; }
'function foo(Baz bar) view returns (string)',
'struct Baz { string name; }',
]>
Try
ts
import { ParseAbiItem } from 'abitype'
 
type Result = ParseAbiItem<
type Result = { readonly name: "balanceOf"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "owner"; }]; readonly outputs: readonly [{ readonly type: "uint256"; }]; }
'function balanceOf(address owner) view returns (uint256)'
>
 
 
type ResultStruct = ParseAbiItem<[
type ResultStruct = { readonly name: "foo"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }]; readonly outputs: readonly [...]; }
'function foo(Baz bar) view returns (string)',
'struct Baz { string name; }',
]>
Try

ParseAbiParameter

Parses human-readable ABI parameter into AbiParameter.

NameDescriptionType
TParamHuman-Readable ABI parameter.string | string[]
returnsParsed AbiParameterTAbiParameter (inferred)

Example

ts
ts
import { ParseAbiParameter } from 'abitype'
 
type Result = ParseAbiParameter<'address from'>
type Result = { readonly type: "address"; readonly name: "from"; }
 
type ResultStruct = ParseAbiParameter<[
type ResultStruct = { readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }
'Baz bar',
'struct Baz { string name; }',
]>
Try
ts
import { ParseAbiParameter } from 'abitype'
 
type Result = ParseAbiParameter<'address from'>
type Result = { readonly type: "address"; readonly name: "from"; }
 
type ResultStruct = ParseAbiParameter<[
type ResultStruct = { readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }
'Baz bar',
'struct Baz { string name; }',
]>
Try

ParseAbiParameters

Parses human-readable ABI parameters into AbiParameters.

NameDescriptionType
TParamsHuman-Readable ABI parameters.string | string[]
returnsParsed AbiParametersTAbiParameter[] (inferred)

Example

ts
ts
import { ParseAbiParameters } from 'abitype'
 
type Result = ParseAbiParameters<'address from, address to, uint256 amount'>
type Result = readonly [{ readonly type: "address"; readonly name: "from"; }, { readonly type: "address"; readonly name: "to"; }, { readonly type: "uint256"; readonly name: "amount"; }]
 
type ResultStruct = ParseAbiParameters<[
type ResultStruct = readonly [{ readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }]
'Baz bar',
'struct Baz { string name; }',
]>
Try
ts
import { ParseAbiParameters } from 'abitype'
 
type Result = ParseAbiParameters<'address from, address to, uint256 amount'>
type Result = readonly [{ readonly type: "address"; readonly name: "from"; }, { readonly type: "address"; readonly name: "to"; }, { readonly type: "uint256"; readonly name: "amount"; }]
 
type ResultStruct = ParseAbiParameters<[
type ResultStruct = readonly [{ readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }]
'Baz bar',
'struct Baz { string name; }',
]>
Try

FormatAbi

Formats Abi into human-readable ABI.

NameDescriptionType
TAbiABIAbi
returnsHuman-Readable ABI.string[] (inferred)

Example

ts
ts
import { FormatAbi } from 'abitype'
 
type Result = FormatAbi<[
type Result = ["function balanceOf(address owner) view returns (uint256)", "event Transfer(address indexed from, address indexed to, uint256 amount)"]
{
name: 'balanceOf'
type: 'function'
stateMutability: 'view'
inputs: [{ type: 'address'; name: 'owner' }]
outputs: [{ type: 'uint256' }]
},
{
name: 'Transfer'
type: 'event'
inputs: [
{ type: 'address'; name: 'from'; indexed: true },
{ type: 'address'; name: 'to'; indexed: true },
{ type: 'uint256'; name: 'amount' },
]
},
]>
Try
ts
import { FormatAbi } from 'abitype'
 
type Result = FormatAbi<[
type Result = ["function balanceOf(address owner) view returns (uint256)", "event Transfer(address indexed from, address indexed to, uint256 amount)"]
{
name: 'balanceOf'
type: 'function'
stateMutability: 'view'
inputs: [{ type: 'address'; name: 'owner' }]
outputs: [{ type: 'uint256' }]
},
{
name: 'Transfer'
type: 'event'
inputs: [
{ type: 'address'; name: 'from'; indexed: true },
{ type: 'address'; name: 'to'; indexed: true },
{ type: 'uint256'; name: 'amount' },
]
},
]>
Try

FormatAbiItem

Formats Abi item (e.g. error, event, function) into human-readable ABI parameter.

NameDescriptionType
TAbiItemABI itemAbi[number]
returnsHuman-Readable ABI item.string (inferred)

Example

ts
ts
import { FormatAbiItem } from 'abitype'
 
type Result = FormatAbiItem<{
type Result = "function balanceOf(address owner) view returns (uint256)"
name: 'balanceOf'
type: 'function'
stateMutability: 'view'
inputs: [{ type: 'address'; name: 'owner' }]
outputs: [{ type: 'uint256' }]
}>
Try
ts
import { FormatAbiItem } from 'abitype'
 
type Result = FormatAbiItem<{
type Result = "function balanceOf(address owner) view returns (uint256)"
name: 'balanceOf'
type: 'function'
stateMutability: 'view'
inputs: [{ type: 'address'; name: 'owner' }]
outputs: [{ type: 'uint256' }]
}>
Try

FormatAbiParameter

Formats AbiParameter into human-readable ABI parameter.

NameDescriptionType
TAbiParameterABI parameterAbiParameter
returnsHuman-Readable ABI parameters.string[] (inferred)

Example

ts
ts
import { FormatAbiParameter } from 'abitype'
 
type Result = FormatAbiParameter<{ type: 'address'; name: 'from' }>
type Result = "address from"
Try
ts
import { FormatAbiParameter } from 'abitype'
 
type Result = FormatAbiParameter<{ type: 'address'; name: 'from' }>
type Result = "address from"
Try

FormatAbiParameters

Formats AbiParameters into human-readable ABI parameters.

NameDescriptionType
TAbiParametersABI parametersAbiParameter[]
returnsHuman-Readable ABI parameter.string (inferred)

Example

ts
ts
import { FormatAbiParameters } from 'abitype'
 
type Result = FormatAbiParameters<[
type Result = "address from, uint256 tokenId"
{ type: 'address'; name: 'from' },
{ type: 'uint256'; name: 'tokenId' },
]>
Try
ts
import { FormatAbiParameters } from 'abitype'
 
type Result = FormatAbiParameters<[
type Result = "address from, uint256 tokenId"
{ type: 'address'; name: 'from' },
{ type: 'uint256'; name: 'tokenId' },
]>
Try

Utilities

Runtime functions for parsing and formatting human-readable ABIs.

WARNING

These functions throw errors for invalid inputs. Make sure you handle errors appropriately.

parseAbi

Parses human-readable ABI into JSON Abi.

NameDescriptionType
signaturesHuman-Readable ABI.string[]
returnsParsed AbiTAbi (inferred)

Example

ts
ts
import { parseAbi } from 'abitype'
 
const abi = parseAbi([
const abi: readonly [{ readonly name: "balanceOf"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "owner"; }]; readonly outputs: readonly [{ readonly type: "uint256"; }]; }, { ...; }]
'function balanceOf(address owner) view returns (uint256)',
'event Transfer(address indexed from, address indexed to, uint256 amount)',
])
Try
ts
import { parseAbi } from 'abitype'
 
const abi = parseAbi([
const abi: readonly [{ readonly name: "balanceOf"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "owner"; }]; readonly outputs: readonly [{ readonly type: "uint256"; }]; }, { ...; }]
'function balanceOf(address owner) view returns (uint256)',
'event Transfer(address indexed from, address indexed to, uint256 amount)',
])
Try

parseAbiItem

Parses human-readable ABI item (e.g. error, event, function) into ABI item.

NameDescriptionType
signatureHuman-Readable ABI item.string | string[]
returnsParsed ABI itemTAbiItem (inferred)

Example

ts
ts
import { parseAbiItem } from 'abitype'
 
const abiItem = parseAbiItem(
const abiItem: { readonly name: "balanceOf"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "owner"; }]; readonly outputs: readonly [{ readonly type: "uint256"; }]; }
'function balanceOf(address owner) view returns (uint256)',
)
 
const abiItemStruct = parseAbiItem([
const abiItemStruct: { readonly name: "foo"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }]; readonly outputs: readonly [...]; }
'function foo(Baz bar) view returns (string)',
'struct Baz { string name; }',
])
Try
ts
import { parseAbiItem } from 'abitype'
 
const abiItem = parseAbiItem(
const abiItem: { readonly name: "balanceOf"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "address"; readonly name: "owner"; }]; readonly outputs: readonly [{ readonly type: "uint256"; }]; }
'function balanceOf(address owner) view returns (uint256)',
)
 
const abiItemStruct = parseAbiItem([
const abiItemStruct: { readonly name: "foo"; readonly type: "function"; readonly stateMutability: "view"; readonly inputs: readonly [{ readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }]; readonly outputs: readonly [...]; }
'function foo(Baz bar) view returns (string)',
'struct Baz { string name; }',
])
Try

parseAbiParameter

Parses human-readable ABI parameter into AbiParameter.

NameDescriptionType
paramHuman-Readable ABI parameter.string | string[]
returnsParsed AbiParameterTAbiParameter (inferred)

Example

ts
ts
import { parseAbiParameter } from 'abitype'
 
const abiParameter = parseAbiParameter('address from')
const abiParameter: { readonly type: "address"; readonly name: "from"; }
 
const abiParameterStruct = parseAbiParameter([
const abiParameterStruct: { readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }
'Baz bar',
'struct Baz { string name; }',
])
Try
ts
import { parseAbiParameter } from 'abitype'
 
const abiParameter = parseAbiParameter('address from')
const abiParameter: { readonly type: "address"; readonly name: "from"; }
 
const abiParameterStruct = parseAbiParameter([
const abiParameterStruct: { readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }
'Baz bar',
'struct Baz { string name; }',
])
Try

parseAbiParameters

Parses human-readable ABI parameters into AbiParameters.

NameDescriptionType
paramsHuman-Readable ABI parameters.string | string[]
returnsParsed AbiParametersTAbiParameter[] (inferred)

Example

ts
ts
import { parseAbiParameters } from 'abitype'
 
const abiParameters = parseAbiParameters(
const abiParameters: readonly [{ readonly type: "address"; readonly name: "from"; }, { readonly type: "address"; readonly name: "to"; }, { readonly type: "uint256"; readonly name: "amount"; }]
'address from, address to, uint256 amount',
)
 
const abiParametersStruct = parseAbiParameters([
const abiParametersStruct: readonly [{ readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }]
'Baz bar',
'struct Baz { string name; }',
])
Try
ts
import { parseAbiParameters } from 'abitype'
 
const abiParameters = parseAbiParameters(
const abiParameters: readonly [{ readonly type: "address"; readonly name: "from"; }, { readonly type: "address"; readonly name: "to"; }, { readonly type: "uint256"; readonly name: "amount"; }]
'address from, address to, uint256 amount',
)
 
const abiParametersStruct = parseAbiParameters([
const abiParametersStruct: readonly [{ readonly type: "tuple"; readonly components: readonly [{ readonly type: "string"; readonly name: "name"; }]; readonly name: "bar"; }]
'Baz bar',
'struct Baz { string name; }',
])
Try

formatAbi

Formats Abi into human-readable ABI.

NameDescriptionType
abiABIAbi
returnsHuman-Readable ABI.string[] (inferred)

Example

ts
ts
import { formatAbi } from 'abitype'
 
const result = formatAbi([
const result: readonly ["function balanceOf(address owner) view returns (uint256)", "event Transfer(address indexed from, address indexed to, uint256 amount)"]
{
name: 'balanceOf',
type: 'function',
stateMutability: 'view',
inputs: [{ type: 'address', name: 'owner' }],
outputs: [{ type: 'uint256' }],
},
{
name: 'Transfer',
type: 'event',
inputs: [
{ type: 'address', name: 'from', indexed: true },
{ type: 'address', name: 'to', indexed: true },
{ type: 'uint256', name: 'amount' },
],
},
])
Try
ts
import { formatAbi } from 'abitype'
 
const result = formatAbi([
const result: readonly ["function balanceOf(address owner) view returns (uint256)", "event Transfer(address indexed from, address indexed to, uint256 amount)"]
{
name: 'balanceOf',
type: 'function',
stateMutability: 'view',
inputs: [{ type: 'address', name: 'owner' }],
outputs: [{ type: 'uint256' }],
},
{
name: 'Transfer',
type: 'event',
inputs: [
{ type: 'address', name: 'from', indexed: true },
{ type: 'address', name: 'to', indexed: true },
{ type: 'uint256', name: 'amount' },
],
},
])
Try

formatAbiItem

Formats Abi item (e.g. error, event, function) into human-readable ABI parameter.

NameDescriptionType
abiItemABI itemAbi[number]
returnsHuman-Readable ABI item.string (inferred)

Example

ts
ts
import { formatAbiItem } from 'abitype'
 
const result = formatAbiItem({
const result: "function balanceOf(address owner) view returns (uint256)"
name: 'balanceOf',
type: 'function',
stateMutability: 'view',
inputs: [{ type: 'address', name: 'owner' }],
outputs: [{ type: 'uint256' }],
})
Try
ts
import { formatAbiItem } from 'abitype'
 
const result = formatAbiItem({
const result: "function balanceOf(address owner) view returns (uint256)"
name: 'balanceOf',
type: 'function',
stateMutability: 'view',
inputs: [{ type: 'address', name: 'owner' }],
outputs: [{ type: 'uint256' }],
})
Try

formatAbiParameter

Formats AbiParameter into human-readable ABI parameter.

NameDescriptionType
abiParameterABI parameterAbiParameter
returnsHuman-Readable ABI parameter.string (inferred)

Example

ts
ts
import { formatAbiParameter } from 'abitype'
 
const result = formatAbiParameter({ type: 'address', name: 'from' })
const result: "address from"
Try
ts
import { formatAbiParameter } from 'abitype'
 
const result = formatAbiParameter({ type: 'address', name: 'from' })
const result: "address from"
Try

formatAbiParameters

Formats AbiParameters into human-readable ABI parameters.

NameDescriptionType
abiParametersABI parametersAbiParameter[]
returnsHuman-Readable ABI parameter.string (inferred)

Example

ts
ts
import { formatAbiParameters } from 'abitype'
 
const result = formatAbiParameters([
const result: "address from, uint256 tokenId"
{ type: 'address', name: 'from' },
{ type: 'uint256', name: 'tokenId' },
])
Try
ts
import { formatAbiParameters } from 'abitype'
 
const result = formatAbiParameters([
const result: "address from, uint256 tokenId"
{ type: 'address', name: 'from' },
{ type: 'uint256', name: 'tokenId' },
])
Try

Errors

ts
ts
import {
CircularReferenceError,
InvalidParenthesisError,
UnknownSignatureError,
InvalidSignatureError,
InvalidStructSignatureError,
InvalidAbiParameterError,
InvalidAbiParametersError,
InvalidParameterError,
SolidityProtectedKeywordError,
InvalidModifierError,
InvalidFunctionModifierError,
InvalidAbiTypeParameterError,
InvalidAbiItemError,
UnknownTypeError,
} from 'abitype'
Try
ts
import {
CircularReferenceError,
InvalidParenthesisError,
UnknownSignatureError,
InvalidSignatureError,
InvalidStructSignatureError,
InvalidAbiParameterError,
InvalidAbiParametersError,
InvalidParameterError,
SolidityProtectedKeywordError,
InvalidModifierError,
InvalidFunctionModifierError,
InvalidAbiTypeParameterError,
InvalidAbiItemError,
UnknownTypeError,
} from 'abitype'
Try

Released under the MIT License.