Expand description
Anchor-grade typed account wrappers for #[hopper::context].
Closes Hopper Safety Audit Stage 2.3: zero-cost, zero-alignment,
type-directed wrappers that programs can use in context structs to
name an account’s role rather than paint it with an
#[account(signer)] attribute.
#[hopper::context]
pub struct Deposit<'info> {
pub authority: Signer<'info>,
pub vault: Account<'info, Vault>,
pub system_program: Program<'info, SystemId>,
}The context macro recognizes these type names via
skips_layout_validation and auto-derives the appropriate
checks (check_signer, check_owned_by, check_executable,
address-pin). The wrappers themselves are
#[repr(transparent)] over &AccountView so they compile away
to the same pointer access as the raw form.
§Why wrappers alongside the attribute path
The attribute-directed lowering (#[account(signer, mut)]) and
the wrapper-directed lowering (pub authority: Signer<'info>)
both cover the same safety story. The wrapper form is
Anchor-familiar and makes the role visible in every signature
that accepts the account; the attribute form stays available for
callers who prefer explicit constraint-lists. Both paths flow
through the same canonical runtime checks. there is no
duplicate safety implementation.
Structs§
- Account
- Account with a verified Hopper layout owned by the executing program.
- Init
Account - Account that is expected to be created during this instruction.
- Program
- Account that must be a named program.
P: ProgramIdidentifies which program the account’s address must equal. - Signer
- Account that must be a transaction signer.
- System
Id - Solana System Program.
Traits§
- Program
Id - Marker trait for a compile-time-known program ID.