Skip to content

Lightprotocol/examples-light-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Light Token Examples

Setup

cp .env.example .env # ...and set RPC_URL
npm install

Run

From repo root:

# quickstart
npm run quickstart

# cookbook (local)
npm run cookbook create-mint:action
npm run cookbook compress:action
# ... see cookbook/package.json for more

# payments
npm run toolkit:payments send-and-receive

Cookbook examples use local test-validator (install via npm i -g @lightprotocol/zk-compression-cli@alpha, then run light test-validator).

Quickstart

End-to-end example: create a mint, token account, mint tokens, and transfer on devnet.

Cookbook

Step-by-step recipes for light-token on localnet.

  • create-mint - Create a new light-token mint
  • create-ata - Create an associated light-token account
  • load-ata - Load a cold token account (compressed) to hot balance (light-token ata)
  • mint-to - Mint tokens to a light-account
  • transfer-interface - Transfer tokens between light-token, T22, and SPL token accounts.
  • wrap - Wrap SPL to light-token
  • unwrap - Unwrap light-token to SPL for off-ramps and legacy integrations

Low-level instruction builders:

  • create-mint - Build create mint instruction
  • create-ata - Build create ATA instruction
  • load-ata - Build load ATA instruction
  • mint-to - Build mint-to instruction
  • transfer-interface - Build transfer interface instruction for transfers between light-token, T22, and SPL token accounts.
  • wrap - Build wrap instruction
  • unwrap - Build unwrap instruction for off-ramps and legacy integrations

Toolkits

Examples for wallet integrations and payment flows:

  • get-balance - Fetch token balances for light-token accounts
  • get-history - Fetch transaction history for light-token accounts
  • send-and-receive - Send and receive light-tokens using the transfer interface
  • wrap-from-spl - Wrap SPL tokens to light-token
  • unwrap-to-spl - Unwrap light-token to SPL for off-ramps and legacy integrations

Rust program example with test to stream mint events of the Light-Token Program.

About

Examples for Light-Token Program

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •