Skip to content

AbiItem.format

Formats an AbiItem.AbiItem into a Human Readable ABI Item.

Imports

Named
import { AbiItem } from 'ox'

Examples

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

Definition

function format<abiItem>(
  abiItem: abiItem | AbiItem,
): abitype.FormatAbiItem<abiItem>

Source: src/AbiItem.ts

Parameters

abiItem

  • Type: abiItem | AbiItem

The ABI Item to format.

Return Type

The formatted ABI Item .

abitype.FormatAbiItem<abiItem>