Part of https://www.notion.so/Create-laconic-registry-SDK-d3a636d4aba44f7cbba3bd99b7146811 - Use user key as transaction private key in record publish cmd Co-authored-by: neeraj <neeraj.rtly@gmail.com> Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Reviewed-on: cerc-io/laconic-registry-cli#56 Co-authored-by: Nabarun <nabarun@deepstacksoft.com> Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
26 lines
860 B
TypeScript
26 lines
860 B
TypeScript
import { Arguments } from 'yargs';
|
|
import assert from 'assert';
|
|
import { Registry } from '@cerc-io/registry-sdk';
|
|
|
|
import { getConfig, getConnectionInfo, queryOutput } from '../../../util';
|
|
|
|
export const command = 'get';
|
|
|
|
export const desc = 'Get record.';
|
|
|
|
export const handler = async (argv: Arguments) => {
|
|
const { id, config } = argv;
|
|
assert(id, 'Invalid Record ID.');
|
|
|
|
const { services: { cns: cnsConfig } } = getConfig(config as string);
|
|
const { restEndpoint, gqlEndpoint, chainId } = getConnectionInfo(argv, cnsConfig);
|
|
assert(restEndpoint, 'Invalid CNS REST endpoint.');
|
|
assert(gqlEndpoint, 'Invalid CNS GQL endpoint.');
|
|
assert(chainId, 'Invalid CNS Chain ID.');
|
|
|
|
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
|
const result = await registry.getRecordsByIds([id as string]);
|
|
|
|
queryOutput(result, argv.output);
|
|
};
|