From 51f91881652030468379cf19dcac04f75980329e Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 15 Aug 2017 16:27:07 +0200 Subject: [PATCH] fix transactionExecuted event --- src/app/execution/txListener.js | 3 ++- src/app/tabs/run-tab.js | 3 ++- src/universal-dapp.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/execution/txListener.js b/src/app/execution/txListener.js index fc2136530a..c8da2e3355 100644 --- a/src/app/execution/txListener.js +++ b/src/app/execution/txListener.js @@ -25,7 +25,8 @@ class TxListener { this.startListening(context) } }) - opt.event.udapp.register('transactionExecuted', (to, data, txResult) => { + opt.event.udapp.register('transactionExecuted', (error, to, data, lookupOnly, txResult) => { + if (error) return if (this.loopId && this._api.isVM()) { this._api.web3().eth.getTransaction(txResult.transactionHash, (error, tx) => { if (error) return console.log(error) diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 996d6fec93..80d98b7f6c 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -371,7 +371,8 @@ function settings (appAPI, appEvents) { ` // EVENTS - appEvents.udapp.register('transactionExecuted', (to, data, lookupOnly, txResult) => { + appEvents.udapp.register('transactionExecuted', (error, to, data, lookupOnly, txResult) => { + if (error) return if (!lookupOnly) el.querySelector('#value').value = '0' }) diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 36f3abcfef..18f3191fcd 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -479,7 +479,7 @@ UniversalDApp.prototype.runTx = function (args, cb) { function (callback) { self.txRunner.rawRun(tx, function (error, result) { if (!args.useCall) { - self.event.trigger('transactionExecuted', [args.to, args.data, result]) + self.event.trigger('transactionExecuted', [error, args.to, args.data, false, result]) } callback(error, result) })