Commit 8d36edf2 authored by Charles Bachmeier's avatar Charles Bachmeier Committed by GitHub

chore: remove no longer used anayltics query (#6165)

* chore: remove no longer used anayltics query

* Remove from index

---------
Co-authored-by: default avatarCharles Bachmeier <charlie@genie.xyz>
parent 0f8d3fa5
export * from './ActivityFetcher'
export * from './CollectionPreviewFetcher'
export * from './logListing'
export * from './RouteFetcher'
export * from './SearchCollectionsFetcher'
export * from './TrendingCollectionsFetcher'
import { ListingMarket, ListingRow } from 'nft/types'
interface Listing extends ListingRow {
marketplaces: ListingMarket[]
}
export const logListing = async (listings: ListingRow[], userAddress: string): Promise<boolean> => {
const url = `${process.env.REACT_APP_TEMP_API_URL}/nft/logGenieList`
const listingsConsolidated: Listing[] = listings.map((el) => ({ ...el, marketplaces: [] }))
const marketplacesById: Record<string, ListingMarket[]> = {}
const listingsWithMarketsConsolidated = listingsConsolidated.reduce((uniqueListings, curr) => {
const key = `${curr.asset.asset_contract.address}-${curr.asset.tokenId}`
if (marketplacesById[key]) {
marketplacesById[key].push(curr.marketplace)
} else {
marketplacesById[key] = [curr.marketplace]
}
if (!uniqueListings.some((listing) => `${listing.asset.asset_contract.address}-${listing.asset.tokenId}` === key)) {
curr.marketplaces = marketplacesById[key]
uniqueListings.push(curr)
}
return uniqueListings
}, [] as Listing[])
const payload = {
listings: listingsWithMarketsConsolidated,
userAddress,
}
const r = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
})
return r.status === 200
}
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