Fix lint errors
This commit is contained in:
parent
3eb07f9b3b
commit
a3c6319801
@ -15,6 +15,7 @@
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }]
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||
"@typescript-eslint/no-explicit-any": "off"
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ export const handler = async (argv: Arguments) => {
|
||||
|
||||
const reveal = fs.readFileSync(path.resolve(filePath));
|
||||
const result = await registry.revealBid({ auctionId, reveal: reveal.toString('hex') }, privateKey, fee);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ export const handler = async (argv: Arguments) => {
|
||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.setAuthorityBond({ name, bondId }, privateKey, fee);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -31,6 +31,6 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.reserveAuthority({ name, owner }, privateKey, fee);
|
||||
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -30,6 +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);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -22,6 +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);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ export const builder = {
|
||||
};
|
||||
|
||||
export const handler = async (argv: Arguments) => {
|
||||
const { config, verbose } = argv;
|
||||
const { config } = argv;
|
||||
const denom = argv.type as string;
|
||||
const amount = argv.quantity as string;
|
||||
|
||||
|
@ -22,6 +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);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -28,6 +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);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -33,6 +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);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -3,7 +3,6 @@ import assert from 'assert';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees, txOutput } from '../../../util';
|
||||
import { isNil } from 'lodash';
|
||||
|
||||
export const command = 'refill';
|
||||
|
||||
@ -37,6 +36,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);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -36,6 +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);
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -23,6 +23,6 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.deleteName({ crn: name }, privateKey, fee);
|
||||
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -25,6 +25,6 @@ export const handler = async (argv: Arguments) => {
|
||||
const fee = getGasAndFees(argv, cnsConfig);
|
||||
const result = await registry.setName({ crn: name, cid: id }, privateKey, fee);
|
||||
|
||||
const success = `{"success":${result.code == 0}}`;
|
||||
const success = `{"success":${result.code === 0}}`;
|
||||
txOutput(result, success, argv.output, argv.verbose);
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import path from 'path';
|
||||
import yaml from 'js-yaml';
|
||||
import fs from 'fs';
|
||||
import { Registry } from '@cerc-io/laconic-sdk';
|
||||
@ -18,7 +17,7 @@ export const builder = {
|
||||
};
|
||||
|
||||
export const handler = async (argv: Arguments) => {
|
||||
const { txKey, filename, verbose, config } = argv;
|
||||
const { txKey, filename, config } = argv;
|
||||
const { services: { cns: cnsConfig } } = getConfig(config as string);
|
||||
const { restEndpoint, gqlEndpoint, userKey, bondId, chainId } = getConnectionInfo(argv, cnsConfig);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import yargs from 'yargs/yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
yargs(hideBin(process.argv))
|
||||
.options({
|
||||
verbose: {
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import assert from 'assert';
|
||||
import { Arguments } from 'yargs';
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
export const txOutput = (result:any, msg:string, output:unknown, verbose:unknown) => {
|
||||
if (output == 'json') {
|
||||
if (output === 'json') {
|
||||
console.log(verbose ? JSON.parse(JSON.stringify(result)) : JSON.parse(msg));
|
||||
} else {
|
||||
console.log(verbose ? JSON.stringify(result, undefined, 2) : msg);
|
||||
@ -8,7 +8,7 @@ export const txOutput = (result:any, msg:string, output:unknown, verbose:unknown
|
||||
};
|
||||
|
||||
export const queryOutput = (result: any, output: unknown) => {
|
||||
if (output == 'json') {
|
||||
if (output === 'json') {
|
||||
console.log(JSON.parse(JSON.stringify(result)));
|
||||
} else {
|
||||
console.log(JSON.stringify(result, (key, value) => {
|
||||
|
@ -116,5 +116,5 @@ export function getBidObject (params: { bidder: string, status?: string }): any
|
||||
}
|
||||
|
||||
export async function delay (ms: number): Promise<any> {
|
||||
return new Promise(res => setTimeout(res, ms));
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user