fix: max amount

This commit is contained in:
Vlad Stan
2022-08-03 13:50:07 +03:00
parent b576ef4f21
commit eedd0ee6a3
6 changed files with 32 additions and 24 deletions
@@ -45,6 +45,11 @@ async function payment(path) {
},
feeValue: function () {
return this.feeRate * this.txSize
},
selectedAmount: function () {
return this.utxos
.filter(utxo => utxo.selected)
.reduce((t, a) => t + (a.amount || 0), 0)
}
},
@@ -84,7 +89,7 @@ async function payment(path) {
fingerprint: w.fingerprint
}))
}
tx.inputs = this.utxos.data
tx.inputs = this.utxos
.filter(utxo => utxo.selected)
.map(mapUtxoToPsbtInput)
.sort((a, b) =>