Fix estimated fee stuff.
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -135,12 +135,18 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
SetAmountWatermark(Money.Zero);
}
+
+ SetFees();
});
AmountKeyUpCommand = ReactiveCommand.Create((KeyEventArgs key) =>
{
var amount = AmountText;
- if (!IsMax)
+ if (IsMax)
+ {
+ SetAmountIfMax();
+ }
+ else
{
// Correct amount
Regex digitsOnly = new Regex(@"[^\d,.]");
@@ -167,8 +173,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
AmountText = betterAmount;
}
}
-
- SetFeesAndTexts();
});
this.WhenAnyValue(x => x.IsBusy)
@@ -509,6 +513,13 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
private void SetFeesAndTexts()
+ {
+ SetFees();
+
+ SetAmountIfMax();
+ }
+
+ private void SetFees()
{
AllFeeEstimate allFeeEstimate = Global.FeeProviders?.AllFeeEstimate;
@@ -558,59 +569,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
- SetFees(allFeeEstimate, feeTarget);
- if (FeeRate is null)
- {
- FeeText = "";
- FeeToolTip = "";
- }
- else
- {
- switch (FeeDisplayFormat)
- {
- case FeeDisplayFormat.SatoshiPerByte:
- FeeText = $"(~ {FeeRate.SatoshiPerByte} sat/vByte)";
- FeeToolTip = "Expected fee rate in satoshi/vByte.";
- break;
-
- case FeeDisplayFormat.USD:
- FeeText = $"(~ ${UsdFee.ToString("0.##")})";
- FeeToolTip = $"Estimated total fees in USD. Exchange Rate: {(long)UsdExchangeRate} BTC/USD.";
- break;
-
- case FeeDisplayFormat.BTC:
- FeeText = $"(~ {EstimatedBtcFee.ToString(false, false)} BTC)";
- FeeToolTip = "Estimated total fees in BTC.";
- break;
-
- case FeeDisplayFormat.Percentage:
- FeeText = $"(~ {FeePercentage.ToString("0.#")} %)";
- FeeToolTip = "Expected percentage of fees against the amount to be sent.";
- break;
-
- default:
- throw new NotSupportedException("This is impossible.");
- }
- }
- }
-
- SetAmountIfMax();
- }
-
- private void SetAmountIfMax()
- {
- if (IsMax)
- {
- AmountText = AllSelectedAmount == Money.Zero
- ? FeePercentage >= 100
- ? "Too high fee"
- : "No Coins Selected"
- : $"~ {AllSelectedAmount.ToString(false, true)}";
- }
- }
-
- private void SetFees(AllFeeEstimate allFeeEstimate, int feeTarget)
- {
if (IsSliderFeeUsed)
{
FeeRate = allFeeEstimate.GetFeeRate(feeTarget);
@@ -684,6 +642,52 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
AllSelectedAmount = Math.Max(Money.Zero, all - EstimatedBtcFee);
+ if (FeeRate is null)
+ {
+ FeeText = "";
+ FeeToolTip = "";
+ }
+ else
+ {
+ switch (FeeDisplayFormat)
+ {
+ case FeeDisplayFormat.SatoshiPerByte:
+ FeeText = $"(~ {FeeRate.SatoshiPerByte} sat/vByte)";
+ FeeToolTip = "Expected fee rate in satoshi/vByte.";
+ break;
+
+ case FeeDisplayFormat.USD:
+ FeeText = $"(~ ${UsdFee.ToString("0.##")})";
+ FeeToolTip = $"Estimated total fees in USD. Exchange Rate: {(long)UsdExchangeRate} BTC/USD.";
+ break;
+
+ case FeeDisplayFormat.BTC:
+ FeeText = $"(~ {EstimatedBtcFee.ToString(false, false)} BTC)";
+ FeeToolTip = "Estimated total fees in BTC.";
+ break;
+
+ case FeeDisplayFormat.Percentage:
+ FeeText = $"(~ {FeePercentage.ToString("0.#")} %)";
+ FeeToolTip = "Expected percentage of fees against the amount to be sent.";
+ break;
+
+ default:
+ throw new NotSupportedException("This is impossible.");
+ }
+ }
+ }
+ }
+
+ private void SetAmountIfMax()
+ {
+ if (IsMax)
+ {
+ AmountText = AllSelectedAmount == Money.Zero
+ ? FeePercentage >= 100
+ ? "Too high fee"
+ : "No Coins Selected"
+ : $"~ {AllSelectedAmount.ToString(false, true)}";
+ }
}
private void SetFeeTargetLimits()

Fix estimated fee stuff.