diff --git a/src/components/WalletDropdown.tsx b/src/components/WalletDropdown.tsx index cf37adb..4202954 100644 --- a/src/components/WalletDropdown.tsx +++ b/src/components/WalletDropdown.tsx @@ -35,6 +35,14 @@ import { TooltipTrigger, } from "@/components/ui/tooltip"; +const LINEA_PARAMS = { + chainId: '0xE705', // 59141 in hex + chainName: 'Linea Sepolia', + rpcUrls: ['https://rpc.sepolia.linea.build'], + nativeCurrency: { name: 'Ethereum', symbol: 'ETH', decimals: 18 }, + blockExplorerUrls: ['https://sepolia.lineascan.build'], +}; + export function WalletDropdown() { const { isConnected, address, chainId, connectWallet, disconnectWallet, balance, wttBalance, mintWTT } = useWallet(); const [isDialogOpen, setIsDialogOpen] = useState(false); @@ -69,6 +77,21 @@ export function WalletDropdown() { return `Unknown (${chainId})`; }; + const addNetwork = async () => { + if (!window.ethereum) { + alert('MetaMask is not installed.'); + return; + } + try { + await window.ethereum.request({ + method: 'wallet_addEthereumChain', + params: [LINEA_PARAMS], + }); + } catch { + alert('Failed to add Linea Sepolia network.'); + } + }; + if (!isConnected || !address) { return ( + + +

Get Testnet ETH from Linea Faucet

+
+ + +
@@ -196,6 +238,16 @@ export function WalletDropdown() {
+ {chainId !== 59141 && ( + + )}