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;
|
||||
};
|
||||
|
||||
PublicKeyRing.prototype.getAddresses = function(excludeChange) {
|
||||
return this.getAddressesInfo(excludeChange).map(function(info) {
|
||||
PublicKeyRing.prototype.getAddresses = function(opts) {
|
||||
return this.getAddressesInfo(opts).map(function(info) {
|
||||
return info.address;
|
||||
});
|
||||
};
|
||||
|
||||
PublicKeyRing.prototype.getAddressesInfo = function(excludeChange) {
|
||||
PublicKeyRing.prototype.getAddressesInfo = function(opts) {
|
||||
opts = opts || {};
|
||||
|
||||
var ret = [];
|
||||
if (!excludeChange) {
|
||||
if (!opts.excludeChange) {
|
||||
for (var i=0; i<this.changeAddressIndex; i++) {
|
||||
ret.unshift({
|
||||
address: this.getAddress(i,true),
|
||||
|
|
@ -235,11 +237,13 @@ PublicKeyRing.prototype.getAddressesInfo = function(excludeChange) {
|
|||
}
|
||||
}
|
||||
|
||||
for (var i=0; i<this.addressIndex; i++) {
|
||||
ret.unshift({
|
||||
address: this.getAddress(i,false),
|
||||
isChange: false
|
||||
});
|
||||
if (!opts.excludeMain) {
|
||||
for (var i=0; i<this.addressIndex; i++) {
|
||||
ret.unshift({
|
||||
address: this.getAddress(i,false),
|
||||
isChange: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue