Add custom IDL support and parse_instruction_with_idl#2
Closed
shahan-khatchadourian-anchorage wants to merge 3 commits into
Closed
Add custom IDL support and parse_instruction_with_idl#2shahan-khatchadourian-anchorage wants to merge 3 commits into
shahan-khatchadourian-anchorage wants to merge 3 commits into
Conversation
2 tasks
8248d99 to
6df6928
Compare
Closed
Allow callers to pass custom IDL JSON strings for any program with optional override of built-in IDLs. Returns SHA256 hash of compressed IDL and source tracking (built-in vs custom) for verification. Key changes: - Add optional custom_idls parameter to parse_transaction() - Add ProgramType enum for 13 built-in IDL types - Add IdlSource and idl_hash fields to SolanaParsedInstructionData - Add compute_idl_hash() for IDL verification - Update CLI to accept --custom-idl flag with optional --override - Maintain backward compatibility (existing calls add , None)
- Add embedded_idls.rs with include_str!() for all 13 IDL files - Add ProgramType::all() and ProgramType::idl_json() methods - Create CustomIdl enum (Parsed/Json) and CustomIdlConfig struct - Add parse_transaction_with_idls() as new preferred API - Update IdlRecord to use program_type instead of file_path - Eliminate runtime file system access for built-in IDLs This fixes the bug where IDL lookups failed when running from directories other than the project root.
Add a new public function that allows parsing individual Solana instruction data using a provided IDL, without requiring full transaction context. This enables parsing instruction data in isolation when only the raw bytes and IDL are available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6df6928 to
e8637bc
Compare
a8d785b to
92de94e
Compare
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
This PR carries forward work originally authored by @prasincs, pending as tkhq/solana-parser#20. It is being opened here on the anchorageoss fork to unblock downstream work that depends on these features.
CustomIdlConfig,CustomIdl,construct_idl_records_map— allows callers to provide their own IDL (either pre-parsed or as JSON) alongside or instead of built-in IDLsparse_instruction_with_idl: parses a raw instruction byte slice against a providedIdlstruct without requiring full transaction contextAttribution
All commits in this PR are authored by @prasincs. This PR recreates his pending upstream PR on this repo.
Merge order
This PR should merge before #1, which adds the
proptestfeature on top of these changes.Test plan
visualsign-parserpipeline integration tests pass with these features enabled🤖 Generated with Claude Code