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

fix missing conversion rates in swaps token drop down (#12420)

* fix missing conversion rates in swaps token drop down

* make defaultToken appear at the top of the owned section of the dropdown with full renderable data regardless of whether swaps tokens are available

* revert change to filter non-native tokens with symbol ETH
This commit is contained in:
Alex Donesky 2021-10-25 10:03:21 -05:00 committed by GitHub
parent b7b21ed20b
commit 385e0f2ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,7 @@ import { getConversionRate } from '../ducks/metamask/metamask';
import { getSwapsTokens } from '../ducks/swaps/swaps';
import { isSwapsDefaultTokenSymbol } from '../../shared/modules/swaps.utils';
import { toChecksumHexAddress } from '../../shared/modules/hexstring-utils';
import { useEqualityCheck } from './useEqualityCheck';
const shuffledContractMap = shuffle(
@ -45,7 +46,7 @@ export function getRenderableTokenData(
getTokenFiatAmount(
isSwapsDefaultTokenSymbol(symbol, chainId)
? 1
: contractExchangeRates[address],
: contractExchangeRates[toChecksumHexAddress(address)],
conversionRate,
currentCurrency,
string,
@ -56,7 +57,7 @@ export function getRenderableTokenData(
getTokenFiatAmount(
isSwapsDefaultTokenSymbol(symbol, chainId)
? 1
: contractExchangeRates[address],
: contractExchangeRates[toChecksumHexAddress(address)],
conversionRate,
currentCurrency,
string,
@ -139,7 +140,7 @@ export function useTokensToSearch({
};
const memoizedSwapsAndUserTokensWithoutDuplicities = uniqBy(
[...memoizedTokensToSearch, ...memoizedUsersToken],
[memoizedDefaultToken, ...memoizedTokensToSearch, ...memoizedUsersToken],
(token) => token.address.toLowerCase(),
);
@ -185,6 +186,7 @@ export function useTokensToSearch({
conversionRate,
currentCurrency,
memoizedTopTokens,
memoizedDefaultToken,
chainId,
tokenList,
useTokenDetection,