From 0bfc5701c04bcb7848e26e25c7b31d54772bb20e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Jan 2026 14:20:47 +0000 Subject: [PATCH] fix: convert sats to millisats when generating invoices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Critical bug fix - we were generating nearly amountless invoices. Before: - User enters 1000 sats in UI - We passed 1000 to makeInvoice (thinking it's millisats) - Generated invoice for 1000 millisats = 1 sat After: - User enters 1000 sats in UI - We multiply by 1000 → 1,000,000 millisats - Generated invoice for 1,000,000 millisats = 1000 sats ✓ This matches the send flow where we also convert sats to millisats before passing to NWC protocol. --- src/components/WalletViewer.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/WalletViewer.tsx b/src/components/WalletViewer.tsx index 1bc49c0..376d129 100644 --- a/src/components/WalletViewer.tsx +++ b/src/components/WalletViewer.tsx @@ -512,15 +512,17 @@ export default function WalletViewer() { } async function handleGenerateInvoice() { - const amount = parseInt(receiveAmount); - if (!amount || amount <= 0) { + const amountSats = parseInt(receiveAmount); + if (!amountSats || amountSats <= 0) { toast.error("Please enter a valid amount"); return; } setGenerating(true); try { - const result = await makeInvoice(amount, { + // Convert sats to millisats for NWC protocol + const amountMillisats = amountSats * 1000; + const result = await makeInvoice(amountMillisats, { description: receiveDescription || undefined, });