Commit 60b94344 authored by Grandschtroumpf's avatar Grandschtroumpf

Udapp listen on TxListener

parent 18691860
...@@ -355,6 +355,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -355,6 +355,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
udapp: udapp.event udapp: udapp.event
}}) }})
registry.put({api: txlistener, name: 'txlistener'}) registry.put({api: txlistener, name: 'txlistener'})
udapp.startListening(txlistener)
const eventsDecoder = new EventsDecoder({ const eventsDecoder = new EventsDecoder({
api: { api: {
......
...@@ -24,12 +24,8 @@ module.exports = class UniversalDApp extends UdappApi { ...@@ -24,12 +24,8 @@ module.exports = class UniversalDApp extends UdappApi {
this.events = new EventEmitter() this.events = new EventEmitter()
this.event = new EventManager() this.event = new EventManager()
this._deps = { this._deps = {
config: registry.get('config').api, config: registry.get('config').api
txlistener: registry.get('txlistener').api
} }
this._deps.txlistener.event.register('newTransaction', (tx) => {
this.events.emit('newTransaction', tx)
})
this._txRunnerAPI = { this._txRunnerAPI = {
config: this._deps.config, config: this._deps.config,
...@@ -46,6 +42,14 @@ module.exports = class UniversalDApp extends UdappApi { ...@@ -46,6 +42,14 @@ module.exports = class UniversalDApp extends UdappApi {
executionContext.event.register('contextChanged', this.resetEnvironment.bind(this)) 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 () { resetEnvironment () {
this.accounts = {} this.accounts = {}
if (executionContext.isVM()) { if (executionContext.isVM()) {
......
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