File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 11"use client" ;
22
33import { Skeleton , Stat , StatLabel , StatNumber } from "@chakra-ui/react" ;
4+ import { useMemo } from "react" ;
45import type { ThirdwebContract } from "thirdweb" ;
5- import { nextTokenIdToMint , totalSupply } from "thirdweb/extensions/erc721" ;
6+ import {
7+ nextTokenIdToMint ,
8+ startTokenId ,
9+ totalSupply ,
10+ } from "thirdweb/extensions/erc721" ;
611import { useReadContract } from "thirdweb/react" ;
712import { Card } from "tw-components" ;
813
@@ -18,9 +23,17 @@ export const SupplyCards: React.FC<SupplyCardsProps> = ({ contract }) => {
1823 contract,
1924 } ) ;
2025
21- const unclaimedSupply = (
22- ( totalSupplyQuery ?. data || 0n ) - ( claimedSupplyQuery ?. data || 0n )
23- ) . toString ( ) ;
26+ const startTokenIdQuery = useReadContract ( startTokenId , { contract } ) ;
27+
28+ const unclaimedSupply = useMemo (
29+ ( ) =>
30+ (
31+ ( totalSupplyQuery ?. data || 0n ) -
32+ ( claimedSupplyQuery ?. data || 0n ) -
33+ ( startTokenIdQuery . data || 0n )
34+ ) . toString ( ) ,
35+ [ totalSupplyQuery . data , claimedSupplyQuery . data , startTokenIdQuery . data ] ,
36+ ) ;
2437
2538 return (
2639 < div className = "flex flex-col gap-3 md:flex-row md:gap-6" >
You can’t perform that action at this time.
0 commit comments