aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2018-02-01 10:24:20 +0800
committerAlexander Tseung <alextsg@gmail.com>2018-02-01 10:24:20 +0800
commit4f1fe1da6295902e3e0fee633444f84f61f28449 (patch)
treea8e35564ec7963c70cd61868323c202bdc7131dd /app/scripts/controllers/transactions.js
parent0c6fef3dec4f3ba70e8e86275ee9db4f2d58d129 (diff)
parent78bce55858916ba9d3189f76db440768e6ae95b1 (diff)
downloadtangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.tar.gz
tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.tar.zst
tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.zip
Fix merge conflicts from uat-next
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
}