Merge pull request #262 from cypherstack/desktop

Desktop
This commit is contained in:
Diego Salazar 2022-12-13 17:41:08 -07:00 committed by GitHub
commit 9e8b7914bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 51 deletions

View file

@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/hive/db.dart';
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/prefs.dart';
@ -63,20 +62,6 @@ class CachedElectrumX {
"setHash": "",
"coins": <dynamic>[],
};
// try up to 3 times
for (int i = 0; i < 3; i++) {
final result = await getInitialAnonymitySetCache(groupId);
if (result != null) {
set["setHash"] = result["setHash"];
set["blockHash"] = result["blockHash"];
set["coins"] = result["coins"];
Logging.instance.log(
"Populated initial anon set cache for group $groupId",
level: LogLevel.Info);
break;
}
}
} else {
set = Map<String, dynamic>.from(cachedSet);
}

View file

@ -275,9 +275,9 @@ class ElectrumX {
final response = await request(
requestID: requestID,
command: 'server.ping',
connectionTimeout: const Duration(seconds: 1),
connectionTimeout: const Duration(seconds: 2),
retries: retryCount,
).timeout(const Duration(seconds: 1)) as Map<String, dynamic>;
).timeout(const Duration(seconds: 2)) as Map<String, dynamic>;
return response.keys.contains("result") && response["result"] == null;
} catch (e) {
rethrow;

View file

@ -766,6 +766,8 @@ class _NodeFormState extends ConsumerState<NodeForm> {
_isFailover = node.isFailover;
if (widget.coin == Coin.epicCash) {
enableSSLCheckbox = !node.host.startsWith("http");
} else {
enableSSLCheckbox = true;
}
print("enableSSLCheckbox: $enableSSLCheckbox");

View file

@ -733,40 +733,6 @@ Future<void> _setTestnetWrapper(bool isTestnet) async {
// setTestnet(isTestnet);
}
Future<Map<String, dynamic>?> getInitialAnonymitySetCache(
String groupID,
) async {
Logging.instance.log("getInitialAnonymitySetCache", level: LogLevel.Info);
final Client client = Client();
try {
final uri = Uri.parse("$kStackCommunityNodesEndpoint/getAnonymity");
final anonSetResult = await client.post(
uri,
headers: {'Content-Type': 'application/json'},
body: jsonEncode({
"jsonrpc": "2.0",
"id": "0",
'aset': groupID,
}),
);
final response = jsonDecode(anonSetResult.body.toString());
Logging.instance.log(response, level: LogLevel.Info);
if (response['status'] == 'success') {
final anonResponse = jsonDecode(response['result'] as String);
final setData = Map<String, dynamic>.from(anonResponse as Map);
return setData;
} else {
return null;
}
} catch (e, s) {
Logging.instance.log("$e $s", level: LogLevel.Error);
return null;
}
}
/// Handles a single instance of a firo wallet
class FiroWallet extends CoinServiceAPI {
static const integrationTestFlag =