File tree Expand file tree Collapse file tree
app/components/Views/TrendingView/feeds/stocks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { useMemo } from 'react' ;
12import type { TrendingAsset } from '@metamask/assets-controllers' ;
23import { useRwaTokens } from '../../../../UI/Trending/hooks/useRwaTokens/useRwaTokens' ;
34import { useFeedRefresh } from '../../hooks/useFeedRefresh' ;
45import type { RefreshConfig } from '../../hooks/useExploreRefresh' ;
56
7+ const ETHEREUM_CAIP_CHAIN_ID = 'eip155:1' ;
8+
69interface UseStocksFeedOptions {
710 query ?: string ;
811 refresh ?: RefreshConfig ;
@@ -14,17 +17,22 @@ export interface UseStocksFeedResult {
1417 refetch : ( ) => Promise < void > ;
1518}
1619
17- /** Tokenized stocks (RWAs on Ethereum mainnet) . */
20+ /** Tokenized stocks (RWAs). Only Ethereum mainnet tokens are shown in the section . */
1821export const useStocksFeed = ( {
1922 query,
2023 refresh,
2124} : UseStocksFeedOptions = { } ) : UseStocksFeedResult => {
2225 const { data, isLoading, refetch } = useRwaTokens ( {
2326 searchQuery : query ,
24- ...( query ? { } : { chainIds : [ 'eip155:1' ] } ) ,
2527 } ) ;
2628
29+ const ethereumData = useMemo (
30+ ( ) =>
31+ data . filter ( ( asset ) => asset . assetId . startsWith ( ETHEREUM_CAIP_CHAIN_ID ) ) ,
32+ [ data ] ,
33+ ) ;
34+
2735 useFeedRefresh ( refresh , refetch ) ;
2836
29- return { data, isLoading, refetch } ;
37+ return { data : ethereumData , isLoading, refetch } ;
3038} ;
You can’t perform that action at this time.
0 commit comments