Add command to get authorities list
This commit is contained in:
parent
70e63c74f1
commit
1e2bd72185
24
src/cmds/registry-cmds/authority-cmds/get.ts
Normal file
24
src/cmds/registry-cmds/authority-cmds/get.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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 [owner]';
|
||||||
|
|
||||||
|
export const desc = 'List authorities (optionally by owner).';
|
||||||
|
|
||||||
|
export const handler = async (argv: Arguments) => {
|
||||||
|
const owner = argv.owner as string || '';
|
||||||
|
|
||||||
|
const { services: { registry: registryConfig } } = getConfig(argv.config as string);
|
||||||
|
const { rpcEndpoint, gqlEndpoint, chainId } = getConnectionInfo(argv, registryConfig);
|
||||||
|
assert(rpcEndpoint, 'Invalid registry RPC endpoint.');
|
||||||
|
assert(gqlEndpoint, 'Invalid registry GQL endpoint.');
|
||||||
|
assert(chainId, 'Invalid registry Chain ID.');
|
||||||
|
|
||||||
|
const registry = new Registry(gqlEndpoint, rpcEndpoint, chainId);
|
||||||
|
const result = await registry.getAuthorities(owner);
|
||||||
|
|
||||||
|
queryOutput(result, argv.output);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user