aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/send-v2.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-11-17 02:14:25 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-12-07 13:15:39 +0800
commit2e9137dddd4abd07cc45caa670f09bdc9559bbbb (patch)
tree8df2d0042aeefb678445d65b32476405253efa7d /ui/app/send-v2.js
parent373f8b72d048d84f537d97d87c7f106e0b8db087 (diff)
downloadtangerine-wallet-browser-2e9137dddd4abd07cc45caa670f09bdc9559bbbb.tar
tangerine-wallet-browser-2e9137dddd4abd07cc45caa670f09bdc9559bbbb.tar.gz
tangerine-wallet-browser-2e9137dddd4abd07cc45caa670f09bdc9559bbbb.tar.bz2
tangerine-wallet-browser-2e9137dddd4abd07cc45caa670f09bdc9559bbbb.tar.lz
tangerine-wallet-browser-2e9137dddd4abd07cc45caa670f09bdc9559bbbb.tar.xz
tangerine-wallet-browser-2e9137dddd4abd07cc45caa670f09bdc9559bbbb.tar.zst
tangerine-wallet-browser-2e9137dddd4abd07cc45caa670f09bdc9559bbbb.zip
Update max amount behaviour to meet new specs.
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r--ui/app/send-v2.js24
1 files changed, 10 insertions, 14 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js
index 788ae87b4..e1b88f0db 100644
--- a/ui/app/send-v2.js
+++ b/ui/app/send-v2.js
@@ -13,8 +13,6 @@ const GasFeeDisplay = require('./components/send/gas-fee-display-v2')
const {
MIN_GAS_TOTAL,
- MIN_GAS_PRICE_HEX,
- MIN_GAS_LIMIT_HEX,
} = require('./components/send/send-constants')
const {
@@ -313,8 +311,9 @@ SendTransactionScreen.prototype.renderToRow = function () {
SendTransactionScreen.prototype.handleAmountChange = function (value) {
const amount = value
- const { updateSendAmount } = this.props
+ const { updateSendAmount, setMaxModeTo } = this.props
+ setMaxModeTo(false)
this.validateAmount(amount)
updateSendAmount(amount)
}
@@ -324,11 +323,9 @@ SendTransactionScreen.prototype.setAmountToMax = function () {
from: { balance },
updateSendAmount,
updateSendErrors,
- updateGasPrice,
- updateGasLimit,
- updateGasTotal,
tokenBalance,
selectedToken,
+ gasTotal,
} = this.props
const { decimals } = selectedToken || {}
const multiplier = Math.pow(10, Number(decimals || 0))
@@ -337,16 +334,12 @@ SendTransactionScreen.prototype.setAmountToMax = function () {
? multiplyCurrencies(tokenBalance, multiplier, {toNumericBase: 'hex'})
: subtractCurrencies(
ethUtil.addHexPrefix(balance),
- ethUtil.addHexPrefix(MIN_GAS_TOTAL),
+ ethUtil.addHexPrefix(gasTotal),
{ toNumericBase: 'hex' }
)
updateSendErrors({ amount: null })
- if (!selectedToken) {
- updateGasPrice(MIN_GAS_PRICE_HEX)
- updateGasLimit(MIN_GAS_LIMIT_HEX)
- updateGasTotal(MIN_GAS_TOTAL)
- }
+
updateSendAmount(maxAmount)
}
@@ -407,19 +400,22 @@ SendTransactionScreen.prototype.renderAmountRow = function () {
amountConversionRate,
errors,
amount,
+ setMaxModeTo,
+ maxModeOn,
} = this.props
return h('div.send-v2__form-row', [
- h('div.send-v2__form-label', [
+ h('div.send-v2__form-label', [
'Amount:',
this.renderErrorMessage('amount'),
!errors.amount && h('div.send-v2__amount-max', {
onClick: (event) => {
event.preventDefault()
+ setMaxModeTo(true)
this.setAmountToMax()
},
- }, [ 'Max' ]),
+ }, [ !maxModeOn ? 'Max' : '' ]),
]),
h('div.send-v2__form-field', [