1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

EIP-1559 - Remove unncessary props from AdvancedFormControls (#11757)

This commit is contained in:
David Walsh 2021-08-04 16:00:46 -05:00 committed by Dan Miller
parent b9d5c431c1
commit f17514489f
3 changed files with 1 additions and 51 deletions

View File

@ -4,16 +4,11 @@ import { useSelector } from 'react-redux';
import { I18nContext } from '../../../contexts/i18n'; import { I18nContext } from '../../../contexts/i18n';
import FormField from '../../ui/form-field'; import FormField from '../../ui/form-field';
import { import { GAS_ESTIMATE_TYPES } from '../../../../shared/constants/gas';
GAS_ESTIMATE_TYPES,
GAS_RECOMMENDATIONS,
} from '../../../../shared/constants/gas';
import { getGasFormErrorText } from '../../../helpers/constants/gas'; import { getGasFormErrorText } from '../../../helpers/constants/gas';
import { checkNetworkAndAccountSupports1559 } from '../../../selectors'; import { checkNetworkAndAccountSupports1559 } from '../../../selectors';
export default function AdvancedGasControls({ export default function AdvancedGasControls({
estimateToUse,
gasFeeEstimates,
gasEstimateType, gasEstimateType,
maxPriorityFee, maxPriorityFee,
maxFee, maxFee,
@ -34,28 +29,6 @@ export default function AdvancedGasControls({
checkNetworkAndAccountSupports1559, 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 = const showFeeMarketFields =
networkAndAccountSupport1559 && networkAndAccountSupport1559 &&
(gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET || (gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET ||
@ -142,23 +115,6 @@ export default function AdvancedGasControls({
} }
AdvancedGasControls.propTypes = { 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)), gasEstimateType: PropTypes.oneOf(Object.values(GAS_ESTIMATE_TYPES)),
setMaxPriorityFee: PropTypes.func, setMaxPriorityFee: PropTypes.func,
setMaxFee: PropTypes.func, setMaxFee: PropTypes.func,

View File

@ -47,7 +47,6 @@ export default function EditGasDisplay({
estimatedMaximumNative, estimatedMaximumNative,
estimatedMinimumNative, estimatedMinimumNative,
isGasEstimatesLoading, isGasEstimatesLoading,
gasFeeEstimates,
gasEstimateType, gasEstimateType,
gasPrice, gasPrice,
setGasPrice, setGasPrice,
@ -216,9 +215,7 @@ export default function EditGasDisplay({
)} )}
{!requireDappAcknowledgement && showAdvancedForm && ( {!requireDappAcknowledgement && showAdvancedForm && (
<AdvancedGasControls <AdvancedGasControls
gasFeeEstimates={gasFeeEstimates}
gasEstimateType={gasEstimateType} gasEstimateType={gasEstimateType}
estimateToUse={estimateToUse}
isGasEstimatesLoading={isGasEstimatesLoading} isGasEstimatesLoading={isGasEstimatesLoading}
gasLimit={gasLimit} gasLimit={gasLimit}
setGasLimit={setGasLimit} setGasLimit={setGasLimit}
@ -263,7 +260,6 @@ EditGasDisplay.propTypes = {
estimatedMaximumNative: PropTypes.string, estimatedMaximumNative: PropTypes.string,
estimatedMinimumNative: PropTypes.string, estimatedMinimumNative: PropTypes.string,
isGasEstimatesLoading: PropTypes.bool, isGasEstimatesLoading: PropTypes.bool,
gasFeeEstimates: PropTypes.object,
gasEstimateType: PropTypes.string, gasEstimateType: PropTypes.string,
gasPrice: PropTypes.string, gasPrice: PropTypes.string,
setGasPrice: PropTypes.func, setGasPrice: PropTypes.func,

View File

@ -71,7 +71,6 @@ export default function EditGasPopover({
estimatedMaximumNative, estimatedMaximumNative,
estimatedMinimumNative, estimatedMinimumNative,
isGasEstimatesLoading, isGasEstimatesLoading,
gasFeeEstimates,
gasEstimateType, gasEstimateType,
gasPrice, gasPrice,
setGasPrice, setGasPrice,
@ -229,7 +228,6 @@ export default function EditGasPopover({
estimatedMaximumNative={estimatedMaximumNative} estimatedMaximumNative={estimatedMaximumNative}
estimatedMinimumNative={estimatedMinimumNative} estimatedMinimumNative={estimatedMinimumNative}
isGasEstimatesLoading={isGasEstimatesLoading} isGasEstimatesLoading={isGasEstimatesLoading}
gasFeeEstimates={gasFeeEstimates}
gasEstimateType={gasEstimateType} gasEstimateType={gasEstimateType}
gasPrice={gasPrice} gasPrice={gasPrice}
setGasPrice={setGasPrice} setGasPrice={setGasPrice}