coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.36k stars 1.25k forks source link

&(config_account.last_token_id + 1).to_le_bytes() causing problems with account resolution in IDL #2933

Closed ajaythxkur closed 2 weeks ago

ajaythxkur commented 2 months ago
pub struct InitToken<'info> {
    #[account(
        mut,
        seeds = [CONFIG_SEED.as_bytes(), authority.key().as_ref()],
        bump,
        has_one = authority
    )]
    pub config_account: Account<'info, Config>,

    #[account(
        init,
        seeds = [TOKEN_SEED.as_bytes(), &(config_account.last_token_id + 1).to_le_bytes()],
        bump,
        payer = authority,
        space = 8 + size_of::<Token>() + MAX_TOKEN_NAME + MAX_TOKEN_SYMBOL + MAX_IMAGE_LEN + MAX_IMAGE_LEN,
    )]
    pub token_account: Account<'info, Token>,

    #[account(mut)]
    pub authority: Signer<'info>,
    pub system_program: Program<'info, System>,
}

Results in error:

seeds = [TOKEN_SEED.as_bytes(), &(config_account.last_token_id + 1).to_le_bytes()],
    |                                           ^^^^^^^^^^^^^^ not found in this scope`

Workaround in Anchor.toml:

[features]
resolution = false