#[derive(LightProgram)]
{
// Attributes available to this derive:
#[light_account]
}
Expand description
Derive macro for manually specifying compressed account variants on an enum.
Generates equivalent code to #[light_program] auto-discovery, but allows
specifying account types and seeds explicitly. Useful for external programs
where you don’t own the module.
§Example
ⓘ
#[derive(LightProgram)]
pub enum ProgramAccounts {
#[light_account(pda::seeds = [b"record", ctx.owner])]
Record(MinimalRecord),
#[light_account(pda::seeds = [RECORD_SEED, ctx.owner], pda::zero_copy)]
ZeroCopyRecord(ZeroCopyRecord),
#[light_account(token::seeds = [VAULT_SEED, ctx.mint], token::owner_seeds = [AUTH_SEED])]
Vault,
#[light_account(associated_token)]
Ata,
}Seed expressions use explicit prefixes:
ctx.field- context account referencedata.field- instruction data parameterb"literal"or"literal"- byte/string literalCONSTANTorpath::CONSTANT- constant in SCREAMING_SNAKE_CASE