support Adding query params to node url (#1901)

* support Adding query params to node url * minor ui fix [skip ci]

Omar Hatem committed Dec 25, 2024 at 21:26 UTC 20d30013d06d605e51d8283eb59b1c753af07c25
2 files changed +8 -13
cw_core/lib/node.dart
+5 -12
@@ -22,8 +22,8 @@ class Node extends HiveObject with Keyable {
22 this.useSSL,
23 this.trusted = false,
24 this.socksProxyAddress,
25 + this.path = '',
26 String? uri,
26 - String? path,
27 WalletType? type,
28 }) {
29 if (uri != null) {
@@ -32,9 +32,6 @@ class Node extends HiveObject with Keyable {
32 if (type != null) {
33 this.type = type;
34 }
35 - if (path != null) {
36 - this.path = path;
37 - }
35 }
36
37 Node.fromMap(Map<String, Object?> map)
@@ -95,19 +92,15 @@ class Node extends HiveObject with Keyable {
92 case WalletType.bitcoin:
93 case WalletType.litecoin:
94 case WalletType.bitcoinCash:
98 - return createUriFromElectrumAddress(uriRaw, path ?? '');
95 + return createUriFromElectrumAddress(uriRaw, path!);
96 case WalletType.nano:
97 case WalletType.banano:
101 - if (isSSL) {
102 - return Uri.https(uriRaw, path ?? '');
103 - } else {
104 - return Uri.http(uriRaw, path ?? '');
105 - }
98 case WalletType.ethereum:
99 case WalletType.polygon:
100 case WalletType.solana:
101 case WalletType.tron:
110 - return Uri.https(uriRaw, path ?? '');
102 + return Uri.parse(
103 + "http${isSSL ? "s" : ""}://$uriRaw${path!.startsWith("/") ? path : "/$path"}");
104 case WalletType.none:
105 throw Exception('Unexpected type ${type.toString()} for Node uri');
106 }
@@ -247,7 +240,7 @@ class Node extends HiveObject with Keyable {
240 if (proxy == null) {
241 return false;
242 }
250 - final proxyAddress = proxy!.split(':')[0];
243 + final proxyAddress = proxy.split(':')[0];
244 final proxyPort = int.parse(proxy.split(':')[1]);
245 try {
246 final socket = await Socket.connect(proxyAddress, proxyPort, timeout: Duration(seconds: 5));
lib/src/screens/seed/seed_verification/seed_verification_step_view.dart
+3 -1
@@ -81,7 +81,9 @@ class SeedVerificationStepView extends StatelessWidget {
81 );
82
83 if (isSecondWrongEntry) {
84 - Navigator.pop(context);
84 + if (context.mounted) {
85 + Navigator.pop(context);
86 + }
87 }
88 }
89 },