-
Notifications
You must be signed in to change notification settings - Fork 40
feat: contract call read #677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This functionality avoids asking the user and accelerates the process
…pop-cli codebase size
…ime-dir-as-command
There was a problem hiding this 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 adds contract storage reading capabilities and refactors the contract call command to make chain URL and signer URI optional parameters. Key changes include:
- New functionality to query and display contract storage values
- Refactored
CallContractCommandto make--urland--surioptional with improved user prompts - Extracted RPC endpoint selection logic into a reusable module
- Enhanced contract metadata parsing to support both functions and storage items
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
crates/pop-contracts/src/utils/metadata.rs |
Adds ContractCallable, ContractStorage types and functions to fetch/parse storage items from contract metadata |
crates/pop-contracts/src/lib.rs |
Exports new storage-related types and functions |
crates/pop-contracts/src/call.rs |
Moves contract parsing before signer creation and token metadata query |
crates/pop-common/src/lib.rs |
Moves #[cfg(feature = "integration-tests")] attribute to correct position |
crates/pop-cli/tests/contract.rs |
Updates test to use --dev flag and simplifies process termination |
crates/pop-cli/src/common/rpc.rs |
New module extracting RPC endpoint selection logic with chain filtering |
crates/pop-cli/src/common/mod.rs |
Adds rpc module to exports |
crates/pop-cli/src/common/chain.rs |
Refactors to use extracted prompt_to_select_chain_rpc function |
crates/pop-cli/src/commands/up/rollup.rs |
Updates configure calls with new select_message parameter |
crates/pop-cli/src/commands/up/contract.rs |
Improves contract deployment flow with better RPC selection and optional parameters |
crates/pop-cli/src/commands/mod.rs |
Passes CLI reference to contract call execution |
crates/pop-cli/src/commands/call/contract.rs |
Major refactor making --url and --suri optional, adding storage reading support |
crates/pop-cli/src/commands/call/chain.rs |
Updates prompts and configure calls with new parameter |
Comments suppressed due to low confidence (1)
crates/pop-cli/src/commands/call/contract.rs:1
- Line 159 evaluates the comparison
self.url == local_urlbut doesn't assign the result to any variable. This appears to be a logic error - the intent seems to be to assign this boolean tostart_local_node, but instead it's just a standalone expression with no effect.
// SPDX-License-Identifier: GPL-3.0
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
al3mart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Mainly a nit about providing a hint implementation for ContractCallable as it was done for CallItem for chains.
I have provided input on some of copilots messages based on what I could see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving as all my feedback has been already incorporated 👍
Thanks, @moliholy :)
AlexD10S
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! So happy to unblock this one and merge it
Closes #678.
This PR:
Screenshots