wonka-labs/wonka-js

Error in mint function when whitelistSettings is set

Opened this issue · 0 comments

I've been having no problems with Candy Machine configs without whitelistMintSettings, but with the following config, I always get an error (despite having isPresale = false). I was able to successfully mint outside of using Wonka, so I don't think there's something wrong with the config itself.

Candy Machine state:

{
[0]   itemsAvailable: 100,
[0]   itemsRedeemed: 1,
[0]   itemsRemaining: 99,
[0]   isSoldOut: false,
[0]   isActive: false,
[0]   isPresale: false,
[0]   isWhitelistOnly: false,
[0]   goLiveDate: <BN: 61c65f00>,
[0]   treasury: PublicKey {
[0]     _bn: <BN: d4f379958bfeb33c56e5237ec468b219433ea67e01113137b2577cac4b9091e9>
[0]   },
[0]   tokenMint: null,
[0]   gatekeeper: null,
[0]   endSettings: null,
[0]   whitelistMintSettings: {
[0]     mode: { burnEveryTime: {} },
[0]     mint: PublicKey {
[0]       _bn: <BN: 44064c130117785053dc01351b6411c5b9b13fad6d24b1a460b4f3f69f78c9e>
[0]     },
[0]     presale: true,
[0]     discountPrice: <BN: 7a1200>
[0]   },
[0]   hiddenSettings: null,
[0]   price: <BN: 989680>
[0] }

Error:

[0] error is  SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 4: Program failed to complete
[0]     at Connection.sendEncodedTransaction (/Users/edwardsun/Sites/paper-web/node_modules/@solana/web3.js/lib/index.cjs.js:6820:13)
[0]     at runMicrotasks (<anonymous>)
[0]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[0]     at async Connection.sendRawTransaction (/Users/edwardsun/Sites/paper-web/node_modules/@solana/web3.js/lib/index.cjs.js:6775:20)
[0]     at async sendAndConfirmRawTransaction (/Users/edwardsun/Sites/paper-web/node_modules/@solana/web3.js/lib/index.cjs.js:9098:21)
[0]     at async Provider.send (/Users/edwardsun/Sites/paper-web/node_modules/@project-serum/anchor/dist/cjs/provider.js:85:22) {
[0]   logs: [
[0]     'Program 11111111111111111111111111111111 invoke [1]',
[0]     'Program 11111111111111111111111111111111 success',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
[0]     'Program log: Instruction: InitializeMint',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2457 of 200000 compute units',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
[0]     'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]',
[0]     'Program log: Transfer 2039280 lamports to the associated token account',
[0]     'Program 11111111111111111111111111111111 invoke [2]',
[0]     'Program 11111111111111111111111111111111 success',
[0]     'Program log: Allocate space for the associated token account',
[0]     'Program 11111111111111111111111111111111 invoke [2]',
[0]     'Program 11111111111111111111111111111111 success',
[0]     'Program log: Assign the associated token account to the SPL Token program',
[0]     'Program 11111111111111111111111111111111 invoke [2]',
[0]     'Program 11111111111111111111111111111111 success',
[0]     'Program log: Initialize the associated token account',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]',
[0]     'Program log: Instruction: InitializeAccount',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3297 of 179576 compute units',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
[0]     'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 24370 of 200000 compute units',
[0]     'Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
[0]     'Program log: Instruction: MintTo',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2611 of 200000 compute units',
[0]     'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success',
[0]     'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ invoke [1]',
[0]     'Program log: Instruction: MintNft',
[0]     'Program log: recent_blockhashes is deprecated and will break soon',
[0]     "Program log: panicked at 'index out of bounds: the len is 0 but the index is 0', src/lib.rs:159:44",
[0]     'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ consumed 36109 of 200000 compute units',
[0]     'Program failed to complete: BPF program panicked',
[0]     'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ failed: Program failed to complete'
[0]   ]
[0] }