fix: chain & contract manual interaction#712
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances argument handling for contract and chain function calls by allowing pre-provided CLI arguments to be merged with interactive prompts. The refactoring enables users to supply some arguments via --args and be prompted only for missing ones, rather than being forced to provide all arguments or none.
Key changes:
- Modified
request_contract_function_argsto accept and utilize existing arguments, prompting only for missing ones - Added similar functionality to chain calls via the new
resolve_function_argsmethod - Added validation to error when too many arguments are provided
- Removed unused imports and simplified test setup
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/pop-cli/src/common/contracts.rs | Enhanced request_contract_function_args to accept existing args, prompt for missing ones, and validate argument count; cleaned up unused test imports |
| crates/pop-cli/src/commands/up/contract.rs | Updated to pass existing args to request_contract_function_args for partial argument resolution |
| crates/pop-cli/src/commands/call/contract.rs | Modified to use partial argument resolution; added test coverage for the new behavior |
| crates/pop-cli/src/commands/call/chain.rs | Refactored argument handling into resolve_function_args method with similar partial resolution logic; added tests |
| crates/pop-chains/src/call/metadata/mod.rs | Added missing semicolons to return statements for consistency |
Comments suppressed due to low confidence (1)
crates/pop-cli/src/common/contracts.rs:112
- The documentation is missing the new
existing_argsparameter. Please add a documentation line such as:/// *existing_args- Optional slice of pre-provided argument values.
/// # Arguments
/// * `function` - The contract function containing argument definitions.
/// * `cli` - Command line interface implementation for user interaction.
///
/// # Returns
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #712 +/- ##
==========================================
+ Coverage 76.96% 77.04% +0.08%
==========================================
Files 111 111
Lines 25250 25418 +168
Branches 25250 25418 +168
==========================================
+ Hits 19433 19583 +150
- Misses 3761 3774 +13
- Partials 2056 2061 +5
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
* refactor: manual weight * fix: docs and issue tommy * fix: ci
tsenovilla
left a comment
There was a problem hiding this comment.
Amazing!
Tested it with the pop-mcp server and it now works like a charm!! lfg!🚀🚀
Closes #710