mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix for gas price to be lowered.
This commit is contained in:
parent
ae56b865e8
commit
98d8275743
@ -31,6 +31,8 @@ BnAsDecimalInput.prototype.render = function () {
|
|||||||
const suffix = props.suffix
|
const suffix = props.suffix
|
||||||
const style = props.style
|
const style = props.style
|
||||||
const valueString = value.toString(10)
|
const valueString = value.toString(10)
|
||||||
|
const newMin = min && this.downsize(min.toString(10), scale)
|
||||||
|
const newMax = max && this.downsize(max.toString(10), scale)
|
||||||
const newValue = this.downsize(valueString, scale)
|
const newValue = this.downsize(valueString, scale)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -47,8 +49,8 @@ BnAsDecimalInput.prototype.render = function () {
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
step: 'any',
|
step: 'any',
|
||||||
required: true,
|
required: true,
|
||||||
min,
|
min: newMin,
|
||||||
max,
|
max: newMax,
|
||||||
style: extend({
|
style: extend({
|
||||||
display: 'block',
|
display: 'block',
|
||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
@ -128,15 +130,15 @@ BnAsDecimalInput.prototype.updateValidity = function (event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BnAsDecimalInput.prototype.constructWarning = function () {
|
BnAsDecimalInput.prototype.constructWarning = function () {
|
||||||
const { name, min, max } = this.props
|
const { name, min, max, scale } = this.props
|
||||||
let message = name ? name + ' ' : ''
|
let message = name ? name + ' ' : ''
|
||||||
|
|
||||||
if (min && max) {
|
if (min && max) {
|
||||||
message += `must be greater than or equal to ${min} and less than or equal to ${max}.`
|
message += `must be greater than or equal to ${this.downsize(min.toString(10), scale)} and less than or equal to ${this.downsize(max.toString(10), scale)}.`
|
||||||
} else if (min) {
|
} else if (min) {
|
||||||
message += `must be greater than or equal to ${min}.`
|
message += `must be greater than or equal to ${this.downsize(min.toString(10), scale)}.`
|
||||||
} else if (max) {
|
} else if (max) {
|
||||||
message += `must be less than or equal to ${max}.`
|
message += `must be less than or equal to ${this.downsize(max.toString(10), scale)}.`
|
||||||
} else {
|
} else {
|
||||||
message += 'Invalid input.'
|
message += 'Invalid input.'
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ const addressSummary = util.addressSummary
|
|||||||
const nameForAddress = require('../../lib/contract-namer')
|
const nameForAddress = require('../../lib/contract-namer')
|
||||||
const BNInput = require('./bn-as-decimal-input')
|
const BNInput = require('./bn-as-decimal-input')
|
||||||
|
|
||||||
const MIN_GAS_PRICE_GWEI_BN = new BN(1)
|
const MIN_GAS_PRICE_MWEI_BN = new BN(100)
|
||||||
const GWEI_FACTOR = new BN(1e9)
|
const MWEI_FACTOR = new BN(1e6)
|
||||||
const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR)
|
const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_MWEI_BN.mul(MWEI_FACTOR)
|
||||||
const MIN_GAS_LIMIT_BN = new BN(21000)
|
const MIN_GAS_LIMIT_BN = new BN(21000)
|
||||||
|
|
||||||
module.exports = PendingTx
|
module.exports = PendingTx
|
||||||
@ -57,7 +57,7 @@ PendingTx.prototype.render = function () {
|
|||||||
const safeGasLimit = safeGasLimitBN.toString(10)
|
const safeGasLimit = safeGasLimitBN.toString(10)
|
||||||
|
|
||||||
// Gas Price
|
// Gas Price
|
||||||
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
|
const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(10)
|
||||||
const gasPriceBn = hexToBn(gasPrice)
|
const gasPriceBn = hexToBn(gasPrice)
|
||||||
|
|
||||||
const txFeeBn = gasBn.mul(gasPriceBn)
|
const txFeeBn = gasBn.mul(gasPriceBn)
|
||||||
@ -200,7 +200,7 @@ PendingTx.prototype.render = function () {
|
|||||||
precision: 9,
|
precision: 9,
|
||||||
scale: 9,
|
scale: 9,
|
||||||
suffix: 'GWEI',
|
suffix: 'GWEI',
|
||||||
min: MIN_GAS_PRICE_GWEI_BN.toString(10),
|
min: MIN_GAS_PRICE_BN.toString(10),
|
||||||
style: {
|
style: {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
top: '5px',
|
top: '5px',
|
||||||
|
Loading…
Reference in New Issue
Block a user