mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-20 06:08:34 +02:00
CW-843: Enhance Wallet Groups Implementation (#2045)
* feat: Enhance Wallet Groups Implementation by using hashedIdentifiers instead of parentAddresses * fix: Call updateWalletGroups even if group has an hash identifier * feat: Add secrets to workflow * feat: Enhance Wallet Groups Implementation by using hashedIdentifiers instead of parentAddresses * Handle wallet grouping edgecase where wallet is restored via non seed medium * fix: Valid wallet/wallet groups not showing up when choosing wallet/groups for creating new wallets
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:cake_wallet/core/wallet_creation_service.dart';
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/entities/background_tasks.dart';
|
||||
import 'package:cake_wallet/entities/generate_name.dart';
|
||||
import 'package:cake_wallet/entities/hash_wallet_identifier.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/nano/nano.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
@@ -103,13 +104,16 @@ abstract class WalletCreationVMBase with Store {
|
||||
showIntroCakePayCard: (!walletCreationService.typeExists(type)) && type != WalletType.haven,
|
||||
derivationInfo: credentials.derivationInfo ?? getDefaultCreateDerivation(),
|
||||
hardwareWalletType: credentials.hardwareWalletType,
|
||||
parentAddress: credentials.parentAddress,
|
||||
);
|
||||
|
||||
credentials.walletInfo = walletInfo;
|
||||
final wallet = restoreWallet != null
|
||||
? await processFromRestoredWallet(credentials, restoreWallet)
|
||||
: await process(credentials);
|
||||
|
||||
final isNonSeedWallet = isRecovery ? wallet.seed == null : false;
|
||||
walletInfo.isNonSeedWallet = isNonSeedWallet;
|
||||
walletInfo.hashedWalletIdentifier = createHashedWalletIdentifier(wallet);
|
||||
walletInfo.address = wallet.walletAddresses.address;
|
||||
await _walletInfoSource.add(walletInfo);
|
||||
await _appStore.changeCurrentWallet(wallet);
|
||||
|
||||
@@ -47,8 +47,6 @@ abstract class WalletGroupsDisplayViewModelBase with Store {
|
||||
@observable
|
||||
WalletInfo? selectedSingleWallet;
|
||||
|
||||
@observable
|
||||
String? parentAddress;
|
||||
|
||||
@observable
|
||||
bool isFetchingMnemonic;
|
||||
@@ -77,9 +75,6 @@ abstract class WalletGroupsDisplayViewModelBase with Store {
|
||||
walletToUse.name,
|
||||
);
|
||||
|
||||
parentAddress =
|
||||
isGroupSelected ? selectedWalletGroup!.parentAddress : selectedSingleWallet!.address;
|
||||
|
||||
return wallet.seed;
|
||||
} catch (e) {
|
||||
return null;
|
||||
@@ -130,11 +125,14 @@ abstract class WalletGroupsDisplayViewModelBase with Store {
|
||||
// Check that selected wallet type is not present already in group
|
||||
bool isSameTypeAsSelectedWallet = wallet.type == type;
|
||||
|
||||
bool isNonSeedWallet = wallet.isNonSeedWallet;
|
||||
|
||||
// Exclude if any of these conditions are true
|
||||
return isNonBIP39Wallet ||
|
||||
isNanoDerivationType ||
|
||||
isElectrumDerivationType ||
|
||||
isSameTypeAsSelectedWallet;
|
||||
isSameTypeAsSelectedWallet ||
|
||||
isNonSeedWallet;
|
||||
});
|
||||
|
||||
if (shouldExcludeGroup) continue;
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class WalletEditViewModelBase with Store {
|
||||
Future<void> changeName(
|
||||
WalletListItem walletItem, {
|
||||
String? password,
|
||||
String? groupParentAddress,
|
||||
String? walletGroupKey,
|
||||
bool isWalletGroup = false,
|
||||
}) async {
|
||||
state = WalletEditRenamePending();
|
||||
@@ -48,7 +48,7 @@ abstract class WalletEditViewModelBase with Store {
|
||||
if (isWalletGroup) {
|
||||
_walletManager.updateWalletGroups();
|
||||
|
||||
_walletManager.setGroupName(groupParentAddress!, newName);
|
||||
_walletManager.setGroupName(walletGroupKey!, newName);
|
||||
} else {
|
||||
await _walletLoadingService.renameWallet(
|
||||
walletItem.type,
|
||||
|
||||
@@ -109,7 +109,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
password: walletPassword,
|
||||
passphrase: passphrase,
|
||||
mnemonic: newWalletArguments!.mnemonic,
|
||||
parentAddress: newWalletArguments!.parentAddress,
|
||||
);
|
||||
case WalletType.haven:
|
||||
return haven!.createHavenNewWalletCredentials(
|
||||
@@ -119,7 +118,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
name: name,
|
||||
password: walletPassword,
|
||||
mnemonic: newWalletArguments!.mnemonic,
|
||||
parentAddress: newWalletArguments!.parentAddress,
|
||||
passphrase: passphrase,
|
||||
);
|
||||
case WalletType.bitcoinCash:
|
||||
@@ -128,7 +126,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
password: walletPassword,
|
||||
passphrase: passphrase,
|
||||
mnemonic: newWalletArguments!.mnemonic,
|
||||
parentAddress: newWalletArguments!.parentAddress,
|
||||
);
|
||||
case WalletType.nano:
|
||||
case WalletType.banano:
|
||||
@@ -136,7 +133,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
name: name,
|
||||
password: walletPassword,
|
||||
mnemonic: newWalletArguments!.mnemonic,
|
||||
parentAddress: newWalletArguments!.parentAddress,
|
||||
passphrase: passphrase,
|
||||
);
|
||||
case WalletType.polygon:
|
||||
@@ -144,7 +140,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
name: name,
|
||||
password: walletPassword,
|
||||
mnemonic: newWalletArguments!.mnemonic,
|
||||
parentAddress: newWalletArguments!.parentAddress,
|
||||
passphrase: passphrase,
|
||||
);
|
||||
case WalletType.solana:
|
||||
@@ -152,7 +147,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
name: name,
|
||||
password: walletPassword,
|
||||
mnemonic: newWalletArguments!.mnemonic,
|
||||
parentAddress: newWalletArguments!.parentAddress,
|
||||
passphrase: passphrase,
|
||||
);
|
||||
case WalletType.tron:
|
||||
@@ -160,7 +154,6 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||
name: name,
|
||||
password: walletPassword,
|
||||
mnemonic: newWalletArguments!.mnemonic,
|
||||
parentAddress: newWalletArguments!.parentAddress,
|
||||
passphrase: passphrase,
|
||||
);
|
||||
case WalletType.wownero:
|
||||
|
||||
Reference in New Issue
Block a user