@@ -13,7 +13,7 @@ import { useWalletStore } from 'lib/store';
1313import { fetchStateFromBackend } from 'lib/store/hooks/useIntercomSync' ;
1414import { navigate , useLocation } from 'lib/woozie' ;
1515import { OnboardingFlow } from 'screens/onboarding/navigator' ;
16- import { ImportType , OnboardingAction , OnboardingStep , OnboardingType } from 'screens/onboarding/types' ;
16+ import { ImportType , OnboardingAction , OnboardingStep , OnboardingType , WalletType } from 'screens/onboarding/types' ;
1717
1818/**
1919 * Check if hardware security is available for vault key protection.
@@ -71,6 +71,7 @@ const Welcome: FC = () => {
7171 const [ onboardingType , setOnboardingType ] = useState < OnboardingType | null > ( null ) ;
7272 const [ importType , setImportType ] = useState < ImportType | null > ( null ) ;
7373 const [ password , setPassword ] = useState < string | null > ( null ) ;
74+ const [ walletType , setWalletType ] = useState < WalletType > ( WalletType . Psm ) ;
7475 const [ importedWithFile , setImportedWithFile ] = useState ( false ) ;
7576 const [ isLoading , setIsLoading ] = useState ( false ) ;
7677 const [ useBiometric , setUseBiometric ] = useState ( true ) ;
@@ -94,14 +95,14 @@ const Welcome: FC = () => {
9495 // For hardware-only wallets, pass undefined as password
9596 const actualPassword = password === '__HARDWARE_ONLY__' ? undefined : password ;
9697 if ( ! importedWithFile ) {
97- await registerWallet ( actualPassword , seedPhraseFormatted , onboardingType === OnboardingType . Import ) ;
98+ await registerWallet ( walletType , actualPassword , seedPhraseFormatted , onboardingType === OnboardingType . Import ) ;
9899 } else {
99100 await importWalletFromClient ( actualPassword , seedPhraseFormatted ) ;
100101 }
101102 } else {
102103 throw new Error ( 'Missing password or seed phrase' ) ;
103104 }
104- } , [ password , seedPhrase , importedWithFile , registerWallet , onboardingType , importWalletFromClient ] ) ;
105+ } , [ password , seedPhrase , importedWithFile , registerWallet , onboardingType , importWalletFromClient , walletType ] ) ;
105106
106107 const onAction = async ( action : OnboardingAction ) => {
107108 let eventCategory = AnalyticsEventCategory . ButtonPress ;
@@ -180,6 +181,14 @@ const Welcome: FC = () => {
180181 setPassword ( action . payload . password ) ;
181182 eventCategory = AnalyticsEventCategory . FormSubmit ;
182183 // Hardware protection is automatically set up in Vault.spawn() when available
184+ if ( onboardingType === OnboardingType . Create ) {
185+ navigate ( '/#select-recovery-method' ) ;
186+ } else {
187+ navigate ( '/#confirmation' ) ;
188+ }
189+ break ;
190+ case 'select-recovery-method' :
191+ setWalletType ( action . payload ) ;
183192 navigate ( '/#confirmation' ) ;
184193 break ;
185194 case 'confirmation' :
@@ -231,6 +240,8 @@ const Welcome: FC = () => {
231240 navigate ( '/#import-from-seed' ) ;
232241 }
233242 }
243+ } else if ( step === OnboardingStep . SelectRecoveryMethod ) {
244+ navigate ( '/#create-password' ) ;
234245 } else if ( step === OnboardingStep . ImportFromFile || step === OnboardingStep . ImportFromSeed ) {
235246 navigate ( '/#select-import-type' ) ;
236247 }
@@ -271,6 +282,9 @@ const Welcome: FC = () => {
271282 case '#create-password' :
272283 setStep ( OnboardingStep . CreatePassword ) ;
273284 break ;
285+ case '#select-recovery-method' :
286+ setStep ( OnboardingStep . SelectRecoveryMethod ) ;
287+ break ;
274288 case '#confirmation' :
275289 if ( ! password ) {
276290 navigate ( '/' ) ;
0 commit comments