get the private coins silently if possible
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyControlViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyControlViewModel.cs
@@ -2,9 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-using System.Reactive;
using System.Reactive.Disposables;
-using System.Threading.Tasks;
using DynamicData;
using DynamicData.Aggregation;
using NBitcoin;
@@ -12,7 +10,6 @@ using ReactiveUI;
using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Fluent.Helpers;
using WalletWasabi.Fluent.ViewModels.Dialogs.Base;
-using WalletWasabi.Logging;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
@@ -21,6 +18,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
public partial class PrivacyControlViewModel : DialogViewModelBase<IEnumerable<SmartCoin>>
{
private readonly Wallet _wallet;
+ private readonly TransactionInfo _transactionInfo;
+ private readonly bool _isSilent;
private readonly SourceList<PocketViewModel> _pocketSource;
private readonly ReadOnlyObservableCollection<PocketViewModel> _pockets;
private readonly IObservableList<PocketViewModel> _selectedPockets;
@@ -29,9 +28,11 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
[AutoNotify] private bool _enoughSelected;
[AutoNotify] private bool _isWarningOpen;
- public PrivacyControlViewModel(Wallet wallet, TransactionInfo transactionInfo)
+ public PrivacyControlViewModel(Wallet wallet, TransactionInfo transactionInfo, bool isSilent)
{
_wallet = wallet;
+ _transactionInfo = transactionInfo;
+ _isSilent = isSilent;
_pocketSource = new SourceList<PocketViewModel>();
@@ -93,6 +94,13 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
Complete();
}
+ else if (_isSilent &&
+ _pocketSource.Items.FirstOrDefault(x => x.Labels == CoinPocketHelper.PrivateFundsText) is { } privatePocket &&
+ privatePocket.Coins.TotalAmount() >= _transactionInfo.Amount)
+ {
+ privatePocket.IsSelected = true;
+ Complete();
+ }
}
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -115,30 +115,18 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
private async Task InitialiseTransactionAsync()
{
var transactionInfo = _info;
- var targetAnonymitySet = _wallet.ServiceConfiguration.GetMixUntilAnonymitySetValue();
- var mixedCoins = _wallet.Coins.Where(x => x.HdPubKey.AnonymitySet >= targetAnonymitySet).ToList();
- var totalMixedCoinsAmount = Money.FromUnit(mixedCoins.Sum(coin => coin.Amount), MoneyUnit.Satoshi);
- transactionInfo.Coins = mixedCoins;
+ var privacyControlDialogResult = await NavigateDialogAsync(new PrivacyControlViewModel(_wallet, transactionInfo, isSilent: true));
+ if (privacyControlDialogResult.Result is { } coins)
+ {
+ transactionInfo.Coins = coins;
+ }
var feeDialogResult = await NavigateDialogAsync(new SendFeeViewModel(_wallet, transactionInfo, true));
-
if (feeDialogResult.Kind == DialogResultKind.Normal)
{
transactionInfo.FeeRate = feeDialogResult.Result;
}
-
- if (transactionInfo.Amount > totalMixedCoinsAmount)
- {
- var privacyControlDialogResult =
- await NavigateDialogAsync(new PrivacyControlViewModel(_wallet, transactionInfo));
-
- if (privacyControlDialogResult.Kind == DialogResultKind.Normal &&
- privacyControlDialogResult.Result is { })
- {
- transactionInfo.Coins = privacyControlDialogResult.Result;
- }
- }
}
private async Task<BuildTransactionResult?> BuildTransactionAsync()
@@ -187,7 +175,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
if (wallet.Coins.TotalAmount() > transactionInfo.Amount)
{
- var privacyControlDialogResult = await NavigateDialogAsync(new PrivacyControlViewModel(wallet, transactionInfo));
+ var privacyControlDialogResult = await NavigateDialogAsync(new PrivacyControlViewModel(wallet, transactionInfo, isSilent: false));
if (privacyControlDialogResult.Kind == DialogResultKind.Normal && privacyControlDialogResult.Result is { })
{
@@ -220,7 +208,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
return txn;
}
- var privacyControlDialogResult = await NavigateDialogAsync(new PrivacyControlViewModel(wallet, transactionInfo));
+ var privacyControlDialogResult = await NavigateDialogAsync(new PrivacyControlViewModel(wallet, transactionInfo, isSilent: false));
if (privacyControlDialogResult.Kind == DialogResultKind.Normal && privacyControlDialogResult.Result is { })
{
transactionInfo.Coins = privacyControlDialogResult.Result;

get the private coins silently if possible