From 4f4d6f8e9de1b0ad98d8806b4213f2fe6cbbcd9e Mon Sep 17 00:00:00 2001 From: julian <julian@cypherstack.com> Date: Tue, 13 Dec 2022 11:21:46 -0600 Subject: [PATCH] remove cached anon set server call --- lib/electrumx_rpc/cached_electrumx.dart | 15 ----------- lib/services/coins/firo/firo_wallet.dart | 34 ------------------------ 2 files changed, 49 deletions(-) diff --git a/lib/electrumx_rpc/cached_electrumx.dart b/lib/electrumx_rpc/cached_electrumx.dart index 2f7916d9e..f62e7e4f5 100644 --- a/lib/electrumx_rpc/cached_electrumx.dart +++ b/lib/electrumx_rpc/cached_electrumx.dart @@ -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); } diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index 7445d718a..c87427b45 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -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 =