mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Min and default gas price, limit, total; comments out code for gas slider.
This commit is contained in:
parent
7362fb8dfc
commit
c2880c4b8f
@ -19,7 +19,7 @@ GasModalCard.prototype.render = function () {
|
|||||||
unitLabel,
|
unitLabel,
|
||||||
value,
|
value,
|
||||||
min,
|
min,
|
||||||
max,
|
// max,
|
||||||
step,
|
step,
|
||||||
title,
|
title,
|
||||||
copy
|
copy
|
||||||
@ -34,20 +34,20 @@ GasModalCard.prototype.render = function () {
|
|||||||
h(InputNumber, {
|
h(InputNumber, {
|
||||||
unitLabel,
|
unitLabel,
|
||||||
step,
|
step,
|
||||||
max,
|
// max,
|
||||||
min,
|
min,
|
||||||
placeholder: '0',
|
placeholder: '0',
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
h(GasSlider, {
|
// h(GasSlider, {
|
||||||
value,
|
// value,
|
||||||
step,
|
// step,
|
||||||
max,
|
// max,
|
||||||
min,
|
// min,
|
||||||
onChange,
|
// onChange,
|
||||||
}),
|
// }),
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -5,6 +5,11 @@ const connect = require('react-redux').connect
|
|||||||
const actions = require('../../actions')
|
const actions = require('../../actions')
|
||||||
const GasModalCard = require('./gas-modal-card')
|
const GasModalCard = require('./gas-modal-card')
|
||||||
|
|
||||||
|
const {
|
||||||
|
MIN_GAS_PRICE,
|
||||||
|
MIN_GAS_LIMIT,
|
||||||
|
} = require('../send/send-constants')
|
||||||
|
|
||||||
const { conversionUtil, multiplyCurrencies } = require('../../conversion-util')
|
const { conversionUtil, multiplyCurrencies } = require('../../conversion-util')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -35,8 +40,8 @@ function CustomizeGasModal (props) {
|
|||||||
Component.call(this)
|
Component.call(this)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
gasPrice: props.gasPrice,
|
gasPrice: props.gasPrice || MIN_GAS_PRICE,
|
||||||
gasLimit: props.gasLimit,
|
gasLimit: props.gasLimit || MIN_GAS_LIMIT,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,8 +120,8 @@ CustomizeGasModal.prototype.render = function () {
|
|||||||
|
|
||||||
h(GasModalCard, {
|
h(GasModalCard, {
|
||||||
value: convertedGasPrice,
|
value: convertedGasPrice,
|
||||||
min: 0,
|
min: MIN_GAS_PRICE,
|
||||||
max: 1000,
|
// max: 1000,
|
||||||
step: 1,
|
step: 1,
|
||||||
onChange: value => this.convertAndSetGasPrice(value),
|
onChange: value => this.convertAndSetGasPrice(value),
|
||||||
title: 'Gas Price',
|
title: 'Gas Price',
|
||||||
@ -125,8 +130,8 @@ CustomizeGasModal.prototype.render = function () {
|
|||||||
|
|
||||||
h(GasModalCard, {
|
h(GasModalCard, {
|
||||||
value: convertedGasLimit,
|
value: convertedGasLimit,
|
||||||
min: 20000,
|
min: MIN_GAS_LIMIT,
|
||||||
max: 100000,
|
// max: 100000,
|
||||||
step: 1,
|
step: 1,
|
||||||
onChange: value => this.convertAndSetGasLimit(value),
|
onChange: value => this.convertAndSetGasLimit(value),
|
||||||
title: 'Gas Limit',
|
title: 'Gas Limit',
|
||||||
|
23
ui/app/components/send/send-constants.js
Normal file
23
ui/app/components/send/send-constants.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
const Identicon = require('../identicon')
|
||||||
|
const { multiplyCurrencies } = require('../../conversion-util')
|
||||||
|
|
||||||
|
const MIN_GAS_PRICE_GWEI = '1'
|
||||||
|
const GWEI_FACTOR = '1e9'
|
||||||
|
const MIN_GAS_PRICE = multiplyCurrencies(GWEI_FACTOR, MIN_GAS_PRICE_GWEI, {
|
||||||
|
multiplicandBase: 16,
|
||||||
|
multiplierBase: 16,
|
||||||
|
})
|
||||||
|
const MIN_GAS_LIMIT = (21000).toString(16)
|
||||||
|
const MIN_GAS_TOTAL = multiplyCurrencies(MIN_GAS_LIMIT, MIN_GAS_PRICE, {
|
||||||
|
toNumericBase: 'hex',
|
||||||
|
multiplicandBase: 16,
|
||||||
|
multiplierBase: 16,
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
MIN_GAS_PRICE_GWEI,
|
||||||
|
GWEI_FACTOR,
|
||||||
|
MIN_GAS_PRICE,
|
||||||
|
MIN_GAS_LIMIT,
|
||||||
|
MIN_GAS_TOTAL,
|
||||||
|
}
|
@ -10,6 +10,8 @@ const CurrencyDisplay = require('./components/send/currency-display')
|
|||||||
const MemoTextArea = require('./components/send/memo-textarea')
|
const MemoTextArea = require('./components/send/memo-textarea')
|
||||||
const GasFeeDisplay = require('./components/send/gas-fee-display-v2')
|
const GasFeeDisplay = require('./components/send/gas-fee-display-v2')
|
||||||
|
|
||||||
|
const { MIN_GAS_TOTAL } = require('./components/send/send-constants')
|
||||||
|
|
||||||
const { showModal } = require('./actions')
|
const { showModal } = require('./actions')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -135,9 +137,8 @@ SendTransactionScreen.prototype.renderHeader = function () {
|
|||||||
|
|
||||||
SendTransactionScreen.prototype.renderErrorMessage = function(errorType) {
|
SendTransactionScreen.prototype.renderErrorMessage = function(errorType) {
|
||||||
const { errors } = this.props
|
const { errors } = this.props
|
||||||
console.log(`! errors`, errors);
|
|
||||||
const errorMessage = errors[errorType];
|
const errorMessage = errors[errorType];
|
||||||
console.log(`errorMessage`, errorMessage);
|
|
||||||
return errorMessage
|
return errorMessage
|
||||||
? h('div.send-v2__error', [ errorMessage ] )
|
? h('div.send-v2__error', [ errorMessage ] )
|
||||||
: null
|
: null
|
||||||
@ -309,7 +310,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
|
|||||||
const {
|
const {
|
||||||
conversionRate,
|
conversionRate,
|
||||||
showCustomizeGasModal,
|
showCustomizeGasModal,
|
||||||
gasTotal,
|
gasTotal = MIN_GAS_TOTAL,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
return h('div.send-v2__form-row', [
|
return h('div.send-v2__form-row', [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user