mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
fix issue where conversionRates aren't shown for tokens stored in non-checksum format (#12206)
This commit is contained in:
parent
c076faeb8f
commit
14f0d8245b
@ -7,6 +7,7 @@ import {
|
||||
} from '../selectors';
|
||||
import { getTokenFiatAmount } from '../helpers/utils/token-util';
|
||||
import { getConversionRate } from '../ducks/metamask/metamask';
|
||||
import { isEqualCaseInsensitive } from '../helpers/utils/util';
|
||||
|
||||
/**
|
||||
* Get the token balance converted to fiat and formatted for display
|
||||
@ -33,8 +34,13 @@ export function useTokenFiatAmount(
|
||||
const currentCurrency = useSelector(getCurrentCurrency);
|
||||
const userPrefersShownFiat = useSelector(getShouldShowFiat);
|
||||
const showFiat = overrides.showFiat ?? userPrefersShownFiat;
|
||||
const contractExchangeTokenKey = Object.keys(
|
||||
contractExchangeRates,
|
||||
).find((key) => isEqualCaseInsensitive(key, tokenAddress));
|
||||
const tokenExchangeRate =
|
||||
overrides.exchangeRate ?? contractExchangeRates[tokenAddress];
|
||||
overrides.exchangeRate ??
|
||||
(contractExchangeTokenKey &&
|
||||
contractExchangeRates[contractExchangeTokenKey]);
|
||||
const formattedFiat = useMemo(
|
||||
() =>
|
||||
getTokenFiatAmount(
|
||||
|
Loading…
Reference in New Issue
Block a user