1import{j as e}from"./vendor-trading-D1p3lq87.js";import{r as i}from"./vendor-icons-6ckh54d_.js";import{e as k}from"./App-DuU1U4az.js";import{L as S}from"./Layout-CUsvgNIy.js";import{I as h}from"./Icon-DjBwmRGQ.js";import{P as $}from"./PageSEO-D5QLkR79.js";import{L as D}from"./vendor-react-DQUjuWkt.js";import"./vendor-firebase-BholX5ft.js";import"./vendor-web3-BzpTdpCw.js";import"./OrderlyConnect-D8NMU3_e.js";import"./home2-CFGPzgUz.js";import"./SiteHeader-BuEhw28K.js";const K=()=>{const[x,P]=i.useState([]),[_,b]=i.useState(!0),[f,j]=i.useState(null),[d,C]=i.useState(""),[p,I]=i.useState("volume"),[m,E]=i.useState("desc");i.useEffect(()=>{const t=async()=>{b(!0),j(null);try{const r=await fetch("https://api-evm.orderly.org/v1/public/info");if(!r.ok)throw new Error("Failed to fetch iotrader markets");const L=((await r.json())?.data?.rows||[]).filter(o=>o.symbol?.startsWith("PERP_")).map(o=>{const a=o.symbol.replace("PERP_","").split("_")[0];return{symbol:o.symbol,base:a,quote:"USDC",baseDp:o.base_dp??4,quoteDp:o.quote_dp??2,minNotional:o.min_notional??10,logo:`https://oss.orderly.network/static/symbol_logo/${a}.png`}}),w=await fetch("https://api-evm.orderly.org/v1/public/futures");let v={};w.ok&&((await w.json())?.data?.rows||[]).forEach(c=>{v[c.symbol]=c});const F=L.map(o=>{const a=v[o.symbol]||{},c=a["24h_close"]||a.mark_price||0,g=a["24h_open"]||0,M=g>0?(c-g)/g*100:0;return{...o,price:c,change24h:M,high24h:a["24h_high"]||0,low24h:a["24h_low"]||0,volume24h:a["24h_volume"]||0,amount24h:a["24h_amount"]||0,markPrice:a.mark_price||0,openInterest:a.open_interest||0}});P(F)}catch(r){j(r.message),console.error("Error fetching markets:",r)}finally{b(!1)}};t();const s=setInterval(t,3e4);return()=>clearInterval(s)},[]);const y=i.useMemo(()=>{let t=[...x];if(d){const s=d.toLowerCase();t=t.filter(r=>r.base.toLowerCase().includes(s)||r.symbol.toLowerCase().includes(s))}return t.sort((s,r)=>{let l,n;switch(p){case"price":l=s.price||0,n=r.price||0;break;case"change":l=s.change24h||0,n=r.change24h||0;break;case"volume":l=s.amount24h||0,n=r.amount24h||0;break;case"openInterest":l=s.openInterest||0,n=r.openInterest||0;break;default:l=s.amount24h||0,n=r.amount24h||0}return m==="desc"?n-l:l-n}),t},[x,d,p,m]),N=t=>t>=1e9?`$${(t/1e9).toFixed(2)}B`:t>=1e6?`$${(t/1e6).toFixed(2)}M`:t>=1e3?`$${(t/1e3).toFixed(2)}K`:`$${t.toFixed(2)}`,u=t=>t>=1e4?`$${t.toLocaleString(void 0,{maximumFractionDigits:2})}`:t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(4)}`:`$${t.toFixed(6)}`;return _&&x.length===0?e.jsxs(S,{activePage:"coin-market-info",children:[e.jsx($,{}),e.jsx("div",{className:"min-h-screen pt-6 pb-20 px-4 lg:px-6",children:e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx(h,{name:"Activity",size:48,className:"text-yellow-500/50 mx-auto mb-4 animate-pulse"}),e.jsx("p",{className:"text-gray-400",children:"Loading markets..."})]})})})})]}):e.jsxs(S,{activePage:"coin-market-info",children:[e.jsx($,{}),e.jsx("div",{className:"min-h-screen pt-6 pb-20 px-4 lg:px-6",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-8 animate-fade-in-up",children:[e.jsx("h1",{className:"text-4xl md:text-5xl font-black text-transparent bg-clip-text bg-gradient-to-r from-yellow-200 to-yellow-500 mb-2",children:"All Markets"}),e.jsxs("p",{className:"text-gray-400 text-sm md:text-base",children:[x.length," perpetual futures trading pairs available. Click any pair to start trading."]})]}),e.jsx("div",{className:"mb-6 animate-fade-in-up",children:e.jsxs("div",{className:"relative",children:[e.jsx(h,{name:"Search",size:20,className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search by symbol...",value:d,onChange:t=>C(t.target.value),className:"w-full pl-12 pr-4 py-3 bg-[#0a0a0a] border border-white/10 rounded-lg text-white placeholder-gray-500 focus:border-yellow-500 focus:outline-none"})]})}),e.jsxs("div",{className:"mb-6 flex flex-wrap items-center gap-4 animate-fade-in-up",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-400 text-sm font-bold",children:"Sort by:"}),e.jsxs("select",{value:p,onChange:t=>I(t.target.value),className:"px-3 py-2 bg-[#0a0a0a] border border-white/10 rounded-lg text-white text-sm font-bold focus:border-yellow-500 focus:outline-none",children:[e.jsx("option",{value:"volume",children:"Volume (24h)"}),e.jsx("option",{value:"price",children:"Price"}),e.jsx("option",{value:"change",children:"24h Change"}),e.jsx("option",{value:"openInterest",children:"Open Interest"})]})]}),e.jsx("button",{onClick:()=>E(t=>t==="desc"?"asc":"desc"),className:"px-3 py-2 bg-[#0a0a0a] border border-white/10 rounded-lg text-white text-sm font-bold hover:border-yellow-500/30 transition-colors",children:m==="desc"?"â Descending":"â Ascending"}),e.jsxs("span",{className:"text-gray-400 text-sm",children:[y.length," pairs"]})]}),f&&e.jsx("div",{className:"mb-6 p-4 bg-red-500/10 border border-red-500/20 rounded-lg",children:e.jsx("p",{className:"text-red-500 text-sm",children:f})}),e.jsx("div",{className:"bg-[#0a0a0a] border border-white/10 rounded-lg overflow-hidden animate-fade-in-up",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/10 bg-[#050505]",children:[e.jsx("th",{className:"text-left py-4 px-4 text-gray-400 text-xs font-bold uppercase",children:"Pair"}),e.jsx("th",{className:"text-right py-4 px-4 text-gray-400 text-xs font-bold uppercase",children:"Price"}),e.jsx("th",{className:"text-right py-4 px-4 text-gray-400 text-xs font-bold uppercase",children:"24h Change"}),e.jsx("th",{className:"text-right py-4 px-4 text-gray-400 text-xs font-bold uppercase",children:"24h High"}),e.jsx("th",{className:"text-right py-4 px-4 text-gray-400 text-xs font-bold uppercase",children:"24h Low"}),e.jsx("th",{className:"text-right py-4 px-4 text-gray-400 text-xs font-bold uppercase",children:"24h Volume"}),e.jsx("th",{className:"text-right py-4 px-4 text-gray-400 text-xs font-bold uppercase",children:"Open Interest"}),e.jsx("th",{className:"text-center py-4 px-4 text-gray-400 text-xs font-bold uppercase",children:"Trade"})]})}),e.jsx("tbody",{children:y.map(t=>e.jsxs("tr",{className:"border-b border-white/5 hover:bg-white/5 transition-colors cursor-pointer",onClick:()=>{window.location.href=k(t.symbol)},children:[e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:t.logo,alt:t.base,className:"w-8 h-8 rounded-full object-cover bg-white/5 shrink-0",onError:s=>{s.target.style.display="none"}}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-white font-bold text-sm",children:[t.base,"/USDC"]}),e.jsx("p",{className:"text-gray-400 text-xs",children:"Perpetual"})]})]})}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsx("p",{className:"text-white font-bold text-sm",children:u(t.price)})}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.change24h>=0?e.jsx(h,{name:"TrendingUp",size:14,className:"text-green-500"}):e.jsx(h,{name:"TrendingUp",size:14,className:"text-red-500 rotate-180"}),e.jsxs("span",{className:`text-sm font-bold ${t.change24h>=0?"text-green-500":"text-red-500"}`,children:[t.change24h>=0?"+":"",t.change24h.toFixed(2),"%"]})]})}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsx("p",{className:"text-white text-sm",children:u(t.high24h)})}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsx("p",{className:"text-white text-sm",children:u(t.low24h)})}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsx("p",{className:"text-white font-bold text-sm",children:N(t.amount24h)})}),e.jsx("td",{className:"py-4 px-4 text-right",children:e.jsx("p",{className:"text-white text-sm",children:t.openInterest>0?N(t.openInterest):"-"})}),e.jsx("td",{className:"py-4 px-4 text-center",children:e.jsx(D,{to:k(t.symbol),className:"px-4 py-1.5 bg-yellow-500 text-black text-xs font-bold rounded hover:bg-yellow-400 transition-colors inline-block",onClick:s=>s.stopPropagation(),children:"Trade"})})]},t.symbol))})]})})})]})})]})};export{K 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.