diff --git a/src/element/send-zap.tsx b/src/element/send-zap.tsx index 530b9d4..c8b0ddd 100644 --- a/src/element/send-zap.tsx +++ b/src/element/send-zap.tsx @@ -13,7 +13,11 @@ export interface LNURLLike { get name(): string; get maxCommentLength(): number; get canZap(): boolean; - getInvoice(amountInSats: number, comment?: string, zap?: NostrEvent): Promise<{ pr?: string }> + getInvoice( + amountInSats: number, + comment?: string, + zap?: NostrEvent + ): Promise<{ pr?: string }>; } export interface SendZapsProps { @@ -93,8 +97,12 @@ export function SendZaps({ if (window.webln) { await window.webln.enable(); - await window.webln.sendPayment(invoice.pr); - onFinish(); + try { + await window.webln.sendPayment(invoice.pr); + onFinish(); + } catch (error) { + setInvoice(invoice.pr); + } } else { setInvoice(invoice.pr); } @@ -138,16 +146,18 @@ export function SendZaps({ ))} - {svc && (svc.maxCommentLength > 0 || svc.canZap) &&