@agirails/sdk 3.2.0 → 3.4.1

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 (278) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +12 -14
  3. package/dist/ACTPClient.d.ts +8 -11
  4. package/dist/ACTPClient.d.ts.map +1 -1
  5. package/dist/ACTPClient.js +79 -20
  6. package/dist/ACTPClient.js.map +1 -1
  7. package/dist/__tests__/helpers/mockX402Server.d.ts +67 -0
  8. package/dist/__tests__/helpers/mockX402Server.d.ts.map +1 -0
  9. package/dist/__tests__/helpers/mockX402Server.js +121 -0
  10. package/dist/__tests__/helpers/mockX402Server.js.map +1 -0
  11. package/dist/adapters/BaseAdapter.d.ts +7 -1
  12. package/dist/adapters/BaseAdapter.d.ts.map +1 -1
  13. package/dist/adapters/BaseAdapter.js +11 -6
  14. package/dist/adapters/BaseAdapter.js.map +1 -1
  15. package/dist/adapters/BasicAdapter.d.ts.map +1 -1
  16. package/dist/adapters/BasicAdapter.js +12 -2
  17. package/dist/adapters/BasicAdapter.js.map +1 -1
  18. package/dist/adapters/StandardAdapter.d.ts.map +1 -1
  19. package/dist/adapters/StandardAdapter.js +12 -2
  20. package/dist/adapters/StandardAdapter.js.map +1 -1
  21. package/dist/adapters/X402Adapter.d.ts +161 -199
  22. package/dist/adapters/X402Adapter.d.ts.map +1 -1
  23. package/dist/adapters/X402Adapter.js +603 -414
  24. package/dist/adapters/X402Adapter.js.map +1 -1
  25. package/dist/adapters/index.d.ts +1 -1
  26. package/dist/adapters/index.d.ts.map +1 -1
  27. package/dist/adapters/index.js.map +1 -1
  28. package/dist/api/agirailsApp.d.ts +21 -1
  29. package/dist/api/agirailsApp.d.ts.map +1 -1
  30. package/dist/api/agirailsApp.js.map +1 -1
  31. package/dist/builders/CounterAcceptBuilder.d.ts +96 -0
  32. package/dist/builders/CounterAcceptBuilder.d.ts.map +1 -0
  33. package/dist/builders/CounterAcceptBuilder.js +226 -0
  34. package/dist/builders/CounterAcceptBuilder.js.map +1 -0
  35. package/dist/builders/CounterOfferBuilder.d.ts +143 -0
  36. package/dist/builders/CounterOfferBuilder.d.ts.map +1 -0
  37. package/dist/builders/CounterOfferBuilder.js +329 -0
  38. package/dist/builders/CounterOfferBuilder.js.map +1 -0
  39. package/dist/builders/DeliveryProofBuilder.d.ts.map +1 -1
  40. package/dist/builders/DeliveryProofBuilder.js +3 -2
  41. package/dist/builders/DeliveryProofBuilder.js.map +1 -1
  42. package/dist/builders/QuoteBuilder.d.ts.map +1 -1
  43. package/dist/builders/QuoteBuilder.js +8 -3
  44. package/dist/builders/QuoteBuilder.js.map +1 -1
  45. package/dist/builders/index.d.ts +2 -0
  46. package/dist/builders/index.d.ts.map +1 -1
  47. package/dist/builders/index.js +7 -1
  48. package/dist/builders/index.js.map +1 -1
  49. package/dist/cli/agirails.js +34 -6
  50. package/dist/cli/agirails.js.map +1 -1
  51. package/dist/cli/commands/autopublish.js +9 -1
  52. package/dist/cli/commands/autopublish.js.map +1 -1
  53. package/dist/cli/commands/config.js +1 -12
  54. package/dist/cli/commands/config.js.map +1 -1
  55. package/dist/cli/commands/deploy-env.js +1 -1
  56. package/dist/cli/commands/deploy-env.js.map +1 -1
  57. package/dist/cli/commands/diff.js +38 -4
  58. package/dist/cli/commands/diff.js.map +1 -1
  59. package/dist/cli/commands/health.js +24 -6
  60. package/dist/cli/commands/health.js.map +1 -1
  61. package/dist/cli/commands/init.d.ts +2 -0
  62. package/dist/cli/commands/init.d.ts.map +1 -1
  63. package/dist/cli/commands/init.js +100 -7
  64. package/dist/cli/commands/init.js.map +1 -1
  65. package/dist/cli/commands/pay.d.ts.map +1 -1
  66. package/dist/cli/commands/pay.js +23 -0
  67. package/dist/cli/commands/pay.js.map +1 -1
  68. package/dist/cli/commands/publish.d.ts +34 -0
  69. package/dist/cli/commands/publish.d.ts.map +1 -1
  70. package/dist/cli/commands/publish.js +266 -83
  71. package/dist/cli/commands/publish.js.map +1 -1
  72. package/dist/cli/commands/pull.js +3 -1
  73. package/dist/cli/commands/pull.js.map +1 -1
  74. package/dist/cli/commands/receipt.d.ts +17 -3
  75. package/dist/cli/commands/receipt.d.ts.map +1 -1
  76. package/dist/cli/commands/receipt.js +95 -33
  77. package/dist/cli/commands/receipt.js.map +1 -1
  78. package/dist/cli/commands/repair.d.ts +23 -0
  79. package/dist/cli/commands/repair.d.ts.map +1 -0
  80. package/dist/cli/commands/repair.js +210 -0
  81. package/dist/cli/commands/repair.js.map +1 -0
  82. package/dist/cli/commands/serve.d.ts +38 -0
  83. package/dist/cli/commands/serve.d.ts.map +1 -0
  84. package/dist/cli/commands/serve.js +308 -0
  85. package/dist/cli/commands/serve.js.map +1 -0
  86. package/dist/cli/commands/test.d.ts.map +1 -1
  87. package/dist/cli/commands/test.js +222 -60
  88. package/dist/cli/commands/test.js.map +1 -1
  89. package/dist/cli/commands/tx.js +13 -0
  90. package/dist/cli/commands/tx.js.map +1 -1
  91. package/dist/cli/index.js +9 -1
  92. package/dist/cli/index.js.map +1 -1
  93. package/dist/cli/receiptUpload.d.ts +52 -0
  94. package/dist/cli/receiptUpload.d.ts.map +1 -0
  95. package/dist/cli/receiptUpload.js +134 -0
  96. package/dist/cli/receiptUpload.js.map +1 -0
  97. package/dist/cli/utils/banner.d.ts +31 -0
  98. package/dist/cli/utils/banner.d.ts.map +1 -0
  99. package/dist/cli/utils/banner.js +92 -0
  100. package/dist/cli/utils/banner.js.map +1 -0
  101. package/dist/cli/utils/config.d.ts +0 -2
  102. package/dist/cli/utils/config.d.ts.map +1 -1
  103. package/dist/cli/utils/config.js +40 -25
  104. package/dist/cli/utils/config.js.map +1 -1
  105. package/dist/cli/utils/output.d.ts +2 -0
  106. package/dist/cli/utils/output.d.ts.map +1 -1
  107. package/dist/cli/utils/output.js +7 -1
  108. package/dist/cli/utils/output.js.map +1 -1
  109. package/dist/cli/utils/share.d.ts +51 -0
  110. package/dist/cli/utils/share.d.ts.map +1 -0
  111. package/dist/cli/utils/share.js +133 -0
  112. package/dist/cli/utils/share.js.map +1 -0
  113. package/dist/config/agirailsmd.d.ts.map +1 -1
  114. package/dist/config/agirailsmd.js +2 -1
  115. package/dist/config/agirailsmd.js.map +1 -1
  116. package/dist/config/agirailsmdV4.d.ts +46 -1
  117. package/dist/config/agirailsmdV4.d.ts.map +1 -1
  118. package/dist/config/agirailsmdV4.js +65 -8
  119. package/dist/config/agirailsmdV4.js.map +1 -1
  120. package/dist/config/defaults.d.ts +12 -2
  121. package/dist/config/defaults.d.ts.map +1 -1
  122. package/dist/config/defaults.js +19 -3
  123. package/dist/config/defaults.js.map +1 -1
  124. package/dist/config/networks.d.ts +7 -0
  125. package/dist/config/networks.d.ts.map +1 -1
  126. package/dist/config/networks.js +20 -11
  127. package/dist/config/networks.js.map +1 -1
  128. package/dist/config/pendingPublish.d.ts.map +1 -1
  129. package/dist/config/pendingPublish.js +10 -3
  130. package/dist/config/pendingPublish.js.map +1 -1
  131. package/dist/config/publishPipeline.d.ts +23 -1
  132. package/dist/config/publishPipeline.d.ts.map +1 -1
  133. package/dist/config/publishPipeline.js +70 -15
  134. package/dist/config/publishPipeline.js.map +1 -1
  135. package/dist/config/syncOperations.d.ts.map +1 -1
  136. package/dist/config/syncOperations.js +4 -2
  137. package/dist/config/syncOperations.js.map +1 -1
  138. package/dist/erc8004/ERC8004Bridge.d.ts.map +1 -1
  139. package/dist/erc8004/ERC8004Bridge.js +0 -1
  140. package/dist/erc8004/ERC8004Bridge.js.map +1 -1
  141. package/dist/errors/ACTPError.d.ts +24 -0
  142. package/dist/errors/ACTPError.d.ts.map +1 -0
  143. package/dist/errors/ACTPError.js +35 -0
  144. package/dist/errors/ACTPError.js.map +1 -0
  145. package/dist/errors/X402Errors.d.ts +106 -0
  146. package/dist/errors/X402Errors.d.ts.map +1 -0
  147. package/dist/errors/X402Errors.js +160 -0
  148. package/dist/errors/X402Errors.js.map +1 -0
  149. package/dist/errors/index.d.ts +3 -9
  150. package/dist/errors/index.d.ts.map +1 -1
  151. package/dist/errors/index.js +38 -33
  152. package/dist/errors/index.js.map +1 -1
  153. package/dist/index.d.ts +22 -1
  154. package/dist/index.d.ts.map +1 -1
  155. package/dist/index.js +41 -3
  156. package/dist/index.js.map +1 -1
  157. package/dist/level0/Provider.d.ts +5 -0
  158. package/dist/level0/Provider.d.ts.map +1 -1
  159. package/dist/level0/ServiceDirectory.d.ts.map +1 -1
  160. package/dist/level0/ServiceDirectory.js +3 -2
  161. package/dist/level0/ServiceDirectory.js.map +1 -1
  162. package/dist/level0/provide.d.ts.map +1 -1
  163. package/dist/level0/provide.js +11 -8
  164. package/dist/level0/provide.js.map +1 -1
  165. package/dist/level0/request.d.ts.map +1 -1
  166. package/dist/level0/request.js +14 -6
  167. package/dist/level0/request.js.map +1 -1
  168. package/dist/level1/Agent.d.ts +28 -1
  169. package/dist/level1/Agent.d.ts.map +1 -1
  170. package/dist/level1/Agent.js +89 -12
  171. package/dist/level1/Agent.js.map +1 -1
  172. package/dist/level1/pricing/PriceCalculator.d.ts.map +1 -1
  173. package/dist/level1/pricing/PriceCalculator.js +4 -12
  174. package/dist/level1/pricing/PriceCalculator.js.map +1 -1
  175. package/dist/negotiation/BuyerOrchestrator.d.ts +103 -1
  176. package/dist/negotiation/BuyerOrchestrator.d.ts.map +1 -1
  177. package/dist/negotiation/BuyerOrchestrator.js +499 -4
  178. package/dist/negotiation/BuyerOrchestrator.js.map +1 -1
  179. package/dist/negotiation/DecisionEngine.d.ts +69 -1
  180. package/dist/negotiation/DecisionEngine.d.ts.map +1 -1
  181. package/dist/negotiation/DecisionEngine.js +140 -1
  182. package/dist/negotiation/DecisionEngine.js.map +1 -1
  183. package/dist/negotiation/PolicyEngine.d.ts +32 -0
  184. package/dist/negotiation/PolicyEngine.d.ts.map +1 -1
  185. package/dist/negotiation/PolicyEngine.js.map +1 -1
  186. package/dist/negotiation/ProviderOrchestrator.d.ts +108 -0
  187. package/dist/negotiation/ProviderOrchestrator.d.ts.map +1 -0
  188. package/dist/negotiation/ProviderOrchestrator.js +136 -0
  189. package/dist/negotiation/ProviderOrchestrator.js.map +1 -0
  190. package/dist/negotiation/ProviderPolicy.d.ts +143 -0
  191. package/dist/negotiation/ProviderPolicy.d.ts.map +1 -0
  192. package/dist/negotiation/ProviderPolicy.js +207 -0
  193. package/dist/negotiation/ProviderPolicy.js.map +1 -0
  194. package/dist/negotiation/index.d.ts +8 -1
  195. package/dist/negotiation/index.d.ts.map +1 -1
  196. package/dist/negotiation/index.js +8 -1
  197. package/dist/negotiation/index.js.map +1 -1
  198. package/dist/negotiation/verifyQuoteOnChain.d.ts +58 -0
  199. package/dist/negotiation/verifyQuoteOnChain.d.ts.map +1 -0
  200. package/dist/negotiation/verifyQuoteOnChain.js +83 -0
  201. package/dist/negotiation/verifyQuoteOnChain.js.map +1 -0
  202. package/dist/protocol/ACTPKernel.d.ts +4 -1
  203. package/dist/protocol/ACTPKernel.d.ts.map +1 -1
  204. package/dist/protocol/ACTPKernel.js +2 -1
  205. package/dist/protocol/ACTPKernel.js.map +1 -1
  206. package/dist/protocol/EventMonitor.d.ts +27 -1
  207. package/dist/protocol/EventMonitor.d.ts.map +1 -1
  208. package/dist/protocol/EventMonitor.js +11 -9
  209. package/dist/protocol/EventMonitor.js.map +1 -1
  210. package/dist/protocol/ProofGenerator.d.ts.map +1 -1
  211. package/dist/protocol/ProofGenerator.js +3 -2
  212. package/dist/protocol/ProofGenerator.js.map +1 -1
  213. package/dist/runtime/BlockchainRuntime.d.ts +15 -0
  214. package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
  215. package/dist/runtime/BlockchainRuntime.js +42 -6
  216. package/dist/runtime/BlockchainRuntime.js.map +1 -1
  217. package/dist/runtime/IACTPRuntime.d.ts +35 -0
  218. package/dist/runtime/IACTPRuntime.d.ts.map +1 -1
  219. package/dist/runtime/MockRuntime.d.ts +14 -2
  220. package/dist/runtime/MockRuntime.d.ts.map +1 -1
  221. package/dist/runtime/MockRuntime.js +55 -22
  222. package/dist/runtime/MockRuntime.js.map +1 -1
  223. package/dist/runtime/types/MockState.d.ts +14 -0
  224. package/dist/runtime/types/MockState.d.ts.map +1 -1
  225. package/dist/runtime/types/MockState.js.map +1 -1
  226. package/dist/server/buildX402Server.d.ts +131 -0
  227. package/dist/server/buildX402Server.d.ts.map +1 -0
  228. package/dist/server/buildX402Server.js +151 -0
  229. package/dist/server/buildX402Server.js.map +1 -0
  230. package/dist/server/index.d.ts +33 -0
  231. package/dist/server/index.d.ts.map +1 -0
  232. package/dist/server/index.js +36 -0
  233. package/dist/server/index.js.map +1 -0
  234. package/dist/transport/QuoteChannel.d.ts +201 -0
  235. package/dist/transport/QuoteChannel.d.ts.map +1 -0
  236. package/dist/transport/QuoteChannel.js +358 -0
  237. package/dist/transport/QuoteChannel.js.map +1 -0
  238. package/dist/types/adapter.d.ts +64 -34
  239. package/dist/types/adapter.d.ts.map +1 -1
  240. package/dist/types/adapter.js +6 -1
  241. package/dist/types/adapter.js.map +1 -1
  242. package/dist/types/eip712.d.ts +20 -0
  243. package/dist/types/eip712.d.ts.map +1 -1
  244. package/dist/types/x402.d.ts +8 -8
  245. package/dist/utils/security.d.ts.map +1 -1
  246. package/dist/utils/security.js +4 -6
  247. package/dist/utils/security.js.map +1 -1
  248. package/dist/wallet/AutoWalletProvider.d.ts +45 -1
  249. package/dist/wallet/AutoWalletProvider.d.ts.map +1 -1
  250. package/dist/wallet/AutoWalletProvider.js +154 -1
  251. package/dist/wallet/AutoWalletProvider.js.map +1 -1
  252. package/dist/wallet/EOAWalletProvider.d.ts +13 -1
  253. package/dist/wallet/EOAWalletProvider.d.ts.map +1 -1
  254. package/dist/wallet/EOAWalletProvider.js +24 -0
  255. package/dist/wallet/EOAWalletProvider.js.map +1 -1
  256. package/dist/wallet/IWalletProvider.d.ts +34 -0
  257. package/dist/wallet/IWalletProvider.d.ts.map +1 -1
  258. package/dist/wallet/SmartWalletRouter.d.ts.map +1 -1
  259. package/dist/wallet/SmartWalletRouter.js +3 -1
  260. package/dist/wallet/SmartWalletRouter.js.map +1 -1
  261. package/dist/wallet/aa/BundlerClient.js +8 -4
  262. package/dist/wallet/aa/BundlerClient.js.map +1 -1
  263. package/dist/wallet/aa/DualNonceManager.d.ts +4 -1
  264. package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -1
  265. package/dist/wallet/aa/DualNonceManager.js +3 -0
  266. package/dist/wallet/aa/DualNonceManager.js.map +1 -1
  267. package/dist/wallet/keystore.d.ts.map +1 -1
  268. package/dist/wallet/keystore.js +6 -4
  269. package/dist/wallet/keystore.js.map +1 -1
  270. package/package.json +31 -3
  271. package/dist/adapters/BeginnerAdapter.d.ts +0 -152
  272. package/dist/adapters/BeginnerAdapter.d.ts.map +0 -1
  273. package/dist/adapters/BeginnerAdapter.js +0 -168
  274. package/dist/adapters/BeginnerAdapter.js.map +0 -1
  275. package/dist/adapters/IntermediateAdapter.d.ts +0 -211
  276. package/dist/adapters/IntermediateAdapter.d.ts.map +0 -1
  277. package/dist/adapters/IntermediateAdapter.js +0 -260
  278. package/dist/adapters/IntermediateAdapter.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildX402Server.d.ts","sourceRoot":"","sources":["../../src/server/buildX402Server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;AAEH,OAAO,EAAE,kBAAkB,EAAyB,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,KAAK,YAAY,EAAsB,MAAM,iBAAiB,CAAC;AAOhG;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IAEd,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IAEd,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB,8BAA8B;IAC9B,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,UAAU,EAAE,sBAAsB,CAAC;IAEnC;;;OAGG;IACH,MAAM,EAAE,YAAY,CAAC;IAErB,0EAA0E;IAC1E,cAAc,EAAE,kBAAkB,CAAC;CACpC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,gBAAgB,CAAC,CAyH3B"}
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ /**
3
+ * buildX402Server — factory that maps AGIRAILS agent config into
4
+ * a ready-to-use x402 v2 resource server + route definitions.
5
+ *
6
+ * Design: we never wrap or re-export framework middleware. The output
7
+ * plugs directly into @x402/express, @x402/hono, @x402/next, or raw
8
+ * @x402/core processHTTPRequest for any framework.
9
+ *
10
+ * @module server/buildX402Server
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.buildX402Server = void 0;
14
+ const server_1 = require("@x402/core/server");
15
+ const http_1 = require("@x402/core/http");
16
+ const server_2 = require("@x402/evm/exact/server");
17
+ // ============================================================================
18
+ // Factory
19
+ // ============================================================================
20
+ /**
21
+ * Build a configured x402 v2 resource server from simple route definitions.
22
+ *
23
+ * Async because it calls `httpServer.initialize()` which fetches facilitator
24
+ * capabilities and validates that all route schemes are supported.
25
+ *
26
+ * @param config - Server configuration
27
+ * @returns Ready-to-use server + routes
28
+ * @throws {Error} If facilitator is unreachable or route schemes unsupported
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * // Express
33
+ * import { buildX402Server } from '@agirails/sdk/server';
34
+ * import { paymentMiddleware } from '@x402/express';
35
+ * import express from 'express';
36
+ *
37
+ * const { httpServer, routes } = await buildX402Server({
38
+ * payTo: client.getAddress(),
39
+ * network: 'eip155:84532',
40
+ * routes: [{ route: 'GET /api/data', price: '$0.01' }],
41
+ * });
42
+ *
43
+ * const app = express();
44
+ * app.use(paymentMiddleware(routes, httpServer));
45
+ * app.get('/api/data', (req, res) => res.json({ data: 42 }));
46
+ * app.listen(3000);
47
+ * ```
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * // Hono
52
+ * import { buildX402Server } from '@agirails/sdk/server';
53
+ * import { paymentMiddleware } from '@x402/hono';
54
+ * import { Hono } from 'hono';
55
+ *
56
+ * const { httpServer, routes } = await buildX402Server({
57
+ * payTo: '0xYourAddress',
58
+ * network: 'eip155:8453',
59
+ * routes: [{ route: 'GET /api/premium', price: '$0.10' }],
60
+ * });
61
+ *
62
+ * const app = new Hono();
63
+ * app.use('*', paymentMiddleware(routes, httpServer));
64
+ * ```
65
+ */
66
+ async function buildX402Server(config) {
67
+ if (!config.payTo || !/^0x[0-9a-f]{40}$/i.test(config.payTo)) {
68
+ throw new Error(`buildX402Server: payTo must be a valid Ethereum address, got "${config.payTo}"`);
69
+ }
70
+ if (!config.network || !config.network.includes(':')) {
71
+ throw new Error(`buildX402Server: network must be a CAIP-2 identifier (e.g. "eip155:8453"), got "${config.network}"`);
72
+ }
73
+ if (!config.routes || config.routes.length === 0) {
74
+ throw new Error('buildX402Server: at least one route is required');
75
+ }
76
+ // 1. Facilitator client
77
+ const facilitator = new server_1.HTTPFacilitatorClient({
78
+ url: config.facilitatorUrl ?? 'https://x402.org/facilitator',
79
+ });
80
+ // 2. Resource server with EVM exact scheme
81
+ const resourceServer = new server_1.x402ResourceServer(facilitator);
82
+ (0, server_2.registerExactEvmScheme)(resourceServer);
83
+ // 3. Build route config
84
+ const routesConfig = {};
85
+ const seen = new Set();
86
+ for (const def of config.routes) {
87
+ if (!def.route || !/^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\s+\/\S*$/.test(def.route)) {
88
+ throw new Error(`buildX402Server: route must be "METHOD /path" format (e.g. "GET /api/data"), got "${def.route}"`);
89
+ }
90
+ if (seen.has(def.route)) {
91
+ throw new Error(`buildX402Server: duplicate route "${def.route}". Each route must be unique.`);
92
+ }
93
+ seen.add(def.route);
94
+ const routePayTo = def.payTo ?? config.payTo;
95
+ if (!/^0x[0-9a-f]{40}$/i.test(routePayTo)) {
96
+ throw new Error(`buildX402Server: route "${def.route}" has invalid payTo "${routePayTo}"`);
97
+ }
98
+ const routeNetwork = def.network ?? config.network;
99
+ if (!routeNetwork.includes(':')) {
100
+ throw new Error(`buildX402Server: route "${def.route}" has invalid network "${routeNetwork}" (must be CAIP-2)`);
101
+ }
102
+ if (!def.price || (typeof def.price === 'string' && def.price.trim() === '')) {
103
+ throw new Error(`buildX402Server: route "${def.route}" has empty or missing price`);
104
+ }
105
+ if (typeof def.price === 'string') {
106
+ const trimmed = def.price.trim();
107
+ if (!/^\$?\d+(\.\d+)?$/.test(trimmed)) {
108
+ throw new Error(`buildX402Server: route "${def.route}" has invalid price "${def.price}" (expected format: "$0.10" or "0.50")`);
109
+ }
110
+ if (parseFloat(trimmed.replace('$', '')) <= 0) {
111
+ throw new Error(`buildX402Server: route "${def.route}" price must be > 0, got "${def.price}"`);
112
+ }
113
+ }
114
+ const timeout = def.maxTimeoutSeconds ?? 300;
115
+ if (!Number.isFinite(timeout) || timeout <= 0) {
116
+ throw new Error(`buildX402Server: route "${def.route}" has invalid maxTimeoutSeconds ${def.maxTimeoutSeconds} (must be > 0)`);
117
+ }
118
+ const paymentOption = {
119
+ scheme: 'exact',
120
+ network: routeNetwork,
121
+ payTo: routePayTo,
122
+ price: def.price,
123
+ maxTimeoutSeconds: timeout,
124
+ };
125
+ // Advertise Permit2 so Smart Wallet buyers work out of the box
126
+ if (config.preferPermit2 !== false) {
127
+ paymentOption.extra = { assetTransferMethod: 'permit2' };
128
+ }
129
+ routesConfig[def.route] = {
130
+ accepts: [paymentOption],
131
+ description: def.description,
132
+ };
133
+ }
134
+ // 4. HTTP resource server
135
+ const httpServer = new http_1.x402HTTPResourceServer(resourceServer, routesConfig);
136
+ // 5. Initialize (fetches facilitator capabilities, validates routes)
137
+ try {
138
+ await httpServer.initialize();
139
+ }
140
+ catch (err) {
141
+ const msg = err instanceof Error ? err.message : String(err);
142
+ throw new Error(`buildX402Server: failed to initialize — ${msg}`);
143
+ }
144
+ return {
145
+ httpServer,
146
+ routes: routesConfig,
147
+ resourceServer,
148
+ };
149
+ }
150
+ exports.buildX402Server = buildX402Server;
151
+ //# sourceMappingURL=buildX402Server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildX402Server.js","sourceRoot":"","sources":["../../src/server/buildX402Server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,8CAA8E;AAC9E,0CAAgG;AAChG,mDAAgE;AA0FhE,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACI,KAAK,UAAU,eAAe,CACnC,MAAwB;IAExB,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CACb,iEAAiE,MAAM,CAAC,KAAK,GAAG,CACjF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CACb,mFAAmF,MAAM,CAAC,OAAO,GAAG,CACrG,CA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A2B,GAAG,CAAC,KAAK,mCAAmC,GAAG,CAAC,iBAAiB,gBAAgB,CAC7G,CAAC;QACJ,CAAC;QAED,MAAM,aAAa,GAAkB;YACnC,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,YAAY;YACrB,KAAK,EAAE,UAAU;YACjB,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,iBAAiB,EAAE,OAAO;SAC3B,CAAC;QAEF,+DAA+D;QAC/D,IAAI,MAAM,CAAC,aAAa,KAAK,KAAK,EAAE,CAAC;YACnC,aAAa,CAAC,KAAK,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC;QAC3D,CAAC;QAED,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG;YACxB,OAAO,EAAE,CAAC,aAAa,CAAC;YACxB,WAAW,EAAE,GAAG,CAAC,WAAW;SAC7B,CAAC;IACJ,CAAC;IAED,0BAA0B;IAC1B,MAAM,UAAU,GAAG,IAAI,6BAAsB,CAC3C,cAAc,EACd,YAA4B,CAC7B,CAAC;IAEF,qEAAqE;IACrE,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,2CAA2C,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,OAAO;QACL,UAAU;QACV,MAAM,EAAE,YAA4B;QACpC,cAAc;KACf,CAAC;AACJ,CAAC;AA3HD,0CA2HC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Server Module — x402 v2 seller-side helpers.
3
+ *
4
+ * Framework-agnostic: builds a configured `x402HTTPResourceServer` + routes
5
+ * object that plugs directly into upstream middleware (`@x402/express`,
6
+ * `@x402/hono`, `@x402/next`) or any framework via the raw processHTTPRequest
7
+ * API from `@x402/core`.
8
+ *
9
+ * @module server
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { buildX402Server } from '@agirails/sdk/server';
14
+ * import { paymentMiddleware } from '@x402/express';
15
+ * import express from 'express';
16
+ *
17
+ * const { httpServer, routes } = await buildX402Server({
18
+ * payTo: '0xYourAddress',
19
+ * network: 'eip155:84532',
20
+ * routes: [
21
+ * { route: 'GET /api/premium', price: '$0.10', description: 'Premium content' },
22
+ * ],
23
+ * });
24
+ *
25
+ * const app = express();
26
+ * app.use(paymentMiddleware(routes, httpServer));
27
+ * app.get('/api/premium', (req, res) => res.json({ secret: '...' }));
28
+ * app.listen(3000);
29
+ * ```
30
+ */
31
+ export { buildX402Server } from './buildX402Server';
32
+ export type { X402ServerConfig, X402RouteDefinition, X402ServerResult, } from './buildX402Server';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * Server Module — x402 v2 seller-side helpers.
4
+ *
5
+ * Framework-agnostic: builds a configured `x402HTTPResourceServer` + routes
6
+ * object that plugs directly into upstream middleware (`@x402/express`,
7
+ * `@x402/hono`, `@x402/next`) or any framework via the raw processHTTPRequest
8
+ * API from `@x402/core`.
9
+ *
10
+ * @module server
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { buildX402Server } from '@agirails/sdk/server';
15
+ * import { paymentMiddleware } from '@x402/express';
16
+ * import express from 'express';
17
+ *
18
+ * const { httpServer, routes } = await buildX402Server({
19
+ * payTo: '0xYourAddress',
20
+ * network: 'eip155:84532',
21
+ * routes: [
22
+ * { route: 'GET /api/premium', price: '$0.10', description: 'Premium content' },
23
+ * ],
24
+ * });
25
+ *
26
+ * const app = express();
27
+ * app.use(paymentMiddleware(routes, httpServer));
28
+ * app.get('/api/premium', (req, res) => res.json({ secret: '...' }));
29
+ * app.listen(3000);
30
+ * ```
31
+ */
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.buildX402Server = void 0;
34
+ var buildX402Server_1 = require("./buildX402Server");
35
+ Object.defineProperty(exports, "buildX402Server", { enumerable: true, get: function () { return buildX402Server_1.buildX402Server; } });
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,qDAAoD;AAA3C,kHAAA,eAAe,OAAA"}
@@ -0,0 +1,201 @@
1
+ /**
2
+ * QuoteChannel — HTTPS transport for AIP-2.1 quote + counter-offer messages.
3
+ *
4
+ * Split into three responsibilities so the SDK is framework-agnostic:
5
+ *
6
+ * 1. `QuoteChannelClient` — sends a signed message to a peer's endpoint.
7
+ * Used by buyers (posting counter-offers to the provider) and by
8
+ * providers (posting quotes to the buyer). Plain fetch + timeout.
9
+ *
10
+ * 2. `QuoteChannelHandler` — framework-agnostic receive-side handler.
11
+ * Callers wire it into whatever HTTP framework they use (Express,
12
+ * Next.js route handler, Fastify, etc). Enforces the security model
13
+ * from AIP-2.1-DRAFT §8:
14
+ * - URL path binding: `/quote-channel/{chainId}/{txId}` must
15
+ * match message.chainId / message.txId (closes T2 + T5).
16
+ * - EIP-712 signature verification (closes "anyone can POST").
17
+ * - TTL + grace window (closes T3).
18
+ * - Nonce LRU dedup (closes T1, idempotent replay).
19
+ * Rate limiting is intentionally out of scope — framework-level
20
+ * concern (Next.js middleware, Express rate-limit, nginx, etc).
21
+ *
22
+ * 3. `DedupStore` — swappable backing for the nonce LRU. In-memory
23
+ * default for single-process use; callers can plug Redis etc. for
24
+ * multi-worker production.
25
+ *
26
+ * @module transport/QuoteChannel
27
+ * @see Protocol/aips/AIP-2.1-DRAFT.md §8 (threat model + mitigations)
28
+ */
29
+ import { QuoteMessage } from '../builders/QuoteBuilder';
30
+ import { CounterOfferMessage } from '../builders/CounterOfferBuilder';
31
+ /** Path pattern builders use / handlers expect. */
32
+ export declare function buildChannelPath(chainId: number, txId: string): string;
33
+ export declare const TTL_GRACE_SECONDS = 30;
34
+ export declare const DEDUP_TTL_SECONDS = 90000;
35
+ /**
36
+ * Wire payload posted by the client and parsed by the handler.
37
+ * Discriminated by `type` so the same endpoint serves both directions.
38
+ */
39
+ export type ChannelPayload = {
40
+ type: 'agirails.quote.v1';
41
+ message: QuoteMessage;
42
+ } | {
43
+ type: 'agirails.counteroffer.v1';
44
+ message: CounterOfferMessage;
45
+ };
46
+ export interface DedupStore {
47
+ /**
48
+ * Atomic "record if absent". Returns:
49
+ * 'recorded' — the key was not present (or had expired) and has now
50
+ * been recorded with the given TTL. Caller treats this
51
+ * POST as fresh and performs side effects.
52
+ * 'duplicate' — the key was already present and unexpired. Caller
53
+ * must return an idempotent cached response without
54
+ * performing side effects.
55
+ *
56
+ * MUST be atomic at the backend level. Single-process JS gets this
57
+ * trivially (no real concurrency); Redis implementations use
58
+ * `SET key 1 NX PX ttlMs` which is natively atomic and correctly
59
+ * handles multiple concurrent workers competing on the same key.
60
+ *
61
+ * Separate check+record would open a TOCTOU window where two
62
+ * workers both observe 'fresh' and both commit — that's the P2
63
+ * audit finding this interface closes.
64
+ */
65
+ recordOnce(key: string, ttlMs: number): Promise<'recorded' | 'duplicate'>;
66
+ }
67
+ /**
68
+ * Single-process in-memory LRU. Callers replace this in production
69
+ * with a distributed store (Redis SET NX EX, DynamoDB conditional put,
70
+ * Postgres INSERT ... ON CONFLICT DO NOTHING, etc).
71
+ *
72
+ * Atomicity here is free because JavaScript event-loop execution is
73
+ * single-threaded — a `recordOnce` call cannot be interrupted mid-way.
74
+ * Multi-worker deployments MUST use a real distributed store or will
75
+ * see duplicate 'recorded' returns across workers.
76
+ */
77
+ export declare class InMemoryDedupStore implements DedupStore {
78
+ private readonly entries;
79
+ private readonly maxSize;
80
+ constructor(maxSize?: number);
81
+ recordOnce(key: string, ttlMs: number): Promise<'recorded' | 'duplicate'>;
82
+ /** Drop entries whose TTL has elapsed. O(n) — fine for our sizes. */
83
+ private dropExpired;
84
+ /** Bound the map at `maxSize` by evicting oldest-inserted keys. */
85
+ private trimToSize;
86
+ }
87
+ export interface QuoteChannelClientConfig {
88
+ /** Per-request timeout in ms. Default 10s. */
89
+ timeoutMs?: number;
90
+ /** Override fetch for tests. Defaults to global fetch. */
91
+ fetchImpl?: typeof fetch;
92
+ /**
93
+ * Allow insecure targets (http://, localhost, RFC1918, link-local).
94
+ * Default false (production hardening). Set to true ONLY for local
95
+ * dev or integration tests running against a mock server.
96
+ *
97
+ * Note: this is a URL-string check only. DNS rebinding can still bypass
98
+ * it — production deployments that are extra paranoid should put the
99
+ * client behind an HTTP proxy that enforces the same rules against the
100
+ * resolved IP at request time.
101
+ */
102
+ allowInsecureTargets?: boolean;
103
+ }
104
+ export declare class QuoteChannelClient {
105
+ private readonly timeoutMs;
106
+ private readonly fetchImpl;
107
+ private readonly allowInsecureTargets;
108
+ constructor(cfg?: QuoteChannelClientConfig);
109
+ /** POST a provider quote to the buyer's endpoint. */
110
+ sendQuote(peerEndpoint: string, quote: QuoteMessage): Promise<void>;
111
+ /** POST a buyer counter-offer to the provider's endpoint. */
112
+ sendCounter(peerEndpoint: string, counter: CounterOfferMessage): Promise<void>;
113
+ private post;
114
+ }
115
+ export interface QuoteChannelHandlerConfig {
116
+ /** Kernel address per chainId — used for EIP-712 domain when verifying. */
117
+ kernelAddressByChainId: Record<number, string>;
118
+ /** Dedup store. Defaults to in-memory (single process). */
119
+ dedupStore?: DedupStore;
120
+ /** TTL grace window in seconds for `expiresAt` check. Defaults to 30s. */
121
+ ttlGraceSeconds?: number;
122
+ }
123
+ export interface HandlerContext {
124
+ /** Chain ID parsed from the URL path. */
125
+ pathChainId: number;
126
+ /** txId parsed from the URL path (0x-prefixed 64-hex). */
127
+ pathTxId: string;
128
+ }
129
+ export type HandlerResult = {
130
+ status: 201;
131
+ body: {
132
+ accepted: true;
133
+ duplicate: false;
134
+ };
135
+ } | {
136
+ status: 200;
137
+ body: {
138
+ accepted: true;
139
+ duplicate: true;
140
+ };
141
+ } | {
142
+ status: 400;
143
+ body: {
144
+ accepted: false;
145
+ reason: string;
146
+ };
147
+ } | {
148
+ status: 401;
149
+ body: {
150
+ accepted: false;
151
+ reason: string;
152
+ };
153
+ } | {
154
+ status: 410;
155
+ body: {
156
+ accepted: false;
157
+ reason: string;
158
+ };
159
+ } | {
160
+ status: 422;
161
+ body: {
162
+ accepted: false;
163
+ reason: string;
164
+ };
165
+ };
166
+ export declare class QuoteChannelHandler {
167
+ private readonly kernelAddressByChainId;
168
+ private readonly dedupStore;
169
+ private readonly ttlGraceSeconds;
170
+ private readonly quoteVerifier;
171
+ private readonly counterVerifier;
172
+ constructor(cfg: QuoteChannelHandlerConfig);
173
+ /**
174
+ * Validate + dedup an incoming POST.
175
+ * Caller is responsible for: parsing URL path into `pathChainId` /
176
+ * `pathTxId`, parsing request body into `ChannelPayload`, and rate
177
+ * limiting the endpoint at the framework level.
178
+ */
179
+ handle(payload: unknown, ctx: HandlerContext): Promise<HandlerResult>;
180
+ }
181
+ /**
182
+ * Reject peer URLs that could SSRF into local / internal infrastructure.
183
+ *
184
+ * Rules (default, `allowInsecureTargets=false`):
185
+ * - scheme MUST be https
186
+ * - hostname MUST NOT be `localhost`
187
+ * - hostname MUST NOT be a literal loopback IP (127.x.x.x, ::1)
188
+ * - hostname MUST NOT be a literal link-local IP (169.254.x.x, fe80::/10)
189
+ * — this also covers AWS metadata at 169.254.169.254
190
+ * - hostname MUST NOT be a literal RFC1918 private IP (10.x, 172.16-31.x,
191
+ * 192.168.x) or IPv6 ULA (fc00::/7)
192
+ *
193
+ * Dev mode (`allowInsecureTargets=true`): no restrictions, callers
194
+ * opting in are responsible for their own network security.
195
+ *
196
+ * @throws Error if the URL fails the checks. Error message is deliberately
197
+ * specific so test fixtures and diagnostics can assert on it.
198
+ * @internal Exported for unit tests.
199
+ */
200
+ export declare function assertSafePeerUrl(url: string, allowInsecureTargets: boolean): void;
201
+ //# sourceMappingURL=QuoteChannel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuoteChannel.d.ts","sourceRoot":"","sources":["../../src/transport/QuoteChannel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAgB,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAuB,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAQ3F,mDAAmD;AACnD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAMxC;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,0BAA0B,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAMvE,MAAM,WAAW,UAAU;IACzB;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC;CAC3E;AAED;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,UAAU;IACnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gB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