Describe the bug
Unable to switch chain ID using wagmi's useSwitchNetwork
Steps
- Set up config like in the wagmi connector docs example with base and baseSepolia chains*
- Connect wallet as shown in the docs example
- Call
switchChain to baseSepolia.id (assuming we are connected to base mainnet)
- Log
chainId in the console using useChainId hook to confirm chain ID has not switched.
I've created a reproducible example here: https://github.com/mrosendin/smart-wallet-expo-switchChain
*I've installed client v0.1.1 and wagmi-connectors v1.0.0 and appChainIds property in the metadata object for createConnectorFromWallet is not recognized, so I removed it. Here's the error message:
Object literal may only specify known properties, and 'appChains' does not exist in type 'StrictOmit<AppMetadata, "appChainIds">'.
This error msg is at odds with the docs example.
Expected behavior
Connector switches chain and useChainId returns the updated chain ID.
The chain ID will switch only after a hard refresh in Expo Go
Version
client v0.1.1, wagmi-connectors v1.0.0
Additional info
No response
Desktop
No response
Smartphone
- Device: iPhone 13
- OS: iOS 17.6.1
Describe the bug
Unable to switch chain ID using wagmi's useSwitchNetwork
Steps
switchChainto baseSepolia.id (assuming we are connected to base mainnet)chainIdin the console usinguseChainIdhook to confirm chain ID has not switched.I've created a reproducible example here: https://github.com/mrosendin/smart-wallet-expo-switchChain
*I've installed client v0.1.1 and wagmi-connectors v1.0.0 and
appChainIdsproperty in the metadata object forcreateConnectorFromWalletis not recognized, so I removed it. Here's the error message:This error msg is at odds with the docs example.
Expected behavior
Connector switches chain and
useChainIdreturns the updated chain ID.The chain ID will switch only after a hard refresh in Expo Go
Version
client v0.1.1, wagmi-connectors v1.0.0
Additional info
No response
Desktop
No response
Smartphone