Using the WalletConnector instance provided by useDynamicContext, you have two useful methods for network switching

supportsNetworkSwitching(): booleanwhether the connector supports network switching.
switchNetwork({ networkChainId, networkName }: { networkChainId?: number; networkName?: string; }): Promise<void>switch to another network by provider either the network name or chain id specified in the list of EvmNetwork

When calling switchNetwork with a connector supporting network switching, the SDK will either request the user to confirm the network switch or add the network if it was not previously set.


const { walletConnector } = useDynamicContext();

if (walletConnector.supportsNetworkSwitching()) {
  await walletConnector.switchNetwork({ networkChainId: 137 });
  console.log("Success! Network switched");