add polyseed eng wordlist and use it

This commit is contained in:
julian 2024-06-12 17:13:06 -06:00
parent 1f71fbcc73
commit 2594169a42
5 changed files with 4143 additions and 54 deletions

View file

@ -96,7 +96,8 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
if (mounted) {
ref.read(mnemonicWordCountStateProvider.state).state =
coin.possibleMnemonicLengths.last;
coin.defaultSeedPhraseLength;
ref.read(pNewWalletOptions.notifier).state = null;
switch (widget.addWalletType) {

View file

@ -170,6 +170,11 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
final lengths = coin.possibleMnemonicLengths;
final isMoneroAnd25 = coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state == 25;
final isWowneroAnd25 = coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state == 25;
return MasterScaffold(
isDesktop: isDesktop,
appBar: isDesktop
@ -222,13 +227,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
SizedBox(
height: isDesktop ? 40 : 24,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
Text(
"Choose start date",
style: isDesktop
@ -240,58 +239,28 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
: STextStyles.smallMed12(context),
textAlign: TextAlign.left,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
SizedBox(
height: isDesktop ? 16 : 8,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
if (!isDesktop)
RestoreFromDatePicker(
onTap: chooseDate,
controller: _dateController,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
if (isDesktop)
// TODO desktop date picker
RestoreFromDatePicker(
onTap: chooseDesktopDate,
controller: _dateController,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
const SizedBox(
height: 8,
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
RoundedWhiteContainer(
child: Center(
child: Text(
@ -308,13 +277,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
),
),
),
if ((coin is Monero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25) ||
coin is Epiccash ||
(coin is Wownero &&
ref.watch(mnemonicWordCountStateProvider.state).state ==
25))
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
SizedBox(
height: isDesktop ? 24 : 16,
),

View file

@ -179,8 +179,14 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
bool _isValidMnemonicWord(String word) {
// TODO: get the actual language
if (widget.coin is Monero) {
final moneroWordList = libxmr.monero.getMoneroWordList("English");
return moneroWordList.contains(word);
switch (widget.seedWordsLength) {
case 25:
return libxmr.monero.getMoneroWordList("English").contains(word);
case 16:
return Monero.sixteenWordsWordList.contains(word);
default:
return false;
}
}
if (widget.coin is Wownero) {
final wowneroWordList = libwow.wownero.getWowneroWordList(

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff