diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b4de681..f928ffca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to the create-aptos-dapp tool will be captured in this file. # Unreleased +- Remove `uniqueHolders` from NFT minting dapp template due to inefficient indexer query + # 0.0.35 (2024-10-23) - Use Aptos Learn for create-aptos-dapp docs diff --git a/templates/nft-minting-dapp-template/frontend/hooks/useGetCollectionData.ts b/templates/nft-minting-dapp-template/frontend/hooks/useGetCollectionData.ts index 411b5f31..e393c087 100644 --- a/templates/nft-minting-dapp-template/frontend/hooks/useGetCollectionData.ts +++ b/templates/nft-minting-dapp-template/frontend/hooks/useGetCollectionData.ts @@ -48,7 +48,6 @@ interface MintQueryResult { interface MintData { maxSupply: number; totalMinted: number; - uniqueHolders: number; userMintBalance: number; collection: Collection; startDate: Date; @@ -90,13 +89,7 @@ export function useGetCollectionData(collection_address: string = COLLECTION_ADD cdn_image_uri } } - current_collection_ownership_v2_view_aggregate( - where: { collection_id: { _eq: $collection_id } } - ) { - aggregate { - count(distinct: true, columns: owner_address) - } - } + }`, }, }); @@ -105,12 +98,12 @@ export function useGetCollectionData(collection_address: string = COLLECTION_ADD if (!collection) return null; const mintStageRes = await getActiveOrNextMintStage({ collection_address }); + // Only return collection data if no mint stage is found if (mintStageRes.length === 0) { return { maxSupply: collection.max_supply ?? 0, totalMinted: collection.current_supply ?? 0, - uniqueHolders: res.current_collection_ownership_v2_view_aggregate.aggregate?.count ?? 0, userMintBalance: 0, collection, endDate: new Date(), @@ -134,7 +127,6 @@ export function useGetCollectionData(collection_address: string = COLLECTION_ADD return { maxSupply: collection.max_supply ?? 0, totalMinted: collection.current_supply ?? 0, - uniqueHolders: res.current_collection_ownership_v2_view_aggregate.aggregate?.count ?? 0, userMintBalance, collection, endDate, diff --git a/templates/nft-minting-dapp-template/frontend/pages/Mint/components/StatsSection.tsx b/templates/nft-minting-dapp-template/frontend/pages/Mint/components/StatsSection.tsx index 5ff5d17e..f385be6f 100644 --- a/templates/nft-minting-dapp-template/frontend/pages/Mint/components/StatsSection.tsx +++ b/templates/nft-minting-dapp-template/frontend/pages/Mint/components/StatsSection.tsx @@ -9,7 +9,7 @@ interface StatsSectionProps {} export const StatsSection: React.FC = () => { const { data } = useGetCollectionData(); - const { maxSupply = 0, totalMinted = 0, uniqueHolders = 0 } = data ?? {}; + const { maxSupply = 0, totalMinted = 0 } = data ?? {}; return (
@@ -17,9 +17,8 @@ export const StatsSection: React.FC = () => { {[ { title: "Created NFTs", value: maxSupply }, { title: "Total Minted", value: totalMinted }, - { title: "Unique Holders", value: uniqueHolders }, ].map(({ title, value }) => ( -
  • +
  • {title}

    {clampNumber(value)}