fix red indicator for XMR nodes

Godwin Asuquo committed Feb 2, 2022 at 13:57 UTC b90e610327427d0f3539841970feadeb46255d75
1 file changed +13 -23
cw_core/lib/node.dart
+13 -23
@@ -95,29 +95,19 @@ class Node extends HiveObject with Keyable {
95 }
96
97 Future<bool> requestMoneroNode() async {
98 - return false;
99 - //try {
100 - // Map<String, dynamic> resBody;
101 -
102 - // if (login != null && password != null) {
103 - // final digestRequest = DigestRequest();
104 - // final response = await digestRequest.request(
105 - // uri: uri.toString(), login: login, password: password);
106 - // resBody = response.data as Map<String, dynamic>;
107 - // } else {
108 - // final rpcUri = Uri.http(uri.authority, '/json_rpc');
109 - // final headers = {'Content-type': 'application/json'};
110 - // final body =
111 - // json.encode({'jsonrpc': '2.0', 'id': '0', 'method': 'get_info'});
112 - // final response =
113 - // await http.post(rpcUri.toString(), headers: headers, body: body);
114 - // resBody = json.decode(response.body) as Map<String, dynamic>;
115 - // }
116 -
117 - // return !(resBody['result']['offline'] as bool);
118 - //} catch (_) {
119 - // return false;
120 - //}
98 + try {
99 + Map<String, dynamic> resBody;
100 + final rpcUri = Uri.http(uri.authority, '/json_rpc');
101 + final headers = {'Content-type': 'application/json'};
102 + final body =
103 + json.encode({'jsonrpc': '2.0', 'id': '0', 'method': 'get_info'});
104 + final response =
105 + await http.post(rpcUri.toString(), headers: headers, body: body);
106 + resBody = json.decode(response.body) as Map<String, dynamic>;
107 + return !(resBody['result']['offline'] as bool);
108 + } catch (_) {
109 + return false;
110 + }
111 }
112
113 Future<bool> requestElectrumServer() async {