cosmic-interchain-cli
Version:
A command-line utility for Cosmic Wire's interchain messaging protocol
79 lines • 2.32 kB
JavaScript
import { readChainConfigs } from '../config/chain.js';
import { readIsmConfig } from '../config/ism.js';
import { readMultisigConfig } from '../config/multisig.js';
import { readWarpRouteDeployConfig } from '../config/warp.js';
import { log, logGreen } from '../logger.js';
import { inputFileCommandOption } from './options.js';
/**
* Parent command
*/
export const configCommand = {
command: 'config',
describe: 'Create or validate interchain configs',
builder: (yargs) => yargs.command(validateCommand).version(false).demandCommand(),
handler: () => log('Command required'),
};
/**
* Validate commands
*/
const validateCommand = {
command: 'validate',
describe: 'Validate a config in a YAML or JSON file',
builder: (yargs) => yargs
.command(validateChainCommand)
.command(validateIsmCommand)
.command(validateIsmAdvancedCommand)
.command(validateWarpCommand)
.version(false)
.demandCommand(),
handler: () => log('Command required'),
};
const validateChainCommand = {
command: 'chain',
describe: 'Validate a chain config file',
builder: {
path: inputFileCommandOption,
},
handler: async ({ path }) => {
readChainConfigs(path);
logGreen(`All chain configs in ${path} are valid`);
process.exit(0);
},
};
const validateIsmCommand = {
command: 'ism',
describe: 'Validate the basic ISM config file',
builder: {
path: inputFileCommandOption,
},
handler: async ({ path }) => {
readMultisigConfig(path);
logGreen('Config is valid');
process.exit(0);
},
};
const validateIsmAdvancedCommand = {
command: 'ism-advanced',
describe: 'Validate the advanced ISM config file',
builder: {
path: inputFileCommandOption,
},
handler: async ({ path }) => {
readIsmConfig(path);
logGreen('Config is valid');
process.exit(0);
},
};
const validateWarpCommand = {
command: 'warp',
describe: 'Validate a Warp Route deployment config file',
builder: {
path: inputFileCommandOption,
},
handler: async ({ path }) => {
await readWarpRouteDeployConfig(path);
logGreen('Config is valid');
process.exit(0);
},
};
//# sourceMappingURL=config.js.map