@@ -76,6 +76,7 @@ const initState: WithWizardState = {
7676 password : '' ,
7777 confirmPassword : '' ,
7878 name : '' ,
79+ isHardware : false ,
7980}
8081
8182const submissionInputs = [
@@ -182,6 +183,8 @@ const Welcome = ({ rootPath = '/wizard/', wallets = [], dispatch }: WizardElemen
182183
183184Welcome . displayName = 'Welcome'
184185
186+ const LEDGER_WORDS_COUNT = 24
187+
185188const Mnemonic = ( { state = initState , rootPath = '/wizard/' , dispatch } : WizardElementProps ) => {
186189 const { generated, imported } = state
187190 const navigate = useNavigate ( )
@@ -193,8 +196,9 @@ const Mnemonic = ({ state = initState, rootPath = '/wizard/', dispatch }: Wizard
193196 [ MnemonicAction . Verify ] : 'wizard.replenish-your-seed' ,
194197 [ MnemonicAction . Import ] : 'wizard.input-your-seed' ,
195198 } [ type ]
196- const { inputsWords, onChangeInput, setInputsWords } = useInputWords ( )
197199 const [ searchParams ] = useSearchParams ( )
200+ const isHardware = searchParams . get ( 'isHardware' ) === 'true'
201+ const { inputsWords, onChangeInput, setInputsWords } = useInputWords ( isHardware ? LEDGER_WORDS_COUNT : undefined )
198202 const disableNext =
199203 ( type === MnemonicAction . Import && inputsWords . some ( v => ! v ) ) ||
200204 ( type === MnemonicAction . Verify && generated !== inputsWords . join ( ' ' ) )
@@ -228,6 +232,14 @@ const Mnemonic = ({ state = initState, rootPath = '/wizard/', dispatch }: Wizard
228232 } )
229233 }
230234 } , [ dispatch , type , navigate , setBlankIndexes ] )
235+ useEffect ( ( ) => {
236+ if ( isHardware ) {
237+ dispatch ( {
238+ type : 'isHardware' ,
239+ payload : true ,
240+ } )
241+ }
242+ } , [ dispatch , isHardware ] )
231243
232244 const globalDispatch = useDispatch ( )
233245
@@ -317,6 +329,7 @@ const Mnemonic = ({ state = initState, rootPath = '/wizard/', dispatch }: Wizard
317329 inputsWords = { inputsWords }
318330 onChangeInputWord = { onChangeInput }
319331 blankIndexes = { MnemonicAction . Import ? undefined : blankIndexes }
332+ wordsCount = { isHardware ? LEDGER_WORDS_COUNT : undefined }
320333 />
321334 { type === MnemonicAction . Import && < div className = { styles . tips } > { t ( 'wizard.input-seed-first-empty-space' ) } </ div > }
322335 < div className = { styles . actions } >
@@ -337,7 +350,7 @@ export const getAlertStatus = (fieldInit: boolean, success: boolean) => {
337350}
338351
339352const Submission = ( { state = initState , wallets = [ ] , dispatch } : WizardElementProps ) => {
340- const { name, password, confirmPassword, imported } = state
353+ const { name, password, confirmPassword, imported, isHardware } = state
341354 const navigate = useNavigate ( )
342355 const { type = MnemonicAction . Create } = useParams < { type : MnemonicAction } > ( )
343356 const [ t ] = useTranslation ( )
@@ -396,6 +409,7 @@ const Submission = ({ state = initState, wallets = [], dispatch }: WizardElement
396409 name,
397410 password,
398411 mnemonic : imported ,
412+ isHardware,
399413 }
400414 openDialog ( )
401415 setTimeout ( ( ) => {
0 commit comments