metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!

Home Page:https://metaplex.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I am having `ParsedProgramError` whlie mint programmable NFT

alchemist0803 opened this issue · comments

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?
Thanks

The JS SDK I was tried using is deprecated.
Below is updated code.

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);
};