EIPs
EIP-3085 — wallet_addEthereumChain
Asks the wallet to add a chain definition (chain ID, RPC URL, native currency, explorer) to its known-chain list. The user sees the proposal in a popup; on approval the chain becomes selectable.
import { wallet_add_ethereum_chain } from "@ethernauta/eip/3085";
await wallet_add_ethereum_chain({
chain_id: "0x2105",
chain_name: "Base",
native_currency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpc_urls: ["https://mainnet.base.org"],
block_explorer_urls: ["https://basescan.org"],
})(signer({ chain_id: eip155_1.chain_id })); Surface
| Export | Type | Purpose |
|---|---|---|
wallet_add_ethereum_chain | Signable<null> | Submit the chain proposal. |
AddEthereumChainParameter, AddEthereumChainParameters | types | Single + array shapes. |
| schemas for both above |
Why a dapp would call this
L2s, sidechains, and testnets that aren’t in the wallet’s built-in registry need to be added before they can be switched to with wallet_switchEthereumChain. The typical pattern: try wallet_switchEthereumChain first; on a 4902 unrecognized_chain error, fall through to wallet_addEthereumChain then retry the switch.
See also
- EIP-3326 — switch to an added chain.
- @ethernauta/chain — Ethernauta’s built-in registry.
- Wallet → add-chain view.