Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Solana development skill covering @solana/kit v5, Anchor programs, LiteSVM testing, and security patterns.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/kit/codama.md
1---2title: Codama Program Clients3description: Naming conventions and patterns for Codama-generated @solana-program/* Kit-compatible clients.4---56# Codama-Generated Program Clients78`@solana-program/*` packages are Codama-generated, Kit-compatible clients for Solana programs.910## Naming Conventions1112| Category | Pattern | Example |13|----------|---------|---------|14| Program address | `{PROGRAM}_PROGRAM_ADDRESS` | `SYSTEM_PROGRAM_ADDRESS` |15| Instructions | `get{Name}Instruction()` | `getTransferSolInstruction()` |16| Instruction parse | `parse{Name}Instruction()` | `parseTransferSolInstruction()` |17| Account fetch | `fetch{Account}()` | `fetchMint()` |18| Account fetch maybe | `fetchMaybe{Account}()` | `fetchMaybeMint()` |19| Account fetch all | `fetchAll{Account}()` | `fetchAllMint()` |20| Account decode | `decode{Account}()` | `decodeMint()` |21| Account size | `get{Account}Size()` | `getMintSize()` |22| Codec | `get{Type}[Encoder\|Decoder\|Codec]()` | `getMintDecoder()` |23| PDA derivation | `find{Name}Pda()` | `findAssociatedTokenPda()` |24| Errors | `{PROGRAM}_ERROR__{NAME}` | `SYSTEM_ERROR__INSUFFICIENT_FUNDS` |25| Error check | `is{Program}Error()` | `isSystemError()` |2627## Quick Examples2829### Fetch Typed Account3031```ts32import { fetchMint } from '@solana-program/token';3334const mint = await fetchMint(rpc, mintAddress);35// mint.data.decimals, mint.data.supply — fully typed36```3738### Create Instruction3940```ts41import { getTransferSolInstruction } from '@solana-program/system';42import { lamports } from '@solana/kit';4344const ix = getTransferSolInstruction({45source: payer,46destination: recipient.address,47amount: lamports(1_000_000n),48});49```5051### Derive PDA5253```ts54import { findAssociatedTokenPda, TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';5556const [ata] = await findAssociatedTokenPda({57owner,58mint,59tokenProgram: TOKEN_PROGRAM_ADDRESS,60});61```6263### Error Handling6465```ts66import { isSystemError, SYSTEM_ERROR__INSUFFICIENT_FUNDS } from '@solana-program/system';6768try {69await sendTransaction(tx);70} catch (e) {71if (isSystemError(e, SYSTEM_ERROR__INSUFFICIENT_FUNDS)) {72console.error('Not enough SOL');73}74}75```7677## Program-Specific References7879For detailed APIs:80- [programs/system.md](programs/system.md) — Account creation, transfers, nonces81- [programs/token.md](programs/token.md) — SPL Token operations82- [programs/token-2022.md](programs/token-2022.md) — Token Extensions83- [programs/compute-budget.md](programs/compute-budget.md) — CU limits & priority fees84