Skip to main content

Overview

Item.isEvent checks whether an ABI item is an event and narrows the type in TypeScript.

Example

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

const item = {
  type: 'event',
  name: 'Transfer',
  inputs: [
    { type: 'address', name: 'from', indexed: true },
    { type: 'address', name: 'to', indexed: true },
    { type: 'uint256', name: 'value' }
  ]
} as const;

if (Abi.Item.isEvent(item)) {
  const topic0 = Abi.Event.getSelector(item);
}

See Also