import React, { useState, useEffect } from 'react'; import axios from 'axios'; import { Search, Share2, Activity, Database, Zap, Wallet, ChevronRight, Terminal, Layers, Hash, Info, X } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; import PersonaChart from './components/PersonaChart'; import RoastCard from './components/RoastCard'; import Logo from './assets/logo.svg'; const API_BASE = import.meta.env.VITE_API_URL || "http://localhost:8000"; function InfoModal({ onClose }) { return (

SYSTEM PROTOCOLS

OPERATIONAL CONSTRAINTS & SPECIFICATIONS

1. NETWORK: ETHEREUM MAINNET ONLY

  • Compatible: Ethereum Mainnet (L1).
  • Incompatible: Base, Arbitrum, Optimism, Polygon, Solana, Bitcoin.
  • Result: Wallets active only on L2s will show 0 activity.

2. ENTITY RECOGNITION

  • Optimized for: User Wallets (EOA).
  • Supported: Smart Contracts (data retrieval works).
  • Warning: Analyzing Contracts (e.g., Uniswap Router) may yield skewed "Whale" personas due to pooled funds.

3. ASSET COVERAGE

  • Native ETH: 100% Coverage.
  • ERC-20 Tokens: 100% Coverage (USDC, PEPE, UNI, etc.).
  • NFTs: ERC-721 & ERC-1155 Standard.

4. TEMPORAL HORIZON (OPTIMIZATION)

  • ETH Txs: Full History (Since 2015). Accurate age/gas stats.
  • DeFi/NFTs: Post-2018 Analysis. Ignores experimental pre-2018 token activity for query speed.
); } function StatusCycler() { const [msgIndex, setMsgIndex] = useState(0); const messages = [ "> INITIALIZING_NEURAL_UPLINK...", "> ESTABLISHING_DUNE_CONNECTION...", "> SCANNING_ETHEREUM_HISTORY...", "> AGGREGATING_NFT_VECTORS...", "> COMPUTING_CLUSTERING_TENSORS...", "> DECODING_BEHAVIORAL_PATTERNS...", "> FINALIZING_AI_ANALYSIS..." ]; useEffect(() => { const interval = setInterval(() => { setMsgIndex((prev) => (prev + 1) % messages.length); }, 3500); return () => clearInterval(interval); }, []); return (
{messages[msgIndex]} _
); } function App() { const [wallet, setWallet] = useState(""); const [status, setStatus] = useState("idle"); const [data, setData] = useState(null); const [errorMsg, setErrorMsg] = useState(""); const [showInfo, setShowInfo] = useState(false); const analyzeWallet = async () => { if (!wallet.startsWith("0x")) { setErrorMsg("INVALID_ADDRESS: Must start with 0x"); return; } setStatus("loading"); setErrorMsg(""); setData(null); try { const startRes = await axios.post(`${API_BASE}/analyze/start/${wallet}`); pollStatus(startRes.data.job_id); } catch (err) { console.error(err); setErrorMsg("CONNECTION_ERR: API Unreachable"); setStatus("error"); } }; const pollStatus = (jobId) => { const interval = setInterval(async () => { try { const res = await axios.get(`${API_BASE}/analyze/status/${jobId}`); const result = res.data; if (result.status === "completed") { clearInterval(interval); setData(result); setStatus("success"); } else if (result.status === "failed") { clearInterval(interval); setErrorMsg(result.error || "Analysis Failed"); setStatus("error"); } } catch (err) { clearInterval(interval); setErrorMsg("POLLING_ERR: Lost connection"); setStatus("error"); } }, 2000); }; const handleExport = () => { if (!data) return; const jsonString = `data:text/json;chatset=utf-8,${encodeURIComponent( JSON.stringify(data, null, 2) )}`; const link = document.createElement("a"); link.href = jsonString; link.download = `analysis_${data.wallet_address || "wallet"}.json`; link.click(); }; return (
{showInfo && setShowInfo(false)} />} {/* 1. Compact Top Navigation Bar (Command Deck Layout) */}
{/* Deck 1: Brand HUD */}
Cluster Protocol

CLUSTERPROTOCOL

v2.1.0
{/* Deck 2: Command Line (Search) */}
setWallet(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && analyzeWallet()} placeholder="0x..." className="w-full bg-bg-main border border-border text-text-primary pl-9 pr-3 py-1.5 font-mono text-xs focus:outline-none focus:border-accent transition-colors rounded-sm" disabled={status === 'loading'} />
{/* Error Toast */} {errorMsg && (
! {errorMsg}
)} {/* Main Content - Flex Layout to avoid scroll */}
{/* Empty / Error State */} {(status === 'idle' || status === 'error') && (

{status === 'error' ? 'System Failure' : 'Ready to Process'}

{status === 'error' ? "The neural uplink encountered an error. Check address and retry." : "Enter a wallet address above to initiate the segmentation engine."}

)} {/* Loading State */} {status === 'loading' && (
)} {/* Dashboard Grid */} {status === 'success' && data && ( {/* Col 1: Visuals (Radar) - 5 Cols */}
Behavioral Topology
Primary Classification {data.persona}
{/* Col 2: Metrics & Insights - 7 Cols */}
{/* Top Row: Metrics */}
} /> } /> } />
{/* Bottom Row: Text Analysis */}
Identity Narrative
LATENCY: 42ms
)}
{/* System Status Footer (Visible only in Idle/Error) */} {(status === 'idle' || status === 'error') && ( )}
); } function MetricCard({ label, value, icon }) { // Metric display component return (
{label} {icon}
{value}
); } export default App;