Move DustThreshold to Bitcoin tab
MODIFY
WalletWasabi.Fluent/ViewModels/Settings/BitcoinTabSettingsViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/BitcoinTabSettingsViewModel.cs
@@ -29,23 +29,27 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private string _localBitcoinCoreDataDir;
[AutoNotify] private bool _stopLocalBitcoinCoreOnShutdown;
[AutoNotify] private string _bitcoinP2PEndPoint;
+ [AutoNotify] private string _dustThreshold;
public BitcoinTabSettingsViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
{
this.ValidateProperty(x => x.BitcoinP2PEndPoint, ValidateBitcoinP2PEndPoint);
+ this.ValidateProperty(x => x.DustThreshold, ValidateDustThreshold);
_network = config.Network;
_startLocalBitcoinCoreOnStartup = config.StartLocalBitcoinCoreOnStartup;
_localBitcoinCoreDataDir = config.LocalBitcoinCoreDataDir;
_stopLocalBitcoinCoreOnShutdown = config.StopLocalBitcoinCoreOnShutdown;
_bitcoinP2PEndPoint = config.GetP2PEndpoint().ToString(defaultPort: -1);
+ _dustThreshold = config.DustThreshold.ToString();
this.WhenAnyValue(
x => x.Network,
x => x.StartLocalBitcoinCoreOnStartup,
x => x.StopLocalBitcoinCoreOnShutdown,
x => x.BitcoinP2PEndPoint,
- x => x.LocalBitcoinCoreDataDir)
+ x => x.LocalBitcoinCoreDataDir,
+ x => x.DustThreshold)
.ObserveOn(RxApp.TaskpoolScheduler)
.Throttle(TimeSpan.FromMilliseconds(ThrottleTime))
.Skip(1)
@@ -70,6 +74,27 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
}
}
+ private void ValidateDustThreshold(IValidationErrors errors) =>
+ ValidateDustThreshold(errors, DustThreshold, whiteSpaceOk: true);
+
+ private void ValidateDustThreshold(IValidationErrors errors, string dustThreshold, bool whiteSpaceOk)
+ {
+ if (!whiteSpaceOk || !string.IsNullOrWhiteSpace(dustThreshold))
+ {
+ if (!string.IsNullOrEmpty(dustThreshold) && dustThreshold.Contains(
+ ',',
+ StringComparison.InvariantCultureIgnoreCase))
+ {
+ errors.Add(ErrorSeverity.Error, "Use decimal point instead of comma.");
+ }
+
+ if (!decimal.TryParse(dustThreshold, out var dust) || dust < 0)
+ {
+ errors.Add(ErrorSeverity.Error, "Invalid dust threshold.");
+ }
+ }
+ }
+
protected override void EditConfigOnSave(Config config)
{
if (Network == config.Network)
@@ -82,6 +107,9 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
config.StartLocalBitcoinCoreOnStartup = StartLocalBitcoinCoreOnStartup;
config.StopLocalBitcoinCoreOnShutdown = StopLocalBitcoinCoreOnShutdown;
config.LocalBitcoinCoreDataDir = Guard.Correct(LocalBitcoinCoreDataDir);
+ config.DustThreshold = decimal.TryParse(DustThreshold, out var threshold)
+ ? Money.Coins(threshold)
+ : Config.DefaultDustThreshold;
}
else
{

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
@@ -29,11 +29,9 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private bool _customFee;
[AutoNotify] private bool _customChangeAddress;
[AutoNotify] private FeeDisplayFormat _selectedFeeDisplayFormat;
- [AutoNotify] private string _dustThreshold;
public GeneralSettingsTabViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
{
- this.ValidateProperty(x => x.DustThreshold, ValidateDustThreshold);
_darkModeEnabled = uiConfig.DarkModeEnabled;
_autoCopy = uiConfig.Autocopy;
@@ -42,13 +40,6 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
_selectedFeeDisplayFormat = Enum.IsDefined(typeof(FeeDisplayFormat), uiConfig.FeeDisplayFormat)
? (FeeDisplayFormat) uiConfig.FeeDisplayFormat
: FeeDisplayFormat.SatoshiPerByte;
- _dustThreshold = config.DustThreshold.ToString();
-
- this.WhenAnyValue(x => x.DustThreshold)
- .ObserveOn(RxApp.TaskpoolScheduler)
- .Throttle(TimeSpan.FromMilliseconds(ThrottleTime))
- .Skip(1)
- .Subscribe(_ => Save());
this.WhenAnyValue(x => x.DarkModeEnabled)
.Skip(1)
@@ -83,32 +74,8 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
public IEnumerable<FeeDisplayFormat> FeeDisplayFormats =>
Enum.GetValues(typeof(FeeDisplayFormat)).Cast<FeeDisplayFormat>();
- private void ValidateDustThreshold(IValidationErrors errors) =>
- ValidateDustThreshold(errors, DustThreshold, whiteSpaceOk: true);
-
- private void ValidateDustThreshold(IValidationErrors errors, string dustThreshold, bool whiteSpaceOk)
- {
- if (!whiteSpaceOk || !string.IsNullOrWhiteSpace(dustThreshold))
- {
- if (!string.IsNullOrEmpty(dustThreshold) && dustThreshold.Contains(
- ',',
- StringComparison.InvariantCultureIgnoreCase))
- {
- errors.Add(ErrorSeverity.Error, "Use decimal point instead of comma.");
- }
-
- if (!decimal.TryParse(dustThreshold, out var dust) || dust < 0)
- {
- errors.Add(ErrorSeverity.Error, "Invalid dust threshold.");
- }
- }
- }
-
protected override void EditConfigOnSave(Config config)
{
- config.DustThreshold = decimal.TryParse(DustThreshold, out var threshold)
- ? Money.Coins(threshold)
- : Config.DefaultDustThreshold;
}
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Views/Settings/BitcoinTabSettingsView.xaml
WalletWasabi.Fluent/Views/Settings/BitcoinTabSettingsView.xaml
<TextBox Text="{Binding BitcoinP2PEndPoint}" />
</DockPanel>
+ <StackPanel Spacing="10">
+ <TextBlock ToolTip.Tip="Coins under the dust threshold won't appear in the coin lists." Text= "Dust Threshold (BTC)" />
+ <TextBox Text="{Binding DustThreshold}" />
+ </StackPanel>
+
</StackPanel>
</UserControl>
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Views/Settings/GeneralSettingsTabView.xaml
WalletWasabi.Fluent/Views/Settings/GeneralSettingsTabView.xaml
</ComboBox>
</StackPanel>
- <StackPanel Spacing="10">
- <TextBlock ToolTip.Tip="Coins under the dust threshold won't appear in the coin lists." Text= "Dust Threshold (BTC)" />
- <TextBox Text="{Binding DustThreshold}" />
- </StackPanel>
+
</StackPanel>
</UserControl>
\ No newline at end of file

Move DustThreshold to Bitcoin tab