aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/helpers/transactions.util.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-10-21 11:48:10 +0800
committerGitHub <noreply@github.com>2018-10-21 11:48:10 +0800
commit3b46478024f87bd237b507e5fb18068febf02de9 (patch)
tree1b70c2e7f431e7e3eb638c7630a2d220fa3dd030 /ui/app/helpers/transactions.util.js
parent600f755dbf8d4cfdc152e3d521b537ee9a046a35 (diff)
parentba3617b685b9dcd8a62e0009ee2015c5997fead3 (diff)
downloadtangerine-wallet-browser-3b46478024f87bd237b507e5fb18068febf02de9.tar.gz
tangerine-wallet-browser-3b46478024f87bd237b507e5fb18068febf02de9.tar.zst
tangerine-wallet-browser-3b46478024f87bd237b507e5fb18068febf02de9.zip
Merge branch 'develop' into develop
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 b2c617384..9be77e14f 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
+}