#[light_account(init)]creates a PDA#[light_account(init, token::...)]creates a token account via CPI#[light_account(init, associated_token::...)]creates an ATA via CPI#[light_account(init, mint::...)]creates a mint via CPI- Required accounts per account type
#[light_account] below standard Anchor #[account] on the same field.
Anchor handles seeds, space, and payer; LightAccount handles rent-free creation.
#[light_account(init)]
Creates a rent-free PDA. No additional parameters — uses Anchor #[account] seeds and space.
attribute
#[light_account(init, token::...)]
Creates a rent-free token account via CPI to the Light Token program. The account type is UncheckedAccount because Light Token program initializes it via CPI.
attribute
#[light_account(init, associated_token::...)]
Creates a rent-free associated token account via CPI.
attribute
#[light_account(init, mint::...)]
Creates a rent-free mint via CPI.
attribute (required)
Mint with metadata
Mint with metadata
Required accounts
Add these to yourinit struct alongside the fields above. The LightAccounts derive macro appends additional protocol accounts to the instruction at runtime — you don’t add those manually.
- PDA
- Token / ATA / Mint
| Account | Description |
|---|---|
compression_config | Per-program PDA. Stores rent sponsor address and compression settings. Initialize once via InitializeRentFreeConfig. |
pda_rent_sponsor | Per-program PDA. Receives rent-exemption lamports when accounts compress. Must be mutable. |
system_program | Solana System Program. Transfers lamports for rent-exemption. |