diff --git a/src/__swaps__/types/search.ts b/src/__swaps__/types/search.ts index c11d1a6f920..b51a452b481 100644 --- a/src/__swaps__/types/search.ts +++ b/src/__swaps__/types/search.ts @@ -10,6 +10,14 @@ export type TokenSearchThreshold = 'CONTAINS' | 'CASE_SENSITIVE_EQUAL'; export type TokenSearchListId = 'highLiquidityAssets' | 'lowLiquidityAssets' | 'verifiedAssets'; +interface Market { + market_cap: { + value: number; + }; + volume_24h: number; + circulating_supply: number; +} + export type SearchAsset = { address: AddressOrEth; chainId: ChainId; @@ -22,6 +30,7 @@ export type SearchAsset = { isNativeAsset?: boolean; isVerified: boolean; mainnetAddress: AddressOrEth; + market?: Market; name: string; networks: { [chainId in ChainId]?: { diff --git a/src/hooks/useSearchCurrencyList.ts b/src/hooks/useSearchCurrencyList.ts index 57c5c9c6dfc..f99e8bcdbb1 100644 --- a/src/hooks/useSearchCurrencyList.ts +++ b/src/hooks/useSearchCurrencyList.ts @@ -97,6 +97,8 @@ const useSearchCurrencyList = (searchQuery: string) => { const topResults = results .sort((a, b) => { if (a.isNativeAsset !== b.isNativeAsset) return a.isNativeAsset ? -1 : 1; + if (a.market?.market_cap?.value !== b.market?.market_cap?.value) + return (b.market?.market_cap?.value || 0) - (a.market?.market_cap?.value || 0); if (a.highLiquidity !== b.highLiquidity) return a.highLiquidity ? -1 : 1; return Object.keys(b.networks).length - Object.keys(a.networks).length; })