Typed Clients Basics
8 examples for IDL-driven TypeScript clients - 5 basic and 3 intermediate.
Search across all documentation pages
8 examples for IDL-driven TypeScript clients - 5 basic and 3 intermediate.
anchor build # Anchor 0.32.1
npm install @solana/kit@7.0.0
npm install -D @codama/cli @codama/renderers-jsIDL is the contract between on-chain Rust and off-chain TypeScript.
ls target/idl/my_program.json@coral-xyz/anchor Program class still works for legacy apps.
// Prefer Codama + kit for new modulesIDL → node graph → renderer → TypeScript kit client.
npx codama run --config codama.jsonGenerated decoders parse account data.
import { createSolanaRpc, address } from "@solana/kit";
// import { fetchMyAccount } from "./generated";
const rpc = createSolanaRpc(process.env.RPC_URL!);Instruction builders encode discriminator + args.
// getIncrementInstruction({ account, authority }) from generated clientHigher-level helpers bundle kit + common programs.
npm install gillimport { createSolanaClient } from "gill";anchor build && npx codama run && git diff --exit-code clients/Monorepo may host several IDLs.
{ "idl": "target/idl/program_a.json", "before": [], "scripts": { "js": "@codama/renderers-js" } }Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 19, 2026