forked from bitpay/bitcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallet-create
executable file
·45 lines (40 loc) · 1.26 KB
/
wallet-create
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
#!/usr/bin/env node
'use strict';
const program = require('../ts_build/program');
const { Wallet } = require('../ts_build/wallet');
const promptly = require('promptly');
program
.version(require('../package.json').version)
.option('--name <name>', 'REQUIRED - Wallet Name')
.option('--chain <chain>', 'REQUIRED - Chain (BTC/BCH/ETH, etc)')
.option(
'--network <network>',
'REQUIRED - Network (livenet/testnet/regtest, etc)'
)
.option('--baseUrl [host]', 'optional - Specify custom Bitcore API URL')
.option('--path [path]', 'optional - Custom wallet storage path')
.option('--storageType [storageType]', 'optional - name of the database to use (Mongo or Level)')
.option('--phrase [phrase]', 'optional - Seed using existing backup phrase')
.option('--lite [lite]', 'optional - Create a wallet lite')
.parse(process.argv);
const main = async () => {
const { name, baseUrl, chain, network, path, phrase, storageType, lite } = program;
try {
const password = await promptly.password('Wallet Password:');
await Wallet.create({
name,
baseUrl,
chain,
network,
path,
phrase,
password,
storageType,
lite
});
console.log('Wallet created!');
} catch (e) {
console.error(e);
}
};
main();