Commit 222e698e authored by Iuri Matias's avatar Iuri Matias

abstract txlistener

parent 30fe405b
...@@ -2,6 +2,7 @@ const remixLib = require('remix-lib') ...@@ -2,6 +2,7 @@ const remixLib = require('remix-lib')
const txFormat = remixLib.execution.txFormat const txFormat = remixLib.execution.txFormat
const txExecution = remixLib.execution.txExecution const txExecution = remixLib.execution.txExecution
const typeConversion = remixLib.execution.typeConversion const typeConversion = remixLib.execution.typeConversion
const Txlistener = remixLib.execution.txListener
const EventManager = remixLib.EventManager const EventManager = remixLib.EventManager
const ethJSUtil = require('ethereumjs-util') const ethJSUtil = require('ethereumjs-util')
const Personal = require('web3-eth-personal') const Personal = require('web3-eth-personal')
...@@ -247,6 +248,12 @@ class Blockchain { ...@@ -247,6 +248,12 @@ class Blockchain {
web3 () { web3 () {
return this.executionContext.web3() return this.executionContext.web3()
} }
getTxListener(opts) {
const txlistener = new Txlistener(opts, this.executionContext)
return txlistener
}
} }
module.exports = Blockchain module.exports = Blockchain
var registry = require('../../global/registry') var registry = require('../../global/registry')
var remixLib = require('remix-lib') var remixLib = require('remix-lib')
var yo = require('yo-yo') var yo = require('yo-yo')
var Txlistener = remixLib.execution.txListener
var EventsDecoder = remixLib.execution.EventsDecoder var EventsDecoder = remixLib.execution.EventsDecoder
var TransactionReceiptResolver = require('../../lib/transactionReceiptResolver') var TransactionReceiptResolver = require('../../lib/transactionReceiptResolver')
...@@ -16,7 +15,7 @@ export function makeUdapp (blockchain, udapp, executionContext, compilersArtefac ...@@ -16,7 +15,7 @@ export function makeUdapp (blockchain, udapp, executionContext, compilersArtefac
// ----------------- Tx listener ----------------- // ----------------- Tx listener -----------------
const transactionReceiptResolver = new TransactionReceiptResolver(blockchain) const transactionReceiptResolver = new TransactionReceiptResolver(blockchain)
const txlistener = new Txlistener({ const txlistener = blockchain.getTxListener({
api: { api: {
contracts: function () { contracts: function () {
if (compilersArtefacts['__last']) return compilersArtefacts['__last'].getContracts() if (compilersArtefacts['__last']) return compilersArtefacts['__last'].getContracts()
...@@ -28,7 +27,9 @@ export function makeUdapp (blockchain, udapp, executionContext, compilersArtefac ...@@ -28,7 +27,9 @@ export function makeUdapp (blockchain, udapp, executionContext, compilersArtefac
}, },
event: { event: {
udapp: udapp.event udapp: udapp.event
}}, executionContext) }
})
registry.put({api: txlistener, name: 'txlistener'}) registry.put({api: txlistener, name: 'txlistener'})
udapp.startListening(txlistener) udapp.startListening(txlistener)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment