From 115c613c1f4261c1508ef51bdf957e52781d0759 Mon Sep 17 00:00:00 2001 From: tilo-14 Date: Fri, 16 Jan 2026 01:24:24 +0000 Subject: [PATCH] Refactor airdrop guide: merge pages, fix links, test code - Merge create-an-airdrop and create-an-airdrop-with-claim into single airdrop.mdx - Add tested localnet examples (mint-spl-tokens.ts, simple-airdrop.ts) - Fix broken GitHub links (simple-claim path, distributor branch) - Update internal links to new /airdrop path - Swap comparison table columns (distributor first) - Add Next Steps card linking to Claim Reference Implementations tab Co-Authored-By: Claude Opus 4.5 --- ...d-wallet-support-for-compressed-tokens.mdx | 2 +- .../{create-an-airdrop.mdx => airdrop.mdx} | 146 +++++++++++++----- .../create-an-airdrop-with-claim.mdx | 8 - ...-combine-operations-in-one-transaction.mdx | 2 +- .../use-token-2022-with-compression.mdx | 2 +- compressed-tokens/overview.mdx | 2 +- cspell.json | 4 +- docs.json | 3 +- home.mdx | 16 +- ...ompressed-tokens-advanced-guides-table.mdx | 5 +- 10 files changed, 122 insertions(+), 68 deletions(-) rename compressed-tokens/advanced-guides/{create-an-airdrop.mdx => airdrop.mdx} (91%) delete mode 100644 compressed-tokens/advanced-guides/create-an-airdrop-with-claim.mdx diff --git a/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.mdx b/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.mdx index 99e6ea2..c03840d 100644 --- a/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.mdx +++ b/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.mdx @@ -635,6 +635,6 @@ If `getCompressedTokenBalancesByOwnerV2` returns empty: title="Create an Airdrop with Compressed Tokens." icon="chevron-right" color="#0066ff" - href="/compressed-tokens/advanced-guides/create-an-airdrop" + href="/compressed-tokens/advanced-guides/airdrop" horizontal /> diff --git a/compressed-tokens/advanced-guides/create-an-airdrop.mdx b/compressed-tokens/advanced-guides/airdrop.mdx similarity index 91% rename from compressed-tokens/advanced-guides/create-an-airdrop.mdx rename to compressed-tokens/advanced-guides/airdrop.mdx index 37e1450..fa89ffa 100644 --- a/compressed-tokens/advanced-guides/create-an-airdrop.mdx +++ b/compressed-tokens/advanced-guides/airdrop.mdx @@ -1,50 +1,37 @@ --- -title: Create an Airdrop without Claim -description: Complete guide to create an airdrop – with or without code. Access to cost calculation and best practices. ZK compression is the most efficient way to distribute SPL tokens. -keywords: ["airdrop infrastructure on solana", "scalable token distribution on solana", "token airdrop for protocols"] +title: Airdrop Guide with ZK Compression +sidebarTitle: Airdrop Guide +description: Complete client and program guides to create an airdrop – with or without code. ZK compression is the most efficient way to distribute SPL tokens. +keywords: ["solana airdrop", "merkle distributor", "merkle airdrop", "airdrop infrastructure on solana", "scalable token distribution on solana", "token airdrop for protocols"] --- +import { TokenAccountCompressedVsSpl } from '/snippets/jsx/token-account-compressed-vs-spl.jsx'; import InstallDependencies from '/snippets/setup/install-dependencies-codegroup.mdx'; import SetupEnvironment from '/snippets/setup/setup-environment-tabs.mdx'; -import { TokenAccountCompressedVsSpl } from '/snippets/jsx/token-account-compressed-vs-spl.jsx'; -## Guides -There are two ways to use ZK Compression to distribute your SPL tokens. - - - Use **Airship by Helius Labs** to airdrop to up to 200,000 recipients via Webapp. - - - Create a programmatic airdrop with this guide for more control. - - - - -### Cost Comparison -## Programmatic Airdrop +--- + + + Choose your implementation based on your needs: | Tab | Best For | What You'll Get | Time | |:-------------|:-------------|:-------------|:-------------| -| **Implementation Steps** | First-time users, learning | Step-by-step Localnet tutorial | 20 min | +| **Localnet Guide** | First-time users, learning | Step-by-step Localnet tutorial | 20 min | | **Simple Airdrop** | \<10,000 recipients | Production-ready single script | 10 min | | **Airdrop with Batched Instructions** | 10,000+ recipients | Batched system with retry logic | 15 min | + +Via Webapp you can use [Airship by Helius Labs](https://airship.helius.dev/) to airdrop to up to 200,000 recipients. + + - + **What you'll build:** A test airdrop sending compressed tokens to 3 recipients on your local validator. @@ -298,11 +285,58 @@ MINT_ADDRESS=YOUR_MINT_ADDRESS ### Mint SPL Tokens -Mint SPL tokens to your wallet for distribution. See the [mint script example](https://github.com/Lightprotocol/example-token-distribution/blob/main/src/simple-airdrop/mint.ts). +Use your existing mint or mint SPL tokens to your wallet for distribution. - -You can also use an existing mint if you already have one. - +```typescript expandable +import { Rpc, createRpc } from '@lightprotocol/stateless.js'; +import { createMint } from '@lightprotocol/compressed-token'; +import { + getOrCreateAssociatedTokenAccount, + mintTo as mintToSpl, +} from '@solana/spl-token'; +import { PAYER_KEYPAIR, RPC_ENDPOINT } from '../constants'; + +const payer = PAYER_KEYPAIR; +const connection: Rpc = createRpc(RPC_ENDPOINT); +const decimals = 9; +const mintAmount = 100; + +(async () => { + // airdrop lamports to pay tx fees + // await confirmTx( + // connection, + // await connection.requestAirdrop(payer.publicKey, 1e7) + // ); + + const { mint, transactionSignature } = await createMint( + connection, + payer, + payer.publicKey, + decimals, + ); + console.log( + `create-mint success! txId: ${transactionSignature}, mint: ${mint.toBase58()}`, + ); + + const ata = await getOrCreateAssociatedTokenAccount( + connection, + payer, + mint, + payer.publicKey, + ); + console.log(`ata: ${ata.address}`); + + const mintTxId = await mintToSpl( + connection, + payer, + mint, + ata.address, + payer.publicKey, + mintAmount, + ); + console.log(`mint-spl success! txId: ${mintTxId}`); +})(); +``` @@ -866,9 +900,7 @@ Solana Wallets like Phantom and Backpack already support compressed tokens. Still, you can let users decompress to SPL via your Frontend to customize claims. -* Full Example on Github to [create an Airdrop with Claim](https://github.com/Lightprotocol/program-examples-airdrop-implementations/simple-claim). - -* Add decompression of SPL Tokens with this script. +Add decompression of SPL Tokens with this script. ```typescript expandable import { @@ -968,12 +1000,52 @@ Set priority fees dynamically for decompression. Learn more [here](https://docs. If you have a custom FE, you can let users swap compressed tokens using the Jup-API. A reference implementation is available [here](https://github.com/Lightprotocol/example-jupiter-swap-node). -# Next Steps +## Next Steps + + + +Customize token distribution and let users claim. + +| | distributor | simple-claim | +|--|-------------|--------------| +| Vesting | Linear Vesting | Cliff at Slot X | +| Partial claims | Yes | No | +| Clawback | Yes | No | +| Frontend | REST API + CLI | None | + + +The programs are not audited and should be before production use. + + + + + Merkle distributor based on jito airdrop and optimized with rent-free PDAs. + + + + Simple SPL token airdrop with claim. + + + + + diff --git a/compressed-tokens/advanced-guides/create-an-airdrop-with-claim.mdx b/compressed-tokens/advanced-guides/create-an-airdrop-with-claim.mdx deleted file mode 100644 index 5dbfb06..0000000 --- a/compressed-tokens/advanced-guides/create-an-airdrop-with-claim.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Example Airdrop with Claim" -description: "Demo for time-locked airdrop with compressed tokens" -url: "https://github.com/Lightprotocol/program-examples-airdrop-implementations/simple-claim" -keywords: ["airdrop with claim on solana", "claimable airdrop infrastructure", "reward distribution for depins", "depin token claims"] ---- - -View the full example on GitHub: [simple-claim](https://github.com/Lightprotocol/program-examples-airdrop-implementations/simple-claim) diff --git a/compressed-tokens/advanced-guides/how-to-combine-operations-in-one-transaction.mdx b/compressed-tokens/advanced-guides/how-to-combine-operations-in-one-transaction.mdx index 53a5281..3201b90 100644 --- a/compressed-tokens/advanced-guides/how-to-combine-operations-in-one-transaction.mdx +++ b/compressed-tokens/advanced-guides/how-to-combine-operations-in-one-transaction.mdx @@ -193,6 +193,6 @@ createPoolAndCompress().catch(console.error); title="Create an Airdrop with Compressed Tokens." icon="chevron-right" color="#0066ff" - href="/compressed-tokens/advanced-guides/create-an-airdrop" + href="/compressed-tokens/advanced-guides/airdrop" horizontal /> diff --git a/compressed-tokens/advanced-guides/use-token-2022-with-compression.mdx b/compressed-tokens/advanced-guides/use-token-2022-with-compression.mdx index 648b41e..12da5bd 100644 --- a/compressed-tokens/advanced-guides/use-token-2022-with-compression.mdx +++ b/compressed-tokens/advanced-guides/use-token-2022-with-compression.mdx @@ -271,7 +271,7 @@ const connection = createRpc(); // defaults to localhost:8899 title="Create an Airdrop with Compressed Tokens." icon="chevron-right" color="#0066ff" - href="/compressed-tokens/advanced-guides/create-an-airdrop" + href="/compressed-tokens/advanced-guides/airdrop" horizontal /> diff --git a/compressed-tokens/overview.mdx b/compressed-tokens/overview.mdx index 8a2fa71..cab4c9e 100644 --- a/compressed-tokens/overview.mdx +++ b/compressed-tokens/overview.mdx @@ -31,7 +31,7 @@ import { TokenAccountCompressedVsSpl } from "/snippets/jsx/token-account-compres title="Create an Airdrop" icon="chevron-right" color="#0066ff" - href="/compressed-tokens/advanced-guides/create-an-airdrop" + href="/compressed-tokens/advanced-guides/airdrop" horizontal /> diff --git a/cspell.json b/cspell.json index 4e4f037..57f1a85 100644 --- a/cspell.json +++ b/cspell.json @@ -184,7 +184,9 @@ "zcash", "circomlibjs", "Jotaro", - "Yano" + "Yano", + "jito", + "Jito" ], "ignorePaths": [ "node_modules", diff --git a/docs.json b/docs.json index 050a5c2..3e3db01 100644 --- a/docs.json +++ b/docs.json @@ -130,6 +130,7 @@ "group": "Compressed Tokens", "pages": [ "compressed-tokens/overview", + "compressed-tokens/advanced-guides/airdrop", { "group": "Cookbook", "pages": [ @@ -160,8 +161,6 @@ "group": "Examples", "expanded": true, "pages": [ - "compressed-tokens/advanced-guides/create-an-airdrop", - "compressed-tokens/advanced-guides/create-an-airdrop-with-claim", "compressed-tokens/advanced-guides/example-web-client", "compressed-tokens/advanced-guides/example-node-js", "compressed-tokens/advanced-guides/example-token-distribution" diff --git a/home.mdx b/home.mdx index 25a9c1e..423d88a 100644 --- a/home.mdx +++ b/home.mdx @@ -105,23 +105,13 @@ import WelcomePageInstall from "/snippets/setup/welcome-page-install.mdx"; - Distribute tokens directly to recipients. - - - - Distribute tokens and let users claim. + ZK Compression is the most efficient way to distribute SPL tokens.