aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/gifts.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/gifts.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/gifts.js')
-rw-r--r--src/features/gifts.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/features/gifts.js b/src/features/gifts.js
index 0543030..e3025d3 100644
--- a/src/features/gifts.js
+++ b/src/features/gifts.js
@@ -412,7 +412,15 @@ export function giftsFeature(ctx) {
const avail = info ? info.spendableSat : 0;
const amt = ui.giftMax ? avail : parseAmount(ui.giftAmount, getUnit());
if (!amt || amt < 1) { ui.giftError = t('giftAmountInvalid', { n: fmtAmount(1) + ' ' + unitLabel() }); render(); return; }
- if (amt > avail) { ui.giftError = t('giftExceedsBalance'); render(); return; }
+ if (amt > avail) {
+ // The headline Spending number includes settling coins; when those are
+ // what's missing, say so instead of disputing the user's own balance.
+ const pend = (info && info.pendingSat) || 0;
+ ui.giftError = amt <= avail + pend
+ ? t('giftSettling', { n: fmtAmount(pend) + ' ' + unitLabel() })
+ : t('giftExceedsBalance');
+ render(); return;
+ }
ui.busy = true; ui.giftError = ''; render();
try {
const g = await hook('arkGiftCreate', amt);