light_system_program/invoke_cpi/
account.rs

1use aligned_sized::aligned_sized;
2use anchor_lang::prelude::*;
3
4use crate::InstructionDataInvokeCpi;
5
6/// Collects instruction data without executing a compressed transaction.
7/// Signer checks are performed on instruction data.
8/// Collected instruction data is combined with the instruction data of the executing cpi,
9/// and executed as a single transaction.
10/// This enables to use input compressed accounts that are owned by multiple programs,
11/// with one zero-knowledge proof.
12#[aligned_sized(anchor)]
13#[derive(Debug, PartialEq, Default)]
14#[account]
15pub struct CpiContextAccount {
16    pub fee_payer: Pubkey,
17    pub associated_merkle_tree: Pubkey,
18    pub context: Vec<InstructionDataInvokeCpi>,
19}
20
21impl CpiContextAccount {
22    pub fn init(&mut self, associated_merkle_tree: Pubkey) {
23        self.associated_merkle_tree = associated_merkle_tree;
24        self.context = Vec::new();
25    }
26}