aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-30 07:12:36 +0800
committerkumavis <aaron@kumavis.me>2018-05-30 07:12:36 +0800
commit4205d9272991c6523fbb8b9222f86411d0253325 (patch)
tree2dce14c72c4a0a62d57f8889072233e2a1f1f410 /app/scripts/controllers
parent219cb83d94566a597f7ffa2ba34454460d2deb5d (diff)
parent5fc24930a7febd919ec6a8f6e9c14f2bac0ef2b2 (diff)
downloadtangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.tar
tangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.tar.gz
tangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.tar.bz2
tangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.tar.lz
tangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.tar.xz
tangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.tar.zst
tangerine-wallet-browser-4205d9272991c6523fbb8b9222f86411d0253325.zip
Merge branch 'master' of github.com:MetaMask/metamask-extension into merge-master
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/transactions/index.js8
-rw-r--r--app/scripts/controllers/transactions/tx-state-manager.js21
2 files changed, 19 insertions, 10 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js
index 541f1db73..aff5db984 100644
--- a/app/scripts/controllers/transactions/index.js
+++ b/app/scripts/controllers/transactions/index.js
@@ -8,6 +8,7 @@ const TxGasUtil = require('./tx-gas-utils')
const PendingTransactionTracker = require('./pending-tx-tracker')
const NonceTracker = require('./nonce-tracker')
const txUtils = require('./lib/util')
+const cleanErrorStack = require('../../lib/cleanErrorStack')
const log = require('loglevel')
/**
@@ -118,6 +119,7 @@ class TransactionController extends EventEmitter {
@param txParams {object} - txParams for the transaction
@param opts {object} - with the key origin to put the origin on the txMeta
*/
+
async newUnapprovedTransaction (txParams, opts = {}) {
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
const initialTxMeta = await this.addUnapprovedTransaction(txParams)
@@ -130,11 +132,11 @@ class TransactionController extends EventEmitter {
case 'submitted':
return resolve(finishedTxMeta.hash)
case 'rejected':
- return reject(new Error('MetaMask Tx Signature: User denied transaction signature.'))
+ return reject(cleanErrorStack(new Error('MetaMask Tx Signature: User denied transaction signature.')))
case 'failed':
- return reject(new Error(finishedTxMeta.err.message))
+ return reject(cleanErrorStack(new Error(finishedTxMeta.err.message)))
default:
- return reject(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`))
+ return reject(cleanErrorStack(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`)))
}
})
})
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)
+ }
+ })
}
/**