Skip to content

fix(solana): sync walletProvider after switchNetwork for non-AUTH providers#5662

Open
Khizr97 wants to merge 2 commits into
chore/khizr-fixes-2from
chore/khizr-fixes-2-REOWN-4377
Open

fix(solana): sync walletProvider after switchNetwork for non-AUTH providers#5662
Khizr97 wants to merge 2 commits into
chore/khizr-fixes-2from
chore/khizr-fixes-2-REOWN-4377

Conversation

@Khizr97
Copy link
Copy Markdown
Contributor

@Khizr97 Khizr97 commented May 11, 2026

Summary

  • Solana adapter now emits switchNetwork for WalletConnect and standard wallet providers (previously only AUTH providers triggered this event)
  • Base-client switchNetwork handler now calls syncProvider() after syncAccount(), keeping useAppKitProvider reactive after network switches

Root Cause

useAppKitProvider reads from ProviderController.state.providers[namespace], which is only updated by syncProvider(). The Solana adapter's switchNetwork method only emitted the event for AUTH connectors (via super.switchNetwork()), leaving WC and standard wallet providers without a re-sync. The base-client handler also never called syncProvider() in the switchNetwork event path.

Test plan

  • New unit tests: WC provider emits switchNetwork event after network change
  • New unit tests: Standard wallet provider emits switchNetwork event after network change
  • New unit tests: No address → event not emitted
  • All 32 Solana adapter tests pass

Fixes: REOWN-4377

🤖 Generated with Claude Code

Khizr97 and others added 2 commits May 11, 2026 21:25
…viders

Solana adapter never emitted the 'switchNetwork' event for WalletConnect
and standard wallet providers, so the base client never called syncProvider
after a network switch. This caused useAppKitProvider to return a stale
provider reference when users switched Solana networks.

- Emit 'switchNetwork' from SolanaAdapter for non-AUTH providers after
  updating the connection, so the base client can re-sync provider state
- Call syncProvider in the base client's switchNetwork event handler to
  keep useAppKitProvider reactive on every network switch

Fixes REOWN-4377

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear Bot commented May 11, 2026

REOWN-4377

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

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

Project Deployment Actions Updated (UTC)
appkit-demo Ready Ready Preview, Comment May 11, 2026 4:45pm
appkit-gallery Ready Ready Preview, Comment May 11, 2026 4:45pm
appkit-headless-sample-app Ready Ready Preview, Comment May 11, 2026 4:45pm
appkit-laboratory Ready Ready Preview, Comment May 11, 2026 4:45pm
9 Skipped Deployments
Project Deployment Actions Updated (UTC)
appkit-basic-example Ignored Ignored May 11, 2026 4:45pm
appkit-basic-sign-client-example Ignored Ignored May 11, 2026 4:45pm
appkit-basic-up-example Ignored Ignored May 11, 2026 4:45pm
appkit-ethers5-bera Ignored Ignored May 11, 2026 4:45pm
appkit-nansen-demo Ignored Ignored May 11, 2026 4:45pm
appkit-wagmi-cdn-example Ignored Ignored May 11, 2026 4:45pm
ethereum-provider-wagmi-example Ignored Ignored May 11, 2026 4:45pm
next-wagmi-solana-bitcoin-example Ignored Ignored May 11, 2026 4:45pm
vue-wagmi-example Ignored Ignored May 11, 2026 4:45pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

🦋 Changeset detected

Latest commit: 6be85fc

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

This PR includes changesets to release 26 packages
Name Type
@reown/appkit-adapter-solana Patch
@reown/appkit Patch
@reown/appkit-cdn Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-tron Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit-universal-connector Patch
@reown/appkit-experimental Patch
@reown/appkit-testing Patch
@reown/appkit-common Patch
@reown/appkit-ui Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-polyfills Patch
@reown/appkit-wallet Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-wallet-button Patch
@reown/appkit-cli Patch
@reown/appkit-pay Patch
@reown/appkit-codemod 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

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