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

Fix Docs to mention that anchor-spl/idl needs to be added to idl-build in cargo.toml #3468

Open
psalm842 opened this issue Jan 8, 2025 · 0 comments

Comments

@psalm842
Copy link

psalm842 commented Jan 8, 2025

Issue

Users get an error when trying to compile the example on the accounts struct documentation page (docs/src/pages/docs/the-accounts-struct.md) shown below:

#[derive(Accounts)]
pub struct SetData<'info> {
    #[account(mut)]
    pub my_account: Account<'info, MyAccount>,
    #[account(
        constraint = my_account.mint == token_account.mint,
        has_one = owner
    )]
    pub token_account: Account<'info, TokenAccount>,
    pub owner: Signer<'info>
}

Generated Error

image

Resolution

The documentation mentions that anchor-spl must be added to the dependencies section of cargo.toml but fails to mention that you also need to add "anchor-spl/idl-build" to the idl-build list in the Cargo.toml.

This issue was identified and answered on stack overflow but it would be best if it was just in the documentation to begin with.

psalm842 added a commit to psalm842/anchor that referenced this issue Jan 8, 2025
Fixes the error generated by the example in the accounts struct section of the documentation by informing the user they also need to add "anchor-spl/idl-build" to the idl-build list in the features section of cargo.toml
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