Skip to content
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

[Feature] Command Line Interface (CLI) #177

Merged
merged 152 commits into from
Oct 31, 2024
Merged

[Feature] Command Line Interface (CLI) #177

merged 152 commits into from
Oct 31, 2024

Conversation

Buckram123
Copy link
Contributor

@Buckram123 Buckram123 commented Aug 8, 2023

cw-orch-cli is a chain-agnostic interactive cli for cosmos chains, with main focus on wasm operations
Currently supported features:

Key management

CLI allows managing keys, using platform-specific secure store. Saved keys are used to perform signing transactions of other CLI commands

Add key

Add key command saves provided(or generated) key to cw-orch keyring

  • Generate new random key : cw-orch-cli key add [NAME] new
  • Recover from seed phrase: cw-orch-cli key add [NAME] from-seed

Show seed of saved key

Show seed command loads saved seed phrase from cw-orch keyring and outputs it

  • Shows seed phrase of the key cw-orch-cli key show [NAME]

Remove key

Remove key command deletes entry of provided key-id from the cw-orch keyring

  • Removes key: cw-orch-cli key remove [NAME]

Cosmwasm

Queries

  • Smart wasm query: cw-orch-cli action [CHAIN-ID] cw query smart [CONTRACT_ADDR] [MSG-TYPE] [MSG]

Transactions

  • Store wasm contract: cw-orch-cli action [CHAIN-ID] cw tx store [WASM_PATH] [SIGNER]
  • Instantiate wasm contract: cw-orch-cli [CHAIN-ID] action cw tx instantiate [CODE_ID] [MSG_TYPE] [MSG] [ADMIN] [LABEL] [COINS] [SIGNER]
  • Execute wasm cw-orch-cli [CHAIN-ID] action cw tx execute [CONTRACT_ADDR] [MSG_TYPE] [MSG] [COINS] [SIGNER]

Arguments details:

  • [NAME]: chosen by user key-id that will be used to sign transactions
  • [CHAIN-ID]: chain id
  • [CONTRACT_ADDR]: Address of the contract
  • [WASM-PATH]: Path to the wasm file of the contract to upload
  • [SIGNER]: key-id from cw-orch keyring that will be used to sign transaction
  • [MSG-TYPE]: in which type [MSG] will be provided, options: json-msg: Valid JSON string (e.g. {"foo": "bar"}), base64-msg: Base64-encoded string (e.g. eyJmb28iOiJiYXIifQ==)
  • [MSG]: the message either in json or base64 encoded format(based on MSG-TYPE)
  • [COINS]: list of coins to be attached to this transaction

Demo of interactivity:

Instantiate

Execute and queries

[New] Selecting chain

packages/cw-orch-cli-derive/src/lib.rs Outdated Show resolved Hide resolved
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 10, 2023

Deploying cw-orchestrator with  Cloudflare Pages  Cloudflare Pages

Latest commit: f7549cd
Status: ✅  Deploy successful!
Preview URL: https://cf992615.cw-orchestrator.pages.dev
Branch Preview URL: https://feat-orch-cli.cw-orchestrator.pages.dev

View logs

cw-orch/Cargo.toml Outdated Show resolved Hide resolved
@CyberHoward
Copy link
Contributor

Is there a way to provide a custom network / grpc url?

@Buckram123
Copy link
Contributor Author

Is there a way to provide a custom network / grpc url?

Not yet, didn't want to add too complicated customization during CLI usage or implement parser from a file into ChainInfo just for CLI, as cw-orch may benefit storing custom networks/network configs in a file as well! See ORC-95

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.7%. Comparing base (1fae9a9) to head (ecca95d).

Additional details and impacted files
Files with missing lines Coverage Δ
cw-orch-daemon/src/state.rs 65.5% <ø> (ø)

Copy link
Contributor

@Kayanski Kayanski left a comment

Choose a reason for hiding this comment

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

Let's include that inside the cw-orch repo !

cw-orch-cli/src/log/mod.rs Outdated Show resolved Hide resolved
@Kayanski
Copy link
Contributor

Kayanski commented Oct 8, 2024

I got this error, is that documented ?

Select one of the options with up-down arrows and press enter to select action 🔑 Keys
Select key action 📝 Add key to the keyring
Id of they key local
How you want to create a new key? Recover key from the seed phrase
Mnemonic 🔑: ********

Your console command: cw-orch-cli key add local from-seed
Error: Platform secure storage failure: zbus error: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection

Caused by:
0: zbus error: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection
1: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection

Location:
cw-orch-cli/src/commands/keys/add_key/mod.rs:93:9

@Buckram123
Copy link
Contributor Author

I got this error, is that documented ?

Select one of the options with up-down arrows and press enter to select action 🔑 Keys
Select key action 📝 Add key to the keyring
Id of they key local
How you want to create a new key? Recover key from the seed phrase
Mnemonic 🔑: ********

Your console command: cw-orch-cli key add local from-seed Error: Platform secure storage failure: zbus error: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection

Caused by: 0: zbus error: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection 1: org.freedesktop.Secret.Error.IsLocked: Cannot create an item in a locked collection

Location: cw-orch-cli/src/commands/keys/add_key/mod.rs:93:9

Yep:

- Access to keyring

@Kayanski Kayanski merged commit 51edcce into main Oct 31, 2024
12 of 15 checks passed
@Kayanski Kayanski deleted the feat/orch-cli branch October 31, 2024 09:20
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.

3 participants