moltspay 1.2.1 → 1.4.0

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 (59) hide show
  1. package/README.md +292 -34
  2. package/dist/cdp/index.d.mts +4 -4
  3. package/dist/cdp/index.d.ts +4 -4
  4. package/dist/cdp/index.js +110 -30368
  5. package/dist/cdp/index.js.map +1 -1
  6. package/dist/cdp/index.mjs +94 -30360
  7. package/dist/cdp/index.mjs.map +1 -1
  8. package/dist/cdp-DeohBe1o.d.ts +66 -0
  9. package/dist/cdp-p_eHuQpb.d.mts +66 -0
  10. package/dist/chains/index.d.mts +9 -8
  11. package/dist/chains/index.d.ts +9 -8
  12. package/dist/chains/index.js +86 -0
  13. package/dist/chains/index.js.map +1 -1
  14. package/dist/chains/index.mjs +86 -0
  15. package/dist/chains/index.mjs.map +1 -1
  16. package/dist/cli/index.js +2746 -290
  17. package/dist/cli/index.js.map +1 -1
  18. package/dist/cli/index.mjs +2752 -282
  19. package/dist/cli/index.mjs.map +1 -1
  20. package/dist/client/index.d.mts +60 -4
  21. package/dist/client/index.d.ts +60 -4
  22. package/dist/client/index.js +734 -43
  23. package/dist/client/index.js.map +1 -1
  24. package/dist/client/index.mjs +732 -41
  25. package/dist/client/index.mjs.map +1 -1
  26. package/dist/facilitators/index.d.mts +220 -39
  27. package/dist/facilitators/index.d.ts +220 -39
  28. package/dist/facilitators/index.js +897 -1
  29. package/dist/facilitators/index.js.map +1 -1
  30. package/dist/facilitators/index.mjs +902 -1
  31. package/dist/facilitators/index.mjs.map +1 -1
  32. package/dist/{index-DgJPZMBG.d.mts → index-D_2FkLwV.d.mts} +6 -2
  33. package/dist/{index-DgJPZMBG.d.ts → index-D_2FkLwV.d.ts} +6 -2
  34. package/dist/index.d.mts +3 -2
  35. package/dist/index.d.ts +3 -2
  36. package/dist/index.js +2238 -30837
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +2167 -30766
  39. package/dist/index.mjs.map +1 -1
  40. package/dist/server/index.d.mts +30 -3
  41. package/dist/server/index.d.ts +30 -3
  42. package/dist/server/index.js +1345 -54
  43. package/dist/server/index.js.map +1 -1
  44. package/dist/server/index.mjs +1355 -54
  45. package/dist/server/index.mjs.map +1 -1
  46. package/dist/verify/index.d.mts +1 -1
  47. package/dist/verify/index.d.ts +1 -1
  48. package/dist/verify/index.js +86 -0
  49. package/dist/verify/index.js.map +1 -1
  50. package/dist/verify/index.mjs +86 -0
  51. package/dist/verify/index.mjs.map +1 -1
  52. package/dist/wallet/index.d.mts +3 -3
  53. package/dist/wallet/index.d.ts +3 -3
  54. package/dist/wallet/index.js +86 -0
  55. package/dist/wallet/index.js.map +1 -1
  56. package/dist/wallet/index.mjs +86 -0
  57. package/dist/wallet/index.mjs.map +1 -1
  58. package/package.json +8 -2
  59. package/schemas/moltspay.services.schema.json +27 -132
@@ -42,6 +42,7 @@ interface ProviderConfig {
42
42
  name: string;
43
43
  description?: string;
44
44
  wallet: string;
45
+ solana_wallet?: string;
45
46
  chain?: string;
46
47
  chains?: ChainConfig[];
47
48
  }
@@ -163,6 +164,23 @@ declare class MoltsPayServer {
163
164
  * POST /execute - Execute service with x402 payment
164
165
  */
165
166
  private handleExecute;
167
+ /**
168
+ * Handle MPP (Machine Payments Protocol) request
169
+ * Supports both x402 and MPP protocols on service endpoints
170
+ */
171
+ private handleMPPRequest;
172
+ /**
173
+ * Handle MPP payment verification and service execution
174
+ */
175
+ private handleMPPPayment;
176
+ /**
177
+ * Return 402 with both x402 and MPP payment requirements
178
+ */
179
+ private sendMPPPaymentRequired;
180
+ /**
181
+ * Generate a unique challenge ID for MPP
182
+ */
183
+ private generateChallengeId;
166
184
  /**
167
185
  * Return 402 with x402 payment requirements (v2 format)
168
186
  * Includes requirements for all chains and all accepted currencies
@@ -195,16 +213,25 @@ declare class MoltsPayServer {
195
213
  /**
196
214
  * POST /proxy - Handle payment for external services (moltspay-creators)
197
215
  *
198
- * This endpoint allows other services to delegate x402 payment handling.
216
+ * This endpoint allows other services to delegate x402/MPP payment handling.
199
217
  * It does NOT execute any skill - just handles payment verification/settlement.
200
218
  *
201
219
  * Request body:
202
220
  * { wallet, amount, currency, chain, memo, serviceId, description }
203
221
  *
204
- * Without X-Payment header: returns 402 with payment requirements
205
- * With X-Payment header: verifies payment and returns result
222
+ * For x402 (base, polygon, base_sepolia):
223
+ * Without X-Payment header: returns 402 with X-Payment-Required
224
+ * With X-Payment header: verifies payment via CDP
225
+ *
226
+ * For MPP (tempo_moderato):
227
+ * Without Authorization header: returns 402 with WWW-Authenticate
228
+ * With Authorization: Payment header: verifies tx on Tempo chain
206
229
  */
207
230
  private handleProxy;
231
+ /**
232
+ * Handle MPP payment flow for /proxy endpoint (tempo_moderato chain)
233
+ */
234
+ private handleProxyMPP;
208
235
  /**
209
236
  * Build payment requirements for proxy endpoint (uses provided wallet)
210
237
  */
@@ -42,6 +42,7 @@ interface ProviderConfig {
42
42
  name: string;
43
43
  description?: string;
44
44
  wallet: string;
45
+ solana_wallet?: string;
45
46
  chain?: string;
46
47
  chains?: ChainConfig[];
47
48
  }
@@ -163,6 +164,23 @@ declare class MoltsPayServer {
163
164
  * POST /execute - Execute service with x402 payment
164
165
  */
165
166
  private handleExecute;
167
+ /**
168
+ * Handle MPP (Machine Payments Protocol) request
169
+ * Supports both x402 and MPP protocols on service endpoints
170
+ */
171
+ private handleMPPRequest;
172
+ /**
173
+ * Handle MPP payment verification and service execution
174
+ */
175
+ private handleMPPPayment;
176
+ /**
177
+ * Return 402 with both x402 and MPP payment requirements
178
+ */
179
+ private sendMPPPaymentRequired;
180
+ /**
181
+ * Generate a unique challenge ID for MPP
182
+ */
183
+ private generateChallengeId;
166
184
  /**
167
185
  * Return 402 with x402 payment requirements (v2 format)
168
186
  * Includes requirements for all chains and all accepted currencies
@@ -195,16 +213,25 @@ declare class MoltsPayServer {
195
213
  /**
196
214
  * POST /proxy - Handle payment for external services (moltspay-creators)
197
215
  *
198
- * This endpoint allows other services to delegate x402 payment handling.
216
+ * This endpoint allows other services to delegate x402/MPP payment handling.
199
217
  * It does NOT execute any skill - just handles payment verification/settlement.
200
218
  *
201
219
  * Request body:
202
220
  * { wallet, amount, currency, chain, memo, serviceId, description }
203
221
  *
204
- * Without X-Payment header: returns 402 with payment requirements
205
- * With X-Payment header: verifies payment and returns result
222
+ * For x402 (base, polygon, base_sepolia):
223
+ * Without X-Payment header: returns 402 with X-Payment-Required
224
+ * With X-Payment header: verifies payment via CDP
225
+ *
226
+ * For MPP (tempo_moderato):
227
+ * Without Authorization header: returns 402 with WWW-Authenticate
228
+ * With Authorization: Payment header: verifies tx on Tempo chain
206
229
  */
207
230
  private handleProxy;
231
+ /**
232
+ * Handle MPP payment flow for /proxy endpoint (tempo_moderato chain)
233
+ */
234
+ private handleProxyMPP;
208
235
  /**
209
236
  * Build payment requirements for proxy endpoint (uses provided wallet)
210
237
  */