apps: - api: Hono REST server, all §26 endpoints, 14 tests - worker: delivery runner + payment-confirm + access-sync + renewal + webhook-retry jobs wired to real package clients - dashboard: Next.js merchant dashboard, full §16/§27 sections + §28 product builder - checkout: Next.js hosted USDC checkout with real delivery materialization - marketplace: Next.js public marketplace + agent metadata.json route - admin: Next.js risk/ops console wired to @settlekit/risk + database - docs: Next.js docs site (9 static routes) - examples: 5 runnable end-to-end examples fix(x402): support pinned config.nonce so a stateless verifier can confirm the challenge nonce round-trips (default stays random; package tests intact). Full workspace: 590 tests passing (122 files), tsc green for all packages + api/worker/examples, all 5 Next apps typecheck clean, docs next build green.
15 lines
540 B
TypeScript
15 lines
540 B
TypeScript
import { NextResponse } from "next/server";
|
|
import type { ApiEnvelope } from "./api";
|
|
|
|
/** Build a successful JSON envelope response. */
|
|
export function ok<T>(data: T, status = 200): NextResponse {
|
|
const body: ApiEnvelope<T> = { ok: true, data, error: null };
|
|
return NextResponse.json(body, { status });
|
|
}
|
|
|
|
/** Build an error JSON envelope response. */
|
|
export function fail(error: string, status = 400): NextResponse {
|
|
const body: ApiEnvelope<never> = { ok: false, data: null, error };
|
|
return NextResponse.json(body, { status });
|
|
}
|