remove unused import
Godwin Asuquo committed
Feb 3, 2022 at 12:46 UTC
aba7b6fc4513bc52a05d3cd585284215757bfbaf
1 file changed
+33
-34
cw_core/lib/node.dart
+33
-34
@@ -7,7 +7,6 @@ import 'package:http/http.dart' as http;
7
import 'package:hive/hive.dart';
8
import 'package:cw_core/wallet_type.dart';
9
import 'package:http/io_client.dart' as ioc;
10
-//import 'package:cake_wallet/entities/digest_request.dart';
10
11
part 'node.g.dart';
12
@@ -97,39 +96,39 @@ class Node extends HiveObject with Keyable {
96
97
Future<bool> requestMoneroNode() async {
98
100
- final path = '/json_rpc';
101
- final rpcUri = isSSL ? Uri.https(uri.authority, path) : Uri.http(uri.authority, path);
102
- final realm = 'monero-rpc';
103
- final body = {
104
- 'jsonrpc': '2.0',
105
- 'id': '0',
106
- 'method': 'get_info'
107
- };
108
-
109
- try {
110
- final authenticatingClient = HttpClient();
111
-
112
- authenticatingClient.addCredentials(
113
- rpcUri,
114
- realm,
115
- HttpClientDigestCredentials(login ?? '', password ?? ''),
116
- );
117
-
118
- final http.Client client = ioc.IOClient(authenticatingClient);
119
-
120
- final response = await client.post(
121
- rpcUri,
122
- headers: {'Content-Type': 'application/json'},
123
- body: json.encode(body),
124
- );
125
-
126
- client.close();
127
-
128
- final resBody = json.decode(response.body) as Map<String, dynamic>;
129
- return !(resBody['result']['offline'] as bool);
130
- } catch (_) {
131
- return false;
132
- }
99
+ final path = '/json_rpc';
100
+ final rpcUri = isSSL ? Uri.https(uri.authority, path) : Uri.http(uri.authority, path);
101
+ final realm = 'monero-rpc';
102
+ final body = {
103
+ 'jsonrpc': '2.0',
104
+ 'id': '0',
105
+ 'method': 'get_info'
106
+ };
107
+
108
+ try {
109
+ final authenticatingClient = HttpClient();
110
+
111
+ authenticatingClient.addCredentials(
112
+ rpcUri,
113
+ realm,
114
+ HttpClientDigestCredentials(login ?? '', password ?? ''),
115
+ );
116
+
117
+ final http.Client client = ioc.IOClient(authenticatingClient);
118
+
119
+ final response = await client.post(
120
+ rpcUri,
121
+ headers: {'Content-Type': 'application/json'},
122
+ body: json.encode(body),
123
+ );
124
+
125
+ client.close();
126
+
127
+ final resBody = json.decode(response.body) as Map<String, dynamic>;
128
+ return !(resBody['result']['offline'] as bool);
129
+ } catch (_) {
130
+ return false;
131
+ }
132
}
133
134
Future<bool> requestElectrumServer() async {