Skip to content

parseAbi

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

Import

import { parseAbi } from 'viem'

Usage

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.

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