From 772416cc7ad2b9783c0d4febd75167d98b020c9c Mon Sep 17 00:00:00 2001 From: Charles Bachmeier Date: Thu, 23 Feb 2023 10:44:27 -0800 Subject: [PATCH] feat: add collection blocklist for ip infringement (#6022) Co-authored-by: Charles Bachmeier --- src/nft/pages/collection/index.tsx | 3 ++- .../queries/genie/SearchCollectionsFetcher.ts | 21 +++++++++++-------- .../genie/TrendingCollectionsFetcher.ts | 4 +++- src/nft/utils/collection.ts | 5 +++++ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/nft/pages/collection/index.tsx b/src/nft/pages/collection/index.tsx index 1f238b4add..f57c439b04 100644 --- a/src/nft/pages/collection/index.tsx +++ b/src/nft/pages/collection/index.tsx @@ -15,6 +15,7 @@ import { CollectionPageSkeleton } from 'nft/components/collection/CollectionPage import { BagCloseIcon } from 'nft/components/icons' import { useBag, useCollectionFilters, useFiltersExpanded, useIsMobile } from 'nft/hooks' import * as styles from 'nft/pages/collection/index.css' +import { blocklistedCollections } from 'nft/utils' import { Suspense, useEffect } from 'react' import { useLocation, useNavigate, useParams } from 'react-router-dom' import { animated, easings, useSpring } from 'react-spring' @@ -188,7 +189,7 @@ const Collection = () => { width: CollectionContainerWidthChange.to((x) => `calc(100% - ${x as number}px)`), }} > - {contractAddress ? ( + {contractAddress && !blocklistedCollections.includes(contractAddress) ? ( <> ; floorPrice: string }) => { - return { - ...collection, - stats: { - ...collection.stats, - floor_price: collection.floorPrice, - }, - } - }) + ? data.data + .filter((collection: { address: string }) => !blocklistedCollections.includes(collection.address)) + .map((collection: { stats: Record; floorPrice: string }) => { + return { + ...collection, + stats: { + ...collection.stats, + floor_price: collection.floorPrice, + }, + } + }) : [] return formattedData.slice(0, MAX_SEARCH_RESULTS) } diff --git a/src/nft/queries/genie/TrendingCollectionsFetcher.ts b/src/nft/queries/genie/TrendingCollectionsFetcher.ts index 36bc04d570..13964afabe 100644 --- a/src/nft/queries/genie/TrendingCollectionsFetcher.ts +++ b/src/nft/queries/genie/TrendingCollectionsFetcher.ts @@ -1,3 +1,5 @@ +import { blocklistedCollections } from 'nft/utils' + import { TimePeriod, TrendingCollection } from '../../types' const NFT_API_URL = process.env.REACT_APP_TEMP_API_URL @@ -18,5 +20,5 @@ export const fetchTrendingCollections = async (payload: { const data = await r.json() - return data ?? [] + return data.filter((collection: { address: string }) => !blocklistedCollections.includes(collection.address)) ?? [] } diff --git a/src/nft/utils/collection.ts b/src/nft/utils/collection.ts index 3f5e215879..664771a9a1 100644 --- a/src/nft/utils/collection.ts +++ b/src/nft/utils/collection.ts @@ -22,3 +22,8 @@ export const isInSameSudoSwapPool = (assetA: GenieAsset, assetB: GenieAsset): bo export const isInSameMarketplaceCollection = (assetA: GenieAsset, assetB: GenieAsset): boolean => { return assetA.address === assetB.address && assetA.marketplace === assetB.marketplace } + +export const blocklistedCollections = [ + '0xd5eeac01b0d1d929d6cffaaf78020af137277293', + '0x85c08fffa9510f87019efdcf986301873cbb10d6', +]