diff --git a/locales/base/translation.json b/locales/base/translation.json index 9d18d19c0ed..9420d3f2f56 100644 --- a/locales/base/translation.json +++ b/locales/base/translation.json @@ -64,7 +64,7 @@ "protectWallet": { "title": "Protect Your Wallet", "subtitle": "Protect your wallet", - "body": "If your phone is lost or stolen, your {{mnemonicLength}} word recovery phrase is the only way you can access your funds.", + "body": "If your phone is lost or stolen, your 12 word recovery phrase is the only way you can access your funds.", "recoveryPhrase": { "title": "Use Recovery Phrase", "subtitle": "Write down your recovery phrase" @@ -72,7 +72,7 @@ }, "recoveryPhrase": { "title": "Your recovery phrase", - "body": "Write these {{mnemonicLength}} words down somewhere safe, where it cannot be stolen or damaged.", + "body": "Write these 12 words down somewhere safe, where it cannot be stolen or damaged.", "continue": "I've saved it", "copy": "Copy to clipboard", "mnemonicCopied": "Recovery phrase copied to clipboard", diff --git a/src/app/saga.ts b/src/app/saga.ts index f164ac51977..27c5b6cde47 100644 --- a/src/app/saga.ts +++ b/src/app/saga.ts @@ -239,7 +239,6 @@ export interface RemoteConfigValues { maxSwapSlippagePercentage: number networkTimeoutSeconds: number celoNews: CeloNewsConfig - twelveWordMnemonicEnabled: boolean priceImpactWarningThreshold: number superchargeRewardContractAddress: string } diff --git a/src/firebase/firebase.ts b/src/firebase/firebase.ts index 162203ab284..4b638850703 100644 --- a/src/firebase/firebase.ts +++ b/src/firebase/firebase.ts @@ -341,7 +341,6 @@ export async function fetchRemoteConfigValues(): Promise { const store = createMockStore({ web3: { - twelveWordMnemonicEnabled: true, account: '0xaccount', }, }) diff --git a/src/onboarding/registration/OnboardingRecoveryPhrase.tsx b/src/onboarding/registration/OnboardingRecoveryPhrase.tsx index a182d7ce494..a04e0f48e91 100644 --- a/src/onboarding/registration/OnboardingRecoveryPhrase.tsx +++ b/src/onboarding/registration/OnboardingRecoveryPhrase.tsx @@ -4,7 +4,7 @@ import React, { useLayoutEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text, View } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' -import { useDispatch, useSelector } from 'react-redux' +import { useDispatch } from 'react-redux' import { recoveryPhraseInOnboardingCompleted } from 'src/account/actions' import { OnboardingEvents } from 'src/analytics/Events' import ValoraAnalytics from 'src/analytics/ValoraAnalytics' @@ -30,13 +30,10 @@ import { default as useTypedSelector } from 'src/redux/useSelector' import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import Logger from 'src/utils/Logger' -import { twelveWordMnemonicEnabledSelector } from 'src/web3/selectors' type Props = NativeStackScreenProps function OnboardingRecoveryPhrase({ navigation }: Props) { - const twelveWordMnemonicEnabled = useSelector(twelveWordMnemonicEnabledSelector) - const mnemonicLength = twelveWordMnemonicEnabled ? '12' : '24' const onboardingProps = useTypedSelector(onboardingPropsSelector) const { step, totalSteps } = getOnboardingStepValues(Screens.ProtectWallet, onboardingProps) const accountKey = useAccountKey() @@ -89,9 +86,7 @@ function OnboardingRecoveryPhrase({ navigation }: Props) { {t('recoveryPhrase.title')} - - {t('recoveryPhrase.body', { mnemonicLength })} - + {t('recoveryPhrase.body')} { const store = createMockStore({ web3: { - twelveWordMnemonicEnabled: true, account: '0xaccount', }, }) @@ -62,7 +61,6 @@ describe('ProtectWalletScreen', () => { it('does not dispatch event if recoveryPhraseInOnboardingStatus is not NotStarted', async () => { const mockStore = createMockStore({ web3: { - twelveWordMnemonicEnabled: true, account: '0xaccount', }, account: { diff --git a/src/onboarding/registration/ProtectWallet.tsx b/src/onboarding/registration/ProtectWallet.tsx index 288cbcf5529..d4effd7adbb 100644 --- a/src/onboarding/registration/ProtectWallet.tsx +++ b/src/onboarding/registration/ProtectWallet.tsx @@ -21,15 +21,13 @@ import colors from 'src/styles/colors' import fontStyles from 'src/styles/fonts' import variables from 'src/styles/variables' import Logger from 'src/utils/Logger' -import { twelveWordMnemonicEnabledSelector, walletAddressSelector } from 'src/web3/selectors' +import { walletAddressSelector } from 'src/web3/selectors' const TAG = 'ProtectWallet' type Props = NativeStackScreenProps function ProtectWallet({ navigation }: Props) { - const twelveWordMnemonicEnabled = useSelector(twelveWordMnemonicEnabledSelector) - const mnemonicLength = twelveWordMnemonicEnabled ? '12' : '24' const onboardingProps = useTypedSelector(onboardingPropsSelector) const { step, totalSteps } = getOnboardingStepValues(Screens.ProtectWallet, onboardingProps) const address = useSelector(walletAddressSelector) @@ -91,9 +89,7 @@ function ProtectWallet({ navigation }: Props) { {t('protectWallet.subtitle')} - - {t('protectWallet.body', { mnemonicLength })} - + {t('protectWallet.body')} ({ + ...state, + web3: _.omit(state.web3, 'twelveWordMnemonicEnabled'), + }), } diff --git a/src/redux/store.test.ts b/src/redux/store.test.ts index 4b5a8732c6d..280cc86b9ca 100644 --- a/src/redux/store.test.ts +++ b/src/redux/store.test.ts @@ -98,7 +98,7 @@ describe('store state', () => { { "_persist": { "rehydrated": true, - "version": 196, + "version": 197, }, "account": { "acceptedTerms": false, @@ -353,7 +353,6 @@ describe('store state', () => { "dataEncryptionKey": "0x0000000000000000000000000000000000008F68", "isDekRegistered": false, "mtwAddress": null, - "twelveWordMnemonicEnabled": false, }, } `) diff --git a/src/redux/store.ts b/src/redux/store.ts index 2c2f6cebbab..c47f0792651 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -23,7 +23,7 @@ const persistConfig: PersistConfig = { key: 'root', // default is -1, increment as we make migrations // See /~https://github.com/valora-inc/wallet/tree/main/WALLET.md#redux-state-migration - version: 196, + version: 197, keyPrefix: `reduxStore-`, // the redux-persist default is `persist:` which doesn't work with some file systems. storage: FSStorage(), blacklist: ['networkInfo', 'alert', 'imports', 'keylessBackup', 'jumpstart'], diff --git a/src/web3/reducer.ts b/src/web3/reducer.ts index 8f3e515cfce..c5833a0d7c1 100644 --- a/src/web3/reducer.ts +++ b/src/web3/reducer.ts @@ -1,7 +1,6 @@ -import { Actions as AppActions, UpdateConfigValuesAction } from 'src/app/actions' -import { REMOTE_CONFIG_VALUES_DEFAULTS } from 'src/firebase/remoteConfigValuesDefaults' -import { getRehydratePayload, REHYDRATE, RehydrateAction } from 'src/redux/persist-helper' -import { Actions, ActionTypes } from 'src/web3/actions' +import { UpdateConfigValuesAction } from 'src/app/actions' +import { REHYDRATE, RehydrateAction, getRehydratePayload } from 'src/redux/persist-helper' +import { ActionTypes, Actions } from 'src/web3/actions' export interface State { account: string | null // this is the wallet address (EOA) @@ -11,7 +10,6 @@ export interface State { dataEncryptionKey: string | null // Has the data encryption key been registered in the Accounts contract isDekRegistered: boolean | undefined - twelveWordMnemonicEnabled: boolean } const initialState: State = { @@ -20,7 +18,6 @@ const initialState: State = { accountInWeb3Keystore: null, dataEncryptionKey: null, isDekRegistered: false, - twelveWordMnemonicEnabled: REMOTE_CONFIG_VALUES_DEFAULTS.twelveWordMnemonicEnabled, } export const reducer = ( @@ -60,11 +57,6 @@ export const reducer = ( ...state, isDekRegistered: true, } - case AppActions.UPDATE_REMOTE_CONFIG_VALUES: - return { - ...state, - twelveWordMnemonicEnabled: action.configValues.twelveWordMnemonicEnabled, - } default: return state } diff --git a/src/web3/saga.test.ts b/src/web3/saga.test.ts index 4801f5124f8..a92ded6bbcf 100644 --- a/src/web3/saga.test.ts +++ b/src/web3/saga.test.ts @@ -100,7 +100,7 @@ describe(getOrCreateAccount, () => { ]) .call( generateMnemonic, - MnemonicStrength.s256_24words, + MnemonicStrength.s128_12words, MnemonicLanguages[expectedMnemonicLang] as unknown as MnemonicLanguages, bip39 ) diff --git a/src/web3/saga.ts b/src/web3/saga.ts index 4c198ec256b..612bd92ebd7 100644 --- a/src/web3/saga.ts +++ b/src/web3/saga.ts @@ -23,7 +23,6 @@ import { createAccountDek } from 'src/web3/dataEncryptionKey' import { currentAccountSelector, mtwAddressSelector, - twelveWordMnemonicEnabledSelector, walletAddressSelector, } from 'src/web3/selectors' import { call, delay, put, select, spawn, take } from 'typed-redux-saga' @@ -61,10 +60,7 @@ export function* getOrCreateAccount() { try { Logger.debug(TAG + '@getOrCreateAccount', 'Creating a new account') - const twelveWordMnemonicEnabled = yield* select(twelveWordMnemonicEnabledSelector) - const mnemonicBitLength = twelveWordMnemonicEnabled - ? MnemonicStrength.s128_12words - : MnemonicStrength.s256_24words + const mnemonicBitLength = MnemonicStrength.s128_12words const mnemonicLanguage = getMnemonicLanguage(yield* select(currentLanguageSelector)) let mnemonic: string = yield* call(generateMnemonic, mnemonicBitLength, mnemonicLanguage, bip39) diff --git a/src/web3/selectors.ts b/src/web3/selectors.ts index bc84f7df82f..ba46c30d9c9 100644 --- a/src/web3/selectors.ts +++ b/src/web3/selectors.ts @@ -20,5 +20,3 @@ export const currentAccountInWeb3KeystoreSelector = (state: RootState) => state.web3.accountInWeb3Keystore export const dataEncryptionKeySelector = (state: RootState) => state.web3.dataEncryptionKey export const isDekRegisteredSelector = (state: RootState) => state.web3.isDekRegistered -export const twelveWordMnemonicEnabledSelector = (state: RootState) => - state.web3.twelveWordMnemonicEnabled diff --git a/test/RootStateSchema.json b/test/RootStateSchema.json index 71b5595b536..84e805fb126 100644 --- a/test/RootStateSchema.json +++ b/test/RootStateSchema.json @@ -4394,9 +4394,6 @@ "null", "string" ] - }, - "twelveWordMnemonicEnabled": { - "type": "boolean" } }, "required": [ @@ -4404,8 +4401,7 @@ "accountInWeb3Keystore", "dataEncryptionKey", "isDekRegistered", - "mtwAddress", - "twelveWordMnemonicEnabled" + "mtwAddress" ], "type": "object" }, diff --git a/test/schemas.ts b/test/schemas.ts index ff2e1651429..6a6bddd73d5 100644 --- a/test/schemas.ts +++ b/test/schemas.ts @@ -3121,6 +3121,15 @@ export const v196Schema = { }, } +export const v197Schema = { + ...v196Schema, + _persist: { + ...v196Schema._persist, + version: 197, + }, + web3: _.omit(v196Schema.web3, 'twelveWordMnemonicEnabled'), +} + export function getLatestSchema(): Partial { - return v196Schema as Partial + return v197Schema as Partial }