@@ -68,41 +68,35 @@ class NostrWalletConnectUri extends Equatable {
6868 factory NostrWalletConnectUri .parseConnectionUri (String uri) {
6969 Uri parsedUri = Uri .parse (uri);
7070
71- String pubkey = parsedUri.host;// _extractPubkey(parsedUri.toString());
71+ String pubkey = parsedUri.host; // _extractPubkey(parsedUri.toString());
7272 String ? secret = parsedUri.queryParameters['secret' ];
7373 String ? lud16 = parsedUri.queryParameters['lud16' ];
7474
7575 if (pubkey.isEmpty || secret == null || parsedUri.scheme != 'nostr+walletconnect' ) {
76- throw Exception (
77- "Required fields (scheme, pubkey, secret) are missing or incorrect in the connection URI." );
76+ throw Exception ("Required fields (scheme, pubkey, secret) are missing or incorrect in the connection URI." );
7877 }
7978
8079 // Parse relays - support both single relay and comma-separated relays
8180 List <String > relaysList = [];
8281
8382 // Check for single relay parameter (backward compatibility)
84- String ? singleRelay = parsedUri.queryParameters['relay' ];
85- if (singleRelay != null ) {
86- List <String > commaSeparatedRelays = singleRelay
87- .split (',' )
88- .map ((r) => r.trim ())
89- .where ((r) => r.isNotEmpty)
90- .toList ();
91- for (String relay in commaSeparatedRelays) {
92- if (! relaysList.contains (relay)) {
93- relaysList.add (relay);
83+ List <String >? relayParams = parsedUri.queryParametersAll['relay' ];
84+ if (relayParams != null ) {
85+ for (var relay in relayParams) {
86+ List <String > commaSeparatedRelays = relay.split (',' ).map ((r) => r.trim ()).where ((r) => r.isNotEmpty).toList ();
87+ for (String relay in commaSeparatedRelays) {
88+ if (! relaysList.contains (relay)) {
89+ relaysList.add (relay);
90+ }
9491 }
9592 }
9693 }
9794
9895 // Check for comma-separated relays in a single parameter
9996 String ? relaysParam = parsedUri.queryParameters['relays' ];
10097 if (relaysParam != null ) {
101- List <String > commaSeparatedRelays = relaysParam
102- .split (',' )
103- .map ((r) => r.trim ())
104- .where ((r) => r.isNotEmpty)
105- .toList ();
98+ List <String > commaSeparatedRelays =
99+ relaysParam.split (',' ).map ((r) => r.trim ()).where ((r) => r.isNotEmpty).toList ();
106100 for (String relay in commaSeparatedRelays) {
107101 if (! relaysList.contains (relay)) {
108102 relaysList.add (relay);
0 commit comments