Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.1 KB

File metadata and controls

33 lines (23 loc) · 1.1 KB

Light Token macro examples

counter Create PDA with sponsored rent-exemption
create-associated-token-account Create associated light-token account
create-mint Create light-token mint
create-token-account Create light-token account

Combining macros with CPI

create-and-transfer shows the pattern for instructions that both create accounts and execute logic. The #[light_account] macro on destination creates the recipient associated token account. The handler body calls TransferInterfaceCpi to execute the transfer.

For existing programs, you can replace spl_token with light_token instructions as you need. The API is a superset of SPL-token so switching is straightforward.

Build and test

# for localnet
npm i -g @lightprotocol/zk-compression-cli@beta
anchor build
cargo test-sbf

Documentation

Learn more about Light-Token here.