Remove WalletManager from HWoperations
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/ConnectHardwareWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/ConnectHardwareWalletViewModel.cs
@@ -150,7 +150,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
{
base.OnNavigatedTo(inStack, disposable);
- HardwareWalletOperations = new HardwareWalletOperations(WalletManager);
+ HardwareWalletOperations = new HardwareWalletOperations(WalletManager.Network);
HardwareWalletOperations.DetectionCompleted += OnDetectionCompleted;
HardwareWalletOperations.PassphraseNeeded += OnPassphraseNeeded;

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/DetectedHardwareWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/DetectedHardwareWalletViewModel.cs
@@ -17,7 +17,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
Title = "Hardware Wallet";
WalletManager = walletManager;
WalletName = walletName;
- HardwareWalletOperations = new HardwareWalletOperations(WalletManager);
+ HardwareWalletOperations = new HardwareWalletOperations(walletManager.Network);
Type = device.Model switch
{
@@ -33,7 +33,9 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
{
try
{
- var km = await HardwareWalletOperations.GenerateWalletAsync(WalletName, device);
+ var walletFilePath = WalletManager.WalletDirectories.GetWalletFilePaths(WalletName).walletFilePath;
+
+ var km = await HardwareWalletOperations.GenerateWalletAsync(device, walletFilePath);
km.SetIcon(Type);
Navigate().To(new AddedWalletPageViewModel(walletManager, km));

MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/HardwareWalletOperations.cs
WalletWasabi.Fluent/ViewModels/AddWallet/HardwareWallet/HardwareWalletOperations.cs
@@ -16,17 +16,15 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
public class HardwareWalletOperations : IAsyncDisposable
{
public event EventHandler<HwiEnumerateEntry[]>? DetectionCompleted;
+
public event EventHandler? PassphraseNeeded;
- public HardwareWalletOperations(WalletManager walletManager)
+ public HardwareWalletOperations(Network network)
{
- WalletManager = walletManager;
- Client = new HwiClient(WalletManager.Network);
+ Client = new HwiClient(network);
DisposeCts = new CancellationTokenSource();
}
- public WalletManager WalletManager { get; }
-
public HwiClient Client { get; }
private CancellationTokenSource DisposeCts { get; }
@@ -45,7 +43,7 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
PassphraseNeeded?.Invoke(this, EventArgs.Empty);
}
- public async Task<KeyManager> GenerateWalletAsync(string walletName, HwiEnumerateEntry device)
+ public async Task<KeyManager> GenerateWalletAsync(HwiEnumerateEntry device, string walletFilePath)
{
if (device.Fingerprint is null)
{
@@ -59,9 +57,8 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet.HardwareWallet
device.Path,
KeyManager.DefaultAccountKeyPath,
cts.Token).ConfigureAwait(false);
- var path = WalletManager.WalletDirectories.GetWalletFilePaths(walletName).walletFilePath;
- return KeyManager.CreateNewHardwareWalletWatchOnly(fingerPrint, extPubKey, path);
+ return KeyManager.CreateNewHardwareWalletWatchOnly(fingerPrint, extPubKey, walletFilePath);
}
public void InitHardwareWallet(HwiEnumerateEntry device)

Remove WalletManager from HWoperations