Files
ObsidianDragon/src/ui/windows/validate_address_dialog.h
T
DanSandClaude Opus 4.8 579accd0c6 fix(ui): validate shielded addresses with the correct RPC
The Validate address dialog chose its RPC from the first character of
the input, then asked the transparent-only validateaddress for every
case. That RPC is Base58-only, so a valid Sapling (z) address came back
isvalid=false and was reported invalid.

- The input is now classified with the checksum-verified recognizers,
  and a shielded address is sent to z_validateaddress while a
  transparent (mining) address keeps validateaddress.
- Anything that is not an address - a typo, garbage, or a pasted
  viewing/spending key - is judged invalid on the spot and never sent to
  the node, so a key pasted into the field is not leaked to an RPC.
- On Lite there is no node to ask, so the dialog shows the checksum
  verdict alone and hides the "owned by this wallet" row.

Tests: validateRpcMethod maps shielded to z_validateaddress, transparent
to validateaddress, and a key or empty string to no RPC.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-12 21:42:23 -05:00

61 lines
1.4 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 validating cryptocurrency addresses
*/
class ValidateAddressDialog {
public:
/**
* @brief Show the validate address dialog
*/
static void show();
/**
* @brief Render the dialog (call every frame)
* @param app Pointer to app instance for RPC calls
*/
static void render(App* app);
/**
* @brief Check if dialog is currently open
*/
static bool isOpen();
/**
* @brief Close the dialog (used by the UI sweep teardown)
*/
static void hide();
/** UI sweep: show the result for a valid mining (transparent) address of ours. */
static void sweepShowMiningResult(const char* address);
private:
static bool s_open;
static bool s_validated;
static bool s_validating;
static char s_address_input[512];
// Validation results
static bool s_is_valid;
static bool s_is_mine;
static bool s_is_mining; // a valid transparent (mining) address: explain it can't be paid
static bool s_ownership_known; // false when no node was asked (lite): the ownership row is hidden
static std::string s_address_type;
static std::string s_error_message;
};
} // namespace ui
} // namespace dragonx