- The light-token API matches the SPL-token API almost entirely, and extends their functionality to include the light token program in addition to the SPL-token and Token-2022 programs.
- Your users use the same stablecoins, just stored more efficiently.
| SPL | Light | |
|---|---|---|
| Transfer | createTransferInstruction() | createTransferInterfaceInstructions() |
Agent skill
Agent skill
Use the payments agent skill to add light-token payment support to your project:For orchestration, install the general skill:
- Guide
- AI Prompt
Setup
Installation
Installation
- npm
- yarn
- pnpm
Install packages in your working directory:Install the CLI globally:
- Localnet
- Devnet
In the code examples, use
createRpc() without arguments for localnet.rpc, payer, mint, owner, recipient, and amount are defined.
See the full examples for runnable setup.Create a Token Helper for Setup
Create a Token Helper for Setup
setup.ts
Find full runnable code examples:
instruction |
action.
Send a Payment
UsecreateTransferInterfaceInstructions to transfer tokens between wallets. The method:- automatically derives Associated Token Accounts for the sender and recipient. If the recipient’s ATA doesn’t exist, the instruction to create the account is automatically added to the same transaction.
- determines whether the sender’s account has a cold balance and adds load instructions if needed.
About loading: Light Token accounts reduce account rent ~200x by auto-compressing inactive
accounts. Before any action, the SDK detects cold balances and adds
instructions to load them. This almost always fits in a single
atomic transaction with your regular transfer. APIs return
TransactionInstruction[][] so the same
loop handles the rare multi-transaction case automatically.- Instruction
- Action
Compare to SPL
Compare to SPL
Sign all transactions together
Sign all transactions together
Optimize sending (parallel conditional loads, then transfer)
Optimize sending (parallel conditional loads, then transfer)
Related guides
Batch payments
Pack multiple transfers to multiple recipients into one transaction.
Gasless transactions
Abstract SOL fees from the user. Sponsor top-ups and transaction fees.
Receive payments
Unify token balances and share ATA address with the sender.