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
This commit is contained in:
Claude
2026-02-20 10:54:33 +00:00
parent 31702cc3d6
commit db4f22b246
2 changed files with 17 additions and 3 deletions

View File

@@ -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

View File

@@ -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(),