hermes
hermes copied to clipboard
Improve `hermes keys balance` command to output more information
Closes: #2726
Description
The command hermes keys balance
only output the balance of the config's gas_price
denomination.
This PR adds an optional flag --denom
which allows the user to specify the denomination desired, as well as a special argument for the new flag all
which lists the balance for all denominations.
Testing
In order to test the new flag first setup the environment using gm, with the following gm.toml
:
[global]
add_to_hermes = false
auto_maintain_config = true
extra_wallets = 2
gaiad_binary = "/Users/luca/go/bin/gaiad"
hdpath = ""
home_dir = "/Users/luca/.gm"
ports_start_at = 27000
validator_mnemonic = ""
wallet_mnemonic = ""
[global.hermes]
binary = "$HOME/.hermes/bin/hermes"
config = "$HOME/.hermes/config.toml"
log_level = "info"
telemetry_enabled = true
telemetry_host = "127.0.0.1"
telemetry_port = 3001
[ibc-0]
ports_start_at = 27010
[ibc-1]
ports_start_at = 27020
[ibc-2]
ports_start_at = 27030
[ibc-3]
ports_start_at = 27040
[node-0]
add_to_hermes = true
network = "ibc-0"
ports_start_at = 27050
[node-1]
add_to_hermes = true
network = "ibc-1"
ports_start_at = 27060
[node-2]
add_to_hermes = true
network = "ibc-2"
ports_start_at = 27070
[node-3]
add_to_hermes = true
network = "ibc-3"
ports_start_at = 27080
Run the following commands:
-
gm start
-
gm hermes config
-
gm hermes keys
The denom specified in the Hermes config.toml
file should be stake
(gas_price = { price = 0.01, denom = 'stake' }
).
The following commands have different results :
-
hermes keys balance --chain ibc-1
- Outputs the balance in
stake
for the user specified in the Hermesconfig.toml
(key_name = 'wallet'
)
- Outputs the balance in
-
hermes keys --chain ibc-1 --denom samoleans
- Outputs the balance in
samoleans
for the user specified in the Hermesconfig.toml
(key_name = 'wallet'
)
- Outputs the balance in
-
hermes keys --chain ibc-1 --denom all
- Outputs the balance for
stake
andsamoleans
for the user specified in the Hermesconfig.toml
(key_name = 'wallet'
)
- Outputs the balance for
-
hermes keys --chain ibc-1 --denom inventeddenom
- Outputs an error since the denom
inventeddenom
doesn't exist
- Outputs an error since the denom
PR author checklist:
- [ ] Added changelog entry, using
unclog
. - [ ] Added tests: integration (for Hermes) or unit/mock tests (for modules).
- [x] Linked to GitHub issue.
- [ ] Updated code comments and documentation (e.g.,
docs/
). - [ ] Tagged one reviewer who will be the one responsible for shepherding this PR.
Reviewer checklist:
- [ ] Reviewed
Files changed
in the GitHub PR explorer. - [ ] Manually tested (in case integration/unit/mock tests are absent).