import { apiRoute } from '@/lib/api/handler'
import { listProofs } from '@/lib/services/proof-service'

export const dynamic = 'force-dynamic'

/** Every frozen proof, newest first. */
export const GET = apiRoute({ permission: 'proof.read' }, async ({ searchParams }) => {
  const limit = Math.min(60, Math.max(1, Number(searchParams.get('limit')) || 20))
  const assetCode = searchParams.get('asset') ?? undefined
  return { proofs: await listProofs({ limit, assetCode }) }
})
