Add support for the Sepolia testnet alongside Ethereum mainnet: - New src/shared/networks.js with network definitions (mainnet + sepolia) including chain IDs, default RPC/Blockscout endpoints, and explorer URLs - State now tracks networkId; defaults to mainnet for backward compatibility - Network selector in Settings lets users switch between mainnet and Sepolia - Switching networks updates RPC URL, Blockscout URL, and chain ID - All hardcoded etherscan.io URLs replaced with dynamic explorer links from the current network config (sepolia.etherscan.io for Sepolia) - Background handles wallet_switchEthereumChain for both supported chains and broadcasts chainChanged events to connected dApps - Inpage provider fetches chain ID on init and updates dynamically via chainChanged events (no more hardcoded 0x1) - Blockscout API uses eth-sepolia.blockscout.com for Sepolia - Etherscan label/phishing checks use the correct explorer per network - Price fetching skipped on testnets (tokens have no real value) - RPC validation checks against the selected network's chain ID - getProvider() uses the correct ethers Network for Sepolia API endpoints verified: - Etherscan: sepolia.etherscan.io - Blockscout: eth-sepolia.blockscout.com/api/v2 - RPC: ethereum-sepolia-rpc.publicnode.com closes #110
This commit is contained in:
@@ -11,7 +11,12 @@ const {
|
||||
escapeHtml,
|
||||
truncateMiddle,
|
||||
} = require("./helpers");
|
||||
const { state, saveState, currentAddress } = require("../../shared/state");
|
||||
const {
|
||||
state,
|
||||
saveState,
|
||||
currentAddress,
|
||||
currentNetwork,
|
||||
} = require("../../shared/state");
|
||||
const {
|
||||
updateSendBalance,
|
||||
renderSendTokenSelect,
|
||||
@@ -82,7 +87,7 @@ function renderActiveAddress() {
|
||||
if (state.activeAddress) {
|
||||
const addr = state.activeAddress;
|
||||
const dot = addressDotHtml(addr);
|
||||
const link = `https://etherscan.io/address/${addr}`;
|
||||
const link = `${currentNetwork().explorerUrl}/address/${addr}`;
|
||||
el.innerHTML =
|
||||
`<span class="underline decoration-dashed cursor-pointer" id="active-addr-copy">${dot}${escapeHtml(addr)}</span>` +
|
||||
`<a href="${link}" target="_blank" rel="noopener" class="inline-flex items-center">${EXT_ICON}</a>`;
|
||||
|
||||
Reference in New Issue
Block a user