Skip to content

Lightprotocol/examples-light-token

Repository files navigation

Light Token Examples

Light token is a high-performance token standard that reduces the cost of mint and token accounts by 200x.

  • All light mint and token accounts are on-chain accounts like SPL, but the light token program sponsors the rent-exemption cost for you.
  • Light-token accounts can hold balances from any light, SPL, or Token-2022 mint.
  • Light-mint accounts represent a unique mint and optionally can store token-metadata. Functionally equivalent to SPL mints.

Toolkits

Description
Payments and Wallets All you need for wallet integrations and payment flows. Minimal API differences to SPL.
Streaming Tokens Stream mint events using Laserstream

Client Examples

TypeScript

Description
create-mint Action Instruction Create a light-token mint with metadata
create-ata Action Instruction Create an associated light-token account
load-ata Action Instruction Load token accounts from light-token, compressed tokens, SPL/T22 to one unified balance
mint-to Action Instruction Mint tokens to a light-account
transfer-interface Action Instruction Transfer between light-token, T22, and SPL accounts
wrap Action Instruction Wrap SPL/T22 to light-token
unwrap Action Instruction Unwrap light-token to SPL/T22
approve Action Approve delegate
revoke Action Revoke delegate

Rust

Description
create-mint Action Instruction Create a light-token mint with metadata
create-ata Action Instruction Create an associated light-token account
create-token-account Instruction Create a light-token account with custom owner
mint-to Action Instruction Mint tokens to a light-account
mint-to-checked Instruction Mint tokens with decimal validation
transfer-interface Action Instruction Transfer between light-token, T22, and SPL accounts
transfer-checked Action Instruction Transfer with decimal validation
spl-to-light-transfer Instruction Transfer from SPL to Light via TransferInterface
wrap Action Wrap SPL/T22 to light-token
unwrap Action Unwrap light-token to SPL/T22
burn Instruction Burn tokens
burn-checked Instruction Burn tokens with decimal validation
approve Action Instruction Approve delegate
revoke Action Instruction Revoke delegate
freeze Instruction Freeze a token account
thaw Instruction Thaw a frozen token account
close Instruction Close a token account

Program Examples

Examples

Description
cp-swap-reference Fork of Raydium AMM that creates markets without paying rent-exemption.
create-and-transfer Create account via macro and transfer via CPI

Macros

Description
counter Create, increment and close counter 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

Instructions

The instructions use pure CPI calls which you can combine with existing and / or light macros. 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.

Description
approve Approve delegate via CPI
burn Burn tokens via CPI
close Close token account via CPI
create-associated-token-account Create associated light-token account via CPI
create-mint Create light-token mint via CPI
create-token-account Create light-token account via CPI
freeze Freeze token account via CPI
mint-to Mint tokens via CPI
revoke Revoke delegate via CPI
thaw Thaw token account via CPI
transfer-checked Transfer with mint validation via CPI
transfer-interface Transfer between light-token, T22, and SPL accounts via CPI

Documentation

Learn more about Light-Token here.

About

For DeFi and Payments.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6