You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
.replace('nostr+walletconnect://','http://')// makes it possible to parse with URL in the different environments (browser/node/...)
// XXX There is a bug in parsing since we use the URL constructor for parsing:
// A wallet pubkey matching /^[0-9a-fA-F]{64}$/ might not be a valid hostname.
// Example: 11111111111 (10 1's) is a valid hostname (gets parsed as IPv4) but 111111111111 (11 1's) is not.
// See https://stackoverflow.com/questions/56804936/how-does-only-numbers-in-url-resolve-to-a-domain
// However, this seems to only get triggered if a wallet pubkey only contains digits so this is pretty improbable.
consturl=newURL(walletConnectUrl)
constparams={}
params.walletPubkey=url.host
constsecret=url.searchParams.get('secret')
constrelayUrl=url.searchParams.get('relay')
if(secret){
params.secret=secret
}
if(relayUrl){
params.relayUrl=relayUrl
}
returnparams
}
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?
The text was updated successfully, but these errors were encountered:
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
usingurl.searchParams.getAll('relay')
instead ofurl.searchParams.get('relay')
and use all of them to publish requests and listen for responses.stacker.news/lib/url.js
Lines 190 to 214 in 4cc3780
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 thelogger
inside its own functions. So maybe it's indeed not needed and we can simply rely on general wallet logs?The text was updated successfully, but these errors were encountered: