/** * Wraps a remote facilitator HTTP service as a `FacilitatorHandler`. * * This handler always sends v2 format requests and expects v2 responses. * Pointing it at a facilitator that only speaks v1 will produce validation * errors, which is the correct failure mode. */ import type { FacilitatorHandler } from "@faremeter/types/facilitator"; import type { HandlerCapabilities } from "@faremeter/types/pricing"; import { type x402PaymentRequirements } from "@faremeter/types/x402v2"; import type { AgedLRUCacheOpts } from "./cache.js"; type CreateHTTPFacilitatorHandlerOpts = { capabilities: HandlerCapabilities; schemes: string[]; fetch?: typeof fetch; cacheConfig?: AgedLRUCacheOpts & { disable?: boolean; }; /** * Original accepts to forward to the facilitator's /accepts endpoint. * When provided, getRequirements sends these instead of the glue * layer's constructed accepts. This preserves fields like `extra` * that ResourcePricing does not carry. * * This is backward-compat debt for the facilitatorURL path. It can be * removed when all callers migrate to in-process handlers or when the * facilitator accepts ResourcePricing natively. */ acceptsOverride?: Partial[]; }; /** * Creates a `FacilitatorHandler` that delegates to a remote facilitator * via HTTP. * * The glue layer constructs valid `x402PaymentRequirements` from * `ResourcePricing` using the handler's declared `schemes`, then passes * them to `getRequirements`. This handler POSTs those to the * facilitator's `/accepts` endpoint for enrichment. * * Cache key stability: caching assumes that identical `accepts` arrays * produce identical facilitator responses. If the facilitator returns * time-dependent values (e.g. `recentBlockhash`), use a short `maxAge` * or disable caching. */ export declare function createHTTPFacilitatorHandler(facilitatorURL: string, opts: CreateHTTPFacilitatorHandlerOpts): FacilitatorHandler; export {}; //# sourceMappingURL=http-handler.d.ts.map