Skip to main content
  1. 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.
  2. Your users use the same stablecoins, just stored more efficiently.

What you will implement

SPLLight
ReceivegetOrCreateAssociatedTokenAccount()createLoadAtaInstructions()
TransfercreateTransferInstruction()createTransferInterfaceInstructions()
Get BalancegetAccount()getAtaInterface()
Tx HistorygetSignaturesForAddress()rpc.getSignaturesForOwnerInterface()
Wrap from SPLN/AcreateWrapInstruction()
Unwrap to SPLN/AcreateUnwrapInstructions() / unwrap()
Find full runnable code examples here.
Use the payments-and-wallets agent skill to add light-token payment support to your project:
Add the marketplace and install:
For orchestration, install the general skill:

Setup

Snippets below assume rpc, payer, mint, owner, recipient, and amount are defined. See the full examples for runnable setup.

One-time: Create interface PDA to existing SPL Mint

For existing SPL mints (e.g. USDC), register the SPL interface once. This creates the omnibus PDA that holds SPL tokens when wrapped to light-token.
Find a full code example here.
Check if the interface already exists:
Register:
Use createMintInterface with TOKEN_PROGRAM_ID to create a new SPL mint and register the interface in one transaction:

Receive Payments

Find a full code example here.
Load creates the associated token account (ATA) if needed and loads any compressed state into it. Share the ATA address with the sender.
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.

Send Payments

Find a full code example: instruction | action.
Your app logic may require you to create a single sign request for your user. Here’s how to do this:
While almost always you will have only one transfer transaction, you can optimize sending in the rare cases where you have multiple transactions. parallelize the loads, confirm them, and then send the transfer instruction after.

Show Balance

Find a full code example here.

Transaction History

Find a full code example here.
Use getSignaturesForAddressInterface(address) if you want address-specific rather than owner-wide history.

Wrap from SPL

Wrap tokens from SPL/Token-2022 accounts to light-token ATA.
Find a full code example here.

Unwrap to SPL

Unwrap moves the token balance from a light-token account to a SPL-token account. Use this to compose with applications that do not yet support light-token.
Find a full code example here.