make the setting wallet specific
MODIFY
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/GeneralSettingsTabViewModel.cs
@@ -26,7 +26,6 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
[AutoNotify] private bool _autoCopy;
[AutoNotify] private bool _customFee;
[AutoNotify] private bool _customChangeAddress;
- [AutoNotify] private bool _usePsbtWorkflow;
[AutoNotify] private FeeDisplayFormat _selectedFeeDisplayFormat;
public GeneralSettingsTabViewModel()
@@ -35,7 +34,6 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
_autoCopy = Services.UiConfig.Autocopy;
_customFee = Services.UiConfig.IsCustomFee;
_customChangeAddress = Services.UiConfig.IsCustomChangeAddress;
- _usePsbtWorkflow = Services.UiConfig.UsePsbtWorkflow;
_selectedFeeDisplayFormat = Enum.IsDefined(typeof(FeeDisplayFormat), Services.UiConfig.FeeDisplayFormat)
? (FeeDisplayFormat) Services.UiConfig.FeeDisplayFormat
: FeeDisplayFormat.SatoshiPerByte;
@@ -68,11 +66,6 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
.ObserveOn(RxApp.MainThreadScheduler)
.Skip(1)
.Subscribe(x => Services.UiConfig.FeeDisplayFormat = (int)x);
-
- this.WhenAnyValue(x => x.UsePsbtWorkflow)
- .ObserveOn(RxApp.TaskpoolScheduler)
- .Skip(1)
- .Subscribe(x => Services.UiConfig.UsePsbtWorkflow = x);
}
public IEnumerable<FeeDisplayFormat> FeeDisplayFormats =>

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletInfoViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletInfoViewModel.cs
+using System;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Navigation;
@@ -12,10 +13,14 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Advanced
[AutoNotify] private bool _showSensitiveData;
[AutoNotify] private string _showButtonText = "Show sensitive data";
[AutoNotify] private string _lockIconString = "eye_show_regular";
+ [AutoNotify] private bool _preferPsbtWorkflow;
- public WalletInfoViewModel(Wallet wallet)
+ public WalletInfoViewModel(WalletViewModelBase walletViewModelBase)
{
+ var wallet = walletViewModelBase.Wallet;
var network = wallet.Network;
+ IsHardwareWallet = wallet.KeyManager.IsHardwareWallet;
+ _preferPsbtWorkflow = wallet.KeyManager.PreferPsbtWorkflow;
SetupCancel(enableCancel: true, enableCancelOnEscape: true, enableCancelOnPressed: true);
@@ -44,6 +49,14 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Advanced
ExtendedAccountZpub = wallet.KeyManager.ExtPubKey.ToZpub(network);
AccountKeyPath = $"m/{wallet.KeyManager.AccountKeyPath}";
MasterKeyFingerprint = wallet.KeyManager.MasterFingerprint.ToString();
+
+ this.WhenAnyValue(x => x.PreferPsbtWorkflow)
+ .Subscribe(value =>
+ {
+ wallet.KeyManager.PreferPsbtWorkflow = value;
+ wallet.KeyManager.ToFile();
+ walletViewModelBase.RaisePropertyChanged(nameof(walletViewModelBase.PreferPsbtWorkflow));
+ });
}
public string ExtendedAccountPublicKey { get; }
@@ -61,5 +74,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Advanced
public string? ExtendedMasterZprv { get; }
public string? ExtendedAccountZprv { get; }
+
+ public bool IsHardwareWallet { get; }
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/HardwareWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/HardwareWalletViewModel.cs
@@ -12,8 +12,6 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
{
internal HardwareWalletViewModel(Wallet wallet) : base(wallet)
{
- PsbtWorkflowEnabled = Services.UiConfig.UsePsbtWorkflow;
-
BroadcastPsbtCommand = ReactiveCommand.CreateFromTask(async () =>
{
try
@@ -32,14 +30,5 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
}
});
}
-
- protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposables)
- {
- base.OnNavigatedTo(isInHistory, disposables);
-
- Services.UiConfig.WhenAnyValue(x => x.UsePsbtWorkflow)
- .Subscribe(value => PsbtWorkflowEnabled = value)
- .DisposeWith(disposables);
- }
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -51,7 +51,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
PayJoinUrl = info.PayJoinClient?.PaymentUrl.AbsoluteUri;
IsPayJoin = PayJoinUrl is not null;
- if (Services.UiConfig.UsePsbtWorkflow)
+ if (wallet.KeyManager.PreferPsbtWorkflow)
{
NextCommand = ReactiveCommand.CreateFromTask(async () =>
{

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -35,7 +35,6 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
[AutoNotify] private int _layoutIndex;
[AutoNotify] private double _widthSource;
[AutoNotify] private double _heightSource;
- [AutoNotify] private bool _psbtWorkflowEnabled;
[AutoNotify(SetterModifier = AccessModifier.Private)] private bool _isSmallLayout;
[AutoNotify(SetterModifier = AccessModifier.Private)] private bool _isNormalLayout;
[AutoNotify(SetterModifier = AccessModifier.Private)] private bool _isWideLayout;
@@ -180,7 +179,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
}
}
- Navigate(NavigationTarget.DialogScreen).To(new WalletInfoViewModel(wallet));
+ Navigate(NavigationTarget.DialogScreen).To(new WalletInfoViewModel(this));
});
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModelBase.cs
@@ -47,6 +47,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
public bool IsLoggedIn => Wallet.IsLoggedIn;
+ public bool PreferPsbtWorkflow => Wallet.KeyManager.PreferPsbtWorkflow;
+
private void SetIcon()
{
if (Wallet.KeyManager.Icon is { } iconString)

MODIFY
WalletWasabi.Fluent/Views/Settings/GeneralSettingsTabView.axaml
WalletWasabi.Fluent/Views/Settings/GeneralSettingsTabView.axaml
<ToggleSwitch IsChecked="{Binding CustomChangeAddress}" />
</DockPanel>
- <DockPanel>
- <TextBlock VerticalAlignment="Center" Text="PSBT workflow" />
- <ToggleSwitch IsChecked="{Binding UsePsbtWorkflow}" />
- </DockPanel>
-
<StackPanel Spacing="10">
<TextBlock Text="Fee Display Format" />
<ComboBox HorizontalAlignment="Stretch" Items="{Binding FeeDisplayFormats}" SelectedItem="{Binding SelectedFeeDisplayFormat}">

MODIFY
WalletWasabi.Fluent/Views/Wallets/Advanced/WalletInfoView.axaml
WalletWasabi.Fluent/Views/Wallets/Advanced/WalletInfoView.axaml
x:DataType="advanced:WalletInfoViewModel"
x:CompileBindings="True"
x:Class="WalletWasabi.Fluent.Views.Wallets.Advanced.WalletInfoView">
- <c:ContentArea Title="{Binding Title}"
- EnableNext="True" NextContent="Done"
+ <c:ContentArea EnableNext="True" NextContent="Done"
EnableCancel="{Binding EnableCancel}"
EnableBack="{Binding EnableBack}">
+ <c:ContentArea.Title>
+ <DockPanel>
+ <StackPanel Orientation="Horizontal" Spacing="10" DockPanel.Dock="Right" IsVisible="{Binding IsHardwareWallet}">
+ <TextBlock VerticalAlignment="Center" Text="PSBT workflow" FontSize="14"/>
+ <ToggleSwitch IsChecked="{Binding PreferPsbtWorkflow}" OnContent="{x:Null}" OffContent="{x:Null}" />
+ </StackPanel>
+ <TextBlock TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Title}" />
+ </DockPanel>
+ </c:ContentArea.Title>
<c:ContentArea.CancelContent>
<StackPanel Spacing="10" Orientation="Horizontal">
<PathIcon Data="{Binding LockIconString, Converter={x:Static conv:NavBarIconConverter.Instance}}" />
</StackPanel>
</c:ContentArea.CancelContent>
<StackPanel Spacing="10" Margin="0 0 20 0">
+
<c:PreviewItem Icon="{StaticResource key_regular}"
Text="Extended Master Private Key"
Content="{Binding ExtendedMasterPrivateKey}"

MODIFY
WalletWasabi.Fluent/Views/Wallets/WalletView.axaml
WalletWasabi.Fluent/Views/Wallets/WalletView.axaml
<TextBlock Text="Send" />
</StackPanel>
</Button>
- <Button Classes="function" Command="{Binding BroadcastPsbtCommand}" IsVisible="{Binding PsbtWorkflowEnabled}">
+ <Button Classes="function" Command="{Binding BroadcastPsbtCommand}" IsVisible="{Binding PreferPsbtWorkflow}">
<StackPanel Orientation="Horizontal" Spacing="15">
<PathIcon Data="{StaticResource live_regular}" />
<TextBlock Text="Broadcast" />

MODIFY
WalletWasabi.Gui/UiConfig.cs
WalletWasabi.Gui/UiConfig.cs
@@ -41,8 +41,7 @@ namespace WalletWasabi.Gui
x => x.FeeDisplayFormat,
x => x.LastSelectedWallet,
x => x.WindowState,
- x => x.UsePsbtWorkflow,
- (_, _, _, _, _, _, _, _, _) => Unit.Default)
+ (_, _, _, _, _, _, _, _) => Unit.Default)
.Throttle(TimeSpan.FromMilliseconds(500))
.Skip(1) // Won't save on UiConfig creation.
.ObserveOn(RxApp.TaskpoolScheduler)
@@ -137,14 +136,6 @@ namespace WalletWasabi.Gui
set => RaiseAndSetIfChanged(ref _lastSelectedWallet, value);
}
- [DefaultValue(false)]
- [JsonProperty(PropertyName = "UsePsbtWorkflow", DefaultValueHandling = DefaultValueHandling.Populate)]
- public bool UsePsbtWorkflow
- {
- get => _usePsbtWorkflow;
- set => RaiseAndSetIfChanged(ref _usePsbtWorkflow, value);
- }
-
[JsonProperty(PropertyName = "CoinListViewSortingPreference")]
[JsonConverter(typeof(SortingPreferenceJsonConverter))]
public SortingPreference CoinListViewSortingPreference { get; internal set; } = new SortingPreference(SortOrder.Increasing, "Amount");

MODIFY
WalletWasabi/Blockchain/Keys/KeyManager.cs
WalletWasabi/Blockchain/Keys/KeyManager.cs
@@ -125,6 +125,9 @@ namespace WalletWasabi.Blockchain.Keys
[JsonProperty(Order = 10, PropertyName = "Icon")]
public string? Icon { get; private set; }
+ [JsonProperty(Order = 11, PropertyName = "PreferPsbtWorkflow")]
+ public bool PreferPsbtWorkflow { get; set; }
+
private object BlockchainStateLock { get; }
private object HdPubKeysLock { get; }

MODIFY
WalletWasabi/Wallets/Wallet.cs
WalletWasabi/Wallets/Wallet.cs
using Microsoft.Extensions.Hosting;
using NBitcoin;
-using NBitcoin.Protocol;
using Nito.AsyncEx;
using System;
using System.Collections.Generic;

make the setting wallet specific