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
abi
the JSON ABI array containing event definitions
log
the log object with topics array and data hex string
data
string
topics
string[]
Returns
object
an object with eventName and decoded args
args
args:
Record<string,any>
eventName
eventName:
string
Example
const result = decodeEventLog(erc20ABI, { topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x000000000000000000000000abc0000000000000000000000000000000000001', '0x000000000000000000000000abc0000000000000000000000000000000000002', ], data: '0x0000000000000000000000000000000000000000000000000000000000000064',});// { eventName: 'Transfer', args: { from: '0xABC0...0001', to: '0xaBc0...0002', value: 100n } }