Skip to main content
1

Prerequisites

Install packages in your working directory:
npm install @lightprotocol/stateless.js@alpha \
            @lightprotocol/compressed-token@alpha
Install the CLI globally:
npm install -g @lightprotocol/zk-compression-cli@alpha
# Start local test-validator
light test-validator
2

Mint Tokens to Light-ATA

import { Keypair } from "@solana/web3.js";
import { createRpc } from "@lightprotocol/stateless.js";
import {
  createMintInterface,
  createAtaInterface,
  mintToInterface,
  getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token";

async function main() {
  const rpc = createRpc();
  const payer = Keypair.generate();
  await rpc.requestAirdrop(payer.publicKey, 10e9);

  const mintSigner = Keypair.generate();
  const { mint } = await createMintInterface(
    rpc,
    payer,
    payer,
    null,
    9,
    mintSigner,
  );

  const recipient = Keypair.generate();
  await createAtaInterface(rpc, payer, mint, recipient.publicKey);

  const destination = getAssociatedTokenAddressInterface(mint, recipient.publicKey);
  const amount = 1_000_000_000;

  const txSignature = await mintToInterface(
    rpc,
    payer,
    mint,
    destination,
    payer,
    amount,
  );

  console.log("Minted tokens:", amount);
  console.log("Transaction:", txSignature);
}

main().catch(console.error);

Next Steps