feat: add DecodeContext with builder pattern#234
Open
Mmesolove wants to merge 1 commit into
Open
Conversation
…e pipeline - Add DecodeContext struct with network, verbosity, and output_format fields - Add DecodeContextBuilder with From<&NetworkConfig> convenience impl - Add OutputFormat enum (human/json/compact/short) replacing raw &str - Update decode_transaction / decode_transaction_with_op_filter to accept &DecodeContext - Update contract_error::resolve to accept &DecodeContext, delegates to network internally - Export DecodeContext, DecodeContextBuilder, OutputFormat from prism_core - Update CLI decode and inspect commands to build DecodeContext from parsed args No global state or hardcoded values remain in the decode pipeline.
Author
|
please review and merge. |
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.
Closes #233
Summary
Adds a
DecodeContextstruct that carries all runtime configuration — network, RPC URL (viaNetworkConfig), verbosity level, and output format — through the entire decode pipeline. Eliminates hardcoded values and global state in analyzers.Changes
crates/core/src/decode/decode_context.rs(new):DecodeContextstruct,DecodeContextBuilderwithFrom<&NetworkConfig>convenience impl, andOutputFormatenum (human / json / compact / short).crates/core/src/decode/mod.rs:decode_transactionanddecode_transaction_with_op_filternow accept&DecodeContextinstead of&NetworkConfig. Re-exports the three new types.crates/core/src/decode/contract_error.rs:resolveaccepts&DecodeContext; delegates to the privateresolve_with_networkfor the actual network call.crates/core/src/lib.rs: ExportsDecodeContext,DecodeContextBuilder,OutputFormat.crates/cli/src/commands/decode.rs: BuildsDecodeContextfrom parsed CLI args and passes&ctxdown.crates/cli/src/commands/inspect.rs: Same treatment as decode.What was tested
DecodeContext.