mirror of https://github.com/BTCPrivate/copay.git
better opts for get address
This commit is contained in:
parent
6b75dd8ddb
commit
79fd185230
|
@ -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,12 +237,14 @@ PublicKeyRing.prototype.getAddressesInfo = function(excludeChange) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!opts.excludeMain) {
|
||||
for (var i=0; i<this.addressIndex; i++) {
|
||||
ret.unshift({
|
||||
address: this.getAddress(i,false),
|
||||
isChange: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
|
|
@ -407,12 +407,12 @@ Wallet.prototype.addSeenToTxProposals = function() {
|
|||
};
|
||||
|
||||
// TODO: remove this method and use getAddressesInfo everywhere
|
||||
Wallet.prototype.getAddresses = function(excludeChange) {
|
||||
return this.publicKeyRing.getAddresses(excludeChange);
|
||||
Wallet.prototype.getAddresses = function(opts) {
|
||||
return this.publicKeyRing.getAddresses(opts);
|
||||
};
|
||||
|
||||
Wallet.prototype.getAddressesStr = function(excludeChange) {
|
||||
return this.getAddresses(excludeChange).map(function(a) {
|
||||
Wallet.prototype.getAddressesStr = function(opts) {
|
||||
return this.getAddresses(opts).map(function(a) {
|
||||
return a.toString();
|
||||
});
|
||||
};
|
||||
|
@ -422,7 +422,7 @@ Wallet.prototype.getAddressesInfo = function(excludeChange) {
|
|||
};
|
||||
|
||||
Wallet.prototype.addressIsOwn = function(addrStr, excludeChange) {
|
||||
var addrList = this.getAddressesStr(excludeChange);
|
||||
var addrList = this.getAddressesStr({excludeMain:true});
|
||||
var l = addrList.length;
|
||||
var ret = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue