mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 13:14:32 +00:00
commit
9e8b7914bc
4 changed files with 4 additions and 51 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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 =
|
||||
|
|
Loading…
Reference in a new issue