feat(settings): rename to "Import Private Key" + add scan height to it

Follow-up to the key/viewing-key button split:

- Rename the "Import Key…" button to "Import Private Key…" (settings_import_key
  value in en + all 8 langs, reusing the existing import_key_title wording) so it
  reads as the natural counterpart to "Import Viewing Key…". The dialog title was
  already "Import Private Key". The viewing-key wrong-type redirect hint now names
  the renamed button.

- Show the "scan from block height" field in the private-key (spending) dialog too,
  not just the viewing-key one. z_importkey accepts a start height, so a shielded
  spend import of a recent key needn't rescan the whole chain. Transparent WIF
  (importprivkey) has no such param, so once a transparent key is recognized the
  field is disabled, its buffer cleared, and a "Transparent keys always rescan
  fully" note replaces the hint. importPrivateKey already gates the start-height
  append on (viewing || shielded), so transparent imports never receive it.

- i18n: shared scan keys renamed import_viewkey_scan_{label,hint} ->
  import_scan_{label,hint}; added import_scan_transparent (en + 8 langs).

Reviewed via an adversarial multi-agent pass (rpc-routing / i18n / ui-logic /
consistency); only two nits surfaced (stale disabled-field value + a stale
comment), both fixed here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-13 14:38:40 -05:00
parent f428292ea4
commit 1fc3e03e6f
11 changed files with 60 additions and 44 deletions

View File

@@ -444,12 +444,13 @@
"import_key_wrong_type": "Das sieht nach einem Anzeigeschlüssel aus. Verwenden Sie stattdessen \"Anzeigeschlüssel importieren\".",
"import_key_z_format": "Z-Adresse Ausgabeschlüssel (secret-extended-key-...)",
"import_private_key": "Privaten Schlüssel importieren...",
"import_scan_hint": "0 = von Anfang an neu scannen",
"import_scan_label": "Ab Blockhöhe scannen (optional)",
"import_scan_transparent": "Transparente Schlüssel scannen immer vollständig neu",
"import_viewkey_field": "Anzeigeschlüssel",
"import_viewkey_note": "Nur Lesen: Ein Anzeigeschlüssel zeigt Guthaben und Transaktionen einer Adresse, kann deren Mittel aber nicht ausgeben.",
"import_viewkey_scan_hint": "0 = von Anfang an neu scannen",
"import_viewkey_scan_label": "Ab Blockhöhe scannen (optional)",
"import_viewkey_title": "Anzeigeschlüssel importieren",
"import_viewkey_wrong_type": "Das sieht nach einem Ausgabeschlüssel aus. Verwenden Sie stattdessen \"Schlüssel importieren\".",
"import_viewkey_wrong_type": "Das sieht nach einem Ausgabeschlüssel aus. Verwenden Sie stattdessen \"Privaten Schlüssel importieren\".",
"incorrect_passphrase": "Falsches Passwort",
"incorrect_pin": "Falsche PIN",
"insufficient_funds": "Unzureichendes Guthaben für diesen Betrag plus Gebühr.",
@@ -1111,7 +1112,7 @@
"settings_gradient_bg": "Hintergrund-Verlauf",
"settings_gradient_desc": "Strukturierte Hintergründe durch sanfte Verläufe ersetzen",
"settings_idle_after": "nach",
"settings_import_key": "Schlüssel importieren...",
"settings_import_key": "Privaten Schlüssel importieren...",
"settings_import_viewkey": "Anzeigeschlüssel importieren...",
"settings_language_note": "Hinweis: Manche Texte erfordern einen Neustart zur Aktualisierung",
"settings_lock_now": "Jetzt sperren",

View File

@@ -444,12 +444,13 @@
"import_key_wrong_type": "Esto parece una clave de visualización. Usa \"Importar clave de visualización\" en su lugar.",
"import_key_z_format": "Claves de gasto de direcciones Z (secret-extended-key-...)",
"import_private_key": "Importar Clave Privada...",
"import_scan_hint": "0 = volver a escanear desde el inicio",
"import_scan_label": "Escanear desde la altura de bloque (opcional)",
"import_scan_transparent": "Las claves transparentes siempre se reescanean por completo",
"import_viewkey_field": "Clave de visualización",
"import_viewkey_note": "Solo lectura: una clave de visualización revela el saldo y las transacciones de una dirección, pero no puede gastar sus fondos.",
"import_viewkey_scan_hint": "0 = volver a escanear desde el inicio",
"import_viewkey_scan_label": "Escanear desde la altura de bloque (opcional)",
"import_viewkey_title": "Importar clave de visualización",
"import_viewkey_wrong_type": "Esto parece una clave de gasto. Usa \"Importar clave\" en su lugar.",
"import_viewkey_wrong_type": "Esto parece una clave de gasto. Usa \"Importar Clave Privada\" en su lugar.",
"incorrect_passphrase": "Contraseña incorrecta",
"incorrect_pin": "PIN incorrecto",
"insufficient_funds": "Fondos insuficientes para este monto más la comisión.",
@@ -1111,7 +1112,7 @@
"settings_gradient_bg": "Fondo degradado",
"settings_gradient_desc": "Reemplazar fondos con texturas por degradados suaves",
"settings_idle_after": "después de",
"settings_import_key": "Importar clave...",
"settings_import_key": "Importar Clave Privada...",
"settings_import_viewkey": "Importar clave de visualización...",
"settings_language_note": "Nota: Parte del texto requiere reinicio para actualizarse",
"settings_lock_now": "Bloquear ahora",

View File

@@ -444,12 +444,13 @@
"import_key_wrong_type": "Ceci ressemble à une clé de visualisation. Utilisez plutôt « Importer la clé de visualisation ».",
"import_key_z_format": "Clés de dépenses z-adresse (secret-extended-key-...)",
"import_private_key": "Importer une clé privée...",
"import_scan_hint": "0 = réanalyser depuis le début",
"import_scan_label": "Analyser à partir de la hauteur de bloc (facultatif)",
"import_scan_transparent": "Les clés transparentes réanalysent toujours entièrement",
"import_viewkey_field": "Clé de visualisation",
"import_viewkey_note": "Lecture seule : une clé de visualisation révèle le solde et les transactions d'une adresse, mais ne peut pas dépenser ses fonds.",
"import_viewkey_scan_hint": "0 = réanalyser depuis le début",
"import_viewkey_scan_label": "Analyser à partir de la hauteur de bloc (facultatif)",
"import_viewkey_title": "Importer la clé de visualisation",
"import_viewkey_wrong_type": "Ceci ressemble à une clé de dépense. Utilisez plutôt « Importer la clé ».",
"import_viewkey_wrong_type": "Ceci ressemble à une clé de dépense. Utilisez plutôt « Importer une clé privée ».",
"incorrect_passphrase": "Mot de passe incorrect",
"incorrect_pin": "PIN incorrect",
"insufficient_funds": "Fonds insuffisants pour ce montant plus les frais.",
@@ -1111,7 +1112,7 @@
"settings_gradient_bg": "Fond dégradé",
"settings_gradient_desc": "Remplacer les arrière-plans texturés par des dégradés lisses",
"settings_idle_after": "après",
"settings_import_key": "Importer la clé...",
"settings_import_key": "Importer une clé privée...",
"settings_import_viewkey": "Importer la clé de visualisation...",
"settings_language_note": "Remarque : Certains textes nécessitent un redémarrage pour se mettre à jour",
"settings_lock_now": "Verrouiller maintenant",

View File

@@ -444,12 +444,13 @@
"import_key_wrong_type": "これは閲覧鍵のようです。代わりに「閲覧鍵をインポート」を使用してください。",
"import_key_z_format": "Zアドレス支出鍵 (secret-extended-key-...)",
"import_private_key": "秘密鍵をインポート...",
"import_scan_hint": "0 = 最初から再スキャン",
"import_scan_label": "スキャン開始ブロック高(任意)",
"import_scan_transparent": "透明鍵は常に全体を再スキャンします",
"import_viewkey_field": "閲覧鍵",
"import_viewkey_note": "監視のみ:閲覧鍵はアドレスの残高と取引を表示できますが、資金を送金することはできません。",
"import_viewkey_scan_hint": "0 = 最初から再スキャン",
"import_viewkey_scan_label": "スキャン開始ブロック高(任意)",
"import_viewkey_title": "閲覧鍵をインポート",
"import_viewkey_wrong_type": "これは支払い鍵のようです。代わりに「鍵をインポート」を使用してください。",
"import_viewkey_wrong_type": "これは支払い鍵のようです。代わりに「秘密鍵をインポート」を使用してください。",
"incorrect_passphrase": "パスフレーズが正しくありません",
"incorrect_pin": "PINが正しくありません",
"insufficient_funds": "この金額と手数料に対して残高が不足しています。",
@@ -1111,7 +1112,7 @@
"settings_gradient_bg": "グラデーション背景",
"settings_gradient_desc": "テクスチャ背景を滑らかなグラデーションに置換",
"settings_idle_after": "経過後",
"settings_import_key": "鍵をインポート...",
"settings_import_key": "秘密鍵をインポート...",
"settings_import_viewkey": "閲覧鍵をインポート...",
"settings_language_note": "注意:一部のテキストは更新に再起動が必要です",
"settings_lock_now": "今すぐロック",

View File

@@ -444,12 +444,13 @@
"import_key_wrong_type": "조회 키인 것 같습니다. 대신 \"조회 키 가져오기\"를 사용하세요.",
"import_key_z_format": "Z 주소 지출 키 (secret-extended-key-...)",
"import_private_key": "개인 키 가져오기...",
"import_scan_hint": "0 = 처음부터 다시 스캔",
"import_scan_label": "스캔 시작 블록 높이(선택 사항)",
"import_scan_transparent": "투명 키는 항상 전체를 다시 스캔합니다",
"import_viewkey_field": "조회 키",
"import_viewkey_note": "읽기 전용: 조회 키는 주소의 잔액과 거래를 보여주지만 자금을 사용할 수는 없습니다.",
"import_viewkey_scan_hint": "0 = 처음부터 다시 스캔",
"import_viewkey_scan_label": "스캔 시작 블록 높이(선택 사항)",
"import_viewkey_title": "조회 키 가져오기",
"import_viewkey_wrong_type": "지출 키인 것 같습니다. 대신 \"키 가져오기\"를 사용하세요.",
"import_viewkey_wrong_type": "지출 키인 것 같습니다. 대신 \"개인 키 가져오기\"를 사용하세요.",
"incorrect_passphrase": "잘못된 암호",
"incorrect_pin": "잘못된 PIN",
"insufficient_funds": "이 금액과 수수료를 위한 잔액이 부족합니다.",
@@ -1111,7 +1112,7 @@
"settings_gradient_bg": "그라데이션 배경",
"settings_gradient_desc": "텍스처 배경을 부드러운 그라데이션으로 교체",
"settings_idle_after": "후",
"settings_import_key": "키 가져오기...",
"settings_import_key": "개인 키 가져오기...",
"settings_import_viewkey": "조회 키 가져오기...",
"settings_language_note": "참고: 일부 텍스트는 업데이트하려면 다시 시작해야 합니다",
"settings_lock_now": "지금 잠금",

View File

@@ -444,12 +444,13 @@
"import_key_wrong_type": "Isto parece uma chave de visualização. Use \"Importar chave de visualização\".",
"import_key_z_format": "Chaves de gasto de z-endereço (secret-extended-key-...)",
"import_private_key": "Importar Chave Privada...",
"import_scan_hint": "0 = reescanear desde o início",
"import_scan_label": "Escanear a partir da altura do bloco (opcional)",
"import_scan_transparent": "Chaves transparentes sempre reescaneiam totalmente",
"import_viewkey_field": "Chave de visualização",
"import_viewkey_note": "Somente leitura: uma chave de visualização revela o saldo e as transações de um endereço, mas não pode gastar seus fundos.",
"import_viewkey_scan_hint": "0 = reescanear desde o início",
"import_viewkey_scan_label": "Escanear a partir da altura do bloco (opcional)",
"import_viewkey_title": "Importar chave de visualização",
"import_viewkey_wrong_type": "Isto parece uma chave de gasto. Use \"Importar chave\".",
"import_viewkey_wrong_type": "Isto parece uma chave de gasto. Use \"Importar Chave Privada\".",
"incorrect_passphrase": "Senha incorreta",
"incorrect_pin": "PIN incorreto",
"insufficient_funds": "Fundos insuficientes para este valor mais taxa.",
@@ -1111,7 +1112,7 @@
"settings_gradient_bg": "Fundo gradiente",
"settings_gradient_desc": "Substituir fundos texturizados por gradientes suaves",
"settings_idle_after": "após",
"settings_import_key": "Importar chave...",
"settings_import_key": "Importar Chave Privada...",
"settings_import_viewkey": "Importar chave de visualização...",
"settings_language_note": "Nota: Alguns textos requerem reinício para atualizar",
"settings_lock_now": "Bloquear agora",

View File

@@ -444,12 +444,13 @@
"import_key_wrong_type": "Похоже, это ключ просмотра. Используйте «Импорт ключа просмотра».",
"import_key_z_format": "Ключи расходования z-адресов (secret-extended-key-...)",
"import_private_key": "Импорт приватного ключа...",
"import_scan_hint": "0 = повторное сканирование с начала",
"import_scan_label": "Сканировать с высоты блока (необязательно)",
"import_scan_transparent": "Прозрачные ключи всегда пересканируются полностью",
"import_viewkey_field": "Ключ просмотра",
"import_viewkey_note": "Только чтение: ключ просмотра показывает баланс и транзакции адреса, но не может тратить его средства.",
"import_viewkey_scan_hint": "0 = повторное сканирование с начала",
"import_viewkey_scan_label": "Сканировать с высоты блока (необязательно)",
"import_viewkey_title": "Импорт ключа просмотра",
"import_viewkey_wrong_type": "Похоже, это ключ расходования. Используйте «Импортировать ключ».",
"import_viewkey_wrong_type": "Похоже, это ключ расходования. Используйте «Импорт приватного ключа».",
"incorrect_passphrase": "Неверный пароль",
"incorrect_pin": "Неверный PIN",
"insufficient_funds": "Недостаточно средств для этой суммы плюс комиссия.",
@@ -1111,7 +1112,7 @@
"settings_gradient_bg": "Градиент фона",
"settings_gradient_desc": "Заменить текстурные фоны плавными градиентами",
"settings_idle_after": "через",
"settings_import_key": "Импортировать ключ...",
"settings_import_key": "Импорт приватного ключа...",
"settings_import_viewkey": "Импортировать ключ просмотра...",
"settings_language_note": "Примечание: Некоторый текст требует перезапуска для обновления",
"settings_lock_now": "Заблокировать сейчас",

View File

@@ -444,12 +444,13 @@
"import_key_wrong_type": "这看起来像查看密钥。请改用\"导入查看密钥\"。",
"import_key_z_format": "Z 地址花费密钥 (secret-extended-key-...)",
"import_private_key": "导入私钥...",
"import_scan_hint": "0 = 从头重新扫描",
"import_scan_label": "从区块高度开始扫描(可选)",
"import_scan_transparent": "透明密钥始终完整重新扫描",
"import_viewkey_field": "查看密钥",
"import_viewkey_note": "仅查看:查看密钥可显示地址的余额和交易,但无法花费其资金。",
"import_viewkey_scan_hint": "0 = 从头重新扫描",
"import_viewkey_scan_label": "从区块高度开始扫描(可选)",
"import_viewkey_title": "导入查看密钥",
"import_viewkey_wrong_type": "这看起来像花费密钥。请改用\"导入钥\"。",
"import_viewkey_wrong_type": "这看起来像花费密钥。请改用\"导入钥\"。",
"incorrect_passphrase": "密码错误",
"incorrect_pin": "PIN 错误",
"insufficient_funds": "余额不足以支付此金额加手续费。",
@@ -1111,7 +1112,7 @@
"settings_gradient_bg": "渐变背景",
"settings_gradient_desc": "用平滑渐变替换纹理背景",
"settings_idle_after": "之后",
"settings_import_key": "导入钥...",
"settings_import_key": "导入钥...",
"settings_import_viewkey": "导入查看密钥...",
"settings_language_note": "注意:部分文本需要重启才能更新",
"settings_lock_now": "立即锁定",

View File

@@ -2862,15 +2862,22 @@ void App::renderImportKeyDialog()
}
ImGui::Spacing();
// Optional scan-from height (viewing keys only — z_importviewingkey takes a start height, so a
// watch-only import of a recent address needn't rescan the whole chain).
if (viewMode) {
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(m::OnSurfaceMedium()), "%s", TR("import_viewkey_scan_label"));
// Optional scan-from height. z_importkey / z_importviewingkey accept a start block, so a shielded
// import of a recent key needn't rescan the whole chain. Transparent WIF (importprivkey) has no
// start-height parameter, so the field is disabled + noted once a transparent key is recognized.
{
const bool transparentKey = !viewMode && isSpend && !shielded; // recognized transparent WIF
if (transparentKey && import_key_scan_height_[0])
sodium_memzero(import_key_scan_height_, sizeof(import_key_scan_height_)); // no stale height in the disabled box
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(m::OnSurfaceMedium()), "%s", TR("import_scan_label"));
ImGui::BeginDisabled(transparentKey);
ImGui::SetNextItemWidth(140.0f * dp);
ImGui::InputText("##importscanheight", import_key_scan_height_, sizeof(import_key_scan_height_),
ImGuiInputTextFlags_CharsDecimal);
ImGui::EndDisabled();
ImGui::SameLine(0, ui::Layout::spacingSm());
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(m::OnSurfaceDisabled()), "%s", TR("import_viewkey_scan_hint"));
ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(m::OnSurfaceDisabled()), "%s",
transparentKey ? TR("import_scan_transparent") : TR("import_scan_hint"));
ImGui::Spacing();
}
@@ -2907,8 +2914,8 @@ void App::renderImportKeyDialog()
import_success_ = false;
import_status_.clear();
import_result_address_.clear();
int startHeight = 0; // viewing-key only; 0 = full rescan (also the transparent/spending default)
if (viewMode && import_key_scan_height_[0]) {
int startHeight = 0; // 0 = full rescan. Shielded imports (z_importkey/z_importviewingkey) honor
if (import_key_scan_height_[0]) { // it; importPrivateKey ignores it for transparent WIF.
startHeight = std::atoi(import_key_scan_height_);
if (startHeight < 0) startHeight = 0;
}

View File

@@ -811,7 +811,7 @@ private:
bool import_in_progress_ = false; // an import + rescan is running (disable/spinner)
std::string import_result_address_; // address imported on success (shown as a copy field)
bool import_view_mode_ = false; // dialog mode: false = spending key, true = viewing key
char import_key_scan_height_[16] = {0}; // optional rescan start height (viewing-key mode)
char import_key_scan_height_[16] = {0}; // optional rescan start height (shielded spend / viewing-key imports)
std::string backup_status_;
bool backup_success_ = false;

View File

@@ -428,7 +428,7 @@ void I18n::loadBuiltinEnglish()
strings_["settings_shield_mining"] = "Shield Mining...";
strings_["settings_merge_to_address"] = "Merge to Address...";
strings_["settings_clear_ztx"] = "Clear Z-Tx History";
strings_["settings_import_key"] = "Import Key...";
strings_["settings_import_key"] = "Import Private Key...";
strings_["settings_import_viewkey"] = "Import Viewing Key...";
strings_["settings_export_key"] = "Export Key...";
strings_["settings_export_all"] = "Export All...";
@@ -1365,9 +1365,10 @@ void I18n::loadBuiltinEnglish()
strings_["import_viewkey_note"] = "Watch-only: a viewing key reveals an address's balance and transactions but cannot spend its funds.";
strings_["import_viewkey_field"] = "Viewing key";
strings_["import_key_wrong_type"] = "This looks like a viewing key. Use \"Import Viewing Key\" instead.";
strings_["import_viewkey_wrong_type"] = "This looks like a spending key. Use \"Import Key\" instead.";
strings_["import_viewkey_scan_label"] = "Scan from block height (optional)";
strings_["import_viewkey_scan_hint"] = "0 = rescan from the start";
strings_["import_viewkey_wrong_type"] = "This looks like a spending key. Use \"Import Private Key\" instead.";
strings_["import_scan_label"] = "Scan from block height (optional)";
strings_["import_scan_hint"] = "0 = rescan from the start";
strings_["import_scan_transparent"] = "Transparent keys always rescan fully";
// --- Key Export Dialog ---
strings_["key_export_fetching"] = "Fetching key from wallet...";