0

I'm using this code to mint

let cpi_accounts = MintTo {
            mint: ctx.accounts.mint.to_account_info(),
            to: ctx.accounts.ata.to_account_info(),
            authority: ctx.accounts.owner.to_account_info(),
        };
        let cpi_program = ctx.accounts.token_program.to_account_info();

        let cpi_ctx = CpiContext::new(cpi_program, cpi_accounts);

        token::mint_to(cpi_ctx, 1)?;

and i'm getting this log

Program invoked: Token Program
  > Program logged: "Instruction: MintTo"
  > Program logged: "Error: InvalidAccountData"
  > Program consumed: 1261 of 190597 compute units
  > Program returned error: "invalid account data for instruction"
> Program consumed: 10664 of 200000 compute units

previously it was working, but it suddenly stopped working

1
  • 1
    Are you sure you are passing the appropriate token account? Commented Nov 18, 2022 at 0:36

1 Answer 1

1

InvalidAccountData can unfortunately mean many things, but most likely the mint account hasn't been created / initialized, or the token account hasn't been created / initialized.

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.