Skip to content
On this page

parseAbiItem

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

Import

ts
import { parseAbiItem } from 'viem'

Usage

ts
import { parseAbiItem } from 'viem'

const abiItem = parseAbiItem(
  //  ^? const abiItem: { name: "balanceOf"; type: "function"; stateMutability: "view";...
  'function balanceOf(address owner) view returns (uint256)',
)

Returns

Abi

Parsed ABI item.

Parameters

signatures

  • Type: string[]

Human-Readable ABI item.

ts
import { parseAbiItem } from 'viem'

const abiItem = parseAbiItem([
  //  ^? const abiItem: { name: "foo"; type: "function"; stateMutability: "view"; inputs:...
  'function foo(Baz bar) view returns (string)',
  'struct Baz { string name; }',
])

Released under the MIT License.