PageSourceSearch

https://superhero.com/assets/Explore-BEhWXuPc.js

js superhero.com collected 2026-09-24 13:25:47 UTC 12,536 bytes, 1 lines download raw bytes

1import{r,j as e}from"./charts-Dl5COngX.js";import{u as L,bu as S,bv as p,au as w}from"./main-CpsmUhQM.js";import{D as A}from"./DexTabs-BsZ7tmqB.js";import{T}from"./TokenListTable-BDwl5go9.js";import{getAllTokens as $,getPairs as z,getHistory as E}from"./dexBackend-CSX5QCGr.js";import"./aeternity-Bb8AAdSJ.js";import"./web3-pqzLatyd.js";import"./PriceDataFormatter-D9KO8If8.js";import"./PerformanceTimeframeSelector-Ds622KVL.js";function R(){const[s,d]=r.useState([]),[l,c]=r.useState(""),[o,i]=r.useState({key:"pairs",asc:!1}),[t,u]=r.useState(!1),[j,g]=r.useState(null);r.useEffect(()=>{m()},[]);async function m(){u(!0),g(null);try{const n=await $();d(n||[])}catch(n){g(n instanceof Error?n.message:"Failed to load tokens")}finally{u(!1)}}return{tokens:r.useMemo(()=>{const n=l.trim().toLowerCase(),k=[...s.filter(a=>!n||(a.symbol||"").toLowerCase().includes(n)||(a.name||"").toLowerCase().includes(n)||(a.address||"").toLowerCase().includes(n))].sort((a,h)=>{let f=a[o.key],b=h[o.key];return["pairs","priceUsd","tvlUsd","priceChangeDay","volumeUsdDay","volumeUsdAll"].includes(o.key)?(f=o.key==="pairs"?a.pairs||0:parseFloat(a[o.key]||"0"),b=o.key==="pairs"?h.pairs||0:parseFloat(h[o.key]||"0"),f-b):String(f||"").localeCompare(String(b||""))});return o.asc?k:k.reverse()},[s,l,o]),search:l,sort:o,loading:t,error:j,setSearch:c,setSort:i,toggleSort:n=>{i(x=>({key:n,asc:x.key===n?!x.asc:!1}))},refresh:m}}function D(){const[s,d]=r.useState([]),[l,c]=r.useState(""),[o,i]=r.useState({key:"transactions",asc:!1}),[t,u]=r.useState(!1),[j,g]=r.useState(null);r.useEffect(()=>{m()},[]);async function m(){u(!0),g(null);try{const n=await z(!1),x=n?Object.values(n):[];d(x)}catch(n){g(n instanceof Error?n.message:"Failed to load pairs")}finally{u(!1)}}return{pairs:r.useMemo(()=>{const n=l.trim().toLowerCase(),k=[...s.filter(a=>{const h=`${a.token0Symbol}/${a.token1Symbol}`.toLowerCase();return!n||h.includes(n)||(a.address||"").toLowerCase().includes(n)||(a.token0||a.token0Address||"").toLowerCase().includes(n)||(a.token1||a.token1Address||"").toLowerCase().includes(n)})].sort((a,h)=>{if(o.key==="pair"){const C=`${a.token0Symbol}/${a.token1Symbol}`,N=`${h.token0Symbol}/${h.token1Symbol}`;return C.localeCompare(N)}const f=a[o.key],b=h[o.key];return typeof f=="number"&&typeof b=="number"?f-b:String(f||"").localeCompare(String(b||""))});return o.asc?k:k.reverse()},[s,l,o]),search:l,sort:o,loading:t,error:j,setSearch:c,setSort:i,toggleSort:n=>{i(x=>({key:n,asc:x.key===n?!x.asc:!0}))},refresh:m}}function P(){const[s,d]=r.useState([]),[l,c]=r.useState("all"),[o,i]=r.useState("24h"),[t,u]=r.useState(!1),[j,g]=r.useState(null);r.useEffect(()=>{m()},[l,o]);async function m(){u(!0),g(null);try{const y=Date.now(),n={limit:100,since:o==="24h"?y-24*36e5:y-168*36e5};l!=="all"&&(n.type=l);const x=await E(n);d(x||[])}catch(y){g(y instanceof Error?y.message:"Failed to load transactions")}finally{u(!1)}}return{transactions:s,type:l,window:o,loading:t,error:j,setType:c,setWindow:i,refresh:m}}function X(){const{t:s}=L("explore"),[d,l]=r.useState("Tokens"),c=R(),o=D(),i=P();return e.jsxs("div",{className:"max-w-[1400px] mx-auto p-5",children:[e.jsx(A,{}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-[32px] font-bold text-white m-0 mb-2",children:s("exploreTitle")}),e.jsx("p",{className:"text-base text-white/80 m-0 leading-relaxed",children:s("exploreDescription")})]}),e.jsxs("div",{className:"flex gap-0.5 mb-6 border-b border-gray-600",children:[e.jsx("button",{onClick:()=>l("Tokens"),className:`px-6 py-3 border-none cursor-pointer text-base font-semibold transition-all ${d==="Tokens"?"bg-gray-800 text-white border-b-2 border-green-500":"bg-transparent text-gray-400 hover:text-white"}`,children:s("tokens")}),e.jsx("button",{onClick:()=>l("Pairs"),className:`px-6 py-3 border-none cursor-pointer text-base font-semibold transition-all ${d==="Pairs"?"bg-gray-800 text-white border-b-2 border-green-500":"bg-transparent text-gray-400 hover:text-white"}`,children:s("pools")}),e.jsx("button",{onClick:()=>l("Transactions"),className:`px-6 py-3 border-none cursor-pointer text-base font-semibold transition-all ${d==="Transactions"?"bg-gray-800 text-white border-b-2 border-green-500":"bg-transparent text-gray-400 hover:text-white"}`,children:s("transactions")})]}),d==="Tokens"&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-white m-0 mb-2",children:s("allTokens")}),e.jsx("p",{className:"text-sm text-white/70 m-0",children:s("allTokensDescription")})]}),e.jsx(T,{tokens:c.tokens,sort:c.sort,onSortChange:c.toggleSort,search:c.search,onSearchChange:c.setSearch,loading:c.loading})]}),d==="Pairs"&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-white m-0 mb-2",children:s("liquidityPools")}),e.jsx("p",{className:"text-sm text-white/70 m-0",children:s("liquidityPoolsDescription")})]}),e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs("div",{className:"flex gap-2 items-center mb-4",children:[e.jsx("label",{className:"text-xs opacity-85 text-white/80",children:s("sortBy")}),e.jsxs(S,{value:o.sort.key,onValueChange:t=>o.toggleSort(t),triggerClassName:"px-2 py-1.5 rounded-md bg-[#1a1a23] text-white border border-gray-600 text-sm focus:outline-none focus:border-green-500",contentClassName:"bg-[#1a1a23] border-gray-600",children:[e.jsx(p,{value:"transactions",children:s("txCount")}
1),e.jsx(p,{value:"pair",children:s("pair")}),e.jsx(p,{value:"address",children:s("address")})]}),e.jsx("button",{onClick:()=>o.toggleSort(o.sort.key),className:"px-2 py-1.5 rounded-md border border-gray-600 bg-gray-800 text-white text-sm hover:bg-gray-700 transition-colors",children:o.sort.asc?"↑":"↓"}),e.jsx("input",{placeholder:s("filterPools"),value:o.search,onChange:t=>o.setSearch(t.target.value),className:"ml-auto px-2 py-1.5 rounded-md bg-[#1a1a23] text-white border border-gray-600 min-w-[200px] text-sm placeholder-white/50 focus:outline-none focus:border-green-500"})]}),e.jsxs("table",{className:"w-full border-collapse bg-white/5 rounded-lg overflow-hidden",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-600 bg-white/10",children:[e.jsx("th",{className:"text-left p-3 text-xs opacity-80 text-white/80",children:s("pair")}),e.jsx("th",{className:"text-left p-3 text-xs opacity-80 text-white/80",children:s("address")}),e.jsx("th",{className:"text-center p-3 text-xs opacity-80 text-white/80",children:s("txShort")}),e.jsx("th",{className:"text-right p-3 text-xs opacity-80 text-white/80",children:s("tvlUsd")}),e.jsx("th",{className:"text-right p-3 text-xs opacity-80 text-white/80",children:s("vol24h")}),e.jsx("th",{className:"text-center p-3 text-xs opacity-80 text-white/80",children:s("actions")})]})}),e.jsx("tbody",{children:o.pairs.map(t=>e.jsxs("tr",{style:{borderBottom:"1px solid #1a1a23"},children:[e.jsxs("td",{style:{padding:"12px 8px"},children:[e.jsx("button",{onClick:()=>window.location.href=`/explore/tokens/${t.token0||t.token0Address}`,style:{color:"white",textDecoration:"underline",background:"none",border:"none",cursor:"pointer",fontSize:14,fontWeight:500},children:t.token0Symbol})," / ",e.jsx("button",{onClick:()=>window.location.href=`/explore/tokens/${t.token1||t.token1Address}`,style:{color:"white",textDecoration:"underline",background:"none",border:"none",cursor:"pointer",fontSize:14,fontWeight:500},children:t.token1Symbol})]}),e.jsxs("td",{style:{padding:"12px 8px",fontFamily:"monospace",fontSize:12},children:[e.jsx("button",{onClick:()=>window.location.href=`/explore/pools/${t.address}`,style:{color:"white",textDecoration:"underline",background:"none",border:"none",cursor:"pointer",marginRight:8},children:t.address}),w.EXPLORER_URL&&e.jsx("a",{href:`${w.EXPLORER_URL.replace(/\/$/,"")}/contracts/${t.address}`,target:"_blank",rel:"noreferrer",style:{color:"#8bc9ff",textDecoration:"underline"},children:s("view")})]}),e.jsx("td",{style:{textAlign:"center",padding:"12px 8px",fontSize:14},children:t.transactions||0}),e.jsx("td",{style:{textAlign:"right",padding:"12px 8px",fontSize:14},children:t.tvlUsd!=null?Number(t.tvlUsd).toLocaleString():t.tvl!=null?Number(t.tvl).toLocaleString():"-"}),e.jsx("td",{style:{textAlign:"right",padding:"12px 8px",fontSize:14},children:t.volume24h!=null?Number(t.volume24h).toLocaleString():"-"}),e.jsx("td",{style:{textAlign:"center",padding:"12px 8px"},children:e.jsxs("div",{style:{display:"flex",gap:4,justifyContent:"center"},children:[e.jsx("button",{onClick:()=>window.location.href=`/defi/swap?from=${t.token0||t.token0Address}&to=${t.token1||t.token1Address}`,style:{padding:"4px 8px",borderRadius:6,border:"1px solid #3a3a4a",background:"#2a2a39",color:"white",cursor:"pointer",fontSize:12},children:s("swap")}),e.jsx("button",{onClick:()=>window.location.href=`/pool/add?from=${t.token0||t.token0Address}&to=${t.token1||t.token1Address}`,style:{padding:"4px 8px",borderRadius:6,border:"1px solid #3a3a4a",background:"#2a2a39",color:"white",cursor:"pointer",fontSize:12},children:s("add")})]})})]},t.address))})]}),o.pairs.length===0&&!o.loading&&e.jsx("div",{style:{textAlign:"center",padding:40,opacity:.7},children:s("noPoolsFound")})]})]}),d==="Transactions"&&e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("h2",{style:{fontSize:20,fontWeight:600,color:"white",margin:"0 0 8px 0"},children:s("recentTransactions")}),e.jsx("p",{style:{fontSize:14,opacity:.7,margin:0},children:s("trackRecentDescription")})]}),e.jsxs("div",{style:{overflowX:"auto"},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:16},children:[e.jsx("label",{style:{fontSize:12,opacity:.85},children:s("type")}),e.jsxs(S,{value:i.type,onValueChange:t=>i.setType(t),triggerClassName:"px-2 py-1.5 rounded-md bg-[#1a1a23] text-white border border-gray-600 text-sm focus:outline-none",contentClassName:"bg-[#1a1a23] border-gray-600",children:[e.jsx(p,{value:"all",children:s("all")}),e.jsx(p,{value:"swap",children:s("swaps")}),e.jsx(p,{value:"add",children:s("adds")}),e.jsx(p,{value:"remove",children:s("removes")})]}),e.jsx("label",{style:{fontSize:12,opacity:.85,marginLeft:8},children:s("window")}),e.jsxs(S,{value:i.window,onValueChange:t=>i.setWindow(t),triggerClassName:"px-2 py-1.5 rounded-md bg-[#1a1a23] text-white border border-gray-600 text-sm focus:outline-none",contentClassName:"bg-[#1a1a23] border-gray-600",children:[e.jsx(p,{value:"24h",children:s("window24h")}),e.jsx(p,{value:"7d",children:s("window7d")})]})]}),e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"1px solid #3a3a4a"},children:[e.jsx("th",{style:{textAlign:"left",padding:"12px 8px",fontSize:12,opacity:.8},children:s("type")}),e.jsx("th",{style:{textAlign:"left",padding:"12px 8px",fontSize:12,opacity:.8},children:s("pair")}),e.jsx("th",{style:{textAlign:"right",padding:"12px 8px",fontSize:12,opacity:.8},children:s("amountIn")}),e.jsx("th",{style:{textAlign:"right",padding:"12px 8px",fontSize:12,opacity:.8},children:s("amountOut")}),e.jsx("th",{style:{textAlign:"left",padding:"12px 8px",fontSize:12,opacity:.8},children:s("transaction")})]})}),e.jsx("tbody",{children:i.transactions.map(t=>e.jsxs("tr",{style:{borderBottom:"1px solid #1a1a23"},children:[e.jsx("td",{style:{padding:"12px 8px",fontSize:14},children:e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:12,fontWeight:600,background:t.type==="swap"?"#4caf50":t.type==="add"?"#2196f3":"#ff9800",color:"white"},children:t.type||t.event||"-"})}),e.jsxs("td",{style:{padding:"12px 8px",fontSize:14},children:[t.tokenInSymbol||t.token0Symbol," ","/",t.tokenOutSymbol||t.token1Symbol]}),e.jsx("td",{style:{textAlign:"right",padding:"12px 8px",fontSize:14},children:t.amountIn||"-"}),e.jsx("td",{style:{textAlign:"right",padding:"12px 8px",fontSize:14},children:t.amountOut||"-"}),e.jsx("td",{style:{padding:"12px 8px",fontFamily:"monospace",fontSize:12},children:t.txHash&&w.EXPLORER_URL?e.jsx("a",{href:`${w.EXPLORER_URL.replace(/\/$/,"")}/transactions/${t.txHash}`,target:"_blank",rel:"noreferrer",style:{color:"#8bc9ff",textDecoration:"underline"},children:t.txHash}):t.txHash||"-"})]},t.txHash||`${t.type}-${t.tokenInSymbol}-${t.tokenOutSymbol}-${t.amountIn}-${t.amountOut}`))})]}),i.transactions.length===0&&!i.loading&&e.jsx("div",{style:{textAlign:"center",padding:40,opacity:.7},children:s("noTransactionsFound")})]})]})]})}export{X as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.