From 43b7eab46a207c43afe0f4d1eb49e528a8f9fa80 Mon Sep 17 00:00:00 2001 From: ryanml Date: Wed, 30 Jun 2021 23:41:39 -0700 Subject: [PATCH] Fixing invalid minimumGasLimit prop (AdvancedGasInputs) (#11412) --- .../advanced-gas-inputs/advanced-gas-inputs.component.js | 2 -- .../advanced-gas-inputs/advanced-gas-inputs.container.js | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.component.js b/ui/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.component.js index a775cec65..21a76c41a 100644 --- a/ui/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.component.js +++ b/ui/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.component.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import classnames from 'classnames'; import { debounce } from 'lodash'; import Tooltip from '../../../ui/tooltip'; -import { MIN_GAS_LIMIT_DEC } from '../../../../pages/send/send.constants'; export default class AdvancedGasInputs extends Component { static contextTypes = { @@ -24,7 +23,6 @@ export default class AdvancedGasInputs extends Component { }; static defaultProps = { - minimumGasLimit: Number(MIN_GAS_LIMIT_DEC), customPriceIsExcessive: false, }; diff --git a/ui/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js b/ui/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js index 45cdaaa38..09eb26fdd 100644 --- a/ui/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js +++ b/ui/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js @@ -4,6 +4,7 @@ import { decimalToHex, hexWEIToDecGWEI, } from '../../../../helpers/utils/conversions.util'; +import { MIN_GAS_LIMIT_DEC } from '../../../../pages/send/send.constants'; import AdvancedGasInputs from './advanced-gas-inputs.component'; function convertGasPriceForInputs(gasPriceInHexWEI) { @@ -14,12 +15,17 @@ function convertGasLimitForInputs(gasLimitInHexWEI) { return parseInt(gasLimitInHexWEI, 16) || 0; } +function convertMinimumGasLimitForInputs(minimumGasLimit = MIN_GAS_LIMIT_DEC) { + return parseInt(minimumGasLimit, 10); +} + const mergeProps = (stateProps, dispatchProps, ownProps) => { const { customGasPrice, customGasLimit, updateCustomGasPrice, updateCustomGasLimit, + minimumGasLimit, } = ownProps; return { ...ownProps, @@ -27,6 +33,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { ...dispatchProps, customGasPrice: convertGasPriceForInputs(customGasPrice), customGasLimit: convertGasLimitForInputs(customGasLimit), + minimumGasLimit: convertMinimumGasLimitForInputs(minimumGasLimit), updateCustomGasPrice: (price) => updateCustomGasPrice(decGWEIToHexWEI(price)), updateCustomGasLimit: (limit) => updateCustomGasLimit(decimalToHex(limit)),