Skip to content
LogoLogo

toFunctionSignature

Returns the signature for a given function definition.

Install

import { toFunctionSignature } from 'viem'

Usage

import {  } from 'viem'
 
// from function definition
const  = ('function ownerOf(uint256 tokenId)')
Output: ownerOf(uint256)
// from an `AbiFunction` on your contract ABI const = ({ : 'ownerOf', : 'function', : [{ : 'tokenId', : 'uint256' }], : [], : 'view', })
Output: ownerOf(uint256)

Returns

string

The signature as a string value.

Parameters

definition

  • Type: string | AbiFunction

The function definition to generate a signature for.