From d3020daf2eecd7049c215ca97568778928e7fa33 Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Mon, 27 Mar 2023 13:14:02 +0530 Subject: [PATCH] bond and records outputs --- src/cmds/cns-cmds/bond-cmds/associate.ts | 3 ++- src/cmds/cns-cmds/bond-cmds/cancel.ts | 3 ++- src/cmds/cns-cmds/bond-cmds/create.ts | 3 ++- src/cmds/cns-cmds/bond-cmds/dissociate.ts | 3 ++- src/cmds/cns-cmds/bond-cmds/records-cmds/dissociate.ts | 3 ++- src/cmds/cns-cmds/bond-cmds/records-cmds/reassociate.ts | 3 ++- src/cmds/cns-cmds/bond-cmds/refill.ts | 4 +++- src/cmds/cns-cmds/bond-cmds/withdraw.ts | 3 ++- src/cmds/cns-cmds/record-cmds/publish.ts | 2 +- watcher.yml | 7 +++++++ 10 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 watcher.yml diff --git a/src/cmds/cns-cmds/bond-cmds/associate.ts b/src/cmds/cns-cmds/bond-cmds/associate.ts index 5f20a2f..755d10c 100644 --- a/src/cmds/cns-cmds/bond-cmds/associate.ts +++ b/src/cmds/cns-cmds/bond-cmds/associate.ts @@ -30,5 +30,6 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const fee = getGasAndFees(argv, cnsConfig); const result = await registry.associateBond({ recordId: id, bondId }, 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/bond-cmds/cancel.ts b/src/cmds/cns-cmds/bond-cmds/cancel.ts index dda59ef..ca3d3e7 100644 --- a/src/cmds/cns-cmds/bond-cmds/cancel.ts +++ b/src/cmds/cns-cmds/bond-cmds/cancel.ts @@ -22,5 +22,6 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const fee = getGasAndFees(argv, cnsConfig); const result = await registry.cancelBond({ 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))); } diff --git a/src/cmds/cns-cmds/bond-cmds/create.ts b/src/cmds/cns-cmds/bond-cmds/create.ts index 9e3a79d..cf4be9e 100644 --- a/src/cmds/cns-cmds/bond-cmds/create.ts +++ b/src/cmds/cns-cmds/bond-cmds/create.ts @@ -36,5 +36,6 @@ export const handler = async (argv: Arguments) => { const fee = getGasAndFees(argv, cnsConfig); const bondId = await registry.getNextBondId(privateKey); const result = await registry.createBond({ denom, amount }, privateKey, fee); - console.log(true ? JSON.stringify(result, undefined, 2)+"\nBondId:"+bondId : bondId); + const jsonString=`{"bondId":"${bondId}"}` + console.log(verbose ? JSON.stringify(result, undefined, 2) : JSON.stringify(JSON.parse(jsonString),null,2)); } diff --git a/src/cmds/cns-cmds/bond-cmds/dissociate.ts b/src/cmds/cns-cmds/bond-cmds/dissociate.ts index 76d9185..7a60a1d 100644 --- a/src/cmds/cns-cmds/bond-cmds/dissociate.ts +++ b/src/cmds/cns-cmds/bond-cmds/dissociate.ts @@ -22,5 +22,6 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const fee = getGasAndFees(argv, cnsConfig); const result = await registry.dissociateBond({ recordId: 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))); } diff --git a/src/cmds/cns-cmds/bond-cmds/records-cmds/dissociate.ts b/src/cmds/cns-cmds/bond-cmds/records-cmds/dissociate.ts index 136e4d4..2d50c00 100644 --- a/src/cmds/cns-cmds/bond-cmds/records-cmds/dissociate.ts +++ b/src/cmds/cns-cmds/bond-cmds/records-cmds/dissociate.ts @@ -28,5 +28,6 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const fee = getGasAndFees(argv, cnsConfig); const result = await registry.dissociateRecords({ bondId }, 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/bond-cmds/records-cmds/reassociate.ts b/src/cmds/cns-cmds/bond-cmds/records-cmds/reassociate.ts index 4e909e1..4696834 100644 --- a/src/cmds/cns-cmds/bond-cmds/records-cmds/reassociate.ts +++ b/src/cmds/cns-cmds/bond-cmds/records-cmds/reassociate.ts @@ -33,5 +33,6 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const fee = getGasAndFees(argv, cnsConfig); const result = await registry.reassociateRecords({ oldBondId, newBondId }, 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/bond-cmds/refill.ts b/src/cmds/cns-cmds/bond-cmds/refill.ts index 0a23269..1627d3e 100644 --- a/src/cmds/cns-cmds/bond-cmds/refill.ts +++ b/src/cmds/cns-cmds/bond-cmds/refill.ts @@ -3,6 +3,7 @@ import assert from 'assert'; import { Registry } from '@cerc-io/laconic-sdk'; import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util'; +import { isNil } from 'lodash'; export const command = 'refill'; @@ -36,5 +37,6 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const fee = getGasAndFees(argv, cnsConfig); const result = await registry.refillBond({ id, denom, amount }, 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/bond-cmds/withdraw.ts b/src/cmds/cns-cmds/bond-cmds/withdraw.ts index 1060e23..79cd313 100644 --- a/src/cmds/cns-cmds/bond-cmds/withdraw.ts +++ b/src/cmds/cns-cmds/bond-cmds/withdraw.ts @@ -36,5 +36,6 @@ export const handler = async (argv: Arguments) => { const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const fee = getGasAndFees(argv, cnsConfig); const result = await registry.withdrawBond({ id, denom, amount }, 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/record-cmds/publish.ts b/src/cmds/cns-cmds/record-cmds/publish.ts index 8944bc8..96756c1 100644 --- a/src/cmds/cns-cmds/record-cmds/publish.ts +++ b/src/cmds/cns-cmds/record-cmds/publish.ts @@ -40,5 +40,5 @@ export const handler = async (argv: Arguments) => { const fee = getGasAndFees(argv, cnsConfig); const result = await registry.setRecord({ privateKey: userKey, record, bondId }, txKey as string, fee); - console.log(verbose ? JSON.stringify(result, undefined, 2) : result.data); + console.log(verbose ? JSON.stringify(result, undefined, 2) : JSON.stringify(result.data,undefined,2)); } diff --git a/watcher.yml b/watcher.yml new file mode 100644 index 0000000..58502aa --- /dev/null +++ b/watcher.yml @@ -0,0 +1,7 @@ +record: + type: WebsiteRegistrationRecord + url: 'https://cerc.io' + repo_registration_record_cid: QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D + build_artifact_cid: QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9 + tls_cert_cid: QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR + version: 1.0.35