diff --git a/src/components/Note/Zap.tsx b/src/components/Note/Zap.tsx
index 69637a0..d252304 100644
--- a/src/components/Note/Zap.tsx
+++ b/src/components/Note/Zap.tsx
@@ -26,6 +26,22 @@ export default function Zap({ event, className }: { event: Event; className?: st
}
const { senderPubkey, recipientPubkey, amount, comment } = zapInfo
+
+ // Determine if this is an event zap or profile zap
+ const isEventZap = targetEvent || zapInfo.eventId
+ const isProfileZap = !isEventZap && recipientPubkey
+
+ // For event zaps, we need to determine the recipient from the zapped event
+ const actualRecipientPubkey = useMemo(() => {
+ if (isEventZap && targetEvent) {
+ // Event zap - recipient is the author of the zapped event
+ return targetEvent.pubkey
+ } else if (isProfileZap) {
+ // Profile zap - recipient is directly specified
+ return recipientPubkey
+ }
+ return undefined
+ }, [isEventZap, isProfileZap, targetEvent, recipientPubkey])
return (
@@ -33,21 +49,29 @@ export default function Zap({ event, className }: { event: Event; className?: st
diff --git a/src/lib/event-metadata.ts b/src/lib/event-metadata.ts
index 8235ed5..2b4593d 100644
--- a/src/lib/event-metadata.ts
+++ b/src/lib/event-metadata.ts
@@ -164,6 +164,32 @@ export function getZapInfoFromEvent(receiptEvent: Event) {
if (!senderPubkey) {
senderPubkey = zapRequest.pubkey
}
+ // Extract recipient from zap request
+ // Priority: e tag (event) -> a tag (addressable event) -> p tag (profile)
+ if (zapRequest.tags) {
+ const eTag = zapRequest.tags.find((tag: string[]) => tag[0] === 'e')
+ const aTag = zapRequest.tags.find((tag: string[]) => tag[0] === 'a')
+ const pTag = zapRequest.tags.find((tag: string[]) => tag[0] === 'p')
+
+ if (eTag && eTag[1]) {
+ // Event zap - recipient is the author of the zapped event
+ // We'll need to fetch this event to get the author's pubkey
+ // For now, fall back to p tag
+ if (pTag && pTag[1]) {
+ recipientPubkey = pTag[1]
+ }
+ } else if (aTag && aTag[1]) {
+ // Addressable event zap - recipient is the author of the zapped event
+ // We'll need to fetch this event to get the author's pubkey
+ // For now, fall back to p tag
+ if (pTag && pTag[1]) {
+ recipientPubkey = pTag[1]
+ }
+ } else if (pTag && pTag[1]) {
+ // Profile zap - recipient is directly specified
+ recipientPubkey = pTag[1]
+ }
+ }
// If invoice parsing failed, try to get amount from zap request tags
if (amount === 0 && zapRequest.tags) {
const amountTag = zapRequest.tags.find((tag: string[]) => tag[0] === 'amount')