Initial getBalance of all your addresses. Socket-io that listening if your address receives btc.
Known bug: if you add new the address you can to recall socket-io. Socket-io should be listening on headerController.
This commit is contained in:
parent
864156ed4f
commit
eaa1bc37e0
7 changed files with 54 additions and 10 deletions
|
|
@ -276,7 +276,15 @@ Wallet.prototype.getAddressesStr = function() {
|
|||
return ret;
|
||||
};
|
||||
|
||||
|
||||
Wallet.prototype.getBalance = function(cb) {
|
||||
var balance = 0;
|
||||
this.blockchain.listUnspent(this.getAddressesStr(), function(unspent) {
|
||||
for(var i=0;i<unspent.length; i++) {
|
||||
balance = balance + unspent[i].amount;
|
||||
}
|
||||
return cb(balance);
|
||||
});
|
||||
};
|
||||
|
||||
Wallet.prototype.listUnspent = function(cb) {
|
||||
this.blockchain.listUnspent(this.getAddressesStr(), cb);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue