live · mainnetoc · docs
specs · api · guides
docs / documentation

@orangecheck/gate


@orangecheck/gate / ocGateFetch

Function: ocGateFetch()

function ocGateFetch(req: Request, opts: GateOptions): Promise<GateDecision>;

Defined in: next.ts:69

Framework-agnostic Fetch-style guard — for Next App Router route handlers, Cloudflare Workers, Hono, Bun, and friends.

export async function POST(req: Request) { const decision = await ocGateFetch(req, { minSats: 100_000, address: { from: 'header' }, }); if (!decision.ok) { return new Response(JSON.stringify({ error: decision.reason }), { status: 403 }); } // ... proceed }

Parameters

ParameterType
reqRequest
optsGateOptions

Returns

Promise&lt;GateDecision>