mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Calculate max amount for send ether based on minimum gas total.
This commit is contained in:
parent
c156c85eaa
commit
d1977225a4
@ -11,11 +11,6 @@ function CurrencyDisplay () {
|
||||
Component.call(this)
|
||||
}
|
||||
|
||||
function isValidInput (text) {
|
||||
const re = /^([1-9]\d*|0)(\.|\.\d*)?$/
|
||||
return re.test(text)
|
||||
}
|
||||
|
||||
function toHexWei (value) {
|
||||
return conversionUtil(value, {
|
||||
fromNumericBase: 'dec',
|
||||
@ -68,7 +63,6 @@ CurrencyDisplay.prototype.render = function () {
|
||||
convertedCurrency,
|
||||
readOnly = false,
|
||||
inError = false,
|
||||
value,
|
||||
handleChange,
|
||||
} = this.props
|
||||
|
||||
@ -82,8 +76,6 @@ CurrencyDisplay.prototype.render = function () {
|
||||
conversionRate,
|
||||
})
|
||||
|
||||
const inputSizeMultiplier = readOnly ? 1 : 1.2
|
||||
|
||||
return h('div', {
|
||||
className,
|
||||
style: {
|
||||
|
@ -307,7 +307,6 @@ SendTransactionScreen.prototype.handleAmountChange = function (value) {
|
||||
SendTransactionScreen.prototype.setAmountToMax = function () {
|
||||
const {
|
||||
from: { balance },
|
||||
gasTotal,
|
||||
updateSendAmount,
|
||||
updateSendErrors,
|
||||
updateGasPrice,
|
||||
@ -323,7 +322,7 @@ SendTransactionScreen.prototype.setAmountToMax = function () {
|
||||
? multiplyCurrencies(tokenBalance, multiplier, {toNumericBase: 'hex'})
|
||||
: subtractCurrencies(
|
||||
ethUtil.addHexPrefix(balance),
|
||||
ethUtil.addHexPrefix(gasTotal),
|
||||
ethUtil.addHexPrefix(MIN_GAS_TOTAL),
|
||||
{ toNumericBase: 'hex' }
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user