Browse Source

fix bit client: create, join, status

activeAddress
Ivan Socolsky 10 years ago
parent
commit
c0b7970ff6
  1. 1
      bit-wallet/bit-create
  2. 1
      bit-wallet/bit-join
  3. 4
      bit-wallet/bit-status
  4. 14
      bit-wallet/cli-utils.js
  5. 2
      lib/client/api.js
  6. 1
      test/integration/client.js

1
bit-wallet/bit-create

@ -8,7 +8,6 @@ program = utils.configureCommander(program);
program
.option('-t, --testnet', 'Create a Testnet Wallet')
.option('-n, --nopasswd [level]', 'Set access for no password usage: none(default), readonly, readwrite, full', 'none')
.usage('[options] <walletName> <m-n> [copayerName]')
.parse(process.argv);

1
bit-wallet/bit-join

@ -7,7 +7,6 @@ program = utils.configureCommander(program);
program
.usage('[options] <secret> [copayerName]')
.option('-n, --nopasswd [level]', 'Set access for no password usage: none(default), readonly, readwrite, full', 'none')
.parse(process.argv);
var args = program.args;

4
bit-wallet/bit-status

@ -9,8 +9,7 @@ program
.parse(process.argv);
var args = program.args;
var client = utils.getClient(program);
utils.getClient(program, function (client) {
client.getStatus(function(err, res) {
utils.die(err);
@ -26,3 +25,4 @@ client.getStatus(function(err, res) {
utils.renderTxProposals(res.pendingTxps);
});
});

14
bit-wallet/cli-utils.js

@ -2,6 +2,7 @@ var _ = require('lodash');
var Client = require('../lib/client');
var FileStorage = require('./filestorage');
var read = require('read')
var log = require('npmlog');
var Utils = function() {};
@ -50,11 +51,20 @@ Utils.getClient = function(args, cb) {
});
storage.load(function(err, walletData) {
if (err && err.code != 'ENOENT') die(err);
if (walletData) {
if (!walletData) return cb(client);
client.import(walletData);
}
client.openWallet(function(err, justCompleted) {
if (client.isComplete() && justCompleted) {
Utils.saveClient(args, client, function() {
log.info('Your wallet has just been completed. Please backup your wallet file or use the export command.');
return cb(client);
});
} else {
return cb(client);
}
});
});
};
Utils.saveClient = function(args, client, cb) {

2
lib/client/api.js

@ -329,7 +329,7 @@ API.prototype.joinWallet = function(secret, copayerName, cb) {
};
API.prototype.getStatus = function(cb) {
$.checkState(this.credentials && this.credentials.isComplete());
$.checkState(this.credentials);
var self = this;
self._doGetRequest('/v1/wallets/', function(err, result) {

1
test/integration/client.js

@ -324,6 +324,7 @@ describe('client API ', function() {
});
});
});
it.skip('should return wallet status even if wallet is not yet complete', function(done) {});
});
describe('Address Creation', function() {

Loading…
Cancel
Save