Skip to content
On this page

parseAbi โ€‹

Parses human-readable ABI into JSON Abi. Re-exported from ABIType.

Import โ€‹

ts
import { parseAbi } from 'viem'

Usage โ€‹

ts
import { parseAbi } from 'viem'

const abi = parseAbi([
  //  ^? const abi: readonly [{ name: "balanceOf"; type: "function"; stateMutability:...
  'function balanceOf(address owner) view returns (uint256)',
  'event Transfer(address indexed from, address indexed to, uint256 amount)',
])

Returns โ€‹

Abi

The JSON ABI.

Parameters โ€‹

signatures โ€‹

  • Type: string[]

Human-readable ABI.

ts
import { parseAbi } from 'viem'

const abi = parseAbi([
  //  ^? const abi: readonly [{ name: "balanceOf"; type: "function"; stateMutability:...
  'function balanceOf(address owner) view returns (uint256)',
  'event Transfer(address indexed from, address indexed to, uint256 amount)',
])

Released under the MIT License.