aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@users.noreply.github.com>2018-12-11 10:02:26 +0800
committerGitHub <noreply@github.com>2018-12-11 10:02:26 +0800
commitdde239797b6cd4248b7ac48d5b97ad03ab69255e (patch)
treeb5b07a4bfaed99509b0c1917f009de56e96cbcbf
parent1fbdce8916151df2b31eebc5de29a1365e5dadff (diff)
downloadtangerine-wallet-browser-dde239797b6cd4248b7ac48d5b97ad03ab69255e.tar
tangerine-wallet-browser-dde239797b6cd4248b7ac48d5b97ad03ab69255e.tar.gz
tangerine-wallet-browser-dde239797b6cd4248b7ac48d5b97ad03ab69255e.tar.bz2
tangerine-wallet-browser-dde239797b6cd4248b7ac48d5b97ad03ab69255e.tar.lz
tangerine-wallet-browser-dde239797b6cd4248b7ac48d5b97ad03ab69255e.tar.xz
tangerine-wallet-browser-dde239797b6cd4248b7ac48d5b97ad03ab69255e.tar.zst
tangerine-wallet-browser-dde239797b6cd4248b7ac48d5b97ad03ab69255e.zip
Show Failed transaction in the browser notification for on-chain failures (#5904)
-rw-r--r--app/scripts/platforms/extension.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/scripts/platforms/extension.js b/app/scripts/platforms/extension.js
index 9ef0d22c9..3f1cb0f27 100644
--- a/app/scripts/platforms/extension.js
+++ b/app/scripts/platforms/extension.js
@@ -48,10 +48,13 @@ class ExtensionPlatform {
}
showTransactionNotification (txMeta) {
+ const { status, txReceipt: { status: receiptStatus } = {} } = txMeta
- const status = txMeta.status
if (status === 'confirmed') {
- this._showConfirmedTransaction(txMeta)
+ // There was an on-chain failure
+ receiptStatus === '0x0'
+ ? this._showFailedTransaction(txMeta, 'Transaction encountered an error.')
+ : this._showConfirmedTransaction(txMeta)
} else if (status === 'failed') {
this._showFailedTransaction(txMeta)
}
@@ -81,11 +84,11 @@ class ExtensionPlatform {
this._showNotification(title, message, url)
}
- _showFailedTransaction (txMeta) {
+ _showFailedTransaction (txMeta, errorMessage) {
const nonce = parseInt(txMeta.txParams.nonce, 16)
const title = 'Failed transaction'
- const message = `Transaction ${nonce} failed! ${txMeta.err.message}`
+ const message = `Transaction ${nonce} failed! ${errorMessage || txMeta.err.message}`
this._showNotification(title, message)
}