Codama from an Anchor IDL
Codama transforms Anchor IDL into @solana/kit 7.0.0 compatible TypeScript: instruction codecs, account decoders, and error enums.
Search across all documentation pages
Codama transforms Anchor IDL into @solana/kit 7.0.0 compatible TypeScript: instruction codecs, account decoders, and error enums.
anchor build
npx @codama/cli@latest run --idl target/idl/my_program.json --out clients/ts/src/generatedimport { createSolanaRpc, pipe } from "@solana/kit";
import { getIncrementInstruction } from "./generated/instructions";When to reach for this: Greenfield dApps standardize on @solana/kit instead of web3.js v1.
import { address, createSolanaRpc, pipe, setTransactionMessageLifetime } from "@solana/kit";
import { getIncrementInstruction } from "./generated/instructions";
const rpc = createSolanaRpc("https://api.devnet.solana.com");
const programId = address("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
const ix = getIncrementInstruction({
counter: counterPda,
authority: signerAddress,
});
// Pipe into transaction message builders (kit 7 patterns)What this demonstrates:
anchor build produces IDL.Fail build if generated folder differs from fresh Codama run.
| Alternative | Use When | Don't Use When |
|---|---|---|
| @coral-xyz/anchor Program | anchor test legacy | Kit-first apps |
| Gill helpers | Higher-level kit wrapper | Raw kit codecs |
0.32.1 across advanced topics.
Large fixed layouts when Borsh CU too high.
Not easily; plan forward growth.
No; document separately.
Callee IDL JSON at compile time.
Yes with correct account metas.
Avoid different IDL per feature on mainnet.
LiteSVM, Surfpool, devnet simulation.
No; last resort.
See Related links for codama.
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