-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
65 lines (56 loc) · 2.16 KB
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env node
const { program } = require('commander');
const { version, getBlockNumber } = require('./commands/versioning/version');
const { rpc } = require('./commands/config/config');
const { getValidators } = require('./commands/validator/getvals');
const {fillValidatorDetails} = require('./commands/validator/getvaldump');
let selectedRPC;
Promise.all([import('figlet'), import('chalk')]).then(([figlet, chalk]) => {
function displayTitle() {
console.log(
chalk.default.greenBright(
figlet.default.textSync('BIZ-CLI', { horizontalLayout: 'full' }),
),
)
}
// Display the title when the program starts
displayTitle();
program
.version(version)
.description('CLI for interacting with BIZ-chain');
program
.command('version')
.description('Display the current version')
.option('--chain <network>', 'Specify the network (testnet/mainnet)')
.action((options) => {
console.log('CLI Version:', version);
selectedRPC = rpc[options.chain] || rpc.testnet;
getBlockNumber(selectedRPC).then(() => {
});
});
const validator = program
.command('validator')
.description('Biz chain validation related commands');
validator
.command('get-current-validators')
.option('--chain <network>', 'Specify the network (testnet/mainnet the default is mainnet)')
.action((options) => {
selectedRPC = rpc[options.chain] || rpc.mainnet;
getValidators(selectedRPC).then(() => {
});
});
validator
.command('get-config')
.option('--name <name>', 'Validator name')
.option('--feeaddress <address>', 'Biz Validator address for fees')
.option('--moniker <moniker>', 'Moniker value')
.option('--identity <identity>', 'Identity value')
.option('--website <website>', 'Website URL')
.option('--email <email>', 'Email address')
.option('--details <details>', 'Details')
.option('--privatkey <privatkey>', 'Private key')
.action(({ name, feeaddress, moniker, identity, website, email, details,privatkey }) => {
fillValidatorDetails({ name, feeAddress: feeaddress, moniker, identity, website, email, details,privatkey });
});
program.parse(process.argv);
});