mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-16 17:48:34 +02:00
fix: correct amount handling and mobile invoice display
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
This commit is contained in:
@@ -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() {
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium">
|
||||
Amount (optional, millisats)
|
||||
Amount (sats, optional)
|
||||
</label>
|
||||
<Input
|
||||
type="number"
|
||||
@@ -1092,10 +1093,7 @@ export default function WalletViewer() {
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Amount:</span>
|
||||
<span className="font-semibold font-mono">
|
||||
{Math.floor(
|
||||
parseInt(sendAmount) / 1000,
|
||||
).toLocaleString()}{" "}
|
||||
sats
|
||||
{parseInt(sendAmount).toLocaleString()} sats
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
@@ -1249,10 +1247,10 @@ export default function WalletViewer() {
|
||||
Invoice (tap to view)
|
||||
</label>
|
||||
<div
|
||||
className="rounded bg-muted p-3 font-mono text-xs overflow-hidden cursor-pointer hover:bg-muted/80 transition-colors"
|
||||
className="rounded bg-muted p-3 font-mono text-xs cursor-pointer hover:bg-muted/80 transition-colors break-all line-clamp-2"
|
||||
onClick={handleCopyInvoice}
|
||||
>
|
||||
<div className="truncate">{generatedInvoice}</div>
|
||||
{generatedInvoice}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user