better opts for get address
This commit is contained in:
parent
6b75dd8ddb
commit
79fd185230
2 changed files with 18 additions and 14 deletions
|
|
@ -218,15 +218,17 @@ PublicKeyRing.prototype.generateAddress = function(isChange) {
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
PublicKeyRing.prototype.getAddresses = function(excludeChange) {
|
PublicKeyRing.prototype.getAddresses = function(opts) {
|
||||||
return this.getAddressesInfo(excludeChange).map(function(info) {
|
return this.getAddressesInfo(opts).map(function(info) {
|
||||||
return info.address;
|
return info.address;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
PublicKeyRing.prototype.getAddressesInfo = function(excludeChange) {
|
PublicKeyRing.prototype.getAddressesInfo = function(opts) {
|
||||||
|
opts = opts || {};
|
||||||
|
|
||||||
var ret = [];
|
var ret = [];
|
||||||
if (!excludeChange) {
|
if (!opts.excludeChange) {
|
||||||
for (var i=0; i<this.changeAddressIndex; i++) {
|
for (var i=0; i<this.changeAddressIndex; i++) {
|
||||||
ret.unshift({
|
ret.unshift({
|
||||||
address: this.getAddress(i,true),
|
address: this.getAddress(i,true),
|
||||||
|
|
@ -235,11 +237,13 @@ PublicKeyRing.prototype.getAddressesInfo = function(excludeChange) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i=0; i<this.addressIndex; i++) {
|
if (!opts.excludeMain) {
|
||||||
ret.unshift({
|
for (var i=0; i<this.addressIndex; i++) {
|
||||||
address: this.getAddress(i,false),
|
ret.unshift({
|
||||||
isChange: false
|
address: this.getAddress(i,false),
|
||||||
});
|
isChange: false
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -407,12 +407,12 @@ Wallet.prototype.addSeenToTxProposals = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: remove this method and use getAddressesInfo everywhere
|
// TODO: remove this method and use getAddressesInfo everywhere
|
||||||
Wallet.prototype.getAddresses = function(excludeChange) {
|
Wallet.prototype.getAddresses = function(opts) {
|
||||||
return this.publicKeyRing.getAddresses(excludeChange);
|
return this.publicKeyRing.getAddresses(opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.getAddressesStr = function(excludeChange) {
|
Wallet.prototype.getAddressesStr = function(opts) {
|
||||||
return this.getAddresses(excludeChange).map(function(a) {
|
return this.getAddresses(opts).map(function(a) {
|
||||||
return a.toString();
|
return a.toString();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -422,7 +422,7 @@ Wallet.prototype.getAddressesInfo = function(excludeChange) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.addressIsOwn = function(addrStr, excludeChange) {
|
Wallet.prototype.addressIsOwn = function(addrStr, excludeChange) {
|
||||||
var addrList = this.getAddressesStr(excludeChange);
|
var addrList = this.getAddressesStr({excludeMain:true});
|
||||||
var l = addrList.length;
|
var l = addrList.length;
|
||||||
var ret = false;
|
var ret = false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue