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.