aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.js6
-rw-r--r--src/features/ark.js9
-rw-r--r--src/features/gifts.js10
-rw-r--r--src/i18n.js1
4 files changed, 21 insertions, 5 deletions
diff --git a/src/app.js b/src/app.js
index 1a89ac7..d4ac31a 100644
--- a/src/app.js
+++ b/src/app.js
@@ -2525,9 +2525,11 @@ function balanceCard() {
h('div', { class: 'amt', style: firstLoad ? 'opacity:.3' : '' },
firstLoad ? h('span', { class: 'spinner sm', style: 'margin-right:8px' }) : null,
animatedAmount('bal:' + sel, isSpending ? spending : saving), ' ', unitTag('unit')),
- pending > 0 || featLines.length
+ (pending > 0 && !isSpending) || featLines.length
? h('div', { class: 'split' },
- pending > 0
+ // Pending incoming is an on-chain fact — it belongs to the Saving
+ // face, not to whichever account happens to be showing.
+ pending > 0 && !isSpending
? h('div', {}, h('div', { class: 'k' }, t('pending')), h('div', { class: 'v pending' }, fmtAmount(pending), ' ', unitTag()))
: null,
...featLines.map((l) =>
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
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);
diff --git a/src/i18n.js b/src/i18n.js
index 3295358..3c56c30 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -326,6 +326,7 @@ const STR = {
giftMinNote: 'Minimum {n}.',
giftAllNote: 'Gifts your whole balance; the recipient pays the claim fee.',
giftExceedsBalance: 'That’s more than your balance.',
+ giftSettling: '{n} of your balance is still settling — try again in a moment.',
giftNeedsHeadroom: 'Gift up to {n}, or tap Max to gift your whole balance.',
giftAnother: 'Create another',
giftForYou: 'A gift for you',