Commit 0f8d3fa5 authored by Charles Bachmeier's avatar Charles Bachmeier Committed by GitHub

fix: add more null checks for trending collections gql query (#6164)

add more null checks for trending collections gql query
Co-authored-by: default avatarCharles Bachmeier <charlie@genie.xyz>
parent 5f64149f
...@@ -68,20 +68,20 @@ export function useTrendingCollections(size: number, timePeriod: HistoryDuration ...@@ -68,20 +68,20 @@ export function useTrendingCollections(size: number, timePeriod: HistoryDuration
const collection = edge?.node const collection = edge?.node
return { return {
name: collection.name, name: collection.name,
address: collection.nftContracts?.[0].address, address: collection.nftContracts?.[0]?.address,
imageUrl: collection.image?.url, imageUrl: collection.image?.url,
bannerImageUrl: collection.bannerImage?.url, bannerImageUrl: collection.bannerImage?.url,
isVerified: collection.isVerified, isVerified: collection.isVerified,
volume: collection.markets?.[0].volume?.value, volume: collection.markets?.[0]?.volume?.value,
volumeChange: collection.markets?.[0].volumePercentChange?.value, volumeChange: collection.markets?.[0]?.volumePercentChange?.value,
floor: collection.markets?.[0].floorPrice?.value, floor: collection.markets?.[0]?.floorPrice?.value,
floorChange: collection.markets?.[0].floorPricePercentChange?.value, floorChange: collection.markets?.[0]?.floorPricePercentChange?.value,
marketCap: collection.markets?.[0].totalVolume?.value, marketCap: collection.markets?.[0]?.totalVolume?.value,
percentListed: percentListed:
(collection.markets?.[0].listings?.value ?? 0) / (collection.nftContracts?.[0].totalSupply ?? 1), (collection.markets?.[0]?.listings?.value ?? 0) / (collection.nftContracts?.[0]?.totalSupply ?? 1),
owners: collection.markets?.[0].owners, owners: collection.markets?.[0]?.owners,
sales: collection.markets?.[0].sales?.value, sales: collection.markets?.[0]?.sales?.value,
totalSupply: collection.nftContracts?.[0].totalSupply, totalSupply: collection.nftContracts?.[0]?.totalSupply,
} }
}), }),
[data?.topCollections?.edges] [data?.topCollections?.edges]
......
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