Skip to content

AbiFunction.format

Formats an AbiFunction.AbiFunction into a Human Readable ABI Function.

Imports

Named
import { AbiFunction } from 'ox'

Examples

import { AbiFunction } from 'ox'
 
const formatted = AbiFunction.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<abiFunction>(
  abiFunction: abiFunction | AbiFunction,
): abitype.FormatAbiItem<abiFunction>

Source: src/core/AbiFunction.ts

Parameters

abiFunction

  • Type: abiFunction | AbiFunction

The ABI Function to format.

Return Type

The formatted ABI Function.

abitype.FormatAbiItem<abiFunction>