Commit 964001fe authored by Charles Bachmeier's avatar Charles Bachmeier Committed by GitHub

refactor: update all nft fetchers to use v3 endpoint (#4894)

update all fetchers to use v3 endpoint
Co-authored-by: default avatarCharles Bachmeier <charlie@genie.xyz>
parent 449c323f
......@@ -40,7 +40,7 @@ export const AssetsFetcher = async ({
notForSale?: boolean
pageParam: number
}): Promise<GenieAsset[] | undefined> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/assets`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/assets`
const payload: AssetPayload = {
filters: {
address: contractAddress.toLowerCase(),
......
......@@ -8,7 +8,7 @@ export const CollectionPreviewFetcher = async (
}
]
> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/collectionPreview?address=${address}`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/collectionPreview?address=${address}`
const controller = new AbortController()
......
......@@ -4,7 +4,7 @@ import { GenieCollection } from '../../types'
export const CollectionStatsFetcher = async (addressOrName: string, recursive = false): Promise<GenieCollection> => {
const isName = !isAddress(addressOrName.toLowerCase())
const url = `${process.env.REACT_APP_GENIE_API_URL}/collections`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/collections`
if (!isName && !recursive) {
try {
......
......@@ -5,7 +5,7 @@ export const fetchMultipleCollectionStats = async ({
}: {
addresses: string[]
}): Promise<GenieCollection[]> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/searchCollections`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/searchCollections`
const filters = {
address: { $in: addresses },
}
......
......@@ -9,7 +9,7 @@ export const fetchRoute = async ({
toBuy: any
senderAddress: string
}): Promise<RouteResponse> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/route`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/route`
const payload = {
sell: [...toSell].map((x) => buildRouteItem(x)),
buy: [...toBuy].filter((x) => x.tokenType !== 'Dust').map((x) => buildRouteItem(x)),
......
......@@ -7,7 +7,7 @@ export const fetchSingleAsset = async ({
contractAddress: string
tokenId?: string
}): Promise<[GenieAsset, CollectionInfoForAsset]> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/assetDetails?address=${contractAddress}&tokenId=${tokenId}`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/assetDetails?address=${contractAddress}&tokenId=${tokenId}`
const r = await fetch(url)
const data = await r.json()
return [data.asset[0], data.collection]
......
......@@ -19,7 +19,7 @@ export const fetchSweep = async ({
rarityRange?: Record<string, unknown>
traits?: Trait[]
}): Promise<GenieAsset[]> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/assets`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/assets`
const payload: AssetPayload = {
filters: {
address: contractAddress.toLowerCase(),
......
import { TransactionsResponse } from '../../types'
export const fetchTransactions = async (payload: { sweep?: boolean }): Promise<TransactionsResponse[]> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/transactions`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/transactions`
const r = await fetch(url, {
method: 'POST',
......
......@@ -5,7 +5,7 @@ interface Listing extends ListingRow {
}
export const logListing = async (listings: ListingRow[], userAddress: string): Promise<boolean> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/logGenieList`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/logGenieList`
const listingsConsolidated: Listing[] = listings.map((el) => ({ ...el, marketplaces: [] }))
const marketplacesById: Record<string, ListingMarket[]> = {}
const listingsWithMarketsConsolidated = listingsConsolidated.reduce((uniqueListings, curr) => {
......
export const triggerPriceUpdatesForCollection = async (address: string) => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/collections/refresh`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/collections/refresh`
const r = await fetch(url, {
method: 'PUT',
headers: {
......
export const createLooksRareOrder = async (payload: any): Promise<boolean> => {
const url = `${process.env.REACT_APP_GENIE_API_URL}/createLooksRareOrder`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/createLooksRareOrder`
const res = await fetch(url, {
method: 'POST',
headers: {
......
......@@ -4,7 +4,7 @@ export const X2Y2_TRANSFER_CONTRACT = '0xf849de01b080adc3a814fabe1e2087475cf2e35
export const newX2Y2Order = async (payload: OrderPayload): Promise<boolean> => {
const body = JSON.stringify(payload)
const url = `${process.env.REACT_APP_GENIE_API_URL}/postX2Y2SellOrderWithApiKey`
const url = `${process.env.REACT_APP_GENIE_V3_API_URL}/postX2Y2SellOrderWithApiKey`
const ac = new AbortController()
const req = new Request(url, {
method: 'POST',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment