Create Token Pools for Compression to Existing Mints
Create a token pool for an existing SPL mint. Requires only fee_payer with no mint authority constraint.
Create a token for compression fo an existing SPL mint. createTokenPool() requires only fee_payer and has no mint authority constraint.
The token pool account itself requires rent, but individual compressed token accounts are rent-free.
Report incorrect code
Copy
Ask AI
// Creates token pool account for existing SPL mintconst transactionSignature = await createTokenPool( rpc, payer, mint,);
Best Practice: Each mint supports a maximum of 4 token pools total. During compression/decompression operations, token pools get write-locked. Use addTokenPools() to create additional pools that increase per-block write-lock capacity.
const mints = [ new PublicKey("MINT_1_ADDRESS"), new PublicKey("MINT_2_ADDRESS"), new PublicKey("MINT_3_ADDRESS"),];for (const mint of mints) { try { const poolTx = await createTokenPool(rpc, payer, mint); console.log(`Pool created for ${mint.toBase58()}:`, poolTx); } catch (error) { console.log(`Failed for ${mint.toBase58()}:`, error.message); }}
Create Pool with Token-2022
Create token pools for Token-2022 mints:
Report incorrect code
Copy
Ask AI
import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token';const poolTx = await createTokenPool( rpc, payer, mint, // Token-2022 mint undefined, TOKEN_2022_PROGRAM_ID,);