diff options
| author | Adam Soltys <[email protected]> | 2026-08-17 23:59:14 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-17 23:59:14 -0700 |
| commit | 828d3b7fb6644a56938820693e8253148113fb77 (patch) | |
| tree | 8d742f80e3e5c13e1c0e79589e97e42243230473 /src/features/ark.js | |
| parent | 9484c2b29a621a4413b91a88391d4f299d3323a2 (diff) | |
| download | coinosv3-828d3b7fb6644a56938820693e8253148113fb77.tar.gz coinosv3-828d3b7fb6644a56938820693e8253148113fb77.zip | |
An empty Spending stops being a dead end: the zap button becomes the door to boarding, prefilled with what the payment needs and open to more
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JtaatFfAbx91Nh3xqKVqKz
Diffstat (limited to 'src/features/ark.js')
| -rw-r--r-- | src/features/ark.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/features/ark.js b/src/features/ark.js index dd71062..223fe3e 100644 --- a/src/features/ark.js +++ b/src/features/ark.js @@ -2133,6 +2133,24 @@ export function arkFeature(ctx) { canLnPay() { return arkAvailable() && !wallet.watchOnly && !!(ark && ark.info); }, lnSpendableSat() { const b = arkBalance(); return b ? b.spendableSat : 0; }, settingsCards() { return [autoWithdrawCard()]; }, + // A payment wants more Spending than exists: open the board panel with a + // prefill that nets out to the need (gross of the board fee, with a bit + // of routing headroom) — editable, so boarding extra is one keystroke. + arkOfferBoard(needSat) { + if (!arkAvailable() || wallet.watchOnly) return false; + const b = arkBalance(); + const have = b ? b.spendableSat : 0; + const short = Math.max(0, Math.ceil(needSat * 1.01) + 2 - have); + let gross = short; + try { for (let i = 0; i < 4; i++) gross = short + boardFee(gross, ark.info.boardFees); } catch {} + const minBoard = (ark && ark.info && ark.info.minBoardAmountSat) || 0; + ctx.goHome(); + ui.arkMoveOpen = true; + ui.arkMoveDir = 'toSpending'; + ui.arkBoardAmt = String(Math.max(gross, minBoard)); + render(); + return true; + }, startLnPay(invoice, meta) { return startArkLnPay(invoice, meta); }, // ---- headless seam for the NWC wallet service ---- arkPayInvoice(invoice, opts) { return payInvoiceHeadless(invoice, opts); }, |
