Lightprotocol / light-protocol

The ZK Compression Protocol For Solana
https://www.zkcompression.com
GNU General Public License v3.0
179 stars 33 forks source link

feat: Add `#[instruction]` attribute #1220

Closed vadorovsky closed 2 months ago

vadorovsky commented 2 months ago

Allow to reference the instruction parameters in seed = and constraint = parametes inside light_account attribute by exposing them through #[instruction] attribute. It works the same way as in Anchor.

Code example:

#[instruction(name: String)]
pub struct MyInstruction {
    #[light_account(init, seeds = [b"my-seed", name.as_bytes()])]
    pub my_cpda: MyCpdaType,

    [...]
}