filter out change address. Better refresh
This commit is contained in:
parent
9ead0f69f4
commit
5eca1a63c2
3 changed files with 13 additions and 12 deletions
|
|
@ -19,7 +19,7 @@ angular.module('copay.home').controller('HomeController',
|
||||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||||
$location.path('signin');
|
$location.path('signin');
|
||||||
} else {
|
} else {
|
||||||
$scope.addrs = $rootScope.wallet.getAddressesStr();
|
$scope.addrs = $rootScope.wallet.getAddressesStr(true);
|
||||||
$scope.selectedAddr = $scope.addrs[0];
|
$scope.selectedAddr = $scope.addrs[0];
|
||||||
|
|
||||||
_getBalance();
|
_getBalance();
|
||||||
|
|
|
||||||
|
|
@ -192,16 +192,18 @@ PublicKeyRing.prototype.generateAddress = function(isChange) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PublicKeyRing.prototype.getAddresses = function() {
|
PublicKeyRing.prototype.getAddresses = function(onlyMain) {
|
||||||
var ret = [];
|
var ret = [];
|
||||||
|
|
||||||
for (var i=0; i<this.changeAddressIndex; i++) {
|
|
||||||
ret.push(this.getAddress(i,true));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i=0; i<this.addressIndex; i++) {
|
for (var i=0; i<this.addressIndex; i++) {
|
||||||
ret.push(this.getAddress(i,false));
|
ret.push(this.getAddress(i,false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!onlyMain) {
|
||||||
|
for (var i=0; i<this.changeAddressIndex; i++) {
|
||||||
|
ret.push(this.getAddress(i,true));
|
||||||
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,6 @@ Wallet.prototype.sendPublicKeyRing = function(recipients) {
|
||||||
|
|
||||||
Wallet.prototype.generateAddress = function() {
|
Wallet.prototype.generateAddress = function() {
|
||||||
var addr = this.publicKeyRing.generateAddress();
|
var addr = this.publicKeyRing.generateAddress();
|
||||||
this.store();
|
|
||||||
this.sendPublicKeyRing();
|
this.sendPublicKeyRing();
|
||||||
return addr;
|
return addr;
|
||||||
};
|
};
|
||||||
|
|
@ -272,13 +271,13 @@ Wallet.prototype.addSeenToTxProposals = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Wallet.prototype.getAddresses = function() {
|
Wallet.prototype.getAddresses = function(onlyMain) {
|
||||||
return this.publicKeyRing.getAddresses();
|
return this.publicKeyRing.getAddresses(onlyMain);
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.getAddressesStr = function() {
|
Wallet.prototype.getAddressesStr = function(onlyMain) {
|
||||||
var ret = [];
|
var ret = [];
|
||||||
this.publicKeyRing.getAddresses().forEach(function(a) {
|
this.publicKeyRing.getAddresses(onlyMain).forEach(function(a) {
|
||||||
ret.push(a.toString());
|
ret.push(a.toString());
|
||||||
});
|
});
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -334,8 +333,8 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
||||||
self.listUnspent(self.getAddressesStr(), function(utxos) {
|
self.listUnspent(self.getAddressesStr(), function(utxos) {
|
||||||
// TODO check enough funds, etc.
|
// TODO check enough funds, etc.
|
||||||
self.createTxSync(toAddress, amountSatStr, utxos, opts);
|
self.createTxSync(toAddress, amountSatStr, utxos, opts);
|
||||||
self.store();
|
|
||||||
self.sendTxProposals();
|
self.sendTxProposals();
|
||||||
|
self.store();
|
||||||
return cb();
|
return cb();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue