mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
restored get_height_by_date.dart, removed unnecessary calls for zano get height
This commit is contained in:
parent
d684be60d7
commit
b585da56ef
4 changed files with 4 additions and 26 deletions
|
@ -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<int> 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<int> getHavenCurrentHeight() async {
|
|||
throw Exception('Failed to load current blockchain height');
|
||||
}
|
||||
}
|
||||
|
||||
int getZanoHeightByDate({required DateTime date}) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Future<int> getZanoCurrentHeight() async {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -90,12 +90,6 @@ class CWZano extends Zano {
|
|||
return CWZanoWalletDetails(wallet);
|
||||
}
|
||||
|
||||
@override
|
||||
int getHeightByDate({required DateTime date}) => getZanoHeightByDate(date: date);
|
||||
|
||||
@override
|
||||
Future<int> getCurrentHeight() => getZanoCurrentHeight();
|
||||
|
||||
@override
|
||||
TransactionPriority getDefaultTransactionPriority() {
|
||||
return MoneroTransactionPriority.automatic;
|
||||
|
|
|
@ -94,8 +94,6 @@ abstract class Zano {
|
|||
|
||||
// String getTransactionAddress(Object wallet, int accountIndex, int addressIndex);
|
||||
|
||||
int getHeightByDate({required DateTime date});
|
||||
Future<int> getCurrentHeight();
|
||||
TransactionPriority getDefaultTransactionPriority();
|
||||
TransactionPriority deserializeMoneroTransactionPriority({required int raw});
|
||||
List<TransactionPriority> getTransactionPriorities();
|
||||
|
@ -143,4 +141,4 @@ abstract class Zano {
|
|||
// Future<void> addAccount(Object wallet, {required String label});
|
||||
// Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label});
|
||||
// }
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue