> ## Documentation Index
> Fetch the complete documentation index at: https://luminouslabs-cc5545c6-swen-token-interface.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Mint SPL tokens, wrap to Light Token, and transfer in under 3 minutes.

<Accordion title="Agent skill">
  Install or view [dedicated agent skills](/ai-tools/overview#agent-skills).

  ```
  npx skills add Lightprotocol/skills
  ```

  Install orchestrator agent skill or view [skill.md](https://www.zkcompression.com/skill.md):

  ```bash theme={null}
  npx skills add https://zkcompression.com
  ```
</Accordion>

<Steps>
  <Step>
    ## Prerequisites

    <Accordion title="Installation">
      <Tabs>
        <Tab title="npm">
          Install packages in your working directory:

          ```bash theme={null}
          npm install @lightprotocol/stateless.js@^0.23.0 \
                      @lightprotocol/compressed-token@^0.23.0
          ```

          Install the CLI globally:

          ```bash theme={null}
          npm install -g @lightprotocol/zk-compression-cli
          ```
        </Tab>

        <Tab title="yarn">
          Install packages in your working directory:

          ```bash theme={null}
          yarn add @lightprotocol/stateless.js@^0.23.0 \
                   @lightprotocol/compressed-token@^0.23.0
          ```

          Install the CLI globally:

          ```bash theme={null}
          yarn global add @lightprotocol/zk-compression-cli
          ```
        </Tab>

        <Tab title="pnpm">
          Install packages in your working directory:

          ```bash theme={null}
          pnpm add @lightprotocol/stateless.js@^0.23.0 \
                   @lightprotocol/compressed-token@^0.23.0
          ```

          Install the CLI globally:

          ```bash theme={null}
          pnpm add -g @lightprotocol/zk-compression-cli
          ```
        </Tab>

        <Tab title="SDK 2.0 (token-interface)">
          Install packages in your working directory:

          ```bash theme={null}
          # npm
          npm install @lightprotocol/stateless.js@^0.23.0 \
                      @lightprotocol/token-interface@^0.1.2

          # yarn
          yarn add @lightprotocol/stateless.js@^0.23.0 \
                   @lightprotocol/token-interface@^0.1.2

          # pnpm
          pnpm add @lightprotocol/stateless.js@^0.23.0 \
                   @lightprotocol/token-interface@^0.1.2
          ```

          Install the CLI globally:

          ```bash theme={null}
          npm install -g @lightprotocol/zk-compression-cli
          ```
        </Tab>
      </Tabs>
    </Accordion>

    <Tabs>
      <Tab title="Localnet">
        ```bash theme={null}
        # start local test-validator in a separate terminal
        light test-validator
        ```

        <Note>
          In the code examples, use `createRpc()` without arguments for localnet.
        </Note>
      </Tab>

      <Tab title="Devnet">
        Get an API key from [Helius](https://helius.dev) and add to `.env`:

        ```bash title=".env" theme={null}
        API_KEY=<your-helius-api-key>
        ```

        <Note>
          In the code examples, use `createRpc(RPC_URL)` with the devnet URL.
        </Note>
      </Tab>
    </Tabs>
  </Step>

  <Step>
    ## Mint SPL tokens, wrap them to a rent-free account and transfer them to a recipient

    ```typescript theme={null}
    import "dotenv/config";
    import { Keypair, PublicKey } from "@solana/web3.js";
    import { createRpc } from "@lightprotocol/stateless.js";
    import {
        createMintInterface,
        createAtaInterfaceIdempotent,
        getAssociatedTokenAddressInterface,
        wrap,
        transferInterface,
    } from "@lightprotocol/compressed-token";
    import {
        TOKEN_2022_PROGRAM_ID,
        createAssociatedTokenAccount,
        mintTo,
    } from "@solana/spl-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 () {
        const decimals = 9;
        const tokenAmount = BigInt(100 * Math.pow(10, decimals));
        const recipient = Keypair.generate();

        // Creates on-chain SPL or Token-2022 mint and registers SPL interface PDA.
        // SPL interface PDA enables wrap/unwrap between SPL/Token-2022 and Light Token.
        const mintKeypair = Keypair.generate();
        const { mint } = await createMintInterface(
            rpc,
            payer,
            payer,
            null,
            decimals,
            mintKeypair,
            undefined,
            TOKEN_2022_PROGRAM_ID,
        );

        // 1. Mint SPL tokens to payer's associated token account
        const payerSplAta = await createAssociatedTokenAccount(
            rpc,
            payer,
            mint,
            payer.publicKey,
            undefined,
            TOKEN_2022_PROGRAM_ID,
        );
        await mintTo(
            rpc,
            payer,
            mint,
            payerSplAta,
            payer,
            tokenAmount,
            [],
            undefined,
            TOKEN_2022_PROGRAM_ID,
        );

        // 2. Wrap SPL tokens into payer's light associated token account
        await createAtaInterfaceIdempotent(rpc, payer, mint, payer.publicKey);
        const payerLightAta = getAssociatedTokenAddressInterface(mint, payer.publicKey);
        await wrap(rpc, payer, payerSplAta, payerLightAta, payer, mint, tokenAmount);

        // 3. Transfer to recipient's light associated token account
        await createAtaInterfaceIdempotent(rpc, payer, mint, recipient.publicKey);
        await transferInterface(
            rpc,
            payer,
            payerLightAta,
            mint,
            recipient.publicKey,
            payer.publicKey,
            payer,
            tokenAmount,
        );

        console.log("Transferred", 100, "tokens to", recipient.publicKey.toBase58());
    })();
    ```

    <Callout type="info">
      Source: [mint-spl-and-wrap.ts](https://github.com/Lightprotocol/examples-light-token/blob/main/toolkits/sign-with-privy/scripts/src/mint-spl-and-wrap.ts)
    </Callout>
  </Step>
</Steps>

# Next Steps

<Card title="FAQ" icon="question" href="/faq">
  Find answers to frequently answered questions.
</Card>
