Repository navigation
Conversation
When the wallet does not know Sepolia, wallet_switchEthereumChain returns 4902 and the client falls back to wallet_addEthereumChain. That call failed in both places that use it. The wrong-network prompt in App.js sent a malformed parameter that only held a nested chainId, so wallets rejected it. It now sends the same fields as Header.js, read from NETWORKS_INGAME.SEPOLIA. The Sepolia rpcUrl pointed to rpc.sepolia.org, which no longer responds, so wallets refused to add the network from the dropdown too. It now points to the publicnode Sepolia endpoint.
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I confirm that I have read and hereby agree to the OpenZeppelin Contributor License Agreement |
Author
|
recheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the connected wallet does not know Sepolia yet, switching to Sepolia fails with
Can't add nor switch to the selected networkin the console.wallet_switchEthereumChainreturns
4902, and the follow-upwallet_addEthereumChaincall fails for two reasons:client/src/containers/App.js(switchToSepolia, used by the wrong-network prompt) sends amalformed parameter:
{ chainId: [{ chainId }] }, withoutchainName,rpcUrlsornativeCurrency. Wallets reject this request.client/src/constants.jssets the SepoliarpcUrltohttps://rpc.sepolia.org, which nolonger responds (
eth_chainIdreturns HTTP 404). This URL is used by the network dropdown inHeader.js. Wallets check the RPC before they add a network, so this request fails too.Changes
App.js: build thewallet_addEthereumChainparameter fromNETWORKS_INGAME.SEPOLIA, with thesame fields that
Header.jsalready sends.constants.js: change the SepoliarpcUrltohttps://ethereum-sepolia-rpc.publicnode.com.Holesky already uses a publicnode endpoint. If you prefer a different public RPC, I am happy to
change it.
Verification
eth_chainIdonhttps://rpc.sepolia.org: HTTP 404.eth_chainIdonhttps://ethereum-sepolia-rpc.publicnode.com:0xaa36a7(11155111).