From b90e610327427d0f3539841970feadeb46255d75 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Wed, 2 Feb 2022 13:57:26 +0100 Subject: [PATCH] fix red indicator for XMR nodes --- cw_core/lib/node.dart | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/cw_core/lib/node.dart b/cw_core/lib/node.dart index c9282c6e7..3dc876521 100644 --- a/cw_core/lib/node.dart +++ b/cw_core/lib/node.dart @@ -95,29 +95,19 @@ class Node extends HiveObject with Keyable { } Future requestMoneroNode() async { - return false; - //try { - // Map resBody; - - // if (login != null && password != null) { - // final digestRequest = DigestRequest(); - // final response = await digestRequest.request( - // uri: uri.toString(), login: login, password: password); - // resBody = response.data as Map; - // } else { - // final rpcUri = Uri.http(uri.authority, '/json_rpc'); - // final headers = {'Content-type': 'application/json'}; - // final body = - // json.encode({'jsonrpc': '2.0', 'id': '0', 'method': 'get_info'}); - // final response = - // await http.post(rpcUri.toString(), headers: headers, body: body); - // resBody = json.decode(response.body) as Map; - // } - - // return !(resBody['result']['offline'] as bool); - //} catch (_) { - // return false; - //} + try { + Map resBody; + final rpcUri = Uri.http(uri.authority, '/json_rpc'); + final headers = {'Content-type': 'application/json'}; + final body = + json.encode({'jsonrpc': '2.0', 'id': '0', 'method': 'get_info'}); + final response = + await http.post(rpcUri.toString(), headers: headers, body: body); + resBody = json.decode(response.body) as Map; + return !(resBody['result']['offline'] as bool); + } catch (_) { + return false; + } } Future requestElectrumServer() async {