Skip to content

Commit

Permalink
Remove the custom derivation path from advanced wallet recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed Apr 30, 2024
1 parent b2e52e5 commit 1cf0a96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ public partial class RecoverWalletSummaryViewModel : RoutableViewModel
[AutoNotify] private bool _isMnemonicsValid;
[AutoNotify] private string? _passphrase;
[AutoNotify] private string? _minGapLimit;
[AutoNotify] private string? _derivationPath;

private RecoverWalletSummaryViewModel(WalletCreationOptions.RecoverWallet options)
{
Passphrase = options.Passphrase;

MinGapLimit = options.MinGapLimit.ToString();

DerivationPath = "";

Suggestions = new Mnemonic(Wordlist.English, WordCount.Twelve).WordList.GetWords();

if (options.Mnemonic is not null)
Expand All @@ -54,17 +51,15 @@ private RecoverWalletSummaryViewModel(WalletCreationOptions.RecoverWallet option

this.ValidateProperty(x => x.Mnemonics, ValidateMnemonics);
this.ValidateProperty(x => x.MinGapLimit, ValidateMinGapLimit);
this.ValidateProperty(x => x.DerivationPath, ValidateDerivationPath);

EnableBack = false;

var canExecuteNext = this.WhenAnyValue(
x => x.MinGapLimit,
x => x.DerivationPath,
x => x.IsMnemonicsValid)
.Select(x =>
{
var (_, _, isMnemonicsValid) = x;
var (_, isMnemonicsValid) = x;
return !Validations.Any && isMnemonicsValid;
});

Expand All @@ -88,8 +83,7 @@ private async Task OnNextAsync(WalletCreationOptions.RecoverWallet options)
{
Passphrase = Passphrase,
Mnemonic = _currentMnemonics,
MinGapLimit = int.Parse(MinGapLimit),
AccountKeyPath = DerivationPath
MinGapLimit = int.Parse(MinGapLimit)
};

var wallet = await UiContext.WalletRepository.NewWalletAsync(options);
Expand Down Expand Up @@ -125,20 +119,6 @@ private void ValidateMnemonics(IValidationErrors errors)
errors.Add(ErrorSeverity.Error, "Invalid set. Make sure you typed all your recovery words in the correct order.");
}

private void ValidateDerivationPath(IValidationErrors errors)
{
if (string.IsNullOrEmpty(DerivationPath))
{
ClearValidations();
return;
}

if (!KeyPath.TryParse(DerivationPath, out var keyPath) || keyPath is null)
{
errors.Add(ErrorSeverity.Error, "Invalid derivation path.");
}
}

private void ValidateMinGapLimit(IValidationErrors errors)
{
if (!int.TryParse(MinGapLimit, out var minGapLimit) ||
Expand Down
12 changes: 0 additions & 12 deletions WalletWasabi.Fluent/Views/AddWallet/RecoverWalletSummaryView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@
</TextBox>
</StackPanel>

<!-- DerivationPath -->
<StackPanel HorizontalAlignment="Stretch"
Grid.Row="1"
Grid.Column="1">
<Label Content="Derivation _Path:" Target="TbDerivationPath" />
<TextBox Name="TbDerivationPath" Watermark="e.g., 10/0/2'/3"
Text="{Binding DerivationPath}"
DockPanel.Dock="Top"
Classes="hasCheckMark">
</TextBox>
</StackPanel>

</Grid>

</DockPanel>
Expand Down

0 comments on commit 1cf0a96

Please sign in to comment.