|
@ -1,5 +1,6 @@ |
|
|
#!/usr/bin/env node |
|
|
#!/usr/bin/env node |
|
|
|
|
|
|
|
|
|
|
|
var _ = require('lodash'); |
|
|
var program = require('commander'); |
|
|
var program = require('commander'); |
|
|
var ClientLib = require('../lib/client'); |
|
|
var ClientLib = require('../lib/client'); |
|
|
var utils = require('./cli-utils'); |
|
|
var utils = require('./cli-utils'); |
|
@ -7,7 +8,7 @@ var utils = require('./cli-utils'); |
|
|
program |
|
|
program |
|
|
.version('0.0.1') |
|
|
.version('0.0.1') |
|
|
.option('-c, --config [file]', 'Wallet config filename') |
|
|
.option('-c, --config [file]', 'Wallet config filename') |
|
|
.option('-n, --network [networkname]', 'livenet|testnet', String, 'livenet') |
|
|
.option('-t, --testnet', 'Create a Testnet Wallet', String) |
|
|
.usage('[options] <walletName> <m-n> [copayerName]') |
|
|
.usage('[options] <walletName> <m-n> [copayerName]') |
|
|
.parse(process.argv); |
|
|
.parse(process.argv); |
|
|
|
|
|
|
|
@ -17,14 +18,14 @@ if (!args[0]) |
|
|
|
|
|
|
|
|
var walletName = args[0]; |
|
|
var walletName = args[0]; |
|
|
var copayerName = args[2] || process.env.USER; |
|
|
var copayerName = args[2] || process.env.USER; |
|
|
var network = program.network; |
|
|
var network = program.testnet ? 'testnet' : 'livenet'; |
|
|
|
|
|
|
|
|
var mn = utils.parseMN(args[1]); |
|
|
var mn = utils.parseMN(args[1]); |
|
|
|
|
|
|
|
|
var client = utils.getClient(program); |
|
|
var client = utils.getClient(program); |
|
|
client.createWallet(walletName, copayerName, mn[0], mn[1], network, function(err, secret) { |
|
|
client.createWallet(walletName, copayerName, mn[0], mn[1], network, function(err, secret) { |
|
|
utils.die(err); |
|
|
utils.die(err); |
|
|
console.log(' * Wallet Created.'); |
|
|
console.log(' * ' + _.capitalize(network) + ' Wallet Created.'); |
|
|
|
|
|
if (secret) |
|
|
console.log(' - Secret to share:\n\t' + secret); |
|
|
console.log(' - Secret to share:\n\t' + secret); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|