Skip to content

Lightprotocol/examples-light-token

Repository files navigation

Light Token and PDA Examples

Light Token and ZK Compression allows you to build scalable Solana applications with rent-free token and mint accounts and PDA's.

Metric Light Standard Solana
Mint Account ~0.000091 SOL ~0.0015 SOL
Token Account ~0.000017 SOL ~0.0029 SOL
PDA (100-byte) ~0.000012 SOL ~0.0016 SOL
  • 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.
  • Light-PDAs are Solana PDAs with sponsored rent-exemption and can be implemented with minimal code changes to your existing Solana program. Your program logic stays mostly untouched, which keeps audit overhead minimal.

How to Use this Repository

Browse contents below, or use AI (Ask DeepWiki).

  1. Open deepwiki.com/Lightprotocol/examples-light-token
  2. Describe your use case and additional context in the chat bar to "AskDevin"
  3. Get relevant resources, code examples, and integration guidance

You can use DeepWiki to index any public GitHub repository.

Toolkits

Description
Payments All you need for wallet integrations and payment flows. Minimal API differences to SPL.
Streaming Tokens Stream mint events using Laserstream
Sign with Privy Light-token operations signed with Privy wallets (Node.js + React)
Sign with Wallet Adapter Sign light-token transactions with Wallet Adapter (React)
Gasless Transactions Abstract SOL fees so users never hold SOL. Set your application as the fee payer. Sponsor rent top-ups and transaction fees.
spl-to-light-transfer
Token 2022 Extensions Create mints with Token 2022 extensions and register them for Light Token

Client Examples

TypeScript

Description
create-mint Action Instruction Create a light-token mint with metadata
create-spl-mint Action Instruction Create an SPL mint with SPL interface PDA
create-t22-mint Action Instruction Create a Token 2022 mint with SPL interface PDA
create-spl-interface Action Instruction Register SPL interface PDA for an existing mint
create-ata Action Instruction Create an associated light-token account
create-ata-explicit-rent-sponsor Action Create an ATA with explicit rent sponsor
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
delegate-transfer Action Delegate transfers tokens on behalf of owner

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
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
escrow Peer-to-peer light-token swap with offer/accept flow
fundraiser Token fundraiser with target, deadline, and refunds
light-token-minter Create light-mints with metadata, mint tokens
token-swap AMM with liquidity pools and swaps (Anchor)
cp-swap-reference Fork of Raydium AMM that creates markets without paying rent-exemption
pinocchio-swap AMM with liquidity pools and swaps (Pinocchio)
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

About

Examples for Stablecoin Payments, Agent Commerce, DeFi and Basics on Solana using Light Token and ZK Compression.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages