Udapp listen on TxListener

pull/3094/head
Grandschtroumpf 6 years ago
parent cb62de2ffe
commit 227db66c96
  1. 1
      src/app.js
  2. 14
      src/universal-dapp.js

@ -355,6 +355,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
udapp: udapp.event
}})
registry.put({api: txlistener, name: 'txlistener'})
udapp.startListening(txlistener)
const eventsDecoder = new EventsDecoder({
api: {

@ -24,12 +24,8 @@ module.exports = class UniversalDApp extends UdappApi {
this.events = new EventEmitter()
this.event = new EventManager()
this._deps = {
config: registry.get('config').api,
txlistener: registry.get('txlistener').api
config: registry.get('config').api
}
this._deps.txlistener.event.register('newTransaction', (tx) => {
this.events.emit('newTransaction', tx)
})
this._txRunnerAPI = {
config: this._deps.config,
@ -46,6 +42,14 @@ module.exports = class UniversalDApp extends UdappApi {
executionContext.event.register('contextChanged', this.resetEnvironment.bind(this))
}
// TODO : event should be triggered by Udapp instead of TxListener
/** Listen on New Transaction. (Cannot be done inside constructor because txlistener doesn't exist yet) */
startListening (txlistener) {
txlistener.event.register('newTransaction', (tx) => {
this.events.emit('newTransaction', tx)
})
}
resetEnvironment () {
this.accounts = {}
if (executionContext.isVM()) {

Loading…
Cancel
Save