mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fixing invalid minimumGasLimit prop (AdvancedGasInputs) (#11412)
This commit is contained in:
parent
a60301686c
commit
43b7eab46a
@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import Tooltip from '../../../ui/tooltip';
|
import Tooltip from '../../../ui/tooltip';
|
||||||
import { MIN_GAS_LIMIT_DEC } from '../../../../pages/send/send.constants';
|
|
||||||
|
|
||||||
export default class AdvancedGasInputs extends Component {
|
export default class AdvancedGasInputs extends Component {
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
@ -24,7 +23,6 @@ export default class AdvancedGasInputs extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
minimumGasLimit: Number(MIN_GAS_LIMIT_DEC),
|
|
||||||
customPriceIsExcessive: false,
|
customPriceIsExcessive: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import {
|
|||||||
decimalToHex,
|
decimalToHex,
|
||||||
hexWEIToDecGWEI,
|
hexWEIToDecGWEI,
|
||||||
} from '../../../../helpers/utils/conversions.util';
|
} from '../../../../helpers/utils/conversions.util';
|
||||||
|
import { MIN_GAS_LIMIT_DEC } from '../../../../pages/send/send.constants';
|
||||||
import AdvancedGasInputs from './advanced-gas-inputs.component';
|
import AdvancedGasInputs from './advanced-gas-inputs.component';
|
||||||
|
|
||||||
function convertGasPriceForInputs(gasPriceInHexWEI) {
|
function convertGasPriceForInputs(gasPriceInHexWEI) {
|
||||||
@ -14,12 +15,17 @@ function convertGasLimitForInputs(gasLimitInHexWEI) {
|
|||||||
return parseInt(gasLimitInHexWEI, 16) || 0;
|
return parseInt(gasLimitInHexWEI, 16) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function convertMinimumGasLimitForInputs(minimumGasLimit = MIN_GAS_LIMIT_DEC) {
|
||||||
|
return parseInt(minimumGasLimit, 10);
|
||||||
|
}
|
||||||
|
|
||||||
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
||||||
const {
|
const {
|
||||||
customGasPrice,
|
customGasPrice,
|
||||||
customGasLimit,
|
customGasLimit,
|
||||||
updateCustomGasPrice,
|
updateCustomGasPrice,
|
||||||
updateCustomGasLimit,
|
updateCustomGasLimit,
|
||||||
|
minimumGasLimit,
|
||||||
} = ownProps;
|
} = ownProps;
|
||||||
return {
|
return {
|
||||||
...ownProps,
|
...ownProps,
|
||||||
@ -27,6 +33,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
|||||||
...dispatchProps,
|
...dispatchProps,
|
||||||
customGasPrice: convertGasPriceForInputs(customGasPrice),
|
customGasPrice: convertGasPriceForInputs(customGasPrice),
|
||||||
customGasLimit: convertGasLimitForInputs(customGasLimit),
|
customGasLimit: convertGasLimitForInputs(customGasLimit),
|
||||||
|
minimumGasLimit: convertMinimumGasLimitForInputs(minimumGasLimit),
|
||||||
updateCustomGasPrice: (price) =>
|
updateCustomGasPrice: (price) =>
|
||||||
updateCustomGasPrice(decGWEIToHexWEI(price)),
|
updateCustomGasPrice(decGWEIToHexWEI(price)),
|
||||||
updateCustomGasLimit: (limit) => updateCustomGasLimit(decimalToHex(limit)),
|
updateCustomGasLimit: (limit) => updateCustomGasLimit(decimalToHex(limit)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user