-
Notifications
You must be signed in to change notification settings - Fork 51
/
cli.js
41 lines (34 loc) · 1.01 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
#!/usr/bin/env node
'use strict';
import chalk from 'chalk';
import { options } from './src/options.js';
import { log, supportedChains } from './src/utils.js';
import Method from './src/Method.js';
(async () => {
if (options.list !== undefined) {
return new Method('list').init();
}
// generate mnemonic string if no argument is passed or only the mnemonic length is passed
if (
options.mnemonic &&
(options.mnemonic === true ||
options.mnemonic === '' ||
options.mnemonic.split(' ').length === 1)
) {
return new Method('mnemonic').init({ mnemonic: options.mnemonic, copy: options?.copy || false });
}
if (options.version) {
return new Method('version').init();
}
if (options.donate) {
return new Method('donate').init();
}
const chain = options.chain.toUpperCase() || 'EVM';
if (supportedChains.includes(chain)) {
return new Method('wallet', {
chain,
options,
}).init();
}
log(chalk.red('⛔️ Error: this blockchain is not supported!'));
})();