Anchor provides strongly-typed account wrappers for common Solana account patterns.
Account<‘info, T>
Wrapper for program-owned accounts with automatic validation and deserialization.
pub data: Account<'info, MyData>
Checks:
- Account owner is the current program
- Account discriminator matches type T
- Account data deserializes to type T
Signer<‘info>
Verifies an account signed the transaction.
pub authority: Signer<'info>
Checks:
SystemAccount<‘info>
Represents a native Solana account owned by the System Program.
pub user: SystemAccount<'info>
Program type
Verifies an account is an executable program.
pub system_program: Program<'info, System>
Checks:
- Account is executable
- Account key matches expected program ID
UncheckedAccount<‘info>
Raw AccountInfo with no automatic checks.
/// CHECK: Safe because we only read the key
pub unchecked: UncheckedAccount<'info>
Always add a /// CHECK: comment explaining why no validation is needed.
InterfaceAccount<‘info, T>
For Token-2022 compatibility.
use anchor_spl::token_interface::TokenAccount;
pub token_account: InterfaceAccount<'info, TokenAccount>
Complete reference
See Accounts for detailed usage examples.