feat(send): harden the confirm dialog (UX audit F010/F011/F029/F053/F054)

First batch of the 2026-11 UX audit, Send surface — the pre-broadcast confirm:

- F029: round the amount-bar drag to satoshi precision, so the value reviewed in
  the confirm is exactly what's sent / affordability-checked (text entry already
  rounded).
- F011: wrap the memo in the confirm (a long / multi-line memo was clipped off
  the card), and repeat the transparent-source privacy warning on the confirm,
  not just the compose form.
- F054: flag a recipient with no saved label and no prior send to it ("New
  recipient — verify the full address") and show its first/last characters for an
  easy compare — the clearest cue against a swapped/clipboard address.
- F053: on the live re-validation at Confirm, name the specific reason (not
  connected / syncing / no tip / no amount / can't afford) instead of one generic
  "cannot send now", reusing the disabled-Review reason chain.
- F010: a locked encrypted lite wallet now tells the user to unlock and closes
  the confirm, instead of silently doing nothing behind it.

3 new strings (English; locales fall back). Build + tests green. Decisions pulled
from the tracked audit artifact (F054 = option a).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 12:26:13 -06:00
co-authored by Claude Opus 4.8
parent 6bb72f9878
commit 47b93252ff
2 changed files with 51 additions and 3 deletions
+48 -3
View File
@@ -513,6 +513,7 @@ static void RenderAmountBar(ImDrawList* dl, double available, float innerW,
float clickPct = std::clamp((mouseX - barMin.x) / barW, 0.0f, 1.0f);
s_amount = maxAmount * clickPct;
if (s_amount < 0) s_amount = 0;
s_amount = std::round(s_amount * 1e8) / 1e8; // satoshi precision — the reviewed value is what's sent
s_send_max = (clickPct >= 1.0f);
// Sync USD amount so the USD input field stays in sync
if (usd_price > 0.0)
@@ -809,6 +810,28 @@ void RenderSendConfirmPopup(App* app) {
drawAddrCard("from_upper", s_from_address);
ImGui::Dummy(ImVec2(0, Layout::spacingSm()));
drawAddrCard("to_upper", s_to_address);
{
// Flag a recipient we have no saved label for and have never sent to — the clearest cue against
// a swapped / clipboard-malware address on the one screen meant to catch it, plus an easy-to-
// compare view of the first and last characters.
bool known = !app->getAddressLabel(s_to_address).empty();
if (!known) {
for (const auto& tx : app->getWalletState().transactions)
if (tx.type == "send" && tx.address == s_to_address) { known = true; break; }
}
if (!known) {
ImGui::Dummy(ImVec2(0, Layout::spacingSm()));
ImGui::PushTextWrapPos(0.0f);
Type().textColored(TypeStyle::Caption, Warning(), TR("send_new_recipient_warn"));
ImGui::PopTextWrapPos();
const std::string a = s_to_address;
if (a.size() > 14) {
const std::string ends = a.substr(0, 6) + " \xE2\x80\xA6 " + a.substr(a.size() - 6);
Type().textColored(TypeStyle::Caption, Primary(),
(std::string(TR("send_verify_ends")) + ends).c_str());
}
}
}
ImGui::Dummy(ImVec2(0, Layout::spacingMd()));
// Fee tier selector
@@ -889,7 +912,18 @@ void RenderSendConfirmPopup(App* app) {
if (s_memo[0] != '\0' && is_valid_z) {
Type().textColored(TypeStyle::Overline, OnSurfaceMedium(), TR("memo_upper"));
ImGui::PushTextWrapPos(0.0f); // wrap a long / multi-line memo instead of clipping it off the card
Type().textColored(TypeStyle::Caption, OnSurface(), s_memo);
ImGui::PopTextWrapPos();
ImGui::Dummy(ImVec2(0, Layout::spacingSm()));
}
// Repeat the transparent-source privacy warning on the final confirm (the compose form shows it, but
// someone who skimmed past it should get one last reminder before broadcasting).
if (s_from_address[0] != '\0' && !dragonx::util::isShieldedAddress(s_from_address)) {
ImGui::PushTextWrapPos(0.0f);
Type().textColored(TypeStyle::Caption, Warning(), TR("send_transparent_source_warn"));
ImGui::PopTextWrapPos();
ImGui::Dummy(ImVec2(0, Layout::spacingSm()));
}
@@ -917,18 +951,29 @@ void RenderSendConfirmPopup(App* app) {
if (!app->isConnected() || liveState.sync.syncing ||
!liveState.sync.sendTipReady(app->isLiteBuild()) || s_amount <= 0 ||
!util::canAfford(s_amount, s_fee, liveAvail)) {
s_tx_status = TR("send_cannot_send_now");
// Name the SPECIFIC reason (the generic "cannot send now" left the user guessing), reusing
// the same reason chain as the disabled-Review tooltip so the two can't diverge.
const char* why =
!app->isConnected() ? TR(app->isLiteBuild() ? "lite_no_wallet_short" : "send_tooltip_not_connected")
: liveState.sync.syncing ? TR("send_tooltip_syncing")
: !liveState.sync.sendTipReady(app->isLiteBuild()) ? TR("send_tooltip_no_tip")
: s_amount <= 0 ? TR("send_tooltip_enter_amount")
: TR("send_tooltip_exceeds_balance");
s_tx_status = why;
s_status_success = false;
s_status_timestamp = ImGui::GetTime();
// The status renders on the form BEHIND this popup, so surface it visibly and close the
// popup — otherwise the user is stuck re-clicking a button that silently does nothing.
Notifications::instance().warning(TR("send_cannot_send_now"));
Notifications::instance().warning(why);
s_show_confirm = false;
}
// A locked encrypted lite wallet can't spend; prompt to unlock instead of sending
// (the backend would otherwise reject with "Wallet is locked").
// (the backend would otherwise reject with "Wallet is locked"). Tell the user why and close
// the confirm so they aren't stuck behind it while the unlock prompt is up.
else if (app->liteWallet() && app->getWalletState().isLocked()) {
app->requestLiteUnlock();
Notifications::instance().info(TR("send_wallet_locked_unlock"));
s_show_confirm = false;
} else {
s_sending = true;
s_send_start_time = ImGui::GetTime();
+3
View File
@@ -2793,6 +2793,9 @@ void I18n::loadBuiltinEnglish()
strings_["send_maybe_sent"] = "This transaction may already have been broadcast (the reply was lost). Do NOT send again yet - check History first.";
strings_["send_tx_sent"] = "Transaction sent!";
strings_["send_cannot_send_now"] = "Cannot send now — check connection, sync, and available balance.";
strings_["send_new_recipient_warn"] = "New recipient — verify the full address matches where you mean to send.";
strings_["send_verify_ends"] = "Check the ends: ";
strings_["send_wallet_locked_unlock"] = "Wallet is locked — enter your passphrase, then send again.";
strings_["send_tx_success"] = "Transaction sent successfully!";
strings_["send_status_unconfirmed"] = "Transaction status could not be confirmed";
strings_["send_err_needs_rescan"] = "Your wallet's shielded note data is out of date with the blockchain (this happens after a bootstrap or reindex). Run a full rescan via Settings -> Rescan Blockchain and let it finish completely, then try sending again.";