summaryrefslogtreecommitdiffstats
path: root/src/wallet.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet.js')
-rw-r--r--src/wallet.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet.js b/src/wallet.js
index 72d33be..2871c5e 100644
--- a/src/wallet.js
+++ b/src/wallet.js
@@ -583,6 +583,19 @@ export class Wallet {
return this.confirmed + this.pending;
}
+ // Confirmed coins locked behind unclaimed gift links. The whole source coin is
+ // committed until the gift is claimed (our change only comes back in the
+ // claimer's tx), so it's already excluded from spending — and from the
+ // spendable balance below.
+ get lockedValue() {
+ const res = this.reservedSet();
+ return this.utxos.reduce((s, u) => s + (res.has(utxoId(u)) ? u.value : 0), 0);
+ }
+ // What the user can actually spend right now: everything minus gift locks.
+ get spendable() {
+ return this.total - this.lockedValue;
+ }
+
_recomputeBalanceFromChains() {
let c = 0;
let p = 0;