Skip to main content

Overview

Event.GetSelector builds a selector function that uses a custom keccak256String. Use this to swap in native/WASM hashing.

Quick Start

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

const getSelector = Abi.Event.GetSelector({
  keccak256String: (value) => myKeccak256String(value)
});

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

const topic0 = getSelector(Transfer);

See Also