Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An account required by the instruction is missing #3494

Open
cxp-13 opened this issue Jan 16, 2025 · 0 comments
Open

An account required by the instruction is missing #3494

cxp-13 opened this issue Jan 16, 2025 · 0 comments

Comments

@cxp-13
Copy link

cxp-13 commented Jan 16, 2025

My accounts:

#[derive(Accounts)]
pub struct CreateChallenge<'info> {
    #[account(
        mut,
        mint::authority = authority,
        mint::decimals = CHALLENGE_MINT_DECIMALS
    )]
    pub mint: Box<InterfaceAccount<'info, Mint>>,
    /// CHECK:
    #[account(seeds = [MINT_AUTHORITY_SEED.as_bytes()], bump)]
    pub authority: UncheckedAccount<'info>,
    #[account(seeds = [CONFIG_SEED.as_bytes()], bump = config.bump)]
    pub config: Box<Account<'info, Config>>,
    #[account(
        init,
        payer = payer,
        space = DISCRIMINATE_SIZE + Challenge::INIT_SPACE,
        seeds = [CHALLENGE_SEED.as_bytes(), mint.key().as_ref()],
        bump
    )]
    pub challenge: Box<Account<'info, Challenge>>,
    #[account(
        init,
        payer = payer,
        associated_token::authority = challenge,
        associated_token::mint = mint,
        token::token_program = token_program
    )]
    pub challenge_vault: Box<InterfaceAccount<'info, TokenAccount>>,
    /// CHECK:
    // #[account(
    //     mut,
    //     seeds = [
    //         METADATA_SEED.as_bytes(),
    //         metadata_program.key().as_ref(),
    //         mint.key().as_ref(),
    //     ],
    //     bump
    // )]
    // pub metadata: UncheckedAccount<'info>,
    #[account(
        mut,
        associated_token::mint = mint,           
        associated_token::authority = payer
    )]
    pub payer_token_account: Box<InterfaceAccount<'info, TokenAccount>>,
    #[account(mut)]
    pub payer: Signer<'info>,
    // pub metadata_program: Program<'info, MetadataProgram>,
    pub token_program: Program<'info, Token>,
    pub associated_token_program: Program<'info, AssociatedToken>,
    pub system_program: Program<'info, System>,
}

test code:

await program.methods
      .createChallenge(TIME_OUT_DURATION, tokenMetaData)
      .accounts({
        mint: challengeMintAccount,
        authority: mintAuthority,
        config: configAccount,
        challenge: challengeAccount,
        challengeVault: challengeVaultAccount,
        // metadata: metadataAccount,
        payerTokenAccount: userATokenAccount,
        payer: userA.publicKey,
        // metadataProgram: metadataProgram.publicKey,
        tokenProgram: TOKEN_PROGRAM_ID,
        associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
        systemProgram: SYSTEM_PROGRAM_ID,
      })
      .signers([userA])
      .rpc();

I'm sure I have pass all of the accounts the instruction need.
but get error

  "Instruction references an unknown account HdoBAJczgc5KWKdkgXubVxbXwMUVicLtBbXxW1CdvpXB",
 "Program EnVjT6csfecAgtpEY3zy7a7bKqwtrJhoPmhx8ej8L2ft consumed 22260 of 200000 compute units",
 "Program EnVjT6csfecAgtpEY3zy7a7bKqwtrJhoPmhx8ej8L2ft failed: An account required by the instruction is missing"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant