2

I am trying to call the MintV2 candy machine instruction, but I am getting the error below originating from the Guard program.

Here is the code first


async function createCandyMachine() {
    const candyMachine = generateSigner(umi);//! ONLY USE WHEN CREATING NEW CANDY MACHINE
    let tx = await create(umi, {
        candyMachine,
        collectionMint: collectionMint,
        collectionUpdateAuthority: umi.identity,
        tokenStandard: TokenStandard.NonFungible,
        sellerFeeBasisPoints: percentAmount(9.99, 2), // 9.99%
        itemsAvailable: 50,
        creators: [
            {
                address: umi.identity.publicKey,
                verified: true,
                percentageShare: 100,
            },
        ],
        configLineSettings: some({
            prefixName: '',
            nameLength: 32,
            prefixUri: '',
            uriLength: 200,
            isSequential: false,
        }),
    });

    tx.sendAndConfirm(umi);
}

async function mintFromCandyMachine() {
    const candyMachine = await fetchCandyMachine(umi, publicKey("ErsrkFwzmCJSBfWts4PXdcCKmVUXwKy5sjrwFfRZChPR"));

    // 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.publicKey,
            collectionMint: collectionMint,
            collectionUpdateAuthority: umi.identity.publicKey,
        }))
        .sendAndConfirm(umi)
}

and 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 log: AnchorError thrown in program/src/instructions/mint_v2.rs:219. Error Code: NotFullyLoaded. Error Number: 6020. Error Message: Not all config lines were added to the candy machine.',
      'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR consumed 29254 of 752695 compute units',
      'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR failed: custom program error: 0x1784',
      'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g consumed 76559 of 800000 compute units',
      'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g failed: custom program error: 0x1784'
    ]
  },
  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 log: AnchorError thrown in program/src/instructions/mint_v2.rs:219. Error Code: NotFullyLoaded. Error Number: 6020. Error Message: Not all config lines were added to the candy machine.',
    'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR consumed 29254 of 752695 compute units',
    'Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR failed: custom program error: 0x1784',
    'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g consumed 76559 of 800000 compute units',
    'Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g failed: custom program error: 0x1784'
  ],
  code: 6020
}

1 Answer 1

3

Since you have itemsAvailable: 50, you need to add 50 items (config lines) to the candy machine before you can mint.

You might have to make multiple calls to addConfigLines() if all of them won't fix in a single tx.

2
  • It seems that there is no way of avoiding the itemsAvailable: 50, field. Is there a way I can have it and not encounter the error?
    – Jimii
    Sep 17, 2023 at 19:57
  • You have to change 50 to the number of nfts you want in the candy machine. If you want 3 nfts, set that to 3. Sep 18, 2023 at 13:39

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.