Skip to content

Abi.format

Formats an Abi.Abi into a Human Readable ABI.

Imports

Named
import { Abi } from 'ox'

Examples

import { Abi } from 'ox'
 
const formatted = Abi.format([{
  type: 'function',
  name: 'approve',
  stateMutability: 'nonpayable',
  inputs: [
    {
      name: 'spender',
      type: 'address',
    },
    {
      name: 'amount',
      type: 'uint256',
    },
  ],
  outputs: [{ type: 'bool' }],
}])
 
const formatted: readonly ["function approve(address spender, uint256 amount) returns (bool)"]
formatted

Definition

function format(
  abi: Abi | readonly unknown[],
): readonly string[]

Source: src/core/Abi.ts

Parameters

abi

  • Type: Abi | readonly unknown[]

The ABI to format.

Return Type

The formatted ABI.

readonly string[]