1

I am trying to mint a pNFT collection with candy machine using the umi library.

But my code is failing when trying to insert and mint my candy machine items.

async function mintPnftFromCandyMachine() {
    const candyMachine = await fetchCandyMachine(
        umi,
        publicKey("9i7LhTXr5v8rcAFL8xU7W51EHFiDZXnk1R8tbJ4XGQU7")
    );
    // console.log('candy machine', candyMachine);

    // add items to our candy machine
    await addConfigLines(umi, {
        candyMachine: candyMachine.publicKey,
        index: 0,
        configLines: [
            {
                name: "Kobeni 1",
                uri: "https://raw.githubusercontent.com/687c/solana-nft-native-client/main/metadata.json",
            },
            {
                name: "Kobeni 2",
                uri: "https://raw.githubusercontent.com/687c/solana-nft-native-client/main/metadata.json",
            },
            {
                name: "Kobeni 3",
                uri: "https://raw.githubusercontent.com/687c/solana-nft-native-client/main/metadata.json",
            },
        ],
    }).sendAndConfirm(umi);

    await transactionBuilder()
        .add(setComputeUnitLimit(umi, { units: 800_000 }))
        .add(
            mintV2(umi, {
                candyMachine: candyMachine.publicKey,
                nftMint: nftMint,
                collectionMint: pNFTCollectionMint,
                tokenRecord: findTokenRecordPda(umi, {
                    mint: pNFTCollectionMint,
                    token: publicKey(
                        "CZBE19tFNU5f9hfSuyLKwR5zhz4c4yLA7DhWMtzC4xDH"
                    ),
                }),
                collectionUpdateAuthority: umi.identity.publicKey,
            })
        )
        .sendAndConfirm(umi);
}

Here are the error logs.

    logs: [
      'Program ComputeBudget111111111111111111111111111111 invoke [1]',
      'Program ComputeBudget111111111111111111111111111111 success',
      'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g invoke [1]',
      'Program log: Instruction: MintV2',
      'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR invoke [2]',
      'Program log: Instruction: MintV2',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [3]',
      'Program log: IX: Create',
      'Program 11111111111111111111111111111111 invoke [4]',
      'Program 11111111111111111111111111111111 success',
      'Program log: Init mint',
      'Program 11111111111111111111111111111111 invoke [4]',
      'Program 11111111111111111111111111111111 success',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]',
      'Program log: Instruction: InitializeMint2',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2828 of 684999 compute units',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
      'Program log: Allocate space for the account',
      'Program 11111111111111111111111111111111 invoke [4]',
      'Program 11111111111111111111111111111111 success',
      'Program log: Assign the account to the owning program',
      'Program 11111111111111111111111111111111 invoke [4]',
      'Program 11111111111111111111111111111111 success',
      'Program log: Transfer 2853600 lamports to the new account',
      'Program 11111111111111111111111111111111 invoke [4]',
      'Program 11111111111111111111111111111111 success',
      'Program log: Allocate space for the account',
      'Program 11111111111111111111111111111111 invoke [4]',
      'Program 11111111111111111111111111111111 success',
      'Program log: Assign the account to the owning program',
      'Program 11111111111111111111111111111111 invoke [4]',
      'Program 11111111111111111111111111111111 success',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]',
      'Program log: Instruction: SetAuthority',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3090 of 618790 compute units',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]',
      'Program log: Instruction: SetAuthority',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3250 of 612455 compute units',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 104873 of 705451 compute units',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [3]',
      'Program log: IX: Mint',
      'Program log: Init ATA',
      'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [4]',
      'Program log: Create',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]',
      'Program log: Instruction: GetAccountDataSize',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1622 of 555953 compute units',
      'Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
      'Program 11111111111111111111111111111111 invoke [5]',
      'Program 11111111111111111111111111111111 success',
      'Program log: Initialize the associated token account',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]',
      'Program log: Instruction: InitializeImmutableOwner',
      'Program log: Please upgrade to SPL Token 2022 for immutable owner support',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 549313 compute units',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]',
      'Program log: Instruction: InitializeAccount3',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4241 of 545431 compute units',
      'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
      'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 20443 of 561350 compute units',
      'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success',
      'Program log: Public key does not match expected value',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 54097 of 588547 compute units',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x9a',
      'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR consumed 217490 of 751940 compute units',
      'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR failed: custom program error: 0x9a',
      'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g consumed 265400 of 799850 compute units',
      'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g failed: custom program error: 0x9a'
    ]
  },
  program: {
    name: 'mplCandyGuard',
    publicKey: 'Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g',
    getErrorFromCode: [Function: getErrorFromCode],
    getErrorFromName: [Function: getErrorFromName],
    isOnCluster: [Function: isOnCluster],
    availableGuards: [
      'botTax',           'solPayment',
      'tokenPayment',     'startDate',
      'thirdPartySigner', 'tokenGate',
      'gatekeeper',       'endDate',
      'allowList',        'mintLimit',
      'nftPayment',       'redeemedAmount',
      'addressGate',      'nftGate',
      'nftBurn',          'tokenBurn',
      'freezeSolPayment', 'freezeTokenPayment',
      'programGate',      'allocation',
      'token2022Payment'
    ]
  },
  logs: [
    'Program ComputeBudget111111111111111111111111111111 invoke [1]',
    'Program ComputeBudget111111111111111111111111111111 success',
    'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g invoke [1]',
    'Program log: Instruction: MintV2',
    'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR invoke [2]',
    'Program log: Instruction: MintV2',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [3]',
    'Program log: IX: Create',
    'Program 11111111111111111111111111111111 invoke [4]',
    'Program 11111111111111111111111111111111 success',
    'Program log: Init mint',
    'Program 11111111111111111111111111111111 invoke [4]',
    'Program 11111111111111111111111111111111 success',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]',
    'Program log: Instruction: InitializeMint2',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2828 of 684999 compute units',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
    'Program log: Allocate space for the account',
    'Program 11111111111111111111111111111111 invoke [4]',
    'Program 11111111111111111111111111111111 success',
    'Program log: Assign the account to the owning program',
    'Program 11111111111111111111111111111111 invoke [4]',
    'Program 11111111111111111111111111111111 success',
    'Program log: Transfer 2853600 lamports to the new account',
    'Program 11111111111111111111111111111111 invoke [4]',
    'Program 11111111111111111111111111111111 success',
    'Program log: Allocate space for the account',
    'Program 11111111111111111111111111111111 invoke [4]',
    'Program 11111111111111111111111111111111 success',
    'Program log: Assign the account to the owning program',
    'Program 11111111111111111111111111111111 invoke [4]',
    'Program 11111111111111111111111111111111 success',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]',
    'Program log: Instruction: SetAuthority',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3090 of 618790 compute units',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]',
    'Program log: Instruction: SetAuthority',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3250 of 612455 compute units',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 104873 of 705451 compute units',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [3]',
    'Program log: IX: Mint',
    'Program log: Init ATA',
    'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [4]',
    'Program log: Create',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]',
    'Program log: Instruction: GetAccountDataSize',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1622 of 555953 compute units',
    'Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
    'Program 11111111111111111111111111111111 invoke [5]',
    'Program 11111111111111111111111111111111 success',
    'Program log: Initialize the associated token account',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]',
    'Program log: Instruction: InitializeImmutableOwner',
    'Program log: Please upgrade to SPL Token 2022 for immutable owner support',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 549313 compute units',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]',
    'Program log: Instruction: InitializeAccount3',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4241 of 545431 compute units',
    'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
    'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 20443 of 561350 compute units',
    'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success',
    'Program log: Public key does not match expected value',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 54097 of 588547 compute units',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: custom program error: 0x9a',
    'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR consumed 217490 of 751940 compute units',
    'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR failed: custom program error: 0x9a',
    'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g consumed 265400 of 799850 compute units',
    'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g failed: custom program error: 0x9a'
  ]
}

1 Answer 1

1

Unfortunately, the Public key does not match expected value error is burried in nested CPI calls and could refer to just about any account.

However, looking at your code snippet, I can see you're not explicitly setting the tokenStandard argument which helps set other default values. You can set it using the candyMachine.tokenStandard attribute like so:

mintV2(umi, {
  tokenStandard: candyMachine.tokenStandard,
  // ...
})

If you want to mint a pNFT (e.g. for royalty enforcement) and have your Candy Machine set up accordingly you will have to add the tokenStandard field. By default NonFungible is used. If you fetched the Candy Machine before you could use candyMachine.tokenStandard, [...].
Metaplex documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.