larry 8
larry 8

Reputation: 3

Adding NFT to certified collection using the metaplex.nfts().create() function

I am having issues verifying the collection when I mint an NFT. I am using the metaplex.nfts().create() function and I am positive the metaplex.indentity() has update authority of the collection NFT. I get the following error.

 MetaplexError: TokenMetadataProgram > Cannont Verify Collection in this Instruction
>> Source: Program > TokenMetadataProgram [metaqbxx...x1s]
>> Problem: The program [TokenMetadataProgram] at address [meta...x1s] raised an error of code [74] that translates to "Cannont Verify Collection in this Instruction".
>> Solution: Check the error message provided by the program.
Caused By: CollectionCannotBeVerifiedInThisInstruction: Cannont Verify Collection in this Instruction

I also know that everything else involved with the minting of the NFT is fine because when I add the collection with verified: 0 it works fine.

Am I able to add an NFT to an existing certified collection using the metaplex.nfts().create() function? If that is not allowed, what is the best way to do so immediately after minting?

Full stack trace:

at RpcClient.parseProgramError (file:///.../node_modules/@metaplex-foundation/js/dist/esm/plugins/rpcModule/RpcClient.mjs:206:28)
      at RpcClient.sendTransaction (file:///.../node_modules/@metaplex-foundation/js/dist/esm/plugins/rpcModule/RpcClient.mjs:48:18)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async RpcClient.sendAndConfirmTransaction (file:///.../node_modules/@metaplex-foundation/js/dist/esm/plugins/rpcModule/RpcClient.mjs:69:23)
      at async TransactionBuilder.sendAndConfirm (file:///.../node_modules/@metaplex-foundation/js/dist/esm/utils/TransactionBuilder.mjs:131:22)
      at async file:///.../node_modules/@metaplex-foundation/js/dist/esm/utils/Task.mjs:58:23
      at async Disposable.run (file:///.../node_modules/@metaplex-foundation/js/dist/esm/utils/Disposable.mjs:22:14)
      at async Task.callback (file:///.../node_modules/@metaplex-foundation/js/dist/esm/plugins/nftModule/NftClient.mjs:48:22)
      at async file:///.../node_modules/@metaplex-foundation/js/dist/esm/utils/Task.mjs:58:23
      at async Disposable.run (file:///.../node_modules/@metaplex-foundation/js/dist/esm/utils/Disposable.mjs:22:14)
      at async mintNft (file:///.../src/mint/mint_lib.js:46:29)
      at async mint (file:///.../src/mint/mint_lib.js:71:12)
      at async Context.<anonymous> (file:///.../test/mint-test.js:27:20)

Upvotes: 0

Views: 859

Answers (1)

WrathionTBP
WrathionTBP

Reputation: 857

The problem is that you try to set the collection as verified true without using a verify_collection instruction. This is not possible since the mpl_token_metadata program checks if someone tries to verify a collection without using that type of instruction, check the onchain code here.

So the actual way of doing this is create the NFT with the collection not verified (verified: 0) and then use createSetAndVerifyCollectionInstruction providing the respective accounts.

Upvotes: 1

Related Questions