diff --git a/packages/assets-controllers/src/AssetsContractController.test.ts b/packages/assets-controllers/src/AssetsContractController.test.ts index 5c768a31e9..87917933fe 100644 --- a/packages/assets-controllers/src/AssetsContractController.test.ts +++ b/packages/assets-controllers/src/AssetsContractController.test.ts @@ -917,7 +917,7 @@ describe('AssetsContractController', () => { ); expect(balances[ERC20_SAI_ADDRESS]).toBeDefined(); - await network.setProviderType(NetworkType.sepolia); + await network.setActiveNetwork(NetworkType.sepolia); const noBalances = await assetsContract.getBalancesInSingleCall( ERC20_SAI_ADDRESS, diff --git a/packages/queued-request-controller/src/QueuedRequestMiddleware.test.ts b/packages/queued-request-controller/src/QueuedRequestMiddleware.test.ts index 4609f4ce16..35e54a7607 100644 --- a/packages/queued-request-controller/src/QueuedRequestMiddleware.test.ts +++ b/packages/queued-request-controller/src/QueuedRequestMiddleware.test.ts @@ -85,12 +85,6 @@ const buildMocks = ( mockAddRequest, ); - const mockSetProviderType = jest.fn().mockResolvedValue(true); - messenger.registerActionHandler( - 'NetworkController:setProviderType', - mockSetProviderType, - ); - const mockSetActiveNetwork = jest.fn().mockResolvedValue(true); messenger.registerActionHandler( 'NetworkController:setActiveNetwork', @@ -111,7 +105,6 @@ const buildMocks = ( enqueueRequest: mockEnqueueRequest, addRequest: mockAddRequest, setActiveNetwork: mockSetActiveNetwork, - setProviderType: mockSetProviderType, setNetworkClientIdForDomain: mockSetNetworkClientIdForDomain, }; }; @@ -379,37 +372,7 @@ describe('createQueuedRequestMiddleware', () => { expect(res.error).toStrictEqual(serializeError(rejected)); }); - it('uses setProviderType when the network is an infura one', async () => { - const messenger = buildMessenger(); - const middleware = createQueuedRequestMiddleware({ - messenger, - useRequestQueue: () => true, - }); - const mocks = buildMocks(messenger, { - getProviderConfig: jest.fn().mockReturnValue({ - chainId: '0x5', - }), - }); - - const req = { - ...requestDefaults, - method: 'eth_sendTransaction', - }; - - await new Promise((resolve, reject) => - middleware( - req, - {} as PendingJsonRpcResponse, - resolve, - reject, - ), - ); - - expect(mocks.setProviderType).toHaveBeenCalled(); - expect(mocks.setActiveNetwork).not.toHaveBeenCalled(); - }); - - it('uses setActiveNetwork when the network is a custom one', async () => { + it('switches the current active network', async () => { const messenger = buildMessenger(); const middleware = createQueuedRequestMiddleware({ messenger, @@ -451,7 +414,6 @@ describe('createQueuedRequestMiddleware', () => { ), ); - expect(mocks.setProviderType).not.toHaveBeenCalled(); expect(mocks.setActiveNetwork).toHaveBeenCalled(); }); }); diff --git a/packages/queued-request-controller/src/QueuedRequestMiddleware.ts b/packages/queued-request-controller/src/QueuedRequestMiddleware.ts index 2f6ad9794a..c143eb9927 100644 --- a/packages/queued-request-controller/src/QueuedRequestMiddleware.ts +++ b/packages/queued-request-controller/src/QueuedRequestMiddleware.ts @@ -9,7 +9,6 @@ import type { NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction, NetworkControllerSetActiveNetworkAction, - NetworkControllerSetProviderTypeAction, } from '@metamask/network-controller'; import { serializeError } from '@metamask/rpc-errors'; import type { SelectedNetworkControllerSetNetworkClientIdForDomainAction } from '@metamask/selected-network-controller'; @@ -22,7 +21,6 @@ import { QueuedRequestControllerActionTypes } from './QueuedRequestController'; export type MiddlewareAllowedActions = | NetworkControllerGetStateAction | NetworkControllerSetActiveNetworkAction - | NetworkControllerSetProviderTypeAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerFindNetworkClientIdByChainIdAction | SelectedNetworkControllerSetNetworkClientIdForDomainAction @@ -155,10 +153,8 @@ export const createQueuedRequestMiddleware = ({ true, ); - const method = isBuiltIn ? 'setProviderType' : 'setActiveNetwork'; - await messenger.call( - `NetworkController:${method}`, + `NetworkController:setActiveNetwork`, networkClientIdForRequest, );