The active network id is the id that the Dynamic SDK uses to identify the active network of a wallet account. For EVM wallets, it will be the same as the chain id (e.g: 1, 137, 56, etc). For other chains, it will an internal id used in Dynamic. To switch the active network, you can use the switchActiveNetwork function.

Usage

import { switchActiveNetwork } from '@dynamic-labs-sdk/client';

const switchNetwork = async () => {
    // Replace with the network id you want to switch to
  await switchActiveNetwork({ walletAccount, networkId: '1' });
}

Error Handling

If the wallet provider does not support network switching, the function will throw an NetworkSwitchingUnavailableError error. You can check if the wallet provider supports network switching by calling the isProgrammaticNetworkSwitchAvailable function.