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.
function-mint-compressed-tokens.ts

Full Code Example

1

Prerequisites

Make sure you have dependencies and developer environment set up!
Dependencies
Developer Environment
By default, all guides use Localnet.
2

Minting Compressed Tokens

Run this script to mint compressed tokens to a recipient!
mint-compressed-tokens.ts
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 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.