Privacidad total — Solo ves las transacciones de tu wallet. Nadie mas puede ver tus movimientos.
VISTA ADMIN — Estas viendo TODAS las transacciones del sistema.
1/1
#
Dominio
Tipo
Concepto
Importe
TX
Bloque
Fecha
Cargando...
Detalle de Transaccion
function detectW(){
var w=[]
if(!window.ethereum)return w
function add(id,n,col,p){if(!w.find(function(x){return x.id===id}))w.push({id:id,n:n,col:col,p:p})}
if(window.ethereum.providers){window.ethereum.providers.forEach(function(p){
if(p.isMetaMask)add('mm','MetaMask','#E8831D',p)
if(p.isTrust||p.isTrustWallet)add('tw','Trust Wallet','#3375BB',p)
if(p.isExodus)add('ex','Exodus','#8B5CF6',p)
})}else{
if(window.ethereum.isMetaMask)add('mm','MetaMask','#E8831D',window.ethereum)
else if(window.ethereum.isTrust)add('tw','Trust','#3375BB',window.ethereum)
else if(window.ethereum.isExodus)add('ex','Exodus','#8B5CF6',window.ethereum)
else add('ev','Wallet','#64748b',window.ethereum)
}
return w
}
function renderW(){
var avail=detectW()
var all=[
{id:'mm',n:'MetaMask',desc:'La wallet mas popular',col:'#E8831D'},
{id:'tw',n:'Trust Wallet',desc:'Multi-chain segura',col:'#3375BB'},
{id:'ex',n:'Exodus',desc:'Todo-en-uno',col:'#8B5CF6'}
]
document.getElementById('wallet-buttons').innerHTML=all.map(function(w){
var a=avail.find(function(x){return x.id===w.id})
var badge=a?('OK'):'';
return('')
}).join('')
}
function msg(type,txt){var el=document.getElementById('status-msg');el.className='status-msg status-'+type;el.textContent=txt;el.style.display='block'}
async function conn(type){
var avail=detectW()
var w=avail.find(function(x){return x.id===type})
if(!w){msg('err','Wallet no detectada');return}
msg('info','Conectando... acepta en tu wallet')
try{
var accs=await w.p.request({method:'eth_requestAccounts'})
var addr=accs[0]
msg('info','Firmando (sin gas)...')
var nr=await fetch('https://api.hipercapitalfinance.com/api/wallet/nonce').then(function(r){return r.json()})
var sig=await w.p.request({method:'personal_sign',params:[nr.message,addr]})
var vr=await fetch('https://api.hipercapitalfinance.com/api/wallet/verify',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({address:addr,signature:sig,nonce:nr.nonce})}).then(function(r){return r.json()})
if(vr.code==='NO_ACCOUNT'){msg('err','Wallet no registrada. Ve a app.hipercapitalfinance.com y vincula tu wallet en Mi Perfil.');return}
if(!vr.success)throw new Error(vr.error||'Error de verificacion')
TK=vr.token;USR=vr.user
localStorage.setItem('exp_tk',TK)
localStorage.setItem('exp_usr',JSON.stringify(USR))
msg('ok','Conectado!')
setTimeout(showApp,700)
}catch(e){msg('err',e.code===4001?'Rechazaste la firma':e.message)}
}
function showApp(){
document.getElementById('login-screen').style.display='none'
document.getElementById('app-screen').style.display='block'
var disp=USR.wallet?USR.wallet.slice(0,8)+'...'+USR.wallet.slice(-6):(USR.email||'--')
document.getElementById('wallet-disp').textContent=disp
if(USR.role==='admin'){document.getElementById('priv-banner').style.display='none';document.getElementById('admin-banner').style.display='block'}
load()
if(live)timer=setInterval(load,15000)
}
function logout(){
localStorage.removeItem('exp_tk');localStorage.removeItem('exp_usr')
TK='';USR={};clearInterval(timer)
document.getElementById('login-screen').style.display='flex'
document.getElementById('app-screen').style.display='none'
}
function toggleLive(){
live=!live
var b=document.getElementById('live-btn')
b.textContent=live?'LIVE':'STOP'
b.style.background=live?'rgba(74,222,128,0.08)':'rgba(100,116,139,0.08)'
b.style.color=live?'#4ade80':'#64748b'
if(live)timer=setInterval(load,15000);else clearInterval(timer)
}
async function load(){
try{
var h={'Authorization':'Bearer '+TK}
var results=await Promise.all([
fetch('https://api.hipercapitalfinance.com/api/chain/stats',{headers:h}).then(function(r){return r.json()}),
fetch('https://api.hipercapitalfinance.com/api/chain/transactions?limit='+LIM+'&page='+page,{headers:h}).then(function(r){return r.json()})
])
var st=results[0],tr=results[1]
if(st.block)document.getElementById('s-block').textContent=fmtN(st.block)
if(st.supply)document.getElementById('s-supply').textContent=fmt(st.supply,0)
document.getElementById('s-txs').textContent=st.isAdmin?'ADMIN':fmtN(st.myTx||0)
if(tr.success){allTxs=tr.transactions||[];total=tr.total||0;filterTxs()}
if(tr.message)showEmpty(tr.message)
}catch(e){console.error(e)}
}
function filterTxs(){
var q=document.getElementById('search').value.toLowerCase()
var f=q?allTxs.filter(function(r){return(r.concept||'').toLowerCase().includes(q)||(r.domain||'').toLowerCase().includes(q)||(r.tx_hash||'').toLowerCase().includes(q)||(r.asset||'').toLowerCase().includes(q)}):allTxs
var pages=Math.ceil(total/LIM)||1
document.getElementById('page-info').textContent=page+'/'+pages
document.getElementById('btn-prev').style.display=page>1?'block':'none'
document.getElementById('btn-next').style.display=page'+fmt(Number(r.amount))+' '+(r.asset||'')+''):'--'
var tx=oc?(''+r.tx_hash.slice(0,8)+'...'+r.tx_hash.slice(-6)+''):'Banco'
var fecha=r.created_at?new Date(r.created_at).toLocaleString('es-ES',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit'}):'--'
var rd=JSON.stringify(r).replace(/\\/g,'\\\\').replace(/'/g,"\\'")
return('
'}
function openTx(j){
try{
var r=JSON.parse(j)
var rows=[['Dominio',r.domain],['Tipo',(r.record_type||'').replace(/_/g,' ')],['Concepto',r.concept||'--'],['Importe',r.amount!=null?fmt(Number(r.amount))+' '+(r.asset||''):'--'],['TX Hash',r.tx_hash||'Off-chain (Banco)'],['Bloque',r.block_number?fmtN(r.block_number):'--'],['Fecha',r.created_at?new Date(r.created_at).toLocaleString('es-ES'):'--']]
document.getElementById('modal-body').innerHTML=rows.map(function(rv){return'
'+rv[0]+'
'+rv[1]+'
'}).join('')
document.getElementById('modal').style.display='flex'
}catch(e){console.error(e)}
}
function closeModal(){document.getElementById('modal').style.display='none'}
function changePage(d){page=Math.max(1,page+d);load()}
function fmt(n,d){d=d||2;if(n==null)return'--';return Number(n).toLocaleString('es-ES',{minimumFractionDigits:d,maximumFractionDigits:d})}
function fmtN(n){if(n==null)return'--';return Number(n).toLocaleString('es-ES')}
window.addEventListener('load',function(){
renderW()
if(TK&&USR.id)showApp()
})