From a4bd85e561373ce0f6ca59a453f636383e31bc35 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Jan 2026 14:15:03 +0000 Subject: [PATCH] fix: correct amount handling and mobile invoice display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amount input fixes: - Changed from millisats to sats for user input - Updated label: "Amount (sats, optional)" - Fixed Lightning address resolution: no division, amount is already in sats - Fixed payInvoice: multiply by 1000 to convert sats to millisats for NWC - Fixed confirmation dialog: removed incorrect division by 1000 Before: User enters 1000 (meant as sats) → system treats as 1000000 millisats → sends 1000 sats After: User enters 1000 sats → system converts to 1000000 millisats → sends 1000 sats ✓ Invoice parsing was correct - already converting millisats to sats. The bug was in the confirmation display and amount submission. Mobile receive invoice fix: - Removed nested div with truncate (was causing overflow) - Changed to break-all + line-clamp-2 - Invoice now wraps properly on mobile (2 lines max) - Still tappable to copy --- src/components/WalletViewer.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/WalletViewer.tsx b/src/components/WalletViewer.tsx index a85d86e..1bc49c0 100644 --- a/src/components/WalletViewer.tsx +++ b/src/components/WalletViewer.tsx @@ -366,7 +366,7 @@ export default function WalletViewer() { try { setSending(true); - const amountSats = parseInt(sendAmount) / 1000; // Convert from millisats + const amountSats = parseInt(sendAmount); // Amount is in sats const invoice = await resolveLightningAddress(input, amountSats); // Update the invoice field with the resolved invoice @@ -488,7 +488,8 @@ export default function WalletViewer() { async function handleSendPayment() { setSending(true); try { - const amount = sendAmount ? parseInt(sendAmount) : undefined; + // Convert sats to millisats for NWC protocol + const amount = sendAmount ? parseInt(sendAmount) * 1000 : undefined; await payInvoice(sendInvoice, amount); toast.success("Payment sent successfully"); resetSendDialog(); @@ -1045,7 +1046,7 @@ export default function WalletViewer() {
Amount: - {Math.floor( - parseInt(sendAmount) / 1000, - ).toLocaleString()}{" "} - sats + {parseInt(sendAmount).toLocaleString()} sats
)} @@ -1249,10 +1247,10 @@ export default function WalletViewer() { Invoice (tap to view)
-
{generatedInvoice}
+ {generatedInvoice}