Repository navigation
radius-sdk@0.4.0
·
120 commits
to main
since this release
Minor Changes
-
bdd6d76: Accept payments from any HTTP stack, not just Hono. New
radius-sdk/serverentry point:radiusPayments()is a web-standard handler (Requestin,Responseout) for Cloudflare Workers without a framework, Bun, Deno, Node 18+, and Next.js / SvelteKit / Remix route handlers. Paid handlers receive the settled receipt as a second argument.createRadiusServer()exposes the Radius x402 resource server and aroutes()builder that plug straight into the upstream adapters:paymentMiddleware(radius.routes({ … }), radius.server)with@x402/express,@x402/nextor@x402/hono.onSettledis registered on the resource server, so it fires whichever adapter served the request (it receives the x402 request context;requestOf(context)returns theRequestfor the SDK's own adapters). Errors thrown byonSettledare logged by x402 core instead of failing the request.- Paid responses stream through in the default
settle: 'before'flow instead of being buffered (the previous Hono middleware buffered every paid response, stalling SSE and token streams). - Breaking:
radius-sdk/honois now a thin wrapper over the web-standard handler with the same options.RadiusHonoAdapteris removed;RequestAdapterfromradius-sdk/server(an x402HTTPAdapterover a web-standardRequest) replaces it. @x402/core/@x402/evmbumped to 2.27.0 (the version line the upstream adapters require).- New examples:
examples/worker-plain(no framework),examples/express-seller(@x402/express) andexamples/astro-seller(validate before charging in an Astro API route).
Patch Changes
- 23f73d6:
radiusPaymentsaccepts facilitators that list theeip3009transfer method forexact. Previously every paid route answered 500 once the facilitator's/supportednamedeip3009beforepermit2. - 5a915b2:
radiusPaymentsanswers502(facilitator_error) when a facilitator call fails without the facilitator's own answer, such as a dropped connection or an error page from a gateway. These were reported as402, which a buyer reads as "rejected, nothing moved", although a settle may have reached the chain. The facilitator's own rejections are still402.