From 236d15bf64a5e5df5a12ac05447cf2fb6e1cf19e Mon Sep 17 00:00:00 2001 From: Kathy Luo Date: Fri, 16 Feb 2024 23:46:45 +0100 Subject: [PATCH] chore: remove unused walletConnectV1Enabled remote config (#4924) ### Description As the title ### Test plan n/a ### Related issues - Fixes RET-878 ### Backwards compatibility Y ### Network scalability If a new NetworkId and/or Network are added in the future, the changes in this PR will: - [x] Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added) --- src/app/reducers.ts | 3 --- src/app/saga.ts | 1 - src/app/selectors.ts | 1 - src/firebase/firebase.ts | 1 - src/firebase/remoteConfigValuesDefaults.e2e.ts | 1 - src/firebase/remoteConfigValuesDefaults.ts | 1 - src/redux/migrations.ts | 4 ++++ src/redux/store.test.ts | 3 +-- src/redux/store.ts | 2 +- src/walletConnect/saga.test.ts | 4 ++-- src/walletConnect/saga.ts | 3 +-- test/RootStateSchema.json | 4 ---- test/schemas.ts | 11 ++++++++++- 13 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/app/reducers.ts b/src/app/reducers.ts index 01e05361ca6..91a244293e6 100644 --- a/src/app/reducers.ts +++ b/src/app/reducers.ts @@ -22,7 +22,6 @@ export interface State { minVersion: string | null celoEducationUri: string | null activeScreen: Screens - walletConnectV1Enabled: boolean walletConnectV2Enabled: boolean superchargeApy: number superchargeTokenConfigByToken: SuperchargeTokenConfigByToken @@ -75,7 +74,6 @@ const initialState = { minVersion: null, celoEducationUri: null, activeScreen: Screens.Main, - walletConnectV1Enabled: REMOTE_CONFIG_VALUES_DEFAULTS.walletConnectV1Enabled, walletConnectV2Enabled: REMOTE_CONFIG_VALUES_DEFAULTS.walletConnectV2Enabled, superchargeApy: REMOTE_CONFIG_VALUES_DEFAULTS.superchargeApy, superchargeTokenConfigByToken: JSON.parse( @@ -207,7 +205,6 @@ export const appReducer = ( return { ...state, celoEducationUri: action.configValues.celoEducationUri, - walletConnectV1Enabled: action.configValues.walletConnectV1Enabled, walletConnectV2Enabled: action.configValues.walletConnectV2Enabled, superchargeApy: action.configValues.superchargeApy, superchargeTokenConfigByToken: action.configValues.superchargeTokenConfigByToken, diff --git a/src/app/saga.ts b/src/app/saga.ts index 62a483cfb1f..b0290ce9e1b 100644 --- a/src/app/saga.ts +++ b/src/app/saga.ts @@ -218,7 +218,6 @@ export interface RemoteConfigValues { celoEducationUri: string | null dappListApiUrl: string | null inviteRewardsVersion: string - walletConnectV1Enabled: boolean walletConnectV2Enabled: boolean logPhoneNumberTypeEnabled: boolean superchargeApy: number diff --git a/src/app/selectors.ts b/src/app/selectors.ts index 55f4ce20c9a..b1fcddd9b5e 100644 --- a/src/app/selectors.ts +++ b/src/app/selectors.ts @@ -30,7 +30,6 @@ export const numberVerifiedDecentrallySelector = (state: RootState) => state.app // this can be called with undefined state in the tests export const walletConnectEnabledSelector = (state?: RootState) => ({ - v1: state?.app.walletConnectV1Enabled ?? false, v2: state?.app.walletConnectV2Enabled ?? false, }) diff --git a/src/firebase/firebase.ts b/src/firebase/firebase.ts index fb193dfb755..b90f9890ea7 100644 --- a/src/firebase/firebase.ts +++ b/src/firebase/firebase.ts @@ -317,7 +317,6 @@ export async function fetchRemoteConfigValues(): Promise ({ + ...state, + app: _.omit(state.app, 'walletConnectV1Enabled'), + }), } diff --git a/src/redux/store.test.ts b/src/redux/store.test.ts index ca0f2513479..7ca37dc7f0b 100644 --- a/src/redux/store.test.ts +++ b/src/redux/store.test.ts @@ -98,7 +98,7 @@ describe('store state', () => { { "_persist": { "rehydrated": true, - "version": 190, + "version": 191, }, "account": { "acceptedTerms": false, @@ -176,7 +176,6 @@ describe('store state', () => { "superchargeTokenConfigByToken": {}, "supportedBiometryType": null, "visualizeNFTsEnabledInHomeAssetsPage": false, - "walletConnectV1Enabled": true, "walletConnectV2Enabled": true, }, "dapps": { diff --git a/src/redux/store.ts b/src/redux/store.ts index 419811b2575..9682a3acec3 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: 190, + version: 191, keyPrefix: `reduxStore-`, // the redux-persist default is `persist:` which doesn't work with some file systems. storage: FSStorage(), blacklist: ['networkInfo', 'alert', 'imports', 'keylessBackup'], diff --git a/src/walletConnect/saga.test.ts b/src/walletConnect/saga.test.ts index ed95930764c..95e5986d308 100644 --- a/src/walletConnect/saga.test.ts +++ b/src/walletConnect/saga.test.ts @@ -660,7 +660,7 @@ describe('initialiseWalletConnect', () => { it('initializes v2 if enabled', async () => { await expectSaga(initialiseWalletConnect, v2ConnectionString, origin) .provide([ - [select(walletConnectEnabledSelector), { v1: true, v2: true }], + [select(walletConnectEnabledSelector), { v2: true }], [call(initialiseWalletConnectV2, v2ConnectionString, origin), {}], ]) .call(initialiseWalletConnectV2, v2ConnectionString, origin) @@ -669,7 +669,7 @@ describe('initialiseWalletConnect', () => { it('doesnt initialize v2 if disabled', async () => { await expectSaga(initialiseWalletConnect, v2ConnectionString, origin) - .provide([[select(walletConnectEnabledSelector), { v1: true, v2: false }]]) + .provide([[select(walletConnectEnabledSelector), { v2: false }]]) .not.call(initialiseWalletConnectV2, v2ConnectionString, origin) .run() }) diff --git a/src/walletConnect/saga.ts b/src/walletConnect/saga.ts index a4490953937..e851d6b5a64 100644 --- a/src/walletConnect/saga.ts +++ b/src/walletConnect/saga.ts @@ -841,9 +841,8 @@ export function* initialiseWalletConnectV2(uri: string, origin: WalletConnectPai export function* isWalletConnectEnabled(uri: string) { const { version } = parseUri(uri) - const { v1, v2 }: { v1: boolean; v2: boolean } = yield* select(walletConnectEnabledSelector) + const { v2 } = yield* select(walletConnectEnabledSelector) const versionEnabled: { [version: string]: boolean | undefined } = { - '1': v1, '2': v2, } return versionEnabled[version] ?? false diff --git a/test/RootStateSchema.json b/test/RootStateSchema.json index 1c878bb1056..ceafdcb4ab6 100644 --- a/test/RootStateSchema.json +++ b/test/RootStateSchema.json @@ -3166,9 +3166,6 @@ "visualizeNFTsEnabledInHomeAssetsPage": { "type": "boolean" }, - "walletConnectV1Enabled": { - "type": "boolean" - }, "walletConnectV2Enabled": { "type": "boolean" } @@ -3213,7 +3210,6 @@ "superchargeTokenConfigByToken", "supportedBiometryType", "visualizeNFTsEnabledInHomeAssetsPage", - "walletConnectV1Enabled", "walletConnectV2Enabled" ], "type": "object" diff --git a/test/schemas.ts b/test/schemas.ts index f80c5fae032..39adf69970c 100644 --- a/test/schemas.ts +++ b/test/schemas.ts @@ -3052,6 +3052,15 @@ export const v190Schema = { }, } +export const v191Schema = { + ...v190Schema, + _persist: { + ...v190Schema._persist, + version: 191, + }, + app: _.omit(v190Schema.app, 'walletConnectV1Enabled'), +} + export function getLatestSchema(): Partial { - return v190Schema as Partial + return v191Schema as Partial }