Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@frolic
Copy link
Contributor

@frolic frolic commented May 29, 2025

I noticed that connecting Rainbow wallet app via WalletConnect would fail for my local app when attempting to use the connected account, because Rainbow doesn't support adding networks. This appears to happen because the walletConnect connector calls switchChain inside getProvider, whereas other connectors appear to do their chain check and switchChain call inside of connect:

// Switch to chain if provided
// Switch to chain if provided
// Switch to chain if provided

For my app, I've set initialChainId to 0 to kinda bypass the chain switching step here, which works because my app only needs signatures from the connected wallet, regardless of the chain it's connected to.

I'm not really sure how to go about testing this change, but this PR aligns the switch chain logic across all connectors.

@vercel
Copy link

vercel bot commented May 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
wagmi Ready Ready Preview Comment Aug 26, 2025 10:52pm

@changeset-bot
Copy link

changeset-bot bot commented May 29, 2025

🦋 Changeset detected

Latest commit: c0a9149

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@wagmi/connectors Patch
wagmi Patch
@wagmi/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@frolic
Copy link
Contributor Author

frolic commented May 30, 2025

I forked this connector with these changes and I was able to connect without issues!

@frolic frolic changed the title switch chain on connect switch chain on connect in walletconnect connector May 30, 2025
@tmm tmm merged commit a03da81 into wevm:main Aug 26, 2025
7 of 12 checks passed
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

Successfully merging this pull request may close these issues.

2 participants