Skip to content

Commit 4f8575b

Browse files
committed
fix: Remove unnecessary logic (switchNetwork)
1 parent a2826ed commit 4f8575b

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

packages/sdk/src/core/__tests__/providers/switch-network.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,6 @@ describe('GnoWalletProvider.switchNetwork', () => {
5757
expect(provider['setNetwork']).not.toHaveBeenCalled();
5858
});
5959

60-
// Validation on provider connection failure
61-
it('should return NOT_CONNECTED when provider connection fails', async () => {
62-
const options: SwitchNetworkOptions = {
63-
chainId: 'test-chain-1',
64-
};
65-
66-
jest.spyOn(provider as unknown as { connectProvider(): boolean }, 'connectProvider').mockReturnValue(false);
67-
68-
const response = await provider.switchNetwork(options);
69-
70-
expect(response).toEqual(makeResponseMessage(WalletResponseFailureType.NOT_CONNECTED));
71-
expect(provider['setNetwork']).toHaveBeenCalledWith(mockNetworks[0]);
72-
});
73-
7460
// Validate a normal network transition
7561
it('should successfully switch network', async () => {
7662
const options: SwitchNetworkOptions = {
@@ -81,7 +67,6 @@ describe('GnoWalletProvider.switchNetwork', () => {
8167

8268
expect(response).toEqual(makeResponseMessage(WalletResponseSuccessType.SWITCH_NETWORK_SUCCESS));
8369
expect(provider['setNetwork']).toHaveBeenCalledWith(mockNetworks[0]);
84-
expect(provider['connectProvider']).toHaveBeenCalled();
8570
});
8671

8772
// Validate network change callback calls

packages/sdk/src/providers/gno-wallet/gno-wallet.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,6 @@ export class GnoWalletProvider implements TM2WalletProvider {
131131

132132
this.setNetwork(network);
133133

134-
const connected = this.connectProvider();
135-
if (!connected) {
136-
return makeResponseMessage(WalletResponseFailureType.NOT_CONNECTED);
137-
}
138-
139134
return makeResponseMessage(WalletResponseSuccessType.SWITCH_NETWORK_SUCCESS);
140135
}
141136

0 commit comments

Comments
 (0)