forked from yerofey/cryptowallet-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
49 lines (41 loc) · 1.92 KB
/
cli.js
File metadata and controls
49 lines (41 loc) · 1.92 KB
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
#!/usr/bin/env node
'use strict';
const { program } = require('commander');
const chalk = require('chalk');
const { log, supportedChains } = require('./src/utils');
const Method = require('./src/Method');
program.option('-b, --chain <ticker>', 'Wallet for specific blockchain', 'ERC');
program.option('-c, --chain <ticker>', 'Wallet for specific blockchain', 'ERC');
program.option('-f, --format <format>', 'Wallet format type (for cryptos with multiple wallet formats)');
program.option('-F, --filename <filename>', 'Filename to output the data (works with -o argument)');
program.option('-g, --geek', 'Display some more info (geeky)');
program.option('-l, --list', 'List all supported cryptos');
program.option('-m, --mnemonic [mnemonic]', 'Generate wallet from mnemonic string OR just a mnemonic string');
program.option('-n, --number <number>', 'Number of wallets to generate (if supported)');
program.option('-o, --output <format>', 'Return results into some file');
program.option('-p, --prefix <prefix>', 'Desired wallet prefix');
program.option('-P, --prefix-sensitive <prefix>', 'Desired wallet prefix (case-sensitive)');
program.option('-s, --suffix <suffix>', 'Desired wallet suffix');
program.option('-S, --suffix-sensitive <suffix>', 'Desired wallet suffix (case-sensitive)');
program.option('-v, --version', 'Display cryptowallet version');
program.parse();
(async () => {
const options = program.opts();
if (options.list !== undefined) {
return new Method('list').init();
}
if (options.mnemonic == true) {
return new Method('mnemonic').init();
}
if (options.version) {
return new Method('version').init();
}
const chain = (options.chain).toUpperCase() || '';
if (supportedChains.includes(chain)) {
return new Method('wallet', {
chain,
options,
}).init();
}
log(chalk.red('⛔️ Error: this blockchain is not supported!'));
})();