diff --git a/src/pages/ValidatorOnboarding/ContinueButton.tsx b/src/pages/ValidatorOnboarding/ContinueButton.tsx index a28dd5e4..b5dcddc3 100644 --- a/src/pages/ValidatorOnboarding/ContinueButton.tsx +++ b/src/pages/ValidatorOnboarding/ContinueButton.tsx @@ -15,13 +15,13 @@ type ContinueButton = { } const ContinueButton = ({ continueHandler, activeStep, subStepValidatorSetup }: ContinueButton) => { - const { isCopyPastedPhrase, isRightPhrase, words, validWords, isConfirmPhraseStage } = + const { isCopyPastedPhrase, isRightPhrase, mnemonic, validWords, isConfirmPhraseStage } = useSelector((state: RootState) => state.keyGeneration) const dispatch = useDispatch() useEffect(() => { - dispatch(setIsRightPhrase(words.every(word => word !== ''))) - }, [words]) + dispatch(setIsRightPhrase(mnemonic.every(word => word !== ''))) + }, [mnemonic]) const isDisabled = () => { if ( diff --git a/src/pages/ValidatorOnboarding/KeyGeneration/ConfirmRecoveryPhrase/AutocompleteInput.tsx b/src/pages/ValidatorOnboarding/KeyGeneration/ConfirmRecoveryPhrase/AutocompleteInput.tsx index d655b6dc..16bc1cb8 100644 --- a/src/pages/ValidatorOnboarding/KeyGeneration/ConfirmRecoveryPhrase/AutocompleteInput.tsx +++ b/src/pages/ValidatorOnboarding/KeyGeneration/ConfirmRecoveryPhrase/AutocompleteInput.tsx @@ -18,7 +18,7 @@ type AutocompleteInputProps = { const AutocompleteInput = ({ index }: AutocompleteInputProps) => { const [suggestions, setSuggestions] = useState([]) const [isFocused, setIsFocused] = useState(false) - const word = useSelector((state: RootState) => state.keyGeneration.words[index]) + const word = useSelector((state: RootState) => state.keyGeneration.mnemonic[index]) const isValidWord = useSelector((state: RootState) => state.keyGeneration.validWords[index]) const validWords = useSelector((state: RootState) => state.keyGeneration.validWords) const dispatch = useDispatch() diff --git a/src/pages/ValidatorOnboarding/ValidatorOnboarding.tsx b/src/pages/ValidatorOnboarding/ValidatorOnboarding.tsx index 8d684a8f..fcdb19a3 100644 --- a/src/pages/ValidatorOnboarding/ValidatorOnboarding.tsx +++ b/src/pages/ValidatorOnboarding/ValidatorOnboarding.tsx @@ -27,7 +27,7 @@ import './layoutGradient.css' const ValidatorOnboarding = () => { const [activeStep, setActiveStep] = useState(0) const [subStepValidatorSetup, setSubStepValidatorSetup] = useState(0) - const { isCopyPastedPhrase, words, isConfirmPhraseStage, generatedMnemonic } = useSelector( + const { isCopyPastedPhrase, mnemonic, isConfirmPhraseStage, generatedMnemonic } = useSelector( (state: RootState) => state.keyGeneration, ) const navigate = useNavigate() @@ -41,7 +41,7 @@ const ValidatorOnboarding = () => { if (activeStep === 4 && isConfirmPhraseStage === false) { return dispatch(setIsConfirmPhraseStage(true)) } else if (activeStep === 4 && isConfirmPhraseStage === true) { - const newValidWords = words.map((w, index) => generatedMnemonic[index] === w) + const newValidWords = mnemonic.map((w, index) => generatedMnemonic[index] === w) dispatch(setValidWords(newValidWords)) if (newValidWords.some(w => w === false)) { diff --git a/src/redux/ValidatorOnboarding/KeyGeneration/slice.ts b/src/redux/ValidatorOnboarding/KeyGeneration/slice.ts index 94281b2c..9b224405 100644 --- a/src/redux/ValidatorOnboarding/KeyGeneration/slice.ts +++ b/src/redux/ValidatorOnboarding/KeyGeneration/slice.ts @@ -1,7 +1,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit' type KeyGenerationState = { - words: string[] + mnemonic: string[] isCopyPastedPhrase: boolean isRightPhrase: boolean validWords: boolean[] @@ -15,7 +15,7 @@ type wordProps = { } const initialState: KeyGenerationState = { - words: Array(24).fill(''), + mnemonic: Array(24).fill(''), isCopyPastedPhrase: false, isRightPhrase: false, validWords: Array(24).fill(true), @@ -28,12 +28,12 @@ const keyGenerationSlice = createSlice({ initialState, reducers: { setWord: (state, action: PayloadAction) => { - const newWords = [...state.words] - newWords[action.payload.index] = action.payload.word - return { ...state, words: newWords } + const newMnemonic = [...state.mnemonic] + newMnemonic[action.payload.index] = action.payload.word + return { ...state, mnemonic: newMnemonic } }, setMnemonic: (state, action: PayloadAction) => { - state.words = action.payload + state.mnemonic = action.payload }, setIsCopyPastedPhrase: (state, action: PayloadAction) => { state.isCopyPastedPhrase = action.payload