diff --git a/components/ZapButton.tsx b/components/ZapButton.tsx index 5cf58d2..8fa8bf9 100644 --- a/components/ZapButton.tsx +++ b/components/ZapButton.tsx @@ -126,8 +126,15 @@ export default function ZapButton({ event }: { event: any }) { events.forEach((event) => { event.tags.forEach((tag) => { if (tag[0] === 'bolt11') { - let decoded = lightningPayReq.decode(tag[1]); - sats = sats + decoded.satoshis; + try { + lightningPayReq.decode(tag[1]); + let decoded = lightningPayReq.decode(tag[1]); + sats = sats + decoded.satoshis; + } catch (e) { + console.error("Error decoding bolt11 tag:", e); + console.log(tag[1]); + return null; + } } }); }); diff --git a/components/ZapButtonListItem.tsx b/components/ZapButtonListItem.tsx index 46ad4bd..95f5d54 100644 --- a/components/ZapButtonListItem.tsx +++ b/components/ZapButtonListItem.tsx @@ -49,9 +49,14 @@ export default function ZapButtonListItem({ event }: { event: NostrEvent }) { var lightningPayReq = require('bolt11'); event.tags.forEach((tag) => { if (tag[0] === 'bolt11') { - let decoded = lightningPayReq.decode(tag[1]); - // console.log(decoded.satoshis); - sats = decoded.satoshis; + try { + let decoded = lightningPayReq.decode(tag[1]); + // console.log(decoded.satoshis); + sats = decoded.satoshis; + } catch (e) { + console.error("Error decoding bolt11 tag:", e); + return null; + } } });