Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
772416cc
Unverified
Commit
772416cc
authored
Feb 23, 2023
by
Charles Bachmeier
Committed by
GitHub
Feb 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add collection blocklist for ip infringement (#6022)
Co-authored-by:
Charles Bachmeier
<
charlie@genie.xyz
>
parent
f15e5725
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
11 deletions
+22
-11
index.tsx
src/nft/pages/collection/index.tsx
+2
-1
SearchCollectionsFetcher.ts
src/nft/queries/genie/SearchCollectionsFetcher.ts
+12
-9
TrendingCollectionsFetcher.ts
src/nft/queries/genie/TrendingCollectionsFetcher.ts
+3
-1
collection.ts
src/nft/utils/collection.ts
+5
-0
No files found.
src/nft/pages/collection/index.tsx
View file @
772416cc
...
@@ -15,6 +15,7 @@ import { CollectionPageSkeleton } from 'nft/components/collection/CollectionPage
...
@@ -15,6 +15,7 @@ import { CollectionPageSkeleton } from 'nft/components/collection/CollectionPage
import
{
BagCloseIcon
}
from
'
nft/components/icons
'
import
{
BagCloseIcon
}
from
'
nft/components/icons
'
import
{
useBag
,
useCollectionFilters
,
useFiltersExpanded
,
useIsMobile
}
from
'
nft/hooks
'
import
{
useBag
,
useCollectionFilters
,
useFiltersExpanded
,
useIsMobile
}
from
'
nft/hooks
'
import
*
as
styles
from
'
nft/pages/collection/index.css
'
import
*
as
styles
from
'
nft/pages/collection/index.css
'
import
{
blocklistedCollections
}
from
'
nft/utils
'
import
{
Suspense
,
useEffect
}
from
'
react
'
import
{
Suspense
,
useEffect
}
from
'
react
'
import
{
useLocation
,
useNavigate
,
useParams
}
from
'
react-router-dom
'
import
{
useLocation
,
useNavigate
,
useParams
}
from
'
react-router-dom
'
import
{
animated
,
easings
,
useSpring
}
from
'
react-spring
'
import
{
animated
,
easings
,
useSpring
}
from
'
react-spring
'
...
@@ -188,7 +189,7 @@ const Collection = () => {
...
@@ -188,7 +189,7 @@ const Collection = () => {
width
:
CollectionContainerWidthChange
.
to
((
x
)
=>
`calc(100% - ${x as number}px)`
),
width
:
CollectionContainerWidthChange
.
to
((
x
)
=>
`calc(100% - ${x as number}px)`
),
}
}
}
}
>
>
{
contractAddress
?
(
{
contractAddress
&&
!
blocklistedCollections
.
includes
(
contractAddress
)
?
(
<>
<>
<
BannerWrapper
>
<
BannerWrapper
>
<
Banner
<
Banner
...
...
src/nft/queries/genie/SearchCollectionsFetcher.ts
View file @
772416cc
import
{
isAddress
}
from
'
@ethersproject/address
'
import
{
isAddress
}
from
'
@ethersproject/address
'
import
{
blocklistedCollections
}
from
'
nft/utils
'
import
{
GenieCollection
}
from
'
../../types
'
import
{
GenieCollection
}
from
'
../../types
'
...
@@ -45,15 +46,17 @@ export const fetchSearchCollections = async (addressOrName: string, recursive =
...
@@ -45,15 +46,17 @@ export const fetchSearchCollections = async (addressOrName: string, recursive =
if
(
isName
)
{
if
(
isName
)
{
const
data
=
await
r
.
json
()
const
data
=
await
r
.
json
()
const
formattedData
=
data
?.
data
const
formattedData
=
data
?.
data
?
data
.
data
.
map
((
collection
:
{
stats
:
Record
<
string
,
unknown
>
;
floorPrice
:
string
})
=>
{
?
data
.
data
return
{
.
filter
((
collection
:
{
address
:
string
})
=>
!
blocklistedCollections
.
includes
(
collection
.
address
))
...
collection
,
.
map
((
collection
:
{
stats
:
Record
<
string
,
unknown
>
;
floorPrice
:
string
})
=>
{
stats
:
{
return
{
...
collection
.
stats
,
...
collection
,
floor_price
:
collection
.
floorPrice
,
stats
:
{
},
...
collection
.
stats
,
}
floor_price
:
collection
.
floorPrice
,
})
},
}
})
:
[]
:
[]
return
formattedData
.
slice
(
0
,
MAX_SEARCH_RESULTS
)
return
formattedData
.
slice
(
0
,
MAX_SEARCH_RESULTS
)
}
}
...
...
src/nft/queries/genie/TrendingCollectionsFetcher.ts
View file @
772416cc
import
{
blocklistedCollections
}
from
'
nft/utils
'
import
{
TimePeriod
,
TrendingCollection
}
from
'
../../types
'
import
{
TimePeriod
,
TrendingCollection
}
from
'
../../types
'
const
NFT_API_URL
=
process
.
env
.
REACT_APP_TEMP_API_URL
const
NFT_API_URL
=
process
.
env
.
REACT_APP_TEMP_API_URL
...
@@ -18,5 +20,5 @@ export const fetchTrendingCollections = async (payload: {
...
@@ -18,5 +20,5 @@ export const fetchTrendingCollections = async (payload: {
const
data
=
await
r
.
json
()
const
data
=
await
r
.
json
()
return
data
??
[]
return
data
.
filter
((
collection
:
{
address
:
string
})
=>
!
blocklistedCollections
.
includes
(
collection
.
address
))
??
[]
}
}
src/nft/utils/collection.ts
View file @
772416cc
...
@@ -22,3 +22,8 @@ export const isInSameSudoSwapPool = (assetA: GenieAsset, assetB: GenieAsset): bo
...
@@ -22,3 +22,8 @@ export const isInSameSudoSwapPool = (assetA: GenieAsset, assetB: GenieAsset): bo
export
const
isInSameMarketplaceCollection
=
(
assetA
:
GenieAsset
,
assetB
:
GenieAsset
):
boolean
=>
{
export
const
isInSameMarketplaceCollection
=
(
assetA
:
GenieAsset
,
assetB
:
GenieAsset
):
boolean
=>
{
return
assetA
.
address
===
assetB
.
address
&&
assetA
.
marketplace
===
assetB
.
marketplace
return
assetA
.
address
===
assetB
.
address
&&
assetA
.
marketplace
===
assetB
.
marketplace
}
}
export
const
blocklistedCollections
=
[
'
0xd5eeac01b0d1d929d6cffaaf78020af137277293
'
,
'
0x85c08fffa9510f87019efdcf986301873cbb10d6
'
,
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment