This is the error info:
Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete
at Connection.sendEncodedTransaction (node_modules/@solana/web3.js/src/connection.ts:4465:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Connection.sendRawTransaction (node_modules/@solana/web3.js/src/connection.ts:4424:20)
at sendAndConfirmRawTransaction (node_modules/@project-serum/anchor/src/provider.ts:284:21)
at AnchorProvider.sendAndConfirm (node_modules/@project-serum/anchor/src/provider.ts:144:14)
at Object.rpc [as claimVestment] (node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:29:16)
Could there be a problem with this:
token::transfer(
CpiContext::new_with_signer(
ctx.accounts.token_program.to_account_info(),
token::Transfer {
from: ctx.accounts.vested_tokens.to_account_info(),
to: ctx.accounts.beneficiary_token_account.to_account_info(),
authority: ctx.accounts.vested_tokens.to_account_info(),
},
&[&[
b"vested-tokens",
vestment.key().as_ref(), //probably the problem
&[*ctx.bumps.get("vested-tokens").unwrap()],
]],
),
*amount_to_claim,
)?;
vestment.amount_claimed = vestment.amount_claimed.checked_add(*amount_to_claim).unwrap();
if vestment.amount_vested-vestment.amount_claimed==0 {
vestment.is_active=false;
}
In tests, this is how I call this instruction:
const txClaim1 = await program.rpc.claimVestment({
accounts: {
ledger: ledger,
vestment: newVestment,
beneficiary: beneficiary.publicKey,
beneficiaryTokenAccount: beneficiaryTokenAccount,
vestedTokens: vestedTokens,
vestedTokensMint: tokenMint,
tokenProgram: TOKEN_PROGRAM_ID,
systemProgram: anchor.web3.SystemProgram.programId,
},
signers: [beneficiary],
});
await connection.confirmTransaction(txClaim1);
Any ideas?