diff --git a/src/App/Localization/Loc.cs b/src/App/Localization/Loc.cs index db10f49..ad08441 100644 --- a/src/App/Localization/Loc.cs +++ b/src/App/Localization/Loc.cs @@ -275,6 +275,10 @@ public sealed class Loc ["send.sect.recipient"] = ["Destinatario", "Recipient", "Destinatario", "Destinataire", "Destinatário", "Empfänger", "收款人"], ["send.sect.amount"] = ["Importo e commissione", "Amount & fee", "Importe y comisión", "Montant et frais", "Valor e taxa", "Betrag & Gebühr", "金额与手续费"], ["send.summary"] = ["Riepilogo", "Summary", "Resumen", "Résumé", "Resumo", "Zusammenfassung", "摘要"], + ["send.psbt.label"] = ["PSBT non firmata (base64) — da firmare altrove", "Unsigned PSBT (base64) — sign it elsewhere", "PSBT sin firmar (base64) — fírmala en otro lugar", "PSBT non signée (base64) — à signer ailleurs", "PSBT não assinada (base64) — assine em outro lugar", "Unsignierte PSBT (base64) — anderswo signieren", "未签名 PSBT(base64)— 请在别处签名"], + ["send.psbt.copy"] = ["Copia PSBT", "Copy PSBT", "Copiar PSBT", "Copier la PSBT", "Copiar PSBT", "PSBT kopieren", "复制 PSBT"], + ["send.watchonly.hint"] = ["Wallet in sola lettura: non può firmare. Esporta la PSBT e firmala con un wallet che possiede le chiavi.", "Watch-only wallet: it cannot sign. Export the PSBT and sign it with a wallet that holds the keys.", "Wallet de solo lectura: no puede firmar. Exporta la PSBT y fírmala con un wallet que tenga las claves.", "Wallet en lecture seule : il ne peut pas signer. Exportez la PSBT et signez-la avec un wallet possédant les clés.", "Carteira somente leitura: não pode assinar. Exporte a PSBT e assine-a com uma carteira que tenha as chaves.", "Nur-Lese-Wallet: kann nicht signieren. Exportieren Sie die PSBT und signieren Sie sie mit einem Wallet, das die Schlüssel besitzt.", "仅观察钱包:无法签名。请导出 PSBT 并用持有密钥的钱包签名。"], + ["psbt.copied"] = ["PSBT copiata negli appunti", "PSBT copied to clipboard", "PSBT copiada al portapapeles", "PSBT copiée dans le presse-papiers", "PSBT copiada para a área de transferência", "PSBT in die Zwischenablage kopiert", "PSBT 已复制到剪贴板"], ["receive.your.address"] = ["Il tuo indirizzo", "Your address", "Tu dirección", "Votre adresse", "Seu endereço", "Deine Adresse", "您的地址"], // Wallet info overlay diff --git a/src/App/ViewModels/MainWindowViewModel.Send.cs b/src/App/ViewModels/MainWindowViewModel.Send.cs index 22dc582..40c7610 100644 --- a/src/App/ViewModels/MainWindowViewModel.Send.cs +++ b/src/App/ViewModels/MainWindowViewModel.Send.cs @@ -31,6 +31,14 @@ public partial class MainWindowViewModel [ObservableProperty] private bool hasPendingSend; + [ObservableProperty] + private string pendingPsbtBase64 = ""; + + /// True when the open account cannot sign — Send only prepares an unsigned PSBT to export. + public bool IsWatchOnlyAccount => _account?.IsWatchOnly ?? false; + + public void NotifyPsbtCopied() => StatusMessage = Loc.Tr("psbt.copied"); + [RelayCommand] private async Task ScanQr() { @@ -81,11 +89,13 @@ public partial class MainWindowViewModel $"({_pendingSend.Transaction.GetVirtualSize()} vB)" + (_pendingSend.Signed ? "" : Loc.Tr("msg.unsigned.watchonly")); HasPendingSend = _pendingSend.Signed; + PendingPsbtBase64 = _pendingSend.Signed ? "" : _pendingSend.Psbt.ToBase64(); } catch (Exception ex) { _pendingSend = null; HasPendingSend = false; + PendingPsbtBase64 = ""; SendPreview = $"{Loc.Tr("msg.error")}: {DescribeError(ex)}"; } await Task.CompletedTask; @@ -103,6 +113,7 @@ public partial class MainWindowViewModel SendTo = SendAmount = ""; _pendingSend = null; HasPendingSend = false; + PendingPsbtBase64 = ""; await ConnectAndSync(); } catch (Exception ex) diff --git a/src/App/ViewModels/MainWindowViewModel.cs b/src/App/ViewModels/MainWindowViewModel.cs index 4665ff1..b538981 100644 --- a/src/App/ViewModels/MainWindowViewModel.cs +++ b/src/App/ViewModels/MainWindowViewModel.cs @@ -201,6 +201,8 @@ public partial class MainWindowViewModel : ViewModelBase _lastTransactions = null; _pendingSend = null; HasPendingSend = false; + PendingPsbtBase64 = ""; + OnPropertyChanged(nameof(IsWatchOnlyAccount)); History.Clear(); Contacts.Clear(); SelectedContactInList = null; diff --git a/src/App/Views/MainView.axaml b/src/App/Views/MainView.axaml index 596faee..bdd815b 100644 --- a/src/App/Views/MainView.axaml +++ b/src/App/Views/MainView.axaml @@ -445,7 +445,7 @@ + RowDefinitions="Auto,Auto,Auto,Auto" RowSpacing="14"> @@ -516,11 +516,29 @@ + + + + +