This PR adds collection NFT count and floor price to queries that return a collection NFT. It was necessary to do a major refactor of Nft to make this possible, as CollectionNft was a limited copy of Nft.
Note that any potential shortcuts suggested for this PR should be considered in relation to its effect on Holaplex.com and marketplaces repo queries. Some side effects in Holaplex.com do not manifest until you run both yarn generate:graphql and try out the app with yarn dev
Note: This should NOT be merged and deployed without an accompanying PR for holaplex.com (here), as it will break.
Marketplaces looks to be safe - only requirement is changing on Nft to on Collection for requests that return Collection, which marketplaces are not using.
Start in objects/nft.tsx
Main Changes
Added a new table collection_stats that will keep track of collection size and floor price (2022-07-22-160735_add_collection_stats_table/*, 2022-07-22-161104_collection_stats_backfill/*, schema.rs). Floor price and collection size are updated by their own triggers when NFTs are added and listings updated (2022-07-22-161901_update_nft_counts_on_collection_stats_hook/*, 2022-07-22-171755_update_floor_price_on_collection_stats_hook/*)
Added data loaders for floor price and collection size (dataloaders/collection.rs, context.rs) and use those for Collections (objects/nft.rs)
Refactored CollectionNft to Collection and move the NFT to be a field in the Collection object (rather than first element of tuple) (objects/nft.rs)
This PR adds collection NFT count and floor price to queries that return a collection NFT. It was necessary to do a major refactor of
Nft
to make this possible, asCollectionNft
was a limited copy ofNft
.Note that any potential shortcuts suggested for this PR should be considered in relation to its effect on Holaplex.com and marketplaces repo queries. Some side effects in Holaplex.com do not manifest until you run both
yarn generate:graphql
and try out the app withyarn dev
Note: This should NOT be merged and deployed without an accompanying PR for holaplex.com (here), as it will break.
Marketplaces looks to be safe - only requirement is changing
on Nft
toon Collection
for requests that returnCollection
, which marketplaces are not using.Start in
objects/nft.tsx
Main Changes
collection_stats
that will keep track of collection size and floor price (2022-07-22-160735_add_collection_stats_table/*
,2022-07-22-161104_collection_stats_backfill/*
,schema.rs
). Floor price and collection size are updated by their own triggers when NFTs are added and listings updated (2022-07-22-161901_update_nft_counts_on_collection_stats_hook/*
,2022-07-22-171755_update_floor_price_on_collection_stats_hook/*
)dataloaders/collection.rs
,context.rs
) and use those forCollection
s (objects/nft.rs
)CollectionNft
toCollection
and move the NFT to be a field in theCollection
object (rather than first element of tuple) (objects/nft.rs
)closes #604