Expand description
§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
- anchor - Derives AnchorSerialize, AnchorDeserialize instead of BorshSerialize, BorshDeserialize.
- 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.
Re-exports§
pub use constants::config_pda;pub use constants::id;pub use constants::LIGHT_TOKEN_CPI_AUTHORITY;
Modules§
- compat
- Solana-compatible token types using
solana_pubkey::Pubkey. - constants
- Constants for Light Token SDK.
- error
- Error types for light-token SDK.
- instruction
- High-level builders for Light Token operations.
- spl_
interface - SPL interface PDA derivation utilities.
- utils
- Utility functions and default account configurations.