From a3c7bae3457d25e0e6ca3767643f21be078d61d1 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Wed, 4 Aug 2021 16:00:46 -0500 Subject: [PATCH] EIP-1559 - Remove unncessary props from AdvancedFormControls (#11757) --- .../advanced-gas-controls.component.js | 46 +------------------ .../edit-gas-display.component.js | 4 -- .../edit-gas-popover.component.js | 2 - 3 files changed, 1 insertion(+), 51 deletions(-) diff --git a/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js b/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js index e46560131..66ced39b1 100644 --- a/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js +++ b/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js @@ -4,16 +4,11 @@ import { useSelector } from 'react-redux'; import { I18nContext } from '../../../contexts/i18n'; import FormField from '../../ui/form-field'; -import { - GAS_ESTIMATE_TYPES, - GAS_RECOMMENDATIONS, -} from '../../../../shared/constants/gas'; +import { GAS_ESTIMATE_TYPES } from '../../../../shared/constants/gas'; import { getGasFormErrorText } from '../../../helpers/constants/gas'; import { checkNetworkAndAccountSupports1559 } from '../../../selectors'; export default function AdvancedGasControls({ - estimateToUse, - gasFeeEstimates, gasEstimateType, maxPriorityFee, maxFee, @@ -34,28 +29,6 @@ export default function AdvancedGasControls({ checkNetworkAndAccountSupports1559, ); - const suggestedValues = {}; - - if (networkAndAccountSupport1559) { - suggestedValues.maxFeePerGas = - gasFeeEstimates?.[estimateToUse]?.suggestedMaxFeePerGas || - gasFeeEstimates?.gasPrice; - suggestedValues.maxPriorityFeePerGas = - gasFeeEstimates?.[estimateToUse]?.suggestedMaxPriorityFeePerGas || - suggestedValues.maxFeePerGas; - } else { - switch (gasEstimateType) { - case GAS_ESTIMATE_TYPES.LEGACY: - suggestedValues.gasPrice = gasFeeEstimates?.[estimateToUse]; - break; - case GAS_ESTIMATE_TYPES.ETH_GASPRICE: - suggestedValues.gasPrice = gasFeeEstimates?.gasPrice; - break; - default: - break; - } - } - const showFeeMarketFields = networkAndAccountSupport1559 && (gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET || @@ -142,23 +115,6 @@ export default function AdvancedGasControls({ } AdvancedGasControls.propTypes = { - estimateToUse: PropTypes.oneOf(Object.values(GAS_RECOMMENDATIONS)), - gasFeeEstimates: PropTypes.oneOf([ - PropTypes.shape({ - gasPrice: PropTypes.string, - }), - PropTypes.shape({ - low: PropTypes.string, - medium: PropTypes.string, - high: PropTypes.string, - }), - PropTypes.shape({ - low: PropTypes.object, - medium: PropTypes.object, - high: PropTypes.object, - estimatedBaseFee: PropTypes.string, - }), - ]), gasEstimateType: PropTypes.oneOf(Object.values(GAS_ESTIMATE_TYPES)), setMaxPriorityFee: PropTypes.func, setMaxFee: PropTypes.func, diff --git a/ui/components/app/edit-gas-display/edit-gas-display.component.js b/ui/components/app/edit-gas-display/edit-gas-display.component.js index 306987118..aba45f521 100644 --- a/ui/components/app/edit-gas-display/edit-gas-display.component.js +++ b/ui/components/app/edit-gas-display/edit-gas-display.component.js @@ -47,7 +47,6 @@ export default function EditGasDisplay({ estimatedMaximumNative, estimatedMinimumNative, isGasEstimatesLoading, - gasFeeEstimates, gasEstimateType, gasPrice, setGasPrice, @@ -216,9 +215,7 @@ export default function EditGasDisplay({ )} {!requireDappAcknowledgement && showAdvancedForm && (