parseAbi
Parses human-readable ABI into JSON Abi
. Re-exported from ABIType.
Import
ts
import { parseAbi } from 'viem'
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)',
])
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
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)',
])
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)',
])