Fixes show all/show less button on address list

This commit is contained in:
Matias Pando 2014-09-19 17:12:54 -03:00
commit 12adaa64d2
8 changed files with 110 additions and 161 deletions

View file

@ -377,6 +377,7 @@ Network.prototype.send = function(dest, payload, cb) {
var message = this.encode(to, payload);
this.socket.emit('message', message);
}
if (typeof cb === 'function') cb();
@ -405,4 +406,6 @@ Network.prototype.lockIncommingConnections = function(allowedCopayerIdsArray) {
}
};
module.exports = Network;

View file

@ -45,6 +45,7 @@ function PublicKeyRing(opts) {
this.copayerIds = [];
this.copayersBackup = opts.copayersBackup || [];
this.addressToPath = {};
};
/**
@ -322,6 +323,8 @@ PublicKeyRing.prototype.getRedeemScript = function(index, isChange, copayerIndex
return script;
};
/**
* @desc
* Get the address for a multisig based on the given params.
@ -462,9 +465,11 @@ PublicKeyRing.prototype.getAddressesInfo = function(opts, pubkey) {
var ret = [];
var self = this;
var copayerIndex = pubkey && this.getCosigner(pubkey);
this.indexes.forEach(function(index) {
ret = ret.concat(self.getAddressesInfoForIndex(index, opts, copayerIndex));
});
return ret;
};
@ -489,18 +494,19 @@ PublicKeyRing.prototype.getAddressesInfo = function(opts, pubkey) {
*/
PublicKeyRing.prototype.getAddressesInfoForIndex = function(index, opts, copayerIndex) {
opts = opts || {};
var isOwned = index.copayerIndex === HDPath.SHARED_INDEX || index.copayerIndex === copayerIndex;
var ret = [];
var appendAddressInfo = function(address, isChange) {
var appendAddressInfo = function(address, isChange, index) {
ret.unshift({
address: address,
addressStr: address.toString(),
isChange: isChange,
owned: isOwned
owned: isOwned,
//index: index.copayerIndex
});
};
for (var i = 0; !opts.excludeChange && i < index.changeIndex; i++) {
appendAddressInfo(this.getAddress(i, true, index.copayerIndex), true);
}