From 16d1bf32ed13a083b522e8841a826bccd8e21f90 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 28 Aug 2020 09:52:22 -0400 Subject: [PATCH] refactor eventsDecoder --- apps/remix-ide/src/app/udapp/make-udapp.js | 6 +----- libs/remix-lib/src/execution/eventsDecoder.js | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/remix-ide/src/app/udapp/make-udapp.js b/apps/remix-ide/src/app/udapp/make-udapp.js index b7f8dff5b2..d7798c9faf 100644 --- a/apps/remix-ide/src/app/udapp/make-udapp.js +++ b/apps/remix-ide/src/app/udapp/make-udapp.js @@ -45,11 +45,7 @@ export function makeUdapp (blockchain, compilersArtefacts, logHtmlCallback) { blockchain.startListening(txlistener) const eventsDecoder = new EventsDecoder({ - api: { - resolveReceipt: function (tx, cb) { - transactionReceiptResolver.resolve(tx, cb) - } - } + resolveReceipt: transactionReceiptResolver.resolve.bind(transactionReceiptResolver) }) txlistener.startListening() registry.put({api: eventsDecoder, name: 'eventsDecoder'}) diff --git a/libs/remix-lib/src/execution/eventsDecoder.js b/libs/remix-lib/src/execution/eventsDecoder.js index b2a128e1cd..b524f8e5c2 100644 --- a/libs/remix-lib/src/execution/eventsDecoder.js +++ b/libs/remix-lib/src/execution/eventsDecoder.js @@ -7,8 +7,8 @@ const txHelper = require('./txHelper') * */ class EventsDecoder { - constructor (opt = {}) { - this._api = opt.api + constructor ({resolveReceipt}) { + this.resolveReceipt = resolveReceipt } /** @@ -20,7 +20,7 @@ class EventsDecoder { */ parseLogs (tx, contractName, compiledContracts, cb) { if (tx.isCall) return cb(null, { decoded: [], raw: [] }) - this._api.resolveReceipt(tx, (error, receipt) => { + this.resolveReceipt(tx, (error, receipt) => { if (error) return cb(error) this._decodeLogs(tx, receipt, contractName, compiledContracts, cb) })