toEventHash
Returns the hash (of the event signature) for a given event definition.
Install
import { toEventHash } from 'viem'Usage
import { } from 'viem'
const = ('event Transfer(address,address,uint256)')
Output: 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef const = ({
: 'Transfer',
: 'event',
: [
{ : 'from', : 'address', : true },
{ : 'to', : 'address', : true },
{ : 'amount', : 'uint256', : false },
],
})
Output: 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efReturns
The hash of the event signature.
Parameters
event
- Type:
string|AbiEvent
The event to generate a hash for.