-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: allow users to specify custom contract metadata files #347
Conversation
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.
Looks good, think there can be some quick improvements to the code to improve readability and reduce complexity.
As mentioned elsewhere, it seems as though any contract artifact can be used (.contract, .json, .wasm), so perhaps the terminology should be adapted accodingly?
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.
Used this contract to test it out - https://github.com/r0gue-io/faucet-contract
⚙ pop call contract --path ./metadata/faucet.contract --contract 5CwTqjdN28XfcTGsaC5VbyxP8wHAfbaKMwhhGA9bNJjaSDUJ --message drip --url wss://rpc1.paseo.popnetwork.xyz/ --suri //Alice --dry_run
│
└ Anyhow error: Error invoking `cargo metadata` for ./metadata/faucet.contract/Cargo.toml
It seems that we are failing to resolve paths correctly when a location to an artifact is passed directly instead of pointing to a directory.
Regarding the discussion between metadata or artifact. Knowing that the CLI should work just fine regardless of being pointed to a metadata file or the code or the bundle artifact. Maybe artifact does a better job fitting all scenarios.
We also use "artifacts" wording after a successful contract build.
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.
Some suggestions for minor improvements. Also, the .wasm artifact doesnt have any consideration in the tests.
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.
Looks good, thanks for your patience!
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.
Quite nice! Thanks.
Now users can provide any contract artifact and perform their calls without problems!
* feat: guide user for calling a contract * feat: get metadata contract from the contract path * refactor: refactor test and validate address input * fix: apply feedback * feat: prompt to have another call and skip questions for queries * refactor: use Cli module instead of cliclack * test: unit test pop-cli crate * test: unit contracts crate * chore: format * test: refactor and improve test cases * fix: fix todos and refactor * test: fix unit test * feat: parse types of parameters and display it to the user in the placeholder * refactor: error handling for pop call * refactor: display call to be executed after guide and reorder * refactor: when repeat call use same contract values and dont clean screen * test: add dry-run test * test: refactor and add more test coverage * test: more coverage * fix: unit test * feat: dev mode to skip certain user prompts * refactor: test functions, renaming and fix clippy * refactor: improve devex of pop call contract * test: adjust tests to refactor * chore: reset_for_new_call fields * fix: build contract if has not been built * refactor: use command state (#338) Merged set_up_call_config and guide_user_to_call_contract into a single function. Also adds short symbols for arguments. * fix: parse user inputs for Option arguments (#332) * fix: automatically add some or none to Option argument * test: refactor and tests * refactor: improve code and comments * fix: renaming and clean code * chore: option params not mandatory * fix: parse user inputs for Option arguments in constructor (#335) * fix: automatically add some or none to Option argument * fix: tests * refactor: process_function_args * test: update tests accordingly last changes * fix: issue with delimiter * test: fix unit test * refactor: renaming and fix comments * refactor: format types (#339) Shows the full type representation, making it easier to see the entry format of parameter values. * fix: logo doesn't show in README --------- Co-authored-by: Frank Bell <[email protected]> Co-authored-by: Alejandro Martinez Andres <[email protected]> * test: fix unit test * feat: allow users to specify custom contract metadata files (#347) * chore: allow the user specify the metadata file to call a contract * test: unit test to parse metadata from a file * docs: fix docs * refactor: ensure_contract_built after user input path * fix: call contract when metadata file * fix: remove default_input in contract address * docs: rename metadata with artifact * fix: panic at has_contract_been_built * fix: clippy * refactor: keep ensure_contract_built as a CallContractCommand function * fix: ensure_contract_built * docs: improve comments * fix: feedback and include wasm file for testing * fix: clippy * chore: after build contract prompt the user if the contract is already deployed * refactor: ensure_contract_built * refactor: has_contract_been_built function * docs: fix comments and messages * refactor: get_messages and get_constructors * test: fix unit tests call ui --------- Co-authored-by: Frank Bell <[email protected]> Co-authored-by: Alejandro Martinez Andres <[email protected]>
Allow the user to pass the location of the metadata instead of the path of the contract project. There might be cases where the user only has access to the metadata.
Mentioned in #306 (review)