internet-court/internet-court-skill / vendored/solana/solana-dev
solana-dev
FlaggedUse when user asks to "build a Solana dapp", "write an Anchor program", "create a token", "debug Solana errors", "set up wallet connection", "test my Solana program", "deploy to devnet", or "explain Solana concepts" (rent, accounts, PDAs, CPIs, etc.). Also use for quick on-chain lookups via public RPC + curl — "what's the balance of <wallet>", "look up transaction <sig>", "token balance for <account>", "check this address on mainnet/devnet". End-to-end Solana development playbook covering wallet connection, Anchor/Pinocchio programs, Codama client generation, Surfpool/LiteSVM/Mollusk testing, security checklists, and JSON-RPC curl lookups against public clusters. Prefers @solana/kit v7 plugin clients (createClient + .use()), wallet connection via @solana/kit-plugin-wallet + @solana/react, web3.js v3 (Kit internals, RC) as the migration target for legacy codebases, and Surfpool for local networks and integration testing.
references/kit/programs/token-2022.md
View on GitHub---
title: Token-2022 (Token Extensions)
description: Kit-compatible @solana-program/token-2022 client — key differences from base Token program, account sizing, ATA derivation, and extension reference.
---
# Token-2022 (Token Extensions)
Program address: `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`
```ts
import { TOKEN_2022_PROGRAM_ADDRESS } from '@solana-program/token-2022';
```
Token-2022 extends the base Token program with configurable extensions. For a full guide to available extensions and their use cases, see the [Token Extensions documentation](https://solana.com/docs/tokens/extensions).
## When to Use Token-2022 vs Token
| Use Token-2022 | Use Token |
|----------------|-----------|
| Transfer fees needed | Simple fungible tokens |
| On-chain metadata | Maximum compatibility |
| Confidential transfers | Lowest compute cost |
| Transfer hooks | Existing ecosystem integration |
| Interest-bearing tokens | |
| Non-transferable tokens | |
## Key Differences from Base Token
### Variable Account Sizes
Unlike base Token (fixed 82/165 byte accounts), Token-2022 sizes vary by extension. Calculate before creating or rent allocation fails:
```ts
import { getMintSize, getTokenSize } from '@solana-program/token-2022';
// Without extensions
const baseSize = getMintSize(); // 82 bytes
// With extensions - pass extension configs
const sizeWithExtensions = getMintSize([
{ extension: 'TransferFeeConfig', ... },
{ extension: 'MetadataPointer', ... },
]);
```
### ATA Derivation
Same pattern as base Token, but you **must** pass `TOKEN_2022_PROGRAM_ADDRESS` — using the wrong program address derives the wrong ATA.
```ts
import { findAssociatedTokenPda, TOKEN_2022_PROGRAM_ADDRESS } from '@solana-program/token-2022';
const [ata] = await findAssociatedTokenPda({
owner: walletAddress,
mint: mintAddress,
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
});
```
### Extension Initialization Order
Extension instructions must come **before** mint initialization — the runtime processes them in order and mint init finalizes the account.
### Account Fetching
Same patterns as base Token — extensions are accessible via `mint.data.extensions`:
```ts
import { fetchMint, fetchToken } from '@solana-program/token-2022';
const mint = await fetchMint(rpc, mintAddress);
// Access extensions via mint.data.extensions
```
## Extensions Reference
See [Token Extensions documentation](https://solana.com/docs/tokens/extensions) for implementation details on each extension.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |