Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/views/wallets_manager/wallets_manager_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class WalletsManagerWrapper extends StatefulWidget {
required this.eventType,
this.onSuccess,
this.selectedWallet,
this.initialHdMode = true,
this.initialHdMode = false,
super.key = const Key('wallets-manager-wrapper'),
});

Expand Down Expand Up @@ -59,7 +59,9 @@ class _WalletsManagerWrapperState extends State<WalletsManagerWrapper> {
close: _closeWalletManager,
onSuccess: widget.onSuccess ?? (_) {},
selectedWallet: widget.selectedWallet,
initialHdMode: widget.initialHdMode,
initialHdMode: widget.selectedWallet?.config.type == WalletType.hdwallet
? true
: widget.initialHdMode,
);
}

Expand Down
8 changes: 5 additions & 3 deletions lib/views/wallets_manager/widgets/iguana_wallets_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class IguanaWalletsManager extends StatefulWidget {
required this.close,
required this.onSuccess,
this.initialWallet,
this.initialHdMode = true,
this.initialHdMode = false,
super.key,
});

Expand All @@ -45,13 +45,15 @@ class _IguanaWalletsManagerState extends State<IguanaWalletsManager> {
Wallet? _selectedWallet;
WalletsManagerExistWalletAction _existWalletAction =
WalletsManagerExistWalletAction.none;
bool _initialHdMode = true;
bool _initialHdMode = false;

@override
void initState() {
super.initState();
_selectedWallet = widget.initialWallet;
_initialHdMode = widget.initialHdMode;
_initialHdMode = widget.initialWallet?.config.type == WalletType.hdwallet
? true
: widget.initialHdMode;
if (_selectedWallet != null) {
_existWalletAction = WalletsManagerExistWalletAction.logIn;
}
Expand Down
3 changes: 1 addition & 2 deletions lib/views/wallets_manager/widgets/wallet_creation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class WalletCreation extends StatefulWidget {
required String name,
required String password,
WalletType? walletType,
})
onCreate;
}) onCreate;
final void Function() onCancel;

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class _WalletImportByFileState extends State<WalletImportByFile> {
TextEditingController(text: '');
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
bool _isObscured = true;
bool _isHdMode = true;
bool _isHdMode = false;
bool _eulaAndTosChecked = false;
bool _allowCustomSeed = false;

Expand Down
3 changes: 2 additions & 1 deletion lib/views/wallets_manager/widgets/wallet_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class WalletLogIn extends StatefulWidget {
required this.wallet,
required this.onLogin,
required this.onCancel,
this.initialHdMode = true,
this.initialHdMode = false,
super.key,
});

Expand Down Expand Up @@ -54,6 +54,7 @@ class _WalletLogInState extends State<WalletLogIn> {
if (user != null) {
setState(() {
_user = user;
_isHdMode = user.wallet.config.type == WalletType.hdwallet;
});
}
}
Expand Down
32 changes: 14 additions & 18 deletions lib/views/wallets_manager/widgets/wallet_simple_import.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ class WalletSimpleImport extends StatefulWidget {
required String name,
required String password,
required WalletConfig walletConfig,
})
onImport;
}) onImport;

final void Function() onCancel;

final void Function({required String fileName, required String fileData})
onUploadFiles;
onUploadFiles;

@override
State<WalletSimpleImport> createState() => _WalletImportWrapperState();
Expand All @@ -57,7 +56,7 @@ class _WalletImportWrapperState extends State<WalletSimpleImport> {
bool _eulaAndTosChecked = false;
bool _inProgress = false;
bool _allowCustomSeed = false;
bool _isHdMode = true;
bool _isHdMode = false;

bool get _isButtonEnabled {
final isFormValid = _refreshFormValidationState();
Expand Down Expand Up @@ -338,16 +337,14 @@ class _WalletImportWrapperState extends State<WalletSimpleImport> {
return null;
}

final maybeFailedReason = context
.read<KomodoDefiSdk>()
.mnemonicValidator
.validateMnemonic(
seed ?? '',
minWordCount: 12,
maxWordCount: 24,
isHd: _isHdMode,
allowCustomSeed: _allowCustomSeed,
);
final maybeFailedReason =
context.read<KomodoDefiSdk>().mnemonicValidator.validateMnemonic(
seed ?? '',
minWordCount: 12,
maxWordCount: 24,
isHd: _isHdMode,
allowCustomSeed: _allowCustomSeed,
);

if (maybeFailedReason == null) {
return null;
Expand All @@ -356,10 +353,9 @@ class _WalletImportWrapperState extends State<WalletSimpleImport> {
return switch (maybeFailedReason) {
MnemonicFailedReason.empty =>
LocaleKeys.walletCreationEmptySeedError.tr(),
MnemonicFailedReason.customNotSupportedForHd =>
_isHdMode
? LocaleKeys.walletCreationHdBip39SeedError.tr()
: LocaleKeys.walletCreationBip39SeedError.tr(),
MnemonicFailedReason.customNotSupportedForHd => _isHdMode
? LocaleKeys.walletCreationHdBip39SeedError.tr()
: LocaleKeys.walletCreationBip39SeedError.tr(),
MnemonicFailedReason.customNotAllowed =>
LocaleKeys.customSeedWarningText.tr(),
MnemonicFailedReason.invalidLength =>
Expand Down
2 changes: 1 addition & 1 deletion lib/views/wallets_manager/widgets/wallets_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class WalletsManager extends StatelessWidget {
required this.close,
required this.onSuccess,
this.selectedWallet,
this.initialHdMode = true,
this.initialHdMode = false,
}) : super(key: key);
final WalletsManagerEventType eventType;
final WalletType walletType;
Expand Down
Loading