Archived Content from Web3Auth Community
This topic was originally posted by phuochungdn1999 on 3/4/2024.
This content has been migrated from our previous community forum to preserve valuable discussions.
I have add new chain to current web3auth and call function to switch chain. After I switched chain, I call web3.provider to get new provider of switched chain. The web3.provider not updated for me to refresh the provider
- SDK Version: @web3auth/no-modal": "^7.3.1,
- Platform: Nextjs
add and switch chain
web3auth?.provider // return chainId 0x5
const newChain = {
chainId: "0x1",
rpcTarget: "https://rpc.ankr.com/eth",
displayName: "Ethereum Mainnet",
blockExplorer: "https://goerli.etherscan.io",
ticker: "ETH",
tickerName: "Ethereum",
chainNamespace: CHAIN_NAMESPACES.EIP155,
};
await web3auth?.addChain(newChain);
await web3auth?.switchChain({ chainId: "0x1" });
after switch chain, I get the provider and it doesnโt updated the provider with new chainId for me
web3auth?.provider // still response chainId 0x5