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:
parent
3f4c988018
commit
a3c7bae345
@ -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,
|
||||
|
@ -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 && (
|
||||
<AdvancedGasControls
|
||||
gasFeeEstimates={gasFeeEstimates}
|
||||
gasEstimateType={gasEstimateType}
|
||||
estimateToUse={estimateToUse}
|
||||
isGasEstimatesLoading={isGasEstimatesLoading}
|
||||
gasLimit={gasLimit}
|
||||
setGasLimit={setGasLimit}
|
||||
@ -263,7 +260,6 @@ EditGasDisplay.propTypes = {
|
||||
estimatedMaximumNative: PropTypes.string,
|
||||
estimatedMinimumNative: PropTypes.string,
|
||||
isGasEstimatesLoading: PropTypes.bool,
|
||||
gasFeeEstimates: PropTypes.object,
|
||||
gasEstimateType: PropTypes.string,
|
||||
gasPrice: PropTypes.string,
|
||||
setGasPrice: PropTypes.func,
|
||||
|
@ -71,7 +71,6 @@ export default function EditGasPopover({
|
||||
estimatedMaximumNative,
|
||||
estimatedMinimumNative,
|
||||
isGasEstimatesLoading,
|
||||
gasFeeEstimates,
|
||||
gasEstimateType,
|
||||
gasPrice,
|
||||
setGasPrice,
|
||||
@ -229,7 +228,6 @@ export default function EditGasPopover({
|
||||
estimatedMaximumNative={estimatedMaximumNative}
|
||||
estimatedMinimumNative={estimatedMinimumNative}
|
||||
isGasEstimatesLoading={isGasEstimatesLoading}
|
||||
gasFeeEstimates={gasFeeEstimates}
|
||||
gasEstimateType={gasEstimateType}
|
||||
gasPrice={gasPrice}
|
||||
setGasPrice={setGasPrice}
|
||||
|
Loading…
Reference in New Issue
Block a user