mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-27 06:18:50 +01:00
* feat: bip39 zano hf * fix: correct monero_c hash * lockfile [skip ci] * fix: zano: proper bip32 fix: zano respect 24 word setting fix: rename / delete * fix: nonBip39WalletTypes * fix: zano wallet rename * fix: passphrase store zano --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
27 lines
791 B
Dart
27 lines
791 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:cw_zano/api/model/get_address_info_result.dart';
|
|
import 'package:cw_zano/get_height_by_date.dart';
|
|
import 'package:monero/zano.dart' as zano;
|
|
|
|
class ZanoUtils {
|
|
static int heightByDate(DateTime date) =>
|
|
ZanoHeight.getBlockHeightByTime(date.toUtc().subtract(const Duration(days: 1)));
|
|
|
|
static int creationTimestampFromHeight(int height) {
|
|
if (height <= 0) return 0;
|
|
return ZanoHeight.getTimeByBlockHeight(height).millisecondsSinceEpoch ~/ 1000;
|
|
}
|
|
|
|
static bool validateAddress(String address) {
|
|
try {
|
|
final result = GetAddressInfoResult.fromJson(
|
|
jsonDecode(zano.PlainWallet_getAddressInfo(address)) as Map<String, dynamic>,
|
|
);
|
|
return result.valid;
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|