feat(ui): wizard flows for xpub/xprv and WIF import

Add two new import paths to the setup wizard:

- "Importa xpub / xprv": accepts any SLIP-132 key (xpub/ypub/zpub or
  xprv/yprv/zprv), auto-detects script type from the version prefix,
  and saves a watch-only or fully-spendable HD account accordingly.

- "Importa chiave WIF": accepts one or more WIF private keys (one per
  line), goes through script-type selection, and saves an ImportedKeyAccount.

WizardFlowKind enum (New, Restore, ImportXkey, ImportWif) governs which
steps are shown; WizardBack() updated for all four flows. OpenLoaded()
updated to accept IWalletAccount and display wallet kind tags
(watch-only / imported) in the network info line.

Localization keys added for all six languages (it/en/es/fr/pt/de).
ViewModel._account changed from HdAccount? to IWalletAccount?.
This commit is contained in:
2026-06-15 14:23:03 +02:00
parent 47b6064964
commit 4dc37f1b42
5 changed files with 222 additions and 20 deletions
+35
View File
@@ -87,6 +87,12 @@
<Button Content="{Binding Loc[wiz.restore.btn]}" FontSize="16"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"
Command="{Binding WizardStartRestoreCommand}"/>
<Button Content="{Binding Loc[wiz.importxkey.btn]}" FontSize="16"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"
Command="{Binding WizardStartImportXkeyCommand}"/>
<Button Content="{Binding Loc[wiz.importwif.btn]}" FontSize="16"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"
Command="{Binding WizardStartImportWifCommand}"/>
</StackPanel>
<!-- Passo: scelta del wallet (più file presenti) -->
@@ -171,6 +177,35 @@
</StackPanel>
</StackPanel>
<!-- Passo: import xpub/xprv estesa (SLIP-132) -->
<StackPanel IsVisible="{Binding IsStepImportXkey}" Spacing="12">
<TextBlock Text="{Binding Loc[wiz.importxkey.title]}" FontSize="18" FontWeight="Bold"/>
<TextBlock Text="{Binding Loc[wiz.importxkey.hint]}" TextWrapping="Wrap" Foreground="Gray"/>
<TextBox PlaceholderText="{Binding Loc[wiz.importxkey.placeholder]}"
Text="{Binding ImportXkeyInput}" AcceptsReturn="False"/>
<TextBlock Text="{Binding ImportXkeyDetectedKind}"
IsVisible="{Binding ImportXkeyDetectedKind, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Foreground="Green" FontSize="12"/>
<StackPanel Orientation="Horizontal" Spacing="10">
<Button Content="{Binding Loc[wiz.back]}" Command="{Binding WizardBackCommand}"/>
<Button Content="{Binding Loc[wiz.next]}" Classes="accent"
Command="{Binding WizardNextFromImportXkeyCommand}"/>
</StackPanel>
</StackPanel>
<!-- Passo: import chiave WIF singola -->
<StackPanel IsVisible="{Binding IsStepImportWif}" Spacing="12">
<TextBlock Text="{Binding Loc[wiz.importwif.title]}" FontSize="18" FontWeight="Bold"/>
<TextBlock Text="{Binding Loc[wiz.importwif.hint]}" TextWrapping="Wrap" Foreground="Gray"/>
<TextBox PlaceholderText="{Binding Loc[wiz.importwif.placeholder]}"
Text="{Binding ImportWifInput}" AcceptsReturn="True" Height="80"/>
<StackPanel Orientation="Horizontal" Spacing="10">
<Button Content="{Binding Loc[wiz.back]}" Command="{Binding WizardBackCommand}"/>
<Button Content="{Binding Loc[wiz.next]}" Classes="accent"
Command="{Binding WizardNextFromImportWifCommand}"/>
</StackPanel>
</StackPanel>
<!-- Passo: scelta del tipo di script/indirizzi -->
<StackPanel IsVisible="{Binding IsStepScriptType}" Spacing="12">
<TextBlock Text="{Binding Loc[wiz.scripttype.title]}" FontSize="18" FontWeight="Bold"/>