# \[Archive\] useSwitchChain() hook does not work

**URL:** <https://builder.metamask.io/t/archive-useswitchchain-hook-does-not-work/1002>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [July 9, 2025, 2:36pm UTC](https://builder.metamask.io/t/archive-useswitchchain-hook-does-not-work/1002 "2025-07-09T14:36:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonwayhuang](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@jonwayhuang](https://builder.metamask.io/u/jonwayhuang)\
**Post date:** [July 9, 2025, 2:36pm UTC](https://builder.metamask.io/t/archive-useswitchchain-hook-does-not-work/1002/1 "2025-07-09T14:36:03Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **jonwayhuang** on 7/9/2025.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

- **SDK Version** (package.json): latest
- **Platform** : React SDK

- made some edits but below should be accurate

Currently, Web3Auth’s `useSwitchChain()` hook imported from `@web3auth/modal/react` does not switch chain for web3Auth.accountAbstractionProvider. Therefore, you cannot set up multiple chains for Smart Accounts because `web3Auth.accountAbstractionProvider.smartAccount` and `web3Auth.accountAbstractionProvider.bundlerClient` will not use the updated chain.

A workaround is to create your own Smart Account and Bundler Client. That is, do not use Web3Auth’s native Smart Account. This method also allows you to use any Smart Account provider, so it doesn’t have to be MetaMask’s. I detailed the workaround here:

 ![](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/1X/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png)

```
  <a href="https://medium.com/@brianonchain/web3-debug-creating-a-multichain-smart-wallet-with-web3auth-to-make-gasless-erc-20-token-e0952288c294" target="_blank" rel="noopener nofollow ugc" title="11:55PM - 14 July 2025">Medium – 14 Jul 25</a>

```

### [Web3: Debug: Setting Up Multichain Smart Accounts When Using Web3Auth](https://medium.com/@brianonchain/web3-debug-creating-a-multichain-smart-wallet-with-web3auth-to-make-gasless-erc-20-token-e0952288c294)

Currently, Web3Auth’s useSwitchChain() hook imported from @web3auth/modal/react does not properly work. switchChain() successfully changes…

Reading time: 6 min read

---

<div class="post-metadata">

**Author:** ![w3abot](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@w3abot](https://builder.metamask.io/u/w3abot)\
**Post date:** [July 9, 2025, 2:37pm UTC](https://builder.metamask.io/t/archive-useswitchchain-hook-does-not-work/1002/2 "2025-07-09T14:37:28Z")

</div>

Thank you for your detailed report, @brianonchain! Here’s a summary of your issue for the support team:

* * *

### Issue Summary

- **SDK:** Web3Auth Plug and Play (PnP) Web SDK
- **SDK Version:** latest (from package.json)
- **Platform:** React (using `@web3auth/modal/react`)
- **Issue:**
  - The `useSwitchChain()` hook updates the Wagmi state (i.e., `useAccount().chain` reflects the correct chain after switching).
  - However, `web3Auth.provider.chain` (from `useWeb3Auth()`) does **not** update and remains on the old chain.
  - This causes issues with Smart Accounts, as `web3Auth.accountAbstractionProvider.smartAccount` and `web3Auth.accountAbstractionProvider.bundlerClient` do not use the updated chain.

- **Workaround:**
  - Manually creating your own Smart Account and Bundler Client works, as described in your [Medium article](https://medium.com/@brianonchain/web3-debug-creating-a-multichain-smart-wallet-with-web3auth-to-make-gasless-erc-20-token-e0952288c294).

* * *

### Additional Context

- You referenced the [Web3Auth documentation](https://web3auth.io/docs/sdk/web/js) and confirmed standard initialization.
- No custom authentication or JWT usage mentioned.
- No code snippets or screenshots provided, but the behavior is clearly described.

* * *

### Next Steps / Suggestions

- **For the Support Team:**

- **For the User:**

* * *

Thank you for your detailed feedback and for sharing your workaround with the community! If you have any additional details (such as code snippets or specific error messages), please feel free to add them here to assist the support team further.

**Related Docs:**

- [Web3Auth React Quick Start](https://web3auth.io/docs/sdk/web/react/quick-start)
- [Web3Auth Modal SDK Reference](https://web3auth.io/docs/sdk/web/modal/usage)

* * *

The support team will review this and follow up with you soon!

> Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

> Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. [Web3Auth Developer Office Hours](https://web3auth.io/community/t/web3auth-developer-office-hours/8777)

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [July 21, 2025, 4:34am UTC](https://builder.metamask.io/t/archive-useswitchchain-hook-does-not-work/1002/3 "2025-07-21T04:34:44Z")

</div>

Can you please try it with v10.0.05?
