From 9b9e8829ec20253d43934aca6820a384a114f41a Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 27 Mar 2023 16:58:14 +0530 Subject: [PATCH] name outputs --- src/cmds/cns-cmds/name-cmds/delete.ts | 3 ++- src/cmds/cns-cmds/name-cmds/resolve.ts | 3 ++- src/cmds/cns-cmds/name-cmds/set.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cmds/cns-cmds/name-cmds/delete.ts b/src/cmds/cns-cmds/name-cmds/delete.ts index 32ff8f9..0c59532 100644 --- a/src/cmds/cns-cmds/name-cmds/delete.ts +++ b/src/cmds/cns-cmds/name-cmds/delete.ts @@ -23,5 +23,6 @@ export const handler = async (argv: Arguments) => { const fee = getGasAndFees(argv, cnsConfig); const result = await registry.deleteName({ crn: name }, privateKey, fee); - console.log(JSON.stringify(result, undefined, 2)); + const success = `{"success":${result.code==0}}` + console.log(argv.verbose ? JSON.stringify(result, undefined, 2): JSON.stringify(JSON.parse(success))); } diff --git a/src/cmds/cns-cmds/name-cmds/resolve.ts b/src/cmds/cns-cmds/name-cmds/resolve.ts index c6b651c..c5d6e5a 100644 --- a/src/cmds/cns-cmds/name-cmds/resolve.ts +++ b/src/cmds/cns-cmds/name-cmds/resolve.ts @@ -21,5 +21,6 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const result = await registry.resolveNames([name]); - console.log(JSON.stringify(result, undefined, 4)); + const success = `{"success":${result.code==0}}` + console.log(argv.verbose ? JSON.stringify(result, undefined, 2): JSON.stringify(JSON.parse(success))); } diff --git a/src/cmds/cns-cmds/name-cmds/set.ts b/src/cmds/cns-cmds/name-cmds/set.ts index addb989..9c541e4 100644 --- a/src/cmds/cns-cmds/name-cmds/set.ts +++ b/src/cmds/cns-cmds/name-cmds/set.ts @@ -25,5 +25,6 @@ export const handler = async (argv: Arguments) => { const fee = getGasAndFees(argv, cnsConfig); const result = await registry.setName({ crn: name, cid: id }, privateKey, fee); - console.log(JSON.stringify(result, undefined, 2)); + const success = `{"success":${result.code==0}}` + console.log(argv.verbose ? JSON.stringify(result, undefined, 2): JSON.stringify(JSON.parse(success))); }