Skip to content

feat: server identity parsing, relay list fetching, and fetch_events (CEP-17)#82

Merged
ContextVM-org merged 1 commit into
ContextVM:mainfrom
harsh04044:feat/cep17-pr1-identity-relay-discovery
May 25, 2026
Merged

feat: server identity parsing, relay list fetching, and fetch_events (CEP-17)#82
ContextVM-org merged 1 commit into
ContextVM:mainfrom
harsh04044:feat/cep17-pr1-identity-relay-discovery

Conversation

@harsh04044
Copy link
Copy Markdown

Part of CEP-17 implementation #80.

Adds all the standalone building blocks for client-side relay discovery - no transport wiring yet, that's PR 2.

What's new:

parse_server_identity() - accepts hex pubkey, npub, or nprofile. Extracts relay hints from nprofile for use in relay resolution later. NostrClientTransport now uses this instead of PublicKey::from_hex(), so nprofile identifiers work as serverPubkey today.

fetch_server_relay_list() - creates a temporary relay pool, connects to discovery relays, fetches kind 10002, returns parsed RelayListEntry vec with url + optional marker. Disconnects in all code paths.

select_operational_relay_urls() - picks operational relays from a relay list. Prefers unmarked entries, falls back to read+write union, deduplicates.

RelayPoolTrait::fetch_events() - added Vec variant to the trait and all impls (RelayPool, MockRelayPool, TestRelayPool). MockRelayPool also gets inject_event() for test setup.

@harsh04044 harsh04044 force-pushed the feat/cep17-pr1-identity-relay-discovery branch from 83d1f87 to de726a4 Compare May 21, 2026 21:37
@ContextVM-org
Copy link
Copy Markdown
Collaborator

Overall I think it looks good to merge.
My only minor note is that RelayPool::fetch_events() currently loops over filters one by one; that’s functionally correct for the current usage, but if nostr-sdk supports batching multiple filters in one fetch call, that might be worth revisiting later for efficiency. Not a blocker for this PR.

@ContextVM-org ContextVM-org merged commit 64e88ed into ContextVM:main May 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants