Fix cns name resolve (#42)

The `cns name resolve` does not return the result.  Obviously it should.

Reviewed-on: cerc-io/laconic-registry-cli#42
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
This commit is contained in:
Thomas E Lackey 2023-11-30 05:01:25 +00:00 committed by Thomas E Lackey
parent 145da8c453
commit fb381c07f3
3 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@cerc-io/laconic-registry-cli", "name": "@cerc-io/laconic-registry-cli",
"version": "0.1.2", "version": "0.1.3",
"main": "index.js", "main": "index.js",
"repository": "git@github.com:cerc-io/laconic-registry-cli.git", "repository": "git@github.com:cerc-io/laconic-registry-cli.git",
"author": "", "author": "",

View File

@ -2,7 +2,7 @@ import { Arguments } from 'yargs';
import assert from 'assert'; import assert from 'assert';
import { Registry } from '@cerc-io/laconic-sdk'; import { Registry } from '@cerc-io/laconic-sdk';
import { getConfig, getConnectionInfo,txOutput } from '../../../util'; import { getConfig, getConnectionInfo, queryOutput } from '../../../util';
export const command = 'resolve [name]'; export const command = 'resolve [name]';
@ -20,8 +20,8 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const result = await registry.resolveNames([name]); let result = await registry.resolveNames([name]);
const success = `{"success":${result.code==0}}` result = result.filter((v: any) => v);
txOutput(result,success,argv.output,argv.verbose)
queryOutput(result, argv.output);
} }

View File

@ -48,11 +48,11 @@ export const handler = async (argv: Arguments) => {
// Apply ex post filters. // Apply ex post filters.
if (bondId) { if (bondId) {
result = result.filter(v => v.bondId === bondId); result = result.filter((v: any) => v.bondId === bondId);
} }
if (owner) { if (owner) {
result = result.filter(v => v.owners?.find((e: string) => e === owner)); result = result.filter((v: any) => v.owners?.find((e: string) => e === owner));
} }
queryOutput(result, argv.output) queryOutput(result, argv.output)