Skip to main content
Kimia uses Codama to turn Anchor IDLs into tree-shakeable, type-safe @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:

Typed errors

Every program’s errors/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.
Example:

PDA helpers

Generated from the Anchor #[account(seeds = [...])] constraint:
Seeds that reference other accounts (e.g. ["market", market_index_le]) are supported via direct parameter objects.

Re-running generation

A single script runs all the program configs:
Individual scripts exist for iterative program dev:

Using the output outside this repo

Codama output has zero framework dependencies. Copy frontend/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.