[bug] switchNetwork() fails to switch between Solana and EVM networks for multi-chain wallets
Link to minimal reproducible example
https://github.com/your-username/appkit-switch-network-bug-demo Instructions: 1. Clone the repository 2. Run npm install 3. Run npm run dev 4. Connect Phantom wallet to Solana 5. Try switching to Ethereum network 6. Observe address becomes undefined
Steps to Reproduce
- Connect a multi-chain wallet (Phantom/OKX) to Solana network
- Successfully login and verify address is available
- Call
switchNetwork(mainnet)to switch to Ethereum - Check
useAppKitAccount().address- it becomesundefined - Check
useAppKitNetwork()- network state doesn't update properly - Wallet appears disconnected despite successful switch call
Summary
Expected Behavior:
-
switchNetwork()should seamlessly switch between Solana and EVM networks - Wallet address should remain available after network switch
- Network state (
caipNetworkId,chainId) should update correctly - Multi-chain wallets should maintain connection across different network types
Actual Behavior:
- Address becomes
undefinedafter switching from Solana to EVM - Network state shows inconsistent values (still shows Solana values)
- Wallet appears disconnected despite successful
switchNetwork()call - Only works when disconnecting and reconnecting manually
Affected Platforms:
- Chrome, Safari, Firefox
- Multi-chain wallets: Phantom, OKX
- Networks: Solana ↔ Ethereum, Solana ↔ Polygon, etc.
Code Example:
const { address } = useAppKitAccount();
const { switchNetwork } = useAppKitNetwork();
// Before switch: Solana
console.log(address); // "D2WpEKRSQ3tSHzsTVtm1BS5FiGnpapN5u9qsVFtRX86D"
await switchNetwork(mainnet); // Switch to Ethereum
// After switch: EVM
console.log(address); // undefined ❌
Logs:
List of related npm package versions
- @reown/appkit: 1.8.6
- @reown/appkit-controllers: 1.8.6
- @reown/appkit-common: 1.8.6
- wagmi: 2.37.7
- viem: 2.37.7
- react: 18.2.0
- next: 14.0.0
Node.js Version
v18.17.0
Package Manager
pnpm 8.15.0
hi @cclion
Can you checks if it's working here ? https://appkit-web-examples-react-multichain.reown.com/
https://github.com/reown-com/appkit-web-examples/tree/main/react/react-multichain
Can you checks if it's working here ? https://appkit-web-examples-react-multichain.reown.com/
For me if u connect wallet on this demo u can switch between mainnet and solana but u couldnt switch between mainnet and arbitrum. Seems like during switch it call wrong rpc (https://rpc.walletconnect.org/v1/?chainId=solana... from network)?
For me if u connect wallet on this demo u can switch between mainnet and solana but u couldnt switch between mainnet and arbitrum. Seems like during switch it call wrong rpc (https://rpc.walletconnect.org/v1/?chainId=solana... from network)?
Same issue (with RPC endpoint) for transaction send if solana and evm configured. When Im trying to send transaction with WC wallet on evm network it will set chainId=solana