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

Ensure that gas fee minimum errors show when api is down (#11767)

* Fix legacy unapproved tx handling

* clean up
This commit is contained in:
Dan J Miller 2021-08-04 20:14:20 -02:30 committed by GitHub
parent 818dc13019
commit 9fcd93191b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -414,6 +414,17 @@ export function useGasFeeInputs(
gasErrors.gasLimit = GAS_FORM_ERRORS.GAS_LIMIT_OUT_OF_BOUNDS;
}
// This ensures these are applied when the api fails to return a fee market type
// It is okay if these errors get overwritten below, as those overwrites can only
// happen when the estimate api is live.
if (networkAndAccountSupports1559) {
if (maxPriorityFeePerGasToUse <= 0) {
gasErrors.maxPriorityFee = GAS_FORM_ERRORS.MAX_PRIORITY_FEE_BELOW_MINIMUM;
} else if (maxPriorityFeePerGasToUse >= maxFeePerGasToUse) {
gasErrors.maxFee = GAS_FORM_ERRORS.MAX_FEE_IMBALANCE;
}
}
switch (gasEstimateType) {
case GAS_ESTIMATE_TYPES.FEE_MARKET:
if (maxPriorityFeePerGasToUse <= 0) {