1

I've downloaded and built the token 2022 program, and added to the Anchor.toml like this:

[[test.genesis]]
address = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
program = "spl_token_2022.so"

However, I'm now getting strange errors:

Instruction references an unknown account [xyz pubkey]...
An account required by the instruction is missing

and the account listed a) doesn't match up with anything I'm passing, and b) seems to change on each run.

Any thoughts? Thanks

1
  • also tried this way, same issue : solana program dump --url mainnet-beta TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA spl_token_2022.so
    – joebuild
    Commented May 7, 2023 at 20:55

1 Answer 1

6

The issue ended up being init for an associated token account. As of 0.27.0 init uses the regular Token program, so it was trying to create a regular Token ATA when it needed a Token2022 ATA. There is a token_program constraint coming in 0.28.0. As a workaround for now, this can be done by created the ATA as a preInstruction (not relying on init) using createAssociatedTokenAccountIdempotent. Then, all you need are constraints on the ATA being passed in, like:

    #[account(
        constraint = ata.owner == some_owner.key(),
        constraint = ata.mint == some_mint.key()
    )]

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.