From 0fa74c239c1340cbfdf3ca3a9d70bdf63c3472ae Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Jan 2026 11:34:27 +0000 Subject: [PATCH] feat: add zap support for NIP-10 thread chat messages Implement getZapConfig method to enable zapping messages in NIP-10 threads: - Returns message author as recipient - Includes event pointer for the message being zapped - Uses conversation metadata relays for zap receipt publishing - Integrates with new zap infrastructure from main branch --- src/lib/chat/adapters/nip-10-adapter.ts | 30 ++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/lib/chat/adapters/nip-10-adapter.ts b/src/lib/chat/adapters/nip-10-adapter.ts index d710d1e..2863e22 100644 --- a/src/lib/chat/adapters/nip-10-adapter.ts +++ b/src/lib/chat/adapters/nip-10-adapter.ts @@ -2,7 +2,11 @@ import { Observable, firstValueFrom, combineLatest } from "rxjs"; import { map, first, toArray } from "rxjs/operators"; import type { Filter } from "nostr-tools"; import { nip19 } from "nostr-tools"; -import { ChatProtocolAdapter, type SendMessageOptions } from "./base-adapter"; +import { + ChatProtocolAdapter, + type SendMessageOptions, + type ZapConfig, +} from "./base-adapter"; import type { Conversation, Message, @@ -530,6 +534,30 @@ export class Nip10Adapter extends ChatProtocolAdapter { await publishEventToRelays(event, relays); } + /** + * Get zap configuration for a message in a NIP-10 thread + * Returns configuration for how zap requests should be constructed + */ + getZapConfig(message: Message, conversation: Conversation): ZapConfig { + // Get relays from conversation metadata + const relays = conversation.metadata?.relays || []; + + // Build eventPointer for the message being zapped + const eventPointer = { + id: message.id, + author: message.author, + relays, + }; + + // Recipient is the message author + return { + supported: true, + recipientPubkey: message.author, + eventPointer, + relays, + }; + } + /** * Load a replied-to message by ID */