1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! LightFinalize and LightPreInit traits for compression operations.
//!
//! These traits are implemented by the `#[derive(LightFinalize)]` macro from light-sdk-macros.
//! They provide hooks for running compression operations at different points in an instruction:
//!
//! - `LightPreInit`: Called at START of instruction - creates mints via CPI context write
//! - `LightFinalize`: Called at END of instruction - compresses PDAs and executes with proof
//!
//! This two-phase design allows mints to be created BEFORE the instruction body runs,
//! so they can be used during the instruction (e.g., for vault creation, minting tokens).
use AccountInfo;
/// 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 lifetime
/// * `P` - The instruction params type (from `#[instruction(params: P)]`)
/// Trait for finalizing compression operations on accounts.
///
/// # Type Parameters
/// * `'info` - The account info lifetime
/// * `P` - The instruction params type (from `#[instruction(params: P)]`)
///