0

My instruction for creating permanent-delegate is

invoke(
        &initialize_permanent_delegate(
            &ctx.accounts.token_program.key(),
            &ctx.accounts.mint_account.key(),
            &ctx.accounts.authority.key(),
        )?,
        &[
            ctx.accounts.token_program.to_account_info(),
            ctx.accounts.mint_account.to_account_info(),
            ctx.accounts.authority.to_account_info(),
        ],
    )?;

and my account struct is

#[derive(Accounts)]
#[instruction(params: TokenParams)]
pub struct MintToken<'info> {
    /// CHECK: This is the token that we want to mint
    #[account(
        mut,
        seeds = [b"mint"],
        bump,
        mint::authority = authority,
        mint::freeze_authority = authority,
    )]
    pub mint_account: InterfaceAccount<'info, Mint>,

    /// CHECK: the authority of the mint account
    #[account(mut)]
    pub authority: Signer<'info>,

    #[account(address = Token2022::id())]
    pub token_program: Program<'info, Token2022>,
}

but getting Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x6 enter image description here

1 Answer 1

0

You must initialize the permanent delegate before initializing the mint.

The error that you see 0x6 corresponds to AlreadyInUse, which means that it's failing because the mint is already initialized.

You can see the error code at https://github.com/solana-labs/solana-program-library/blob/10d9c63d91bf736387bca8ba5503bf3b3cf425c8/token/program-2022/src/error.rs#L39

3
  • Ya I have resolved it, thanks
    – blackhorse
    Commented Jan 11 at 9:54
  • Please accept the answer if it's helpful so that others may find it in the future!
    – Jon C
    Commented Jan 11 at 11:13
  • accepted, thanks Jon
    – blackhorse
    Commented Jan 11 at 12: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.