I am having ParsedProgramError whlie mint programmable NFT

114 views Asked by At

I am using below code to mint pNFT on Solana using Metaplex

const transactionBuilder = await METAPLEX
      .nfts()
      .builders()
      .create({
        uri: metadataUri,
        name: name,
        sellerFeeBasisPoints: sellerFee,
        symbol: symbol,
        creators: creators,
        isMutable: true,
        isCollection: false,
        tokenStandard: TokenStandard.ProgrammableNonFungible,
        ruleSet: null
      });

 let { signature, confirmResponse } = await METAPLEX.rpc().sendAndConfirmTransaction(transactionBuilder, { commitment: 'finalized' });

I have error in second line METAPLEX.rpc().sendAndConfirmTransaction().

Below is my error log

ParsedProgramError: The program [TokenMetadataProgram] at address [metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s] raised an error of code [1] that translates to "".

How to fix it?

1

There are 1 answers

0
Alchemist On BEST ANSWER

The SDK I was using has been deprecated. So I switched to new JS SDK. Below is the code I used for this.

const mintpNFT = async ({ data, uri }) => {
  const tx = await transactionBuilder()
    .add(
      createV1(umi, {
        mint: mint,
        uri,
        name: data.imgName,
        symbol: data.symbol,
        isCollection: false,
        sellerFeeBasisPoints: createAmount(data.sellerFeeBasisPoints, "%", 2),
        tokenStandard: TokenStandard.ProgrammableNonFungible,
        collection: {
          verified: false,
          key: data.collectionNFT,
        },
      })
    )
    .add(
      mintV1(umi, {
        mint: mint.publicKey,
        authority: umi.identity,
        tokenOwner: keypair.publicKey,
        tokenStandard: TokenStandard.ProgrammableNonFungible,
      })
    )
    .sendAndConfirm(umi, { send: { commitment: "finalized" } });
  const metadataAccount = findMetadataPda(umi, { mint: mint.publicKey })[0];
  await verifyCollectionV1(umi, {
    metadata: metadataAccount,
    collectionMint: publicKey(data.collectionNFT),
    authority: umi.identity,
  }).sendAndConfirm(umi, { send: { skipPreflight: true } });
  console.log("New NFT minted", mint.publicKey);
};

This is working fine.

You can check the documentatio here.