Add OKX Router Solana preset#351
Draft
kyle-anchorage wants to merge 1 commit into
Draft
Conversation
OKX Router (proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u) swaps were falling through to the unknown-program catch-all, so signers saw raw instruction bytes instead of decoded instruction names, accounts, and arguments. This adds an IDL-backed visualizer so OKX Router instructions render with structured fields. User prompt: add okx router program Co-Authored-By: Claude <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.
1. Why this PR exists
OKX Router (
proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u) swaps on Solana fell through to the unknown-program catch-all visualizer. Signers saw raw instruction bytes instead of a decoded instruction name, named accounts, and arguments — making it hard to verify what they were signing.This adds an IDL-backed preset so OKX Router instructions render as structured, human-readable fields.
2. What changed
presets/okx_router/withOkxRouterVisualizer, following the existing IDL-preset pattern (mirrorsneutral_trade).okx_router.json, ~3.5k lines) viainclude_str!; the visualizer parses instructions withparse_instruction_with_idlagainst the bundled IDL.SolanaIntegrationConfigregisters the program with a"*" -> "*"wildcard so all OKX Router instructions route to this visualizer.pub mod okx_router;topresets/mod.rs— thebuild.rsscript auto-discovers the directory and wiresOkxRouterVisualizerintoavailable_visualizers().3. Why this is safe
pub modline. Before this, OKX Router txs hit the unknown-program catch-all; now they hit a dedicated visualizer. No other chain or program is affected.InstructionVisualizer+SolanaIntegrationConfig+build.rsauto-discovery mechanism already used by every other Solana preset, so it inherits their behavior and routing.VisualSignErrorrather than panicking or mis-rendering. Decoding failures surface as errors; the field carries a raw-hex fallback so nothing is silently dropped.Checks run (by agent)
cargo test -p visualsign-solana okx— 4 passed (IDL loads, all discriminators are 8 bytes, unknown discriminator errors, short data errors)cargo clippy -p visualsign-solana --all-targets -- -D warnings— cleancargo fmt --check -p visualsign-solana— cleanManual steps needed (by human)
None — fully automated by CI.
4. How this is maintainable
neutral_trade,metadao_futarchy), so a fresh developer recognizes the pattern immediately. Thesolana-add-idlskill documents how to add more.build.rsdirectory scanning — no central registry to keep in sync; the directory name (okx_router) deterministically maps toOkxRouterVisualizer.🤖 Generated with Claude Code