fix(nwc): stabilize relay subscription and wallet service info#545
fix(nwc): stabilize relay subscription and wallet service info#545DSanich wants to merge 1 commit intogetAlby:masterfrom
Conversation
- 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
|
Warning Rate limit exceeded
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 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. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Stabilizes
NWCClientbehavior 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
subscribeNotificationspreviously 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.getWalletServiceInfocould observe an empty result on the firstEOSE(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, andawaitit before returning the unsubscribe function to callers.getWalletServiceInfo: on empty results, retry up to a limited number of times with incremental backoff before failing withno info event (kind 13194) returned from relay.Scope
src/nwc/NWCClient.tsonly.