Files
hash-wallet/cw_zano/lib/zano_utils.dart
T
905db64f77 feat: zano hf + bip39 (#3359)
* 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>
2026-08-28 15:49:51 +08:00

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;
}
}
}