You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My users can switch between chains (e.g., BSC → Polygon) via a dropdown before deposit.
I use switchChainAsync({ chainId }) in the onSubmit of a form.
📱 Issue on MetaMask Mobile (via WalletConnect)
When calling switchChainAsync({ chainId }) on mobile with WalletConnect + MetaMask, I get an error:
This happens before the user even taps “Open MetaMask” in the WalletConnect modal (i.e., before the DApp has control again).
This behavior does not happen on desktop browsers.
And i saw the same issue on #4600 but it's closed with no solution.
✅ What I tried
Verified chain ID is valid and matches the dropdown selection.
Checked getAccount(wagmiConfig).connector.id === 'walletConnect'
Waited for getWalletClient() before calling switchChainAsync (no effect).
Tried delay/wait but issue persists.
Confirmed that MetaMask is already unlocked and on BSC.
🧠 Expected
I expect switchChainAsync to trigger the WalletConnect request → then user switches network in MetaMask → then returns control.
Currently, it fails before that can happen.
ℹ️ Questions
Is this a known limitation on WalletConnect + mobile?
Is there a workaround or correct way to wait for walletClient readiness before calling switchChainAsync()?
Do I need to defer the switch until user re-opens the dApp from MetaMask?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🧩 Context
I'm building a deposit flow using:
[email protected]
[email protected]
@web3modal/[email protected]
My users can switch between chains (e.g., BSC → Polygon) via a dropdown before deposit.
I use switchChainAsync({ chainId }) in the onSubmit of a form.
📱 Issue on MetaMask Mobile (via WalletConnect)
When calling switchChainAsync({ chainId }) on mobile with WalletConnect + MetaMask, I get an error:
This happens before the user even taps “Open MetaMask” in the WalletConnect modal (i.e., before the DApp has control again).
This behavior does not happen on desktop browsers.
And i saw the same issue on #4600 but it's closed with no solution.
✅ What I tried
Verified chain ID is valid and matches the dropdown selection.
Checked getAccount(wagmiConfig).connector.id === 'walletConnect'
Waited for getWalletClient() before calling switchChainAsync (no effect).
Tried delay/wait but issue persists.
Confirmed that MetaMask is already unlocked and on BSC.
🧠 Expected
I expect switchChainAsync to trigger the WalletConnect request → then user switches network in MetaMask → then returns control.
Currently, it fails before that can happen.
ℹ️ Questions
Beta Was this translation helpful? Give feedback.
All reactions