fix retrieving events abi

pull/5370/head
yann300 3 years ago
parent 0850267267
commit f68dbbdd1e
  1. 23
      libs/remix-lib/src/execution/eventsDecoder.ts

@ -56,18 +56,19 @@ export class EventsDecoder {
return eventsABI return eventsABI
} }
_event (hash, eventsABI) { _event (hash: string, eventsABI: Record<string, unknown>, contractName: string) {
for (const k in eventsABI) { const events = eventsABI[contractName]
if (eventsABI[k][hash]) { if (!events) return null
const event = eventsABI[k][hash]
for (const input of event.inputs) { if (events[hash]) {
if (input.type === 'function') { const event = events[hash]
input.type = 'bytes24' for (const input of event.inputs) {
input.baseType = 'bytes24' if (input.type === 'function') {
} input.type = 'bytes24'
input.baseType = 'bytes24'
} }
return event
} }
return event
} }
return null return null
} }
@ -94,7 +95,7 @@ export class EventsDecoder {
// [address, topics, mem] // [address, topics, mem]
const log = logs[i] const log = logs[i]
const topicId = log.topics[0] const topicId = log.topics[0]
const eventAbi = this._event(topicId.replace('0x', ''), eventsABI) const eventAbi = this._event(topicId.replace('0x', ''), eventsABI, contractName)
if (eventAbi) { if (eventAbi) {
const decodedlog = eventAbi.abi.parseLog(log) const decodedlog = eventAbi.abi.parseLog(log)
const decoded = {} const decoded = {}

Loading…
Cancel
Save