aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions.js
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2018-01-20 07:58:26 +0800
committerGitHub <noreply@github.com>2018-01-20 07:58:26 +0800
commit338ebe5f402ff50dc8d1a91b7b69cd8e262cc789 (patch)
treeda684e0dd093775a0c43262b3cbae546f0ba387c /app/scripts/controllers/transactions.js
parentc554e52e82b53447dd77c265723e914063d518b1 (diff)
parentc415b56ce7fe95295beec9cf827720253a2f7a8e (diff)
downloadtangerine-wallet-browser-338ebe5f402ff50dc8d1a91b7b69cd8e262cc789.tar
tangerine-wallet-browser-338ebe5f402ff50dc8d1a91b7b69cd8e262cc789.tar.gz
tangerine-wallet-browser-338ebe5f402ff50dc8d1a91b7b69cd8e262cc789.tar.bz2
tangerine-wallet-browser-338ebe5f402ff50dc8d1a91b7b69cd8e262cc789.tar.lz
tangerine-wallet-browser-338ebe5f402ff50dc8d1a91b7b69cd8e262cc789.tar.xz
tangerine-wallet-browser-338ebe5f402ff50dc8d1a91b7b69cd8e262cc789.tar.zst
tangerine-wallet-browser-338ebe5f402ff50dc8d1a91b7b69cd8e262cc789.zip
Merge pull request #3049 from chikeichan/newmaster
Merge master to uat
Diffstat (limited to 'app/scripts/controllers/transactions.js')
-rw-r--r--app/scripts/controllers/transactions.js32
1 files changed, 30 insertions, 2 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index 290444bbb..91ec42b69 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -43,6 +43,28 @@ 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.txStateManager.getFilteredTxList({
+ status: 'approved',
+ }).forEach((txMeta) => {
+ const txSignError = new Error('Transaction found as "approved" during boot - possibly stuck during signing')
+ this.txStateManager.setTxStatusFailed(txMeta.id, txSignError)
+ })
+
+
this.store = this.txStateManager.store
this.txStateManager.on('tx:status-update', this.emit.bind(this, 'tx:status-update'))
this.nonceTracker = new NonceTracker({
@@ -171,11 +193,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
}