add wallets nicknames, handle error messages

This commit is contained in:
Matias Alejo Garcia 2014-04-24 16:35:52 -03:00
commit 5d30a6abea
8 changed files with 98 additions and 48 deletions

View file

@ -25,6 +25,7 @@ function Wallet(opts) {
this.log('creating '+opts.requiredCopayers+' of '+opts.totalCopayers+' wallet');
this.id = opts.id || Wallet.getRandomId();
this.name = opts.name;
this.verbose = opts.verbose;
this.publicKeyRing.walletId = this.id;
this.txProposals.walletId = this.id;
@ -137,6 +138,7 @@ Wallet.prototype._optsToObj = function () {
spendUnconfirmed: this.spendUnconfirmed,
requiredCopayers: this.requiredCopayers,
totalCopayers: this.totalCopayers,
name: this.name,
};
return obj;
@ -172,6 +174,7 @@ Wallet.prototype.netStart = function() {
copayerId: myId,
signingKeyHex: self.privateKey.getSigningKey(),
};
net.start(startOpts, function() {
self.emit('created');
for (var i=0; i<self.publicKeyRing.registeredCopayers(); i++) {
@ -518,6 +521,8 @@ Wallet.prototype.connectTo = function(peerId) {
};
Wallet.prototype.disconnect = function() {
console.log('[Wallet.js.524] DISC'); //TODO
this.network.disconnect();
};

View file

@ -73,7 +73,7 @@ WalletFactory.prototype.read = function(walletId) {
w.privateKey.getExtendedPublicKeyString()
);
} catch (e) {
this.log('NOT NECCESARY AN ERROR:', e); //TODO
// No really an error, just to be sure.
}
this.log('### WALLET OPENED:', w.id);
return w;
@ -129,9 +129,13 @@ WalletFactory.prototype.open = function(walletId, opts) {
return w;
};
WalletFactory.prototype.getWalletIds = function() {
return this.storage.getWalletIds();
}
WalletFactory.prototype.getWallets = function() {
var ret = this.storage.getWallets();
ret.forEach(function(i) {
i.show = i.name ? ( (i.name + ' <'+i.id+'>') ) : i.id;
});
return ret;
};
WalletFactory.prototype.remove = function(walletId) {
// TODO remove wallet contents