mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-10 12:54:38 +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);
|
DateTime formatMapKey(String key) => dateFormat.parse(key);
|
||||||
|
|
||||||
int getHavenHeightByDate({required DateTime date}) {
|
int getHavenHeightByDate({required DateTime date}) {
|
||||||
String closestKey = havenDates.keys
|
String closestKey =
|
||||||
.firstWhere((key) => formatMapKey(key).isBefore(date), orElse: () => '');
|
havenDates.keys.firstWhere((key) => formatMapKey(key).isBefore(date), orElse: () => '');
|
||||||
|
|
||||||
return havenDates[closestKey] ?? 0;
|
return havenDates[closestKey] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> getHavenCurrentHeight() async {
|
Future<int> getHavenCurrentHeight() async {
|
||||||
final response = await http
|
final response = await http.get(Uri.parse('https://explorer.havenprotocol.org/api/networkinfo'));
|
||||||
.get(Uri.parse('https://explorer.havenprotocol.org/api/networkinfo'));
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final info = jsonDecode(response.body);
|
final info = jsonDecode(response.body);
|
||||||
|
@ -206,11 +205,3 @@ Future<int> getHavenCurrentHeight() async {
|
||||||
throw Exception('Failed to load current blockchain height');
|
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) {
|
if (_appStore.wallet!.type == WalletType.monero) {
|
||||||
return monero_wallet.getCurrentHeight();
|
return monero_wallet.getCurrentHeight();
|
||||||
}
|
}
|
||||||
if (_appStore.wallet!.type == WalletType.zano) {
|
|
||||||
return await zano!.getCurrentHeight();
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,8 +181,6 @@ abstract class WalletKeysViewModelBase with Store {
|
||||||
return monero!.getHeigthByDate(date: date);
|
return monero!.getHeigthByDate(date: date);
|
||||||
} else if (type == WalletType.haven) {
|
} else if (type == WalletType.haven) {
|
||||||
return haven!.getHeightByDate(date: date);
|
return haven!.getHeightByDate(date: date);
|
||||||
} else if (type == WalletType.zano) {
|
|
||||||
return zano!.getHeightByDate(date: date);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,12 +90,6 @@ class CWZano extends Zano {
|
||||||
return CWZanoWalletDetails(wallet);
|
return CWZanoWalletDetails(wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
int getHeightByDate({required DateTime date}) => getZanoHeightByDate(date: date);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<int> getCurrentHeight() => getZanoCurrentHeight();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TransactionPriority getDefaultTransactionPriority() {
|
TransactionPriority getDefaultTransactionPriority() {
|
||||||
return MoneroTransactionPriority.automatic;
|
return MoneroTransactionPriority.automatic;
|
||||||
|
|
|
@ -94,8 +94,6 @@ abstract class Zano {
|
||||||
|
|
||||||
// String getTransactionAddress(Object wallet, int accountIndex, int addressIndex);
|
// String getTransactionAddress(Object wallet, int accountIndex, int addressIndex);
|
||||||
|
|
||||||
int getHeightByDate({required DateTime date});
|
|
||||||
Future<int> getCurrentHeight();
|
|
||||||
TransactionPriority getDefaultTransactionPriority();
|
TransactionPriority getDefaultTransactionPriority();
|
||||||
TransactionPriority deserializeMoneroTransactionPriority({required int raw});
|
TransactionPriority deserializeMoneroTransactionPriority({required int raw});
|
||||||
List<TransactionPriority> getTransactionPriorities();
|
List<TransactionPriority> getTransactionPriorities();
|
||||||
|
@ -143,4 +141,4 @@ abstract class Zano {
|
||||||
// Future<void> addAccount(Object wallet, {required String label});
|
// Future<void> addAccount(Object wallet, {required String label});
|
||||||
// Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label});
|
// Future<void> setLabelAccount(Object wallet, {required int accountIndex, required String label});
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue