aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorKevin Serrano <kevin.serrano@consensys.net>2017-09-14 03:17:42 +0800
committerKevin Serrano <kevin.serrano@consensys.net>2017-09-14 03:17:42 +0800
commit06153dd47d16c2e3c6eed7470501d7534c29cbd4 (patch)
treef85fc10be6d321f08b49a8b914f805d3078ccb4c /ui
parent1d3cd9768cdd372d02e7e34674dde9d86af536f5 (diff)
downloadtangerine-wallet-browser-06153dd47d16c2e3c6eed7470501d7534c29cbd4.tar
tangerine-wallet-browser-06153dd47d16c2e3c6eed7470501d7534c29cbd4.tar.gz
tangerine-wallet-browser-06153dd47d16c2e3c6eed7470501d7534c29cbd4.tar.bz2
tangerine-wallet-browser-06153dd47d16c2e3c6eed7470501d7534c29cbd4.tar.lz
tangerine-wallet-browser-06153dd47d16c2e3c6eed7470501d7534c29cbd4.tar.xz
tangerine-wallet-browser-06153dd47d16c2e3c6eed7470501d7534c29cbd4.tar.zst
tangerine-wallet-browser-06153dd47d16c2e3c6eed7470501d7534c29cbd4.zip
Add warning of higher failure risk since app proposed gasLimit.
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/pending-tx.js64
1 files changed, 39 insertions, 25 deletions
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 3e53d47f9..37b242728 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -52,7 +52,8 @@ PendingTx.prototype.render = function () {
const gas = txParams.gas
const gasBn = hexToBn(gas)
const gasLimit = new BN(parseInt(blockGasLimit))
- const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
+ const safeGasLimitBN = this.bnMultiplyByFraction(gasLimit, 19, 20)
+ const safeGasLimit = safeGasLimitBN.toString(10)
// Gas Price
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
@@ -66,6 +67,8 @@ PendingTx.prototype.render = function () {
const balanceBn = hexToBn(balance)
const insufficientBalance = balanceBn.lt(maxCost)
+ const dangerousGasLimit = gasBn.gte(safeGasLimitBN)
+ const gasLimitSpecified = txMeta.gasLimitSpecified
const buyDisabled = insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting
const showRejectAll = props.unconfTxListLength > 1
@@ -263,33 +266,44 @@ PendingTx.prototype.render = function () {
text-transform: uppercase;
}
`),
+ h('.cell.row', {
+ style: {
+ textAlign: 'center',
+ },
+ }, [
+ txMeta.simulationFails ?
+ h('.error', {
+ style: {
+ fontSize: '0.9em',
+ },
+ }, 'Transaction Error. Exception thrown in contract code.')
+ : null,
- txMeta.simulationFails ?
- h('.error', {
- style: {
- marginLeft: 50,
- fontSize: '0.9em',
- },
- }, 'Transaction Error. Exception thrown in contract code.')
- : null,
+ !isValidAddress ?
+ h('.error', {
+ style: {
+ fontSize: '0.9em',
+ },
+ }, 'Recipient address is invalid. Sending this transaction will result in a loss of ETH.')
+ : null,
- !isValidAddress ?
- h('.error', {
- style: {
- marginLeft: 50,
- fontSize: '0.9em',
- },
- }, 'Recipient address is invalid. Sending this transaction will result in a loss of ETH.')
- : null,
+ insufficientBalance ?
+ h('span.error', {
+ style: {
+ fontSize: '0.9em',
+ },
+ }, 'Insufficient balance for transaction')
+ : null,
+
+ (dangerousGasLimit && gasLimitSpecified) ?
+ h('span.error', {
+ style: {
+ fontSize: '0.9em',
+ },
+ }, 'Gas limit set dangerously high. Approving this transaction is likely to fail.')
+ : null,
+ ]),
- insufficientBalance ?
- h('span.error', {
- style: {
- marginLeft: 50,
- fontSize: '0.9em',
- },
- }, 'Insufficient balance for transaction')
- : null,
// send + cancel
h('.flex-row.flex-space-around.conf-buttons', {