separate transaction building logic in PrivacyControlViewModel
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyControlViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyControlViewModel.cs
@@ -8,6 +8,7 @@ using DynamicData.Aggregation;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Blockchain.TransactionBroadcasting;
+using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Exceptions;
using WalletWasabi.Fluent.Helpers;
using WalletWasabi.Fluent.Model;
@@ -74,19 +75,23 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
{
if (transactionInfo.PayJoinClient is { })
{
- try
+ await BuildPayJoinTransactionAsync(wallet, transactionInfo, coins, broadcaster);
+ }
+ else
{
- var transactionResult = await Task.Run(() => TransactionHelpers.BuildTransaction(_wallet, transactionInfo.Address, transactionInfo.Amount, transactionInfo.Labels, transactionInfo.FeeRate, coins, subtractFee: false, transactionInfo.PayJoinClient));
- Navigate().To(new TransactionPreviewViewModel(wallet, transactionInfo, broadcaster, transactionResult));
- return;
+ await BuildNormalTransactionAsync(wallet, transactionInfo, coins, broadcaster);
}
- catch (InsufficientBalanceException)
+ }
+ catch (Exception ex)
{
- await ShowErrorAsync("Transaction Building", "There are not enough funds selected to cover the transaction fee.", "Wasabi was unable to create your transaction.");
- return;
+ Logger.LogError(ex);
+ await ShowErrorAsync("Transaction Building", ex.ToUserFriendlyString(), "Wasabi was unable to create your transaction.");
+ Navigate().BackTo<SendViewModel>();
}
}
+ private async Task BuildNormalTransactionAsync(Wallet wallet, TransactionInfo transactionInfo, SmartCoin[] coins, TransactionBroadcaster broadcaster)
+ {
try
{
var transactionResult = await Task.Run(() => TransactionHelpers.BuildTransaction(_wallet, transactionInfo.Address, transactionInfo.Amount, transactionInfo.Labels, transactionInfo.FeeRate, coins, subtractFee: false));
@@ -108,11 +113,17 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
}
}
}
- catch (Exception ex)
+
+ private async Task BuildPayJoinTransactionAsync(Wallet wallet, TransactionInfo transactionInfo, SmartCoin[] coins, TransactionBroadcaster broadcaster)
{
- Logger.LogError(ex);
- await ShowErrorAsync("Transaction Building", ex.ToUserFriendlyString(), "Wasabi was unable to create your transaction.");
- Navigate().BackTo<SendViewModel>();
+ try
+ {
+ var transactionResult = await Task.Run(() => TransactionHelpers.BuildTransaction(_wallet, transactionInfo.Address, transactionInfo.Amount, transactionInfo.Labels, transactionInfo.FeeRate, coins, subtractFee: false));
+ Navigate().To(new TransactionPreviewViewModel(wallet, transactionInfo, broadcaster, transactionResult));
+ }
+ catch (InsufficientBalanceException)
+ {
+ await ShowErrorAsync("Transaction Building", "There are not enough funds selected to cover the transaction fee.", "Wasabi was unable to create your transaction.");
}
}

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
Text="via Bitcoin address"
Content="{Binding AddressText, FallbackValue=btc029382398fkj34f98df239823}" />
<Separator />
- <c:PreviewItem Icon="{StaticResource timer_regular}"
+ <c:PreviewItem Icon=""
Text="PayJoin will be used to protect your privacy"
Content="{Binding PayJoinUrl, FallbackValue=https://testnet.demo.btcpayserver.org/BTC/pj}"
IsVisible="{Binding IsPayJoin}" />

separate transaction building logic in PrivacyControlViewModel