Skip to content

fix(nwc): stabilize relay subscription and wallet service info#545

Open
DSanich wants to merge 1 commit intogetAlby:masterfrom
DSanich:fix/nwc-client-relay-subscription
Open

fix(nwc): stabilize relay subscription and wallet service info#545
DSanich wants to merge 1 commit intogetAlby:masterfrom
DSanich:fix/nwc-client-relay-subscription

Conversation

@DSanich
Copy link
Copy Markdown
Contributor

@DSanich DSanich commented Apr 16, 2026

Summary

Stabilizes NWCClient behavior around relay subscriptions and discovery of the wallet service info event (NIP-47 kind 13194). These changes were split out from the NWC contract e2e work so client behavior can be reviewed on its own.

Motivation

  1. subscribeNotifications previously returned the unsubscribe handle as soon as the subscription loop started. Callers could register handlers after the client had already subscribed, which made it easy to miss notifications that arrived immediately after the subscription became active.

  2. getWalletServiceInfo could observe an empty result on the first EOSE (e.g. relay or timing quirks), and then throw even though a valid info event might appear shortly after.

Changes

  • subscribeNotifications: resolve a one-shot promise when the first successful relay subscription is established, and await it before returning the unsubscribe function to callers.
  • getWalletServiceInfo: on empty results, retry up to a limited number of times with incremental backoff before failing with no info event (kind 13194) returned from relay.

Scope

  • src/nwc/NWCClient.ts only.

- Await initial relay subscription in subscribeNotifications before returning
  so callers do not miss early notifications.
- Retry fetching kind 13194 wallet service info with backoff when the relay
  returns no event yet.

Made-with: Cursor
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Warning

Rate limit exceeded

@DSanich has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 9 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 53 minutes and 9 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7ec6f997-d9a7-45e8-aa05-03c77b1dbb97

📥 Commits

Reviewing files that changed from the base of the PR and between da2352b and d6cc4d5.

📒 Files selected for processing (1)
  • src/nwc/NWCClient.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@DSanich
Copy link
Copy Markdown
Contributor Author

DSanich commented Apr 16, 2026

@rolznz Hello! This is a continuation of your message here. I've moved the changes related to NWCClient into a separate PR. So, we have two PRs. Please take a look:

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.

1 participant