remember subtract fee preference
MODIFY
WalletWasabi.Fluent/Helpers/TransactionHelpers.cs
WalletWasabi.Fluent/Helpers/TransactionHelpers.cs
@@ -42,9 +42,9 @@ namespace WalletWasabi.Fluent.Helpers
return txRes;
}
- public static BuildTransactionResult BuildTransaction(Wallet wallet, TransactionInfo transactionInfo, bool subtractFee = false, bool isPayJoin = false)
+ public static BuildTransactionResult BuildTransaction(Wallet wallet, TransactionInfo transactionInfo, bool isPayJoin = false)
{
- if (isPayJoin && subtractFee)
+ if (isPayJoin && transactionInfo.SubtractFee)
{
throw new InvalidOperationException("Not possible to subtract the fee.");
}
@@ -56,18 +56,18 @@ namespace WalletWasabi.Fluent.Helpers
transactionInfo.Labels,
transactionInfo.FeeRate,
transactionInfo.Coins,
- subtractFee,
+ transactionInfo.SubtractFee,
isPayJoin ? transactionInfo.PayJoinClient : null);
}
- public static bool TryBuildTransaction(Wallet wallet, TransactionInfo transactionInfo, [NotNullWhen(true)]out BuildTransactionResult? transaction, bool subtractFee = false, bool isPayJoin = false)
+ public static bool TryBuildTransaction(Wallet wallet, TransactionInfo transactionInfo, [NotNullWhen(true)]out BuildTransactionResult? transaction, bool isPayJoin = false)
{
transaction = null;
try
{
- transaction = BuildTransaction(wallet, transactionInfo, subtractFee, isPayJoin);
+ transaction = BuildTransaction(wallet, transactionInfo, isPayJoin);
}
catch (Exception)
{

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionInfo.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionInfo.cs
@@ -40,5 +40,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
public bool IsPayJoin => PayJoinClient is { };
public bool IsPrivatePocketUsed => Coins.All(x => x.HdPubKey.AnonymitySet >= _privateCoinTreshold);
+
+ public bool SubtractFee { get; set; }
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -170,7 +170,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
if (result.Result)
{
- return await Task.Run(() => TransactionHelpers.BuildTransaction(wallet, transactionInfo, subtractFee: true));
+ transactionInfo.SubtractFee = true;
+ return await Task.Run(() => TransactionHelpers.BuildTransaction(wallet, transactionInfo));
}
if (wallet.Coins.TotalAmount() > transactionInfo.Amount)
@@ -326,7 +327,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
{
try
{
- var payJoinTransaction = await Task.Run(() => TransactionHelpers.BuildTransaction(_wallet, transactionInfo, subtractFee: false, isPayJoin: true));
+ var payJoinTransaction = await Task.Run(() => TransactionHelpers.BuildTransaction(_wallet, transactionInfo, isPayJoin: true));
return payJoinTransaction.Transaction;
}
catch (Exception ex)

remember subtract fee preference