From f99f2221623b8ec3c8157e3280f101d51a0a9561 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Fri, 23 Aug 2024 14:00:58 +0530 Subject: [PATCH] Update all CLI commands --- demo/README.md | 1 + demo/scripts/publish-records.ts | 2 +- src/cmds/registry-cmds/account-cmds/get.ts | 2 +- src/cmds/registry-cmds/auction-cmds/bid-cmds/commit.ts | 5 +++-- src/cmds/registry-cmds/auction-cmds/bid-cmds/reveal.ts | 5 +++-- src/cmds/registry-cmds/auction-cmds/get.ts | 2 +- src/cmds/registry-cmds/authority-cmds/bond-cmds/set.ts | 5 +++-- src/cmds/registry-cmds/authority-cmds/list.ts | 2 +- src/cmds/registry-cmds/authority-cmds/reserve.ts | 5 +++-- src/cmds/registry-cmds/authority-cmds/whois.ts | 2 +- src/cmds/registry-cmds/bond-cmds/associate.ts | 5 +++-- src/cmds/registry-cmds/bond-cmds/cancel.ts | 5 +++-- src/cmds/registry-cmds/bond-cmds/dissociate.ts | 5 +++-- src/cmds/registry-cmds/bond-cmds/get.ts | 2 +- src/cmds/registry-cmds/bond-cmds/list.ts | 2 +- src/cmds/registry-cmds/bond-cmds/records-cmds/dissociate.ts | 5 +++-- .../registry-cmds/bond-cmds/records-cmds/reassociate.ts | 5 +++-- src/cmds/registry-cmds/bond-cmds/refill.ts | 5 +++-- src/cmds/registry-cmds/bond-cmds/withdraw.ts | 5 +++-- src/cmds/registry-cmds/name-cmds/delete.ts | 5 +++-- src/cmds/registry-cmds/name-cmds/lookup.ts | 2 +- src/cmds/registry-cmds/name-cmds/resolve.ts | 2 +- src/cmds/registry-cmds/name-cmds/set.ts | 5 +++-- src/cmds/registry-cmds/record-cmds/get.ts | 2 +- src/cmds/registry-cmds/record-cmds/list.ts | 2 +- src/cmds/registry-cmds/record-cmds/publish.ts | 6 ++++-- src/cmds/registry-cmds/status.ts | 2 +- src/cmds/registry-cmds/tokens-cmds/gettx.ts | 2 +- src/cmds/registry-cmds/tokens-cmds/send.ts | 5 +++-- 29 files changed, 60 insertions(+), 43 deletions(-) diff --git a/demo/README.md b/demo/README.md index ae9dbe1..3c94faf 100644 --- a/demo/README.md +++ b/demo/README.md @@ -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 diff --git a/demo/scripts/publish-records.ts b/demo/scripts/publish-records.ts index 1f9c643..7f2263a 100644 --- a/demo/scripts/publish-records.ts +++ b/demo/scripts/publish-records.ts @@ -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)); diff --git a/src/cmds/registry-cmds/account-cmds/get.ts b/src/cmds/registry-cmds/account-cmds/get.ts index 192505d..3a60fe4 100644 --- a/src/cmds/registry-cmds/account-cmds/get.ts +++ b/src/cmds/registry-cmds/account-cmds/get.ts @@ -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); diff --git a/src/cmds/registry-cmds/auction-cmds/bid-cmds/commit.ts b/src/cmds/registry-cmds/auction-cmds/bid-cmds/commit.ts index 04a392b..28f0b6f 100644 --- a/src/cmds/registry-cmds/auction-cmds/bid-cmds/commit.ts +++ b/src/cmds/registry-cmds/auction-cmds/bid-cmds/commit.ts @@ -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); diff --git a/src/cmds/registry-cmds/auction-cmds/bid-cmds/reveal.ts b/src/cmds/registry-cmds/auction-cmds/bid-cmds/reveal.ts index 30020c0..e1f1ecc 100644 --- a/src/cmds/registry-cmds/auction-cmds/bid-cmds/reveal.ts +++ b/src/cmds/registry-cmds/auction-cmds/bid-cmds/reveal.ts @@ -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)); diff --git a/src/cmds/registry-cmds/auction-cmds/get.ts b/src/cmds/registry-cmds/auction-cmds/get.ts index 3bd2a12..ee5eae6 100644 --- a/src/cmds/registry-cmds/auction-cmds/get.ts +++ b/src/cmds/registry-cmds/auction-cmds/get.ts @@ -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); diff --git a/src/cmds/registry-cmds/authority-cmds/bond-cmds/set.ts b/src/cmds/registry-cmds/authority-cmds/bond-cmds/set.ts index e1aa8b2..dcc2f62 100644 --- a/src/cmds/registry-cmds/authority-cmds/bond-cmds/set.ts +++ b/src/cmds/registry-cmds/authority-cmds/bond-cmds/set.ts @@ -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}'; diff --git a/src/cmds/registry-cmds/authority-cmds/list.ts b/src/cmds/registry-cmds/authority-cmds/list.ts index b92b59d..19a65ec 100644 --- a/src/cmds/registry-cmds/authority-cmds/list.ts +++ b/src/cmds/registry-cmds/authority-cmds/list.ts @@ -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); diff --git a/src/cmds/registry-cmds/authority-cmds/reserve.ts b/src/cmds/registry-cmds/authority-cmds/reserve.ts index 52bf7bb..4e5be3c 100644 --- a/src/cmds/registry-cmds/authority-cmds/reserve.ts +++ b/src/cmds/registry-cmds/authority-cmds/reserve.ts @@ -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); diff --git a/src/cmds/registry-cmds/authority-cmds/whois.ts b/src/cmds/registry-cmds/authority-cmds/whois.ts index 19f7a77..936c61d 100644 --- a/src/cmds/registry-cmds/authority-cmds/whois.ts +++ b/src/cmds/registry-cmds/authority-cmds/whois.ts @@ -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); diff --git a/src/cmds/registry-cmds/bond-cmds/associate.ts b/src/cmds/registry-cmds/bond-cmds/associate.ts index bfc9e45..1f389ea 100644 --- a/src/cmds/registry-cmds/bond-cmds/associate.ts +++ b/src/cmds/registry-cmds/bond-cmds/associate.ts @@ -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}'; diff --git a/src/cmds/registry-cmds/bond-cmds/cancel.ts b/src/cmds/registry-cmds/bond-cmds/cancel.ts index c2cc21d..e974d77 100644 --- a/src/cmds/registry-cmds/bond-cmds/cancel.ts +++ b/src/cmds/registry-cmds/bond-cmds/cancel.ts @@ -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}'; diff --git a/src/cmds/registry-cmds/bond-cmds/dissociate.ts b/src/cmds/registry-cmds/bond-cmds/dissociate.ts index df69f8e..cf10bdc 100644 --- a/src/cmds/registry-cmds/bond-cmds/dissociate.ts +++ b/src/cmds/registry-cmds/bond-cmds/dissociate.ts @@ -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}'; diff --git a/src/cmds/registry-cmds/bond-cmds/get.ts b/src/cmds/registry-cmds/bond-cmds/get.ts index 5c41c14..6ab9a40 100644 --- a/src/cmds/registry-cmds/bond-cmds/get.ts +++ b/src/cmds/registry-cmds/bond-cmds/get.ts @@ -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]); diff --git a/src/cmds/registry-cmds/bond-cmds/list.ts b/src/cmds/registry-cmds/bond-cmds/list.ts index edc36de..82fb221 100644 --- a/src/cmds/registry-cmds/bond-cmds/list.ts +++ b/src/cmds/registry-cmds/bond-cmds/list.ts @@ -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 }); diff --git a/src/cmds/registry-cmds/bond-cmds/records-cmds/dissociate.ts b/src/cmds/registry-cmds/bond-cmds/records-cmds/dissociate.ts index 72a733f..f19c94b 100644 --- a/src/cmds/registry-cmds/bond-cmds/records-cmds/dissociate.ts +++ b/src/cmds/registry-cmds/bond-cmds/records-cmds/dissociate.ts @@ -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}'; diff --git a/src/cmds/registry-cmds/bond-cmds/records-cmds/reassociate.ts b/src/cmds/registry-cmds/bond-cmds/records-cmds/reassociate.ts index bcf65f3..94f648d 100644 --- a/src/cmds/registry-cmds/bond-cmds/records-cmds/reassociate.ts +++ b/src/cmds/registry-cmds/bond-cmds/records-cmds/reassociate.ts @@ -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}'; diff --git a/src/cmds/registry-cmds/bond-cmds/refill.ts b/src/cmds/registry-cmds/bond-cmds/refill.ts index 9219e51..4d5ba15 100644 --- a/src/cmds/registry-cmds/bond-cmds/refill.ts +++ b/src/cmds/registry-cmds/bond-cmds/refill.ts @@ -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}'; diff --git a/src/cmds/registry-cmds/bond-cmds/withdraw.ts b/src/cmds/registry-cmds/bond-cmds/withdraw.ts index 862fb50..f6446cf 100644 --- a/src/cmds/registry-cmds/bond-cmds/withdraw.ts +++ b/src/cmds/registry-cmds/bond-cmds/withdraw.ts @@ -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}'; diff --git a/src/cmds/registry-cmds/name-cmds/delete.ts b/src/cmds/registry-cmds/name-cmds/delete.ts index 1730e8f..8dfba9f 100644 --- a/src/cmds/registry-cmds/name-cmds/delete.ts +++ b/src/cmds/registry-cmds/name-cmds/delete.ts @@ -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); diff --git a/src/cmds/registry-cmds/name-cmds/lookup.ts b/src/cmds/registry-cmds/name-cmds/lookup.ts index a16c163..99f86b6 100644 --- a/src/cmds/registry-cmds/name-cmds/lookup.ts +++ b/src/cmds/registry-cmds/name-cmds/lookup.ts @@ -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); diff --git a/src/cmds/registry-cmds/name-cmds/resolve.ts b/src/cmds/registry-cmds/name-cmds/resolve.ts index 2f31a88..fbfc7b3 100644 --- a/src/cmds/registry-cmds/name-cmds/resolve.ts +++ b/src/cmds/registry-cmds/name-cmds/resolve.ts @@ -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); diff --git a/src/cmds/registry-cmds/name-cmds/set.ts b/src/cmds/registry-cmds/name-cmds/set.ts index 8f16db4..ebdf26e 100644 --- a/src/cmds/registry-cmds/name-cmds/set.ts +++ b/src/cmds/registry-cmds/name-cmds/set.ts @@ -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); diff --git a/src/cmds/registry-cmds/record-cmds/get.ts b/src/cmds/registry-cmds/record-cmds/get.ts index 76d3859..84e1843 100644 --- a/src/cmds/registry-cmds/record-cmds/get.ts +++ b/src/cmds/registry-cmds/record-cmds/get.ts @@ -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); diff --git a/src/cmds/registry-cmds/record-cmds/list.ts b/src/cmds/registry-cmds/record-cmds/list.ts index 4a0db44..4b763b3 100644 --- a/src/cmds/registry-cmds/record-cmds/list.ts +++ b/src/cmds/registry-cmds/record-cmds/list.ts @@ -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); diff --git a/src/cmds/registry-cmds/record-cmds/publish.ts b/src/cmds/registry-cmds/record-cmds/publish.ts index 4bdeb7b..5699009 100644 --- a/src/cmds/registry-cmds/record-cmds/publish.ts +++ b/src/cmds/registry-cmds/record-cmds/publish.ts @@ -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); diff --git a/src/cmds/registry-cmds/status.ts b/src/cmds/registry-cmds/status.ts index 25d03f7..7a7c0dd 100644 --- a/src/cmds/registry-cmds/status.ts +++ b/src/cmds/registry-cmds/status.ts @@ -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)); diff --git a/src/cmds/registry-cmds/tokens-cmds/gettx.ts b/src/cmds/registry-cmds/tokens-cmds/gettx.ts index 61df54d..d3f7d18 100644 --- a/src/cmds/registry-cmds/tokens-cmds/gettx.ts +++ b/src/cmds/registry-cmds/tokens-cmds/gettx.ts @@ -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); diff --git a/src/cmds/registry-cmds/tokens-cmds/send.ts b/src/cmds/registry-cmds/tokens-cmds/send.ts index 7183f80..5092639 100644 --- a/src/cmds/registry-cmds/tokens-cmds/send.ts +++ b/src/cmds/registry-cmds/tokens-cmds/send.ts @@ -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);