diff --git a/src/app/tabs/runTab/model/blockchain.js b/src/app/tabs/runTab/model/blockchain.js index a3dd051285..ce0c5d8186 100644 --- a/src/app/tabs/runTab/model/blockchain.js +++ b/src/app/tabs/runTab/model/blockchain.js @@ -2,6 +2,7 @@ const remixLib = require('remix-lib') const txFormat = remixLib.execution.txFormat const txExecution = remixLib.execution.txExecution const typeConversion = remixLib.execution.typeConversion +const Txlistener = remixLib.execution.txListener const EventManager = remixLib.EventManager const ethJSUtil = require('ethereumjs-util') const Personal = require('web3-eth-personal') @@ -247,6 +248,12 @@ class Blockchain { web3 () { return this.executionContext.web3() } + + getTxListener(opts) { + const txlistener = new Txlistener(opts, this.executionContext) + return txlistener + } + } module.exports = Blockchain diff --git a/src/app/udapp/make-udapp.js b/src/app/udapp/make-udapp.js index 45d0713ec1..5b1ce24167 100644 --- a/src/app/udapp/make-udapp.js +++ b/src/app/udapp/make-udapp.js @@ -1,7 +1,6 @@ var registry = require('../../global/registry') var remixLib = require('remix-lib') var yo = require('yo-yo') -var Txlistener = remixLib.execution.txListener var EventsDecoder = remixLib.execution.EventsDecoder var TransactionReceiptResolver = require('../../lib/transactionReceiptResolver') @@ -16,7 +15,7 @@ export function makeUdapp (blockchain, udapp, executionContext, compilersArtefac // ----------------- Tx listener ----------------- const transactionReceiptResolver = new TransactionReceiptResolver(blockchain) - const txlistener = new Txlistener({ + const txlistener = blockchain.getTxListener({ api: { contracts: function () { if (compilersArtefacts['__last']) return compilersArtefacts['__last'].getContracts() @@ -28,7 +27,9 @@ export function makeUdapp (blockchain, udapp, executionContext, compilersArtefac }, event: { udapp: udapp.event - }}, executionContext) + } + }) + registry.put({api: txlistener, name: 'txlistener'}) udapp.startListening(txlistener)