Force gas min has correct precision and is set when editing gas if max.

feature/default_network_editable
Dan 7 years ago
parent a4c6a5e92e
commit 66422cd083
  1. 7
      ui/app/components/customize-gas-modal/index.js
  2. 4
      ui/app/components/pending-tx/confirm-send-ether.js
  3. 4
      ui/app/components/pending-tx/confirm-send-token.js

@ -233,6 +233,7 @@ CustomizeGasModal.prototype.render = function () {
convertedGasPrice += convertedGasPrice.match(/[.]/) ? priceSigZeros : `${priceSigDec}${priceSigZeros}` convertedGasPrice += convertedGasPrice.match(/[.]/) ? priceSigZeros : `${priceSigDec}${priceSigZeros}`
let newGasPrice = gasPrice
if (forceGasMin) { if (forceGasMin) {
const convertedMinPrice = conversionUtil(forceGasMin, { const convertedMinPrice = conversionUtil(forceGasMin, {
fromNumericBase: 'hex', fromNumericBase: 'hex',
@ -242,6 +243,10 @@ CustomizeGasModal.prototype.render = function () {
{ value: convertedMinPrice, fromNumericBase: 'dec' }, { value: convertedMinPrice, fromNumericBase: 'dec' },
{ value: convertedGasPrice, fromNumericBase: 'dec' } { value: convertedGasPrice, fromNumericBase: 'dec' }
) )
newGasPrice = conversionMax(
{ value: gasPrice, fromNumericBase: 'hex' },
{ value: forceGasMin, fromNumericBase: 'hex' }
)
} }
const convertedGasLimit = conversionUtil(gasLimit, { const convertedGasLimit = conversionUtil(gasLimit, {
@ -302,7 +307,7 @@ CustomizeGasModal.prototype.render = function () {
}, [t('cancel')]), }, [t('cancel')]),
h(`div.send-v2__customize-gas__save${error ? '__error' : ''}.allcaps`, { h(`div.send-v2__customize-gas__save${error ? '__error' : ''}.allcaps`, {
onClick: () => !error && this.save(gasPrice, gasLimit, gasTotal), onClick: () => !error && this.save(newGasPrice, gasLimit, gasTotal),
}, [t('save')]), }, [t('save')]),
]), ]),

@ -68,13 +68,11 @@ function mapDispatchToProps (dispatch) {
let forceGasMin let forceGasMin
if (lastGasPrice) { if (lastGasPrice) {
const stripped = ethUtil.stripHexPrefix(lastGasPrice) forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(stripped, 1.1, {
multiplicandBase: 16, multiplicandBase: 16,
multiplierBase: 10, multiplierBase: 10,
toNumericBase: 'hex', toNumericBase: 'hex',
fromDenomination: 'WEI', fromDenomination: 'WEI',
toDenomination: 'GWEI',
})) }))
} }

@ -104,13 +104,11 @@ function mapDispatchToProps (dispatch, ownProps) {
let forceGasMin let forceGasMin
if (lastGasPrice) { if (lastGasPrice) {
const stripped = ethUtil.stripHexPrefix(lastGasPrice) forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(stripped, 1.1, {
multiplicandBase: 16, multiplicandBase: 16,
multiplierBase: 10, multiplierBase: 10,
toNumericBase: 'hex', toNumericBase: 'hex',
fromDenomination: 'WEI', fromDenomination: 'WEI',
toDenomination: 'GWEI',
})) }))
} }

Loading…
Cancel
Save