Skip to content

Commit

Permalink
Revert "listen to new transaction using blockchain abstraction instea…
Browse files Browse the repository at this point in the history
…d of txlistener"

This reverts commit c2d7422.
  • Loading branch information
iurimatias authored and yann300 committed Feb 5, 2020
1 parent a9e16b8 commit a827b6b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/ui/txLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class TxLogger {
}
})

blockchain.event.register('newTransaction', (tx, receipt) => {
this.txListener.event.register('newTransaction', (tx, receipt) => {
log(this, tx, receipt)
})

Expand Down
5 changes: 1 addition & 4 deletions src/blockchain/blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,7 @@ class Blockchain {
}

startListening (txlistener) {
txlistener.event.register('newTransaction', (tx, receipt) => {
this.event.emit('newTransaction', tx, receipt)
this.udapp.events.emit('newTransaction', tx, receipt) // for plugin backwards compatibility
})
this.udapp.startListening(txlistener)
}

runOrCallContractMethod (contractName, contractABI, funABI, value, address, params, lookupOnly, logMsg, logCallback, outputCb, callbacksInContext) {
Expand Down
8 changes: 8 additions & 0 deletions src/blockchain/universalDapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ class UniversalDApp {
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 () {
this.accounts = {}
if (this.executionContext.isVM()) {
Expand Down

0 comments on commit a827b6b

Please sign in to comment.