aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2018-10-10 22:26:38 +0800
committerkumavis <kumavis@users.noreply.github.com>2018-10-10 22:26:38 +0800
commitff67293a8ef61308d602d09f26b163b9b9ec90d3 (patch)
tree3b4e3c33d30599ceb615e7398dbe4c78006eebb3 /app
parentfb6eca3f65a7c0140dbdd9b2d70bf2e40041a020 (diff)
downloadtangerine-wallet-browser-ff67293a8ef61308d602d09f26b163b9b9ec90d3.tar
tangerine-wallet-browser-ff67293a8ef61308d602d09f26b163b9b9ec90d3.tar.gz
tangerine-wallet-browser-ff67293a8ef61308d602d09f26b163b9b9ec90d3.tar.bz2
tangerine-wallet-browser-ff67293a8ef61308d602d09f26b163b9b9ec90d3.tar.lz
tangerine-wallet-browser-ff67293a8ef61308d602d09f26b163b9b9ec90d3.tar.xz
tangerine-wallet-browser-ff67293a8ef61308d602d09f26b163b9b9ec90d3.tar.zst
tangerine-wallet-browser-ff67293a8ef61308d602d09f26b163b9b9ec90d3.zip
transactions - add txReceipt to the txMeta body for confirmed txs (#5375)
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/transactions/index.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js
index ebd49f882..1d566522c 100644
--- a/app/scripts/controllers/transactions/index.js
+++ b/app/scripts/controllers/transactions/index.js
@@ -362,7 +362,29 @@ class TransactionController extends EventEmitter {
this.txStateManager.setTxStatusSubmitted(txId)
}
- confirmTransaction (txId) {
+ /**
+ Sets the status of the transaction to confirmed
+ and sets the status of nonce duplicates as dropped
+ if the txParams have data it will fetch the txReceipt
+ @param txId {number} - the tx's Id
+ @returns {Promise<void>}
+ */
+
+ async confirmTransaction (txId) {
+ // get the txReceipt before marking the transaction confirmed
+ // to ensure the receipt is gotten before the ui revives the tx
+ const txMeta = this.txStateManager.getTx(txId)
+ if (txMeta.txParams.data) {
+ try {
+ const txReceipt = await this.query.getTransactionReceipt()
+ txMeta.txReceipt = txReceipt
+ this.txStateManager.updateTx(txMeta, 'transactions#confirmTransaction - add txReceipt')
+
+ } catch (err) {
+ log.error(err)
+ }
+ }
+
this.txStateManager.setTxStatusConfirmed(txId)
this._markNonceDuplicatesDropped(txId)
}