stackernews / stacker.news

Internet communities that pay you Bitcoin
https://stacker.news
MIT License
434 stars 112 forks source link

Support multiple NWC relays #1549

Open ekzyis opened 1 week ago

ekzyis commented 1 week ago

Describe the problem you're trying to solve

Wallets like cashu.me include multiple relays in their NWC connection string. We currently only use the first relay.

Describe the solution you'd like

Parse all relays from NWC connection in parseNwcUrl using url.searchParams.getAll('relay') instead of url.searchParams.get('relay') and use all of them to publish requests and listen for responses.

https://github.com/stackernews/stacker.news/blob/4cc3780eca1f1390bdd331f0e418b9a7efd4347e/lib/url.js#L190-L214

Describe alternatives you've considered

No response

Additional context

Logging would become very noisy if we log all events for every relay individually like we do now for the single relay. We should consider to remove all logs inside the nwcCall function if they aren't needed. NWC is the only wallet that uses the logger inside its own functions. So maybe it's indeed not needed and we can simply rely on general wallet logs?

riccardobl commented 5 days ago

this is the default behavior in ndk, so it should be fixed by #1590