Skip to main content

Overview

Item.isFunction checks whether an ABI item is a function and narrows the type in TypeScript.

Example

import { Abi } from '@tevm/voltaire/Abi';

const item = {
  type: 'function',
  name: 'balanceOf',
  inputs: [{ type: 'address', name: 'owner' }],
  outputs: [{ type: 'uint256' }]
} as const;

if (Abi.Item.isFunction(item)) {
  const selector = Abi.Function.getSelector(item);
}

See Also