mppx 0.8.17 → 0.8.18

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 (914) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +15 -0
  3. package/dist/Challenge.js +21 -4
  4. package/dist/bin.js +3 -3
  5. package/dist/cli/THIRD-PARTY-LICENSES.txt +328 -0
  6. package/dist/cli/cli.js +253 -1505
  7. package/dist/cli/plugins/index.js +19 -5
  8. package/dist/cli/plugins/tempo.js +7 -3
  9. package/dist/cli/sessions/Manager.js +7 -4
  10. package/dist/cli/sessions/request.d.ts +2 -0
  11. package/dist/cli/sessions/request.js +18 -0
  12. package/dist/cli/sessions/store.js +28 -14
  13. package/dist/discovery/Discovery.js +2 -1
  14. package/dist/evm/client/Charge.js +8 -0
  15. package/dist/server/core.d.ts +9 -0
  16. package/dist/server/core.js +9 -0
  17. package/dist/stripe/server/Charge.js +2 -4
  18. package/dist/stripe/server/Methods.d.ts +2 -2
  19. package/dist/stripe/server/Methods.js +17 -11
  20. package/dist/stripe/server/internal/html.gen.d.ts +1 -1
  21. package/dist/stripe/server/internal/html.gen.js +1 -1
  22. package/dist/stripe/server/spt.d.ts +8 -0
  23. package/dist/stripe/server/spt.js +8 -0
  24. package/dist/tempo/Methods.d.ts +13 -0
  25. package/dist/tempo/Methods.js +14 -3
  26. package/dist/tempo/client/Charge.d.ts +3 -0
  27. package/dist/tempo/client/Charge.js +31 -9
  28. package/dist/tempo/client/Methods.d.ts +13 -0
  29. package/dist/tempo/internal/defaults.d.ts +11 -0
  30. package/dist/tempo/internal/defaults.js +11 -0
  31. package/dist/tempo/internal/machine-token-charge.d.ts +51 -0
  32. package/dist/tempo/internal/machine-token-charge.js +113 -0
  33. package/dist/tempo/internal/machine-token-session.d.ts +88 -0
  34. package/dist/tempo/internal/machine-token-session.js +173 -0
  35. package/dist/tempo/internal/signature-envelope.d.ts +14 -0
  36. package/dist/tempo/internal/signature-envelope.js +28 -0
  37. package/dist/tempo/legacy/client/ChannelOps.d.ts +2 -2
  38. package/dist/tempo/legacy/client/ChannelOps.js +11 -5
  39. package/dist/tempo/legacy/client/Session.d.ts +13 -1
  40. package/dist/tempo/legacy/client/Session.js +3 -3
  41. package/dist/tempo/legacy/client/SessionManager.d.ts +3 -1
  42. package/dist/tempo/legacy/client/SessionManager.js +2 -0
  43. package/dist/tempo/server/Charge.d.ts +3 -0
  44. package/dist/tempo/server/Charge.js +58 -17
  45. package/dist/tempo/server/Methods.d.ts +21 -4
  46. package/dist/tempo/server/Methods.js +8 -4
  47. package/dist/tempo/server/internal/html.gen.d.ts +1 -1
  48. package/dist/tempo/server/internal/html.gen.js +1 -1
  49. package/dist/tempo/session/client/ChannelOps.d.ts +18 -3
  50. package/dist/tempo/session/client/ChannelOps.js +35 -6
  51. package/dist/tempo/session/client/ChannelStore.d.ts +0 -5
  52. package/dist/tempo/session/client/ChannelStore.js +2 -2
  53. package/dist/tempo/session/client/CredentialState.d.ts +17 -2
  54. package/dist/tempo/session/client/CredentialState.js +77 -76
  55. package/dist/tempo/session/client/Runtime.d.ts +4 -2
  56. package/dist/tempo/session/client/Runtime.js +21 -5
  57. package/dist/tempo/session/client/Session.d.ts +15 -3
  58. package/dist/tempo/session/client/Session.js +186 -63
  59. package/dist/tempo/session/client/SessionManager.d.ts +3 -1
  60. package/dist/tempo/session/client/SessionManager.js +35 -11
  61. package/dist/tempo/session/client/Transports.d.ts +2 -0
  62. package/dist/tempo/session/client/Transports.js +12 -2
  63. package/dist/tempo/session/precompile/Chain.d.ts +10 -2
  64. package/dist/tempo/session/precompile/Chain.js +50 -10
  65. package/dist/tempo/session/precompile/Protocol.d.ts +15 -0
  66. package/dist/tempo/session/precompile/Protocol.js +7 -0
  67. package/dist/tempo/session/precompile/Voucher.d.ts +3 -1
  68. package/dist/tempo/session/precompile/Voucher.js +6 -12
  69. package/dist/tempo/session/server/ChannelStore.d.ts +6 -0
  70. package/dist/tempo/session/server/ChannelStore.js +11 -4
  71. package/dist/tempo/session/server/CredentialVerification.d.ts +11 -9
  72. package/dist/tempo/session/server/CredentialVerification.js +185 -109
  73. package/dist/tempo/session/server/MeteredStream.d.ts +1 -1
  74. package/dist/tempo/session/server/MeteredStream.js +5 -4
  75. package/dist/tempo/session/server/RequestState.d.ts +19 -0
  76. package/dist/tempo/session/server/RequestState.js +61 -15
  77. package/dist/tempo/session/server/Session.d.ts +14 -2
  78. package/dist/tempo/session/server/Session.js +37 -6
  79. package/dist/tempo/session/server/Settlement.d.ts +11 -4
  80. package/dist/tempo/session/server/Settlement.js +53 -21
  81. package/dist/x402/client/Exact.d.ts +8 -0
  82. package/dist/x402/client/Exact.js +40 -10
  83. package/dist/x402/server/EvmCharge.d.ts +22 -0
  84. package/dist/x402/server/EvmCharge.js +23 -1
  85. package/package.json +15 -37
  86. package/dist/BodyDigest.d.ts.map +0 -1
  87. package/dist/BodyDigest.js.map +0 -1
  88. package/dist/Challenge.d.ts.map +0 -1
  89. package/dist/Challenge.js.map +0 -1
  90. package/dist/Constants.d.ts.map +0 -1
  91. package/dist/Constants.js.map +0 -1
  92. package/dist/Credential.d.ts.map +0 -1
  93. package/dist/Credential.js.map +0 -1
  94. package/dist/Errors.d.ts.map +0 -1
  95. package/dist/Errors.js.map +0 -1
  96. package/dist/Expires.d.ts.map +0 -1
  97. package/dist/Expires.js.map +0 -1
  98. package/dist/Html.d.ts.map +0 -1
  99. package/dist/Html.js.map +0 -1
  100. package/dist/Mcp.d.ts.map +0 -1
  101. package/dist/Mcp.js.map +0 -1
  102. package/dist/Method.d.ts.map +0 -1
  103. package/dist/Method.js.map +0 -1
  104. package/dist/PaymentRequest.d.ts.map +0 -1
  105. package/dist/PaymentRequest.js.map +0 -1
  106. package/dist/Receipt.d.ts.map +0 -1
  107. package/dist/Receipt.js.map +0 -1
  108. package/dist/Store.d.ts.map +0 -1
  109. package/dist/Store.js.map +0 -1
  110. package/dist/attestation/Client.d.ts.map +0 -1
  111. package/dist/attestation/Client.js.map +0 -1
  112. package/dist/attestation/Constants.d.ts.map +0 -1
  113. package/dist/attestation/Constants.js.map +0 -1
  114. package/dist/attestation/Server.d.ts.map +0 -1
  115. package/dist/attestation/Server.js.map +0 -1
  116. package/dist/attestation/Types.d.ts.map +0 -1
  117. package/dist/attestation/Types.js.map +0 -1
  118. package/dist/attestation/index.d.ts.map +0 -1
  119. package/dist/attestation/index.js.map +0 -1
  120. package/dist/attestation/internal/HttpMessageSignature.d.ts.map +0 -1
  121. package/dist/attestation/internal/HttpMessageSignature.js.map +0 -1
  122. package/dist/attestation/internal/SigningContext.d.ts.map +0 -1
  123. package/dist/attestation/internal/SigningContext.js.map +0 -1
  124. package/dist/bin.d.ts.map +0 -1
  125. package/dist/bin.js.map +0 -1
  126. package/dist/cli/account.d.ts.map +0 -1
  127. package/dist/cli/account.js.map +0 -1
  128. package/dist/cli/cli.d.ts.map +0 -1
  129. package/dist/cli/cli.js.map +0 -1
  130. package/dist/cli/config.d.ts.map +0 -1
  131. package/dist/cli/config.js.map +0 -1
  132. package/dist/cli/internal.d.ts.map +0 -1
  133. package/dist/cli/internal.js.map +0 -1
  134. package/dist/cli/plugins/evm.d.ts.map +0 -1
  135. package/dist/cli/plugins/evm.js.map +0 -1
  136. package/dist/cli/plugins/index.d.ts.map +0 -1
  137. package/dist/cli/plugins/index.js.map +0 -1
  138. package/dist/cli/plugins/plugin.d.ts.map +0 -1
  139. package/dist/cli/plugins/plugin.js.map +0 -1
  140. package/dist/cli/plugins/stripe.d.ts.map +0 -1
  141. package/dist/cli/plugins/stripe.js.map +0 -1
  142. package/dist/cli/plugins/tempo.d.ts.map +0 -1
  143. package/dist/cli/plugins/tempo.js.map +0 -1
  144. package/dist/cli/sessions/Manager.d.ts.map +0 -1
  145. package/dist/cli/sessions/Manager.js.map +0 -1
  146. package/dist/cli/sessions/commands.d.ts.map +0 -1
  147. package/dist/cli/sessions/commands.js.map +0 -1
  148. package/dist/cli/sessions/request.d.ts.map +0 -1
  149. package/dist/cli/sessions/request.js.map +0 -1
  150. package/dist/cli/sessions/store.d.ts.map +0 -1
  151. package/dist/cli/sessions/store.js.map +0 -1
  152. package/dist/cli/utils.d.ts.map +0 -1
  153. package/dist/cli/utils.js.map +0 -1
  154. package/dist/cli/validate/challenge.d.ts.map +0 -1
  155. package/dist/cli/validate/challenge.js.map +0 -1
  156. package/dist/cli/validate/discovery.d.ts.map +0 -1
  157. package/dist/cli/validate/discovery.js.map +0 -1
  158. package/dist/cli/validate/helpers.d.ts.map +0 -1
  159. package/dist/cli/validate/helpers.js.map +0 -1
  160. package/dist/cli/validate/index.d.ts.map +0 -1
  161. package/dist/cli/validate/index.js.map +0 -1
  162. package/dist/cli/validate/messages.d.ts.map +0 -1
  163. package/dist/cli/validate/messages.js.map +0 -1
  164. package/dist/cli/validate/payment.d.ts.map +0 -1
  165. package/dist/cli/validate/payment.js.map +0 -1
  166. package/dist/client/Methods.d.ts.map +0 -1
  167. package/dist/client/Methods.js.map +0 -1
  168. package/dist/client/Mppx.d.ts.map +0 -1
  169. package/dist/client/Mppx.js.map +0 -1
  170. package/dist/client/Transport.d.ts.map +0 -1
  171. package/dist/client/Transport.js.map +0 -1
  172. package/dist/client/index.d.ts.map +0 -1
  173. package/dist/client/index.js.map +0 -1
  174. package/dist/client/internal/Fetch.d.ts.map +0 -1
  175. package/dist/client/internal/Fetch.js.map +0 -1
  176. package/dist/client/internal/MethodChallenge.d.ts.map +0 -1
  177. package/dist/client/internal/MethodChallenge.js.map +0 -1
  178. package/dist/client/internal/MethodResponse.d.ts.map +0 -1
  179. package/dist/client/internal/MethodResponse.js.map +0 -1
  180. package/dist/client/internal/protocols/Mcp.d.ts.map +0 -1
  181. package/dist/client/internal/protocols/Mcp.js.map +0 -1
  182. package/dist/client/internal/protocols/Mpp.d.ts.map +0 -1
  183. package/dist/client/internal/protocols/Mpp.js.map +0 -1
  184. package/dist/client/internal/protocols/Protocol.d.ts.map +0 -1
  185. package/dist/client/internal/protocols/Protocol.js.map +0 -1
  186. package/dist/client/internal/protocols/Shared.d.ts.map +0 -1
  187. package/dist/client/internal/protocols/Shared.js.map +0 -1
  188. package/dist/client/internal/protocols/X402.d.ts.map +0 -1
  189. package/dist/client/internal/protocols/X402.js.map +0 -1
  190. package/dist/client/node.d.ts.map +0 -1
  191. package/dist/client/node.js.map +0 -1
  192. package/dist/discovery/Discovery.d.ts.map +0 -1
  193. package/dist/discovery/Discovery.js.map +0 -1
  194. package/dist/discovery/OpenApi.d.ts.map +0 -1
  195. package/dist/discovery/OpenApi.js.map +0 -1
  196. package/dist/discovery/Validate.d.ts.map +0 -1
  197. package/dist/discovery/Validate.js.map +0 -1
  198. package/dist/discovery/index.d.ts.map +0 -1
  199. package/dist/discovery/index.js.map +0 -1
  200. package/dist/discovery/internal/Metadata.d.ts.map +0 -1
  201. package/dist/discovery/internal/Metadata.js.map +0 -1
  202. package/dist/evm/Assets.d.ts.map +0 -1
  203. package/dist/evm/Assets.js.map +0 -1
  204. package/dist/evm/Chains.d.ts.map +0 -1
  205. package/dist/evm/Chains.js.map +0 -1
  206. package/dist/evm/Methods.d.ts.map +0 -1
  207. package/dist/evm/Methods.js.map +0 -1
  208. package/dist/evm/Types.d.ts.map +0 -1
  209. package/dist/evm/Types.js.map +0 -1
  210. package/dist/evm/client/Charge.d.ts.map +0 -1
  211. package/dist/evm/client/Charge.js.map +0 -1
  212. package/dist/evm/client/Methods.d.ts.map +0 -1
  213. package/dist/evm/client/Methods.js.map +0 -1
  214. package/dist/evm/client/index.d.ts.map +0 -1
  215. package/dist/evm/client/index.js.map +0 -1
  216. package/dist/evm/index.d.ts.map +0 -1
  217. package/dist/evm/index.js.map +0 -1
  218. package/dist/evm/server/Charge.d.ts.map +0 -1
  219. package/dist/evm/server/Charge.js.map +0 -1
  220. package/dist/evm/server/Methods.d.ts.map +0 -1
  221. package/dist/evm/server/Methods.js.map +0 -1
  222. package/dist/evm/server/index.d.ts.map +0 -1
  223. package/dist/evm/server/index.js.map +0 -1
  224. package/dist/index.d.ts.map +0 -1
  225. package/dist/index.js.map +0 -1
  226. package/dist/internal/AcceptPayment.d.ts.map +0 -1
  227. package/dist/internal/AcceptPayment.js.map +0 -1
  228. package/dist/internal/HeaderCodec.d.ts.map +0 -1
  229. package/dist/internal/HeaderCodec.js.map +0 -1
  230. package/dist/internal/constantTimeEqual.d.ts.map +0 -1
  231. package/dist/internal/constantTimeEqual.js.map +0 -1
  232. package/dist/internal/env.d.ts.map +0 -1
  233. package/dist/internal/env.js.map +0 -1
  234. package/dist/internal/types.d.ts.map +0 -1
  235. package/dist/internal/types.js.map +0 -1
  236. package/dist/mcp/client/McpClient.d.ts.map +0 -1
  237. package/dist/mcp/client/McpClient.js.map +0 -1
  238. package/dist/mcp/client/index.d.ts.map +0 -1
  239. package/dist/mcp/client/index.js.map +0 -1
  240. package/dist/mcp/server/Transport.d.ts.map +0 -1
  241. package/dist/mcp/server/Transport.js.map +0 -1
  242. package/dist/mcp/server/index.d.ts.map +0 -1
  243. package/dist/mcp/server/index.js.map +0 -1
  244. package/dist/middlewares/elysia.d.ts.map +0 -1
  245. package/dist/middlewares/elysia.js.map +0 -1
  246. package/dist/middlewares/express.d.ts.map +0 -1
  247. package/dist/middlewares/express.js.map +0 -1
  248. package/dist/middlewares/hono.d.ts.map +0 -1
  249. package/dist/middlewares/hono.js.map +0 -1
  250. package/dist/middlewares/internal/mppx.d.ts.map +0 -1
  251. package/dist/middlewares/internal/mppx.js.map +0 -1
  252. package/dist/middlewares/nextjs.d.ts.map +0 -1
  253. package/dist/middlewares/nextjs.js.map +0 -1
  254. package/dist/proxy/Proxy.d.ts.map +0 -1
  255. package/dist/proxy/Proxy.js.map +0 -1
  256. package/dist/proxy/Service.d.ts.map +0 -1
  257. package/dist/proxy/Service.js.map +0 -1
  258. package/dist/proxy/index.d.ts.map +0 -1
  259. package/dist/proxy/index.js.map +0 -1
  260. package/dist/proxy/internal/Headers.d.ts.map +0 -1
  261. package/dist/proxy/internal/Headers.js.map +0 -1
  262. package/dist/proxy/internal/Route.d.ts.map +0 -1
  263. package/dist/proxy/internal/Route.js.map +0 -1
  264. package/dist/proxy/services/anthropic.d.ts.map +0 -1
  265. package/dist/proxy/services/anthropic.js.map +0 -1
  266. package/dist/proxy/services/openai.d.ts.map +0 -1
  267. package/dist/proxy/services/openai.js.map +0 -1
  268. package/dist/proxy/services/stripe.d.ts.map +0 -1
  269. package/dist/proxy/services/stripe.js.map +0 -1
  270. package/dist/server/Methods.d.ts.map +0 -1
  271. package/dist/server/Methods.js.map +0 -1
  272. package/dist/server/Mppx.d.ts.map +0 -1
  273. package/dist/server/Mppx.js.map +0 -1
  274. package/dist/server/NodeListener.d.ts.map +0 -1
  275. package/dist/server/NodeListener.js.map +0 -1
  276. package/dist/server/Request.d.ts.map +0 -1
  277. package/dist/server/Request.js.map +0 -1
  278. package/dist/server/Response.d.ts.map +0 -1
  279. package/dist/server/Response.js.map +0 -1
  280. package/dist/server/Transport.d.ts.map +0 -1
  281. package/dist/server/Transport.js.map +0 -1
  282. package/dist/server/index.d.ts.map +0 -1
  283. package/dist/server/index.js.map +0 -1
  284. package/dist/server/internal/html/compose.main.gen.d.ts.map +0 -1
  285. package/dist/server/internal/html/compose.main.gen.js.map +0 -1
  286. package/dist/server/internal/html/config.d.ts.map +0 -1
  287. package/dist/server/internal/html/config.js.map +0 -1
  288. package/dist/server/internal/html/constants.d.ts.map +0 -1
  289. package/dist/server/internal/html/constants.js.map +0 -1
  290. package/dist/server/internal/html/serviceWorker.client.d.ts.map +0 -1
  291. package/dist/server/internal/html/serviceWorker.client.js.map +0 -1
  292. package/dist/server/internal/html/serviceWorker.gen.d.ts.map +0 -1
  293. package/dist/server/internal/html/serviceWorker.gen.js.map +0 -1
  294. package/dist/server/internal/scope.d.ts.map +0 -1
  295. package/dist/server/internal/scope.js.map +0 -1
  296. package/dist/stripe/Methods.d.ts.map +0 -1
  297. package/dist/stripe/Methods.js.map +0 -1
  298. package/dist/stripe/client/Charge.d.ts.map +0 -1
  299. package/dist/stripe/client/Charge.js.map +0 -1
  300. package/dist/stripe/client/Methods.d.ts.map +0 -1
  301. package/dist/stripe/client/Methods.js.map +0 -1
  302. package/dist/stripe/client/index.d.ts.map +0 -1
  303. package/dist/stripe/client/index.js.map +0 -1
  304. package/dist/stripe/index.d.ts.map +0 -1
  305. package/dist/stripe/index.js.map +0 -1
  306. package/dist/stripe/internal/constants.d.ts.map +0 -1
  307. package/dist/stripe/internal/constants.js.map +0 -1
  308. package/dist/stripe/internal/types.d.ts.map +0 -1
  309. package/dist/stripe/internal/types.js.map +0 -1
  310. package/dist/stripe/server/Charge.d.ts.map +0 -1
  311. package/dist/stripe/server/Charge.js.map +0 -1
  312. package/dist/stripe/server/Methods.d.ts.map +0 -1
  313. package/dist/stripe/server/Methods.js.map +0 -1
  314. package/dist/stripe/server/index.d.ts.map +0 -1
  315. package/dist/stripe/server/index.js.map +0 -1
  316. package/dist/stripe/server/internal/deposit-address.d.ts.map +0 -1
  317. package/dist/stripe/server/internal/deposit-address.js.map +0 -1
  318. package/dist/stripe/server/internal/html/types.d.ts.map +0 -1
  319. package/dist/stripe/server/internal/html/types.js.map +0 -1
  320. package/dist/stripe/server/internal/html.gen.d.ts.map +0 -1
  321. package/dist/stripe/server/internal/html.gen.js.map +0 -1
  322. package/dist/stripe/server/internal/record-payment.d.ts.map +0 -1
  323. package/dist/stripe/server/internal/record-payment.js.map +0 -1
  324. package/dist/stripe/server/internal/request.d.ts.map +0 -1
  325. package/dist/stripe/server/internal/request.js.map +0 -1
  326. package/dist/tap/Constants.d.ts.map +0 -1
  327. package/dist/tap/Constants.js.map +0 -1
  328. package/dist/tap/Types.d.ts.map +0 -1
  329. package/dist/tap/Types.js.map +0 -1
  330. package/dist/tap/client/index.d.ts.map +0 -1
  331. package/dist/tap/client/index.js.map +0 -1
  332. package/dist/tap/index.d.ts.map +0 -1
  333. package/dist/tap/index.js.map +0 -1
  334. package/dist/tap/server/index.d.ts.map +0 -1
  335. package/dist/tap/server/index.js.map +0 -1
  336. package/dist/tempo/Attribution.d.ts.map +0 -1
  337. package/dist/tempo/Attribution.js.map +0 -1
  338. package/dist/tempo/Methods.d.ts.map +0 -1
  339. package/dist/tempo/Methods.js.map +0 -1
  340. package/dist/tempo/Proof.d.ts.map +0 -1
  341. package/dist/tempo/Proof.js.map +0 -1
  342. package/dist/tempo/client/Charge.d.ts.map +0 -1
  343. package/dist/tempo/client/Charge.js.map +0 -1
  344. package/dist/tempo/client/Methods.d.ts.map +0 -1
  345. package/dist/tempo/client/Methods.js.map +0 -1
  346. package/dist/tempo/client/ResolveAccount.d.ts.map +0 -1
  347. package/dist/tempo/client/ResolveAccount.js.map +0 -1
  348. package/dist/tempo/client/Subscription.d.ts.map +0 -1
  349. package/dist/tempo/client/Subscription.js.map +0 -1
  350. package/dist/tempo/client/index.d.ts.map +0 -1
  351. package/dist/tempo/client/index.js.map +0 -1
  352. package/dist/tempo/index.d.ts.map +0 -1
  353. package/dist/tempo/index.js.map +0 -1
  354. package/dist/tempo/internal/account.d.ts.map +0 -1
  355. package/dist/tempo/internal/account.js.map +0 -1
  356. package/dist/tempo/internal/address.d.ts.map +0 -1
  357. package/dist/tempo/internal/address.js.map +0 -1
  358. package/dist/tempo/internal/auto-swap.d.ts.map +0 -1
  359. package/dist/tempo/internal/auto-swap.js.map +0 -1
  360. package/dist/tempo/internal/charge.d.ts.map +0 -1
  361. package/dist/tempo/internal/charge.js.map +0 -1
  362. package/dist/tempo/internal/defaults.d.ts.map +0 -1
  363. package/dist/tempo/internal/defaults.js.map +0 -1
  364. package/dist/tempo/internal/fee-payer.d.ts.map +0 -1
  365. package/dist/tempo/internal/fee-payer.js.map +0 -1
  366. package/dist/tempo/internal/fee-token.d.ts.map +0 -1
  367. package/dist/tempo/internal/fee-token.js.map +0 -1
  368. package/dist/tempo/internal/proof.d.ts.map +0 -1
  369. package/dist/tempo/internal/proof.js.map +0 -1
  370. package/dist/tempo/internal/selectors.d.ts.map +0 -1
  371. package/dist/tempo/internal/selectors.js.map +0 -1
  372. package/dist/tempo/internal/types.d.ts.map +0 -1
  373. package/dist/tempo/internal/types.js.map +0 -1
  374. package/dist/tempo/legacy/client/ChannelOps.d.ts.map +0 -1
  375. package/dist/tempo/legacy/client/ChannelOps.js.map +0 -1
  376. package/dist/tempo/legacy/client/Session.d.ts.map +0 -1
  377. package/dist/tempo/legacy/client/Session.js.map +0 -1
  378. package/dist/tempo/legacy/client/SessionManager.d.ts.map +0 -1
  379. package/dist/tempo/legacy/client/SessionManager.js.map +0 -1
  380. package/dist/tempo/legacy/client/index.d.ts.map +0 -1
  381. package/dist/tempo/legacy/client/index.js.map +0 -1
  382. package/dist/tempo/legacy/index.d.ts.map +0 -1
  383. package/dist/tempo/legacy/index.js.map +0 -1
  384. package/dist/tempo/legacy/session/Chain.d.ts.map +0 -1
  385. package/dist/tempo/legacy/session/Chain.js.map +0 -1
  386. package/dist/tempo/legacy/session/Channel.d.ts.map +0 -1
  387. package/dist/tempo/legacy/session/Channel.js.map +0 -1
  388. package/dist/tempo/legacy/session/Types.d.ts.map +0 -1
  389. package/dist/tempo/legacy/session/Types.js.map +0 -1
  390. package/dist/tempo/legacy/session/Voucher.d.ts.map +0 -1
  391. package/dist/tempo/legacy/session/Voucher.js.map +0 -1
  392. package/dist/tempo/legacy/session/escrow.abi.d.ts.map +0 -1
  393. package/dist/tempo/legacy/session/escrow.abi.js.map +0 -1
  394. package/dist/tempo/legacy/session/index.d.ts.map +0 -1
  395. package/dist/tempo/legacy/session/index.js.map +0 -1
  396. package/dist/tempo/server/Charge.d.ts.map +0 -1
  397. package/dist/tempo/server/Charge.js.map +0 -1
  398. package/dist/tempo/server/Methods.d.ts.map +0 -1
  399. package/dist/tempo/server/Methods.js.map +0 -1
  400. package/dist/tempo/server/Relay.d.ts.map +0 -1
  401. package/dist/tempo/server/Relay.js.map +0 -1
  402. package/dist/tempo/server/SponsorBudget.d.ts.map +0 -1
  403. package/dist/tempo/server/SponsorBudget.js.map +0 -1
  404. package/dist/tempo/server/Subscription.d.ts.map +0 -1
  405. package/dist/tempo/server/Subscription.js.map +0 -1
  406. package/dist/tempo/server/index.d.ts.map +0 -1
  407. package/dist/tempo/server/index.js.map +0 -1
  408. package/dist/tempo/server/internal/html.gen.d.ts.map +0 -1
  409. package/dist/tempo/server/internal/html.gen.js.map +0 -1
  410. package/dist/tempo/server/internal/request-body.d.ts.map +0 -1
  411. package/dist/tempo/server/internal/request-body.js.map +0 -1
  412. package/dist/tempo/server/internal/transport.d.ts.map +0 -1
  413. package/dist/tempo/server/internal/transport.js.map +0 -1
  414. package/dist/tempo/session/Snapshot.d.ts.map +0 -1
  415. package/dist/tempo/session/Snapshot.js.map +0 -1
  416. package/dist/tempo/session/client/ChannelOps.d.ts.map +0 -1
  417. package/dist/tempo/session/client/ChannelOps.js.map +0 -1
  418. package/dist/tempo/session/client/ChannelStore.d.ts.map +0 -1
  419. package/dist/tempo/session/client/ChannelStore.js.map +0 -1
  420. package/dist/tempo/session/client/CredentialState.d.ts.map +0 -1
  421. package/dist/tempo/session/client/CredentialState.js.map +0 -1
  422. package/dist/tempo/session/client/ReceiptCoordinator.d.ts.map +0 -1
  423. package/dist/tempo/session/client/ReceiptCoordinator.js.map +0 -1
  424. package/dist/tempo/session/client/Runtime.d.ts.map +0 -1
  425. package/dist/tempo/session/client/Runtime.js.map +0 -1
  426. package/dist/tempo/session/client/Session.d.ts.map +0 -1
  427. package/dist/tempo/session/client/Session.js.map +0 -1
  428. package/dist/tempo/session/client/SessionManager.d.ts.map +0 -1
  429. package/dist/tempo/session/client/SessionManager.js.map +0 -1
  430. package/dist/tempo/session/client/Transports.d.ts.map +0 -1
  431. package/dist/tempo/session/client/Transports.js.map +0 -1
  432. package/dist/tempo/session/client/index.d.ts.map +0 -1
  433. package/dist/tempo/session/client/index.js.map +0 -1
  434. package/dist/tempo/session/client/internal/SessionManager.d.ts.map +0 -1
  435. package/dist/tempo/session/client/internal/SessionManager.js.map +0 -1
  436. package/dist/tempo/session/index.d.ts.map +0 -1
  437. package/dist/tempo/session/index.js.map +0 -1
  438. package/dist/tempo/session/precompile/Chain.d.ts.map +0 -1
  439. package/dist/tempo/session/precompile/Chain.js.map +0 -1
  440. package/dist/tempo/session/precompile/Channel.d.ts.map +0 -1
  441. package/dist/tempo/session/precompile/Channel.js.map +0 -1
  442. package/dist/tempo/session/precompile/Protocol.d.ts.map +0 -1
  443. package/dist/tempo/session/precompile/Protocol.js.map +0 -1
  444. package/dist/tempo/session/precompile/Voucher.d.ts.map +0 -1
  445. package/dist/tempo/session/precompile/Voucher.js.map +0 -1
  446. package/dist/tempo/session/precompile/escrow.abi.d.ts.map +0 -1
  447. package/dist/tempo/session/precompile/escrow.abi.js.map +0 -1
  448. package/dist/tempo/session/precompile/index.d.ts.map +0 -1
  449. package/dist/tempo/session/precompile/index.js.map +0 -1
  450. package/dist/tempo/session/server/ChannelOps.d.ts.map +0 -1
  451. package/dist/tempo/session/server/ChannelOps.js.map +0 -1
  452. package/dist/tempo/session/server/ChannelStore.d.ts.map +0 -1
  453. package/dist/tempo/session/server/ChannelStore.js.map +0 -1
  454. package/dist/tempo/session/server/CredentialVerification.d.ts.map +0 -1
  455. package/dist/tempo/session/server/CredentialVerification.js.map +0 -1
  456. package/dist/tempo/session/server/MeteredStream.d.ts.map +0 -1
  457. package/dist/tempo/session/server/MeteredStream.js.map +0 -1
  458. package/dist/tempo/session/server/RequestState.d.ts.map +0 -1
  459. package/dist/tempo/session/server/RequestState.js.map +0 -1
  460. package/dist/tempo/session/server/Session.d.ts.map +0 -1
  461. package/dist/tempo/session/server/Session.js.map +0 -1
  462. package/dist/tempo/session/server/Settlement.d.ts.map +0 -1
  463. package/dist/tempo/session/server/Settlement.js.map +0 -1
  464. package/dist/tempo/session/server/Sse.d.ts.map +0 -1
  465. package/dist/tempo/session/server/Sse.js.map +0 -1
  466. package/dist/tempo/session/server/Transports.d.ts.map +0 -1
  467. package/dist/tempo/session/server/Transports.js.map +0 -1
  468. package/dist/tempo/session/server/Ws.d.ts.map +0 -1
  469. package/dist/tempo/session/server/Ws.js.map +0 -1
  470. package/dist/tempo/session/server/index.d.ts.map +0 -1
  471. package/dist/tempo/session/server/index.js.map +0 -1
  472. package/dist/tempo/subscription/KeyAuthorization.d.ts.map +0 -1
  473. package/dist/tempo/subscription/KeyAuthorization.js.map +0 -1
  474. package/dist/tempo/subscription/Receipt.d.ts.map +0 -1
  475. package/dist/tempo/subscription/Receipt.js.map +0 -1
  476. package/dist/tempo/subscription/Store.d.ts.map +0 -1
  477. package/dist/tempo/subscription/Store.js.map +0 -1
  478. package/dist/tempo/subscription/Types.d.ts.map +0 -1
  479. package/dist/tempo/subscription/Types.js.map +0 -1
  480. package/dist/tempo/subscription/index.d.ts.map +0 -1
  481. package/dist/tempo/subscription/index.js.map +0 -1
  482. package/dist/validation/core.d.ts.map +0 -1
  483. package/dist/validation/core.js.map +0 -1
  484. package/dist/validation/index.d.ts.map +0 -1
  485. package/dist/validation/index.js.map +0 -1
  486. package/dist/viem/Account.d.ts.map +0 -1
  487. package/dist/viem/Account.js.map +0 -1
  488. package/dist/viem/Client.d.ts.map +0 -1
  489. package/dist/viem/Client.js.map +0 -1
  490. package/dist/web-bot-auth/Constants.d.ts.map +0 -1
  491. package/dist/web-bot-auth/Constants.js.map +0 -1
  492. package/dist/web-bot-auth/Types.d.ts.map +0 -1
  493. package/dist/web-bot-auth/Types.js.map +0 -1
  494. package/dist/web-bot-auth/client/index.d.ts.map +0 -1
  495. package/dist/web-bot-auth/client/index.js.map +0 -1
  496. package/dist/web-bot-auth/index.d.ts.map +0 -1
  497. package/dist/web-bot-auth/index.js.map +0 -1
  498. package/dist/web-bot-auth/internal/JwkThumbprint.d.ts.map +0 -1
  499. package/dist/web-bot-auth/internal/JwkThumbprint.js.map +0 -1
  500. package/dist/web-bot-auth/internal/SignatureAgent.d.ts.map +0 -1
  501. package/dist/web-bot-auth/internal/SignatureAgent.js.map +0 -1
  502. package/dist/web-bot-auth/server/index.d.ts.map +0 -1
  503. package/dist/web-bot-auth/server/index.js.map +0 -1
  504. package/dist/x402/Assets.d.ts.map +0 -1
  505. package/dist/x402/Assets.js.map +0 -1
  506. package/dist/x402/Header.d.ts.map +0 -1
  507. package/dist/x402/Header.js.map +0 -1
  508. package/dist/x402/Types.d.ts.map +0 -1
  509. package/dist/x402/Types.js.map +0 -1
  510. package/dist/x402/client/Exact.d.ts.map +0 -1
  511. package/dist/x402/client/Exact.js.map +0 -1
  512. package/dist/x402/index.d.ts.map +0 -1
  513. package/dist/x402/index.js.map +0 -1
  514. package/dist/x402/internal/ChallengeBrand.d.ts.map +0 -1
  515. package/dist/x402/internal/ChallengeBrand.js.map +0 -1
  516. package/dist/x402/internal/RouteBinding.d.ts.map +0 -1
  517. package/dist/x402/internal/RouteBinding.js.map +0 -1
  518. package/dist/x402/server/EvmCharge.d.ts.map +0 -1
  519. package/dist/x402/server/EvmCharge.js.map +0 -1
  520. package/dist/x402/server/Facilitator.d.ts.map +0 -1
  521. package/dist/x402/server/Facilitator.js.map +0 -1
  522. package/dist/zod.d.ts.map +0 -1
  523. package/dist/zod.js.map +0 -1
  524. package/src/BodyDigest.test.ts +0 -43
  525. package/src/BodyDigest.ts +0 -55
  526. package/src/Challenge.fuzz.test.ts +0 -154
  527. package/src/Challenge.test-d.ts +0 -82
  528. package/src/Challenge.test.ts +0 -1060
  529. package/src/Challenge.ts +0 -687
  530. package/src/Constants.ts +0 -58
  531. package/src/Credential.fuzz.test.ts +0 -62
  532. package/src/Credential.test.ts +0 -378
  533. package/src/Credential.ts +0 -217
  534. package/src/Errors.test.ts +0 -520
  535. package/src/Errors.ts +0 -448
  536. package/src/Expires.test.ts +0 -112
  537. package/src/Expires.ts +0 -59
  538. package/src/Html.ts +0 -67
  539. package/src/Mcp.ts +0 -85
  540. package/src/Method.test.ts +0 -177
  541. package/src/Method.ts +0 -631
  542. package/src/PaymentRequest.test.ts +0 -147
  543. package/src/PaymentRequest.ts +0 -108
  544. package/src/Receipt.test.ts +0 -151
  545. package/src/Receipt.ts +0 -146
  546. package/src/Store.test-d.ts +0 -211
  547. package/src/Store.test.ts +0 -407
  548. package/src/Store.ts +0 -397
  549. package/src/attestation/Attestation.integration.test.ts +0 -208
  550. package/src/attestation/Client.test.ts +0 -83
  551. package/src/attestation/Client.ts +0 -34
  552. package/src/attestation/Constants.ts +0 -15
  553. package/src/attestation/Server.test.ts +0 -60
  554. package/src/attestation/Server.ts +0 -12
  555. package/src/attestation/Types.test-d.ts +0 -54
  556. package/src/attestation/Types.ts +0 -77
  557. package/src/attestation/index.ts +0 -5
  558. package/src/attestation/internal/HttpMessageSignature.test.ts +0 -101
  559. package/src/attestation/internal/HttpMessageSignature.ts +0 -429
  560. package/src/attestation/internal/SigningContext.ts +0 -13
  561. package/src/bin.js +0 -2
  562. package/src/bin.ts +0 -4
  563. package/src/cli/account.ts +0 -269
  564. package/src/cli/cli.test.ts +0 -2221
  565. package/src/cli/cli.ts +0 -1650
  566. package/src/cli/config.test.ts +0 -89
  567. package/src/cli/config.ts +0 -50
  568. package/src/cli/internal.ts +0 -114
  569. package/src/cli/mcp.test.ts +0 -262
  570. package/src/cli/plugins/evm.ts +0 -55
  571. package/src/cli/plugins/index.ts +0 -4
  572. package/src/cli/plugins/plugin.ts +0 -84
  573. package/src/cli/plugins/stripe.ts +0 -174
  574. package/src/cli/plugins/tempo.ts +0 -1102
  575. package/src/cli/sessions/Manager.test.ts +0 -249
  576. package/src/cli/sessions/Manager.ts +0 -93
  577. package/src/cli/sessions/commands.ts +0 -444
  578. package/src/cli/sessions/request.test.ts +0 -51
  579. package/src/cli/sessions/request.ts +0 -353
  580. package/src/cli/sessions/store.test.ts +0 -581
  581. package/src/cli/sessions/store.ts +0 -940
  582. package/src/cli/utils.test.ts +0 -156
  583. package/src/cli/utils.ts +0 -394
  584. package/src/cli/validate/challenge.ts +0 -565
  585. package/src/cli/validate/discovery.test.ts +0 -435
  586. package/src/cli/validate/discovery.ts +0 -221
  587. package/src/cli/validate/helpers.ts +0 -166
  588. package/src/cli/validate/index.ts +0 -229
  589. package/src/cli/validate/messages.ts +0 -7
  590. package/src/cli/validate/payment.ts +0 -774
  591. package/src/cli/validate.test.ts +0 -843
  592. package/src/client/Methods.ts +0 -8
  593. package/src/client/Mppx.test-d.ts +0 -287
  594. package/src/client/Mppx.test.ts +0 -1065
  595. package/src/client/Mppx.ts +0 -487
  596. package/src/client/Transport.test.ts +0 -586
  597. package/src/client/Transport.ts +0 -170
  598. package/src/client/index.ts +0 -29
  599. package/src/client/internal/Fetch.browser.test.ts +0 -197
  600. package/src/client/internal/Fetch.test-d.ts +0 -109
  601. package/src/client/internal/Fetch.test.ts +0 -2336
  602. package/src/client/internal/Fetch.ts +0 -1075
  603. package/src/client/internal/MethodChallenge.ts +0 -35
  604. package/src/client/internal/MethodResponse.ts +0 -67
  605. package/src/client/internal/protocols/Mcp.test.ts +0 -220
  606. package/src/client/internal/protocols/Mcp.ts +0 -186
  607. package/src/client/internal/protocols/Mpp.ts +0 -21
  608. package/src/client/internal/protocols/Protocol.ts +0 -10
  609. package/src/client/internal/protocols/Shared.ts +0 -25
  610. package/src/client/internal/protocols/X402.ts +0 -46
  611. package/src/client/node.test.ts +0 -115
  612. package/src/client/node.ts +0 -247
  613. package/src/discovery/Discovery.test.ts +0 -214
  614. package/src/discovery/Discovery.ts +0 -105
  615. package/src/discovery/OpenApi.test.ts +0 -623
  616. package/src/discovery/OpenApi.ts +0 -192
  617. package/src/discovery/Validate.test.ts +0 -305
  618. package/src/discovery/Validate.ts +0 -77
  619. package/src/discovery/index.ts +0 -3
  620. package/src/discovery/internal/Metadata.ts +0 -51
  621. package/src/env.d.ts +0 -12
  622. package/src/evm/Assets.ts +0 -1
  623. package/src/evm/Chains.ts +0 -11
  624. package/src/evm/Methods.ts +0 -44
  625. package/src/evm/PublicInterface.test-d.ts +0 -134
  626. package/src/evm/Types.ts +0 -140
  627. package/src/evm/client/Charge.test.ts +0 -347
  628. package/src/evm/client/Charge.ts +0 -187
  629. package/src/evm/client/Methods.ts +0 -19
  630. package/src/evm/client/index.ts +0 -6
  631. package/src/evm/index.ts +0 -16
  632. package/src/evm/server/Charge.test.ts +0 -339
  633. package/src/evm/server/Charge.ts +0 -295
  634. package/src/evm/server/Methods.ts +0 -22
  635. package/src/evm/server/index.ts +0 -6
  636. package/src/index.ts +0 -14
  637. package/src/internal/AcceptPayment.test.ts +0 -347
  638. package/src/internal/AcceptPayment.ts +0 -366
  639. package/src/internal/HeaderCodec.ts +0 -36
  640. package/src/internal/changeset.test.ts +0 -106
  641. package/src/internal/constantTimeEqual.test.ts +0 -47
  642. package/src/internal/constantTimeEqual.ts +0 -10
  643. package/src/internal/env.test.ts +0 -42
  644. package/src/internal/env.ts +0 -49
  645. package/src/internal/types.test-d.ts +0 -21
  646. package/src/internal/types.ts +0 -479
  647. package/src/mcp/client/McpClient.integration.test.ts +0 -639
  648. package/src/mcp/client/McpClient.test-d.ts +0 -144
  649. package/src/mcp/client/McpClient.test.ts +0 -463
  650. package/src/mcp/client/McpClient.ts +0 -307
  651. package/src/mcp/client/McpClient.unit.test.ts +0 -135
  652. package/src/mcp/client/index.ts +0 -2
  653. package/src/mcp/server/Transport.test.ts +0 -191
  654. package/src/mcp/server/Transport.ts +0 -111
  655. package/src/mcp/server/index.ts +0 -1
  656. package/src/middlewares/elysia.test.ts +0 -285
  657. package/src/middlewares/elysia.ts +0 -116
  658. package/src/middlewares/express.test.ts +0 -361
  659. package/src/middlewares/express.ts +0 -140
  660. package/src/middlewares/hono.test.ts +0 -473
  661. package/src/middlewares/hono.ts +0 -153
  662. package/src/middlewares/internal/mppx.test.ts +0 -177
  663. package/src/middlewares/internal/mppx.ts +0 -67
  664. package/src/middlewares/nextjs.test.ts +0 -359
  665. package/src/middlewares/nextjs.ts +0 -107
  666. package/src/proxy/Proxy.test.ts +0 -1038
  667. package/src/proxy/Proxy.ts +0 -483
  668. package/src/proxy/Proxy.upstreamError.test.ts +0 -364
  669. package/src/proxy/Service.test.ts +0 -252
  670. package/src/proxy/Service.ts +0 -280
  671. package/src/proxy/index.ts +0 -6
  672. package/src/proxy/internal/Headers.test.ts +0 -139
  673. package/src/proxy/internal/Headers.ts +0 -66
  674. package/src/proxy/internal/Route.test.ts +0 -217
  675. package/src/proxy/internal/Route.ts +0 -64
  676. package/src/proxy/services/anthropic.test.ts +0 -132
  677. package/src/proxy/services/anthropic.ts +0 -53
  678. package/src/proxy/services/hooks.test-d.ts +0 -14
  679. package/src/proxy/services/hooks.test.ts +0 -44
  680. package/src/proxy/services/openai.test.ts +0 -157
  681. package/src/proxy/services/openai.ts +0 -60
  682. package/src/proxy/services/stripe.test.ts +0 -175
  683. package/src/proxy/services/stripe.ts +0 -59
  684. package/src/server/Methods.test-d.ts +0 -88
  685. package/src/server/Methods.test.ts +0 -69
  686. package/src/server/Methods.ts +0 -3
  687. package/src/server/Mppx.authorize.test.ts +0 -210
  688. package/src/server/Mppx.test-d.ts +0 -494
  689. package/src/server/Mppx.test.ts +0 -6711
  690. package/src/server/Mppx.ts +0 -2919
  691. package/src/server/NodeListener.test.ts +0 -293
  692. package/src/server/NodeListener.ts +0 -45
  693. package/src/server/Request.test.ts +0 -255
  694. package/src/server/Request.ts +0 -155
  695. package/src/server/Response.test.ts +0 -32
  696. package/src/server/Response.ts +0 -45
  697. package/src/server/Transport.test.ts +0 -598
  698. package/src/server/Transport.ts +0 -320
  699. package/src/server/index.ts +0 -9
  700. package/src/server/internal/html/compose.main.gen.ts +0 -2
  701. package/src/server/internal/html/compose.main.ts +0 -88
  702. package/src/server/internal/html/config.ts +0 -672
  703. package/src/server/internal/html/constants.ts +0 -28
  704. package/src/server/internal/html/serviceWorker.client.ts +0 -28
  705. package/src/server/internal/html/serviceWorker.gen.ts +0 -2
  706. package/src/server/internal/html/serviceWorker.ts +0 -27
  707. package/src/server/internal/html/tsconfig.compose.json +0 -8
  708. package/src/server/internal/html/tsconfig.worker.client.json +0 -8
  709. package/src/server/internal/html/tsconfig.worker.json +0 -8
  710. package/src/server/internal/scope.ts +0 -43
  711. package/src/stripe/Charge.integration.test.ts +0 -329
  712. package/src/stripe/Methods.test.ts +0 -62
  713. package/src/stripe/Methods.ts +0 -44
  714. package/src/stripe/client/Charge.test.ts +0 -205
  715. package/src/stripe/client/Charge.ts +0 -132
  716. package/src/stripe/client/Methods.ts +0 -37
  717. package/src/stripe/client/index.ts +0 -2
  718. package/src/stripe/index.ts +0 -1
  719. package/src/stripe/internal/constants.ts +0 -7
  720. package/src/stripe/internal/types.ts +0 -47
  721. package/src/stripe/server/Charge.test-d.ts +0 -81
  722. package/src/stripe/server/Charge.test.ts +0 -700
  723. package/src/stripe/server/Charge.ts +0 -487
  724. package/src/stripe/server/Methods.test-d.ts +0 -157
  725. package/src/stripe/server/Methods.test.ts +0 -403
  726. package/src/stripe/server/Methods.ts +0 -441
  727. package/src/stripe/server/index.ts +0 -2
  728. package/src/stripe/server/internal/deposit-address.ts +0 -57
  729. package/src/stripe/server/internal/html/main.ts +0 -165
  730. package/src/stripe/server/internal/html/node_modules/.bin/mppx +0 -22
  731. package/src/stripe/server/internal/html/node_modules/.bin/mppx.src +0 -22
  732. package/src/stripe/server/internal/html/package.json +0 -9
  733. package/src/stripe/server/internal/html/stripe-js-pure.d.ts +0 -7
  734. package/src/stripe/server/internal/html/tsconfig.json +0 -8
  735. package/src/stripe/server/internal/html/types.ts +0 -5
  736. package/src/stripe/server/internal/html.gen.ts +0 -2
  737. package/src/stripe/server/internal/record-payment.ts +0 -66
  738. package/src/stripe/server/internal/request.ts +0 -49
  739. package/src/tap/Constants.ts +0 -32
  740. package/src/tap/Tap.test.ts +0 -125
  741. package/src/tap/Types.ts +0 -11
  742. package/src/tap/client/index.ts +0 -54
  743. package/src/tap/index.ts +0 -4
  744. package/src/tap/server/index.ts +0 -48
  745. package/src/tempo/AccessKeyAuthorization.test.ts +0 -141
  746. package/src/tempo/Attribution.test.ts +0 -294
  747. package/src/tempo/Attribution.ts +0 -185
  748. package/src/tempo/Methods.test.ts +0 -425
  749. package/src/tempo/Methods.ts +0 -367
  750. package/src/tempo/Proof.conformance.test.ts +0 -146
  751. package/src/tempo/Proof.test-d.ts +0 -32
  752. package/src/tempo/Proof.test.ts +0 -40
  753. package/src/tempo/Proof.ts +0 -69
  754. package/src/tempo/PublicExports.test-d.ts +0 -130
  755. package/src/tempo/Subscription.integration.test.ts +0 -591
  756. package/src/tempo/client/Charge.test.ts +0 -501
  757. package/src/tempo/client/Charge.ts +0 -271
  758. package/src/tempo/client/Methods.ts +0 -45
  759. package/src/tempo/client/ResolveAccount.ts +0 -46
  760. package/src/tempo/client/Subscription.test.ts +0 -180
  761. package/src/tempo/client/Subscription.ts +0 -156
  762. package/src/tempo/client/index.ts +0 -17
  763. package/src/tempo/index.ts +0 -5
  764. package/src/tempo/internal/account.ts +0 -56
  765. package/src/tempo/internal/address.test.ts +0 -42
  766. package/src/tempo/internal/address.ts +0 -6
  767. package/src/tempo/internal/auto-swap.test.ts +0 -198
  768. package/src/tempo/internal/auto-swap.ts +0 -145
  769. package/src/tempo/internal/charge.test.ts +0 -66
  770. package/src/tempo/internal/charge.ts +0 -43
  771. package/src/tempo/internal/defaults.test.ts +0 -95
  772. package/src/tempo/internal/defaults.ts +0 -53
  773. package/src/tempo/internal/fee-payer.test.ts +0 -1177
  774. package/src/tempo/internal/fee-payer.ts +0 -808
  775. package/src/tempo/internal/fee-token.test.ts +0 -165
  776. package/src/tempo/internal/fee-token.ts +0 -72
  777. package/src/tempo/internal/proof.test.ts +0 -97
  778. package/src/tempo/internal/proof.ts +0 -87
  779. package/src/tempo/internal/selectors.ts +0 -10
  780. package/src/tempo/internal/types.ts +0 -19
  781. package/src/tempo/legacy/AccessKeyAuthorization.test.ts +0 -162
  782. package/src/tempo/legacy/README.md +0 -9
  783. package/src/tempo/legacy/client/ChannelOps.test.ts +0 -379
  784. package/src/tempo/legacy/client/ChannelOps.ts +0 -271
  785. package/src/tempo/legacy/client/Session.test.ts +0 -800
  786. package/src/tempo/legacy/client/Session.ts +0 -397
  787. package/src/tempo/legacy/client/SessionManager.test.ts +0 -468
  788. package/src/tempo/legacy/client/SessionManager.ts +0 -909
  789. package/src/tempo/legacy/client/index.ts +0 -6
  790. package/src/tempo/legacy/index.ts +0 -4
  791. package/src/tempo/legacy/session/Chain.test.ts +0 -1349
  792. package/src/tempo/legacy/session/Chain.ts +0 -830
  793. package/src/tempo/legacy/session/Channel.test.ts +0 -109
  794. package/src/tempo/legacy/session/Channel.ts +0 -51
  795. package/src/tempo/legacy/session/Types.ts +0 -91
  796. package/src/tempo/legacy/session/Voucher.test.ts +0 -410
  797. package/src/tempo/legacy/session/Voucher.ts +0 -183
  798. package/src/tempo/legacy/session/escrow.abi.ts +0 -760
  799. package/src/tempo/legacy/session/index.ts +0 -8
  800. package/src/tempo/server/AtomicStore.test-d.ts +0 -63
  801. package/src/tempo/server/Charge.test.ts +0 -6056
  802. package/src/tempo/server/Charge.ts +0 -1379
  803. package/src/tempo/server/Methods.ts +0 -86
  804. package/src/tempo/server/Relay.test.ts +0 -677
  805. package/src/tempo/server/Relay.ts +0 -297
  806. package/src/tempo/server/SponsorBudget.test.ts +0 -154
  807. package/src/tempo/server/SponsorBudget.ts +0 -219
  808. package/src/tempo/server/Sse.test.ts +0 -321
  809. package/src/tempo/server/Subscription.test.ts +0 -1944
  810. package/src/tempo/server/Subscription.ts +0 -1336
  811. package/src/tempo/server/index.ts +0 -12
  812. package/src/tempo/server/internal/html/main.ts +0 -115
  813. package/src/tempo/server/internal/html/node_modules/.bin/mppx +0 -22
  814. package/src/tempo/server/internal/html/node_modules/.bin/mppx.src +0 -22
  815. package/src/tempo/server/internal/html/package.json +0 -10
  816. package/src/tempo/server/internal/html/tsconfig.json +0 -8
  817. package/src/tempo/server/internal/html.gen.ts +0 -2
  818. package/src/tempo/server/internal/request-body.test.ts +0 -210
  819. package/src/tempo/server/internal/request-body.ts +0 -61
  820. package/src/tempo/server/internal/transport.test.ts +0 -922
  821. package/src/tempo/server/internal/transport.ts +0 -322
  822. package/src/tempo/session/README.md +0 -320
  823. package/src/tempo/session/Snapshot.test.ts +0 -41
  824. package/src/tempo/session/Snapshot.ts +0 -95
  825. package/src/tempo/session/client/ChannelOps.test.ts +0 -218
  826. package/src/tempo/session/client/ChannelOps.ts +0 -348
  827. package/src/tempo/session/client/ChannelStore.ts +0 -111
  828. package/src/tempo/session/client/CredentialState.test.ts +0 -789
  829. package/src/tempo/session/client/CredentialState.ts +0 -942
  830. package/src/tempo/session/client/ReceiptCoordinator.ts +0 -95
  831. package/src/tempo/session/client/Runtime.test.ts +0 -1104
  832. package/src/tempo/session/client/Runtime.ts +0 -1008
  833. package/src/tempo/session/client/Session.test.ts +0 -1355
  834. package/src/tempo/session/client/Session.ts +0 -420
  835. package/src/tempo/session/client/SessionManager.test.ts +0 -1899
  836. package/src/tempo/session/client/SessionManager.ts +0 -996
  837. package/src/tempo/session/client/Transports.test.ts +0 -1141
  838. package/src/tempo/session/client/Transports.ts +0 -1534
  839. package/src/tempo/session/client/index.ts +0 -40
  840. package/src/tempo/session/client/internal/SessionManager.ts +0 -36
  841. package/src/tempo/session/index.ts +0 -7
  842. package/src/tempo/session/precompile/Chain.integration.test.ts +0 -339
  843. package/src/tempo/session/precompile/Chain.test.ts +0 -1641
  844. package/src/tempo/session/precompile/Chain.ts +0 -1269
  845. package/src/tempo/session/precompile/Channel.test.ts +0 -147
  846. package/src/tempo/session/precompile/Channel.ts +0 -108
  847. package/src/tempo/session/precompile/Protocol.test.ts +0 -358
  848. package/src/tempo/session/precompile/Protocol.ts +0 -520
  849. package/src/tempo/session/precompile/Voucher.test.ts +0 -354
  850. package/src/tempo/session/precompile/Voucher.ts +0 -162
  851. package/src/tempo/session/precompile/escrow.abi.ts +0 -226
  852. package/src/tempo/session/precompile/index.ts +0 -33
  853. package/src/tempo/session/server/ChannelOps.test.ts +0 -129
  854. package/src/tempo/session/server/ChannelOps.ts +0 -157
  855. package/src/tempo/session/server/ChannelStore.test.ts +0 -1093
  856. package/src/tempo/session/server/ChannelStore.ts +0 -856
  857. package/src/tempo/session/server/CredentialVerification.test.ts +0 -299
  858. package/src/tempo/session/server/CredentialVerification.ts +0 -1087
  859. package/src/tempo/session/server/MeteredStream.ts +0 -99
  860. package/src/tempo/session/server/RequestState.test.ts +0 -574
  861. package/src/tempo/session/server/RequestState.ts +0 -507
  862. package/src/tempo/session/server/Session.integration.test.ts +0 -449
  863. package/src/tempo/session/server/Session.test.ts +0 -4247
  864. package/src/tempo/session/server/Session.ts +0 -669
  865. package/src/tempo/session/server/Settlement.test.ts +0 -345
  866. package/src/tempo/session/server/Settlement.ts +0 -527
  867. package/src/tempo/session/server/Sse.fuzz.test.ts +0 -138
  868. package/src/tempo/session/server/Sse.test.ts +0 -634
  869. package/src/tempo/session/server/Sse.ts +0 -261
  870. package/src/tempo/session/server/Transports.test.ts +0 -346
  871. package/src/tempo/session/server/Transports.ts +0 -256
  872. package/src/tempo/session/server/Ws.test.ts +0 -765
  873. package/src/tempo/session/server/Ws.ts +0 -391
  874. package/src/tempo/session/server/index.ts +0 -12
  875. package/src/tempo/subscription/KeyAuthorization.test.ts +0 -282
  876. package/src/tempo/subscription/KeyAuthorization.ts +0 -396
  877. package/src/tempo/subscription/Receipt.ts +0 -28
  878. package/src/tempo/subscription/Store.test.ts +0 -609
  879. package/src/tempo/subscription/Store.ts +0 -449
  880. package/src/tempo/subscription/Types.ts +0 -68
  881. package/src/tempo/subscription/index.ts +0 -23
  882. package/src/tsconfig.json +0 -10
  883. package/src/validation/core.ts +0 -386
  884. package/src/validation/index.ts +0 -11
  885. package/src/viem/Account.test.ts +0 -72
  886. package/src/viem/Account.ts +0 -30
  887. package/src/viem/Client.test.ts +0 -366
  888. package/src/viem/Client.ts +0 -93
  889. package/src/web-bot-auth/Constants.ts +0 -24
  890. package/src/web-bot-auth/Types.ts +0 -9
  891. package/src/web-bot-auth/WebBotAuth.test.ts +0 -182
  892. package/src/web-bot-auth/client/index.ts +0 -84
  893. package/src/web-bot-auth/index.ts +0 -6
  894. package/src/web-bot-auth/internal/JwkThumbprint.ts +0 -21
  895. package/src/web-bot-auth/internal/SignatureAgent.ts +0 -18
  896. package/src/web-bot-auth/server/index.ts +0 -113
  897. package/src/x402/Assets.test.ts +0 -253
  898. package/src/x402/Assets.ts +0 -221
  899. package/src/x402/Exact.e2e.test.ts +0 -488
  900. package/src/x402/Exact.localnet.test.ts +0 -475
  901. package/src/x402/Header.test.ts +0 -73
  902. package/src/x402/Header.ts +0 -79
  903. package/src/x402/PublicInterface.test-d.ts +0 -39
  904. package/src/x402/Types.ts +0 -248
  905. package/src/x402/client/Exact.test.ts +0 -309
  906. package/src/x402/client/Exact.ts +0 -186
  907. package/src/x402/index.ts +0 -6
  908. package/src/x402/internal/ChallengeBrand.ts +0 -14
  909. package/src/x402/internal/RouteBinding.ts +0 -18
  910. package/src/x402/server/EvmCharge.ts +0 -410
  911. package/src/x402/server/Facilitator.test.ts +0 -111
  912. package/src/x402/server/Facilitator.ts +0 -56
  913. package/src/zod.test.ts +0 -169
  914. package/src/zod.ts +0 -71
@@ -1,830 +0,0 @@
1
- import {
2
- type Account,
3
- type Address,
4
- type Client,
5
- decodeFunctionData,
6
- encodeFunctionData,
7
- erc20Abi,
8
- getAbiItem,
9
- type Hex,
10
- type ReadContractReturnType,
11
- toFunctionSelector,
12
- } from 'viem'
13
- import {
14
- call,
15
- prepareTransactionRequest,
16
- readContract,
17
- sendRawTransaction,
18
- sendRawTransactionSync,
19
- signTransaction,
20
- } from 'viem/actions'
21
- import { Transaction } from 'viem/tempo'
22
-
23
- import { BadRequestError, ChannelClosedError, VerificationFailedError } from '../../../Errors.js'
24
- import * as TempoAddress from '../../internal/address.js'
25
- import * as defaults from '../../internal/defaults.js'
26
- import * as FeePayer from '../../internal/fee-payer.js'
27
- import { resolveFeeToken } from '../../internal/fee-token.js'
28
- import * as Channel from './Channel.js'
29
- import { escrowAbi } from './escrow.abi.js'
30
- import type { LegacySignedVoucher } from './Types.js'
31
-
32
- export { escrowAbi }
33
-
34
- type SenderSignedTransaction = {
35
- from?: Address | undefined
36
- signature?: unknown
37
- }
38
-
39
- /**
40
- * Asserts that a deserialized transaction has an existing sender signature —
41
- * required before fee payer co-signing to prevent the fee payer from becoming
42
- * the sender.
43
- */
44
- function assertSenderSigned(transaction: SenderSignedTransaction): void {
45
- if (!transaction.signature || !transaction.from)
46
- throw new BadRequestError({
47
- reason: 'Transaction must be signed by the sender before fee payer co-signing',
48
- })
49
- }
50
-
51
- const UINT128_MAX = 2n ** 128n - 1n
52
-
53
- /**
54
- * On-chain channel state from the escrow contract.
55
- */
56
- export type OnChainChannel = ReadContractReturnType<typeof escrowAbi, 'getChannel'>
57
-
58
- /**
59
- * Read channel state from the escrow contract.
60
- */
61
- export async function getOnChainChannel(
62
- client: Client,
63
- escrowContract: Address,
64
- channelId: Hex,
65
- ): Promise<OnChainChannel> {
66
- return readContract(client, {
67
- address: escrowContract,
68
- abi: escrowAbi,
69
- functionName: 'getChannel',
70
- args: [channelId],
71
- })
72
- }
73
-
74
- /**
75
- * Verify a topUp by re-reading on-chain channel state.
76
- */
77
- export async function verifyTopUpTransaction(
78
- client: Client,
79
- escrowContract: Address,
80
- channelId: Hex,
81
- previousDeposit: bigint,
82
- ): Promise<{ deposit: bigint }> {
83
- const channel = await getOnChainChannel(client, escrowContract, channelId)
84
-
85
- if (channel.finalized) {
86
- throw new ChannelClosedError({ reason: 'channel is finalized on-chain' })
87
- }
88
-
89
- if (channel.deposit <= previousDeposit) {
90
- throw new VerificationFailedError({ reason: 'channel deposit did not increase' })
91
- }
92
-
93
- return { deposit: channel.deposit }
94
- }
95
-
96
- function assertUint128(amount: bigint): void {
97
- if (amount < 0n || amount > UINT128_MAX) {
98
- throw new VerificationFailedError({ reason: 'cumulativeAmount exceeds uint128 range' })
99
- }
100
- }
101
-
102
- /** Options for {@link settleOnChain}. */
103
- export type SettleOptions =
104
- | { candidateFeeTokens?: readonly Address[] | undefined; feePayer: Account; account: Account }
105
- | {
106
- candidateFeeTokens?: readonly Address[] | undefined
107
- feePayer?: undefined
108
- account?: Account | undefined
109
- }
110
-
111
- /**
112
- * Submit a settle transaction on-chain.
113
- */
114
- export async function settleOnChain(
115
- client: Client,
116
- escrowContract: Address,
117
- voucher: LegacySignedVoucher,
118
- options?: SettleOptions,
119
- ): Promise<Hex> {
120
- assertUint128(voucher.cumulativeAmount)
121
- const resolved = options?.account ?? client.account
122
- if (!resolved)
123
- throw new Error(
124
- 'Cannot settle channel: no account available. Pass an `account` to tempo.settle(), or provide a `getClient` that returns an account-bearing client.',
125
- )
126
- const args = [voucher.channelId, voucher.cumulativeAmount, voucher.signature] as const
127
- if (options?.feePayer) {
128
- const data = encodeFunctionData({ abi: escrowAbi, functionName: 'settle', args })
129
- return sendFeePayerTx(
130
- client,
131
- resolved,
132
- options.feePayer,
133
- escrowContract,
134
- data,
135
- 'settle',
136
- options.candidateFeeTokens,
137
- )
138
- }
139
- return sendAccountTx(
140
- client,
141
- resolved,
142
- escrowContract,
143
- encodeFunctionData({ abi: escrowAbi, functionName: 'settle', args }),
144
- 'settle',
145
- options?.candidateFeeTokens,
146
- )
147
- }
148
-
149
- /** Options for {@link closeOnChain}. */
150
- export type CloseOptions =
151
- | {
152
- candidateFeeTokens?: readonly Address[] | undefined
153
- feePayer: Account
154
- account: Account
155
- }
156
- | {
157
- candidateFeeTokens?: readonly Address[] | undefined
158
- feePayer?: undefined
159
- account?: Account | undefined
160
- }
161
-
162
- /**
163
- * Submit a close transaction on-chain.
164
- */
165
- export async function closeOnChain(
166
- client: Client,
167
- escrowContract: Address,
168
- voucher: LegacySignedVoucher,
169
- options?: CloseOptions,
170
- ): Promise<Hex> {
171
- assertUint128(voucher.cumulativeAmount)
172
- const resolved = options?.account ?? client.account
173
- if (!resolved)
174
- throw new Error(
175
- 'Cannot close channel: no account available. Pass an `account` (viem Account, e.g. privateKeyToAccount("0x...")) to tempo.session(), or provide a `getClient` that returns an account-bearing client.',
176
- )
177
- const args = [voucher.channelId, voucher.cumulativeAmount, voucher.signature] as const
178
- if (options?.feePayer) {
179
- const data = encodeFunctionData({ abi: escrowAbi, functionName: 'close', args })
180
- return sendFeePayerTx(
181
- client,
182
- resolved,
183
- options.feePayer,
184
- escrowContract,
185
- data,
186
- 'close',
187
- options.candidateFeeTokens,
188
- )
189
- }
190
- return sendAccountTx(
191
- client,
192
- resolved,
193
- escrowContract,
194
- encodeFunctionData({ abi: escrowAbi, functionName: 'close', args }),
195
- 'close',
196
- options?.candidateFeeTokens,
197
- )
198
- }
199
-
200
- async function sendAccountTx(
201
- client: Client,
202
- account: Account,
203
- to: Address,
204
- data: Hex,
205
- label: string,
206
- candidateFeeTokens?: readonly Address[] | undefined,
207
- ): Promise<Hex> {
208
- const feeToken = await resolveFeeToken({
209
- account: account.address,
210
- candidateTokens: candidateFeeTokens,
211
- client,
212
- })
213
- const prepared = await prepareTransactionRequest(client, {
214
- account,
215
- calls: [{ to, data }],
216
- ...(feeToken ? { feeToken } : {}),
217
- } as never)
218
- prepared.gas = prepared.gas! + 5_000n
219
-
220
- const serialized = (await signTransaction(client, {
221
- ...prepared,
222
- account,
223
- } as never)) as Hex
224
-
225
- const receipt = await sendRawTransactionSync(client, {
226
- serializedTransaction: serialized as Transaction.TransactionSerializedTempo,
227
- })
228
-
229
- if (receipt.status !== 'success') {
230
- throw new VerificationFailedError({
231
- reason: `${label} transaction reverted: ${receipt.transactionHash}`,
232
- })
233
- }
234
-
235
- return receipt.transactionHash
236
- }
237
-
238
- /**
239
- * Build, sign, and broadcast a fee-sponsored type-0x76 transaction.
240
- *
241
- * Follows the same signTransaction + sendRawTransactionSync pattern used
242
- * by broadcastOpenTransaction / broadcastTopUpTransaction, but originates
243
- * the transaction server-side (estimating gas and fees first).
244
- *
245
- * @param account - The logical sender / msg.sender (e.g. the payee).
246
- * @param feePayer - The gas sponsor — only co-signs to cover fees.
247
- */
248
- async function sendFeePayerTx(
249
- client: Client,
250
- account: Account,
251
- feePayer: Account,
252
- to: Address,
253
- data: Hex,
254
- label: string,
255
- candidateFeeTokens?: readonly Address[] | undefined,
256
- ): Promise<Hex> {
257
- const feeToken = await resolveFeeToken({
258
- account: feePayer.address,
259
- candidateTokens: candidateFeeTokens,
260
- client,
261
- })
262
-
263
- const prepared = await prepareTransactionRequest(client, {
264
- account,
265
- calls: [{ to, data }],
266
- ...(feeToken ? { feeToken } : {}),
267
- nonceKey: 'expiring',
268
- validBefore: Math.floor(Date.now() / 1_000) + 25,
269
- } as never)
270
- // Estimate before enabling fee-payer mode so Tempo includes sender
271
- // signature verification costs in the gas budget.
272
- prepared.gas = (prepared.gas ?? 0n) + 5_000n
273
- ;(prepared as Record<string, unknown>).feePayer = true
274
-
275
- const serialized = (await signTransaction(client, {
276
- ...prepared,
277
- account,
278
- feePayer,
279
- } as never)) as Hex
280
-
281
- const receipt = await sendRawTransactionSync(client, {
282
- serializedTransaction: serialized as Transaction.TransactionSerializedTempo,
283
- })
284
-
285
- if (receipt.status !== 'success') {
286
- throw new VerificationFailedError({
287
- reason: `${label} transaction reverted: ${receipt.transactionHash}`,
288
- })
289
- }
290
-
291
- return receipt.transactionHash
292
- }
293
-
294
- const escrowOpenSelector = /*#__PURE__*/ toFunctionSelector(
295
- getAbiItem({ abi: escrowAbi, name: 'open' }),
296
- )
297
-
298
- const escrowTopUpSelector = /*#__PURE__*/ toFunctionSelector(
299
- getAbiItem({ abi: escrowAbi, name: 'topUp' }),
300
- )
301
-
302
- const erc20ApproveSelector = /*#__PURE__*/ toFunctionSelector(
303
- 'function approve(address spender, uint256 amount)',
304
- )
305
-
306
- /** Result returned after a legacy open transaction is broadcast or recovered from on-chain state. */
307
- export type BroadcastResult = {
308
- txHash: Hex | undefined
309
- onChain: OnChainChannel
310
- }
311
-
312
- /** Inputs for validating an ERC-20 approve call inside a fee-sponsored legacy channel transaction. */
313
- type SponsoredApproveCallParameters = {
314
- action: 'open' | 'topUp'
315
- call: TempoCall
316
- currency: Address
317
- escrowContract: Address
318
- expectedAmount: bigint
319
- }
320
-
321
- /** Inputs for extracting the escrow open call from a fee-sponsored legacy channel transaction. */
322
- type SponsoredOpenCallsParameters = {
323
- calls: readonly TempoCall[]
324
- currency: Address
325
- deposit: bigint
326
- escrowContract: Address
327
- }
328
-
329
- /** Inputs for extracting the escrow top-up call from a fee-sponsored legacy channel transaction. */
330
- type SponsoredTopUpCallsParameters = {
331
- calls: readonly TempoCall[]
332
- currency: Address
333
- escrowContract: Address
334
- topUpAmount: bigint
335
- }
336
-
337
- /** Inputs for broadcasting and validating a legacy contract-backed open transaction. */
338
- export type BroadcastOpenTransactionParameters = {
339
- beforeBroadcast?: ((onChain: OnChainChannel) => Promise<void> | void) | undefined
340
- challengeExpires?: string | undefined
341
- channelId: Hex
342
- client: Client
343
- currency: Address
344
- escrowContract: Address
345
- feePayer?: Account | undefined
346
- feePayerPolicy?: Partial<FeePayer.Policy> | undefined
347
- isSponsored?: boolean | undefined
348
- recipient: Address
349
- serializedTransaction: Hex
350
- /** When false, simulates instead of waiting for confirmation and returns derived on-chain state. @default true */
351
- waitForConfirmation?: boolean | undefined
352
- }
353
-
354
- /** Inputs for broadcasting and validating a legacy contract-backed top-up transaction. */
355
- export type BroadcastTopUpTransactionParameters = {
356
- challengeExpires?: string | undefined
357
- channelId: Hex
358
- client: Client
359
- currency: Address
360
- declaredDeposit: bigint
361
- escrowContract: Address
362
- feePayer?: Account | undefined
363
- feePayerPolicy?: Partial<FeePayer.Policy> | undefined
364
- isSponsored?: boolean | undefined
365
- previousDeposit: bigint
366
- serializedTransaction: Hex
367
- }
368
-
369
- /** Result returned after a legacy top-up transaction is broadcast and verified. */
370
- export type BroadcastTopUpTransactionResult = {
371
- newDeposit: bigint
372
- txHash: Hex
373
- }
374
-
375
- type TempoCall = NonNullable<ReturnType<(typeof Transaction)['deserialize']>['calls']>[number]
376
-
377
- function assertCallHasTargetAndData(call: TempoCall): { to: Address; data: Hex } {
378
- if (!call.to || !call.data) {
379
- throw new BadRequestError({
380
- reason: 'fee-sponsored transactions must not contain calls without target or data',
381
- })
382
- }
383
- return { to: call.to, data: call.data }
384
- }
385
-
386
- function validateSponsoredApproveCall(parameters: SponsoredApproveCallParameters) {
387
- const { action, call, currency, escrowContract, expectedAmount } = parameters
388
- const { to, data } = assertCallHasTargetAndData(call)
389
-
390
- if (!TempoAddress.isEqual(to, currency) || data.slice(0, 10) !== erc20ApproveSelector) {
391
- throw new BadRequestError({
392
- reason: `fee-sponsored ${action} transaction contains an unauthorized call`,
393
- })
394
- }
395
-
396
- const { args } = decodeFunctionData({ abi: erc20Abi, data })
397
- const [spender, amount] = args as readonly [Address, bigint]
398
-
399
- if (!TempoAddress.isEqual(spender, escrowContract)) {
400
- throw new BadRequestError({
401
- reason: `fee-sponsored ${action} transaction approve spender does not match escrow contract`,
402
- })
403
- }
404
-
405
- if (amount !== expectedAmount) {
406
- throw new BadRequestError({
407
- reason: `fee-sponsored ${action} transaction approve amount does not match requested amount`,
408
- })
409
- }
410
- }
411
-
412
- function validateSponsoredOpenCalls(parameters: SponsoredOpenCallsParameters) {
413
- const { calls, currency, escrowContract, deposit } = parameters
414
-
415
- let openCall: TempoCall | undefined
416
- let approveCall: TempoCall | undefined
417
-
418
- for (const call of calls) {
419
- const { to, data } = assertCallHasTargetAndData(call)
420
- const selector = data.slice(0, 10)
421
- const isOpen = TempoAddress.isEqual(to, escrowContract) && selector === escrowOpenSelector
422
- const isApprove = TempoAddress.isEqual(to, currency) && selector === erc20ApproveSelector
423
-
424
- if (isApprove) {
425
- if (approveCall || openCall) {
426
- throw new BadRequestError({
427
- reason: 'fee-sponsored open transaction contains a smuggled call',
428
- })
429
- }
430
- approveCall = call
431
- continue
432
- }
433
-
434
- if (isOpen) {
435
- if (openCall) {
436
- throw new BadRequestError({
437
- reason: 'fee-sponsored open transaction contains a smuggled call',
438
- })
439
- }
440
- openCall = call
441
- continue
442
- }
443
-
444
- throw new BadRequestError({
445
- reason: 'fee-sponsored open transaction contains an unauthorized call',
446
- })
447
- }
448
-
449
- if (approveCall) {
450
- validateSponsoredApproveCall({
451
- action: 'open',
452
- call: approveCall,
453
- currency,
454
- escrowContract,
455
- expectedAmount: deposit,
456
- })
457
- }
458
-
459
- return openCall
460
- }
461
-
462
- function validateSponsoredTopUpCalls(parameters: SponsoredTopUpCallsParameters) {
463
- const { calls, currency, escrowContract, topUpAmount } = parameters
464
-
465
- let topUpCall: TempoCall | undefined
466
- let approveCall: TempoCall | undefined
467
-
468
- for (const call of calls) {
469
- const { to, data } = assertCallHasTargetAndData(call)
470
- const selector = data.slice(0, 10)
471
- const isTopUp = TempoAddress.isEqual(to, escrowContract) && selector === escrowTopUpSelector
472
- const isApprove = TempoAddress.isEqual(to, currency) && selector === erc20ApproveSelector
473
-
474
- if (isApprove) {
475
- if (approveCall || topUpCall) {
476
- throw new BadRequestError({
477
- reason: 'fee-sponsored topUp transaction contains a smuggled call',
478
- })
479
- }
480
- approveCall = call
481
- continue
482
- }
483
-
484
- if (isTopUp) {
485
- if (topUpCall) {
486
- throw new BadRequestError({
487
- reason: 'fee-sponsored topUp transaction contains a smuggled call',
488
- })
489
- }
490
- topUpCall = call
491
- continue
492
- }
493
-
494
- throw new BadRequestError({
495
- reason: 'fee-sponsored topUp transaction contains an unauthorized call',
496
- })
497
- }
498
-
499
- if (approveCall) {
500
- validateSponsoredApproveCall({
501
- action: 'topUp',
502
- call: approveCall,
503
- currency,
504
- escrowContract,
505
- expectedAmount: topUpAmount,
506
- })
507
- }
508
-
509
- return topUpCall
510
- }
511
-
512
- export async function broadcastOpenTransaction(
513
- parameters: BroadcastOpenTransactionParameters,
514
- ): Promise<BroadcastResult> {
515
- const {
516
- client,
517
- serializedTransaction,
518
- escrowContract,
519
- channelId,
520
- recipient,
521
- currency,
522
- challengeExpires,
523
- feePayerPolicy,
524
- feePayer,
525
- isSponsored = Boolean(feePayer),
526
- beforeBroadcast,
527
- waitForConfirmation = true,
528
- } = parameters
529
-
530
- if (isSponsored && !FeePayer.isTempoTransaction(serializedTransaction))
531
- throw new BadRequestError({
532
- reason: 'Only Tempo (0x76/0x78) transactions are supported',
533
- })
534
-
535
- const transaction = Transaction.deserialize(
536
- serializedTransaction as Transaction.TransactionSerializedTempo,
537
- )
538
-
539
- if (isSponsored) assertSenderSigned(transaction)
540
-
541
- const calls = transaction.calls ?? []
542
-
543
- const sponsoredOpenCall = isSponsored
544
- ? validateSponsoredOpenCalls({
545
- calls,
546
- currency,
547
- escrowContract,
548
- deposit: (() => {
549
- const candidate = calls.find((call) => {
550
- if (!call.to || !TempoAddress.isEqual(call.to, escrowContract)) return false
551
- if (!call.data) return false
552
- return call.data.slice(0, 10) === escrowOpenSelector
553
- })
554
- if (!candidate?.data)
555
- throw new BadRequestError({
556
- reason: 'transaction does not contain a valid escrow open call',
557
- })
558
- const { args } = decodeFunctionData({ abi: escrowAbi, data: candidate.data })
559
- return (args as readonly [Address, Address, bigint, Hex, Address])[2]
560
- })(),
561
- })
562
- : undefined
563
-
564
- const openCall =
565
- sponsoredOpenCall ??
566
- calls.find((call) => {
567
- if (!call.to || !TempoAddress.isEqual(call.to, escrowContract)) return false
568
- if (!call.data) return false
569
- return call.data.slice(0, 10) === escrowOpenSelector
570
- })
571
-
572
- if (!openCall)
573
- throw new BadRequestError({
574
- reason: 'transaction does not contain a valid escrow open call',
575
- })
576
-
577
- const { args: openArgs } = decodeFunctionData({ abi: escrowAbi, data: openCall.data! })
578
- const [payee, token, deposit, salt, authorizedSigner] = openArgs as readonly [
579
- Address,
580
- Address,
581
- bigint,
582
- Hex,
583
- Address,
584
- ]
585
-
586
- if (!TempoAddress.isEqual(payee, recipient)) {
587
- throw new VerificationFailedError({
588
- reason: 'open transaction payee does not match server recipient',
589
- })
590
- }
591
- if (!TempoAddress.isEqual(token, currency)) {
592
- throw new VerificationFailedError({
593
- reason: 'open transaction token does not match server currency',
594
- })
595
- }
596
-
597
- if (!transaction.from) throw new BadRequestError({ reason: 'open transaction has no sender' })
598
-
599
- const derivedChannelId = Channel.computeId({
600
- payer: transaction.from as `0x${string}`,
601
- payee,
602
- token,
603
- salt,
604
- authorizedSigner,
605
- escrowContract,
606
- chainId: client.chain!.id,
607
- })
608
- if (derivedChannelId.toLowerCase() !== channelId.toLowerCase())
609
- throw new VerificationFailedError({
610
- reason: 'open transaction does not match claimed channelId',
611
- })
612
-
613
- const defaultFeeToken = defaults.currency[client.chain?.id as keyof typeof defaults.currency]
614
- const resolvedFeeToken = transaction.feeToken ?? defaultFeeToken
615
-
616
- const pendingOnChain = {
617
- finalized: false,
618
- closeRequestedAt: 0n,
619
- payer: transaction.from,
620
- payee,
621
- token,
622
- authorizedSigner,
623
- deposit,
624
- settled: 0n,
625
- } as OnChainChannel
626
-
627
- await beforeBroadcast?.(pendingOnChain)
628
-
629
- const completeTransaction = async () => {
630
- if (feePayer) {
631
- if (!sponsoredOpenCall)
632
- throw new BadRequestError({
633
- reason: 'transaction does not contain a valid escrow open call',
634
- })
635
-
636
- const completed = await FeePayer.preflightSponsorship({
637
- transaction,
638
- simulate: (request) => call(client, request as never),
639
- async complete() {
640
- const sponsored = FeePayer.prepareSponsoredTransaction({
641
- account: feePayer,
642
- allowedFeeTokens: defaultFeeToken ? [defaultFeeToken] : undefined,
643
- challengeExpires,
644
- chainId: client.chain!.id,
645
- details: { channelId, currency, recipient },
646
- policy: feePayerPolicy,
647
- transaction: {
648
- ...transaction,
649
- ...(resolvedFeeToken ? { feeToken: resolvedFeeToken } : {}),
650
- },
651
- })
652
- return { feePayer: feePayer.address, transaction: sponsored }
653
- },
654
- })
655
- return signTransaction(client, completed.transaction as never)
656
- }
657
- return serializedTransaction
658
- }
659
-
660
- if (!waitForConfirmation) {
661
- const serializedTransaction_final = await completeTransaction()
662
- // Local sponsorship already ran sender-context preflight above. Every
663
- // other optimistic path must still simulate before returning calldata as
664
- // pending on-chain state, including hosted sponsorship (`isSponsored`).
665
- if (!feePayer)
666
- await call(
667
- client,
668
- FeePayer.simulationTransaction(transaction, { feePayer: isSponsored }) as never,
669
- )
670
- const txHash = await sendRawTransaction(client, {
671
- serializedTransaction: serializedTransaction_final as Transaction.TransactionSerializedTempo,
672
- })
673
-
674
- return {
675
- txHash,
676
- onChain: pendingOnChain,
677
- }
678
- }
679
-
680
- let txHash: Hex | undefined
681
- try {
682
- // Keep local preflight inside recovery: a retry can legitimately revert
683
- // during simulation after the original open was mined.
684
- const serializedTransaction_final = await completeTransaction()
685
- const receipt = await sendRawTransactionSync(client, {
686
- serializedTransaction: serializedTransaction_final as Transaction.TransactionSerializedTempo,
687
- })
688
-
689
- if (receipt.status !== 'success') {
690
- throw new VerificationFailedError({
691
- reason: `open transaction reverted: ${receipt.transactionHash}`,
692
- })
693
- }
694
-
695
- txHash = receipt.transactionHash
696
- } catch (error) {
697
- const onChain = await getOnChainChannel(client, escrowContract, channelId)
698
- if (onChain.deposit > 0n) {
699
- return { txHash: undefined, onChain }
700
- }
701
- throw error
702
- }
703
-
704
- const onChain = await getOnChainChannel(client, escrowContract, channelId)
705
-
706
- return { txHash, onChain }
707
- }
708
-
709
- export async function broadcastTopUpTransaction(
710
- parameters: BroadcastTopUpTransactionParameters,
711
- ): Promise<BroadcastTopUpTransactionResult> {
712
- const {
713
- client,
714
- serializedTransaction,
715
- escrowContract,
716
- channelId,
717
- currency,
718
- declaredDeposit,
719
- previousDeposit,
720
- challengeExpires,
721
- feePayerPolicy,
722
- feePayer,
723
- isSponsored = Boolean(feePayer),
724
- } = parameters
725
-
726
- if (isSponsored && !FeePayer.isTempoTransaction(serializedTransaction))
727
- throw new BadRequestError({
728
- reason: 'Only Tempo (0x76/0x78) transactions are supported',
729
- })
730
-
731
- const transaction = Transaction.deserialize(
732
- serializedTransaction as Transaction.TransactionSerializedTempo,
733
- )
734
-
735
- if (isSponsored) assertSenderSigned(transaction)
736
-
737
- const calls = transaction.calls ?? []
738
-
739
- const sponsoredTopUpCall = isSponsored
740
- ? validateSponsoredTopUpCalls({
741
- calls,
742
- currency,
743
- escrowContract,
744
- topUpAmount: declaredDeposit,
745
- })
746
- : undefined
747
-
748
- const topUpCall =
749
- sponsoredTopUpCall ??
750
- calls.find((call) => {
751
- if (!call.to || !TempoAddress.isEqual(call.to, escrowContract)) return false
752
- if (!call.data) return false
753
- return call.data.slice(0, 10) === escrowTopUpSelector
754
- })
755
-
756
- if (!topUpCall)
757
- throw new BadRequestError({
758
- reason: 'transaction does not contain a valid escrow topUp call',
759
- })
760
-
761
- const { args: topUpArgs } = decodeFunctionData({ abi: escrowAbi, data: topUpCall.data! })
762
- const [txChannelId, txAmount] = topUpArgs as [Hex, bigint]
763
-
764
- if (txChannelId.toLowerCase() !== channelId.toLowerCase()) {
765
- throw new VerificationFailedError({
766
- reason: 'topUp transaction channelId does not match payload channelId',
767
- })
768
- }
769
- if (BigInt(txAmount) !== declaredDeposit) {
770
- throw new VerificationFailedError({
771
- reason: `topUp transaction amount (${txAmount}) does not match declared additionalDeposit (${declaredDeposit})`,
772
- })
773
- }
774
-
775
- const serializedTransaction_final = await (async () => {
776
- if (feePayer) {
777
- if (!sponsoredTopUpCall)
778
- throw new BadRequestError({
779
- reason: 'transaction does not contain a valid escrow topUp call',
780
- })
781
-
782
- const defaultFeeToken = defaults.currency[client.chain?.id as keyof typeof defaults.currency]
783
- const completed = await FeePayer.preflightSponsorship({
784
- transaction,
785
- simulate: (request) => call(client, request as never),
786
- async complete() {
787
- const sponsored = FeePayer.prepareSponsoredTransaction({
788
- account: feePayer,
789
- allowedFeeTokens: defaultFeeToken ? [defaultFeeToken] : undefined,
790
- challengeExpires,
791
- chainId: client.chain!.id,
792
- details: {
793
- additionalDeposit: declaredDeposit.toString(),
794
- channelId,
795
- currency,
796
- },
797
- policy: feePayerPolicy,
798
- transaction: {
799
- ...transaction,
800
- ...((transaction.feeToken ?? defaultFeeToken)
801
- ? { feeToken: transaction.feeToken ?? defaultFeeToken }
802
- : {}),
803
- },
804
- })
805
- return { feePayer: feePayer.address, transaction: sponsored }
806
- },
807
- })
808
- return signTransaction(client, completed.transaction as never)
809
- }
810
- return serializedTransaction
811
- })()
812
-
813
- const receipt = await sendRawTransactionSync(client, {
814
- serializedTransaction: serializedTransaction_final as Transaction.TransactionSerializedTempo,
815
- })
816
-
817
- if (receipt.status !== 'success') {
818
- throw new VerificationFailedError({
819
- reason: `topUp transaction reverted: ${receipt.transactionHash}`,
820
- })
821
- }
822
-
823
- const onChain = await getOnChainChannel(client, escrowContract, channelId)
824
-
825
- if (onChain.deposit <= previousDeposit) {
826
- throw new VerificationFailedError({ reason: 'channel deposit did not increase after topUp' })
827
- }
828
-
829
- return { txHash: receipt.transactionHash, newDeposit: onChain.deposit }
830
- }