hardware wallet auth dialog
MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/PasswordAuthDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/PasswordAuthDialogViewModel.cs
using System.Reactive.Linq;
using System.Threading.Tasks;
using ReactiveUI;
+using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.Fluent.Validation;
using WalletWasabi.Models;
using WalletWasabi.Userfacing;
@@ -9,11 +10,11 @@ using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
[NavigationMetaData(Title = "Enter your password")]
- public partial class PasswordAuthDialogViewModel : DialogViewModelBase<bool>
+ public partial class PasswordAuthDialogViewModel : DialogViewModelBase<SmartTransaction?>
{
[AutoNotify] private string _password;
- public PasswordAuthDialogViewModel(Wallet wallet)
+ public PasswordAuthDialogViewModel(Wallet wallet, SmartTransaction transaction)
{
_password = "";
@@ -25,12 +26,15 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
var passwordValid = await Task.Run(() => PasswordHelper.TryPassword(wallet.KeyManager, Password, out _));
- if (!passwordValid)
+ if (passwordValid)
+ {
+ Close(DialogResultKind.Normal, transaction);
+ }
+ else
{
await ShowErrorAsync("Password", "Password was incorrect.", "");
+ Close();
}
-
- Close(DialogResultKind.Normal, passwordValid);
}
,canExecute);

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -61,76 +61,15 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
NextCommand = ReactiveCommand.CreateFromTask(async () =>
{
- var transaction = buildTransactionResult;
+ var authDialog = AuthorisationHelpers.GetAuthorisationDialog(wallet, buildTransactionResult);
- var authDialog = AuthorisationHelpers.GetAuthorisationDialog(wallet, ref transaction);
- var authResult = await NavigateDialog(authDialog, NavigationTarget.DialogScreen);
+ var authDialogResult = await NavigateDialog(authDialog, NavigationTarget.DialogScreen);
- if (authResult.Result)
+ if (authDialogResult.Result is { } signedTransaction)
{
- await broadcaster.SendTransactionAsync(transaction.Transaction);
+ await broadcaster.SendTransactionAsync(signedTransaction);
Navigate().Clear();
}
- // else
- // {
- // await ShowErrorAsync(authErrorMessage, "Please try again.", "");
- // }
-
- // IsBusy = true;
- //
- // var passwordValid = await Task.Run(
- // () => PasswordHelper.TryPassword(
- // wallet.KeyManager,
- // dialogResult.Result,
- // out string? compatibilityPasswordUsed));
- //
- // if (passwordValid)
- // {
- // // Dequeue any coin-joining coins.
- // await wallet.ChaumianClient.DequeueAllCoinsFromMixAsync(DequeueReason.TransactionBuilding);
- //
- // var signedTransaction2 = buildTransactionResult.Transaction;
- //
- // // If it's a hardware wallet and still has a private key then it's password.
- // if (wallet.KeyManager.IsHardwareWallet && !buildTransactionResult.Signed)
- // {
- // try
- // {
- // var client = new HwiClient(wallet.Network);
- //
- // using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
- // PSBT? signedPsbt = null;
- // try
- // {
- // signedPsbt = await client.SignTxAsync(
- // wallet.KeyManager.MasterFingerprint!.Value,
- // buildTransactionResult.Psbt,
- // cts.Token);
- // }
- // catch (HwiException ex) when (ex.ErrorCode is not HwiErrorCode.ActionCanceled)
- // {
- // await PinPadViewModel.UnlockAsync();
- //
- // signedPsbt = await client.SignTxAsync(
- // wallet.KeyManager.MasterFingerprint!.Value,
- // buildTransactionResult.Psbt,
- // cts.Token);
- // }
- //
- // signedTransaction2 = signedPsbt.ExtractSmartTransaction(buildTransactionResult.Transaction);
- // }
- // catch (Exception _)
- // {
- // // probably throw something here?
- // }
- // }
- //
- // await broadcaster.SendTransactionAsync(signedTransaction);
- //
- // Navigate().Clear();
- //
- // IsBusy = false;
- // }
});
}

hardware wallet auth dialog