From 7929d49e27d24eb294076c2118b9b83c6278621d Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Tue, 30 Apr 2024 09:55:24 +0200 Subject: [PATCH] polyseed support --- .../restore_options_view.dart | 28 ++++++++++++++----- lib/utilities/constants.dart | 2 +- lib/wallets/wallet/impl/monero_wallet.dart | 3 +- lib/wallets/wallet/impl/wownero_wallet.dart | 4 ++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart index 44ac51aac..8b28a0466 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart @@ -311,7 +311,9 @@ class _RestoreOptionsViewState extends ConsumerState { SizedBox( height: isDesktop ? 40 : 24, ), - if (coin == Coin.monero || + if ((coin == Coin.monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin == Coin.epicCash || (coin == Coin.wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -327,7 +329,9 @@ class _RestoreOptionsViewState extends ConsumerState { : STextStyles.smallMed12(context), textAlign: TextAlign.left, ), - if (coin == Coin.monero || + if ((coin == Coin.monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin == Coin.epicCash || (coin == Coin.wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -335,7 +339,9 @@ class _RestoreOptionsViewState extends ConsumerState { SizedBox( height: isDesktop ? 16 : 8, ), - if (coin == Coin.monero || + if ((coin == Coin.monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin == Coin.epicCash || (coin == Coin.wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -345,7 +351,9 @@ class _RestoreOptionsViewState extends ConsumerState { onTap: chooseDate, controller: _dateController, ), - if (coin == Coin.monero || + if ((coin == Coin.monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin == Coin.epicCash || (coin == Coin.wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -356,7 +364,9 @@ class _RestoreOptionsViewState extends ConsumerState { onTap: chooseDesktopDate, controller: _dateController, ), - if (coin == Coin.monero || + if ((coin == Coin.monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin == Coin.epicCash || (coin == Coin.wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -364,7 +374,9 @@ class _RestoreOptionsViewState extends ConsumerState { const SizedBox( height: 8, ), - if (coin == Coin.monero || + if ((coin == Coin.monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin == Coin.epicCash || (coin == Coin.wownero && ref.watch(mnemonicWordCountStateProvider.state).state == @@ -385,7 +397,9 @@ class _RestoreOptionsViewState extends ConsumerState { ), ), ), - if (coin == Coin.monero || + if ((coin == Coin.monero && + ref.watch(mnemonicWordCountStateProvider.state).state == + 25) || coin == Coin.epicCash || (coin == Coin.wownero && ref.watch(mnemonicWordCountStateProvider.state).state == diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index db0543044..e0fd5e3df 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -184,7 +184,7 @@ abstract class Constants { values.addAll([24, 12]); case Coin.monero: - values.addAll([25]); + values.addAll([16, 25]); break; case Coin.wownero: values.addAll([14, 25]); diff --git a/lib/wallets/wallet/impl/monero_wallet.dart b/lib/wallets/wallet/impl/monero_wallet.dart index 5f681c774..9ed4b0da7 100644 --- a/lib/wallets/wallet/impl/monero_wallet.dart +++ b/lib/wallets/wallet/impl/monero_wallet.dart @@ -159,6 +159,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { type: WalletType.monero, trusted: node.trusted ?? false, ), + socksProxyAddress: null, ); } @@ -392,7 +393,7 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface { final mnemonic = await getMnemonic(); final seedLength = mnemonic.trim().split(" ").length; - if (seedLength != 25) { + if (seedLength != 25 && seedLength != 16) { throw Exception("Invalid monero mnemonic length found: $seedLength"); } diff --git a/lib/wallets/wallet/impl/wownero_wallet.dart b/lib/wallets/wallet/impl/wownero_wallet.dart index 514f9e244..46ad5726a 100644 --- a/lib/wallets/wallet/impl/wownero_wallet.dart +++ b/lib/wallets/wallet/impl/wownero_wallet.dart @@ -149,6 +149,7 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { type: WalletType.wownero, trusted: node.trusted ?? false, ), + socksProxyAddress: null, ); } @@ -331,7 +332,8 @@ class WowneroWallet extends CryptonoteWallet with CwBasedInterface { // days: // 2))); // subtract a couple days to ensure we have a buffer for SWB // TODO(mrcyjanek): implement - final bufferedCreateHeight = 1; //getSeedHeightSync(wallet!.seed.trim()); + final bufferedCreateHeight = + 1; //getSeedHeightSync(wallet!.seed.trim()); await info.updateRestoreHeight( newRestoreHeight: bufferedCreateHeight,