Successfully removed hardcoded Sepolia references throughout the ETH Shot codebase and made network configuration fully dynamic based on environment variables. The application now supports any Ethereum-compatible network by simply changing environment variables.
Changes:
- Added
NETWORK_CONFIGimport - Replaced hardcoded "Sepolia Testnet" with
NETWORK_CONFIG.NETWORK_NAME - Made testnet/mainnet notice dynamic based on
NETWORK_CONFIG.CHAIN_ID - Updated warning messages to use dynamic network name
Impact: Wallet connection UI now displays correct network name and appropriate notices for mainnet vs testnet.
Changes:
- Renamed
SEPOLIA_CONFIGtoNETWORK_WALLET_CONFIGfor generic network support - Made native currency name dynamic (shows "Ether" for mainnet, network-specific for testnets)
- Renamed
switchToSepolia()toswitchToNetwork()with backward compatibility alias - Updated
getTestnetInfo()to return different instructions for mainnet vs testnet - Added support for multiple networks in testnet info
Impact: Network switching and detection now works for any configured network, not just Sepolia.
Changes:
- Renamed
getEtherscanUrl()togetBlockExplorerUrl() - Uses
NETWORK_CONFIG.BLOCK_EXPLORER_URLinstead of hardcoded Sepolia explorer - Dynamic block explorer link text (shows "Etherscan" for mainnet, "Block Explorer" for others)
Impact: Admin panel transaction links now point to the correct block explorer for the configured network.
Changes:
- Added
getNetworkConfig()function to read network settings from environment - Dynamic network name and block explorer URL in console output
- Uses configured Hardhat network name instead of hardcoded "sepolia"
- Network-specific API key guidance in error messages
- Dynamic block explorer URLs in success/error messages
Impact: Contract verification script now works with any supported network based on environment variables.
VITE_CHAIN_ID=11155111
VITE_NETWORK_NAME="Sepolia Testnet"
VITE_RPC_URL="https://sepolia.infura.io/v3/YOUR_KEY"
VITE_BLOCK_EXPLORER_URL="https://sepolia.etherscan.io"VITE_CHAIN_ID=1
VITE_NETWORK_NAME="Ethereum Mainnet"
VITE_RPC_URL="https://mainnet.infura.io/v3/YOUR_KEY"
VITE_BLOCK_EXPLORER_URL="https://etherscan.io"VITE_CHAIN_ID=8453
VITE_NETWORK_NAME="Base Mainnet"
VITE_RPC_URL="https://mainnet.base.org"
VITE_BLOCK_EXPLORER_URL="https://basescan.org"✅ Network Detection Utility: Chain ID conversion and network name mapping work correctly ✅ Verification Script: Properly detects network configuration from environment variables ✅ Mainnet Configuration: Successfully loads mainnet settings (Chain ID: 1, Etherscan URLs) ✅ Sepolia Configuration: Maintains backward compatibility with existing testnet setup
-
Update Environment Variables:
VITE_CHAIN_ID=1 VITE_NETWORK_NAME="Ethereum Mainnet" VITE_RPC_URL="https://mainnet.infura.io/v3/YOUR_INFURA_KEY" VITE_BLOCK_EXPLORER_URL="https://etherscan.io" VITE_CONTRACT_ADDRESS="YOUR_MAINNET_CONTRACT_ADDRESS"
-
Update Hardhat Configuration:
- Ensure
hardhat.config.jshas proper mainnet configuration - Set
ETHERSCAN_API_KEYfor contract verification
- Ensure
-
Deploy Contract:
pnpm run deploy:mainnet
-
Verify Contract:
node scripts/verify-contract.js
-
Test Application:
- UI will automatically show "Ethereum Mainnet" instead of "Sepolia Testnet"
- Wallet connection prompts will reference mainnet
- Block explorer links will point to etherscan.io
- Admin panel will use mainnet explorer URLs
- All existing Sepolia configurations continue to work unchanged
switchToSepolia()function maintained as alias toswitchToNetwork()- Default values still point to Sepolia for development environments
- No breaking changes to existing API or component interfaces
- Network Agnostic: Single codebase supports any Ethereum-compatible network
- Easy Deployment: Switch networks by changing environment variables only
- Maintainable: No more hardcoded network-specific strings scattered throughout code
- User Experience: Dynamic UI messages appropriate for each network
- Developer Experience: Clear configuration and easy testing across networks
The application is now ready for mainnet deployment. Simply update the environment variables and deploy the contract to switch from Sepolia testnet to Ethereum mainnet or any other supported network.