AbiEvent.getSelector
Computes the event selector (hash of event signature) for an AbiEvent.AbiEvent
.
Imports
Named
import { AbiEvent } from 'ox'
Examples
import { AbiEvent } from 'ox'
const selector = AbiEvent.getSelector('event Transfer(address indexed from, address indexed to, uint256 value)')
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f556a2'
import { AbiEvent } from 'ox'
const selector = AbiEvent.getSelector({
name: 'Transfer',
type: 'event',
inputs: [
{ name: 'from', type: 'address', indexed: true },
{ name: 'to', type: 'address', indexed: true },
{ name: 'value', type: 'uint256' }
]
})
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f556a2'
Definition
function getSelector(
abiItem: AbiEvent.AbiEvent,
): Hex.Hex
Source: src/AbiEvent.ts
Parameters
abiItem
- Type:
AbiEvent.AbiEvent
The ABI event to compute the selector for.
abiItem.hash
- Type:
0x${string}
- Optional
abiItem.overloads
- Type:
readonly any[]
- Optional
Return Type
The Hash.keccak256
hash of the event signature.
Hex.Hex
Error Type
AbiEvent.getSelector.ErrorType