aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/helpers/transactions.util.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@users.noreply.github.com>2018-10-16 06:00:47 +0800
committerGitHub <noreply@github.com>2018-10-16 06:00:47 +0800
commitc821a8354c8eba05885ca219f39aedafbd4f8052 (patch)
tree880b60c46a0c3f0873a58f16077623211140ac0e /ui/app/helpers/transactions.util.js
parent61dec4ea464607d32a5727bdf343a7d8a9af66fc (diff)
downloadtangerine-wallet-browser-c821a8354c8eba05885ca219f39aedafbd4f8052.tar
tangerine-wallet-browser-c821a8354c8eba05885ca219f39aedafbd4f8052.tar.gz
tangerine-wallet-browser-c821a8354c8eba05885ca219f39aedafbd4f8052.tar.bz2
tangerine-wallet-browser-c821a8354c8eba05885ca219f39aedafbd4f8052.tar.lz
tangerine-wallet-browser-c821a8354c8eba05885ca219f39aedafbd4f8052.tar.xz
tangerine-wallet-browser-c821a8354c8eba05885ca219f39aedafbd4f8052.tar.zst
tangerine-wallet-browser-c821a8354c8eba05885ca219f39aedafbd4f8052.zip
Add txReceipt data to transaction details (#5513)
Diffstat (limited to 'ui/app/helpers/transactions.util.js')
-rw-r--r--ui/app/helpers/transactions.util.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/ui/app/helpers/transactions.util.js b/ui/app/helpers/transactions.util.js
index f7d249e63..e50196196 100644
--- a/ui/app/helpers/transactions.util.js
+++ b/ui/app/helpers/transactions.util.js
@@ -126,3 +126,21 @@ export function sumHexes (...args) {
return ethUtil.addHexPrefix(total)
}
+
+/**
+ * Returns a status key for a transaction. Requires parsing the txMeta.txReceipt on top of
+ * txMeta.status because txMeta.status does not reflect on-chain errors.
+ * @param {Object} transaction - The txMeta object of a transaction.
+ * @param {Object} transaction.txReceipt - The transaction receipt.
+ * @returns {string}
+ */
+export function getStatusKey (transaction) {
+ const { txReceipt: { status } = {} } = transaction
+
+ // There was an on-chain failure
+ if (status === '0x0') {
+ return 'failed'
+ }
+
+ return transaction.status
+}