For the complete documentation index optimized for AI agents, see llms.txt or llms-full.txt. A markdown version of this page is available by appending.mdto the URL or sendingAccept: text/markdown.
a4 idl — IDL Explorer
For AI agents: the documentation index is at llms.txt (full corpus: llms-full.txt). A markdown source for this page is /cli/idl.md.
Explore and analyze Solana IDL (Interface Definition Language) files directly from the command line.
The a4 idl suite helps you understand a program’s structure, account layouts, and relationships before you start building your stack.
Global Behavior
Section titled “Global Behavior”These rules apply to all a4 idl subcommands:
- Path argument: Every subcommand takes
<path>as its first positional argument (the path to the IDL JSON file). - JSON output: Most commands support the
--jsonflag for machine-readable output. - Fuzzy matching: Lookups for instructions, accounts, and types are case-insensitive. If you make a typo, the CLI suggests the closest match.
- Error handling: File-not-found or invalid names exit with code 1 and a clear message.
Quick Reference
Section titled “Quick Reference”| Command | Description |
|---|---|
summary | Quick overview of the IDL structure |
instructions | List all instructions |
instruction | Detail view of a specific instruction |
accounts | List all account types |
account | Detail view of a specific account |
types | List all custom types |
type | Detail view of a specific custom type |
errors | List all program errors |
events | List all program events |
constants | List all defined constants |
search | Fuzzy search across the entire IDL |
discriminator | Compute Anchor discriminators |
relations | Categorize accounts by their role |
account-usage | Find all instructions using an account |
links | Find instructions linking two accounts |
pda-graph | Visualize PDA derivation paths |
type-graph | Visualize field-to-account relationships |
connect | Analyze how to connect new accounts |
Data Commands
Section titled “Data Commands”a4 idl summary
Section titled “a4 idl summary”Show a high-level overview of the program.
# Get a quick summarya4 idl summary meteora_dlmm.json# Output: Name: meteora_dlmm, Format: modern, Instructions: 74, Constants: 30Shows program name, IDL format (modern or legacy), program address, version, and counts for all sections.
a4 idl instructions
Section titled “a4 idl instructions”List all instructions defined in the IDL.
# List all instructionsa4 idl instructions ore.json
# Count instructions via JSONa4 idl instructions ore.json --json | jq length# Output: 19Options:
| Flag | Description |
|---|---|
--json | Output as JSON (machine-readable) |
a4 idl instruction
Section titled “a4 idl instruction”Show detailed information about a specific instruction, including its discriminator, accounts, and arguments.
# Detail view for an instructiona4 idl instruction ore.json deposit
# Fuzzy matching on typosa4 idl instruction ore.json depositt# Error: instruction 'depositt' not found, did you mean: deposit?Options:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl accounts
Section titled “a4 idl accounts”List all account structures defined in the IDL.
# List all accountsa4 idl accounts meteora_dlmm.jsonOptions:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl account
Section titled “a4 idl account”Show the detailed field layout of a specific account type.
# View account fields and typesa4 idl account meteora_dlmm.json lb_pairOptions:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl types
Section titled “a4 idl types”List all custom types and enums.
# List all custom typesa4 idl types ore.jsonOptions:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl type
Section titled “a4 idl type”Show the full definition of a custom type or enum.
# View type detailsa4 idl type ore.json ConfigOptions:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl errors
Section titled “a4 idl errors”List all custom program errors with their codes and messages.
# List all errorsa4 idl errors meteora_dlmm.jsonOptions:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl events
Section titled “a4 idl events”List all events emitted by the program.
# List all eventsa4 idl events meteora_dlmm.jsonOptions:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl constants
Section titled “a4 idl constants”List all constants defined in the program.
# List all constantsa4 idl constants ore.jsonOptions:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl search
Section titled “a4 idl search”Perform a fuzzy search across instructions, accounts, types, errors, events, and constants.
# Search for anything related to "swap"a4 idl search meteora_dlmm.json swap
# Use JSON to see where matches were founda4 idl search meteora_dlmm.json swap --json | jq '.[].section' | sort -u# Output: "error", "event", "instruction", "type"Options:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl discriminator
Section titled “a4 idl discriminator”Compute the Anchor discriminator for an instruction or account.
# Compute instruction discriminator (global namespace)a4 idl discriminator pump.json buy# Output: Name: buy, Namespace: global, Discriminator: [66, 06, 3d, 12, 01, da, eb, ea]
# Compute account discriminator (account namespace)a4 idl discriminator pump.json LastIdlBlockOptions:
| Flag | Description |
|---|---|
--json | Output as JSON |
Relationship Commands
Section titled “Relationship Commands”a4 idl relations
Section titled “a4 idl relations”Analyze and categorize all accounts in the IDL.
# See how accounts are categorizeda4 idl relations meteora_dlmm.json
# Find core entity accountsa4 idl relations meteora_dlmm.json --json | jq '.[] | select(.category == "Entity") | .account_name'# Output includes: "lb_pair"Accounts are classified into:
- Entity: Core data accounts that appear across many instructions.
- Infrastructure: System programs or token programs.
- Role: Authorities, signers, or administrative accounts.
- Other: Miscellaneous accounts.
Options:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl account-usage
Section titled “a4 idl account-usage”Find every instruction that uses a specific account.
# See where 'lb_pair' is useda4 idl account-usage meteora_dlmm.json lb_pair
# Count usagesa4 idl account-usage meteora_dlmm.json lb_pair --json | jq length# Output: 59Instructions are grouped by the role the account plays: Writable, Signer, or Readonly.
Options:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl links
Section titled “a4 idl links”Find instructions that involve a specific pair of accounts. This is useful for discovering how two entities interact.
# Find instructions linking 'round' and 'entropyVar'a4 idl links ore.json round entropyVar
# Count shared instructionsa4 idl links ore.json round entropyVar --json | jq length# Output: 2Options:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl pda-graph
Section titled “a4 idl pda-graph”Extract and visualize the PDA (Program Derived Address) derivation graph.
# Extract PDA grapha4 idl pda-graph idl.jsonShows seeds (constants, accounts, or arguments) used to derive each PDA account.
Options:
| Flag | Description |
|---|---|
--json | Output as JSON |
a4 idl type-graph
Section titled “a4 idl type-graph”Analyze field types to find implicit references to account types.
# Extract type reference grapha4 idl type-graph idl.jsonUseful for identifying when a field named lb_pair (type Pubkey) refers to an account of type LbPair.
Options:
| Flag | Description |
|---|---|
--json | Output as JSON |
Connection Command
Section titled “Connection Command”a4 idl connect
Section titled “a4 idl connect”Analyze how a new account can be connected to existing accounts in the program.
# Analyze connection between reward_vault and lb_paira4 idl connect meteora_dlmm.json reward_vault --existing lb_pair
# With Arete-specific suggestionsa4 idl connect meteora_dlmm.json reward_vault --existing lb_pair --suggest-a4# Shows: register_from suggestions
# Partial success handlinga4 idl connect ore.json entropyVar --existing round,bogus_account# Warning: account 'bogus_account' not found in IDL, skipping# (then shows connections to round)Options:
| Flag | Description |
|---|---|
--existing <names> | Comma-separated list of existing account names |
--json | Output as JSON |
--suggest-a4 | Show Arete integration suggestions (register_from, aggregate) |