Edit generation wallet workflow
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletSuccessViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletSuccessViewModel.cs
@@ -5,6 +5,10 @@ using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Logging;
using System;
using System.Reactive.Linq;
+using WalletWasabi.Helpers;
+using WalletWasabi.Blockchain.Keys;
+using WalletWasabi.Models;
+using WalletWasabi.Gui.Helpers;
namespace WalletWasabi.Gui.Tabs.WalletManager
{
@@ -12,17 +16,35 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
private string _mnemonicWords;
- public GenerateWalletSuccessViewModel(WalletManagerViewModel owner, Mnemonic mnemonic) : base("Wallet Generated Successfully!")
+ public GenerateWalletSuccessViewModel(WalletManagerViewModel owner, string password, string walletFilePath, Global global) : base("Wallet Generated Successfully!")
{
+ // Here we are not letting anything that will be autocorrected later. We need to generate the wallet exactly with the entered password bacause of compatibility.
+ PasswordHelper.Guard(password);
+
+ var keyManager = KeyManager.CreateNew(out Mnemonic mnemonic, password);
_mnemonicWords = mnemonic.ToString();
- ConfirmCommand = ReactiveCommand.Create(() => owner.SelectTestPassword());
+ ConfirmCommand = ReactiveCommand.Create(() =>
+ {
+ DoConfirmCommand(keyManager, walletFilePath, global);
+ owner.SelectTestPassword();
+ });
ConfirmCommand.ThrownExceptions
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex => Logger.LogError(ex));
}
+ private void DoConfirmCommand(KeyManager keyManager, string walletFilePath, Global global)
+ {
+ keyManager.SetNetwork(global.Network);
+ keyManager.SetBestHeight(new Height(global.BitcoinStore.SmartHeaderChain.TipHeight));
+ keyManager.SetFilePath(walletFilePath);
+ keyManager.ToFile();
+
+ NotificationHelpers.Success("Wallet is successfully generated!");
+ }
+
public string MnemonicWords
{
get => _mnemonicWords;

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletView.xaml
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletView.xaml
<controls:ExtendedTextBox Text="{Binding WalletName}" Watermark="Wallet Name" UseFloatingWatermark="True" />
<controls:TogglePasswordBox Text="{Binding Password}" Watermark="Choose a password">
<i:Interaction.Behaviors>
- <behaviors:CommandOnEnterBehavior Command="{Binding GenerateCommand}" />
+ <behaviors:CommandOnEnterBehavior Command="{Binding NextCommand}" />
</i:Interaction.Behaviors>
</controls:TogglePasswordBox>
</StackPanel>
<TextBlock Text=" documents." />
</StackPanel>
</CheckBox>
- <Button Content="Generate" Command="{Binding GenerateCommand}" DockPanel.Dock="Right" />
+ <Button Content="Next" Command="{Binding NextCommand}" DockPanel.Dock="Right" />
<Grid></Grid>
</DockPanel>
</StackPanel>

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletViewModel.cs
@@ -35,14 +35,14 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
this.WhenAnyValue(x => x.Password).Select(pw => !ValidatePassword().HasErrors),
(terms, pw) => terms && pw);
- GenerateCommand = ReactiveCommand.Create(DoGenerateCommand, canGenerate);
+ NextCommand = ReactiveCommand.Create(DoNextCommand, canGenerate);
- GenerateCommand.ThrownExceptions
+ NextCommand.ThrownExceptions
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex => Logger.LogError(ex));
}
- private void DoGenerateCommand()
+ private void DoNextCommand()
{
WalletName = Guard.Correct(WalletName);
@@ -70,17 +70,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
try
{
- PasswordHelper.Guard(Password); // Here we are not letting anything that will be autocorrected later. We need to generate the wallet exactly with the entered password bacause of compatibility.
-
- var km = KeyManager.CreateNew(out Mnemonic mnemonic, Password);
- km.SetNetwork(Global.Network);
- km.SetBestHeight(new Height(Global.BitcoinStore.SmartHeaderChain.TipHeight));
- km.SetFilePath(walletFilePath);
- km.ToFile();
-
- NotificationHelpers.Success("Wallet is successfully generated!");
-
- Owner.CurrentView = new GenerateWalletSuccessViewModel(Owner, mnemonic);
+ Owner.CurrentView = new GenerateWalletSuccessViewModel(Owner, Password, walletFilePath, Global);
}
catch (Exception ex)
{
@@ -143,7 +133,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
set => this.RaiseAndSetIfChanged(ref _termsAccepted, value);
}
- public ReactiveCommand<Unit, Unit> GenerateCommand { get; }
+ public ReactiveCommand<Unit, Unit> NextCommand { get; }
public void OnLegalClicked()
{

Edit generation wallet workflow