metaplex-foundation / js-deprecated

Deprecated Metaplex JavaScript SDK
https://metaplex-foundation.github.io/js/
MIT License
127 stars 77 forks source link

Unable to Mint a Master Edition NFT with supply of 0 #184

Open Kenny4444 opened 2 years ago

Kenny4444 commented 2 years ago

In trying to create an NFT from mintNFT I found that there is not way to create a NFT with a supply of 0.

Steps to Repro: Call Mint Nft with a supply of 0. Notice that the maxSupply is set to Null or Undefined

Expected Behavior: The nft is created with maxSupply of 0 so that there cannot be any limited edition prints on it.

There seems to be an issue on line 98 of mintNFT.ts in the creation of a new CreateMasterEdition:

const masterEditionTx = new CreateMasterEdition( { feePayer: wallet.publicKey }, { edition: editionPDA, metadata: metadataPDA, updateAuthority: wallet.publicKey, mint: mint.publicKey, mintAuthority: wallet.publicKey, maxSupply: maxSupply || maxSupply === 0 ? new BN(maxSupply) : null, }, ); the line: maxSupply: maxSupply || maxSupply === 0 ? new BN(maxSupply) : null, will not allow you to set the maxSupply to 0.

should probably be

maxSupply: maxSupply || maxSupply >= 0 ? new BN(maxSupply) : null,