move IsFixedAmount into TransactionInfo too
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletCoins/WalletCoinsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletCoins/WalletCoinsViewModel.cs
@@ -129,10 +129,11 @@ public partial class WalletCoinsViewModel : RoutableViewModel
Amount = selectedSmartCoins.Sum(x => x.Amount),
SubtractFee = true,
UserLabels = label,
- IsSelectedCoinModificationEnabled = false
+ IsSelectedCoinModificationEnabled = false,
+ IsFixedAmount = true,
};
- Navigate().To(new TransactionPreviewViewModel(wallet, info, true));
+ Navigate().To(new TransactionPreviewViewModel(wallet, info));
}
private FlatTreeDataGridSource<WalletCoinViewModel> CreateGridSource(IEnumerable<WalletCoinViewModel> coins)

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionsFlyoutViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionsFlyoutViewModel.cs
@@ -45,7 +45,7 @@ public partial class PrivacySuggestionsFlyoutViewModel : ViewModelBase
public ObservableCollection<SuggestionViewModel> Suggestions { get; }
/// <remarks>Method supports being called multiple times. In that case the last call cancels the previous one.</remarks>
- public async Task BuildPrivacySuggestionsAsync(Wallet wallet, TransactionInfo info, BuildTransactionResult transaction, bool isFixedAmount, CancellationToken cancellationToken)
+ public async Task BuildPrivacySuggestionsAsync(Wallet wallet, TransactionInfo info, BuildTransactionResult transaction, CancellationToken cancellationToken)
{
using CancellationTokenSource singleRunCts = new();
@@ -70,7 +70,7 @@ public partial class PrivacySuggestionsFlyoutViewModel : ViewModelBase
var hasChange = transaction.InnerWalletOutputs.Any(x => x.ScriptPubKey != info.Destination.ScriptPubKey);
- if (hasChange && !isFixedAmount && !info.IsPayJoin)
+ if (hasChange && !info.IsFixedAmount && !info.IsPayJoin)
{
// Exchange rate can change substantially during computation itself.
// Reporting up-to-date exchange rates would just confuse users.

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -115,10 +115,11 @@ public partial class SendViewModel : RoutableViewModel
{
Amount = new Money(AmountBtc, MoneyUnit.BTC),
UserLabels = label,
- PayJoinClient = PayJoinEndPoint is { } ? GetPayjoinClient(PayJoinEndPoint) : null
+ PayJoinClient = PayJoinEndPoint is { } ? GetPayjoinClient(PayJoinEndPoint) : null,
+ IsFixedAmount = _isFixedAmount
};
- Navigate().To(new TransactionPreviewViewModel(wallet, transactionInfo, _isFixedAmount));
+ Navigate().To(new TransactionPreviewViewModel(wallet, transactionInfo));
}, nextCommandCanExecute);
this.WhenAnyValue(x => x.ConversionReversed)

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionInfo.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionInfo.cs
@@ -59,6 +59,8 @@ public partial class TransactionInfo
public bool IsSelectedCoinModificationEnabled { get; set; } = true;
+ public bool IsFixedAmount { get; init; }
+
private void OnFeeChanged()
{
ChangelessCoins = Enumerable.Empty<SmartCoin>();
@@ -87,7 +89,8 @@ public partial class TransactionInfo
IsCustomFeeUsed = IsCustomFeeUsed,
SubtractFee = SubtractFee,
IsOtherPocketSelectionPossible = IsOtherPocketSelectionPossible,
- IsSelectedCoinModificationEnabled = IsSelectedCoinModificationEnabled
+ IsSelectedCoinModificationEnabled = IsSelectedCoinModificationEnabled,
+ IsFixedAmount = IsFixedAmount
};
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -27,7 +27,6 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send;
public partial class TransactionPreviewViewModel : RoutableViewModel
{
private readonly Stack<(BuildTransactionResult, TransactionInfo)> _undoHistory;
- private readonly bool _isFixedAmount;
private readonly Wallet _wallet;
private TransactionInfo _info;
private TransactionInfo _currentTransactionInfo;
@@ -38,13 +37,12 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
[AutoNotify] private TransactionSummaryViewModel? _displayedTransactionSummary;
[AutoNotify] private bool _canUndo;
- public TransactionPreviewViewModel(Wallet wallet, TransactionInfo info, bool isFixedAmount)
+ public TransactionPreviewViewModel(Wallet wallet, TransactionInfo info)
{
_undoHistory = new();
_wallet = wallet;
_info = info;
_currentTransactionInfo = info.Clone();
- _isFixedAmount = isFixedAmount;
_cancellationTokenSource = new CancellationTokenSource();
PrivacySuggestions = new PrivacySuggestionsFlyoutViewModel();
@@ -98,7 +96,7 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
.WhereNotNull()
.Throttle(TimeSpan.FromMilliseconds(100))
.ObserveOn(RxApp.MainThreadScheduler)
- .DoAsync(async transaction => await PrivacySuggestions.BuildPrivacySuggestionsAsync(_wallet, _info, transaction, _isFixedAmount, _cancellationTokenSource.Token))
+ .DoAsync(async transaction => await PrivacySuggestions.BuildPrivacySuggestionsAsync(_wallet, _info, transaction, _cancellationTokenSource.Token))
.Subscribe();
SetupCancel(enableCancel: true, enableCancelOnEscape: true, enableCancelOnPressed: false);
@@ -352,7 +350,7 @@ public partial class TransactionPreviewViewModel : RoutableViewModel
if (totalBalanceUsed)
{
- if (selectedAmount == _info.Amount && !(_isFixedAmount || _info.IsPayJoin))
+ if (selectedAmount == _info.Amount && !(_info.IsFixedAmount || _info.IsPayJoin))
{
_info.SubtractFee = true;
return true;

move IsFixedAmount into TransactionInfo too