@solana/kit clients. The output is committed
to frontend/app/generated/<program>/; Codama is only re-run when a program
changes. Nothing is published to npm — if you want the TS client in your own
package, copy the folder or run Codama yourself.
The pipeline
Config format
idl: Path to Anchor’s output IDL.outDir: Where the generated TS lands.programName: camelCased; drives symbol naming.
What gets generated
For each account, instruction, type, error, and event in the IDL:| IDL item | Generated TS |
|---|---|
Account "Market" | accounts/market.ts, fetchMarket, getMarketCodec, getMarketSize, MARKET_DISCRIMINATOR |
Instruction "place_order" | instructions/placeOrder.ts, getPlaceOrderInstruction, getPlaceOrderInstructionDataCodec |
Type "Direction" | types/direction.ts, enum-codec pair |
Error "StaleOracle" | errors/index.ts, KIMIA_PERP_ERROR__STALE_ORACLE + message map |
Typed errors
Every program’serrors/index.ts exports:
- A numeric enum matching Anchor’s error codes.
- A message map for user-facing strings.
- A helper
is<ProgramName>Error(error, code)for switch-style matching.
PDA helpers
Generated from the Anchor#[account(seeds = [...])] constraint:
["market", market_index_le]) are
supported via direct parameter objects.
Re-running generation
A single script runs all the program configs:Using the output outside this repo
Codama output has zero framework dependencies. Copyfrontend/app/generated/<program>/ into any TS project; all it imports is
@solana/kit. There is no official npm package — the in-repo copy is the
source of truth.
