mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-22 19:39:22 +00:00
add polyseed eng wordlist and use it
This commit is contained in:
parent
1f71fbcc73
commit
2594169a42
5 changed files with 4143 additions and 54 deletions
|
@ -96,7 +96,8 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ref.read(mnemonicWordCountStateProvider.state).state =
|
ref.read(mnemonicWordCountStateProvider.state).state =
|
||||||
coin.possibleMnemonicLengths.last;
|
coin.defaultSeedPhraseLength;
|
||||||
|
|
||||||
ref.read(pNewWalletOptions.notifier).state = null;
|
ref.read(pNewWalletOptions.notifier).state = null;
|
||||||
|
|
||||||
switch (widget.addWalletType) {
|
switch (widget.addWalletType) {
|
||||||
|
|
|
@ -170,6 +170,11 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
|
|
||||||
final lengths = coin.possibleMnemonicLengths;
|
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(
|
return MasterScaffold(
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
appBar: isDesktop
|
appBar: isDesktop
|
||||||
|
@ -222,13 +227,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 40 : 24,
|
height: isDesktop ? 40 : 24,
|
||||||
),
|
),
|
||||||
if ((coin is Monero &&
|
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25) ||
|
|
||||||
coin is Epiccash ||
|
|
||||||
(coin is Wownero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25))
|
|
||||||
Text(
|
Text(
|
||||||
"Choose start date",
|
"Choose start date",
|
||||||
style: isDesktop
|
style: isDesktop
|
||||||
|
@ -240,58 +239,28 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
: STextStyles.smallMed12(context),
|
: STextStyles.smallMed12(context),
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
),
|
),
|
||||||
if ((coin is Monero &&
|
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25) ||
|
|
||||||
coin is Epiccash ||
|
|
||||||
(coin is Wownero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25))
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 16 : 8,
|
height: isDesktop ? 16 : 8,
|
||||||
),
|
),
|
||||||
if ((coin is Monero &&
|
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25) ||
|
|
||||||
coin is Epiccash ||
|
|
||||||
(coin is Wownero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25))
|
|
||||||
if (!isDesktop)
|
if (!isDesktop)
|
||||||
RestoreFromDatePicker(
|
RestoreFromDatePicker(
|
||||||
onTap: chooseDate,
|
onTap: chooseDate,
|
||||||
controller: _dateController,
|
controller: _dateController,
|
||||||
),
|
),
|
||||||
if ((coin is Monero &&
|
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25) ||
|
|
||||||
coin is Epiccash ||
|
|
||||||
(coin is Wownero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25))
|
|
||||||
if (isDesktop)
|
if (isDesktop)
|
||||||
// TODO desktop date picker
|
// TODO desktop date picker
|
||||||
RestoreFromDatePicker(
|
RestoreFromDatePicker(
|
||||||
onTap: chooseDesktopDate,
|
onTap: chooseDesktopDate,
|
||||||
controller: _dateController,
|
controller: _dateController,
|
||||||
),
|
),
|
||||||
if ((coin is Monero &&
|
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25) ||
|
|
||||||
coin is Epiccash ||
|
|
||||||
(coin is Wownero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25))
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
if ((coin is Monero &&
|
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25) ||
|
|
||||||
coin is Epiccash ||
|
|
||||||
(coin is Wownero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25))
|
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -308,13 +277,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if ((coin is Monero &&
|
if (isMoneroAnd25 || coin is Epiccash || isWowneroAnd25)
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25) ||
|
|
||||||
coin is Epiccash ||
|
|
||||||
(coin is Wownero &&
|
|
||||||
ref.watch(mnemonicWordCountStateProvider.state).state ==
|
|
||||||
25))
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: isDesktop ? 24 : 16,
|
height: isDesktop ? 24 : 16,
|
||||||
),
|
),
|
||||||
|
|
|
@ -179,8 +179,14 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
bool _isValidMnemonicWord(String word) {
|
bool _isValidMnemonicWord(String word) {
|
||||||
// TODO: get the actual language
|
// TODO: get the actual language
|
||||||
if (widget.coin is Monero) {
|
if (widget.coin is Monero) {
|
||||||
final moneroWordList = libxmr.monero.getMoneroWordList("English");
|
switch (widget.seedWordsLength) {
|
||||||
return moneroWordList.contains(word);
|
case 25:
|
||||||
|
return libxmr.monero.getMoneroWordList("English").contains(word);
|
||||||
|
case 16:
|
||||||
|
return Monero.sixteenWordsWordList.contains(word);
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (widget.coin is Wownero) {
|
if (widget.coin is Wownero) {
|
||||||
final wowneroWordList = libwow.wownero.getWowneroWordList(
|
final wowneroWordList = libwow.wownero.getWowneroWordList(
|
||||||
|
|
File diff suppressed because it is too large
Load diff
2068
test/sixteen_word_list_sanity_test.dart
Normal file
2068
test/sixteen_word_list_sanity_test.dart
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue