Browse Source

Merge pull request #29 from matiu/feat/host

add host param
activeAddress
Ivan Socolsky 10 years ago
parent
commit
3e197c5fb8
  1. 1
      README.md
  2. 1
      bit-wallet/bit
  3. 1
      bit-wallet/bit-address
  4. 1
      bit-wallet/bit-addresses
  5. 1
      bit-wallet/bit-balance
  6. 1
      bit-wallet/bit-broadcast
  7. 1
      bit-wallet/bit-create
  8. 1
      bit-wallet/bit-export
  9. 1
      bit-wallet/bit-join
  10. 1
      bit-wallet/bit-reject
  11. 1
      bit-wallet/bit-rm
  12. 1
      bit-wallet/bit-send
  13. 1
      bit-wallet/bit-sign
  14. 1
      bit-wallet/bit-status
  15. 1
      bit-wallet/cli-utils.js
  16. 7
      lib/client/api.js

1
README.md

@ -25,6 +25,7 @@ A Multisig HD Wallet Service, with minimun server trust.
# Sets default file to use
export BIT_FILE=pete.dat
export BIT_HOST=http://pepe.com/bws
./bit address
[1bitcoinaddress]
./bit balance

1
bit-wallet/bit

@ -17,6 +17,7 @@ program
.command('rm <txpId>', 'remove a transaction proposal')
.command('export', 'export wallet critical data')
.command('import', 'import wallet critical data')
.command('confirm', 'show copayer\'s data for confirmation')
.parse(process.argv);

1
bit-wallet/bit-address

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
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);

1
bit-wallet/bit-addresses

@ -8,6 +8,7 @@ var Client = require('../lib/client');
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);

1
bit-wallet/bit-balance

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
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);

1
bit-wallet/bit-broadcast

@ -8,6 +8,7 @@ var utils = require('./cli-utils');
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);

1
bit-wallet/bit-create

@ -8,6 +8,7 @@ var utils = require('./cli-utils');
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', String)
.usage('[options] <walletName> <m-n> [copayerName]')
.parse(process.argv);

1
bit-wallet/bit-export

@ -9,6 +9,7 @@ var utils = require('./cli-utils');
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);

1
bit-wallet/bit-join

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
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);

1
bit-wallet/bit-reject

@ -9,6 +9,7 @@ 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);

1
bit-wallet/bit-rm

@ -9,6 +9,7 @@ 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);

1
bit-wallet/bit-send

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
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> <message>')
.parse(process.argv);

1
bit-wallet/bit-sign

@ -8,6 +8,7 @@ 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);

1
bit-wallet/bit-status

@ -7,6 +7,7 @@ var utils = require('./cli-utils');
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);

1
bit-wallet/cli-utils.js

@ -37,6 +37,7 @@ Utils.getClient = function(args) {
});
return new Client({
storage: storage,
baseUrl: args.host || process.env['BIT_HOST'],
verbose: args.verbose
});
}

7
lib/client/api.js

@ -23,10 +23,6 @@ function _createProposalOpts(opts, signingKey) {
return opts;
};
function _getUrl(path) {
return BASE_URL + path;
};
function _parseError(body) {
if (_.isString(body)) {
try {
@ -58,6 +54,7 @@ function API(opts) {
this.storage = opts.storage;
this.verbose = !!opts.verbose;
this.request = request || opts.request;
this.baseUrl = opts.baseUrl || BASE_URL;
if (this.verbose) {
log.level = 'debug';
}
@ -112,7 +109,7 @@ API.prototype._doRequest = function(method, url, args, data, cb) {
if (data.signingPrivKey)
reqSignature = _signRequest(method, url, args, data.signingPrivKey);
var absUrl = _getUrl(url);
var absUrl = this.baseUrl + url;
var args = {
headers: {
'x-identity': data.copayerId,

Loading…
Cancel
Save