mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Using formatIconUrlWithProxy to get the iconUrl proxy of swap token (#15562)
This commit is contained in:
parent
aac5a45bec
commit
4512a9e151
@ -123,7 +123,7 @@
|
|||||||
"@keystonehq/metamask-airgapped-keyring": "0.2.1",
|
"@keystonehq/metamask-airgapped-keyring": "0.2.1",
|
||||||
"@material-ui/core": "^4.11.0",
|
"@material-ui/core": "^4.11.0",
|
||||||
"@metamask/contract-metadata": "^1.31.0",
|
"@metamask/contract-metadata": "^1.31.0",
|
||||||
"@metamask/controllers": "^30.1.0",
|
"@metamask/controllers": "^30.3.0",
|
||||||
"@metamask/design-tokens": "^1.9.0",
|
"@metamask/design-tokens": "^1.9.0",
|
||||||
"@metamask/eth-ledger-bridge-keyring": "^0.13.0",
|
"@metamask/eth-ledger-bridge-keyring": "^0.13.0",
|
||||||
"@metamask/eth-token-tracker": "^4.0.0",
|
"@metamask/eth-token-tracker": "^4.0.0",
|
||||||
@ -299,8 +299,8 @@
|
|||||||
"browser-util-inspect": "^0.2.0",
|
"browser-util-inspect": "^0.2.0",
|
||||||
"browserify": "^16.5.1",
|
"browserify": "^16.5.1",
|
||||||
"chalk": "^3.0.0",
|
"chalk": "^3.0.0",
|
||||||
"chokidar": "^3.5.3",
|
|
||||||
"chromedriver": "^103.0.0",
|
"chromedriver": "^103.0.0",
|
||||||
|
"chokidar": "^3.5.3",
|
||||||
"concurrently": "^5.2.0",
|
"concurrently": "^5.2.0",
|
||||||
"copy-webpack-plugin": "^6.0.3",
|
"copy-webpack-plugin": "^6.0.3",
|
||||||
"cross-spawn": "^7.0.3",
|
"cross-spawn": "^7.0.3",
|
||||||
|
@ -2,6 +2,7 @@ import { useMemo } from 'react';
|
|||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { isEqual, uniqBy } from 'lodash';
|
import { isEqual, uniqBy } from 'lodash';
|
||||||
|
import { formatIconUrlWithProxy } from '@metamask/controllers';
|
||||||
import { getTokenFiatAmount } from '../helpers/utils/token-util';
|
import { getTokenFiatAmount } from '../helpers/utils/token-util';
|
||||||
import {
|
import {
|
||||||
getTokenExchangeRates,
|
getTokenExchangeRates,
|
||||||
@ -16,6 +17,16 @@ import { getSwapsTokens } from '../ducks/swaps/swaps';
|
|||||||
import { isSwapsDefaultTokenSymbol } from '../../shared/modules/swaps.utils';
|
import { isSwapsDefaultTokenSymbol } from '../../shared/modules/swaps.utils';
|
||||||
import { toChecksumHexAddress } from '../../shared/modules/hexstring-utils';
|
import { toChecksumHexAddress } from '../../shared/modules/hexstring-utils';
|
||||||
import { TOKEN_BUCKET_PRIORITY } from '../../shared/constants/swaps';
|
import { TOKEN_BUCKET_PRIORITY } from '../../shared/constants/swaps';
|
||||||
|
import {
|
||||||
|
ETH_SYMBOL,
|
||||||
|
MATIC_SYMBOL,
|
||||||
|
BNB_SYMBOL,
|
||||||
|
AVALANCHE_SYMBOL,
|
||||||
|
MAINNET_CHAIN_ID,
|
||||||
|
BSC_CHAIN_ID,
|
||||||
|
POLYGON_CHAIN_ID,
|
||||||
|
AVALANCHE_CHAIN_ID,
|
||||||
|
} from '../../shared/constants/network';
|
||||||
import { useEqualityCheck } from './useEqualityCheck';
|
import { useEqualityCheck } from './useEqualityCheck';
|
||||||
|
|
||||||
export function getRenderableTokenData(
|
export function getRenderableTokenData(
|
||||||
@ -55,8 +66,15 @@ export function getRenderableTokenData(
|
|||||||
)
|
)
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
const usedIconUrl =
|
const tokenIconUrl =
|
||||||
iconUrl || tokenList[address?.toLowerCase()]?.iconUrl || token?.image;
|
(symbol === ETH_SYMBOL && chainId === MAINNET_CHAIN_ID) ||
|
||||||
|
(symbol === BNB_SYMBOL && chainId === BSC_CHAIN_ID) ||
|
||||||
|
(symbol === MATIC_SYMBOL && chainId === POLYGON_CHAIN_ID) ||
|
||||||
|
(symbol === AVALANCHE_SYMBOL && chainId === AVALANCHE_CHAIN_ID)
|
||||||
|
? iconUrl
|
||||||
|
: formatIconUrlWithProxy({ chainId, tokenAddress: address || '' });
|
||||||
|
const usedIconUrl = tokenIconUrl || token?.image;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...token,
|
...token,
|
||||||
primaryLabel: symbol,
|
primaryLabel: symbol,
|
||||||
|
@ -2873,10 +2873,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.35.0.tgz#2bf2b8f2b6fdbd5132f0bcfa594b6c02dc71c42e"
|
resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.35.0.tgz#2bf2b8f2b6fdbd5132f0bcfa594b6c02dc71c42e"
|
||||||
integrity sha512-zfZKwLFOVrQS8vTFoeoNCG9JhqmK4oyembGiGVVpUAYD9BHVZnd9WpicGoUC07ROXLEyQuAK9AJZNBtqwwzfEQ==
|
integrity sha512-zfZKwLFOVrQS8vTFoeoNCG9JhqmK4oyembGiGVVpUAYD9BHVZnd9WpicGoUC07ROXLEyQuAK9AJZNBtqwwzfEQ==
|
||||||
|
|
||||||
"@metamask/controllers@^30.0.0", "@metamask/controllers@^30.1.0":
|
"@metamask/controllers@^30.0.0", "@metamask/controllers@^30.3.0":
|
||||||
version "30.1.0"
|
version "30.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-30.1.0.tgz#157d0afca156f1f37a89fbb864c4ee5c64d23af0"
|
resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-30.3.0.tgz#64ad8be538b75226a14f667db05c4ca02c75533f"
|
||||||
integrity sha512-480mQafsYKbl0q7YgV820mrPCUtWgLLVH/s8ozNT6/ZVX3sBU0FBhNKeCalewhn0HRfMRnLe8pvHCKIH30k/0w==
|
integrity sha512-6KtRIEBAcXeF/ozsP2I7T7hFv1X0mf30ygWcgApKdQEYXAERAaBz0S9ENC8OsFULUj5MFPBfUKIDaeGNOq6MvQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ethereumjs/common" "^2.3.1"
|
"@ethereumjs/common" "^2.3.1"
|
||||||
"@ethereumjs/tx" "^3.2.1"
|
"@ethereumjs/tx" "^3.2.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user