mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 19:26:37 +00:00
remove cached anon set server call
This commit is contained in:
parent
b83dec53c3
commit
4f4d6f8e9d
2 changed files with 0 additions and 49 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);
|
||||
}
|
||||
|
|
|
@ -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