refactor eventsDecoder

pull/5370/head
Iuri Matias 4 years ago
parent a1b00ee484
commit 16d1bf32ed
  1. 6
      apps/remix-ide/src/app/udapp/make-udapp.js
  2. 6
      libs/remix-lib/src/execution/eventsDecoder.js

@ -45,11 +45,7 @@ export function makeUdapp (blockchain, compilersArtefacts, logHtmlCallback) {
blockchain.startListening(txlistener) blockchain.startListening(txlistener)
const eventsDecoder = new EventsDecoder({ const eventsDecoder = new EventsDecoder({
api: { resolveReceipt: transactionReceiptResolver.resolve.bind(transactionReceiptResolver)
resolveReceipt: function (tx, cb) {
transactionReceiptResolver.resolve(tx, cb)
}
}
}) })
txlistener.startListening() txlistener.startListening()
registry.put({api: eventsDecoder, name: 'eventsDecoder'}) registry.put({api: eventsDecoder, name: 'eventsDecoder'})

@ -7,8 +7,8 @@ const txHelper = require('./txHelper')
* *
*/ */
class EventsDecoder { class EventsDecoder {
constructor (opt = {}) { constructor ({resolveReceipt}) {
this._api = opt.api this.resolveReceipt = resolveReceipt
} }
/** /**
@ -20,7 +20,7 @@ class EventsDecoder {
*/ */
parseLogs (tx, contractName, compiledContracts, cb) { parseLogs (tx, contractName, compiledContracts, cb) {
if (tx.isCall) return cb(null, { decoded: [], raw: [] }) if (tx.isCall) return cb(null, { decoded: [], raw: [] })
this._api.resolveReceipt(tx, (error, receipt) => { this.resolveReceipt(tx, (error, receipt) => {
if (error) return cb(error) if (error) return cb(error)
this._decodeLogs(tx, receipt, contractName, compiledContracts, cb) this._decodeLogs(tx, receipt, contractName, compiledContracts, cb)
}) })

Loading…
Cancel
Save