Hi everyone! I’m working with a Candy Machine UI from Metaplex and I’m having trouble implementing two features. First, I need to add a counter that shows how many NFTs are left to mint. Second, I want to display all the minted NFTs in a separate section on my interface.
I’ve looked through different GitHub repositories to see how others handle this, but each project seems to fetch the data in completely different ways. This makes it really confusing for someone like me who is still learning.
Does anyone know if there’s documentation that explains how to get this information from the Candy Machine? Or maybe someone can point me to a simple example that shows how to query the remaining supply and display the minted tokens?
Any help would be really appreciated. Thanks!
Oh man, I feel you! Candy Machine v3 is a real headache when you’re piecing together scattered examples.
The technical stuff others mentioned is solid, but I’m curious - are you building from scratch or forking an existing UI? Sometimes it’s way easier to find a working example and reverse engineer it.
What’s your Solana dev experience like? If you’re newer, consider using Metaplex’s Candy Machine UI as a starting point. It’s got most of this functionality built in.
When you say “all the minted NFTs” - you mean like a gallery of everything minted from your specific candy machine? That could get heavy depending on collection size. You thinking pagination or just thumbnails?
Have you tried the Metaplex Discord? Devs are pretty active there and you’ll get real-time help instead of hunting through docs. Quick conversation beats hours of documentation digging.
Indeed, Candy Machine v3 has introduced various changes that can be confusing for developers. To obtain the remaining NFTs, access the candyMachine account data—look for the itemsRedeemed and data.itemsAvailable properties. By utilizing the @metaplex-foundation/js SDK, you can fetch this account data and simply calculate the remaining supply by subtracting the itemsRedeemed from itemsAvailable. For the minted NFTs, it’s advisable to query the blockchain for NFTs created by the candy machine. Avoid querying all NFTs as it’s too resource-intensive; instead, consider using the Digital Asset Standard API or services like Helius for efficient filtering. The Metaplex documentation does touch on these methods, though it can be somewhat scattered.
you should check out the candy machine sdk. the fetchCandyMachine method has the itemsRemaining field, which should help ya. for the minted NFTs, you can either use the Metaplex JS sdk or just do an RPC call to get the nft metadata from the collection address.