You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useChainId and useNetwork returning the wrong chainId and wrong network after switching networks with useSwitchNetwork when using web3auth wagmi connector
#111
useChainId and useNetwork returning the wrong chainId and wrong network after switching networks with useSwitchNetwork when using web3auth wagmi connector.
const{ chain }=useNetwork()const{ chains, error, pendingChainId, switchNetwork, status }=useSwitchNetwork()return(<div>{chain &&<div>Using{chain.name}</div>}
{chains.map((x)=>(<buttondisabled={!switchNetwork||x.id===chain?.id}key={x.id}onClick={()=>switchNetwork?.(x.id)}>Switchto{x.name}{status==='loading'&&x.id===pendingChainId&&'…'}</button>
))}<div>{error &&(error?.message??'Failed to switch')}</div></div>)
Expected behavior
After clicking the Switch to Ethereum button, the chain data should be Ethereum, and Using Goerli should be changed to Using Ethereum on the screen.
(The chain data obtained through useNetwork() should be the changed network data).
Describe the bug
useChainId and useNetwork returning the wrong chainId and wrong network after switching networks with useSwitchNetwork when using web3auth wagmi connector.
To Reproduce
Steps to reproduce the behavior:
web3auth-pnp-examples
(https://github.com/Web3Auth/web3auth-pnp-examples) repositoryCode
Expected behavior
After clicking the
Switch to Ethereum
button, the chain data should be Ethereum, andUsing Goerli
should be changed toUsing Ethereum
on the screen.(The chain data obtained through useNetwork() should be the changed network data).
Screenshots
https://imgur.com/5b0Am18
Note
If I use other connectors (provided by rainbowkit), it works fine, but if I use
web3auth-wagmi-connector
, it works abnormally.Device Info (please complete the following information):
"@web3auth/base": "^7.2.0",
"@web3auth/ethereum-provider": "^7.2.0",
"@web3auth/modal": "^7.2.0",
"@web3auth/openlogin-adapter": "^7.2.0",
"@web3auth/torus-wallet-connector-plugin": "^7.2.0",
"@web3auth/web3auth-wagmi-connector": "^5.0.1",
The text was updated successfully, but these errors were encountered: