diff --git a/ui/hooks/bridge/useTokensWithFiltering.ts b/ui/hooks/bridge/useTokensWithFiltering.ts index 597b6d3e1c08..3d846f8eaa6f 100644 --- a/ui/hooks/bridge/useTokensWithFiltering.ts +++ b/ui/hooks/bridge/useTokensWithFiltering.ts @@ -3,7 +3,6 @@ import { useSelector } from 'react-redux'; import { isEqual } from 'lodash'; import { ChainId } from '@metamask/controller-utils'; import { Hex } from '@metamask/utils'; -import { useParams } from 'react-router-dom'; import { zeroAddress } from 'ethereumjs-util'; import { getAllDetectedTokensForSelectedAddress, @@ -41,17 +40,15 @@ type FilterPredicate = ( /** * Returns a token list generator that filters and sorts tokens in this order - * - matches URL token parameter * - matches search query - * - highest balance in selected currency - * - detected tokens (with balance) + * - tokens with highest to lowest balance in selected currency + * - detected tokens (without balance) * - popularity * - all other tokens * * @param chainId - the selected src/dest chainId */ export const useTokensWithFiltering = (chainId?: ChainId | Hex) => { - const { token: tokenAddressFromUrl } = useParams(); const allDetectedTokens: Record = useSelector( getAllDetectedTokensForSelectedAddress, ); @@ -140,22 +137,6 @@ export const useTokensWithFiltering = (chainId?: ChainId | Hex) => { return; } - // If a token address is in the URL (e.g. from a deep link), yield that token first - if (tokenAddressFromUrl) { - const token = - tokenList[tokenAddressFromUrl] ?? - tokenList[tokenAddressFromUrl.toLowerCase()]; - if ( - token && - shouldAddToken(token.symbol, token.address ?? undefined, chainId) - ) { - const tokenWithData = buildTokenData(token); - if (tokenWithData) { - yield tokenWithData; - } - } - } - // Yield multichain tokens with balances and are not blocked for (const token of multichainTokensWithBalance) { if ( @@ -250,7 +231,6 @@ export const useTokensWithFiltering = (chainId?: ChainId | Hex) => { currentCurrency, chainId, tokenList, - tokenAddressFromUrl, allDetectedTokens, ], );