Update all CLI commands
Some checks failed
Lint / lint (18.x) (pull_request) Successful in 1m8s
Tests / cli_tests (18.x) (pull_request) Failing after 1m11s

This commit is contained in:
Prathamesh Musale 2024-08-23 14:00:58 +05:30
parent 02057d891a
commit f99f222162
29 changed files with 60 additions and 43 deletions

View File

@ -26,6 +26,7 @@
# Update the gas value in config.yml
# gas: 500000
# fees: 500000alnt
# Get user private key
laconicd keys export alice --unarmored-hex --unsafe --keyring-backend test --home ~/.laconicd

View File

@ -46,7 +46,7 @@ async function main () {
let rpcEndpoint, gqlEndpoint, chainId: string;
({ rpcEndpoint, gqlEndpoint, userKey, bondId, chainId } = getConnectionInfo(argv, registryConfig));
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
fee = getGasAndFees(argv, registryConfig);
await processDir(path.resolve(recordsDir));

View File

@ -23,7 +23,7 @@ export const handler = async (argv: Arguments) => {
address = account.address;
}
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const result = await registry.getAccounts([address]);
queryOutput(result, argv.output);

View File

@ -5,7 +5,7 @@ import { Account, createBid, Registry } from '@cerc-io/registry-sdk';
import { ensureDir } from 'fs-extra';
import fs from 'fs';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../../util';
const OUT_DIR = 'out';
@ -40,7 +40,8 @@ export const handler = async (argv: Arguments) => {
await ensureDir(outDirPath);
fs.writeFileSync(revealFilePath, JSON.stringify(reveal, undefined, 2));
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.commitBid({ auctionId, commitHash }, privateKey, fee);

View File

@ -4,7 +4,7 @@ import path from 'path';
import { Registry } from '@cerc-io/registry-sdk';
import fs from 'fs';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../../util';
export const command = 'reveal [auction-id] [file-path]';
@ -23,7 +23,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const reveal = fs.readFileSync(path.resolve(filePath));

View File

@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const result = await registry.getAuctionsByIds([id as string]);
queryOutput(result, argv.output);

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../../util';
export const command = 'set [name] [bond-id]';
@ -21,7 +21,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.setAuthorityBond({ name, bondId }, privateKey, fee);
const success = '{"success": true}';

View File

@ -22,7 +22,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const result = await registry.getAuthorities(argv.owner as string);
queryOutput(result, argv.output);

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
export const command = 'reserve [name]';
@ -27,7 +27,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.reserveAuthority({ name, owner }, privateKey, fee);

View File

@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const result = await registry.lookupAuthorities([name], true);
queryOutput(result, argv.output);

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
export const command = 'associate';
@ -27,7 +27,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.associateBond({ recordId: id, bondId }, privateKey, fee);
const success = '{"success": true}';

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
export const command = 'cancel';
@ -19,7 +19,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.cancelBond({ id }, privateKey, fee);
const success = '{"success": true}';

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
export const command = 'dissociate';
@ -19,7 +19,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.dissociateBond({ recordId: id }, privateKey, fee);
const success = '{"success": true}';

View File

@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const result = await registry.getBondsByIds([id as string]);

View File

@ -21,7 +21,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const { owner } = argv;
const result = await registry.queryBonds({ owner });

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../../util';
export const command = 'dissociate';
@ -25,7 +25,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.dissociateRecords({ bondId }, privateKey, fee);
const success = '{"success": true}';

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../../util';
export const command = 'reassociate';
@ -30,7 +30,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.reassociateRecords({ oldBondId, newBondId }, privateKey, fee);
const success = '{"success": true}';

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
export const command = 'refill';
@ -33,7 +33,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.refillBond({ id, denom, amount }, privateKey, fee);
const success = '{"success": true}';

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
export const command = 'withdraw';
@ -33,7 +33,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.withdrawBond({ id, denom, amount }, privateKey, fee);
const success = '{"success": true}';

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
export const command = 'delete [name]';
@ -19,7 +19,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.deleteName({ lrn: name }, privateKey, fee);

View File

@ -24,7 +24,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const result = await registry.lookupNames([name], argv.history as boolean);
queryOutput(result, argv.output);

View File

@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
let result = await registry.resolveNames([name]);
result = result.filter((v: any) => v);

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
export const command = 'set [name] [id]';
@ -21,7 +21,8 @@ export const handler = async (argv: Arguments) => {
assert(privateKey, 'Invalid Transaction Key.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.setName({ lrn: name, cid: id }, privateKey, fee);

View File

@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const result = await registry.getRecordsByIds([id as string]);
queryOutput(result, argv.output);

View File

@ -42,7 +42,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
let result = await registry.queryRecords({ ...filters, type, name }, all as boolean);

View File

@ -4,7 +4,7 @@ import yaml from 'js-yaml';
import fs from 'fs';
import { Registry } from '@cerc-io/registry-sdk';
import { getConfig, getGasAndFees, getConnectionInfo, txOutput } from '../../../util';
import { getConfig, getGasAndFees, getConnectionInfo, getGasPrice, txOutput } from '../../../util';
export const command = 'publish';
@ -43,7 +43,9 @@ export const handler = async (argv: Arguments) => {
}
}
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const fee = getGasAndFees(argv, registryConfig);
const result = await registry.setRecord({ privateKey: userKey, record, bondId }, txKey || userKey, fee);

View File

@ -15,7 +15,7 @@ export const handler = async (argv: Arguments) => {
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
assert(chainId, 'Invalid registry Chain ID.');
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const result = await registry.getStatus();
console.log(JSON.stringify(result, undefined, 2));

View File

@ -30,7 +30,7 @@ export const handler = async (argv: Arguments) => {
const account = new Account(Buffer.from(privateKey, 'hex'));
await account.init();
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
const laconicClient = await registry.getLaconicClient(account);
const txResponse: IndexedTx | null = await laconicClient.getTx(hash);

View File

@ -4,7 +4,7 @@ import assert from 'assert';
import { Account, Registry, DEFAULT_GAS_ESTIMATION_MULTIPLIER } from '@cerc-io/registry-sdk';
import { DeliverTxResponse } from '@cosmjs/stargate';
import { getConfig, getConnectionInfo, getGasAndFees, queryOutput } from '../../../util';
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, queryOutput } from '../../../util';
export const command = 'send';
@ -39,7 +39,8 @@ export const handler = async (argv: Arguments) => {
await account.init();
const fromAddress = account.address;
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
const gasPrice = getGasPrice(argv, registryConfig);
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId, gasPrice });
const laconicClient = await registry.getLaconicClient(account);
const fee = getGasAndFees(argv, registryConfig);