@@ -19,12 +19,14 @@ import Background from '../../../services/Background';
1919import { CHAIN_IDS } from '../../../../constants' ;
2020import { NetworkName } from 'networks/types' ;
2121import { Button , ErrorMessage , Input } from '../../ui' ;
22+ import { useTranslation } from 'react-i18next' ;
2223import * as styles from './import.module.css' ;
2324
2425export function ImportSeedMultichain ( ) {
2526 const navigate = useNavigate ( ) ;
2627 const dispatch = usePopupDispatch ( ) ;
2728 const accounts = usePopupSelector ( state => state . accounts ) ;
29+ const { t } = useTranslation ( ) ;
2830 const [ seed , setSeed ] = useState ( '' ) ;
2931 const [ addressWaves , setAddressWaves ] = useState ( '' ) ;
3032 const [ addressEvm , setAddressEvm ] = useState ( '' ) ;
@@ -72,6 +74,8 @@ export function ImportSeedMultichain() {
7274 checkDuplicates ( ) ;
7375 } , [ addressWaves , addressEvm , accounts ] ) ;
7476
77+ const SEED_MIN_LENGTH = 24 ;
78+
7579 async function handleSeedChange ( value : string ) {
7680 const normalizedSeed = value . trim ( ) . replace ( / \s + / g, ' ' ) ;
7781 setSeed ( normalizedSeed ) ;
@@ -83,9 +87,12 @@ export function ImportSeedMultichain() {
8387 nameRef . current = '' ;
8488 addressWavesRef . current = '' ;
8589 addressEvmRef . current = '' ;
86- if ( ! normalizedSeed ) return ;
87- if ( normalizedSeed . length < 12 ) {
88- setError ( 'Seed phrase too short' ) ;
90+ if ( ! normalizedSeed ) {
91+ setError ( t ( 'importSeed.requiredError' ) ) ;
92+ return ;
93+ }
94+ if ( normalizedSeed . length < SEED_MIN_LENGTH ) {
95+ setError ( t ( 'importSeed.seedLengthError' , { minLength : SEED_MIN_LENGTH } ) ) ;
8996 return ;
9097 }
9198 try {
@@ -116,8 +123,12 @@ export function ImportSeedMultichain() {
116123 function handleImport ( e : React . FormEvent ) {
117124 e . preventDefault ( ) ;
118125
119- // All validation (including duplicate check) is handled by useEffect
120- // Just check if there's any error
126+ if ( ! seed ) {
127+ setShowValidationError ( true ) ;
128+ setError ( t ( 'importSeed.requiredError' ) ) ;
129+ return ;
130+ }
131+
121132 if ( ! addressWaves || ! addressEvm || error ) {
122133 setShowValidationError ( true ) ;
123134 setError ( error || 'Enter valid seed' ) ;
0 commit comments