Skip to main content

LightPreInit

Trait LightPreInit 

Source
pub trait LightPreInit<AI, P>
where AI: AccountInfoTrait,
{ // Required method fn light_pre_init( &mut self, remaining_accounts: &[AI], params: &P, ) -> Result<bool, LightSdkTypesError>; }
Expand description

Trait for pre-initialization operations (mint creation).

This is generated by #[derive(LightFinalize)] when #[light_account(init)] fields exist. Called at the START of an instruction to write mint creation to CPI context.

The mints are written to CPI context but NOT executed yet - execution happens in light_finalize() at the end, allowing the shared proof to cover both mints and PDAs.

§Type Parameters

  • AI - AccountInfoTrait implementation (solana or pinocchio)
  • P - The instruction params type (from #[instruction(params: P)])

Required Methods§

Source

fn light_pre_init( &mut self, remaining_accounts: &[AI], params: &P, ) -> Result<bool, LightSdkTypesError>

Execute pre-initialization operations (mint creation).

Implementors§