From be7a1f919f36b010560d7920096b32a060db0f12 Mon Sep 17 00:00:00 2001 From: Danny Morabito Date: Tue, 5 Aug 2025 18:59:22 +0200 Subject: [PATCH] When using bolt11 show how much the user is paying --- src/lib/components/SendDialog.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/components/SendDialog.svelte b/src/lib/components/SendDialog.svelte index e13e5ef..62e9334 100644 --- a/src/lib/components/SendDialog.svelte +++ b/src/lib/components/SendDialog.svelte @@ -10,11 +10,13 @@ let amountSat = $state(""); let status = $state(""); + let isBolt11 = $state(false); let requireAmount = $state(false); $effect(() => { (async () => { + isBolt11 = false; if (!destination.trim()) { requireAmount = false; return; @@ -29,7 +31,8 @@ parsed.invoice.amountMsat > 0 ) { requireAmount = false; - amountSat = ""; + amountSat = Math.floor(parsed.invoice.amountMsat / 1000); + isBolt11 = true; } else { requireAmount = true; } @@ -45,7 +48,7 @@ if (!$walletState.open) throw new Error("Wallet not open"); const sendGenerator = $walletState.wallet.pay( destination, - Number(amountSat) || 0 + Number(amountSat) || 0, ); for await (const { status: sendStatus, @@ -130,6 +133,8 @@ placeholder="amount in sats" /> + {:else if isBolt11} +

Paying {amountSat} sats

{/if} {#if status}