diff --git a/src/components/ZapWindow.tsx b/src/components/ZapWindow.tsx index b1ea8da..bd89f21 100644 --- a/src/components/ZapWindow.tsx +++ b/src/components/ZapWindow.tsx @@ -162,6 +162,11 @@ export function ZapWindow({ : recipientPubkey.slice(0, 8); }, [recipientPubkey, recipientProfile]); + // Check if recipient has a lightning address + const hasLightningAddress = !!( + recipientProfile?.lud16 || recipientProfile?.lud06 + ); + // Track amount usage const trackAmountUsage = (amount: number) => { const newUsage = { @@ -229,8 +234,6 @@ export function ZapWindow({ } // Step 2: Resolve LNURL to get callback URL and nostrPubkey - toast.info("Resolving Lightning address..."); - let lnurlData; if (lud16) { lnurlData = await resolveLightningAddress(lud16); @@ -277,8 +280,6 @@ export function ZapWindow({ } // Step 3: Create and sign zap request event (kind 9734) - toast.info("Creating zap request..."); - const zapRequest = await createZapRequest({ recipientPubkey, amountMillisats, @@ -291,8 +292,6 @@ export function ZapWindow({ const serializedZapRequest = serializeZapRequest(zapRequest); // Step 4: Fetch invoice from LNURL callback - toast.info("Fetching invoice..."); - const invoiceResponse = await fetchInvoiceFromCallback( lnurlData.callback, amountMillisats, @@ -305,8 +304,6 @@ export function ZapWindow({ // Step 5: Pay or show QR code if (useWallet && wallet && walletInfo?.methods.includes("pay_invoice")) { // Pay with NWC wallet with timeout - toast.info("Paying invoice with wallet..."); - try { // Race between payment and 30 second timeout const paymentPromise = payInvoice(invoiceText); @@ -319,15 +316,9 @@ export function ZapWindow({ setIsPaid(true); toast.success(`⚡ Zapped ${amount} sats to ${recipientName}!`); - - // Show success message from LNURL service if available - if (invoiceResponse.successAction?.message) { - toast.info(invoiceResponse.successAction.message); - } } catch (error) { if (error instanceof Error && error.message === "TIMEOUT") { // Payment timed out - show QR code with retry option - toast.warning("Wallet payment timed out. Showing QR code instead."); setPaymentTimedOut(true); const qrUrl = await generateQrCode(invoiceText); setQrCodeUrl(qrUrl); @@ -344,7 +335,6 @@ export function ZapWindow({ setQrCodeUrl(qrUrl); setInvoice(invoiceText); setShowQrDialog(true); - toast.success("Invoice ready! Scan or copy to pay."); } } catch (error) { console.error("Zap error:", error); @@ -385,8 +375,6 @@ export function ZapWindow({ setPaymentTimedOut(false); try { - toast.info("Retrying payment with wallet..."); - // Try again with timeout const paymentPromise = payInvoice(invoice); const timeoutPromise = new Promise((_, reject) => @@ -401,7 +389,7 @@ export function ZapWindow({ toast.success("⚡ Payment successful!"); } catch (error) { if (error instanceof Error && error.message === "TIMEOUT") { - toast.error("Payment timed out again. Please try manually."); + toast.error("Payment timed out. Please try manually."); setPaymentTimedOut(true); setShowQrDialog(true); } else { @@ -526,11 +514,11 @@ export function ZapWindow({ {/* Amount Selection */}