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
aa0f35a8ba
commit
825e8b7bbf
@ -90,11 +90,12 @@ function getGasFeeEstimate(
|
||||
gasFeeEstimates,
|
||||
gasEstimateType,
|
||||
estimateToUse,
|
||||
fallback = '0',
|
||||
) {
|
||||
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,
|
||||
gasEstimateType,
|
||||
estimateToUse,
|
||||
initialMaxFeePerGas,
|
||||
);
|
||||
|
||||
const maxPriorityFeePerGasToUse =
|
||||
@ -289,6 +291,7 @@ export function useGasFeeInputs(
|
||||
gasFeeEstimates,
|
||||
gasEstimateType,
|
||||
estimateToUse,
|
||||
initialMaxPriorityFeePerGas,
|
||||
);
|
||||
|
||||
const [initialGasPriceEstimates] = useState(gasFeeEstimates);
|
||||
|
Loading…
Reference in New Issue
Block a user