default bit.dat file;
This commit is contained in:
parent
d4aeff3c44
commit
9e724cabee
|
@ -3,12 +3,9 @@
|
|||
var program = require('commander');
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
.parse(process.argv);
|
||||
|
||||
var args = program.args;
|
||||
|
|
|
@ -4,12 +4,9 @@ var _ = require('lodash');
|
|||
var program = require('commander');
|
||||
var utils = require('./cli-utils');
|
||||
var Client = require('../lib/client');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
.parse(process.argv);
|
||||
|
||||
var args = program.args;
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
var program = require('commander');
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
.parse(process.argv);
|
||||
|
||||
var args = program.args;
|
||||
|
|
|
@ -4,12 +4,9 @@ var _ = require('lodash');
|
|||
var program = require('commander');
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c,--config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v,--verbose', 'be verbose')
|
||||
.usage('[options] <txpid>')
|
||||
.parse(process.argv);
|
||||
|
||||
|
|
|
@ -4,13 +4,11 @@ var _ = require('lodash');
|
|||
var program = require('commander');
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
.parse(process.argv);
|
||||
|
||||
var client = utils.getClient(program);
|
||||
|
||||
client.getStatus(function(err, x, myCopayerId) {
|
||||
|
|
|
@ -4,11 +4,9 @@ var _ = require('lodash');
|
|||
var program = require('commander');
|
||||
var ClientLib = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-t, --testnet', 'Create a Testnet Wallet')
|
||||
.usage('[options] <walletName> <m-n> [copayerName]')
|
||||
.parse(process.argv);
|
||||
|
|
|
@ -5,12 +5,9 @@ var qr = require('qr-image');
|
|||
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
.option('-q, --qr')
|
||||
.parse(process.argv);
|
||||
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
var program = require('commander');
|
||||
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
|
||||
var fs = require('fs');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
.usage('import [options] <file>')
|
||||
.parse(process.argv);
|
||||
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
var program = require('commander');
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.usage('[options] <secret> [copayerName]')
|
||||
.parse(process.argv);
|
||||
|
||||
|
|
|
@ -4,11 +4,9 @@ var _ = require('lodash');
|
|||
var program = require('commander');
|
||||
var ClientLib = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.usage('[options] walletname')
|
||||
.description('Creates a wallet on the remove server given the local information')
|
||||
.parse(process.argv);
|
||||
|
|
|
@ -4,12 +4,9 @@ var _ = require('lodash');
|
|||
var program = require('commander');
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c,--config [file]', 'Wallet config filename')
|
||||
.option('-v,--verbose', 'be verbose')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.usage('[options] <txpid> [reason]')
|
||||
.parse(process.argv);
|
||||
|
||||
|
|
|
@ -4,12 +4,10 @@ var _ = require('lodash');
|
|||
var program = require('commander');
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c,--config [file]', 'Wallet config filename')
|
||||
.option('-v,--verbose', 'be verbose')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.usage('[options] <txpid>')
|
||||
.parse(process.argv);
|
||||
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
var program = require('commander');
|
||||
var Client = require('../lib/client');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
.usage('[options] <address> <amount> [note]')
|
||||
.description('Create a proposal for sending bitcoins to a destination address.\n The amount can be specified in bit, btc or sat (the default).');
|
||||
|
||||
|
@ -19,7 +16,6 @@ program.on('--help', function(){
|
|||
console.log(' $ bit-send mgWeRvUC6d1LRPKtdDbvYEpaUEmApS4XrY 0.2btc "dinner with friends"');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
var args = program.args;
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
var _ = require('lodash');
|
||||
var program = require('commander');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c,--config [file]', 'Wallet config filename')
|
||||
.option('-v,--verbose', 'be verbose')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.usage('[options] <txpid>')
|
||||
.parse(process.argv);
|
||||
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
var _ = require('lodash');
|
||||
var program = require('commander');
|
||||
var utils = require('./cli-utils');
|
||||
program = utils.configureCommander(program);
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-c, --config [file]', 'Wallet config filename')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
.parse(process.argv);
|
||||
|
||||
var args = program.args;
|
||||
|
|
|
@ -36,7 +36,7 @@ Utils.confirmationId = function(copayer) {
|
|||
|
||||
Utils.getClient = function(args) {
|
||||
var storage = new Client.FileStorage({
|
||||
filename: args.config || process.env['BIT_FILE'],
|
||||
filename: args.file || process.env['BIT_FILE'],
|
||||
});
|
||||
return new Client({
|
||||
storage: storage,
|
||||
|
@ -89,5 +89,14 @@ Utils.parseAmount = function(text) {
|
|||
return amountSat;
|
||||
};
|
||||
|
||||
Utils.configureCommander = function(program) {
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-f, --file [filename]', 'Wallet file', 'bit.dat')
|
||||
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
||||
.option('-v, --verbose', 'be verbose')
|
||||
|
||||
return program;
|
||||
};
|
||||
|
||||
module.exports = Utils;
|
||||
|
|
|
@ -227,7 +227,7 @@ API.prototype.createWallet = function(walletName, copayerName, m, n, network, cb
|
|||
|
||||
this.storage.load(function(err, data) {
|
||||
if (data)
|
||||
return cb('Storage already contains a wallet');
|
||||
return cb(self.storage.getName() + ' already contains a wallet');
|
||||
|
||||
var walletPrivKey = new Bitcore.PrivateKey();
|
||||
var args = {
|
||||
|
|
|
@ -3,12 +3,15 @@ var fs = require('fs')
|
|||
|
||||
function FileStorage(opts) {
|
||||
if (!opts.filename) {
|
||||
throw new Error('Please set the config filename');
|
||||
throw new Error('Please set wallet filename');
|
||||
}
|
||||
this.filename = opts.filename;
|
||||
this.fs = opts.fs || fs;
|
||||
};
|
||||
|
||||
FileStorage.prototype.getName = function() {
|
||||
return this.filename;
|
||||
};
|
||||
|
||||
FileStorage.prototype.save = function(data, cb) {
|
||||
this.fs.writeFile(this.filename, JSON.stringify(data), cb);
|
||||
|
|
Loading…
Reference in New Issue