Update bond list CLI for owner filter

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,8 +66,8 @@ services:
## Gas and Fees ## 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 - `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 - 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`: - `fees` have to be paid by sender to allow the transaction into the mempool and is calculated using `gasPrice`:
@ -77,10 +77,11 @@ services:
``` ```
- Typically, validators / full nodes set `min-gas-prices` to only allow txs providing minimum amount of fees - 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: - Using `cosmjs`, 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) - 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 and fees is calculated by simulating the tx) - 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)
- 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`: - As such, following `gas`, `fees` and `gasPrice` combinations can be used in `laconic-registry-cli`:
- Gas set, fees set to `Xalnt`: - Gas set, fees set to `Xalnt`:
@ -104,8 +105,9 @@ services:
``` ```
- `gas` config ignored - `gas` config ignored
- uses `auto` fee calculation using gas estimation with default multiplier value from `registry-sdk` - 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 fails mid-execution if it runs out of given gas - 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`: - Fees set to a `X` (without `alnt` suffix), gas price set to `Yalnt`:
```bash ```bash
@ -117,7 +119,8 @@ services:
- `gas` config ignored - `gas` config ignored
- uses `auto` fee calculation using gas estimation with `fees` as the multiplier - 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: - Fees and gas price both not set:
```bash ```bash
@ -128,7 +131,8 @@ services:
``` ```
- `gas` config ignored - `gas` config ignored
- Throws error: - uses `auto` fee calculation using gas estimation
- throws error:
```bash ```bash
Gas price must be set in the client options when auto gas is used. 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 }); const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
let result: any;
const { owner } = argv; 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); queryOutput(result, argv.output);
}; };