Skip to content

Conversation

@Daanvdplas
Copy link
Collaborator

@Daanvdplas Daanvdplas commented Nov 4, 2025

Closes #710

@Daanvdplas Daanvdplas requested a review from Copilot November 4, 2025 16:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_args to accept and utilize existing arguments, prompting only for missing ones
  • Added similar functionality to chain calls via the new resolve_function_args method
  • 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_args parameter. 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.

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 86.53061% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.04%. Comparing base (c6ed092) to head (cef7dbd).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/pop-cli/src/commands/call/chain.rs 80.00% 7 Missing and 5 partials ⚠️
crates/pop-cli/src/common/contracts.rs 82.81% 7 Missing and 4 partials ⚠️
crates/pop-cli/src/commands/call/contract.rs 93.10% 3 Missing and 5 partials ⚠️
crates/pop-cli/src/commands/up/contract.rs 0.00% 2 Missing ⚠️
@@            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     
Files with missing lines Coverage Δ
crates/pop-chains/src/call/metadata/mod.rs 89.55% <100.00%> (ø)
crates/pop-cli/src/commands/up/contract.rs 13.97% <0.00%> (ø)
crates/pop-cli/src/commands/call/contract.rs 71.79% <93.10%> (+2.36%) ⬆️
crates/pop-cli/src/common/contracts.rs 73.80% <82.81%> (+2.38%) ⬆️
crates/pop-cli/src/commands/call/chain.rs 68.21% <80.00%> (+0.82%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Daanvdplas Daanvdplas requested a review from tsenovilla November 5, 2025 08:27
* refactor: manual weight

* fix: docs and issue tommy

* fix: ci
Copy link
Collaborator

@tsenovilla tsenovilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

Tested it with the pop-mcp server and it now works like a charm!! lfg!🚀🚀

@Daanvdplas Daanvdplas merged commit f05fd7c into main Nov 7, 2025
22 of 23 checks passed
@Daanvdplas Daanvdplas deleted the daan/fix-contract_interaction branch November 7, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pop call contract not working properly

4 participants