CW-520-Enable-user-to-choose-12-or-24-seed-words-for-BCH-and-ETH (#1181)

* seed phrase option UI

* bch seed length option

* eth seed lengh option

* update preseed info

* update localization files
This commit is contained in:
Serhii 2023-11-17 15:45:42 +02:00 committed by GitHub
parent 36361ef329
commit 8237b89d56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 137 additions and 14 deletions

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:flutter/foundation.dart';
@ -18,6 +19,7 @@ class WalletCreationService {
required this.secureStorage,
required this.keyService,
required this.sharedPreferences,
required this.settingsStore,
required this.walletInfoSource})
: type = initialType {
changeWalletType(type: type);
@ -26,6 +28,7 @@ class WalletCreationService {
WalletType type;
final FlutterSecureStorage secureStorage;
final SharedPreferences sharedPreferences;
final SettingsStore settingsStore;
final KeyService keyService;
final Box<WalletInfo> walletInfoSource;
WalletService? _service;
@ -56,6 +59,9 @@ class WalletCreationService {
checkIfExists(credentials.name);
final password = generateWalletPassword();
credentials.password = password;
if (type == WalletType.bitcoinCash || type == WalletType.ethereum) {
credentials.seedPhraseLength = settingsStore.seedPhraseLength.value;
}
await keyService.saveWalletPassword(password: password, walletName: credentials.name);
final wallet = await _service!.create(credentials);