feat: zashi zkool sweep, and minor fixes (#2838)

feat: restore from keys zcash
fix: don't display empty keys
This commit is contained in:
cyan
2026-02-06 02:39:19 +01:00
committed by GitHub
parent 4ae94db3ee
commit d8a6766090
59 changed files with 886 additions and 93 deletions
@@ -19,6 +19,7 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/store/dashboard/order_filter_store.dart';
import 'package:cake_wallet/utils/device_info.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/zcash/zcash.dart';
import 'package:cw_core/utils/proxy_wrapper.dart';
import 'package:cake_wallet/utils/tor.dart';
import 'package:cake_wallet/wownero/wownero.dart' as wow;
@@ -580,6 +581,13 @@ abstract class DashboardViewModelBase with Store {
];
return errors;
}
@computed
bool get showZcashMissingFundsCard {
if (wallet.type != WalletType.zcash) return false;
if (!settingsStore.showZcashMissingFundsCard) return false;
return zcash!.showMissingFundsCard(wallet);
}
@computed
bool get hasSilentPayments =>
@@ -852,6 +860,16 @@ abstract class DashboardViewModelBase with Store {
mwebEnabled = false;
bitcoin!.setMwebEnabled(wallet, false);
}
@action
Future<void> rescanInternalChangeZcash() async {
await zcash!.rescanInternalChange(wallet);
}
@action
void dismissZcash() {
settingsStore.showZcashMissingFundsCard = false;
}
@action
void dismissDecredInfoCard() {
@@ -105,7 +105,7 @@ abstract class BitboxViewModelBase extends HardwareWalletViewModel with Store {
case WalletType.polygon:
return evm!.setHardwareWalletService(wallet, await getHardwareWalletService(wallet.type));
default:
throw Exception('Unexpected wallet type: ${wallet.type}');
throw Exception('Unexpected wallet type: ${wallet.type} for bitbox');
}
}
}
@@ -189,7 +189,7 @@ abstract class LedgerViewModelBase extends HardwareWalletViewModel with Store {
case WalletType.polygon:
return evm!.setHardwareWalletService(wallet, await getHardwareWalletService(wallet.type));
default:
throw Exception('Unexpected wallet type: ${wallet.type}');
throw Exception('Unexpected wallet type: ${wallet.type} for ledger');
}
}
@@ -73,7 +73,7 @@ abstract class TrezorViewModelBase extends HardwareWalletViewModel with Store {
case WalletType.polygon:
return evm!.setHardwareWalletService(wallet, await getHardwareWalletService(wallet.type));
default:
throw Exception('Unexpected wallet type: ${wallet.type}');
throw Exception('Unexpected wallet type: ${wallet.type} for trezor');
}
}
}
@@ -53,7 +53,7 @@ abstract class MoneroAccountListViewModelBase with Store {
.toList();
}
throw Exception('Unexpected wallet type: ${_wallet.type}');
throw Exception('Unexpected wallet type: ${_wallet.type} for monero');
}
final WalletBase _wallet;
@@ -36,7 +36,7 @@ abstract class NanoAccountListViewModelBase with Store {
.toList();
}
throw Exception('Unexpected wallet type: ${_wallet.type}');
throw Exception('Unexpected wallet type: ${_wallet.type} for nano');
}
final WalletBase _wallet;
@@ -63,7 +63,7 @@ abstract class PowNodeListViewModelBase with Store {
node = getNanoDefaultPowNode(nodes: _nodeSource)!;
break;
default:
throw Exception('Unexpected wallet type: ${_appStore.wallet!.type}');
throw Exception('Unexpected wallet type: ${_appStore.wallet!.type} for pow node list');
}
await setAsCurrent(node);
+1 -1
View File
@@ -1035,7 +1035,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
// priority: priority,
);
default:
throw Exception('Unexpected wallet type: ${wallet.type}');
throw Exception('Unexpected wallet type: ${wallet.type} for send');
}
}
@@ -49,6 +49,9 @@ abstract class DisplaySettingsViewModelBase with Store {
@computed
bool get showAddressBookPopup => _settingsStore.showAddressBookPopupEnabled;
@computed
bool get showZcashCard => _settingsStore.showZcashMissingFundsCard;
@computed
SyncStatusDisplayMode get syncStatusDisplayMode => _settingsStore.syncStatusDisplayMode;
@@ -103,6 +106,9 @@ abstract class DisplaySettingsViewModelBase with Store {
@action
void setBalanceDisplayMode(BalanceDisplayMode value) => _settingsStore.balanceDisplayMode = value;
@action
void setShowZcashCard(bool value) => _settingsStore.showZcashMissingFundsCard = value;
@action
void setShouldDisplayBalance(bool value) {
if (value) {
+22 -7
View File
@@ -5,6 +5,7 @@ import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.d
import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cake_wallet/zano/zano.dart';
import 'package:cake_wallet/zcash/zcash.dart';
import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_info.dart';
import 'package:cw_core/wallet_base.dart';
@@ -139,13 +140,15 @@ abstract class WalletKeysViewModelBase with Store {
case WalletType.zano:
keys = zano!.getKeys(_wallet);
break;
case WalletType.zcash:
keys = zcash!.getKeys(_wallet);
break;
case WalletType.ethereum:
case WalletType.polygon:
case WalletType.base:
case WalletType.arbitrum:
case WalletType.bsc:
case WalletType.solana:
case WalletType.zcash:
case WalletType.tron:
items.addAll([
if (_wallet.privateKey != null)
@@ -208,35 +211,47 @@ abstract class WalletKeysViewModelBase with Store {
if (keys != null) {
items.addAll([
if (keys['primaryAddress'] != null)
if ((keys['primaryAddress']??'').isNotEmpty)
StandartListItem(
key: ValueKey('${_walletName}_wallet_primary_address_item_key'),
title: S.current.primary_address,
value: keys['primaryAddress']!),
if (keys['publicSpendKey'] != null)
if ((keys['publicSpendKey']??'').isNotEmpty)
StandartListItem(
key: ValueKey('${_walletName}_wallet_public_spend_key_item_key'),
title: S.current.spend_key_public,
value: keys['publicSpendKey']!,
),
if (keys['privateSpendKey'] != null)
if ((keys['privateSpendKey']??'').isNotEmpty)
StandartListItem(
key: ValueKey('${_walletName}_wallet_private_spend_key_item_key'),
title: S.current.spend_key_private,
value: keys['privateSpendKey']!,
),
if (keys['publicViewKey'] != null)
if ((keys['publicViewKey']??'').isNotEmpty)
StandartListItem(
key: ValueKey('${_walletName}_wallet_public_view_key_item_key'),
title: S.current.view_key_public,
value: keys['publicViewKey']!,
),
if (keys['privateViewKey'] != null)
if ((keys['privateViewKey']??'').isNotEmpty)
StandartListItem(
key: ValueKey('${_walletName}_wallet_private_view_key_item_key'),
title: S.current.view_key_private,
value: keys['privateViewKey']!,
),
if ((keys['tsk']??'').isNotEmpty)
StandartListItem(
key: ValueKey('${_walletName}_wallet_transparent_secret_key_item_key'),
title: S.current.transparent_secret_key,
value: keys['tsk']!,
),
if ((keys['uvk']??'').isNotEmpty)
StandartListItem(
key: ValueKey('${_walletName}_wallet_unified_view_key_item_key'),
title: S.current.unified_view_key,
value: keys['uvk']!,
),
]);
}
}
@@ -292,7 +307,7 @@ abstract class WalletKeysViewModelBase with Store {
case WalletType.zcash:
return 'zcash-wallet';
default:
throw Exception('Unexpected wallet type: ${_wallet.type.toString()}');
throw Exception('Unexpected wallet type: ${_wallet.type.toString()} for wallet keys');
}
}
+10 -2
View File
@@ -57,11 +57,11 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
case WalletType.decred:
case WalletType.bitcoin:
case WalletType.litecoin:
case WalletType.zcash:
availableModes = [WalletRestoreMode.seed, WalletRestoreMode.keys];
break;
case WalletType.bitcoinCash:
case WalletType.zano:
case WalletType.zcash:
case WalletType.dogecoin:
availableModes = [WalletRestoreMode.seed];
break;
@@ -95,7 +95,8 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
WalletType.nano,
WalletType.banano,
WalletType.solana,
WalletType.tron
WalletType.tron,
WalletType.zcash,
].contains(type);
late final bool onlyViewKeyRestore =
@@ -307,6 +308,13 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
password: password,
pubkey: viewKey!,
);
case WalletType.zcash:
return zcash!.createZcashRestoreWalletFromPrivateKey(
name: name,
privateKey: options['private_key'] as String,
password: password,
height: height
);
default:
break;
}