make auth dialogs to return boolean instead of transaction
MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/Authorization/AuthorizationDialogBase.cs
WalletWasabi.Fluent/ViewModels/Dialogs/Authorization/AuthorizationDialogBase.cs
@@ -6,7 +6,7 @@ using WalletWasabi.Fluent.ViewModels.Dialogs.Base;
namespace WalletWasabi.Fluent.ViewModels.Dialogs.Authorization
{
- public abstract class AuthorizationDialogBase : DialogViewModelBase<SmartTransaction?>
+ public abstract class AuthorizationDialogBase : DialogViewModelBase<bool>
{
protected AuthorizationDialogBase()
{

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/Authorization/HardwareWalletAuthDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/Authorization/HardwareWalletAuthDialogViewModel.cs
using System.Threading;
using System.Threading.Tasks;
using NBitcoin;
-using WalletWasabi.Blockchain.TransactionBuilding;
using WalletWasabi.CoinJoin.Client.Clients.Queuing;
+using WalletWasabi.Fluent.Model;
using WalletWasabi.Fluent.ViewModels.Dialogs.Base;
using WalletWasabi.Hwi;
using WalletWasabi.Wallets;
@@ -14,12 +14,12 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs.Authorization
public partial class HardwareWalletAuthDialogViewModel : AuthorizationDialogBase
{
private readonly Wallet _wallet;
- private readonly BuildTransactionResult _buildTransactionResult;
+ private readonly TransactionAuthorizationInfo _transactionAuthorizationInfo;
- public HardwareWalletAuthDialogViewModel(Wallet wallet, BuildTransactionResult buildTransactionResult)
+ public HardwareWalletAuthDialogViewModel(Wallet wallet, TransactionAuthorizationInfo transactionAuthorizationInfo)
{
_wallet = wallet;
- _buildTransactionResult = buildTransactionResult;
+ _transactionAuthorizationInfo = transactionAuthorizationInfo;
IsHardwareWallet = _wallet.KeyManager.IsHardwareWallet;
WalletIcon = _wallet.KeyManager.Icon;
}
@@ -34,7 +34,7 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs.Authorization
await _wallet.ChaumianClient.DequeueAllCoinsFromMixAsync(DequeueReason.TransactionBuilding);
// If it's a hardware wallet and still has a private key then it's password.
- if (_wallet.KeyManager.IsHardwareWallet && !_buildTransactionResult.Signed)
+ if (IsHardwareWallet && !_transactionAuthorizationInfo.BuildTransactionResult.Signed)
{
try
{
@@ -43,12 +43,12 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs.Authorization
var signedPsbt = await client.SignTxAsync(
_wallet.KeyManager.MasterFingerprint!.Value,
- _buildTransactionResult.Psbt,
+ _transactionAuthorizationInfo.BuildTransactionResult.Psbt,
cts.Token);
- var signedTransaction = signedPsbt.ExtractSmartTransaction(_buildTransactionResult.Transaction);
+ _transactionAuthorizationInfo.Transaction = signedPsbt.ExtractSmartTransaction(_transactionAuthorizationInfo.Transaction);
- Close(DialogResultKind.Normal, signedTransaction);
+ Close(DialogResultKind.Normal, true);
}
catch (Exception ex)
{

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/Authorization/PasswordAuthDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/Authorization/PasswordAuthDialogViewModel.cs
@@ -10,13 +10,11 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs.Authorization
public partial class PasswordAuthDialogViewModel : AuthorizationDialogBase
{
private readonly Wallet _wallet;
- private readonly SmartTransaction _transaction;
[AutoNotify] private string _password;
- public PasswordAuthDialogViewModel(Wallet wallet, SmartTransaction transaction)
+ public PasswordAuthDialogViewModel(Wallet wallet)
{
_wallet = wallet;
- _transaction = transaction;
_password = "";
}
@@ -29,15 +27,12 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs.Authorization
{
var passwordValid = await Task.Run(() => PasswordHelper.TryPassword(_wallet.KeyManager, Password, out _));
- if (passwordValid)
- {
- Close(DialogResultKind.Normal, _transaction);
- }
- else
+ if (!passwordValid)
{
await ShowErrorAsync("Password", "Password was incorrect.", "");
- Close();
}
+
+ Close(DialogResultKind.Normal, passwordValid);
}
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -4,6 +4,7 @@ using ReactiveUI;
using WalletWasabi.Blockchain.TransactionBroadcasting;
using WalletWasabi.Blockchain.TransactionBuilding;
using WalletWasabi.Fluent.Helpers;
+using WalletWasabi.Fluent.Model;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Wallets;
@@ -51,13 +52,13 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
NextCommand = ReactiveCommand.CreateFromTask(async () =>
{
- var authDialog = AuthorizationHelpers.GetAuthorizationDialog(wallet, buildTransactionResult);
-
+ var transactionAuthorizationInfo = new TransactionAuthorizationInfo(buildTransactionResult);
+ var authDialog = AuthorizationHelpers.GetAuthorizationDialog(wallet, transactionAuthorizationInfo);
var authDialogResult = await NavigateDialog(authDialog, NavigationTarget.DialogScreen);
- if (authDialogResult.Result is { } signedTransaction)
+ if (authDialogResult.Result)
{
- await broadcaster.SendTransactionAsync(signedTransaction);
+ await broadcaster.SendTransactionAsync(transactionAuthorizationInfo.Transaction);
Navigate().Clear();
}
});

make auth dialogs to return boolean instead of transaction