Skip to content

Generate a visited consumer-facing IDL - #501

Open
lorisleiva wants to merge 1 commit into
mainfrom
feat/idl-loopback
Open

Generate a visited consumer-facing IDL#501
lorisleiva wants to merge 1 commit into
mainfrom
feat/idl-loopback

Conversation

@lorisleiva

Copy link
Copy Markdown
Member

This PR separates the raw interface IDL from the consumer-facing IDL.

Pipeline

make generate-idl-interface now:

  1. runs codama-rs and writes the macro-generated tree to interface-idl.json;
  2. runs the Codama CLI's idl script, applying all configured before visitors;
  3. uses @codama/renderers-core#writeIdlVisitor to write the resolved tree to idl.json.

The Makefile owns both steps, so CI regenerates and checks both artifacts deterministically. make generate-clients also runs the idl, js and rust scripts from the same post-visitor tree.

Result

  • interface-idl.json is byte-identical to the previously committed raw idl.json.
  • Consumer-facing idl.json now matches the transformed tree used by client generation:
    • redelegate removed;
    • epoch and unixTimestamp aliases resolved (including date-time display);
    • stakeStateAccount wrapper present;
    • instruction data flattened/unwrapped;
    • no dangling defined-type links.
  • Generated JS/Rust clients remain byte-identical.

Also adds @codama/renderers-core@^1.4.0 and updates codama to ^1.10.2.

Verification

  • IDL generation is idempotent across repeated runs.
  • Builds without Codama; all interface and Codama schema tests pass.
  • Rust fmt/clippy clean with warnings denied.
  • Both IDLs parse as valid JSON.
  • The shared Solana CI setup already installs pnpm dependencies before running the IDL Makefile target.

Separate the raw interface IDL from the consumer-facing IDL. codama-rs now writes its macro-generated output to interface-idl.json, after which the Codama CLI applies the configured before visitors and uses writeIdlVisitor to write the resolved tree to idl.json. The Makefile owns both steps, keeping CI regeneration deterministic. As a result, consumers of idl.json receive the same transformed tree used by client generation, including resolved clock aliases, flattened instruction data and the stake account wrapper, with no dangling defined-type links.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant