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
@@ -333,6 +333,36 @@ class CryptoBalanceWidget extends StatelessWidget {
),
),
),
],
if (dashboardViewModel.showZcashMissingFundsCard) ...[
SizedBox(height: 10),
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
child: InfoCard(
title: S.of(context).zcash_card_missing_funds,
description: S.of(context).zcash_card_description,
leftButtonTitle: S.of(context).zcash_card_dismiss,
rightButtonTitle: S.of(context).zcash_card_scan,
image: 'assets/images/zec_icon.png',
leftButtonAction: () => _dismissZcash(context),
rightButtonAction: () => _rescanInternalChangeZcash(context),
hintWidget: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => launchUrl(
Uri.parse("https://docs.cakewallet.com/tutorials/zashi/#creating-a-new-zcash-wallet-on-cake"),
mode: LaunchMode.externalApplication,
),
child: Text(
S.of(context).learn_more,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
height: 1,
),
softWrap: true,
),
),
),
),
],
if (dashboardViewModel.showDecredInfoCard) ...[
SizedBox(height: 10),
@@ -462,6 +492,22 @@ class CryptoBalanceWidget extends StatelessWidget {
}
dashboardViewModel.setMwebEnabled();
}
Future<void> _rescanInternalChangeZcash(BuildContext context) async {
dashboardViewModel.rescanInternalChangeZcash();
await showPopUp<void>(
context: context,
builder: (BuildContext context) => AlertWithOneAction(
alertTitle: S.of(context).alert_notice,
alertContent: S.of(context).zcash_card_warning,
buttonText: S.of(context).understand,
buttonAction: () {
Navigator.of(context).pop();
},
),
);
}
Future<void> _dismissMweb(BuildContext context) async {
await showPopUp<void>(
@@ -476,4 +522,18 @@ class CryptoBalanceWidget extends StatelessWidget {
));
dashboardViewModel.dismissMweb();
}
Future<void> _dismissZcash(BuildContext context) async {
await showPopUp<void>(
context: context,
builder: (BuildContext context) => AlertWithOneAction(
alertTitle: S.of(context).alert_notice,
alertContent: S.of(context).zcash_card_enable_later,
buttonText: S.of(context).understand,
buttonAction: () {
Navigator.of(context).pop();
},
));
dashboardViewModel.dismissZcash();
}
}
@@ -232,14 +232,26 @@ class WalletRestoreFromKeysFormState extends State<WalletRestoreFromKeysForm> {
bool nanoBased = widget.walletRestoreViewModel.type == WalletType.nano ||
widget.walletRestoreViewModel.type == WalletType.banano;
return AddressTextField(
addressKey: ValueKey('wallet_restore_from_key_private_key_textfield_key'),
controller: privateKeyController,
placeholder: nanoBased ? S.of(context).seed_hex_form : S.of(context).private_key,
options: [AddressTextFieldOption.paste],
onPushPasteButton: (_) {
_pasteText();
},
return Column(
children: [
AddressTextField(
addressKey: ValueKey('wallet_restore_from_key_private_key_textfield_key'),
controller: privateKeyController,
placeholder: nanoBased ? S.of(context).seed_hex_form : S.of(context).private_key,
options: [AddressTextFieldOption.paste],
onPushPasteButton: (_) {
_pasteText();
},
),
if (widget.walletRestoreViewModel.hasBlockchainHeightSelector)
BlockchainHeightWidget(
key: blockchainHeightKey,
hasDatePicker: widget.walletRestoreViewModel.type != WalletType.haven,
onHeightChange: (_) => null,
onHeightOrDateEntered: widget.onHeightOrDateEntered,
walletType: widget.walletRestoreViewModel.type,
),
]
);
}
@@ -50,6 +50,13 @@ class DisplaySettingsPage extends BasePage {
_displaySettingsViewModel.setShowAddressBookPopup(value);
},
),
SettingsSwitcherCell(
title: S.of(context).show_zcash_card,
value: _displaySettingsViewModel.showZcashCard,
onValueChange: (_, bool value) {
_displaySettingsViewModel.setShowZcashCard(value);
},
),
SettingsPickerCell<SyncStatusDisplayMode>(
title: S.current.sync_status_display_mode,
items: SyncStatusDisplayMode.values.toList(),