aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/tx-state-manager.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-06-07 02:08:29 +0800
committerkumavis <aaron@kumavis.me>2018-06-07 02:08:29 +0800
commit9d77b0a19648fa5c4de594bbecaab2137d5d5658 (patch)
treefe87a5798021ac1b3332a3a13a70f5c4a930e126 /app/scripts/controllers/transactions/tx-state-manager.js
parent32293a959c367ce5dd585111d4ee0d873072c830 (diff)
parentc2e3194dbf4e2a3fd2bdffb3300ec0cd822dc78e (diff)
downloadtangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.gz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.bz2
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.lz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.xz
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.tar.zst
tangerine-wallet-browser-9d77b0a19648fa5c4de594bbecaab2137d5d5658.zip
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-remove-provider-engine
Diffstat (limited to 'app/scripts/controllers/transactions/tx-state-manager.js')
-rw-r--r--app/scripts/controllers/transactions/tx-state-manager.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js
index 00e837571..0aae4774b 100644
--- a/app/scripts/controllers/transactions/tx-state-manager.js
+++ b/app/scripts/controllers/transactions/tx-state-manager.js
@@ -2,6 +2,7 @@ const extend = require('xtend')
const EventEmitter = require('events')
const ObservableStore = require('obs-store')
const ethUtil = require('ethereumjs-util')
+const log = require('loglevel')
const txStateHistoryHelper = require('./lib/tx-state-history-helper')
const createId = require('../../lib/random-id')
const { getFinalStates } = require('./lib/util')
@@ -398,13 +399,19 @@ class TransactionStateManager extends EventEmitter {
_setTxStatus (txId, status) {
const txMeta = this.getTx(txId)
txMeta.status = status
- this.emit(`${txMeta.id}:${status}`, txId)
- this.emit(`tx:status-update`, txId, status)
- if (['submitted', 'rejected', 'failed'].includes(status)) {
- this.emit(`${txMeta.id}:finished`, txMeta)
- }
- this.updateTx(txMeta, `txStateManager: setting status to ${status}`)
- this.emit('update:badge')
+ setTimeout(() => {
+ try {
+ this.updateTx(txMeta, `txStateManager: setting status to ${status}`)
+ this.emit(`${txMeta.id}:${status}`, txId)
+ this.emit(`tx:status-update`, txId, status)
+ if (['submitted', 'rejected', 'failed'].includes(status)) {
+ this.emit(`${txMeta.id}:finished`, txMeta)
+ }
+ this.emit('update:badge')
+ } catch (error) {
+ log.error(error)
+ }
+ })
}
/**