LightCpiInstruction

Trait LightCpiInstruction 

Source
pub trait LightCpiInstruction: Sized {
    // Required methods
    fn new_cpi(cpi_signer: CpiSigner, proof: ValidityProof) -> Self;
    fn with_light_account<A>(
        self,
        account: LightAccount<A>,
    ) -> Result<Self, ProgramError>
       where A: AnchorSerialize + AnchorDeserialize + LightDiscriminator + Default;
    fn get_mode(&self) -> u8;
    fn get_bump(&self) -> u8;
}
Expand description

Trait for Light CPI instruction types

Required Methods§

Source

fn new_cpi(cpi_signer: CpiSigner, proof: ValidityProof) -> Self

Creates a new CPI instruction builder with a validity proof.

§Arguments
  • cpi_signer - The CPI signer containing program ID and bump seed
  • proof - Validity proof for compressed account operations
Source

fn with_light_account<A>( self, account: LightAccount<A>, ) -> Result<Self, ProgramError>

Adds a compressed account to the instruction (using SHA256 hashing).

The account can be an input (for updating/closing), output (for creating/updating), or both. The method automatically handles the conversion based on the account state.

§Arguments
  • account - The light account to add to the instruction
§Type Parameters
  • A - The compressed account data type
Source

fn get_mode(&self) -> u8

Returns the instruction mode (0 for v1, 1 for v2).

Source

fn get_bump(&self) -> u8

Returns the CPI signer bump seed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§