aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/ark.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-05 11:56:53 -0700
committerAdam Soltys <[email protected]>2026-08-05 11:56:53 -0700
commit1307f8930283393fcf987cfa7e5cfa054676396a (patch)
tree7d31e3355d217ca531f0db8ab95ca59d7d402523 /src/features/ark.js
parent399a100248792fe8d6aaf19849eab3ee3baa1984 (diff)
downloadcoinosv3-1307f8930283393fcf987cfa7e5cfa054676396a.tar.gz
coinosv3-1307f8930283393fcf987cfa7e5cfa054676396a.zip
Spending trusts its own ledger: gifts read persisted ark state, and Savings keeps its pending line to itself
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01M5kFodm9azZJVTQxnkDdKe
Diffstat (limited to 'src/features/ark.js')
-rw-r--r--src/features/ark.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/features/ark.js b/src/features/ark.js
index 2fa151f..1a5a2a2 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -2044,9 +2044,14 @@ export function arkFeature(ctx) {
// ---- ark-gift hooks (called by the gifts feature via ctx.hook) ----
arkGiftInfo() {
- if (!arkAvailable() || !ark || !ark.state) return null;
+ // Persisted state, not the live manager: the gift form renders before
+ // connectArk() has run, and a null here silently flips the gift to the
+ // on-chain source — "more than your balance" against Savings while the
+ // header shows a healthy Spending balance. Creation connects on demand.
+ const b = arkAvailable() ? arkBalance() : null;
+ if (!b) return null;
maybeReconcile(); // the gift form is a send-intent signal too (throttled)
- return { spendableSat: ark.balance().spendableSat };
+ return { spendableSat: b.spendableSat, pendingSat: b.pendingSat };
},
arkGiftDecode(code) { return decodeArkGiftCode(code); },
// A fresh visitor (no wallets) opening a gift link lands on the gift's