Files
mpc/dashboard/app/audit/page.tsx
zeekay 6b38df60a4 feat: MPC wallet dashboard - full-stack implementation
Complete MPC wallet management platform rivaling Fireblocks/Utila/Fordefi:

Backend (Go):
- REST API with 60+ endpoints on chi router (pkg/api/)
- PostgreSQL schema with 13 tables (pkg/db/)
- JWT + MFA auth, bcrypt passwords, API key management
- Policy engine (deny/approve/require_approval)
- Transaction signing flow with approval workflow
- Subscription scheduler for recurring payments
- Payment requests with public pay pages
- Safe + ERC-4337 smart wallet integration (pkg/smart/)
- Rate limiting, webhook delivery (HMAC-SHA256), audit logging
- 27 passing tests (auth, policy engine, middleware)

Frontend (Next.js 14):
- 27 routes with monochrome dark theme (Tailwind + Geist fonts)
- Full API client with JWT auto-refresh
- React Query hooks for all resources
- Pages: dashboard, vaults, wallets, transactions, policies,
  whitelist, team, settings, API keys, webhooks, audit,
  subscriptions, payments, smart wallets

Infrastructure:
- Dockerfiles for API (Go) and dashboard (Next.js standalone)
- compose.yml for local development (PostgreSQL + API + dashboard)
- K8s manifests for mpc.lux.network + cloud.lux.network
- GitHub Actions deploy workflow (build → push GHCR → kubectl apply)
- TLS via cert-manager, Traefik IngressRoute for both domains
2025-12-27 13:11:38 -08:00

78 lines
3.1 KiB
TypeScript

'use client'
import { useState, useEffect } from 'react'
import { Nav } from '@/components/layout/nav'
import { api } from '@/lib/api'
import type { AuditEntry } from '@/lib/types'
export default function AuditPage() {
const [entries, setEntries] = useState<AuditEntry[]>([])
const [error, setError] = useState('')
useEffect(() => {
api.listAudit().then(setEntries).catch((e) => setError(e.message))
}, [])
return (
<>
<Nav />
<main className="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
<div className="mb-8">
<h1 className="text-2xl font-semibold tracking-tight">Audit Log</h1>
<p className="mt-1 text-sm text-muted-foreground">Track all actions performed in the system.</p>
</div>
{error && <p className="mb-4 text-sm text-destructive">{error}</p>}
<div className="overflow-x-auto rounded-lg border border-border">
<table className="w-full text-sm">
<thead>
<tr className="border-b border-border bg-muted/50">
<th className="px-4 py-3 text-left font-medium text-muted-foreground">Action</th>
<th className="px-4 py-3 text-left font-medium text-muted-foreground">Resource</th>
<th className="px-4 py-3 text-left font-medium text-muted-foreground">User</th>
<th className="px-4 py-3 text-left font-medium text-muted-foreground">Date</th>
<th className="px-4 py-3 text-left font-medium text-muted-foreground">IP</th>
</tr>
</thead>
<tbody>
{entries.map((entry) => (
<tr key={entry.id} className="border-b border-border last:border-0">
<td className="px-4 py-3 font-medium">{entry.action}</td>
<td className="px-4 py-3">
{entry.resource_type && (
<span className="text-muted-foreground">
{entry.resource_type}
{entry.resource_id && (
<span className="ml-1 font-mono text-xs">{entry.resource_id.slice(0, 12)}...</span>
)}
</span>
)}
{!entry.resource_type && <span className="text-muted-foreground">--</span>}
</td>
<td className="px-4 py-3 font-mono text-xs text-muted-foreground">
{entry.user_id || '--'}
</td>
<td className="px-4 py-3 text-muted-foreground">
{new Date(entry.created_at).toLocaleString()}
</td>
<td className="px-4 py-3 font-mono text-xs text-muted-foreground">
{entry.ip_address || '--'}
</td>
</tr>
))}
{entries.length === 0 && (
<tr>
<td colSpan={5} className="px-4 py-8 text-center text-muted-foreground">
No audit entries.
</td>
</tr>
)}
</tbody>
</table>
</div>
</main>
</>
)
}