aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-03-25 00:45:03 +0800
committerDan Finlay <dan@danfinlay.com>2017-03-25 00:45:03 +0800
commit0e74cf2cba206520dbb8d7cc7b2a989566317201 (patch)
treed581d8ac07eef51007c740cae8a8eb92169e4a36 /ui/app/components
parent6a46e9ce0662413f6351756658b2bae8a895a33b (diff)
downloadtangerine-wallet-browser-0e74cf2cba206520dbb8d7cc7b2a989566317201.tar
tangerine-wallet-browser-0e74cf2cba206520dbb8d7cc7b2a989566317201.tar.gz
tangerine-wallet-browser-0e74cf2cba206520dbb8d7cc7b2a989566317201.tar.bz2
tangerine-wallet-browser-0e74cf2cba206520dbb8d7cc7b2a989566317201.tar.lz
tangerine-wallet-browser-0e74cf2cba206520dbb8d7cc7b2a989566317201.tar.xz
tangerine-wallet-browser-0e74cf2cba206520dbb8d7cc7b2a989566317201.tar.zst
tangerine-wallet-browser-0e74cf2cba206520dbb8d7cc7b2a989566317201.zip
Disable accept button when gas limit is too low
Diffstat (limited to 'ui/app/components')
-rw-r--r--ui/app/components/pending-tx.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 2f9e9885b..cfccf2a89 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -16,7 +16,7 @@ const nameForAddress = require('../../lib/contract-namer')
const HexInput = require('./hex-as-decimal-input')
const MIN_GAS_PRICE_BN = new BN(20000000)
-
+const MIN_GAS_LIMIT_BN = new BN(21000)
module.exports = connect(mapStateToProps)(PendingTx)
@@ -164,7 +164,7 @@ PendingTx.prototype.render = function () {
h(HexInput, {
name: 'Gas Limit',
value: gas,
- min: 21000, // The hard lower limit for gas.
+ min: MIN_GAS_LIMIT_BN.toString(10), // The hard lower limit for gas.
suffix: 'UNITS',
style: {
position: 'relative',
@@ -298,6 +298,7 @@ PendingTx.prototype.render = function () {
},
}, 'Reset'),
+ // Accept Button
h('input.confirm.btn-green', {
type: 'submit',
value: 'ACCEPT',
@@ -374,10 +375,6 @@ PendingTx.prototype.componentDidUpdate = function (prevProps, previousState) {
}
}
-PendingTx.prototype.isValid = function () {
- return this.state.valid
-}
-
PendingTx.prototype.calculateGas = function () {
const state = this.state
const props = this.props
@@ -388,10 +385,10 @@ PendingTx.prototype.calculateGas = function () {
const txParams = txMeta.txParams
const gasLimit = new BN(ethUtil.stripHexPrefix(txParams.gas || txMeta.estimatedGas), 16)
- const gasPriceHex = (state.gasPrice === undefined) ? txData.gasPrice : state.gasPrice
+ const gasPriceHex = state.gasPrice || txData.gasPrice
const gasPrice = new BN(ethUtil.stripHexPrefix(gasPriceHex), 16)
- const valid = !gasPrice.lt(MIN_GAS_PRICE_BN)
+ const valid = !gasPrice.lt(MIN_GAS_PRICE_BN) && !gasLimit.lt(MIN_GAS_LIMIT_BN)
this.validChanged(valid)
const txFee = gasLimit.mul(gasPrice)