Skip to content

Commit 570a0fe

Browse files
committed
address comments from review
1 parent e6bcf63 commit 570a0fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+441
-395
lines changed

cw_bitcoin/lib/electrum.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ class ElectrumClient {
7474
} catch (_) {}
7575
socket = null;
7676

77+
final ssl = !(useSSL == false || (useSSL == null && uri.toString().contains("btc-electrum")));
7778
try {
78-
socket = await ProxyWrapper().getSocksSocket(useSSL ?? false, host, port, connectionTimeout: connectionTimeout);
79+
socket = await ProxyWrapper().getSocksSocket(ssl, host, port, connectionTimeout: connectionTimeout);
7980
} catch (e) {
8081
printV("connect: $e");
8182
if (e is HandshakeException) {

cw_core/lib/node.dart

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,6 @@ class Node extends HiveObject with Keyable {
184184
final body = {'jsonrpc': '2.0', 'id': '0', 'method': "getinfo"};
185185

186186
try {
187-
final authenticatingClient = ProxyWrapper().getHttpClient();
188-
189-
authenticatingClient.badCertificateCallback =
190-
((X509Certificate cert, String host, int port) => true);
191-
192187
final jsonBody = json.encode(body);
193188

194189
final response = await ProxyWrapper().post(
@@ -197,8 +192,8 @@ class Node extends HiveObject with Keyable {
197192
body: jsonBody,
198193
);
199194

200-
final responseString = await response.transform(utf8.decoder).join();
201-
final resBody = json.decode(responseString) as Map<String, dynamic>;
195+
196+
final resBody = json.decode(response.body) as Map<String, dynamic>;
202197

203198
return resBody['result']['height'] != null;
204199
} catch (e) {
@@ -263,7 +258,7 @@ class Node extends HiveObject with Keyable {
263258
}
264259
}
265260

266-
final resBody = json.decode(responseString) as Map<String, dynamic>;
261+
final resBody = json.decode(response.body) as Map<String, dynamic>;
267262
return !(resBody['result']['offline'] as bool);
268263
} catch (e) {
269264
printV("error: $e");
@@ -324,8 +319,8 @@ class Node extends HiveObject with Keyable {
324319
},
325320
),
326321
);
327-
final responseString = await response.transform(utf8.decoder).join();
328-
final data = jsonDecode(responseString);
322+
323+
final data = jsonDecode(response.body);
329324
if (response.statusCode != 200 ||
330325
data["error"] != null ||
331326
data["balance"] == null ||

cw_core/lib/solana_rpc_http_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class SolanaRPCHTTPService implements SolanaJSONRPCService {
1818
'Content-Type': 'application/json',
1919
},
2020
).timeout(timeout ?? defaultRequestTimeout);
21-
final responseString = await response.transform(utf8.decoder).join();
22-
final data = json.decode(responseString) as Map<String, dynamic>;
21+
22+
final data = json.decode(response.body) as Map<String, dynamic>;
2323
return data;
2424
}
2525
}

0 commit comments

Comments
 (0)