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

EIP-1559 - Show minium native currency in banner when on testnets (#11743)

This commit is contained in:
David Walsh 2021-08-03 12:51:02 -05:00 committed by Dan Miller
parent d0e4a890c4
commit c4c1504e09
3 changed files with 12 additions and 2 deletions

View File

@ -45,6 +45,7 @@ export default function EditGasDisplay({
setMaxFeePerGas,
maxFeePerGasFiat,
estimatedMaximumNative,
estimatedMinimumNative,
isGasEstimatesLoading,
gasFeeEstimates,
gasEstimateType,
@ -140,9 +141,9 @@ export default function EditGasDisplay({
)}
<TransactionTotalBanner
total={
networkAndAccountSupport1559 || isMainnet
(networkAndAccountSupport1559 || isMainnet) && estimatedMinimumFiat
? `~ ${estimatedMinimumFiat}`
: estimatedMaximumNative
: estimatedMinimumNative
}
detail={
networkAndAccountSupport1559 &&
@ -260,6 +261,7 @@ EditGasDisplay.propTypes = {
setMaxFeePerGas: PropTypes.func,
maxFeePerGasFiat: PropTypes.string,
estimatedMaximumNative: PropTypes.string,
estimatedMinimumNative: PropTypes.string,
isGasEstimatesLoading: PropTypes.boolean,
gasFeeEstimates: PropTypes.object,
gasEstimateType: PropTypes.string,

View File

@ -69,6 +69,7 @@ export default function EditGasPopover({
setMaxFeePerGas,
maxFeePerGasFiat,
estimatedMaximumNative,
estimatedMinimumNative,
isGasEstimatesLoading,
gasFeeEstimates,
gasEstimateType,
@ -226,6 +227,7 @@ export default function EditGasPopover({
setMaxFeePerGas={setMaxFeePerGas}
maxFeePerGasFiat={maxFeePerGasFiat}
estimatedMaximumNative={estimatedMaximumNative}
estimatedMinimumNative={estimatedMinimumNative}
isGasEstimatesLoading={isGasEstimatesLoading}
gasFeeEstimates={gasFeeEstimates}
gasEstimateType={gasEstimateType}

View File

@ -357,6 +357,11 @@ export function useGasFeeInputs(
currency: primaryCurrency,
});
const [estimatedMinimumNative] = useCurrencyDisplay(minimumCostInHexWei, {
numberOfDecimals: primaryNumberOfDecimals,
currency: primaryCurrency,
});
// We also need to display our closest estimate of the low end of estimation
// in fiat.
const [, { value: estimatedMinimumFiat }] = useCurrencyDisplay(
@ -493,6 +498,7 @@ export function useGasFeeInputs(
estimatedMinimumFiat: showFiat ? estimatedMinimumFiat : '',
estimatedMaximumFiat: showFiat ? maxFeePerGasFiat : '',
estimatedMaximumNative,
estimatedMinimumNative,
isGasEstimatesLoading,
gasFeeEstimates,
gasEstimateType,