mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-16 17:48:34 +02:00
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:
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user