decodeEventLog
decodeEventLog(
abi,log):object
Defined in: utils/decode-event-log.ts:71
Decodes an Ethereum event log using the provided ABI.
Matches topic0 against event signatures in the ABI, then decodes indexed parameters from topics[1..] and non-indexed parameters from data.
Parameters
Section titled “Parameters”the JSON ABI array containing event definitions
the log object with topics array and data hex string
string
topics
Section titled “topics”string[]
Returns
Section titled “Returns”object
an object with eventName and decoded args
args:
Record<string,any>
eventName
Section titled “eventName”eventName:
string
Example
Section titled “Example”const result = decodeEventLog(erc20ABI, { topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x000000000000000000000000abc0000000000000000000000000000000000001', '0x000000000000000000000000abc0000000000000000000000000000000000002', ], data: '0x0000000000000000000000000000000000000000000000000000000000000064',});// { eventName: 'Transfer', args: { from: '0xABC0...0001', to: '0xaBc0...0002', value: 100n } }