Quasar uses an Interface Definition Language (IDL) as the canonical description of your program’s public surface: its instructions, account types, error codes, and events. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/blueshift-gg/quasar/llms.txt
Use this file to discover all available pages before exploring further.
quasar idl command extracts this description from your Rust source code, and quasar client turns it into ready-to-use client code in TypeScript, Python, Go, or C. Both commands are also run automatically during quasar build, so generated clients stay in sync with your program on every compile.
quasar idl
quasar idl PATH generates the IDL JSON for a program crate and writes it to target/idl/<name>.json. It also generates a Rust client crate in target/client/rust/. The PATH argument is the path to the program crate directory — typically . when running from the project root.
How IDL Generation Works
Quasar extracts the IDL by compiling the program crate with theidl-build Cargo feature enabled and running a special __quasar_emit_idl test that prints the IDL as JSON to stdout. The Quasar framework macro infrastructure captures instruction discriminators, account field names and types, error variants, and event definitions at compile time, so the IDL always reflects the actual compiled program — not a hand-written description.
Your Cargo.toml must include the idl-build feature for this to work:
quasar init.
Output
quasar lint to track your program’s public surface in quasar.lock.json.
IDL JSON Structure
The IDL JSON describes every public-facing element of your program. Here is an example structure:| Field | Description |
|---|---|
name | Program crate name (snake_case) |
version | Version from Cargo.toml |
address | On-chain program ID from declare_id!() |
instructions[] | All #[instruction] handlers with discriminators, accounts, and args |
accounts[] | All #[account] structs with discriminators and fields |
types[] | Shared types referenced by instructions or accounts |
errors[] | All #[error_code] variants |
events[] | All #[event] structs |
quasar client
quasar client IDL [--lang ...] generates client code from an IDL JSON file. By default it generates clients for all supported languages; use --lang to restrict to specific ones.
Flags
| Flag | Description |
|---|---|
IDL | Path to the IDL JSON file (e.g. target/idl/my_program.json) |
--lang LANG | Comma-separated list of languages to generate. Options: typescript, python, golang, c. Default: all. |
ts → typescript, py → python, go → golang.
Output Paths
Client code is written to the path configured inQuasar.toml under clients.path (default: target/client/):
Generated Client Code
- TypeScript (Kit)
- Python
- Go
- C
The TypeScript client includes two variants: The generated
kit.ts for @solana/kit (the modern Solana TypeScript SDK) and web3.ts for @solana/web3.js. Both provide strongly typed instruction builders and account decoders.Example usage with @solana/kit:package.json in the client directory declares the correct peer dependencies so the client can be published as a standalone npm package.Typical IDL & Client Workflow
Write and build your program
quasar build automatically generates the IDL and all configured client languages. You only need to run quasar idl or quasar client manually when you want to target a specific crate path or language outside of the normal build flow.Inspect the generated IDL
Generate clients from a saved IDL
If you have an IDL JSON from a deployed program and want to regenerate clients without a local source build:
Client code is regenerated on every
quasar build. If you change an instruction signature, account layout, or error variant, the generated clients are updated automatically. Run quasar lint to see a diff of what changed relative to quasar.lock.json.