Update bond list CLI for owner filter
Some checks failed
Lint / lint (18.x) (pull_request) Successful in 1m12s
Tests / cli_tests (18.x) (pull_request) Failing after 1m13s

This commit is contained in:
Prathamesh Musale 2024-08-27 18:02:01 +05:30
parent 705bf0257a
commit 743f5ebc3c
2 changed files with 28 additions and 17 deletions

View File

@ -66,21 +66,22 @@ services:
## Gas and Fees
<https://docs.cosmos.network/v0.50/learn/beginner/gas-fees>
- Gas and fees in `cosmos-sdk`:
- <https://docs.cosmos.network/v0.50/learn/beginner/gas-fees>
- `gas` is a special unit that is used to track the consumption of resources during execution of a transaction
- The maximum value a tx is allowed to consume can be capped by setting `gas` in the config
- `fees` have to be paid by sender to allow the transaction into the mempool and is calculated using `gasPrice`:
- `gas` is a special unit that is used to track the consumption of resources during execution of a transaction
- The maximum value a tx is allowed to consume can be capped by setting `gas` in the config
- `fees` have to be paid by sender to allow the transaction into the mempool and is calculated using `gasPrice`:
```bash
fees = gas * gasPrice
```
```bash
fees = gas * gasPrice
```
- Typically, validators / full nodes set `min-gas-prices` to only allow txs providing minimum amount of fees
- Using `cosmjs`, there are two ways max fees amount can be given for a tx:
- Either by specifying `fees` and `gas` (in which case `fees` should be >= `gas` * `min-gas-price`)
- Or by specifying a `gasPrice` (in which case `gasPrice` should be >= `min-gas-price` set by the node and fees is `auto` calculated by simulating the tx)
- Typically, validators / full nodes set `min-gas-prices` to only allow txs providing minimum amount of fees
- There are two ways max fees amount can be given for a tx:
- Either by specifying `fees` and `gas` in the config (in which case fees should be >= gas * min-gas-price)
- Or by specifying a `gasPrice` (in which case gasPrice should be > min-gas-price and fees is calculated by simulating the tx)
- When using the `auto` fees calculation, the gas estimation by tx simulation is typically multiplied by a multiplier
When using the `auto` fees calculation, the gas estimation by tx simulation is typically multiplied by a multiplier
- As such, following `gas`, `fees` and `gasPrice` combinations can be used in `laconic-registry-cli`:
- Gas set, fees set to `Xalnt`:
@ -104,8 +105,9 @@ services:
```
- `gas` config ignored
- uses `auto` fee calculation using gas estimation with default multiplier value from `registry-sdk`
- tx fails mid-execution if it runs out of given gas
- uses `auto` fee calculation using gas estimation with [default multiplier](https://git.vdb.to/cerc-io/registry-sdk/src/branch/main/src/constants.ts) value from `registry-sdk`
- tx rejected if given `gasPrice` < `min-gas-price` set by the node
- tx fails mid-execution if it runs out of calculated gas
- Fees set to a `X` (without `alnt` suffix), gas price set to `Yalnt`:
```bash
@ -117,7 +119,8 @@ services:
- `gas` config ignored
- uses `auto` fee calculation using gas estimation with `fees` as the multiplier
- tx fails mid-execution if it runs out of given gas, can be retried with a higher gas estimation multiplier (`fees`)
- tx rejected if given `gasPrice` < `min-gas-price` set by the node
- tx fails mid-execution if it runs out of calculated gas, can be retried with a higher gas estimation multiplier (`fees`)
- Fees and gas price both not set:
```bash
@ -128,7 +131,8 @@ services:
```
- `gas` config ignored
- Throws error:
- uses `auto` fee calculation using gas estimation
- throws error:
```bash
Gas price must be set in the client options when auto gas is used.

View File

@ -23,8 +23,15 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
let result: any;
const { owner } = argv;
const result = await registry.queryBonds({ owner });
if (owner) {
const [bondsByOwnerResult] = await registry.queryBondsByOwner([String(owner)]);
result = bondsByOwnerResult.bonds;
} else {
result = await registry.queryBonds();
}
queryOutput(result, argv.output);
};