light_sdk/
traits.rs

1// Ported from light-system-program, adjusted for caller programs.
2use anchor_lang::prelude::*;
3
4pub trait InvokeAccounts<'info> {
5    fn get_registered_program_pda(&self) -> &AccountInfo<'info>;
6    fn get_noop_program(&self) -> &AccountInfo<'info>;
7    fn get_account_compression_authority(&self) -> &AccountInfo<'info>;
8    fn get_account_compression_program(&self) -> &AccountInfo<'info>;
9    fn get_system_program(&self) -> &Program<'info, System>;
10    fn get_compressed_sol_pda(&self) -> Option<&AccountInfo<'info>>;
11    fn get_compression_recipient(&self) -> Option<&AccountInfo<'info>>;
12}
13
14pub trait LightSystemAccount<'info> {
15    fn get_light_system_program(&self) -> &AccountInfo<'info>;
16}
17
18pub trait SignerAccounts<'info> {
19    fn get_fee_payer(&self) -> &Signer<'info>;
20    fn get_authority(&self) -> &AccountInfo<'info>;
21}
22
23// Only used within the systemprogram
24pub trait InvokeCpiContextAccountMut<'info> {
25    fn get_cpi_context_account_mut(&mut self) -> &mut Option<AccountInfo<'info>>;
26}
27
28pub trait InvokeCpiContextAccount<'info> {
29    fn get_cpi_context_account(&self) -> Option<&AccountInfo<'info>>;
30}
31
32pub trait InvokeCpiAccounts<'info> {
33    fn get_invoking_program(&self) -> &AccountInfo<'info>;
34}