getBalance returns total unspent
This commit is contained in:
parent
9fc5505730
commit
58ab0b631e
2 changed files with 52 additions and 19 deletions
src
|
@ -60,6 +60,12 @@ var Wallet = function (seed, options) {
|
|||
return this.changeAddresses[this.changeAddresses.length - 1]
|
||||
}
|
||||
|
||||
this.getBalance = function() {
|
||||
return this.getUnspentOutputs().reduce(function(memo, output){
|
||||
return memo + output.value
|
||||
}, 0)
|
||||
}
|
||||
|
||||
this.getUnspentOutputs = function() {
|
||||
var utxo = []
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue