Skip to content

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

Open
CKodidela wants to merge 2 commits intocameri:mainfrom
CKodidela:feat/nip65
Open

feat: add NIP-65 (Relay List Metadata) support#585
CKodidela wants to merge 2 commits intocameri:mainfrom
CKodidela:feat/nip65

Conversation

@CKodidela
Copy link
Copy Markdown
Collaborator

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
Copy link
Copy Markdown

changeset-bot Bot commented Apr 27, 2026

🦋 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
Name Type
nostream Minor

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

Copy link
Copy Markdown

Copilot AI left a comment

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
File Description
src/constants/base.ts Introduces EventKinds.RELAY_LIST constant for kind 10002.
src/utils/nip65.ts Adds NIP-65 helpers to detect/parse relay list events (r tags + markers).
package.json Adds NIP-65 (65) to supportedNips (used for NIP-11 relay info + logging).
README.md Updates supported NIPs list to include NIP-65.
.changeset/nip-65-relay-list-metadata.md Changeset documenting the new NIP-65 feature.
test/unit/factories/event-strategy-factory.spec.ts Ensures relay_list events are treated as replaceable by the strategy factory.
test/unit/utils/nip65.spec.ts Unit tests for isRelayListEvent and parseRelayList.
test/integration/features/nip-65/nip-65.feature BDD scenarios for publishing/updating/querying relay lists, including read/write markers.
test/integration/features/nip-65/nip-65.feature.ts Step definitions implementing the NIP-65 BDD scenarios.

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

Comment thread src/constants/base.ts Outdated
Comment thread src/utils/nip65.ts Outdated
Comment thread src/utils/nip65.ts
@CKodidela
Copy link
Copy Markdown
Collaborator Author

CKodidela commented Apr 27, 2026

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

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.

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

4 participants