Skip to content

feat: add NIP-65 (Relay List Metadata) support - #585

Merged
cameri merged 2 commits into
cameri:mainfrom
CKodidela:feat/nip65
Apr 28, 2026
Merged

feat: add NIP-65 (Relay List Metadata) support#585
cameri merged 2 commits into
cameri:mainfrom
CKodidela:feat/nip65

Conversation

@CKodidela

Copy link
Copy Markdown
Contributor

Description

Added support for NIP-65 (Relay List Metadata). This includes adding event kind 10002 as a ReplaceableEventStrategy, and implementing utility functions isRelayListEvent and parseRelayList to parse r tags correctly with read and write markers.

Related Issue

Closes#577

Motivation and Context

To support the NIP-65 standard which allows users to advertise their preferred read and write relays, improving interoperability across different clients.

How Has This Been Tested?

I added both unit and integration tests to ensure the feature functions correctly:

  • Unit Tests: Added tests for the event strategy factory to ensure kind 10002 is properly treated as a replaceable event. Added tests for isRelayListEvent and parseRelayList to verify correct parsing of tags and markers.
  • Integration Tests: Added BDD tests via Cucumber (nip65.feature) verifying the creation, sending, subscribing to, and receiving of relay_list events.

Screenshots (if appropriate):

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

@changeset-bot

changeset-botBot commented Apr 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 48676cb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
nostreamMinor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds NIP-65 (Relay List Metadata) support by recognizing kind 10002 (relay_list) as a first-class event kind, advertising it via the NIP-11 relay info document, and providing utilities + tests for parsing NIP-65 relay tags.

Changes:

  • Add EventKinds.RELAY_LIST = 10002 and advertise NIP-65 support in the relay’s supported_nips.
  • Introduce src/utils/nip65.ts utilities (isRelayListEvent, parseRelayList) to parse r tags with optional read/write markers.
  • Add unit + Cucumber integration coverage validating replaceable semantics and tag parsing/roundtrip behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
src/constants/base.tsIntroduces EventKinds.RELAY_LIST constant for kind 10002.
src/utils/nip65.tsAdds NIP-65 helpers to detect/parse relay list events (r tags + markers).
package.jsonAdds NIP-65 (65) to supportedNips (used for NIP-11 relay info + logging).
README.mdUpdates supported NIPs list to include NIP-65.
.changeset/nip-65-relay-list-metadata.mdChangeset documenting the new NIP-65 feature.
test/unit/factories/event-strategy-factory.spec.tsEnsures relay_list events are treated as replaceable by the strategy factory.
test/unit/utils/nip65.spec.tsUnit tests for isRelayListEvent and parseRelayList.
test/integration/features/nip-65/nip-65.featureBDD scenarios for publishing/updating/querying relay lists, including read/write markers.
test/integration/features/nip-65/nip-65.feature.tsStep definitions implementing the NIP-65 BDD scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/constants/base.ts Outdated
Comment threadsrc/utils/nip65.ts Outdated
Comment threadsrc/utils/nip65.ts
@CKodidela

CKodidela commented Apr 27, 2026

Copy link
Copy Markdown
ContributorAuthor

@cameri
I had to fix getRelayUptimeSeconds because runCommandWithOutput was rejecting the promise when Docker wasn’t installed. In that case, spawn emits an ENOENT error instead of returning a non-zero exit code, which caused info --json to crash with exit code 1 and broke the pre-commit hook.
I can undo the change and make it as a separate PR if needed

@CKodidela
CKodidela requested a review from cameriApril 27, 2026 16:53
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 64.107% (+0.09%) from 64.015% — CKodidela:feat/nip65 into cameri:main

@cameri

Copy link
Copy Markdown
Owner

@CKodidela I don't have a strong opinion on that. Do you mind creating an issue to discuss potential alternatives for the getRelayUptimeSeconfs function?

@cameri
cameri merged commit ce59383 into cameri:mainApr 28, 2026
16 checks passed
@camericameri mentioned this pull request Apr 26, 2026
@CKodidela

Copy link
Copy Markdown
ContributorAuthor

Sure will do that.

Sign up for freeto 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.

feat: add NIP-65 (Relay List Metadata) support

4 participants

@CKodidela@coveralls@cameri