light-token 0.20.0

SDK for Light Tokens
Documentation

Light Token SDK

The base library to use Light Token Accounts, and Light Mints.

Light Token Accounts

  • are on Solana devnet.
  • are Solana accounts.
  • are functionally equivalent to SPL token accounts.
  • can hold tokens of Light, SPL and Token 2022 mints.
  • cost 17,288 lamports to create with 24 hours rent.
  • are rentfree:
    • rent exemption is sponsored by the token program.
    • rent is 388 lamports per rent epoch (1.5 hours).
    • once the account's lamports balance is insufficient, it is auto-compressed to a compressed token account.
    • the accounts state is cryptographically preserved on the Solana ledger.
    • compressed tokens can be loaded to a Light Token account.
    • configurable lamports per write (eg transfer) keep the Light Token account perpetually funded when used. So you don't have to worry about funding rent.
    • users load a compressed account into a light account in-flight when using the account again.

Light Mints

  • are on Solana devnet.
  • are Compressed accounts.
  • support TokenMetadata.
  • have the same rent-config as light token accounts

For full program examples, see the Light Token Examples.

Operation Docs guide GitHub example
CreateAssociatedAccountCpi create-ata example
CreateTokenAccountCpi create-token-account example
CreateMintCpi create-mint example
MintToCpi mint-to example
MintToCheckedCpi mint-to example
BurnCpi burn example
TransferCheckedCpi transfer-checked example
TransferInterfaceCpi transfer-interface example
ApproveCpi approve-revoke example
RevokeCpi approve-revoke example
FreezeCpi freeze-thaw example
ThawCpi freeze-thaw example
CloseAccountCpi close-token-account example

Features

  1. anchor - Derives AnchorSerialize, AnchorDeserialize instead of BorshSerialize, BorshDeserialize.
  2. compressible - utility functions for compressible sdk macros.

Common Operations

Operation Instruction Builder CPI Builder
Create Associated Token Account CreateAssociatedTokenAccount CreateAssociatedAccountCpi
Create Token Account CreateTokenAccount CreateTokenAccountCpi
Transfer Transfer TransferCpi
Transfer Interface (auto-detect) TransferInterface TransferInterfaceCpi
Close Token account CloseAccount CloseAccountCpi
Create Mint CreateMint CreateMintCpi
MintTo MintTo MintToCpi

Disclaimer

This library is not audited and in a beta state. Use at your own risk and expect breaking changes.