How to mint multiple NFT token from Metaplex Candy Machine v2?

I am trying to mint multiple token (2 in my case) from one user click. I see in the metaplex JS library, there's one function called mintOneToken which allows us to mint one token at time. How can I implement the function which mints n token at one click of the user?

Upvotes: 0

Views: 1920

Answers (1)

Bek
Bek

Reputation: 313

that functionality is added in CMv2 cli repo, and looks:

if (index < NUMBER_OF_NFTS_TO_MINT - 1) {
        log.info('minting another token...');
        await mintToken(index + 1);
      }

this statement in the discord community by TonyBoyle.eth#0265 helped a lot to make sense of the problem

The mint multiple in the CLI just loops a single transaction it's technically not multiple mint in one transaction

you can add this to the onMint function in the Home.tsx and tweak the frontend accordingly.

Upvotes: 1

Related Questions