updated rust logging method, added mnemonic word validation for Xelis

This commit is contained in:
Tritonn204 2025-03-14 20:51:00 -07:00
parent 0f7e44fadd
commit 4feb14c7da
2 changed files with 10 additions and 3 deletions
lib
main.dart
pages/add_wallet_views/restore_wallet_view

View file

@ -82,9 +82,9 @@ final openedFromSWBFileStringStateProvider =
void startListeningToRustLogs() {
xelis_api.createLogStream().listen((logEntry) {
print("[Rust Log] [${logEntry.level}] ${logEntry.tag}: ${logEntry.msg}");
Logging.instance.i("[Rust Log] [${logEntry.level}] ${logEntry.tag}: ${logEntry.msg}");
}, onError: (e) {
print("Error receiving Rust logs: $e");
Logging.instance.e("Error receiving Rust logs: $e");
});
}

View file

@ -25,6 +25,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:xelis_flutter/src/api/seed_search_engine.dart' as x_seed;
import '../../../notifications/show_flush_bar.dart';
import '../../../pages_desktop_specific/desktop_home_view.dart';
import '../../../pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart';
@ -104,6 +106,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
late final int _seedWordCount;
late final bool isDesktop;
x_seed.SearchEngine? _xelisSeedSearch;
final HashSet<String> _wordListHashSet = HashSet.from(bip39wordlist.WORDLIST);
final ScrollController controller = ScrollController();
@ -168,6 +171,10 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
// _focusNodes.add(FocusNode());
}
if (widget.coin is Xelis) {
_xelisSeedSearch = x_seed.SearchEngine.init(languageIndex: BigInt.from(0));
}
super.initState();
}
@ -202,7 +209,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
}
// TODO: use Xelis word list
if (widget.coin is Xelis) {
return true;
return _xelisSeedSearch!.search(query: word).length > 0;
}
return _wordListHashSet.contains(word);
}