From b585da56efb3b8fcf2aa6ef1e51da049bba9b27c Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 7 Mar 2024 08:53:38 +0000 Subject: [PATCH] restored get_height_by_date.dart, removed unnecessary calls for zano get height --- cw_core/lib/get_height_by_date.dart | 15 +++------------ lib/view_model/wallet_keys_view_model.dart | 5 ----- lib/zano/cw_zano.dart | 6 ------ lib/zano/zano.dart | 4 +--- 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/cw_core/lib/get_height_by_date.dart b/cw_core/lib/get_height_by_date.dart index d4fe8c9b0..819990e0a 100644 --- a/cw_core/lib/get_height_by_date.dart +++ b/cw_core/lib/get_height_by_date.dart @@ -189,15 +189,14 @@ const havenDates = { DateTime formatMapKey(String key) => dateFormat.parse(key); int getHavenHeightByDate({required DateTime date}) { - String closestKey = havenDates.keys - .firstWhere((key) => formatMapKey(key).isBefore(date), orElse: () => ''); + String closestKey = + havenDates.keys.firstWhere((key) => formatMapKey(key).isBefore(date), orElse: () => ''); return havenDates[closestKey] ?? 0; } Future getHavenCurrentHeight() async { - final response = await http - .get(Uri.parse('https://explorer.havenprotocol.org/api/networkinfo')); + final response = await http.get(Uri.parse('https://explorer.havenprotocol.org/api/networkinfo')); if (response.statusCode == 200) { final info = jsonDecode(response.body); @@ -206,11 +205,3 @@ Future getHavenCurrentHeight() async { throw Exception('Failed to load current blockchain height'); } } - -int getZanoHeightByDate({required DateTime date}) { - return 0; -} - -Future getZanoCurrentHeight() async { - return 0; -} diff --git a/lib/view_model/wallet_keys_view_model.dart b/lib/view_model/wallet_keys_view_model.dart index 7a5b93062..ccbe43416 100644 --- a/lib/view_model/wallet_keys_view_model.dart +++ b/lib/view_model/wallet_keys_view_model.dart @@ -120,9 +120,6 @@ abstract class WalletKeysViewModelBase with Store { if (_appStore.wallet!.type == WalletType.monero) { return monero_wallet.getCurrentHeight(); } - if (_appStore.wallet!.type == WalletType.zano) { - return await zano!.getCurrentHeight(); - } return null; } @@ -184,8 +181,6 @@ abstract class WalletKeysViewModelBase with Store { return monero!.getHeigthByDate(date: date); } else if (type == WalletType.haven) { return haven!.getHeightByDate(date: date); - } else if (type == WalletType.zano) { - return zano!.getHeightByDate(date: date); } return 0; } diff --git a/lib/zano/cw_zano.dart b/lib/zano/cw_zano.dart index 7c283759e..ac8102333 100644 --- a/lib/zano/cw_zano.dart +++ b/lib/zano/cw_zano.dart @@ -90,12 +90,6 @@ class CWZano extends Zano { return CWZanoWalletDetails(wallet); } - @override - int getHeightByDate({required DateTime date}) => getZanoHeightByDate(date: date); - - @override - Future getCurrentHeight() => getZanoCurrentHeight(); - @override TransactionPriority getDefaultTransactionPriority() { return MoneroTransactionPriority.automatic; diff --git a/lib/zano/zano.dart b/lib/zano/zano.dart index b4d22b1ac..e3daa7e46 100644 --- a/lib/zano/zano.dart +++ b/lib/zano/zano.dart @@ -94,8 +94,6 @@ abstract class Zano { // String getTransactionAddress(Object wallet, int accountIndex, int addressIndex); - int getHeightByDate({required DateTime date}); - Future getCurrentHeight(); TransactionPriority getDefaultTransactionPriority(); TransactionPriority deserializeMoneroTransactionPriority({required int raw}); List getTransactionPriorities(); @@ -143,4 +141,4 @@ abstract class Zano { // Future addAccount(Object wallet, {required String label}); // Future setLabelAccount(Object wallet, {required int accountIndex, required String label}); // } - \ No newline at end of file +