Fix + improved UI
DELETE
WalletWasabi.Fluent/Converters/ScriptTypeConverter.cs
-using System.Globalization;
-using Avalonia.Data.Converters;
-using NBitcoin;
-
-namespace WalletWasabi.Fluent.Converters;
-
-public class ScriptTypeConverter : IValueConverter
-{
- public static readonly ScriptTypeConverter Instance = new();
-
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- return value switch
- {
- ScriptType.MultiSig => "",
- null => "",
- ScriptType.Witness => "",
- ScriptType.P2SH => "",
- ScriptType.P2PK => "",
- ScriptType.P2PKH => "",
- ScriptType.P2WSH => "SW",
- ScriptType.P2WPKH => "SW",
- ScriptType.Taproot => "TR",
- _ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
- };
- }
-
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- throw new NotSupportedException();
- }
-}

MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/CoinSelectorViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinControl/CoinSelectorViewModel.cs
@@ -145,7 +145,7 @@ public class CoinSelectorViewModel : ViewModelBase, IDisposable
{
return new PlainTextColumn<CoinControlItemViewModelBase>(
new AnonymityScoreHeaderView(),
- node => node is CoinCoinControlItemViewModel coin ? coin.AnonymityScore.ToString() : "",
+ node => node.AnonymityScore.ToString(),
GridLength.Auto,
new TextColumnOptions<CoinControlItemViewModelBase>
{

MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/Core/CoinCoinControlItemViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinControl/Core/CoinCoinControlItemViewModel.cs
@@ -20,7 +20,7 @@ public class CoinCoinControlItemViewModel : CoinControlItemViewModelBase
BannedUntilUtc = smartCoin.BannedUntilUtc;
IsSelected = false;
CanBeSelected = !IsCoinjoining;
- ScriptType = smartCoin.ScriptType;
+ ScriptType = ScriptType.FromEnum(smartCoin.ScriptType);
}
public SmartCoin SmartCoin { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/Core/CoinControlItemViewModelBase.cs
WalletWasabi.Fluent/ViewModels/CoinControl/Core/CoinControlItemViewModelBase.cs
@@ -35,7 +35,7 @@ public abstract class CoinControlItemViewModelBase : ViewModelBase
public string? BannedUntilUtcToolTip { get; protected set; }
- public int AnonymityScore { get; protected set; }
+ public int? AnonymityScore { get; protected set; }
public SmartLabel Labels { get; protected set; } = SmartLabel.Empty;

MODIFY
WalletWasabi.Fluent/ViewModels/CoinControl/Core/PocketCoinControlItemViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinControl/Core/PocketCoinControlItemViewModel.cs
@@ -13,18 +13,20 @@ public class PocketCoinControlItemViewModel : CoinControlItemViewModelBase, IDis
public PocketCoinControlItemViewModel(Pocket pocket)
{
- var unconfirmedCount = pocket.Coins.Count(x => !x.Confirmed);
+ var pocketCoins = pocket.Coins.ToList();
+
+ var unconfirmedCount = pocketCoins.Count(x => !x.Confirmed);
IsConfirmed = unconfirmedCount == 0;
ConfirmationStatus = IsConfirmed ? "All coins are confirmed" : $"{unconfirmedCount} coins are waiting for confirmation";
- IsBanned = pocket.Coins.Any(x => x.IsBanned);
+ IsBanned = pocketCoins.Any(x => x.IsBanned);
BannedUntilUtcToolTip = IsBanned ? "Some coins can't participate in coinjoin" : null;
Amount = pocket.Amount;
- IsCoinjoining = pocket.Coins.Any(x => x.CoinJoinInProgress);
- AnonymityScore = (int)pocket.Coins.Max(x => x.HdPubKey.AnonymitySet);
+ IsCoinjoining = pocketCoins.Any(x => x.CoinJoinInProgress);
+ AnonymityScore = pocketCoins.Count == 1 ? (int)pocketCoins[0].HdPubKey.AnonymitySet : null;
Labels = pocket.Labels;
- Children = pocket.Coins.OrderByDescending(x => x.Amount).Select(coin => new CoinCoinControlItemViewModel(coin)).ToList();
+ Children = pocketCoins.OrderByDescending(x => x.Amount).Select(coin => new CoinCoinControlItemViewModel(coin)).ToList();
CanBeSelected = true;
- ScriptType = null;
+ ScriptType = pocketCoins.Count == 1 ? ScriptType.FromEnum(pocketCoins[0].ScriptType) : null;
Children
.AsObservableChangeSet()

ADD
WalletWasabi.Fluent/ViewModels/CoinControl/Core/ScriptType.cs
+namespace WalletWasabi.Fluent.ViewModels.CoinControl.Core;
+
+public record ScriptType(string Name, string ShortName)
+{
+ public static readonly ScriptType Unknown = new("Unknown", "?");
+ public static ScriptType SegWit = new("SegWit", "SW");
+ public static ScriptType Taproot = new("Taproot", "TR");
+
+ public static ScriptType FromEnum(NBitcoin.ScriptType type)
+ {
+ return type switch
+ {
+ NBitcoin.ScriptType.Witness => Unknown,
+ NBitcoin.ScriptType.P2PKH => Unknown,
+ NBitcoin.ScriptType.P2SH => Unknown,
+ NBitcoin.ScriptType.P2PK => Unknown,
+ NBitcoin.ScriptType.MultiSig => Unknown,
+ NBitcoin.ScriptType.P2WSH => SegWit,
+ NBitcoin.ScriptType.P2WPKH => SegWit,
+ NBitcoin.ScriptType.Taproot => Taproot,
+ _ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
+ };
+ }
+};

MODIFY
WalletWasabi.Fluent/Views/CoinControl/Core/Cells/IndicatorsCellView.axaml
WalletWasabi.Fluent/Views/CoinControl/Core/Cells/IndicatorsCellView.axaml
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:core="clr-namespace:WalletWasabi.Fluent.ViewModels.CoinControl.Core"
- xmlns:converters="clr-namespace:WalletWasabi.Fluent.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="core:CoinControlItemViewModelBase"
x:CompileBindings="True"
x:Class="WalletWasabi.Fluent.Views.CoinControl.Core.Cells.IndicatorsCellView">
- <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Spacing="5" Margin="5 0">
+ <UserControl.Styles>
+ <Style Selector="WrapPanel > :is(Control)">
+ <Setter Property="Margin" Value="2 0" />
+ </Style>
+ </UserControl.Styles>
+
+ <WrapPanel VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
<Panel>
<!-- Confirmed -->
</Panel>
<Border BorderThickness="1" IsVisible="{Binding #ScriptType.Text, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" BorderBrush="{DynamicResource TextControlForeground}" Opacity="0.6" CornerRadius="4" Padding="3">
- <TextBlock Classes="h10" x:Name="ScriptType" Text="{Binding ScriptType, Converter={x:Static converters:ScriptTypeConverter.Instance}}" />
+ <TextBlock Classes="h10" x:Name="ScriptType" Text="{Binding ScriptType.ShortName, FallbackValue=''}" ToolTip.Tip="{Binding ScriptType.Name, FallbackValue=''}" />
</Border>
<!-- Banned -->
Height="14"
ToolTip.Tip="{Binding BannedUntilUtcToolTip}" />
- </StackPanel>
+ </WrapPanel>
</UserControl>

Fix + improved UI