Switch Network from Polygon To Solana

Hi!

I am using @web3auth/no-modal-react-hooks and I need to implement a switch from Polygon to Solana, as my application supports multichain. However, when I click on

<button onClick={() => addAndSwitchChain(solanaTestnetChainConfig)}>
  Add and Switch Chain
</button>
const solanaTestnetChainConfig: CustomChainConfig = {
  chainNamespace: CHAIN_NAMESPACES.SOLANA,
  chainId: "0x2", 
  rpcTarget: "",
  displayName: "Solana TestNet",
  blockExplorerUrl: "",
  ticker: "SOL",
  tickerName: "Solana",
};

I get an error: undefined, This adapter doesn’t support this chainNamespace. WalletOperationsError: undefined, This adapter doesn’t support this chainNamespace.
Question: How can I switch from Polygon to Solana?

My Web3AuthProviderConfig

const privateKeyProvider = new EthereumPrivateKeyProvider({
  config: {
    chainConfig: {
  chainNamespace: CHAIN_NAMESPACES.EIP155,
  chainId: "0x13882",
  rpcTarget: mumbaiRpcUrl,
  blockExplorerUrl: "",
  displayName: "Polygon Testnet",
  ticker: "MATIC",
  tickerName: "Matic",
},
  },
});
const web3AuthOptions: IWeb3AuthCoreOptions = {
  clientId,
  chainConfig: {
  chainNamespace: CHAIN_NAMESPACES.EIP155,
  chainId: "0x13882",
  rpcTarget: mumbaiRpcUrl,
  blockExplorerUrl: "",
  displayName: "Polygon Testnet",
  ticker: "MATIC",
  tickerName: "Matic",
},
  web3AuthNetwork: "sapphire_devnet",
  privateKeyProvider,
};
const openloginAdapter = new OpenloginAdapter({
  privateKeyProvider: privateKeyProvider,
  adapterSettings: {
    loginConfig: {
      google: {
       ....
      },
    },
  },
});
const web3AuthContextConfig = {
  web3AuthOptions,
  adapters: [openloginAdapter],
};

Versions:

"@web3auth/base": "^8.6.2",
    "@web3auth/ethereum-provider": "^8.6.2",
    "@web3auth/no-modal": "^8.6.2",
    "@web3auth/no-modal-react-hooks": "^8.6.2",
    "@web3auth/openlogin-adapter": "^8.6.2",
    "@web3auth/solana-provider": "^8.6.2",

hi @dev.amsets

Thanks for reporting this issue. Let me try to reproduce it and get back to you.

Do you have any updates?

Hey @dev.amsets, sorry for the delays. Switch chain doesn’t support changing chains to cross ecosystem from EVM to Solana since you are using the EthereumPrivateKeyProvider.

You can checkout our Multi-chain example on how to achieve it, giving a short summary, you’ll have to maintain different instances of Private key providers, and setup private key yourself for provider. You can check example for more details.