Skip to main content

Crate verified_anchor

Crate verified_anchor 

Source
Expand description

Verified Anchor runtime support (Milestone 2).

Re-exports§

pub use account_data::AccountData;
pub use account_data::ProgramId;
pub use account_data::System;
pub use account::Account;
pub use account::Signer;
pub use account::Program;
pub use account::SystemAccount;
pub use account::UncheckedAccount;
pub use context::Context;
pub use borsh;
pub use solana_program;
pub use inventory;

Modules§

account
The six typed wrappers the M7a macro recognises. Each is a thin marker over &'info AccountInfo<'info>; Account<'info, T> additionally carries the Borsh-deserialised T (the macro fills it in try_accounts).
account_data
Traits that user types carry into typed-account wrappers.
context
Context<'a, 'b, 'c, 'info, T> — mirrors stock Anchor’s signature so a verified-anchor instruction handler is type-identical to a stock-Anchor one.
prelude
Recommended use verified_anchor::prelude::*; — gives users the typed wrappers, traits, Context, and the derive macros in one import.

Macros§

emit_specs
Drop ONE call in your crate’s lib (e.g. bottom of src/lib.rs). Expands to a test that, when VERIFIED_ANCHOR_SPEC_DIR is set (by cargo verified-anchor check), writes spec files for every derived struct in this crate. Placing it in the lib is REQUIRED: the emitter must be same-crate as the inventory::submit!s (cross-crate harnesses dead-strip).

Structs§

SpecEntry
One registered #[derive(VerifiedAccounts)] struct.

Enums§

VAError
Why account validation failed. field is the struct field name that failed.

Traits§

Accounts
THE DEVELOPER SURFACE (M7a). try_accounts calls Self::validate (the proven layer) and Borsh-deserialises each Account<T> field.
Validate
Implemented by #[derive(VerifiedAccounts)]. Validation is positional over the runtime account slice (index = field declaration order), matching the Lean Ctx.

Functions§

collect_specs
All registered structs in the current compilation artifact.
write_spec_files
Write one spec file per registered struct into dir. Filename is <name>.<kind> where kind is lifecycle or validation; the file content is the lean_spec() literal. (No JSON — the literal is the whole content, so there’s nothing to escape.)

Attribute Macros§

account

Derive Macros§

AccountData
VerifiedAccounts