Add hand-written Anchor-compatible IDL#65
Draft
kaze-cow wants to merge 1 commit into
Draft
Conversation
Describes the settlement program's instructions/accounts/types for IDL-driven tooling (e.g. Solscan), since this is a native/Pinocchio program rather than an Anchor program and has no generated IDL. Several spots can't be fully expressed in the IDL grammar and are documented inline via `docs` fields instead: BeginSettle's dynamically-shaped tail (order count/bumps/transfer counts/pull amounts, which have no Borsh-expressible layout), and order_pda's PDA seed (a sha256 hash of the whole intent argument, not a plain field/account reference). Draft: we don't yet have a cheap way to validate that this IDL is actually correct - e.g. that it can build parsable/successful transactions for each instruction, and successfully parse real account data. That validation is intended as fast-follow work. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
programs/settlement/idl/cow_settlement.json) describing the settlement program's instructions/accounts/types, for IDL-driven tooling (e.g. Solscan). This program is native/Pinocchio, not Anchor, so there's no generated IDL to start from.docsfields instead:BeginSettle's dynamically-shaped tail (order count / bumps / transfer counts / pull amounts) has no Borsh-expressible layout (no length prefixes, and a trailing array whose length is the sum of an earlier array).order_pda's PDA seed issha256(intent_bytes)— a hash of the whole instruction argument, not a plain field/account reference the PDA-seed grammar can point at.create_buffer's account list is padded to a chosen maximum (15) of indexed(buffer_pda_i, mint_i)pairs, since the real instruction accepts an unbounded number of them via remaining accounts.Stacked on #64 (discriminators), which is itself stacked on #63 (little-endian encoding) — the IDL only makes sense once both land.
Draft — why
We don't yet have a cheap way to actually validate this IDL against the real program: e.g. that it can build parsable/successful transactions for every defined instruction, and successfully parse real account data pulled from a running program. That validation is planned as fast-follow work; marking this draft until we have it.
Test plan
python3 -m json.tool)🤖 Generated with Claude Code