diff --git a/android/.project b/android/.project index 01fcd9b83dea..3cf8618bf4c1 100644 --- a/android/.project +++ b/android/.project @@ -14,15 +14,4 @@ org.eclipse.buildship.core.gradleprojectnature - - - 1727268192852 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs index e479558406c2..e8895216fd3c 100644 --- a/android/.settings/org.eclipse.buildship.core.prefs +++ b/android/.settings/org.eclipse.buildship.core.prefs @@ -1,13 +1,2 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) connection.project.dir= eclipse.preferences.version=1 -gradle.user.home= -java.home= -jvm.arguments= -offline.mode=false -override.workspace.settings=false -show.console.view=false -show.executions.view=false diff --git a/app/component-library/components-temp/ListItemMultiSelectButton/ListItemMultiSelectButton.tsx b/app/component-library/components-temp/ListItemMultiSelectButton/ListItemMultiSelectButton.tsx index 0c459067e349..3860990db0f4 100644 --- a/app/component-library/components-temp/ListItemMultiSelectButton/ListItemMultiSelectButton.tsx +++ b/app/component-library/components-temp/ListItemMultiSelectButton/ListItemMultiSelectButton.tsx @@ -13,7 +13,6 @@ import styleSheet from './ListItemMultiSelectButton.styles'; import { ListItemMultiSelectButtonProps } from './ListItemMultiSelectButton.types'; import { BUTTON_TEST_ID, - BUTTON_TEXT_TEST_ID, DEFAULT_LISTITEMMULTISELECT_GAP, } from './ListItemMultiSelectButton.constants'; import ButtonIcon from '../../../component-library/components/Buttons/ButtonIcon'; diff --git a/app/components/Views/MultiRpcModal/__snapshots__/MultiRpcModal.test.tsx.snap b/app/components/Views/MultiRpcModal/__snapshots__/MultiRpcModal.test.tsx.snap index 8bf4ed85cadc..69796a34b9ef 100644 --- a/app/components/Views/MultiRpcModal/__snapshots__/MultiRpcModal.test.tsx.snap +++ b/app/components/Views/MultiRpcModal/__snapshots__/MultiRpcModal.test.tsx.snap @@ -719,7 +719,6 @@ exports[`MultiRpcModal render matches snapshot 1`] = ` "paddingHorizontal": 16, } } - testID="button-text-select-test-id" > { isReadOnly: false, }); - const onRpcSelect = (clientId) => { + const onRpcSelect = (clientId: string) => { const { NetworkController } = Engine.context; NetworkController.setActiveNetwork(clientId); @@ -426,7 +426,6 @@ const NetworkSelector = () => { onLongPress={() => { openModal(chainId, false, MAINNET, true); }} - id={chainId} /> ); }; diff --git a/app/store/migrations/054.test.ts b/app/store/migrations/054.test.ts index b31dd700456d..658a7086eb09 100644 --- a/app/store/migrations/054.test.ts +++ b/app/store/migrations/054.test.ts @@ -148,13 +148,15 @@ describe(`migration #${version}`, () => { const defaultStateToExpect = defaultPostMigrationState(); const expectedNetwork = { ...defaultStateToExpect.networkConfigurationsByChainId[ - customNetwork.chainId + customNetwork.chainId as keyof typeof defaultStateToExpect.networkConfigurationsByChainId ], }; expectedNetwork.defaultRpcEndpointIndex = expectedNetwork.rpcEndpoints.push({ networkClientId: customNetwork.id, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-expect-error name: customNetwork.nickname, url: customNetwork.rpcUrl, type: 'custom', @@ -244,14 +246,6 @@ describe(`migration #${version}`, () => { customNetwork.rpcPrefs.blockExplorerUrl, ) - 1; - // const expectedState = { - // ...defaultStateToExpect, - // networkConfigurationsByChainId: { - // ...defaultStateToExpect.networkConfigurationsByChainId, - // [customNetwork.chainId]: expectedNetwork, - // }, - // }; - const expectedState = { ...defaultStateToExpect, // Selected network shouldn't change @@ -264,8 +258,6 @@ describe(`migration #${version}`, () => { }, }; - console.log('expectedState -----', expectedState); - const newState = (await migrate(oldState)) as EngineState; expect(newState.engine.backgroundState.NetworkController).toStrictEqual( expectedState, @@ -309,7 +301,7 @@ describe(`migration #${version}`, () => { }, }; - const newState = await migrate(oldState); + const newState = (await migrate(oldState)) as EngineState; const { networkConfigurationsByChainId } = newState.engine.backgroundState .NetworkController as { @@ -350,7 +342,7 @@ describe(`migration #${version}`, () => { }, }; - const newState = await migrate(oldState); + const newState = (await migrate(oldState)) as EngineState; // Expect the configuration with an invalid URL to be omitted expect(newState.engine.backgroundState.NetworkController).toStrictEqual( @@ -371,7 +363,7 @@ describe(`migration #${version}`, () => { }, }; - const newState = await migrate(oldState); + const newState = (await migrate(oldState)) as EngineState; // selectedNetworkClientId should fall back to mainnet expect(newState.engine.backgroundState.NetworkController).toStrictEqual( diff --git a/app/store/migrations/054.ts b/app/store/migrations/054.ts index 94375fd83576..b55387019e55 100644 --- a/app/store/migrations/054.ts +++ b/app/store/migrations/054.ts @@ -1,8 +1,10 @@ +/* eslint-disable import/no-namespace */ import { captureException } from '@sentry/react-native'; import { TransactionControllerState, TransactionMeta, } from '@metamask/transaction-controller'; +// eslint-disable-next-line import/no-extraneous-dependencies import * as URI from 'uri-js'; import { SelectedNetworkControllerState } from '@metamask/selected-network-controller'; import { hasProperty, isObject, RuntimeObject } from '@metamask/utils'; @@ -18,7 +20,6 @@ export const version = 54; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function addBuiltInInfuraNetworks(networkConfigurations: any[]) { - console.log('Adding built-in Infura networks...'); return [ { type: 'infura', @@ -69,15 +70,10 @@ function isValidUrl(url: string) { } export default function migrate(state: unknown) { - console.log('Starting migration...'); - if (!ensureValidState(state, 54)) { - console.log('State is not valid for migration 54, exiting...'); return state; } - console.log('State is valid. Proceeding with migration...'); - const networkControllerState = state.engine?.backgroundState?.NetworkController; const transactionControllerState = state.engine?.backgroundState @@ -86,7 +82,6 @@ export default function migrate(state: unknown) { ?.SelectedNetworkController as SelectedNetworkControllerState; if (!isObject(networkControllerState)) { - console.log('Error: Invalid NetworkController state.'); captureException( new Error( `FATAL ERROR: Migration ${version}: Invalid NetworkController state error: '${typeof networkControllerState}'`, @@ -96,7 +91,6 @@ export default function migrate(state: unknown) { } if (!isObject(transactionControllerState)) { - console.log('Error: Invalid TransactionController state.'); captureException( new Error( `FATAL ERROR: Migration ${version}: Invalid TransactionController state error: '${typeof transactionControllerState}'`, @@ -105,22 +99,17 @@ export default function migrate(state: unknown) { return state; } - console.log('Extracted NetworkController and TransactionController states.'); - const networkState = networkControllerState; // Get custom network configurations or default to an empty array - console.log('Fetching custom network configurations...'); let networkConfigurations = isObject(networkState.networkConfigurations) ? Object.values(networkState.networkConfigurations) : []; // Add built-in Infura networks - console.log('Adding built-in Infura networks...'); networkConfigurations = addBuiltInInfuraNetworks(networkConfigurations); // Group the network configurations by chain id - console.log('Grouping network configurations by chain ID...'); const networkConfigurationArraysByChainId = networkConfigurations.reduce( (acc: Record, networkConfiguration) => { if ( @@ -134,10 +123,7 @@ export default function migrate(state: unknown) { {}, ); - console.log('Network configurations grouped by chain ID.'); - // Get transaction history in reverse chronological order to help with tie breaks - console.log('Fetching transaction history...'); const transactions: RuntimeObject[] = Array.isArray( transactionControllerState.transactions, ) @@ -151,15 +137,10 @@ export default function migrate(state: unknown) { .sort((a, b) => b.time - a.time) : []; - console.log('Transaction history fetched and sorted.'); - // For each chain id, merge the array of network configurations - console.log('Merging network configurations by chain ID...'); const networkConfigurationsByChainId = Object.entries( networkConfigurationArraysByChainId, ).reduce((acc: Record, [chainId, networks]) => { - console.log(`Processing chain ID: ${chainId}`); - // Calculate the tie breaker network, whose values will be preferred let tieBreaker: RuntimeObject | undefined; @@ -170,9 +151,6 @@ export default function migrate(state: unknown) { // Otherwise use the network that was most recently transacted on if (!tieBreaker) { - console.log( - `No selected network found, using most recent transaction for chain ID: ${chainId}`, - ); transactions .filter((tx) => tx.chainId === chainId) .some( @@ -186,14 +164,10 @@ export default function migrate(state: unknown) { // If no transactions were found for the chain id, fall back // to an arbitrary custom network that is not built in Infura if (!tieBreaker) { - console.log( - `No transactions found for chain ID: ${chainId}, using a custom network if available.`, - ); tieBreaker = networks.find((network) => network.type !== 'infura'); } // Calculate the unique set of valid rpc endpoints for this chain id - console.log(`Calculating valid RPC endpoints for chain ID: ${chainId}...`); const rpcEndpoints = networks.reduce( (endpoints: RuntimeObject[], network) => { if ( @@ -248,9 +222,6 @@ export default function migrate(state: unknown) { // If there were no valid unique endpoints, omit the network configuration if (rpcEndpoints.length === 0) { - console.log( - `No valid RPC endpoints found for chain ID: ${chainId}, skipping...`, - ); return acc; } @@ -263,10 +234,6 @@ export default function migrate(state: unknown) { 0, ); - console.log( - `Default RPC endpoint index for chain ID ${chainId}: ${defaultRpcEndpointIndex}`, - ); - // Calculate the unique array of non-empty block explorer urls const blockExplorerUrls = [ ...networks.reduce((urls, network) => { @@ -295,10 +262,6 @@ export default function migrate(state: unknown) { 0, ); - console.log( - `Default block explorer URL index for chain ID ${chainId}: ${defaultBlockExplorerUrlIndex}`, - ); - const name = networks.find((n) => n.nickname)?.nickname; const nativeCurrency = tieBreaker?.ticker ?? networks.find((n) => n.ticker)?.ticker; @@ -314,14 +277,10 @@ export default function migrate(state: unknown) { name, nativeCurrency, }; - console.log(`Finished processing chain ID ${chainId}.`); return acc; }, {}); - console.log('Finished merging network configurations by chain ID.'); - // Given a network client id, returns the chain id it used to point to - console.log('Mapping network client IDs to chain IDs...'); const networkClientIdToChainId = (networkClientId: unknown) => { const networkConfiguration = networkConfigurations.find( (n) => isObject(n) && n.id === networkClientId, @@ -334,7 +293,6 @@ export default function migrate(state: unknown) { // Ensure that selectedNetworkClientId points to // some endpoint of some network configuration. - console.log('Ensuring selected network client ID is valid...'); let selectedNetworkClientId = Object.values(networkConfigurationsByChainId) .flatMap((n) => isObject(n) && Array.isArray(n.rpcEndpoints) ? n.rpcEndpoints : [], @@ -345,9 +303,6 @@ export default function migrate(state: unknown) { // If not valid, try to fallback to the default endpoint for the same chain if (!selectedNetworkClientId) { - console.log( - `Selected network client ID is invalid, trying to fallback to default endpoint...`, - ); const chainId = networkClientIdToChainId( networkState.selectedNetworkClientId, ); @@ -366,10 +321,7 @@ export default function migrate(state: unknown) { : 'mainnet'; } - console.log(`Selected network client ID: ${selectedNetworkClientId}`); - // Redirect domains in the selected network controller - console.log('Redirecting domains in the SelectedNetworkController...'); if ( hasProperty(state.engine.backgroundState, 'SelectedNetworkController') && isObject(state.engine.backgroundState.SelectedNetworkController) && @@ -404,20 +356,13 @@ export default function migrate(state: unknown) { // Point the domain to the chain's default rpc endpoint if (newNetworkClientId) { - console.log( - `Redirecting domain ${domain} to network client ID ${newNetworkClientId}`, - ); selectedNetworkController.domains[domain] = newNetworkClientId; } else { - console.log( - `Removing domain ${domain} due to invalid network client ID.`, - ); delete selectedNetworkController.domains[domain]; } } } - console.log('Updating NetworkController state...'); state.engine.backgroundState.NetworkController = { selectedNetworkClientId, networkConfigurationsByChainId, @@ -425,7 +370,6 @@ export default function migrate(state: unknown) { }; // Set `showMultiRpcModal` based on whether there are any networks with multiple rpc endpoints - console.log('Checking for networks with multiple RPC endpoints...', state); if ( hasProperty(state.engine.backgroundState, 'PreferencesController') && isObject(state.engine.backgroundState.PreferencesController) && @@ -435,7 +379,6 @@ export default function migrate(state: unknown) { ) && isObject(state.engine.backgroundState.PreferencesController.preferences) ) { - console.log('SALIM IS HERE ----------'); state.engine.backgroundState.PreferencesController.preferences.showMultiRpcModal = Object.values(networkConfigurationsByChainId).some( (networkConfiguration) => @@ -446,7 +389,6 @@ export default function migrate(state: unknown) { } // Migrate the user's drag + drop preference order for the network menu - console.log('Migrating NetworkOrderController...'); if ( hasProperty(state.engine.backgroundState, 'NetworkOrderController') && isObject(state.engine.backgroundState.NetworkOrderController) && @@ -463,7 +405,6 @@ export default function migrate(state: unknown) { ].map((networkId) => ({ networkId })); } - console.log('Migration completed.'); // Return the modified state return state; }