Hide empty addresses from othe copayers
This commit is contained in:
parent
04b6aa4003
commit
fd2cf54eb4
5 changed files with 24 additions and 9 deletions
|
|
@ -246,18 +246,22 @@ PublicKeyRing.prototype.getCosigner = function(pubKey) {
|
|||
}
|
||||
|
||||
|
||||
PublicKeyRing.prototype.getAddressesInfo = function(opts) {
|
||||
PublicKeyRing.prototype.getAddressesInfo = function(opts, pubkey) {
|
||||
var ret = [];
|
||||
var self = this;
|
||||
var cosigner = pubkey && this.getCosigner(pubkey);
|
||||
this.indexes.forEach(function(index) {
|
||||
ret = ret.concat(self.getAddressesInfoForIndex(index, opts));
|
||||
ret = ret.concat(self.getAddressesInfoForIndex(index, opts, cosigner));
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
PublicKeyRing.prototype.getAddressesInfoForIndex = function(index, opts) {
|
||||
PublicKeyRing.prototype.getAddressesInfoForIndex = function(index, opts, cosigner) {
|
||||
opts = opts || {};
|
||||
|
||||
var isOwned = index.cosigner == Structure.SHARED_INDEX
|
||||
|| index.cosigner == cosigner;
|
||||
|
||||
var ret = [];
|
||||
if (!opts.excludeChange) {
|
||||
for (var i = 0; i < index.changeIndex; i++) {
|
||||
|
|
@ -265,7 +269,8 @@ PublicKeyRing.prototype.getAddressesInfoForIndex = function(index, opts) {
|
|||
ret.unshift({
|
||||
address: a,
|
||||
addressStr: a.toString(),
|
||||
isChange: true
|
||||
isChange: true,
|
||||
owned: isOwned
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -276,7 +281,8 @@ PublicKeyRing.prototype.getAddressesInfoForIndex = function(index, opts) {
|
|||
ret.unshift({
|
||||
address: a,
|
||||
addressStr: a.toString(),
|
||||
isChange: false
|
||||
isChange: false,
|
||||
owned: isOwned
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ Wallet.prototype.getAddressesStr = function(opts) {
|
|||
};
|
||||
|
||||
Wallet.prototype.getAddressesInfo = function(opts) {
|
||||
return this.publicKeyRing.getAddressesInfo(opts);
|
||||
return this.publicKeyRing.getAddressesInfo(opts, this.publicKey);
|
||||
};
|
||||
|
||||
Wallet.prototype.addressIsOwn = function(addrStr, opts) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue