diff --git a/components/connect-wallet.tsx b/components/connect-wallet.tsx index 364b8f5..67cb2a8 100644 --- a/components/connect-wallet.tsx +++ b/components/connect-wallet.tsx @@ -6,10 +6,11 @@ import { Badge } from "@/components/ui/badge" import { Wallet, ChevronDown, AlertCircle, Shield } from "lucide-react" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" import { Alert, AlertDescription } from "@/components/ui/alert" +import { DOMA_CHAIN_CONFIG } from "@/lib/doma-smart-contracts" interface ConnectWalletProps { isConnected: boolean - onConnect: (connected: boolean) => void + onConnect: (connected: boolean, address?: string) => void } declare global { @@ -38,7 +39,7 @@ export function ConnectWallet({ isConnected, onConnect }: ConnectWalletProps) { const account = accounts[0] setAddress(formatAddress(account)) setConnectedWallet("MetaMask") - onConnect(true) + onConnect(true, account) return } } catch (error) { @@ -53,7 +54,7 @@ export function ConnectWallet({ isConnected, onConnect }: ConnectWalletProps) { const account = accounts[0] setAddress(formatAddress(account)) setConnectedWallet("OKX Wallet") - onConnect(true) + onConnect(true, account) return } } catch (error) { @@ -99,15 +100,32 @@ export function ConnectWallet({ isConnected, onConnect }: ConnectWalletProps) { const account = accounts[0] setAddress(formatAddress(account)) setConnectedWallet("MetaMask") - onConnect(true) + onConnect(true, account) try { await window.ethereum.request({ method: "wallet_switchEthereumChain", - params: [{ chainId: "0x1" }], + params: [{ chainId: DOMA_CHAIN_CONFIG.chainId }], }) } catch (switchError: any) { - console.log("Network switch error:", switchError) + if (switchError?.code === 4902) { + try { + await window.ethereum.request({ + method: "wallet_addEthereumChain", + params: [{ + chainId: DOMA_CHAIN_CONFIG.chainId, + chainName: DOMA_CHAIN_CONFIG.chainName, + nativeCurrency: DOMA_CHAIN_CONFIG.nativeCurrency, + rpcUrls: DOMA_CHAIN_CONFIG.rpcUrls, + blockExplorerUrls: DOMA_CHAIN_CONFIG.blockExplorerUrls, + }], + }) + } catch (addErr) { + console.log("Add chain failed:", addErr) + } + } else { + console.log("Network switch error:", switchError) + } } } } catch (error: any) { @@ -141,15 +159,32 @@ export function ConnectWallet({ isConnected, onConnect }: ConnectWalletProps) { const account = accounts[0] setAddress(formatAddress(account)) setConnectedWallet("OKX Wallet") - onConnect(true) + onConnect(true, account) try { await window.okxwallet.request({ method: "wallet_switchEthereumChain", - params: [{ chainId: "0x1" }], + params: [{ chainId: DOMA_CHAIN_CONFIG.chainId }], }) } catch (switchError: any) { - console.log("Network switch error:", switchError) + if (switchError?.code === 4902) { + try { + await window.okxwallet.request({ + method: "wallet_addEthereumChain", + params: [{ + chainId: DOMA_CHAIN_CONFIG.chainId, + chainName: DOMA_CHAIN_CONFIG.chainName, + nativeCurrency: DOMA_CHAIN_CONFIG.nativeCurrency, + rpcUrls: DOMA_CHAIN_CONFIG.rpcUrls, + blockExplorerUrls: DOMA_CHAIN_CONFIG.blockExplorerUrls, + }], + }) + } catch (addErr) { + console.log("Add chain failed:", addErr) + } + } else { + console.log("Network switch error:", switchError) + } } } } catch (error: any) { diff --git a/components/doma-analytics.tsx b/components/doma-analytics.tsx index 8afdbdc..3a47f63 100644 --- a/components/doma-analytics.tsx +++ b/components/doma-analytics.tsx @@ -29,7 +29,7 @@ import { Clock, Shield } from "lucide-react" -import { LineChart, Line, AreaChart, Area, BarChart, Bar, PieChart as RechartsPieChart, Cell, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts' +import { LineChart, Line, AreaChart, Area, BarChart, Bar, Pie, PieChart as RechartsPieChart, Cell, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts' interface AnalyticsData { volume: number @@ -582,7 +582,7 @@ export function DomaAnalytics({ walletAddress, isConnected }: DomaAnalyticsProps {domain.name}
- {domain.registrar} • Token #{domain.tokenId} + {domain.registrar} �� Token #{domain.tokenId}
diff --git a/components/doma-bridge.tsx b/components/doma-bridge.tsx index c6eab59..05b1fc9 100644 --- a/components/doma-bridge.tsx +++ b/components/doma-bridge.tsx @@ -67,90 +67,25 @@ interface DomaBridgeProps { const SUPPORTED_CHAINS: SupportedChain[] = [ { - id: 'ethereum', - name: 'Ethereum', - shortName: 'ETH', - chainId: 1, - icon: '⟠', + id: 'doma', + name: 'Doma Network', + shortName: 'DOMA', + chainId: 97476, + icon: '🛡️', nativeCurrency: 'ETH', - rpcUrl: 'https://mainnet.infura.io/v3/', - explorerUrl: 'https://etherscan.io', - bridgeFee: 0.005, - estimatedTime: '5-10 min', - isTestnet: false - }, - { - id: 'sepolia', - name: 'Sepolia Testnet', - shortName: 'SEP', - chainId: 11155111, - icon: '⟠', - nativeCurrency: 'ETH', - rpcUrl: 'https://sepolia.infura.io/v3/', - explorerUrl: 'https://sepolia.etherscan.io', - bridgeFee: 0.001, - estimatedTime: '2-5 min', + rpcUrl: 'https://rpc-testnet.doma.xyz', + explorerUrl: 'https://explorer-testnet.doma.xyz', + bridgeFee: 0, + estimatedTime: '—', isTestnet: true - }, - { - id: 'polygon', - name: 'Polygon', - shortName: 'MATIC', - chainId: 137, - icon: '🔷', - nativeCurrency: 'MATIC', - rpcUrl: 'https://polygon-rpc.com', - explorerUrl: 'https://polygonscan.com', - bridgeFee: 0.1, - estimatedTime: '3-7 min', - isTestnet: false - }, - { - id: 'arbitrum', - name: 'Arbitrum One', - shortName: 'ARB', - chainId: 42161, - icon: '🔵', - nativeCurrency: 'ETH', - rpcUrl: 'https://arb1.arbitrum.io/rpc', - explorerUrl: 'https://arbiscan.io', - bridgeFee: 0.002, - estimatedTime: '2-4 min', - isTestnet: false - }, - { - id: 'optimism', - name: 'Optimism', - shortName: 'OP', - chainId: 10, - icon: '🔴', - nativeCurrency: 'ETH', - rpcUrl: 'https://mainnet.optimism.io', - explorerUrl: 'https://optimistic.etherscan.io', - bridgeFee: 0.003, - estimatedTime: '3-6 min', - isTestnet: false - }, - { - id: 'solana', - name: 'Solana', - shortName: 'SOL', - chainId: 0, // Solana doesn't use EVM chain IDs - icon: '☀️', - nativeCurrency: 'SOL', - rpcUrl: 'https://api.mainnet-beta.solana.com', - explorerUrl: 'https://explorer.solana.com', - bridgeFee: 0.01, - estimatedTime: '1-3 min', - isTestnet: false } ] export function DomaBridge({ walletAddress, isConnected }: DomaBridgeProps) { const [userDomains, setUserDomains] = useState([]) const [selectedDomain, setSelectedDomain] = useState("") - const [fromChain, setFromChain] = useState("sepolia") - const [toChain, setToChain] = useState("polygon") + const [fromChain, setFromChain] = useState("doma") + const [toChain, setToChain] = useState("") const [toAddress, setToAddress] = useState("") const [bridgeTransactions, setBridgeTransactions] = useState([]) const [currentBridge, setCurrentBridge] = useState(null) @@ -499,7 +434,7 @@ export function DomaBridge({ walletAddress, isConnected }: DomaBridgeProps) { Bridge Summary - Review your bridge transaction details + Doma Network only. Use the official bridge below for cross-chain actions. @@ -543,6 +478,12 @@ export function DomaBridge({ walletAddress, isConnected }: DomaBridgeProps) {
+
diff --git a/components/doma-marketplace.tsx b/components/doma-marketplace.tsx index 23ddad6..8094260 100644 --- a/components/doma-marketplace.tsx +++ b/components/doma-marketplace.tsx @@ -306,7 +306,7 @@ export function DomaMarketplace({ walletAddress, isConnected }: DomaMarketplaceP
Chain: - Sepolia Testnet + Doma Network
diff --git a/components/domain-monitor.tsx b/components/domain-monitor.tsx index 03eea23..0b074da 100644 --- a/components/domain-monitor.tsx +++ b/components/domain-monitor.tsx @@ -183,7 +183,7 @@ export function DomainMonitor({ walletAddress, isConnected }: DomainMonitorProps
@@ -262,7 +262,7 @@ export function DomainMonitor({ walletAddress, isConnected }: DomainMonitorProps @@ -376,11 +376,11 @@ export function WalletAssetsDashboard({ walletAddress, isConnected, provider }: