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