Skip to main content
When a market becomes inactive, its token accounts and related PDAs will be compressed automatically (cold storage). The state is cryptographically preserved on the Solana ledger. While compressed, pure on-chain lookups will return uninitialized. Your indexer should keep tracking, quoting, and routing markets even if the on-chain account shows is_initialized: false, is_compressed: true. To trade a cold market, the first client must prepend an idempotent decompress “warm up” instruction.
Find the source code here.
1

Load compressed tokens (cold storage) to Associated Token Account (hot balance)

import "dotenv/config";
import { Keypair } from "@solana/web3.js";
import { createRpc, bn } from "@lightprotocol/stateless.js";
import {
    createMint,
    mintTo,
    loadAta,
    getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token";
import { homedir } from "os";
import { readFileSync } from "fs";

// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();

const payer = Keypair.fromSecretKey(
    new Uint8Array(
        JSON.parse(readFileSync(`${homedir()}/.config/solana/id.json`, "utf8"))
    )
);

(async function () {
    // Setup: Get compressed tokens (cold storage)
    const { mint } = await createMint(rpc, payer, payer.publicKey, 9);
    await mintTo(rpc, payer, mint, payer.publicKey, payer, bn(1000));

    // Load compressed tokens to hot balance
    const lightTokenAta = getAssociatedTokenAddressInterface(mint, payer.publicKey);
    const tx = await loadAta(rpc, lightTokenAta, payer, mint, payer);

    console.log("Tx:", tx);
})();

Stream light-mint accounts

Toolkit to stream light-mints