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

@orangecheck/gate


@orangecheck/gate / withOcGate

Function: withOcGate()

function withOcGate<H>(handler: H, opts: GateOptions): H;

Defined in: next.ts:27

Next.js Pages Router API wrapper.

import { withOcGate } from '@orangecheck/gate';

async function handler(req, res) { // The decision is attached to req when the gate lets the call through. res.json({ hello: (req as any).orangecheck.sats }); }

export default withOcGate(handler, { minSats: 100_000, minDays: 30, address: { from: 'query', name: 'addr' }, });

Type Parameters

Type Parameter
H extends (req: any, res: any) => any

Parameters

ParameterType
handlerH
optsGateOptions

Returns

H