@lunora/x402 1.0.0-alpha.4 → 1.0.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +18 -0
- package/README.md +18 -0
- package/dist/charge/index.d.mts +155 -95
- package/dist/charge/index.d.ts +155 -95
- package/dist/charge/index.mjs +1 -7
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.mjs +1 -2
- package/dist/packem_shared/DEFAULT_ALLOWED_ASSETS-hq1xeZL6.mjs +1 -0
- package/dist/packem_shared/DEFAULT_FACILITATOR_URL-CPJNUMvi.mjs +1 -0
- package/dist/packem_shared/EVM_NETWORKS-C5yyzK27.mjs +1 -0
- package/dist/packem_shared/createChargeMiddleware-CURPSr23.mjs +1 -0
- package/dist/packem_shared/createFacilitatorClient-piLSnKs5.mjs +1 -0
- package/dist/packem_shared/createPayFetch-lyg7i3Js.mjs +1 -0
- package/dist/packem_shared/createProcedureChargeGate-Ki_K8dQE.mjs +1 -0
- package/dist/packem_shared/index.d-CzQaqaP6.d.mts +533 -0
- package/dist/packem_shared/index.d-CzQaqaP6.d.ts +533 -0
- package/dist/packem_shared/optional-peer-BBhVxozi.mjs +1 -0
- package/dist/packem_shared/registerWallet-DvCt0Q7M.mjs +1 -0
- package/dist/packem_shared/toPaymentEventRow-DTXuTDh0.mjs +1 -0
- package/dist/packem_shared/withX402-CJcBVHdI.mjs +1 -0
- package/dist/pay/index.d.mts +61 -61
- package/dist/pay/index.d.ts +61 -61
- package/dist/pay/index.mjs +1 -21
- package/package.json +21 -9
- package/dist/packem_shared/DEFAULT_FACILITATOR_URL-Cbz6kIqa.mjs +0 -4
- package/dist/packem_shared/DEFAULT_STABLECOIN_DECIMALS-CpW619nu.mjs +0 -90
- package/dist/packem_shared/EVM_NETWORKS-BhnYWUQ4.mjs +0 -26
- package/dist/packem_shared/config.d-5Nqi5iox.d.mts +0 -404
- package/dist/packem_shared/config.d-5Nqi5iox.d.ts +0 -404
- package/dist/packem_shared/createChargeMiddleware-D3yhOpFs.mjs +0 -162
- package/dist/packem_shared/createFacilitatorClient-rXHBnCZm.mjs +0 -16
- package/dist/packem_shared/createPayFetch-BeT05njL.mjs +0 -17
- package/dist/packem_shared/createProcedureChargeGate-eh9yv36U.mjs +0 -21
- package/dist/packem_shared/registerWallet-I4pVwq65.mjs +0 -109
- package/dist/packem_shared/toPaymentEventRow-DW4O9N7Y.mjs +0 -22
- package/dist/packem_shared/withX402-DILL2DvD.mjs +0 -15
package/LICENSE.md
CHANGED
|
@@ -108,4 +108,22 @@ specific language governing permissions and limitations under the License.
|
|
|
108
108
|
<!-- /DEPENDENCIES -->
|
|
109
109
|
|
|
110
110
|
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
|
|
112
|
+
# Licenses of bundled types
|
|
113
|
+
The published @lunora/x402 artifact additionally contains code with the following licenses:
|
|
114
|
+
Apache-2.0
|
|
115
|
+
|
|
116
|
+
# Bundled types:
|
|
117
|
+
## @x402/evm
|
|
118
|
+
License: Apache-2.0
|
|
119
|
+
By: x402 Foundation
|
|
120
|
+
Repository: https://github.com/x402-foundation/x402
|
|
121
|
+
|
|
122
|
+
---------------------------------------
|
|
123
|
+
|
|
124
|
+
## @x402/svm
|
|
125
|
+
License: Apache-2.0
|
|
126
|
+
By: x402 Foundation
|
|
127
|
+
Repository: https://github.com/x402-foundation/x402
|
|
128
|
+
|
|
111
129
|
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -25,6 +25,24 @@ The root export (`@lunora/x402`) carries only the shared config/types
|
|
|
25
25
|
(`.x402({ price })`), and MCP tools behind a USDC price; the **pay** rail signs and
|
|
26
26
|
retries `402` challenges under a mandatory spend policy.
|
|
27
27
|
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
The chain toolchains are **optional peers**, so an EVM-only deployment never
|
|
31
|
+
installs Solana's (heavy) toolchain and vice versa. Install the pair your
|
|
32
|
+
network family needs alongside the package:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm add @lunora/x402 # protocol core only
|
|
36
|
+
pnpm add @x402/evm viem # + EVM networks (Base, Arbitrum, …)
|
|
37
|
+
pnpm add @x402/svm @solana/kit # + Solana networks
|
|
38
|
+
pnpm add @coinbase/cdp-sdk # + CDP-managed custody (EVM)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Missing a peer fails with an `ENV_INVALID` error naming exactly what to install.
|
|
42
|
+
Note that TypeScript needs the same peers present to resolve the pay rail's
|
|
43
|
+
signer types (`ClientSvmSigner` resolves through `@solana/kit`); with neither
|
|
44
|
+
family installed, compile the package's declarations under `skipLibCheck`.
|
|
45
|
+
|
|
28
46
|
## Networks & custody
|
|
29
47
|
|
|
30
48
|
- **EVM** (Base, Arbitrum, Ethereum, Polygon, …) is signed via [`@x402/evm`](https://npmjs.com/package/@x402/evm) + [viem](https://viem.sh); pass a raw CAIP-2 id for chains without a friendly alias.
|
package/dist/charge/index.d.mts
CHANGED
|
@@ -1,112 +1,136 @@
|
|
|
1
|
-
import { F as FacilitatorConfig,
|
|
2
|
-
export { type
|
|
1
|
+
import { F as FacilitatorConfig, q as X402ChargeConfig, h as X402Price } from "../packem_shared/index.d-CzQaqaP6.mjs";
|
|
2
|
+
export { type b as Caip2, c as DEFAULT_FACILITATOR_URL,
|
|
3
|
+
/**
|
|
4
|
+
* `@lunora/x402/charge` — the charge rail (server side).
|
|
5
|
+
*
|
|
6
|
+
* A Lunora deployment gates a resource (an HTTP-action route, a procedure, or
|
|
7
|
+
* an MCP tool) behind a USDC price: it returns `402 Payment Required` with a
|
|
8
|
+
* `PAYMENT-REQUIRED` header, verifies the client's `X-PAYMENT` payload (via a
|
|
9
|
+
* facilitator), runs the handler, settles, and attaches `X-PAYMENT-RESPONSE`.
|
|
10
|
+
*
|
|
11
|
+
* `withX402` gates a Lunora HTTP action; `createChargeMiddleware` is the
|
|
12
|
+
* framework-agnostic core for other surfaces (procedures, MCP tools).
|
|
13
|
+
*/
|
|
14
|
+
type E as EvmAddress, type P as PaymentEventRow, type g as X402Network, type s as X402Receipt, type v as X402ReceiptSink,
|
|
15
|
+
/**
|
|
16
|
+
* `@lunora/x402/charge` — the charge rail (server side).
|
|
17
|
+
*
|
|
18
|
+
* A Lunora deployment gates a resource (an HTTP-action route, a procedure, or
|
|
19
|
+
* an MCP tool) behind a USDC price: it returns `402 Payment Required` with a
|
|
20
|
+
* `PAYMENT-REQUIRED` header, verifies the client's `X-PAYMENT` payload (via a
|
|
21
|
+
* facilitator), runs the handler, settles, and attaches `X-PAYMENT-RESPONSE`.
|
|
22
|
+
*
|
|
23
|
+
* `withX402` gates a Lunora HTTP action; `createChargeMiddleware` is the
|
|
24
|
+
* framework-agnostic core for other surfaces (procedures, MCP tools).
|
|
25
|
+
*/
|
|
26
|
+
type w as X402Recipient, n as isEvmNetwork, o as isSvmNetwork, p as resolveFacilitatorUrl, t as toCaip2, x as toPaymentEventRow, y as toReceipt } from "../packem_shared/index.d-CzQaqaP6.mjs";
|
|
3
27
|
import { HTTPFacilitatorClient } from '@x402/core/server';
|
|
4
28
|
import { RouteConfig } from '@x402/core/http';
|
|
5
|
-
import '@x402/evm';
|
|
6
|
-
import '@x402/svm';
|
|
7
29
|
import '@x402/core/client';
|
|
8
30
|
import '@x402/core/types';
|
|
31
|
+
import '@solana/accounts';
|
|
9
32
|
/**
|
|
10
|
-
* Build an `@x402/core` facilitator client from Lunora's {@link FacilitatorConfig}.
|
|
11
|
-
*
|
|
12
|
-
* `config.headers` (e.g. a CDP bearer token) are applied to every facilitator
|
|
13
|
-
* call — `@x402/core` splits auth per endpoint (`verify` / `settle` /
|
|
14
|
-
* `supported`), so the same header map is handed to each. With no config the
|
|
15
|
-
* client points at the public {@link resolveFacilitatorUrl default} and sends no
|
|
16
|
-
* auth headers.
|
|
17
|
-
* @experimental
|
|
18
|
-
*/
|
|
33
|
+
* Build an `@x402/core` facilitator client from Lunora's {@link FacilitatorConfig}.
|
|
34
|
+
*
|
|
35
|
+
* `config.headers` (e.g. a CDP bearer token) are applied to every facilitator
|
|
36
|
+
* call — `@x402/core` splits auth per endpoint (`verify` / `settle` /
|
|
37
|
+
* `supported`), so the same header map is handed to each. With no config the
|
|
38
|
+
* client points at the public {@link resolveFacilitatorUrl default} and sends no
|
|
39
|
+
* auth headers.
|
|
40
|
+
* @experimental
|
|
41
|
+
*/
|
|
19
42
|
declare const createFacilitatorClient: (config?: FacilitatorConfig) => HTTPFacilitatorClient;
|
|
20
43
|
/**
|
|
21
|
-
* A handler shaped like a Lunora HTTP action: `(context, request) => Response`.
|
|
22
|
-
* @experimental
|
|
23
|
-
*/
|
|
44
|
+
* A handler shaped like a Lunora HTTP action: `(context, request) => Response`.
|
|
45
|
+
* @experimental
|
|
46
|
+
*/
|
|
24
47
|
type HttpActionHandler<Context> = (context: Context, request: Request) => Promise<Response> | Response;
|
|
25
48
|
/**
|
|
26
|
-
* Gate `handler` behind an x402 paywall described by `config`. Returns a handler
|
|
27
|
-
* of the same shape, ready to pass to `httpAction`.
|
|
28
|
-
* @experimental
|
|
29
|
-
*/
|
|
49
|
+
* Gate `handler` behind an x402 paywall described by `config`. Returns a handler
|
|
50
|
+
* of the same shape, ready to pass to `httpAction`.
|
|
51
|
+
* @experimental
|
|
52
|
+
*/
|
|
30
53
|
declare const withX402: <Context>(config: X402ChargeConfig, handler: HttpActionHandler<Context>) => HttpActionHandler<Context>;
|
|
31
54
|
/**
|
|
32
|
-
* Runs the protected resource handler, producing the Response to gate.
|
|
33
|
-
* @experimental
|
|
34
|
-
*/
|
|
55
|
+
* Runs the protected resource handler, producing the Response to gate.
|
|
56
|
+
* @experimental
|
|
57
|
+
*/
|
|
35
58
|
type ChargeHandler = () => Promise<Response> | Response;
|
|
36
59
|
/**
|
|
37
|
-
* Per-request platform seams `handle` can use, beyond the request/handler pair.
|
|
38
|
-
* @experimental
|
|
39
|
-
*/
|
|
60
|
+
* Per-request platform seams `handle` can use, beyond the request/handler pair.
|
|
61
|
+
* @experimental
|
|
62
|
+
*/
|
|
40
63
|
interface ChargeHandlerDeps {
|
|
41
64
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
* Keep background work (the receipt sink) alive past the response — the
|
|
66
|
+
* request's `ctx.waitUntil`. Absent on paths with no platform execution
|
|
67
|
+
* context reaching the middleware (e.g. today's HTTP-action rail).
|
|
68
|
+
*/
|
|
46
69
|
readonly waitUntil?: (promise: Promise<unknown>) => void;
|
|
47
70
|
}
|
|
48
71
|
/**
|
|
49
|
-
* A prepared, initialised paywall. Build once (it fetches facilitator support), reuse per request.
|
|
50
|
-
* @experimental
|
|
51
|
-
*/
|
|
72
|
+
* A prepared, initialised paywall. Build once (it fetches facilitator support), reuse per request.
|
|
73
|
+
* @experimental
|
|
74
|
+
*/
|
|
52
75
|
interface ChargeMiddleware {
|
|
53
76
|
/** Gate `request`: challenge / verify / settle around `runHandler`. */
|
|
54
77
|
handle: (request: Request, runHandler: ChargeHandler, deps?: ChargeHandlerDeps) => Promise<Response>;
|
|
55
78
|
}
|
|
56
79
|
/**
|
|
57
|
-
* Route metadata a caller can layer onto the generated catch-all route. The
|
|
58
|
-
* procedure gate sets `resource` to the `functionPath` so the x402 challenge
|
|
59
|
-
* names the paid function (x402 core falls back to the request URL otherwise —
|
|
60
|
-
* every RPC POSTs to the same `/_lunora/rpc`, so the URL can't tell two paid
|
|
61
|
-
* procedures apart).
|
|
62
|
-
* @experimental
|
|
63
|
-
*/
|
|
80
|
+
* Route metadata a caller can layer onto the generated catch-all route. The
|
|
81
|
+
* procedure gate sets `resource` to the `functionPath` so the x402 challenge
|
|
82
|
+
* names the paid function (x402 core falls back to the request URL otherwise —
|
|
83
|
+
* every RPC POSTs to the same `/_lunora/rpc`, so the URL can't tell two paid
|
|
84
|
+
* procedures apart).
|
|
85
|
+
* @experimental
|
|
86
|
+
*/
|
|
64
87
|
type ChargeRouteOverrides = Pick<RouteConfig, "description" | "resource">;
|
|
65
88
|
/**
|
|
66
|
-
* Behaviour knobs for {@link createChargeMiddleware} beyond route metadata.
|
|
67
|
-
* @experimental
|
|
68
|
-
*/
|
|
89
|
+
* Behaviour knobs for {@link createChargeMiddleware} beyond route metadata.
|
|
90
|
+
* @experimental
|
|
91
|
+
*/
|
|
69
92
|
interface ChargeMiddlewareOptions {
|
|
70
93
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
* Settle the verified payment **before** dispatching `runHandler`, instead
|
|
95
|
+
* of after. **Default `true`** — a settlement failure then means the handler
|
|
96
|
+
* never runs at all, so its side effects (writes, LLM calls, mail, push) can
|
|
97
|
+
* never happen unpaid. This matters because `verifyPayment` only checks the
|
|
98
|
+
* signed intent, NOT solvency: an underfunded or facilitator-refused payment
|
|
99
|
+
* passes verify and fails at `/settle`. Once settlement succeeds the payment
|
|
100
|
+
* is final (on-chain) — a handler failure after that point is a normal
|
|
101
|
+
* application error, not a payment to unwind: there is nothing left to
|
|
102
|
+
* cancel, so it is not caught here and simply propagates.
|
|
103
|
+
*
|
|
104
|
+
* Set `false` for settle-after: the handler's response is passed to
|
|
105
|
+
* settlement as transport context (`responseHeaders` — read by some schemes
|
|
106
|
+
* for settlement overrides), and a handler throw releases the
|
|
107
|
+
* verified-but-unsettled payment via `cancellationDispatcher.cancel`.
|
|
108
|
+
* Settlement can still FAIL after the handler already ran on this path, so a
|
|
109
|
+
* handler gated this way MUST be idempotent or compensatable — opt in only
|
|
110
|
+
* when you need the response as settlement context and can accept that.
|
|
111
|
+
*/
|
|
88
112
|
readonly settleBeforeHandler?: boolean;
|
|
89
113
|
}
|
|
90
114
|
/**
|
|
91
|
-
* Build and initialise a {@link ChargeMiddleware} for `config`. Fetches
|
|
92
|
-
* facilitator support once (via `initialize()`), so call this once per config
|
|
93
|
-
* and reuse the result across requests. `routeOverrides` layers extra route
|
|
94
|
-
* metadata (e.g. `resource`) onto the generated catch-all route; `options`
|
|
95
|
-
* controls settlement ordering (see {@link ChargeMiddlewareOptions}).
|
|
96
|
-
* @experimental
|
|
97
|
-
*/
|
|
115
|
+
* Build and initialise a {@link ChargeMiddleware} for `config`. Fetches
|
|
116
|
+
* facilitator support once (via `initialize()`), so call this once per config
|
|
117
|
+
* and reuse the result across requests. `routeOverrides` layers extra route
|
|
118
|
+
* metadata (e.g. `resource`) onto the generated catch-all route; `options`
|
|
119
|
+
* controls settlement ordering (see {@link ChargeMiddlewareOptions}).
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
98
122
|
declare const createChargeMiddleware: (config: X402ChargeConfig, routeOverrides?: ChargeRouteOverrides, options?: ChargeMiddlewareOptions) => Promise<ChargeMiddleware>;
|
|
99
123
|
/**
|
|
100
|
-
* Charge config for the procedure gate: the worker-level settlement vocabulary
|
|
101
|
-
* (network, recipient, facilitator) minus `price` — price is per-procedure and
|
|
102
|
-
* arrives with each {@link X402ProcedureSpec}.
|
|
103
|
-
* @experimental
|
|
104
|
-
*/
|
|
124
|
+
* Charge config for the procedure gate: the worker-level settlement vocabulary
|
|
125
|
+
* (network, recipient, facilitator) minus `price` — price is per-procedure and
|
|
126
|
+
* arrives with each {@link X402ProcedureSpec}.
|
|
127
|
+
* @experimental
|
|
128
|
+
*/
|
|
105
129
|
type X402ProcedureChargeConfig = Omit<X402ChargeConfig, "price">;
|
|
106
130
|
/**
|
|
107
|
-
* The per-RPC charge spec the runtime passes the gate for each paid dispatch.
|
|
108
|
-
* @experimental
|
|
109
|
-
*/
|
|
131
|
+
* The per-RPC charge spec the runtime passes the gate for each paid dispatch.
|
|
132
|
+
* @experimental
|
|
133
|
+
*/
|
|
110
134
|
interface X402ProcedureSpec {
|
|
111
135
|
/** The `file:function` id of the paid procedure; becomes the x402 challenge `resource`. */
|
|
112
136
|
readonly functionPath: string;
|
|
@@ -114,26 +138,62 @@ interface X402ProcedureSpec {
|
|
|
114
138
|
readonly price: X402Price;
|
|
115
139
|
}
|
|
116
140
|
/**
|
|
117
|
-
* Gate one paid RPC. Returns a real `402` + `PAYMENT-REQUIRED` challenge when the
|
|
118
|
-
* request is unpaid, or the dispatched response (with `X-PAYMENT-RESPONSE`
|
|
119
|
-
* attached) once the client's `X-PAYMENT` is verified and settled. `dispatch`
|
|
120
|
-
* runs the actual shard forward — settlement happens **before** `dispatch` is
|
|
121
|
-
* invoked (settle-first), so a settlement failure means the shard forward
|
|
122
|
-
* (the mutation's commit) never runs at all — no committed-but-unpaid write is
|
|
123
|
-
* possible. `deps.waitUntil`, when supplied (the request's `ctx.waitUntil`),
|
|
124
|
-
* keeps the opt-in receipt sink alive past the response.
|
|
125
|
-
* @experimental
|
|
126
|
-
*/
|
|
141
|
+
* Gate one paid RPC. Returns a real `402` + `PAYMENT-REQUIRED` challenge when the
|
|
142
|
+
* request is unpaid, or the dispatched response (with `X-PAYMENT-RESPONSE`
|
|
143
|
+
* attached) once the client's `X-PAYMENT` is verified and settled. `dispatch`
|
|
144
|
+
* runs the actual shard forward — settlement happens **before** `dispatch` is
|
|
145
|
+
* invoked (settle-first), so a settlement failure means the shard forward
|
|
146
|
+
* (the mutation's commit) never runs at all — no committed-but-unpaid write is
|
|
147
|
+
* possible. `deps.waitUntil`, when supplied (the request's `ctx.waitUntil`),
|
|
148
|
+
* keeps the opt-in receipt sink alive past the response.
|
|
149
|
+
* @experimental
|
|
150
|
+
*/
|
|
127
151
|
type X402ProcedureChargeGate = (request: Request, spec: X402ProcedureSpec, dispatch: () => Promise<Response>, deps?: ChargeHandlerDeps) => Promise<Response>;
|
|
128
152
|
/**
|
|
129
|
-
* Build the injectable procedure charge gate for `config`. One initialised
|
|
130
|
-
* {@link ChargeMiddleware} is memoised per `functionPath` (each bakes that
|
|
131
|
-
* function's price + `resource`), since `createChargeMiddleware` fetches
|
|
132
|
-
* facilitator support on first use. A failed init is not cached, so a transient
|
|
133
|
-
* facilitator outage retries on the next request. Settlement runs before
|
|
134
|
-
* `dispatch` (`settleBeforeHandler
|
|
135
|
-
* procedure's real mutation — see `createChargeMiddleware`'s `ChargeMiddlewareOptions`.
|
|
136
|
-
* @experimental
|
|
137
|
-
*/
|
|
153
|
+
* Build the injectable procedure charge gate for `config`. One initialised
|
|
154
|
+
* {@link ChargeMiddleware} is memoised per `functionPath` (each bakes that
|
|
155
|
+
* function's price + `resource`), since `createChargeMiddleware` fetches
|
|
156
|
+
* facilitator support on first use. A failed init is not cached, so a transient
|
|
157
|
+
* facilitator outage retries on the next request. Settlement runs before
|
|
158
|
+
* `dispatch` (the `settleBeforeHandler` default) since `dispatch` commits the
|
|
159
|
+
* procedure's real mutation — see `createChargeMiddleware`'s `ChargeMiddlewareOptions`.
|
|
160
|
+
* @experimental
|
|
161
|
+
*/
|
|
138
162
|
declare const createProcedureChargeGate: (config: X402ProcedureChargeConfig) => X402ProcedureChargeGate;
|
|
139
|
-
export { type ChargeHandler, type ChargeHandlerDeps, type ChargeMiddleware, type ChargeMiddlewareOptions, type ChargeRouteOverrides,
|
|
163
|
+
export { type ChargeHandler, type ChargeHandlerDeps, type ChargeMiddleware, type ChargeMiddlewareOptions, type ChargeRouteOverrides,
|
|
164
|
+
/**
|
|
165
|
+
* `@lunora/x402/charge` — the charge rail (server side).
|
|
166
|
+
*
|
|
167
|
+
* A Lunora deployment gates a resource (an HTTP-action route, a procedure, or
|
|
168
|
+
* an MCP tool) behind a USDC price: it returns `402 Payment Required` with a
|
|
169
|
+
* `PAYMENT-REQUIRED` header, verifies the client's `X-PAYMENT` payload (via a
|
|
170
|
+
* facilitator), runs the handler, settles, and attaches `X-PAYMENT-RESPONSE`.
|
|
171
|
+
*
|
|
172
|
+
* `withX402` gates a Lunora HTTP action; `createChargeMiddleware` is the
|
|
173
|
+
* framework-agnostic core for other surfaces (procedures, MCP tools).
|
|
174
|
+
*/
|
|
175
|
+
type FacilitatorConfig, type HttpActionHandler,
|
|
176
|
+
/**
|
|
177
|
+
* `@lunora/x402/charge` — the charge rail (server side).
|
|
178
|
+
*
|
|
179
|
+
* A Lunora deployment gates a resource (an HTTP-action route, a procedure, or
|
|
180
|
+
* an MCP tool) behind a USDC price: it returns `402 Payment Required` with a
|
|
181
|
+
* `PAYMENT-REQUIRED` header, verifies the client's `X-PAYMENT` payload (via a
|
|
182
|
+
* facilitator), runs the handler, settles, and attaches `X-PAYMENT-RESPONSE`.
|
|
183
|
+
*
|
|
184
|
+
* `withX402` gates a Lunora HTTP action; `createChargeMiddleware` is the
|
|
185
|
+
* framework-agnostic core for other surfaces (procedures, MCP tools).
|
|
186
|
+
*/
|
|
187
|
+
type X402ChargeConfig,
|
|
188
|
+
/**
|
|
189
|
+
* `@lunora/x402/charge` — the charge rail (server side).
|
|
190
|
+
*
|
|
191
|
+
* A Lunora deployment gates a resource (an HTTP-action route, a procedure, or
|
|
192
|
+
* an MCP tool) behind a USDC price: it returns `402 Payment Required` with a
|
|
193
|
+
* `PAYMENT-REQUIRED` header, verifies the client's `X-PAYMENT` payload (via a
|
|
194
|
+
* facilitator), runs the handler, settles, and attaches `X-PAYMENT-RESPONSE`.
|
|
195
|
+
*
|
|
196
|
+
* `withX402` gates a Lunora HTTP action; `createChargeMiddleware` is the
|
|
197
|
+
* framework-agnostic core for other surfaces (procedures, MCP tools).
|
|
198
|
+
*/
|
|
199
|
+
type X402Price, type X402ProcedureChargeConfig, type X402ProcedureChargeGate, type X402ProcedureSpec, createChargeMiddleware, createFacilitatorClient, createProcedureChargeGate, withX402 };
|