Skip to main content
The mintTo() function creates compressed token accounts for recipients and increases the mint’s token supply. Only the mint authority can perform this operation. Before minting compressed tokens, you need an SPL mint with a token pool for compression. This token pool can be created for new SPL mints via createMint() or added to existing SPL mints via createTokenPool().
function-mint-compressed-tokens.ts

Full Code Example

Prerequisites

Make sure you have dependencies and developer environment set up!
Dependencies
Alternatives:
Developer EnvironmentBy default, this guide uses Localnet.
Alternative: Using DevnetFollow these steps to create an RPC Connection. Replace <your_api_key> with your API key before running.
Get your API Key here, if you don’t have one yet.

Minting Compressed Tokens

Run this script to mint compressed tokens to a recipient!
mint-compressed-tokens.ts

Troubleshooting

The mint does no have a token pool for compression. Ensure you created the mint using createMint.
The token pool info doesn’t correspond to the mint address. Ensure you’re fetching the correct pool:
When minting to multiple recipients, ensure arrays are the same size.

Advanced Configuration

Mint tokens using a custom mint authority with approveAndMintTo():

Next Steps

Learn how to transfer compressed tokens you just minted.