mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 09:29:48 +00:00
remove unused import
This commit is contained in:
parent
c162e34ef4
commit
aba7b6fc45
1 changed files with 31 additions and 32 deletions
|
@ -7,7 +7,6 @@ import 'package:http/http.dart' as http;
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
import 'package:http/io_client.dart' as ioc;
|
import 'package:http/io_client.dart' as ioc;
|
||||||
//import 'package:cake_wallet/entities/digest_request.dart';
|
|
||||||
|
|
||||||
part 'node.g.dart';
|
part 'node.g.dart';
|
||||||
|
|
||||||
|
@ -97,39 +96,39 @@ class Node extends HiveObject with Keyable {
|
||||||
|
|
||||||
Future<bool> requestMoneroNode() async {
|
Future<bool> requestMoneroNode() async {
|
||||||
|
|
||||||
final path = '/json_rpc';
|
final path = '/json_rpc';
|
||||||
final rpcUri = isSSL ? Uri.https(uri.authority, path) : Uri.http(uri.authority, path);
|
final rpcUri = isSSL ? Uri.https(uri.authority, path) : Uri.http(uri.authority, path);
|
||||||
final realm = 'monero-rpc';
|
final realm = 'monero-rpc';
|
||||||
final body = {
|
final body = {
|
||||||
'jsonrpc': '2.0',
|
'jsonrpc': '2.0',
|
||||||
'id': '0',
|
'id': '0',
|
||||||
'method': 'get_info'
|
'method': 'get_info'
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final authenticatingClient = HttpClient();
|
final authenticatingClient = HttpClient();
|
||||||
|
|
||||||
authenticatingClient.addCredentials(
|
authenticatingClient.addCredentials(
|
||||||
rpcUri,
|
rpcUri,
|
||||||
realm,
|
realm,
|
||||||
HttpClientDigestCredentials(login ?? '', password ?? ''),
|
HttpClientDigestCredentials(login ?? '', password ?? ''),
|
||||||
);
|
);
|
||||||
|
|
||||||
final http.Client client = ioc.IOClient(authenticatingClient);
|
final http.Client client = ioc.IOClient(authenticatingClient);
|
||||||
|
|
||||||
final response = await client.post(
|
final response = await client.post(
|
||||||
rpcUri,
|
rpcUri,
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
body: json.encode(body),
|
body: json.encode(body),
|
||||||
);
|
);
|
||||||
|
|
||||||
client.close();
|
client.close();
|
||||||
|
|
||||||
final resBody = json.decode(response.body) as Map<String, dynamic>;
|
final resBody = json.decode(response.body) as Map<String, dynamic>;
|
||||||
return !(resBody['result']['offline'] as bool);
|
return !(resBody['result']['offline'] as bool);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> requestElectrumServer() async {
|
Future<bool> requestElectrumServer() async {
|
||||||
|
|
Loading…
Reference in a new issue