Skip to content

Commit

Permalink
- add feeRate tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
molnard committed Dec 20, 2018
1 parent fa9aaee commit 1234158
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion WalletWasabi.Gui/Controls/WalletExplorer/SendTabView.xaml
Expand Up @@ -92,7 +92,7 @@
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Spacing="4">
<TextBlock Text="Confirmation Expected In:" VerticalAlignment="Center"/>
<TextBlock Foreground="YellowGreen" Text="{Binding ConfirmationExpectedText}" Width="80" VerticalAlignment="Center" />
<Button Content="{Binding FeeText}" Command="{Binding FeeRateCommand}" Padding="0" Background="{DynamicResource EditorBackgroundBrush}" BorderBrush="{DynamicResource EditorBackgroundBrush}" VerticalAlignment="Top" />
<Button Content="{Binding FeeText}" ToolTip.Tip="{Binding FeeToolTip}" Command="{Binding FeeRateCommand}" Padding="0" Background="{DynamicResource EditorBackgroundBrush}" BorderBrush="{DynamicResource EditorBackgroundBrush}" VerticalAlignment="Top" />
</StackPanel>
</StackPanel>
</StackPanel>
Expand Down
18 changes: 14 additions & 4 deletions WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
Expand Up @@ -42,6 +42,7 @@ public class SendTabViewModel : WalletActionViewModel
private string _address;
private string _label;
private string _labelToolTip;
private string _feeToolTip;
private bool _isBusy;
private string _warningMessage;
private string _successMessage;
Expand Down Expand Up @@ -257,7 +258,7 @@ orderby val
private void SetFeesAndTexts()
{
AllFeeEstimate allFeeEstimate = Global.Synchronizer?.AllFeeEstimate;

decimal exchangeRate = Global.Synchronizer.UsdExchangeRate;
var feeTarget = FeeTarget;

if (allFeeEstimate != null)
Expand Down Expand Up @@ -298,26 +299,30 @@ private void SetFeesAndTexts()
ConfirmationExpectedText = $"two weeks™";
}

SetFees(allFeeEstimate, feeTarget);
SetFees(allFeeEstimate, feeTarget, exchangeRate);

if (allFeeEstimate != null)
{
switch (FeeDisplayFormat)
{
case FeeDisplayFormat.SatoshiPerByte:
FeeText = $"(~ {SatoshiPerByteFeeRate.Satoshi} sat/byte)";
FeeToolTip = "Expected fee rate in satoshi / vbyte.";
break;

case FeeDisplayFormat.USD:
FeeText = $"(~ ${UsdFee.ToString("0.##")})";
FeeToolTip = $"Estimated total fees in USD. Exchange rate: {(int)exchangeRate} BTC/USD.";
break;

case FeeDisplayFormat.BTC:
FeeText = $"(~ {BtcFee.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:
Expand All @@ -326,7 +331,7 @@ private void SetFeesAndTexts()
}
}

private void SetFees(AllFeeEstimate allFeeEstimate, int feeTarget)
private void SetFees(AllFeeEstimate allFeeEstimate, int feeTarget, decimal exchangeRate)
{
SatoshiPerByteFeeRate = allFeeEstimate.GetFeeRate(feeTarget);

Expand Down Expand Up @@ -378,7 +383,6 @@ private void SetFees(AllFeeEstimate allFeeEstimate, int feeTarget)
}
}

decimal exchangeRate = Global.Synchronizer.UsdExchangeRate;
if (exchangeRate != 0)
{
UsdFee = BtcFee.ToUsd(exchangeRate);
Expand Down Expand Up @@ -692,6 +696,12 @@ public string SuccessMessage
set => this.RaiseAndSetIfChanged(ref _successMessage, value);
}

public string FeeToolTip
{
get => _feeToolTip;
set => this.RaiseAndSetIfChanged(ref _feeToolTip, value);
}

public ReactiveCommand BuildTransactionCommand { get; }

public ReactiveCommand MaxCommand { get; }
Expand Down

0 comments on commit 1234158

Please sign in to comment.