[Archive] When switching networks with Wagmi

:classical_building: Archived Content from Web3Auth Community

This topic was originally posted by jh.koo on 12/18/2023.
This content has been migrated from our previous community forum to preserve valuable discussions.


SDK Version:
“@web3auth/ethereum-provider”: “^7.2.0”,
“@web3auth/modal”: “^7.2.0”,
“@web3auth/openlogin-adapter”: “^7.2.0”,
“@web3auth/wallet-connect-v2-adapter”: “^7.2.0”,
“@web3auth/web3auth-wagmi-connector”: “^5.0.1”,
“@web3modal/ethereum”: “2.6.2”,
“@web3modal/react”: “^2.6.2”,

I downloaded this.
(https://github.com/Web3Auth/web3auth-pnp-examples/tree/main/web-modal-sdk/wagmi-examples/wagmi-modal-example)

connected to injected with metamask

3
31306Ă—876 70.5 KB

connected to web3auth

2
21322Ă—898 71.5 KB

both successfully changed the network.

however, the chain name of web3auth has not been changed.

The same is true when i click Polygon Network.

isSuccess and data were added from useSwitchNetwork() and checked as logs.

@jh.koo Your issue has been forwarded to our Dev team and we will get back with an update…

@jh.koo Did you follow the steps in the previous thread ?

It was automatically resolved because I checked it late.

However, before using web3auth, I already used Wagmi to change my network.

So now I’ve tried to change the network using web3auth, but it keeps failing.

Hello @jh.koo,

I wanted to follow up on your query. Please have a look at the example provided here. After testing it locally, I can confirm that the useSwitchNetwork function operates seamlessly. It’s efficiently fetching and displaying the correct account addresses and balances for each chain when using injected MetaMask.

If you’re still encountering difficulties, could you please share more details about the issue? I’d be happy to assist further!

Thank you for checking

However, what I inquired about is not a meta mask, but if you log in (Google) with web3auth, there will be a problem.

If i try with a metamask, the network change succeeds.
If i try with web3auth, the network will not change.