Skip to content

fix: repair the Sepolia add-network request and replace the dead RPC - #865

Open
afrijaldz wants to merge 1 commit into
OpenZeppelin:masterfrom
afrijaldz:fix/sepolia-add-network
Open

afrijaldz wants to merge 1 commit into
OpenZeppelin:masterfrom
afrijaldz:fix/sepolia-add-network

Conversation

@afrijaldz

Copy link
Copy Markdown

Problem

When the connected wallet does not know Sepolia yet, switching to Sepolia fails with
Can't add nor switch to the selected network in the console. wallet_switchEthereumChain
returns 4902, and the follow-up wallet_addEthereumChain call fails for two reasons:

  1. client/src/containers/App.js (switchToSepolia, used by the wrong-network prompt) sends a
    malformed parameter: { chainId: [{ chainId }] }, without chainName, rpcUrls or
    nativeCurrency. Wallets reject this request.
  2. client/src/constants.js sets the Sepolia rpcUrl to https://rpc.sepolia.org, which no
    longer responds (eth_chainId returns HTTP 404). This URL is used by the network dropdown in
    Header.js. Wallets check the RPC before they add a network, so this request fails too.

Changes

  • App.js: build the wallet_addEthereumChain parameter from NETWORKS_INGAME.SEPOLIA, with the
    same fields that Header.js already sends.
  • constants.js: change the Sepolia rpcUrl to https://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_chainId on https://rpc.sepolia.org: HTTP 404.
  • eth_chainId on https://ethereum-sepolia-rpc.publicnode.com: 0xaa36a7 (11155111).
  • Not run: the client build, lint, and a manual test of the add-network flow in a wallet.

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.
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@afrijaldz

Copy link
Copy Markdown
Author

I confirm that I have read and hereby agree to the OpenZeppelin Contributor License Agreement

@afrijaldz

Copy link
Copy Markdown
Author

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant