Skip to content

AbiItem.getSignature

Computes the stringified signature for a given AbiItem.AbiItem.

Imports

Named
import { AbiItem } from 'ox'

Examples

import { AbiItem } from 'ox'
 
const signature = AbiItem.getSignature('function ownerOf(uint256 tokenId)')
'ownerOf(uint256)'
import { Abi, AbiItem } from 'ox'
 
const erc20Abi = Abi.from([...])
 
const signature = AbiItem.getSignature(erc20Abi, 'ownerOf')
'ownerOf(uint256)'
import { AbiItem } from 'ox'
 
const signature = AbiItem.getSignature({
  name: 'ownerOf',
  type: 'function',
  inputs: [{ name: 'tokenId', type: 'uint256' }],
  outputs: [],
  stateMutability: 'view',
})
'ownerOf(uint256)'

Definition

function getSignature<abi, name>(
  abi: abi | Abi.Abi | readonly unknown[],
  name: name,
): string

Source: src/core/AbiItem.ts

Parameters

abi

  • Type: abi | Abi.Abi | readonly unknown[]

name

  • Type: name

Return Type

The stringified signature of the ABI Item.

string