fix: convert sats to millisats when generating invoices

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.
This commit is contained in:
Claude
2026-01-18 14:20:47 +00:00
parent a4bd85e561
commit 0bfc5701c0

View File

@@ -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,
});