aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2018-01-18 08:36:18 +0800
committerGitHub <noreply@github.com>2018-01-18 08:36:18 +0800
commit7c380547b77d90b718f14d6a31cda00fdbe2c819 (patch)
tree10d3e9940879f92f35a81406edfece0de2e21acd /app/scripts
parent5e4dd7118f285005301743d1c6b2f08182188456 (diff)
parentbe8d9244326443fb7f54df271d4e2a2abda90f6f (diff)
downloadtangerine-wallet-browser-7c380547b77d90b718f14d6a31cda00fdbe2c819.tar
tangerine-wallet-browser-7c380547b77d90b718f14d6a31cda00fdbe2c819.tar.gz
tangerine-wallet-browser-7c380547b77d90b718f14d6a31cda00fdbe2c819.tar.bz2
tangerine-wallet-browser-7c380547b77d90b718f14d6a31cda00fdbe2c819.tar.lz
tangerine-wallet-browser-7c380547b77d90b718f14d6a31cda00fdbe2c819.tar.xz
tangerine-wallet-browser-7c380547b77d90b718f14d6a31cda00fdbe2c819.tar.zst
tangerine-wallet-browser-7c380547b77d90b718f14d6a31cda00fdbe2c819.zip
Merge pull request #3019 from MetaMask/i#3015
transactions - wrap addTxDefaults in a try catch and re try addTxDefa…
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/controllers/transactions.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index bb9253175..73aadb292 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -43,6 +43,20 @@ module.exports = class TransactionController extends EventEmitter {
txHistoryLimit: opts.txHistoryLimit,
getNetwork: this.getNetwork.bind(this),
})
+
+ this.txStateManager.getFilteredTxList({
+ status: 'unapproved',
+ loadingDefaults: true,
+ }).forEach((tx) => {
+ this.addTxDefaults(tx)
+ .then((txMeta) => {
+ txMeta.loadingDefaults = false
+ this.txStateManager.updateTx(txMeta, 'transactions: gas estimation for tx on boot')
+ }).catch((error) => {
+ this.txStateManager.setTxStatusFailed(tx.id, error)
+ })
+ })
+
this.store = this.txStateManager.store
this.txStateManager.on('tx:status-update', this.emit.bind(this, 'tx:status-update'))
this.nonceTracker = new NonceTracker({
@@ -171,11 +185,17 @@ module.exports = class TransactionController extends EventEmitter {
this.addTx(txMeta)
this.emit('newUnapprovedTx', txMeta)
// add default tx params
- await this.addTxDefaults(txMeta)
-
+ try {
+ await this.addTxDefaults(txMeta)
+ } catch (error) {
+ console.log(error)
+ this.txStateManager.setTxStatusFailed(txMeta.id, error)
+ throw error
+ }
txMeta.loadingDefaults = false
// save txMeta
this.txStateManager.updateTx(txMeta)
+
return txMeta
}