bond and records outputs

This commit is contained in:
0xmuralik 2023-03-27 13:14:02 +05:30
parent 495bbfdb3c
commit d3020daf2e
10 changed files with 25 additions and 9 deletions

View File

@ -30,5 +30,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.associateBond({ recordId: id, bondId }, privateKey, fee); 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)));
} }

View File

@ -22,5 +22,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.cancelBond({ id }, privateKey, fee); 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)));
} }

View File

@ -36,5 +36,6 @@ export const handler = async (argv: Arguments) => {
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const bondId = await registry.getNextBondId(privateKey); const bondId = await registry.getNextBondId(privateKey);
const result = await registry.createBond({ denom, amount }, privateKey, fee); 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));
} }

View File

@ -22,5 +22,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.dissociateBond({ recordId: id }, privateKey, fee); 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)));
} }

View File

@ -28,5 +28,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.dissociateRecords({ bondId }, privateKey, fee); 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)));
} }

View File

@ -33,5 +33,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.reassociateRecords({ oldBondId, newBondId }, privateKey, fee); 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)));
} }

View File

@ -3,6 +3,7 @@ import assert from 'assert';
import { Registry } from '@cerc-io/laconic-sdk'; import { Registry } from '@cerc-io/laconic-sdk';
import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util'; import { getConfig, getConnectionInfo, getGasAndFees } from '../../../util';
import { isNil } from 'lodash';
export const command = 'refill'; export const command = 'refill';
@ -36,5 +37,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.refillBond({ id, denom, amount }, privateKey, fee); 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)));
} }

View File

@ -36,5 +36,6 @@ export const handler = async (argv: Arguments) => {
const registry = new Registry(gqlEndpoint, restEndpoint, chainId); const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.withdrawBond({ id, denom, amount }, privateKey, fee); 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)));
} }

View File

@ -40,5 +40,5 @@ export const handler = async (argv: Arguments) => {
const fee = getGasAndFees(argv, cnsConfig); const fee = getGasAndFees(argv, cnsConfig);
const result = await registry.setRecord({ privateKey: userKey, record, bondId }, txKey as string, fee); 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));
} }

7
watcher.yml Normal file
View File

@ -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