mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 22:58:49 +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/electrumx_rpc/electrumx.dart';
|
||||||
import 'package:stackwallet/hive/db.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/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
import 'package:stackwallet/utilities/prefs.dart';
|
||||||
|
@ -63,20 +62,6 @@ class CachedElectrumX {
|
||||||
"setHash": "",
|
"setHash": "",
|
||||||
"coins": <dynamic>[],
|
"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 {
|
} else {
|
||||||
set = Map<String, dynamic>.from(cachedSet);
|
set = Map<String, dynamic>.from(cachedSet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,9 +275,9 @@ class ElectrumX {
|
||||||
final response = await request(
|
final response = await request(
|
||||||
requestID: requestID,
|
requestID: requestID,
|
||||||
command: 'server.ping',
|
command: 'server.ping',
|
||||||
connectionTimeout: const Duration(seconds: 1),
|
connectionTimeout: const Duration(seconds: 2),
|
||||||
retries: retryCount,
|
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;
|
return response.keys.contains("result") && response["result"] == null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rethrow;
|
rethrow;
|
||||||
|
|
|
@ -766,6 +766,8 @@ class _NodeFormState extends ConsumerState<NodeForm> {
|
||||||
_isFailover = node.isFailover;
|
_isFailover = node.isFailover;
|
||||||
if (widget.coin == Coin.epicCash) {
|
if (widget.coin == Coin.epicCash) {
|
||||||
enableSSLCheckbox = !node.host.startsWith("http");
|
enableSSLCheckbox = !node.host.startsWith("http");
|
||||||
|
} else {
|
||||||
|
enableSSLCheckbox = true;
|
||||||
}
|
}
|
||||||
print("enableSSLCheckbox: $enableSSLCheckbox");
|
print("enableSSLCheckbox: $enableSSLCheckbox");
|
||||||
|
|
||||||
|
|
|
@ -733,40 +733,6 @@ Future<void> _setTestnetWrapper(bool isTestnet) async {
|
||||||
// setTestnet(isTestnet);
|
// 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
|
/// Handles a single instance of a firo wallet
|
||||||
class FiroWallet extends CoinServiceAPI {
|
class FiroWallet extends CoinServiceAPI {
|
||||||
static const integrationTestFlag =
|
static const integrationTestFlag =
|
||||||
|
|
Loading…
Reference in a new issue