Files
ObsidianDragon/src/ui/windows/shield_dialog.h
T
DanSandClaude Opus 4.8 08cfeb0e08 feat(ui): rework the consolidate/merge modal
Make Merge to Address actually serve wallet-bloat consolidation and be far less
opaque. New ShieldDialog::showConsolidate() preset (used by the large-wallet
Settings banner + alert action) frames it as "Consolidate funds" and targets
shielded notes — the bloat the nudge warns about.

- Source selector: consolidate shielded notes (ANY_SAPLING), transparent
  (ANY_TADDR), or both (*) — previously hardcoded to ANY_TADDR, which never
  reduced the shielded-witness bloat. Batch limit now applies to the right side.
- Scope: on open, count spendable UTXOs + notes (listunspent / z_listunspent)
  and show "N transparent + M shielded · ~X DRGX"; warn "repeat to finish" when
  the set exceeds one batch.
- Destination auto-selects the best spendable z-address (button enabled by
  default); empty wallets get an inline "Create shielded address" (z_getnewaddress).
- Advanced disclosure hides Fee + "Max inputs per batch" (renamed from the "UTXO
  Limit" jargon) with sane defaults.
- Inline confirm step before the fund-moving call (amount + input count + dest).
- Live progress: self-polls z_getoperationstatus to show Consolidating… →
  Done/Failed, replacing the raw opid + manual "Check status" button.

All three merge entry points now use the typed showMerge()/showConsolidate()
(no stale-static leaks from direct show(MergeToAddress)). Shield-coinbase mode
keeps working. New i18n keys fall back to English.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-20 22:33:59 -05:00

59 lines
1.3 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#include <string>
namespace dragonx {
class App;
namespace ui {
/**
* @brief Dialog for shielding coinbase rewards and merging funds
*/
class ShieldDialog {
public:
enum class Mode {
ShieldCoinbase, // Shield mining rewards (t-addr coinbase -> z-addr)
MergeToAddress // Merge multiple inputs to single z-addr
};
/**
* @brief Show the shield dialog
* @param mode Operating mode
*/
static void show(Mode mode = Mode::ShieldCoinbase);
/**
* @brief Show shield coinbase dialog for specific address
*/
static void showShieldCoinbase(const std::string& fromAddress = "*");
/**
* @brief Show merge to address dialog (generic — both transparent + shielded sources)
*/
static void showMerge();
/**
* @brief Show the consolidate-funds flow preset for wallet-bloat reduction (shielded notes).
* Used by the large-wallet nudges (Settings banner + alert action).
*/
static void showConsolidate();
/**
* @brief Render the dialog (call each frame)
*/
static void render(App* app);
/**
* @brief Close the dialog (used by the UI sweep teardown)
*/
static void hide();
};
} // namespace ui
} // namespace dragonx