mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
EIP-1559 - Maintain changed form values and unselect radio buttons when user customizes form value (#11577)
This commit is contained in:
parent
b259546db8
commit
286fd397f8
@ -81,8 +81,8 @@ export default function AdvancedGasControls({
|
||||
titleUnit="(GWEI)"
|
||||
tooltipText={t('editGasMaxPriorityFeeTooltip')}
|
||||
onChange={(value) => {
|
||||
setMaxPriorityFee(value);
|
||||
onManualChange?.();
|
||||
setMaxPriorityFee(value);
|
||||
}}
|
||||
value={maxPriorityFee}
|
||||
detailText={maxPriorityFeeFiat}
|
||||
@ -122,8 +122,8 @@ export default function AdvancedGasControls({
|
||||
titleUnit="(GWEI)"
|
||||
tooltipText={t('editGasMaxFeeTooltip')}
|
||||
onChange={(value) => {
|
||||
setMaxFee(value);
|
||||
onManualChange?.();
|
||||
setMaxFee(value);
|
||||
}}
|
||||
value={maxFee}
|
||||
numeric
|
||||
@ -165,8 +165,8 @@ export default function AdvancedGasControls({
|
||||
titleText={t('advancedGasPriceTitle')}
|
||||
titleUnit="(GWEI)"
|
||||
onChange={(value) => {
|
||||
setGasPrice(value);
|
||||
onManualChange?.();
|
||||
setGasPrice(value);
|
||||
}}
|
||||
tooltipText={t('editGasPriceTooltip')}
|
||||
value={gasPrice}
|
||||
|
@ -55,6 +55,7 @@ export default function EditGasDisplay({
|
||||
setShowAdvancedForm,
|
||||
warning,
|
||||
gasErrors,
|
||||
onManualChange,
|
||||
}) {
|
||||
const t = useContext(I18nContext);
|
||||
|
||||
@ -199,6 +200,7 @@ export default function EditGasDisplay({
|
||||
maxPriorityFeeFiat={maxPriorityFeePerGasFiat}
|
||||
maxFeeFiat={maxFeePerGasFiat}
|
||||
gasErrors={gasErrors}
|
||||
onManualChange={onManualChange}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
@ -245,4 +247,5 @@ EditGasDisplay.propTypes = {
|
||||
warning: PropTypes.string,
|
||||
transaction: PropTypes.object,
|
||||
gasErrors: PropTypes.object,
|
||||
onManualChange: PropTypes.func,
|
||||
};
|
||||
|
@ -74,6 +74,7 @@ export default function EditGasPopover({
|
||||
estimatedMaximumFiat,
|
||||
hasGasErrors,
|
||||
gasErrors,
|
||||
onManualChange,
|
||||
} = useGasFeeInputs(defaultEstimateToUse);
|
||||
|
||||
/**
|
||||
@ -216,6 +217,7 @@ export default function EditGasPopover({
|
||||
mode={mode}
|
||||
transaction={transaction}
|
||||
gasErrors={gasErrors}
|
||||
onManualChange={onManualChange}
|
||||
{...editGasDisplayProps}
|
||||
/>
|
||||
)}
|
||||
|
@ -354,5 +354,13 @@ export function useGasFeeInputs(defaultEstimateToUse = 'medium') {
|
||||
estimatedGasFeeTimeBounds,
|
||||
gasErrors: errorsAndWarnings,
|
||||
hasGasErrors: hasBlockingGasErrors,
|
||||
onManualChange: () => {
|
||||
setEstimateToUse(null);
|
||||
// Restore existing values
|
||||
setGasPrice(gasPriceToUse);
|
||||
setGasLimit(gasLimit);
|
||||
setMaxFeePerGas(maxFeePerGasToUse);
|
||||
setMaxPriorityFeePerGas(maxPriorityFeePerGasToUse);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user