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

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

Closed
ajaythxkur opened this issue Apr 26, 2024 · 0 comments · Fixed by #3033
Labels
bug Something isn't working idl related to the IDL, either program or client side

Comments

@ajaythxkur
Copy link

ajaythxkur commented Apr 26, 2024

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
@acheroncrypto acheroncrypto added the idl related to the IDL, either program or client side label Apr 26, 2024
@acheroncrypto acheroncrypto added the bug Something isn't working label Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working idl related to the IDL, either program or client side
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants