PageSourceSearch

https://radreport.com.br/assets/Web3TransactionExplorer-D5MuOgph.js

js radreport.com.br collected 2026-09-24 14:37:26 UTC 7,467 bytes, 1 lines download raw bytes

1import{u as _,j as e}from"./vendor-query-skQMsM6X.js";import{r as y}from"./vendor-react-DyYvSSk1.js";import{b as S,r as f,v as j,x as N,y as g,z as o,at as T,ax as k,ab as R,aR as I,p as C}from"./index-BGwtrXIa.js";import{useWeb3ChainConfig as P}from"./useWeb3ChainConfig-oZ-Z2Koq.js";import{bQ as A,L as w,bF as V,aD as B,af as H,i as z,br as M,bg as Q,C as E,v as q,o as F,aq as $}from"./vendor-ui-CCmu0bzQ.js";import"./vendor-supabase-BfoV2C50.js";import"./utils-BnNtzvC2.js";const v=20,K=i=>i==="confirmed"?"default":i==="failed"?"destructive":"secondary",O=i=>i==="confirmed"?e.jsx(E,{className:"h-3.5 w-3.5 text-green-500"}):i==="failed"?e.jsx(q,{className:"h-3.5 w-3.5 text-destructive"}):e.jsx(F,{className:"h-3.5 w-3.5 text-amber-500 animate-pulse"}),W=({filters:i})=>{const{data:n,isLoading:t}=_({queryKey:["web3-tx-summary",i],queryFn:async()=>{let a=S.from("web3_mint_log").select("status, amount, token_type",{count:"exact"});if(i.period!=="all"){const l=i.period==="7d"?7:i.period==="30d"?30:90,c=new Date(Date.now()-l*864e5).toISOString();a=a.gte("minted_at",c)}const{data:x,error:r}=await a;if(r)throw r;const d=x??[],u=d.filter(l=>l.status==="confirmed"),m=d.filter(l=>l.status==="pending"),h=d.filter(l=>l.status==="failed"),s=u.reduce((l,c)=>l+(Number(c.amount)||0),0);return{total:d.length,confirmed:u.length,pending:m.length,failed:h.length,volume:s}},staleTime:3e4});if(t)return e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})});const p=[{label:"Confirmadas",value:(n==null?void 0:n.confirmed)??0,icon:E,color:"text-green-500"},{label:"Pendentes",value:(n==null?void 0:n.pending)??0,icon:F,color:"text-amber-500"},{label:"Falhas",value:(n==null?void 0:n.failed)??0,icon:q,color:"text-destructive"},{label:"Volume RADC",value:Number((n==null?void 0:n.volume)??0).toLocaleString("pt-BR"),icon:$,color:"text-primary"}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:p.map(a=>e.jsx(T,{children:e.jsxs(k,{className:"p-3 flex flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[e.jsx(a.icon,{className:`h-3.5 w-3.5 ${a.color}`})," ",a.label]}),e.jsx("span",{className:"text-lg font-bold font-mono",children:a.value})]})},a.label))})},se=()=>{const{getExplorer:i,defaultChainId:n}=P(),[t,p]=y.useState({status:"all",tokenType:"all",period:"30d"}),[a,x]=y.useState(0),{data:r,isLoading:d,isFetching:u}=_({queryKey:["web3-tx-explorer",t,a],queryFn:async()=>{let s=S.from("web3_mint_log").select("*",{count:"exact"}).order("minted_at",{ascending:!1}).range(a*v,(a+1)*v-1);if(t.status!=="all"&&(s=s.eq("status",t.status)),t.tokenType!=="all"&&(s=s.eq("token_type",t.tokenType)),t.period!=="all"){const D=t.period==="7d"?7:t.period==="30d"?30:90,L=new Date(Date.now()-D*864e5).toISOString();s=s.gte("minted_at",L)}const{data:l,count:c,error:b}=await s;if(b)throw b;return{rows:l??[],total:c??0}},refetchInterval:t.status==="all"||t.status==="pending"?3e4:!1,staleTime:15e3}),m=Math.ceil(((r==null?void 0:r.total)??0)/v),h=(s,l)=>{p(c=>({...c,[s]:l})),x(0)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h2",{className:"text-lg font-semibold font-mono flex items-center gap-2",children:[e.jsx(A,{className:"h-5 w-5 text-primary"})," Transaction Explorer",u&&e.jsx(w,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),e.jsx(W,{filters:t}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(f,{value:t.status,onValueChange:s=>h("status",s),children:[e.jsx(j,{className:"w-[140px] font-mono text-xs",children:e.jsx(N,{placeholder:"Status"})}),e.jsxs(g,{children:[e.jsx(o,{value:"all",children:"Todos"}),e.jsx(o,{value:"pending",children:"Pending"}),e.jsx(o,{value:"confirmed",children:"Confirmed"}),e.jsx(o,{value:"failed",children:"Failed"})]})]}),e.jsxs(f,{value:t.tokenType,onValueChange:s=>h("tokenType",s),children:[e.jsx(j,{className:"w-[140px] font-mono text-xs",children:e.jsx(N,{placeholder:"Tipo"})}),e.jsxs(g,{children:[e.jsx(o,{value:"all",children:"Todos"}),e.jsx(o,{value:"erc20",children:"ERC-20"}),e.jsx(o,{value:"erc1155",children:"ERC-1155"})]})]}),e.jsxs(f,{value:t.period,onValueChange:s=>h("period",s),children:[e.jsx(j,{className:"w-[140px] font-mono text-xs",children:e.jsx(N,{placeholder:"Período"})}),e.jsxs(g,{children:[e.jsx(o,{value:"7d",children:"7 dias"}),e.jsx(o,{value:"30d",children:"30 dias"}),e.jsx(o,{value:"90d",children:"90 dias"}),e.jsx(o,{value:"all",children:"Todo período"})]})]})]}),e.jsx(T,{children:e.jsx(k,{className:"p-0",children:d?e.jsx("div",{className:"p-6 flex justify-center",children:e.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):r!=null&&r.rows.length?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground font-mono text-xs",children:[e.jsx("th",{className:"p-3",children:"Status"}),e.jsx("th",{className:"p-3",children:"Tipo"}),e.jsx("th",{className:"p-3",children:"Quantidade"}),e.jsx("th",{className:"p-3",children:"Chain"}),e.jsx("th",{className:"p-3",children:"TX Hash"}),e.jsx("th",{className:"p-3",children:"Data"})]})}),e.jsx("tbody",{children:r.rows.map(s=>e.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50 transition-colors",children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[O(s.status),e.jsx(R,{variant:K(s.status),className:"text-[10px]",children:s.status})]})}),e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-xs",children:[s.token_type==="erc20"?e.jsx(V,{className:"h-3.5 w-3.5 text-green-500"}):e.jsx(B,{className:"h-3.5 w-3.5 text-orange-500"}),s.token_type??"-"]})}),e.jsx("td",{className:"p-3 font-mono font-medium",children:s.amount!=null?Number(s.amount).toLocaleStr
1ing("pt-BR"):"-"}),e.jsx("td",{className:"p-3 font-mono text-xs text-muted-foreground",children:s.chain_id??"-"}),e.jsx("td",{className:"p-3",children:s.tx_hash?e.jsxs("a",{href:`${i(s.chain_id??n)}/tx/${s.tx_hash}`,target:"_blank",rel:"noopener noreferrer",className:"font-mono text-xs text-primary hover:underline flex items-center gap-1 max-w-[140px]",title:s.tx_hash,children:[s.tx_hash.slice(0,10),"…",s.tx_hash.slice(-4),e.jsx(H,{className:"h-3 w-3 flex-shrink-0"})]}):s.status==="pending"?e.jsxs("span",{className:"text-xs text-amber-500 flex items-center gap-1",children:[e.jsx(z,{className:"h-3 w-3"})," Aguardando"]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"-"})}),e.jsx("td",{className:"p-3 text-xs text-muted-foreground",children:s.minted_at?I(new Date(s.minted_at),"dd/MM/yy HH:mm"):"-"})]},s.id))})]})}):e.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Nenhuma transação encontrada."})})}),m>1&&e.jsxs("div",{className:"flex items-center justify-between text-sm font-mono",children:[e.jsxs("span",{className:"text-muted-foreground text-xs",children:[(r==null?void 0:r.total)??0," transações · Página ",a+1,"/",m]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>x(s=>s-1),disabled:a===0,children:e.jsx(M,{className:"h-4 w-4"})}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>x(s=>s+1),disabled:a>=m-1,children:e.jsx(Q,{className:"h-4 w-4"})})]})]})]})};export{se as Web3TransactionExplorer};

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.