@@ -8,6 +8,7 @@ import withWizard, { WizardElementProps, WithWizardState } from 'components/with
88import { MnemonicAction , BUTTON_GAP } from 'utils/const'
99import { verifyWalletSubmission } from 'utils/validators'
1010import { helpersCall , walletsCall } from 'services/UILayer'
11+ import { validateMnemonic , showErrorMessage } from 'services/remote'
1112import { registerIcons , buttonGrommetIconStyles } from 'utils/icons'
1213
1314export enum WalletWizardPath {
@@ -138,13 +139,18 @@ const Mnemonic = ({
138139 if ( isCreate ) {
139140 history . push ( `${ rootPath } ${ WalletWizardPath . Mnemonic } /${ MnemonicAction . Verify } ` )
140141 } else {
141- history . push (
142- `${ rootPath } ${ WalletWizardPath . Submission } /${
143- type === MnemonicAction . Verify ? MnemonicAction . Create : MnemonicAction . Import
144- } `
145- )
142+ const isMnemonicValid = validateMnemonic ( imported )
143+ if ( isMnemonicValid ) {
144+ history . push (
145+ `${ rootPath } ${ WalletWizardPath . Submission } /${
146+ type === MnemonicAction . Verify ? MnemonicAction . Create : MnemonicAction . Import
147+ } `
148+ )
149+ } else {
150+ showErrorMessage ( t ( 'messages.error' ) , t ( 'messages.invalid-mnemonic' ) )
151+ }
146152 }
147- } , [ isCreate , history , rootPath , type ] )
153+ } , [ isCreate , history , rootPath , type , imported , t ] )
148154
149155 return (
150156 < Stack verticalFill verticalAlign = "center" horizontalAlign = "stretch" tokens = { { childrenGap : 15 } } >
0 commit comments