Add more parameters to the settings page
MODIFY
WalletWasabi.Gui/Tabs/SettingsView.xaml
WalletWasabi.Gui/Tabs/SettingsView.xaml
</StackPanel>
</controls:GroupBox>
+ <controls:GroupBox Title="Anonymity" TextBlock.FontSize="16" Padding="10" Margin="0 5 10 5">
+ <StackPanel Spacing="10" Orientation="Vertical">
+ <StackPanel Margin="0 10">
+ <TextBlock>Some</TextBlock>
+ <TextBox Text="{Binding SomePrivacyLevel}"/>
+ </StackPanel>
+
+ <StackPanel Margin="0 10">
+ <TextBlock>Fine</TextBlock>
+ <TextBox Text="{Binding FinePrivacyLevel}"/>
+ </StackPanel>
+
+ <StackPanel Margin="0 10">
+ <TextBlock>Strong</TextBlock>
+ <TextBox Text="{Binding StrongPrivacyLevel}"/>
+ </StackPanel>
+ </StackPanel>
+ </controls:GroupBox>
+
+ <controls:GroupBox Title="Other settings" TextBlock.FontSize="16" Padding="10" Margin="0 5 10 5">
+ <StackPanel Spacing="10" Orientation="Vertical">
+ <StackPanel Margin="0 10">
+ <TextBlock>Dust Threshold</TextBlock>
+ <TextBox Text="{Binding DustThreshold}"/>
+ </StackPanel>
+ </StackPanel>
+ </controls:GroupBox>
+
<Button Content="Open Config File" Command="{Binding OpenConfigFileCommand}" />
</StackPanel>
</Grid>

MODIFY
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
using Avalonia.Threading;
+using NBitcoin;
using ReactiveUI;
using System;
using System.Collections.Generic;
@@ -7,6 +8,8 @@ using System.Net;
using System.Net.Sockets;
using System.Reactive;
using System.Reactive.Disposables;
+using System.Reactive.Linq;
+using System.Text.RegularExpressions;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Gui.ViewModels.Validation;
@@ -25,6 +28,11 @@ namespace WalletWasabi.Gui.Tabs
private string _useTorText;
private bool _isModified;
+ private string _somePrivacyLevel;
+ private string _finePrivacyLevel;
+ private string _strongPrivacyLevel;
+ private string _dustThreshold;
+
public ReactiveCommand<Unit, Unit> OpenConfigFileCommand { get; }
public ReactiveCommand<Unit, Unit> LurkingWifeModeCommand { get; }
@@ -33,7 +41,14 @@ namespace WalletWasabi.Gui.Tabs
var config = new Config(Global.Config.FilePath);
Autocopy = Global.UiConfig?.Autocopy is true;
- this.WhenAnyValue(x => x.Network, x => x.TorHost, x => x.TorPort, x => x.UseTor).Subscribe(x => Save());
+ this.WhenAnyValue(x => x.Network,
+ x => x.TorHost, x => x.TorPort, x => x.UseTor)
+ .Subscribe(x => Save());
+
+ this.WhenAnyValue(
+ x => x.SomePrivacyLevel, x => x.FinePrivacyLevel, x => x.StrongPrivacyLevel,
+ x=> x.DustThreshold)
+ .Subscribe(x => Save());
this.WhenAnyValue(x => x.Autocopy).Subscribe(x =>
{
@@ -60,6 +75,12 @@ namespace WalletWasabi.Gui.Tabs
TorPort = config.TorSocks5Port.ToString();
UseTor = config.UseTor.Value;
+ SomePrivacyLevel = config.PrivacyLevelSome.ToString();
+ FinePrivacyLevel = config.PrivacyLevelFine.ToString();
+ StrongPrivacyLevel = config.PrivacyLevelStrong.ToString();
+
+ DustThreshold = config.DustThreshold.ToString();
+
IsModified = await Global.Config.CheckFileChangeAsync();
});
@@ -155,6 +176,35 @@ namespace WalletWasabi.Gui.Tabs
set => this.RaiseAndSetIfChanged(ref _useTorText, value);
}
+ [ValidateMethod(nameof(ValidateSomePrivacyLevel))]
+ public string SomePrivacyLevel
+ {
+ get => _somePrivacyLevel;
+ set => this.RaiseAndSetIfChanged(ref _somePrivacyLevel, value);
+ }
+
+ [ValidateMethod(nameof(ValidateFinePrivacyLevel))]
+ public string FinePrivacyLevel
+ {
+ get => _finePrivacyLevel;
+ set => this.RaiseAndSetIfChanged(ref _finePrivacyLevel, value);
+ }
+
+ [ValidateMethod(nameof(ValidateStrongPrivacyLevel))]
+ public string StrongPrivacyLevel
+ {
+ get => _strongPrivacyLevel;
+ set => this.RaiseAndSetIfChanged(ref _strongPrivacyLevel, value);
+ }
+
+ [ValidateMethod(nameof(ValidateDustThreshold))]
+ public string DustThreshold
+ {
+ get => _dustThreshold;
+ set => this.RaiseAndSetIfChanged(ref _dustThreshold, value);
+ }
+
+
public bool LurkingWifeMode => Global.UiConfig.LurkingWifeMode is true;
public string LurkingWifeModeText => Global.UiConfig.LurkingWifeMode is true ? "On" : "Off";
@@ -168,7 +218,11 @@ namespace WalletWasabi.Gui.Tabs
return;
}
- if (string.IsNullOrWhiteSpace(Network))
+ if (string.IsNullOrWhiteSpace(Network)
+ || string.IsNullOrWhiteSpace(SomePrivacyLevel)
+ || string.IsNullOrWhiteSpace(FinePrivacyLevel)
+ || string.IsNullOrWhiteSpace(StrongPrivacyLevel)
+ || string.IsNullOrWhiteSpace(DustThreshold))
{
return;
}
@@ -183,13 +237,29 @@ namespace WalletWasabi.Gui.Tabs
var torHost = TorHost;
var torSocks5Port = int.TryParse(TorPort, out var port) ? (int?)port : null;
var useTor = UseTor;
-
- if (config.Network != network || config.TorHost != torHost || config.TorSocks5Port != torSocks5Port || config.UseTor != useTor)
+ int level;
+ var somePrivacyLevel = int.TryParse(SomePrivacyLevel, out level) ? (int?)level : null;
+ var finePrivacyLevel = int.TryParse(FinePrivacyLevel, out level) ? (int?)level : null;
+ var strongPrivacyLevel= int.TryParse(StrongPrivacyLevel, out level) ? (int?)level : null;
+ var dustThreshold= decimal.TryParse(DustThreshold, out var threshold) ? (decimal?)threshold : null;
+
+ if (config.Network != network
+ || config.TorHost != torHost
+ || config.TorSocks5Port != torSocks5Port
+ || config.UseTor != useTor
+ || config.PrivacyLevelSome != somePrivacyLevel
+ || config.PrivacyLevelFine != finePrivacyLevel
+ || config.PrivacyLevelStrong != strongPrivacyLevel
+ || config.DustThreshold.ToUnit(NBitcoin.MoneyUnit.BTC) != dustThreshold)
{
config.Network = network;
config.TorHost = torHost;
config.TorSocks5Port = torSocks5Port;
config.UseTor = useTor;
+ config.PrivacyLevelSome = somePrivacyLevel;
+ config.PrivacyLevelFine = finePrivacyLevel;
+ config.PrivacyLevelStrong= strongPrivacyLevel;
+ config.DustThreshold = Money.Coins(dustThreshold.Value);
await config.ToFileAsync();
@@ -238,6 +308,43 @@ namespace WalletWasabi.Gui.Tabs
return "Invalid port.";
}
+ public string ValidateSomePrivacyLevel()
+ => ValidatePrivacyLevel(SomePrivacyLevel);
+ public string ValidateFinePrivacyLevel()
+ => ValidatePrivacyLevel(FinePrivacyLevel);
+ public string ValidateStrongPrivacyLevel()
+ => ValidatePrivacyLevel(StrongPrivacyLevel);
+
+ public string ValidatePrivacyLevel(string value)
+ {
+ if(string.IsNullOrWhiteSpace(value))
+ {
+ return string.Empty;
+ }
+
+ if (uint.TryParse(value, out _))
+ {
+ return string.Empty;
+ }
+
+ return "Invalid privacy level.";
+ }
+
+ public string ValidateDustThreshold()
+ {
+ if(string.IsNullOrWhiteSpace(DustThreshold))
+ {
+ return string.Empty;
+ }
+
+ if (decimal.TryParse(DustThreshold, out _))
+ {
+ return string.Empty;
+ }
+
+ return "Invalid dust amount.";
+ }
+
private void OpenConfigFile()
{
IoHelpers.OpenFileInTextEditor(Global.Config.FilePath);

Add more parameters to the settings page