mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Ensure that gas fee inputs fallback to tx params values if api is down (#11775)
* Ensure that gas fee inputs fallback to tx params values if down * ensure getGasFeeEstimate fallback is a string
This commit is contained in:
parent
9fcd93191b
commit
01262d33a4
@ -90,11 +90,12 @@ function getGasFeeEstimate(
|
|||||||
gasFeeEstimates,
|
gasFeeEstimates,
|
||||||
gasEstimateType,
|
gasEstimateType,
|
||||||
estimateToUse,
|
estimateToUse,
|
||||||
|
fallback = '0',
|
||||||
) {
|
) {
|
||||||
if (gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET) {
|
if (gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET) {
|
||||||
return gasFeeEstimates?.[estimateToUse]?.[field] ?? '0';
|
return gasFeeEstimates?.[estimateToUse]?.[field] ?? String(fallback);
|
||||||
}
|
}
|
||||||
return '0';
|
return String(fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -280,6 +281,7 @@ export function useGasFeeInputs(
|
|||||||
gasFeeEstimates,
|
gasFeeEstimates,
|
||||||
gasEstimateType,
|
gasEstimateType,
|
||||||
estimateToUse,
|
estimateToUse,
|
||||||
|
initialMaxFeePerGas,
|
||||||
);
|
);
|
||||||
|
|
||||||
const maxPriorityFeePerGasToUse =
|
const maxPriorityFeePerGasToUse =
|
||||||
@ -289,6 +291,7 @@ export function useGasFeeInputs(
|
|||||||
gasFeeEstimates,
|
gasFeeEstimates,
|
||||||
gasEstimateType,
|
gasEstimateType,
|
||||||
estimateToUse,
|
estimateToUse,
|
||||||
|
initialMaxPriorityFeePerGas,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [initialGasPriceEstimates] = useState(gasFeeEstimates);
|
const [initialGasPriceEstimates] = useState(gasFeeEstimates);
|
||||||
|
Loading…
Reference in New Issue
Block a user