Fixing the missing AddWallet calls
MODIFY
WalletWasabi.Gui/Rpc/WasabiJsonRpcService.cs
WalletWasabi.Gui/Rpc/WasabiJsonRpcService.cs
@@ -46,7 +46,7 @@ namespace WalletWasabi.Gui.Rpc
var walletGenerator = new WalletGenerator(Global.WalletManager.WalletDirectories.WalletsDir, Global.Network);
walletGenerator.TipHeight = Global.BitcoinStore.SmartHeaderChain.TipHeight;
var (keyManager, mnemonic) = walletGenerator.GenerateWallet(walletName, password);
- keyManager.ToFile();
+ Global.WalletManager.AddWallet(keyManager);
return mnemonic.ToString();
}

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/HardwareWallets/ConnectHardwareWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/HardwareWallets/ConnectHardwareWalletViewModel.cs
@@ -117,7 +117,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager.HardwareWallets
Logger.LogInfo("Creating a new wallet file.");
var walletName = Global.WalletManager.WalletDirectories.GetNextWalletName("Coldcard");
var walletFullPath = Global.WalletManager.WalletDirectories.GetWalletFilePaths(walletName).walletFilePath;
- KeyManager.CreateNewHardwareWalletWatchOnly(mfp, extPubKey, walletFullPath);
+ Global.WalletManager.AddWallet(KeyManager.CreateNewHardwareWalletWatchOnly(mfp, extPubKey, walletFullPath));
owner.SelectLoadWallet();
}
});
@@ -352,7 +352,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager.HardwareWallets
{
throw new InvalidOperationException("Hardware wallet did not provide fingerprint.");
}
- KeyManager.CreateNewHardwareWalletWatchOnly(selectedWallet.HardwareWalletInfo.Fingerprint.Value, extPubKey, path);
+ Global.WalletManager.AddWallet(KeyManager.CreateNewHardwareWalletWatchOnly(selectedWallet.HardwareWalletInfo.Fingerprint.Value, extPubKey, path));
}
KeyManager keyManager = Global.WalletManager.GetWalletByName(walletName).KeyManager;

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWallets/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWallets/LoadWalletViewModel.cs
@@ -65,7 +65,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager.LoadWallets
Observable.FromEventPattern<Wallet>(Global.WalletManager, nameof(Global.WalletManager.WalletAdded))
.ObserveOn(RxApp.MainThreadScheduler)
.Select(x => x.EventArgs)
- .Where(x => x is { })
+ .Where(x => x is { } && (!IsPasswordRequired || !x.KeyManager.IsWatchOnly))
.Subscribe(wallet =>
{
RootList.Add(new WalletViewModelBase(wallet));

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWallets/RecoverWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/RecoverWallets/RecoverWalletViewModel.cs
@@ -82,7 +82,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager.RecoverWallets
var km = KeyManager.Recover(mnemonic, Password, filePath: null, keyPath, MinGapLimit);
km.SetNetwork(Global.Network);
km.SetFilePath(walletFilePath);
- km.ToFile();
+ Global.WalletManager.AddWallet(km);
NotificationHelpers.Success("Wallet was recovered.");

Fixing the missing AddWallet calls