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

View File

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

View File

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