Add a config option and arg to set gas price for auto
fees calculation
#81
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
# Update the gas value in config.yml
|
# Update the gas value in config.yml
|
||||||
# gas: 500000
|
# gas: 500000
|
||||||
|
# fees: 500000alnt
|
||||||
|
|
||||||
# Get user private key
|
# Get user private key
|
||||||
laconicd keys export alice --unarmored-hex --unsafe --keyring-backend test --home ~/.laconicd
|
laconicd keys export alice --unarmored-hex --unsafe --keyring-backend test --home ~/.laconicd
|
||||||
|
@ -46,7 +46,7 @@ async function main () {
|
|||||||
let rpcEndpoint, gqlEndpoint, chainId: string;
|
let rpcEndpoint, gqlEndpoint, chainId: string;
|
||||||
({ rpcEndpoint, gqlEndpoint, userKey, bondId, chainId } = getConnectionInfo(argv, registryConfig));
|
({ rpcEndpoint, gqlEndpoint, userKey, bondId, chainId } = getConnectionInfo(argv, registryConfig));
|
||||||
|
|
||||||
registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
|
||||||
fee = getGasAndFees(argv, registryConfig);
|
fee = getGasAndFees(argv, registryConfig);
|
||||||
|
|
||||||
await processDir(path.resolve(recordsDir));
|
await processDir(path.resolve(recordsDir));
|
||||||
|
@ -23,7 +23,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
address = account.address;
|
address = account.address;
|
||||||
}
|
}
|
||||||
|
|
||||||
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
|
||||||
const result = await registry.getAccounts([address]);
|
const result = await registry.getAccounts([address]);
|
||||||
|
|
||||||
queryOutput(result, argv.output);
|
queryOutput(result, argv.output);
|
||||||
|
@ -5,7 +5,7 @@ import { Account, createBid, Registry } from '@cerc-io/registry-sdk';
|
|||||||
import { ensureDir } from 'fs-extra';
|
import { ensureDir } from 'fs-extra';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../../util';
|
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../../util';
|
||||||
|
|
||||||
const OUT_DIR = 'out';
|
const OUT_DIR = 'out';
|
||||||
|
|
||||||
@ -40,7 +40,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
await ensureDir(outDirPath);
|
await ensureDir(outDirPath);
|
||||||
fs.writeFileSync(revealFilePath, JSON.stringify(reveal, undefined, 2));
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
|
|
||||||
const result = await registry.commitBid({ auctionId, commitHash }, privateKey, fee);
|
const result = await registry.commitBid({ auctionId, commitHash }, privateKey, fee);
|
||||||
|
@ -4,7 +4,7 @@ import path from 'path';
|
|||||||
import { Registry } from '@cerc-io/registry-sdk';
|
import { Registry } from '@cerc-io/registry-sdk';
|
||||||
import fs from 'fs';
|
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]';
|
export const command = 'reveal [auction-id] [file-path]';
|
||||||
|
|
||||||
@ -23,7 +23,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
|
|
||||||
const reveal = fs.readFileSync(path.resolve(filePath));
|
const reveal = fs.readFileSync(path.resolve(filePath));
|
||||||
|
@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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]);
|
const result = await registry.getAuctionsByIds([id as string]);
|
||||||
|
|
||||||
queryOutput(result, argv.output);
|
queryOutput(result, argv.output);
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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]';
|
export const command = 'set [name] [bond-id]';
|
||||||
|
|
||||||
@ -21,7 +21,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.setAuthorityBond({ name, bondId }, privateKey, fee);
|
const result = await registry.setAuthorityBond({ name, bondId }, privateKey, fee);
|
||||||
const success = '{"success": true}';
|
const success = '{"success": true}';
|
||||||
|
@ -22,7 +22,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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);
|
const result = await registry.getAuthorities(argv.owner as string);
|
||||||
|
|
||||||
queryOutput(result, argv.output);
|
queryOutput(result, argv.output);
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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]';
|
export const command = 'reserve [name]';
|
||||||
|
|
||||||
@ -27,7 +27,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.reserveAuthority({ name, owner }, privateKey, fee);
|
const result = await registry.reserveAuthority({ name, owner }, privateKey, fee);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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);
|
const result = await registry.lookupAuthorities([name], true);
|
||||||
|
|
||||||
queryOutput(result, argv.output);
|
queryOutput(result, argv.output);
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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';
|
export const command = 'associate';
|
||||||
|
|
||||||
@ -27,7 +27,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.associateBond({ recordId: id, bondId }, privateKey, fee);
|
const result = await registry.associateBond({ recordId: id, bondId }, privateKey, fee);
|
||||||
const success = '{"success": true}';
|
const success = '{"success": true}';
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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';
|
export const command = 'cancel';
|
||||||
|
|
||||||
@ -19,7 +19,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.cancelBond({ id }, privateKey, fee);
|
const result = await registry.cancelBond({ id }, privateKey, fee);
|
||||||
const success = '{"success": true}';
|
const success = '{"success": true}';
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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';
|
export const command = 'dissociate';
|
||||||
|
|
||||||
@ -19,7 +19,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.dissociateBond({ recordId: id }, privateKey, fee);
|
const result = await registry.dissociateBond({ recordId: id }, privateKey, fee);
|
||||||
const success = '{"success": true}';
|
const success = '{"success": true}';
|
||||||
|
@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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]);
|
const result = await registry.getBondsByIds([id as string]);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
assert(chainId, 'Invalid registry Chain ID.');
|
||||||
|
|
||||||
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
|
||||||
|
|
||||||
let result: any;
|
let result: any;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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';
|
export const command = 'dissociate';
|
||||||
|
|
||||||
@ -25,7 +25,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.dissociateRecords({ bondId }, privateKey, fee);
|
const result = await registry.dissociateRecords({ bondId }, privateKey, fee);
|
||||||
const success = '{"success": true}';
|
const success = '{"success": true}';
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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';
|
export const command = 'reassociate';
|
||||||
|
|
||||||
@ -30,7 +30,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.reassociateRecords({ oldBondId, newBondId }, privateKey, fee);
|
const result = await registry.reassociateRecords({ oldBondId, newBondId }, privateKey, fee);
|
||||||
const success = '{"success": true}';
|
const success = '{"success": true}';
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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';
|
export const command = 'refill';
|
||||||
|
|
||||||
@ -33,7 +33,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.refillBond({ id, denom, amount }, privateKey, fee);
|
const result = await registry.refillBond({ id, denom, amount }, privateKey, fee);
|
||||||
const success = '{"success": true}';
|
const success = '{"success": true}';
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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';
|
export const command = 'withdraw';
|
||||||
|
|
||||||
@ -33,7 +33,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.withdrawBond({ id, denom, amount }, privateKey, fee);
|
const result = await registry.withdrawBond({ id, denom, amount }, privateKey, fee);
|
||||||
const success = '{"success": true}';
|
const success = '{"success": true}';
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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]';
|
export const command = 'delete [name]';
|
||||||
|
|
||||||
@ -19,7 +19,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.deleteName({ lrn: name }, privateKey, fee);
|
const result = await registry.deleteName({ lrn: name }, privateKey, fee);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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);
|
const result = await registry.lookupNames([name], argv.history as boolean);
|
||||||
|
|
||||||
queryOutput(result, argv.output);
|
queryOutput(result, argv.output);
|
||||||
|
@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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]);
|
let result = await registry.resolveNames([name]);
|
||||||
result = result.filter((v: any) => v);
|
result = result.filter((v: any) => v);
|
||||||
|
@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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]';
|
export const command = 'set [name] [id]';
|
||||||
|
|
||||||
@ -21,7 +21,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(privateKey, 'Invalid Transaction Key.');
|
assert(privateKey, 'Invalid Transaction Key.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.setName({ lrn: name, cid: id }, privateKey, fee);
|
const result = await registry.setName({ lrn: name, cid: id }, privateKey, fee);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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]);
|
const result = await registry.getRecordsByIds([id as string]);
|
||||||
|
|
||||||
queryOutput(result, argv.output);
|
queryOutput(result, argv.output);
|
||||||
|
@ -52,7 +52,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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, refs as boolean, limit as number, offset as number);
|
let result = await registry.queryRecords({ ...filters, type, name }, all as boolean, refs as boolean, limit as number, offset as number);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import yaml from 'js-yaml';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { Registry } from '@cerc-io/registry-sdk';
|
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';
|
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 fee = getGasAndFees(argv, registryConfig);
|
||||||
const result = await registry.setRecord({ privateKey: userKey, record, bondId }, txKey || userKey, fee);
|
const result = await registry.setRecord({ privateKey: userKey, record, bondId }, txKey || userKey, fee);
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
assert(chainId, 'Invalid registry Chain ID.');
|
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();
|
const result = await registry.getStatus();
|
||||||
console.log(JSON.stringify(result, undefined, 2));
|
console.log(JSON.stringify(result, undefined, 2));
|
||||||
|
@ -30,7 +30,7 @@ export const handler = async (argv: Arguments) => {
|
|||||||
const account = new Account(Buffer.from(privateKey, 'hex'));
|
const account = new Account(Buffer.from(privateKey, 'hex'));
|
||||||
await account.init();
|
await account.init();
|
||||||
|
|
||||||
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
const registry = new Registry(gqlEndpoint, rpcEndpoint, { chainId });
|
||||||
const laconicClient = await registry.getLaconicClient(account);
|
const laconicClient = await registry.getLaconicClient(account);
|
||||||
|
|
||||||
const txResponse: IndexedTx | null = await laconicClient.getTx(hash);
|
const txResponse: IndexedTx | null = await laconicClient.getTx(hash);
|
||||||
|
@ -4,7 +4,7 @@ import assert from 'assert';
|
|||||||
import { Account, Registry, DEFAULT_GAS_ESTIMATION_MULTIPLIER } from '@cerc-io/registry-sdk';
|
import { Account, Registry, DEFAULT_GAS_ESTIMATION_MULTIPLIER } from '@cerc-io/registry-sdk';
|
||||||
import { DeliverTxResponse } from '@cosmjs/stargate';
|
import { DeliverTxResponse } from '@cosmjs/stargate';
|
||||||
|
|
||||||
import { getConfig, getConnectionInfo, getGasAndFees, queryOutput } from '../../../util';
|
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, queryOutput } from '../../../util';
|
||||||
|
|
||||||
export const command = 'send';
|
export const command = 'send';
|
||||||
|
|
||||||
@ -39,7 +39,8 @@ export const handler = async (argv: Arguments) => {
|
|||||||
await account.init();
|
await account.init();
|
||||||
const fromAddress = account.address;
|
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 laconicClient = await registry.getLaconicClient(account);
|
||||||
const fee = getGasAndFees(argv, registryConfig);
|
const fee = getGasAndFees(argv, registryConfig);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user