pub trait LightPreInit<'info, P> {
// Required method
fn light_pre_init(
&mut self,
remaining_accounts: &[AccountInfo<'info>],
params: &P,
) -> Result<bool, LightSdkError>;
}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
'info- The account info lifetimeP- The instruction params type (from#[instruction(params: P)])
Required Methods§
Sourcefn light_pre_init(
&mut self,
remaining_accounts: &[AccountInfo<'info>],
params: &P,
) -> Result<bool, LightSdkError>
fn light_pre_init( &mut self, remaining_accounts: &[AccountInfo<'info>], params: &P, ) -> Result<bool, LightSdkError>
Execute pre-initialization operations (mint creation).
This writes mint creation operations to CPI context. The actual execution
with proof happens in light_finalize().
§Arguments
remaining_accounts- The remaining accounts from the context, used for CPIparams- The instruction parameters containing compression data
§Returns
true if mints were written to CPI context and light_finalize should execute
with CPI context. false if no mints exist and normal flow should proceed.