From db4f22b246b2a1df61d20f8860101aeec4a97a30 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Feb 2026 10:54:33 +0000 Subject: [PATCH] feat(settings): add favorite relays list (kind 10012) to relay settings Add kind 10012 (Favorite Relays / Relay Feeds) to the settings UI and account sync fetching. Uses "relay" tags like other NIP-51 lists. https://claude.ai/code/session_01JHirYU56sKDKYhRx6aCQ54 --- src/components/settings/RelayListsSettings.tsx | 16 +++++++++++++++- src/hooks/useAccountSync.ts | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/settings/RelayListsSettings.tsx b/src/components/settings/RelayListsSettings.tsx index ceac87b..a3fabaa 100644 --- a/src/components/settings/RelayListsSettings.tsx +++ b/src/components/settings/RelayListsSettings.tsx @@ -72,6 +72,15 @@ const RELAY_LIST_KINDS: RelayListKindUIConfig[] = [ tagName: "relay", hasMarkers: false, }, + { + kind: 10012, + name: "Favorite Relays", + description: + "Relays you find interesting or want to browse. Can be used by clients for relay discovery and recommendations.", + nip: "51", + tagName: "relay", + hasMarkers: false, + }, { kind: 10050, name: "DM Relays", @@ -362,6 +371,10 @@ export function RelayListsSettings() { () => (pubkey ? eventStore.replaceable(10007, pubkey, "") : undefined), [pubkey], ); + const event10012 = use$( + () => (pubkey ? eventStore.replaceable(10012, pubkey, "") : undefined), + [pubkey], + ); const event10050 = use$( () => (pubkey ? eventStore.replaceable(10050, pubkey, "") : undefined), [pubkey], @@ -372,9 +385,10 @@ export function RelayListsSettings() { 10002: event10002, 10006: event10006, 10007: event10007, + 10012: event10012, 10050: event10050, }), - [event10002, event10006, event10007, event10050], + [event10002, event10006, event10007, event10012, event10050], ); // Local draft state: kind -> entries diff --git a/src/hooks/useAccountSync.ts b/src/hooks/useAccountSync.ts index 0170995..380ba28 100644 --- a/src/hooks/useAccountSync.ts +++ b/src/hooks/useAccountSync.ts @@ -89,7 +89,7 @@ export function useAccountSync() { }; }, [activeAccount?.pubkey, eventStore, setActiveAccountRelays]); - // Fetch other replaceable relay lists (10006, 10007, 10050) when account changes + // Fetch other replaceable relay lists when account changes // These are read directly from EventStore in the settings UI, we just need to trigger fetching useEffect(() => { if (!activeAccount?.pubkey) { @@ -97,7 +97,7 @@ export function useAccountSync() { } const pubkey = activeAccount.pubkey; - const relayListKinds = [10006, 10007, 10050]; + const relayListKinds = [10006, 10007, 10012, 10050]; const subscriptions = relayListKinds.map((kind) => addressLoader({ kind, pubkey, identifier: "" }).subscribe(),