Skip to content

parseAbiItem

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

Import

import { parseAbiItem } from 'viem'

Usage

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.

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; }',
])