@puga-labs/x402-mantle-sdk 0.3.8 → 0.3.10

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.
Files changed (49) hide show
  1. package/dist/chunk-3DGAB7HD.js +126 -0
  2. package/dist/chunk-CKBTOS7X.js +86 -0
  3. package/dist/chunk-IEJB5W26.js +113 -0
  4. package/dist/chunk-IXIFGPJ2.js +250 -0
  5. package/dist/chunk-JXMWK3BO.js +96 -0
  6. package/dist/chunk-P5FKQVHW.js +99 -0
  7. package/dist/chunk-T4DIHTBP.js +83 -0
  8. package/dist/chunk-UVYA6H32.js +293 -0
  9. package/dist/express-BWE0nQty.d.cts +68 -0
  10. package/dist/express-BvuN0Lx1.d.ts +68 -0
  11. package/dist/express-DqyVgO5n.d.cts +68 -0
  12. package/dist/express-DxxlKmmF.d.ts +68 -0
  13. package/dist/index.cjs +89 -10
  14. package/dist/index.d.cts +3 -3
  15. package/dist/index.d.ts +3 -3
  16. package/dist/index.js +2 -2
  17. package/dist/nextjs-Bujo9Okf.d.cts +89 -0
  18. package/dist/nextjs-CzSejZe8.d.ts +89 -0
  19. package/dist/nextjs-DGcN_MGa.d.ts +89 -0
  20. package/dist/nextjs-EoISXVEo.d.cts +89 -0
  21. package/dist/server-express.cjs +89 -10
  22. package/dist/server-express.d.cts +2 -2
  23. package/dist/server-express.d.ts +2 -2
  24. package/dist/server-express.js +2 -2
  25. package/dist/server-nextjs.cjs +90 -11
  26. package/dist/server-nextjs.d.cts +2 -2
  27. package/dist/server-nextjs.d.ts +2 -2
  28. package/dist/server-nextjs.js +2 -2
  29. package/dist/server-web.cjs +90 -11
  30. package/dist/server-web.d.cts +2 -2
  31. package/dist/server-web.d.ts +2 -2
  32. package/dist/server-web.js +2 -2
  33. package/dist/server.cjs +141 -12
  34. package/dist/server.d.cts +8 -7
  35. package/dist/server.d.ts +8 -7
  36. package/dist/server.js +4 -4
  37. package/dist/types-B87bD2yo.d.cts +102 -0
  38. package/dist/types-Ba0v9XsC.d.ts +108 -0
  39. package/dist/types-BkGUHT4x.d.cts +108 -0
  40. package/dist/types-DEpSrXCf.d.ts +112 -0
  41. package/dist/types-DrBw0xwj.d.cts +112 -0
  42. package/dist/types-DvKDSdL6.d.ts +106 -0
  43. package/dist/types-X6DeBEgb.d.cts +106 -0
  44. package/dist/types-vicT7qsY.d.ts +102 -0
  45. package/dist/web-standards-BJcdcxD6.d.ts +77 -0
  46. package/dist/web-standards-C6JwCDmd.d.cts +77 -0
  47. package/dist/web-standards-DsCZRJPE.d.ts +77 -0
  48. package/dist/web-standards-QCbyQ14G.d.cts +77 -0
  49. package/package.json +1 -1
@@ -0,0 +1,77 @@
1
+ import { M as MinimalPaywallOptions } from './types-Ba0v9XsC.js';
2
+
3
+ /**
4
+ * Web Standards route handler type.
5
+ * Takes a Request and returns a Response.
6
+ */
7
+ type WebHandler = (request: Request) => Promise<Response>;
8
+ /**
9
+ * Wrapper function that adds x402 payment verification to Web Standards handler.
10
+ */
11
+ type WebPaywallWrapper = (handler: WebHandler) => WebHandler;
12
+ /**
13
+ * Create Web Standards middleware for x402 payment verification.
14
+ * Uses Mantle mainnet defaults (USDC, exact scheme, etc.).
15
+ *
16
+ * Compatible with:
17
+ * - Hono
18
+ * - Cloudflare Workers
19
+ * - Deno
20
+ * - Bun
21
+ * - Any platform supporting Web Request/Response API
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Hono example
26
+ * import { Hono } from 'hono'
27
+ * import { mantlePaywall } from '@puga-labs/x402-mantle-sdk/server/web'
28
+ *
29
+ * const app = new Hono()
30
+ * const pay = mantlePaywall({
31
+ * priceUsd: 0.01,
32
+ * payTo: '0x...',
33
+ * });
34
+ *
35
+ * app.post('/api/generate', pay(async (req) => {
36
+ * const body = await req.json();
37
+ * // Your handler code here
38
+ * return new Response(JSON.stringify({ success: true }), {
39
+ * headers: { 'Content-Type': 'application/json' }
40
+ * });
41
+ * }));
42
+ * ```
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * // Cloudflare Workers example
47
+ * import { mantlePaywall } from '@puga-labs/x402-mantle-sdk/server/web'
48
+ *
49
+ * const pay = mantlePaywall({
50
+ * priceUsd: 0.01,
51
+ * payTo: '0x...',
52
+ * });
53
+ *
54
+ * export default {
55
+ * async fetch(request: Request) {
56
+ * const handler = pay(async (req) => {
57
+ * // Your handler code here
58
+ * return new Response('Hello World');
59
+ * });
60
+ * return handler(request);
61
+ * }
62
+ * }
63
+ * ```
64
+ *
65
+ * @param opts - Minimal configuration (price, payTo, optional facilitator/telemetry).
66
+ * @returns Function that wraps Web Standards handlers with payment verification.
67
+ */
68
+ declare function mantlePaywall(opts: MinimalPaywallOptions): WebPaywallWrapper;
69
+
70
+ type webStandards_WebHandler = WebHandler;
71
+ type webStandards_WebPaywallWrapper = WebPaywallWrapper;
72
+ declare const webStandards_mantlePaywall: typeof mantlePaywall;
73
+ declare namespace webStandards {
74
+ export { type webStandards_WebHandler as WebHandler, type webStandards_WebPaywallWrapper as WebPaywallWrapper, webStandards_mantlePaywall as mantlePaywall };
75
+ }
76
+
77
+ export { type WebHandler as W, type WebPaywallWrapper as a, mantlePaywall as m, webStandards as w };
@@ -0,0 +1,77 @@
1
+ import { M as MinimalPaywallOptions } from './types-BkGUHT4x.cjs';
2
+
3
+ /**
4
+ * Web Standards route handler type.
5
+ * Takes a Request and returns a Response.
6
+ */
7
+ type WebHandler = (request: Request) => Promise<Response>;
8
+ /**
9
+ * Wrapper function that adds x402 payment verification to Web Standards handler.
10
+ */
11
+ type WebPaywallWrapper = (handler: WebHandler) => WebHandler;
12
+ /**
13
+ * Create Web Standards middleware for x402 payment verification.
14
+ * Uses Mantle mainnet defaults (USDC, exact scheme, etc.).
15
+ *
16
+ * Compatible with:
17
+ * - Hono
18
+ * - Cloudflare Workers
19
+ * - Deno
20
+ * - Bun
21
+ * - Any platform supporting Web Request/Response API
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Hono example
26
+ * import { Hono } from 'hono'
27
+ * import { mantlePaywall } from '@puga-labs/x402-mantle-sdk/server/web'
28
+ *
29
+ * const app = new Hono()
30
+ * const pay = mantlePaywall({
31
+ * priceUsd: 0.01,
32
+ * payTo: '0x...',
33
+ * });
34
+ *
35
+ * app.post('/api/generate', pay(async (req) => {
36
+ * const body = await req.json();
37
+ * // Your handler code here
38
+ * return new Response(JSON.stringify({ success: true }), {
39
+ * headers: { 'Content-Type': 'application/json' }
40
+ * });
41
+ * }));
42
+ * ```
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * // Cloudflare Workers example
47
+ * import { mantlePaywall } from '@puga-labs/x402-mantle-sdk/server/web'
48
+ *
49
+ * const pay = mantlePaywall({
50
+ * priceUsd: 0.01,
51
+ * payTo: '0x...',
52
+ * });
53
+ *
54
+ * export default {
55
+ * async fetch(request: Request) {
56
+ * const handler = pay(async (req) => {
57
+ * // Your handler code here
58
+ * return new Response('Hello World');
59
+ * });
60
+ * return handler(request);
61
+ * }
62
+ * }
63
+ * ```
64
+ *
65
+ * @param opts - Minimal configuration (price, payTo, optional facilitator/telemetry).
66
+ * @returns Function that wraps Web Standards handlers with payment verification.
67
+ */
68
+ declare function mantlePaywall(opts: MinimalPaywallOptions): WebPaywallWrapper;
69
+
70
+ type webStandards_WebHandler = WebHandler;
71
+ type webStandards_WebPaywallWrapper = WebPaywallWrapper;
72
+ declare const webStandards_mantlePaywall: typeof mantlePaywall;
73
+ declare namespace webStandards {
74
+ export { type webStandards_WebHandler as WebHandler, type webStandards_WebPaywallWrapper as WebPaywallWrapper, webStandards_mantlePaywall as mantlePaywall };
75
+ }
76
+
77
+ export { type WebHandler as W, type WebPaywallWrapper as a, mantlePaywall as m, webStandards as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puga-labs/x402-mantle-sdk",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "x402 payments SDK for Mantle (USDC, gasless, facilitator-based)",
5
5
  "license": "MIT",
6
6
  "author": "Evgenii Pugachev <cyprus.pugamuga@gmail.com>",