1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Swap : Fix undefined icon url (#14411)

This commit is contained in:
Guillaume Roux 2022-04-13 14:18:35 +02:00 committed by GitHub
parent 8eb8fc1591
commit 4b3977044f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,19 +61,19 @@ export function getRenderableTokenData(
symbol, symbol,
false, false,
) || ''; ) || '';
let tokenAddress;
let tokenIconUrl; // token from dynamic api list is fetched when useTokenDetection is true
if (process.env.TOKEN_DETECTION_V2) { // And since the token.address from allTokens is checksumaddress
tokenAddress = address?.toLowerCase(); // token Address have to be changed to lowercase when we are using dynamic list
tokenIconUrl = tokenList[tokenAddress]?.iconUrl; const tokenAddress =
} else { useTokenDetection || process.env.TOKEN_DETECTION_V2
// token from dynamic api list is fetched when useTokenDetection is true ? address?.toLowerCase()
// And since the token.address from allTokens is checksumaddress : address;
// token Address have to be changed to lowercase when we are using dynamic list
tokenAddress = useTokenDetection ? address?.toLowerCase() : address; let tokenIconUrl = tokenList[tokenAddress]?.iconUrl;
tokenIconUrl = useTokenDetection
? tokenList[tokenAddress]?.iconUrl if (!process.env.TOKEN_DETECTION_V2 && !useTokenDetection && tokenIconUrl) {
: `images/contract/${tokenList[tokenAddress].iconUrl}`; tokenIconUrl = `images/contract/${tokenIconUrl}`;
} }
const usedIconUrl = iconUrl || tokenIconUrl || token?.image; const usedIconUrl = iconUrl || tokenIconUrl || token?.image;
return { return {