Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromcunha committed Mar 5, 2024
2 parents 141f79a + d08f25a commit ff77d6b
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 42 deletions.
2 changes: 2 additions & 0 deletions hooks/useIsUnsupportedChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const MAINNET_CHAINS: Chain[] = [
reservoirChains.scroll,
reservoirChains.opBnb,
reservoirChains.ancient8,
reservoirChains.astarZkEVM,
reservoirChains.blast,
]

const MAINNET_DEPLOYMENT_URLS = [
Expand Down
59 changes: 28 additions & 31 deletions hooks/useMultiMarketplaceConfigs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { paths } from '@reservoir0x/reservoir-sdk'
import { useMemo } from 'react'
import useSWR from 'swr/immutable'
import useMarketplaceChain from './useMarketplaceChain'
import { setParams } from '@reservoir0x/reservoir-sdk'
import { ReservoirChain } from 'utils/chains'
import useMarketplaceChain from './useMarketplaceChain'

type MarketplaceConfigurationsResponse =
paths['/collections/{collection}/marketplace-configurations/v1']['get']['responses']['200']['schema']
Expand All @@ -20,26 +19,22 @@ const fetcher = async (urls: string[]) => {
const fetches = urls.map((url) =>
fetch(url)
.then((r) => r.json())
.catch(() => undefined)
.catch(() => undefined),
)
const results = await Promise.allSettled(fetches)
return results.map((result) =>
result.status === 'fulfilled' ? result.value : undefined
result.status === 'fulfilled' ? result.value : undefined,
)
}

export default function (
tokens: string[],
chain?: ReservoirChain | null | undefined,
enabled: boolean = true
) {
export default function (tokens: string[], enabled: boolean = true) {
const { proxyApi } = useMarketplaceChain()
const urls = tokens.map((id) => {
const pieces = id.split(':')
const tokenId = pieces[pieces.length - 1]
const collectionId = pieces.slice(0, -1).join(':')
let url = new URL(
`${process.env.NEXT_PUBLIC_PROXY_URL}${proxyApi}/collections/${collectionId}/marketplace-configurations/v1`
`${process.env.NEXT_PUBLIC_PROXY_URL}${proxyApi}/collections/${collectionId}/marketplace-configurations/v1`,
)
setParams(url, {
tokenId,
Expand All @@ -48,36 +43,38 @@ export default function (
})
const { data, error } = useSWR<MarketplaceConfigurationsResponse[]>(
enabled ? urls : null,
fetcher
fetcher,
)

const tokenExchanges = useMemo(() => {
return (
data?.reduce((exchanges, data, i) => {
const reservoirMarketplace = data?.marketplaces?.find(
(marketplace) => marketplace.orderbook === 'reservoir'
)
data?.reduce(
(exchanges, data, i) => {
const reservoirMarketplace = data?.marketplaces?.find(
(marketplace) => marketplace.orderbook === 'reservoir',
)

if (reservoirMarketplace) {
//CONFIGURABLE: Set your marketplace fee and recipient, (fee is in BPS)
// Note that this impacts orders created on your marketplace (offers/listings)
reservoirMarketplace.fee = {
bps: 250,
}
if (reservoirMarketplace) {
//CONFIGURABLE: Set your marketplace fee and recipient, (fee is in BPS)
// Note that this impacts orders created on your marketplace (offers/listings)
reservoirMarketplace.fee = {
bps: 250,
}

const key = tokens[i]
const key = tokens[i]

exchanges[key] = {
exchange: Object.values(reservoirMarketplace?.exchanges || {}).find(
(exchange) => exchange?.enabled
) as Exchange,
marketplace: reservoirMarketplace,
exchanges[key] = {
exchange: Object.values(
reservoirMarketplace?.exchanges || {},
).find((exchange) => exchange?.enabled) as Exchange,
marketplace: reservoirMarketplace,
}
}
}

return exchanges
}, {} as Record<string, { exchange: Exchange; marketplace: Marketplace }>) ||
{}
return exchanges
},
{} as Record<string, { exchange: Exchange; marketplace: Marketplace }>,
) || {}
)
}, [data])

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@radix-ui/react-toggle-group": "^1.0.1",
"@radix-ui/react-tooltip": "1.0.6",
"@rainbow-me/rainbowkit": "2.0.0",
"@reservoir0x/reservoir-kit-ui": "2.3.3",
"@reservoir0x/reservoir-kit-ui": "2.3.4",
"@sentry/nextjs": "^7.85.0",
"@tanstack/react-query": "5.20.2",
"@types/uuid": "^9.0.1",
Expand Down
20 changes: 20 additions & 0 deletions public/icons/astar-zkevm-icon-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions public/icons/astar-zkevm-icon-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion utils/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default [
name: 'Blast',
lightIconUrl: '/icons/blast-icon-light.svg',
darkIconUrl: '/icons/blast-icon-dark.svg',
reservoirBaseUrl: 'https://api-blast.reservoir.tools',
reservoirBaseUrl: reservoirChains.blast.baseApiUrl,
proxyApi: '/api/reservoir/blast',
routePrefix: 'blast',
apiKey: process.env.RESERVOIR_API_KEY,
Expand All @@ -360,4 +360,18 @@ export default [
community: process.env.NEXT_PUBLIC_BLAST_COMMUNITY,
checkPollingInterval: reservoirChains.blast.checkPollingInterval,
},
{
...customChains.astarZkEVM,
name: 'Astar ZkEVM',
lightIconUrl: '/icons/astar-zkevm-icon-light.svg',
darkIconUrl: '/icons/astar-zkevm-icon-dark.svg',
reservoirBaseUrl: reservoirChains.astarZkEVM.baseApiUrl,
proxyApi: '/api/reservoir/blast',
routePrefix: 'astar-zkevm',
apiKey: process.env.RESERVOIR_API_KEY,
coingeckoId: 'ethereum',
collectionSetId: process.env.NEXT_PUBLIC_ASTAR_ZKEVM_COLLECTION_SET_ID,
community: process.env.NEXT_PUBLIC_ASTAR_ZKEVM_COMMUNITY,
checkPollingInterval: reservoirChains.astarZkEVM.checkPollingInterval,
},
] as ReservoirChain[]
74 changes: 74 additions & 0 deletions utils/paymentTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,5 +625,79 @@ export const chainPaymentTokensMap = {
name: 'WETH',
decimals: 18,
},
{
chainId: 1,
address: zeroAddress,
symbol: 'ETH',
name: 'ETH',
decimals: 18,
},
{
chainId: 8453,
address: zeroAddress,
symbol: 'ETH',
name: 'Base ETH',
decimals: 18,
},
{
chainId: 10,
address: zeroAddress,
symbol: 'ETH',
name: 'Optimism ETH',
decimals: 18,
},
{
chainId: 7777777,
address: zeroAddress,
symbol: 'ETH',
name: 'Zora ETH',
decimals: 18,
},
],

// Blast
81457: [
{
chainId: 81457,
address: zeroAddress,
symbol: 'ETH',
name: 'Blast ETH',
decimals: 18,
},
{
chainId: 81457,
address: '0x4300000000000000000000000000000000000004',
symbol: 'WETH',
name: 'Blast WETH',
decimals: 18,
},
{
chainId: 1,
address: zeroAddress,
symbol: 'ETH',
name: 'ETH',
decimals: 18,
},
{
chainId: 8453,
address: zeroAddress,
symbol: 'ETH',
name: 'Base ETH',
decimals: 18,
},
{
chainId: 10,
address: zeroAddress,
symbol: 'ETH',
name: 'Optimism ETH',
decimals: 18,
},
{
chainId: 7777777,
address: zeroAddress,
symbol: 'ETH',
name: 'Zora ETH',
decimals: 18,
},
],
} as Record<number, PaymentToken[]>
2 changes: 2 additions & 0 deletions utils/wrappedContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const wrappedContracts: Record<number, string> = {
11155111: '0x7b79995e5f793a07bc00c21412e50ecae098e7f9', //sepolia
70700: '0x77684A04145a5924eFCE0D92A7c4a2A2E8C359de', //Apex Pop
168587773: '0x4200000000000000000000000000000000000006', //blast sepolia
81457: '0x4300000000000000000000000000000000000004', //blast
3776: '0x81ECac0D6Be0550A00FF064a4f9dd2400585FE9c', // astar zkEVM
}

export default wrappedContracts
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1888,10 +1888,10 @@
dependencies:
merge-options "^3.0.4"

"@reservoir0x/reservoir-kit-ui@2.3.3":
version "2.3.3"
resolved "https://registry.yarnpkg.com/@reservoir0x/reservoir-kit-ui/-/reservoir-kit-ui-2.3.3.tgz#d6be9bebeb02dedc260fa359189f96330116e620"
integrity sha512-mBvZIIS9k8KE/fiifCeFUKer2lC09THC4YSHx454ReRA9ifUKZmYgue8Kyend/bouAZXFMi9rBd58eQx96Uc4A==
"@reservoir0x/reservoir-kit-ui@2.3.4":
version "2.3.4"
resolved "https://registry.yarnpkg.com/@reservoir0x/reservoir-kit-ui/-/reservoir-kit-ui-2.3.4.tgz#c87588b3cbe475dfe25d9a8cde675e19037b6276"
integrity sha512-wrZQr5Lt1NinGsjUZfRTZsvrPN/HBGGxaRnT09bHY+ay+zO9K2fdKPr9XdPULJU+HMWf8NH3hgStcEyO6flx/Q==
dependencies:
"@fortawesome/fontawesome-svg-core" "^6.1.1"
"@fortawesome/free-solid-svg-icons" "^6.1.1"
Expand All @@ -1907,18 +1907,18 @@
"@radix-ui/react-toggle-group" "1.0.4"
"@radix-ui/react-tooltip" "1.0.6"
"@react-hookz/web" "^19.2.0"
"@reservoir0x/reservoir-sdk" "2.0.5"
"@reservoir0x/reservoir-sdk" "2.0.6"
"@stitches/react" "1.3.1-1"
dayjs "^1.11.4"
flatpickr "^4.6.13"
framer-motion "^6.4.2"
react-flatpickr "^3.10.13"
swr "2.0.1"

"@reservoir0x/reservoir-sdk@2.0.5":
version "2.0.5"
resolved "https://registry.yarnpkg.com/@reservoir0x/reservoir-sdk/-/reservoir-sdk-2.0.5.tgz#f158627ab8c4f5ceba2402d8e5cf3e3a82b9d4d9"
integrity sha512-UOLxzIyR+cOpuenC0EuqX4GX4FgH3GkyTi3eQFC1Tnc+zU1SSdMiF8caXPe0csWEIwtDysQ0L0Vzk2suBg07bQ==
"@reservoir0x/reservoir-sdk@2.0.6":
version "2.0.6"
resolved "https://registry.yarnpkg.com/@reservoir0x/reservoir-sdk/-/reservoir-sdk-2.0.6.tgz#a4c8086b9dad293ee7b2dbc22e2a21f101f91b67"
integrity sha512-ojyCAcH9VC19I1KWaRCjAhF0NGtQEjclmJCfp95H1c/ilHU0IxBd2pRkNhxrQIaJ8RsGvleO+Z2UJmNYZ9i1Gg==
dependencies:
axios "^1.6.7"

Expand Down

0 comments on commit ff77d6b

Please sign in to comment.