fix: Use kind 10050 (DM relay list) for gift wrap syncing

NIP-17 specifies kind 10050 for DM relay list, not kind 10002.

**Changes:**
- Fetch kind 10050 (DM relay list) instead of kind 10002
- Parse relay tags with read marker for inbox relays
- These relays are used for:
  - Syncing gift wraps on inbox load
  - Subscribing to new gift wraps
  - (Future) Sending gift wraps to recipient's DM relays

Kind 10050 format:
- ['relay', '<url>', 'read'] - for receiving DMs
- ['relay', '<url>', 'write'] - for sending DMs
- ['relay', '<url>'] - for both
This commit is contained in:
Claude
2026-01-14 20:18:19 +00:00
parent 38e39eafc5
commit 018401a084

View File

@@ -48,19 +48,22 @@ export default function InboxViewer({ action }: InboxViewerProps) {
const syncGiftWraps = async () => {
setLoading(true);
try {
// Get inbox relays from user's kind 10002 relay list event
const relayListEvent = await firstValueFrom(
eventStore.replaceable({ kind: 10002, pubkey }),
// Get DM relays from user's kind 10050 relay list (NIP-17)
const dmRelayListEvent = await firstValueFrom(
eventStore.replaceable({ kind: 10050, pubkey }),
);
const inboxRelays = relayListEvent
? Array.from(getInboxes(relayListEvent))
// Kind 10050 uses read/write relay tags
const dmRelays = dmRelayListEvent
? dmRelayListEvent.tags
.filter((t) => t[0] === "relay" && (!t[2] || t[2] === "read"))
.map((t) => t[1])
: [];
// Fallback to default relays if no inbox relays
// Fallback to default relays if no DM relays configured
const relays =
inboxRelays.length > 0
? inboxRelays
dmRelays.length > 0
? dmRelays
: [
"wss://relay.damus.io",
"wss://nos.lol",