thru-cli abi codegen when you already have ABI YAML and want generated client-side or runtime-facing code, not an on-chain ABI account.
Use This When
- you want generated C headers and helpers from ABI type definitions
- you want Rust or TypeScript types organized by package
- you have one or more ABI files plus imported dependencies on disk
- you want to inspect type resolution or IR before generating code: Analyze
- you want to publish an ABI on-chain: Account
- you need a flattened or publish-ready YAML artifact instead of generated source: Flatten or Prep for Publish
Syntax
Required Inputs
| Input | What it does | ||
|---|---|---|---|
—files <FILE>… | One or more root ABI YAML files to load. | ||
| `—language c | rust | typescript` | Chooses the generator backend. |
—include-dir <DIR>… | Adds search roots for imported ABI files. | ||
—output <DIR> | Output directory for generated code. Defaults to generated. |
Output Shape
The generator resolves imports, groups types by package, and writes package directories underneath the output directory.C
Emits package directories containing
types.h and functions.c.Rust
Emits package directories with
types.rs, helper modules, and mod.rs scaffolding.TypeScript
Emits package directories with
types.ts.| Language | Typical output |
|---|---|
c | Package directories with types.h and functions.c. |
rust | Package directories with types.rs, helper modules, and mod.rs scaffolding. |
typescript | Package directories with types.ts. |
Minimal Patterns
Notes
--filescan be repeated so one run can generate code for multiple root packages.- The command creates the output directory if it does not already exist.
--verboseis useful when import resolution is the risky part of the task because it prints loaded files, packages, and output locations.- Use Analyze first if you want to inspect layout or validation helpers before you commit to generated output.