Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Switch chain ID #23

Open
mrosendin opened this issue Oct 28, 2024 · 0 comments
Open

Bug: Switch chain ID #23

mrosendin opened this issue Oct 28, 2024 · 0 comments

Comments

@mrosendin
Copy link

mrosendin commented Oct 28, 2024

Describe the bug

Unable to switch chain ID using wagmi's useSwitchNetwork

Steps

  1. Set up config like in the wagmi connector docs example with base and baseSepolia chains*
  2. Connect wallet as shown in the docs example
  3. Call switchChain to baseSepolia.id (assuming we are connected to base mainnet)
  4. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant