Skip to main content
The transfer() function moves compressed tokens between accounts.
  • SPL token transfers that update the existing account
  • Compressed token transfers consume input accounts from the sender and create new output accounts for sender and recipient with updated balances.
SPL token accounts can be compressed in the same transaction with compress_or_decompress_amount, if needed.
function-transfer-compressed-tokens.ts

Get Started

1

Transfer Compressed Tokens

Install packages in your working directory:
Install the CLI globally:
In the code examples, use createRpc() without arguments for localnet.
Make sure the SPL mint has a token pool for compression.
The script creates this token pool for you.
For development, you can create a new mint with token pool via createMint() or add a token pool to an existing mint via createTokenPool().

Troubleshooting

The sender doesn’t have enough compressed tokens for the requested transfer amount.
The transfer requires more than 4 compressed accounts, which exceeds the transaction limit.

Advanced Configuration

Transfer to multiple recipients in separate transactions:
Transfer tokens using delegate authority:

Next Steps

How to Compress and Decompress SPL Tokens