feat: add generated mnemonic to redux

This commit is contained in:
RadoslavDimchev 2023-10-08 10:54:39 +03:00
parent 109fca4aa7
commit 232cc13547
1 changed files with 13 additions and 2 deletions

View File

@ -5,6 +5,7 @@ type KeyGenerationState = {
isCopyPastedPhrase: boolean isCopyPastedPhrase: boolean
isRightPhrase: boolean isRightPhrase: boolean
validWords: boolean[] validWords: boolean[]
generatedMnemonic: string[]
} }
type wordProps = { type wordProps = {
@ -17,6 +18,7 @@ const initialState: KeyGenerationState = {
isCopyPastedPhrase: false, isCopyPastedPhrase: false,
isRightPhrase: false, isRightPhrase: false,
validWords: Array(24).fill(true), validWords: Array(24).fill(true),
generatedMnemonic: Array(24).fill(''),
} }
const keyGenerationSlice = createSlice({ const keyGenerationSlice = createSlice({
@ -40,10 +42,19 @@ const keyGenerationSlice = createSlice({
setValidWords: (state, action: PayloadAction<boolean[]>) => { setValidWords: (state, action: PayloadAction<boolean[]>) => {
state.validWords = action.payload state.validWords = action.payload
}, },
setGeneratedMnemonic: (state, action: PayloadAction<string[]>) => {
state.generatedMnemonic = action.payload
},
}, },
}) })
export const { setWord, setMnemonic, setIsCopyPastedPhrase, setIsRightPhrase, setValidWords } = export const {
keyGenerationSlice.actions setWord,
setMnemonic,
setIsCopyPastedPhrase,
setIsRightPhrase,
setValidWords,
setGeneratedMnemonic,
} = keyGenerationSlice.actions
export default keyGenerationSlice.reducer export default keyGenerationSlice.reducer