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.