moltspay 0.9.5 → 0.9.7

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 (51) hide show
  1. package/README.md +68 -45
  2. package/dist/cdp/index.d.mts +1 -1
  3. package/dist/cdp/index.d.ts +1 -1
  4. package/dist/cdp/index.js +63 -0
  5. package/dist/cdp/index.js.map +1 -1
  6. package/dist/cdp/index.mjs +63 -0
  7. package/dist/cdp/index.mjs.map +1 -1
  8. package/dist/chains/index.d.mts +9 -5
  9. package/dist/chains/index.d.ts +9 -5
  10. package/dist/chains/index.js +85 -0
  11. package/dist/chains/index.js.map +1 -1
  12. package/dist/chains/index.mjs +83 -0
  13. package/dist/chains/index.mjs.map +1 -1
  14. package/dist/cli/index.js +201 -38
  15. package/dist/cli/index.js.map +1 -1
  16. package/dist/cli/index.mjs +201 -38
  17. package/dist/cli/index.mjs.map +1 -1
  18. package/dist/client/index.d.mts +18 -3
  19. package/dist/client/index.d.ts +18 -3
  20. package/dist/client/index.js +112 -15
  21. package/dist/client/index.js.map +1 -1
  22. package/dist/client/index.mjs +112 -15
  23. package/dist/client/index.mjs.map +1 -1
  24. package/dist/{index-Dg8n6wdW.d.mts → index-B3v8IWjM.d.mts} +11 -1
  25. package/dist/{index-Dg8n6wdW.d.ts → index-B3v8IWjM.d.ts} +11 -1
  26. package/dist/index.d.mts +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +203 -42
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +203 -42
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/server/index.d.mts +19 -1
  33. package/dist/server/index.d.ts +19 -1
  34. package/dist/server/index.js +71 -19
  35. package/dist/server/index.js.map +1 -1
  36. package/dist/server/index.mjs +71 -19
  37. package/dist/server/index.mjs.map +1 -1
  38. package/dist/verify/index.d.mts +7 -0
  39. package/dist/verify/index.d.ts +7 -0
  40. package/dist/verify/index.js +83 -8
  41. package/dist/verify/index.js.map +1 -1
  42. package/dist/verify/index.mjs +83 -8
  43. package/dist/verify/index.mjs.map +1 -1
  44. package/dist/wallet/index.d.mts +16 -8
  45. package/dist/wallet/index.d.ts +16 -8
  46. package/dist/wallet/index.js +114 -18
  47. package/dist/wallet/index.js.map +1 -1
  48. package/dist/wallet/index.mjs +114 -18
  49. package/dist/wallet/index.mjs.map +1 -1
  50. package/package.json +1 -1
  51. package/schemas/moltspay.services.schema.json +13 -3
package/README.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # MoltsPay
2
2
 
3
- Blockchain payment infrastructure for AI Agents. Turn any skill into a paid service with one JSON file.
3
+ [![npm version](https://img.shields.io/npm/v/moltspay.svg)](https://www.npmjs.com/package/moltspay)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
6
+
7
+ **Blockchain payment infrastructure for AI Agents.** Turn any skill into a paid service with one JSON file.
8
+
9
+ MoltsPay enables agent-to-agent commerce using the [x402 protocol](https://www.x402.org/) - HTTP-native payments where AI agents can pay each other for services without human intervention. Built on USDC stablecoins with gasless transactions powered by Coinbase CDP.
10
+
11
+ ## Why MoltsPay?
12
+
13
+ | Problem | MoltsPay Solution |
14
+ |---------|-------------------|
15
+ | AI agents can't pay for services | x402 protocol - HTTP 402 Payment Required flow |
16
+ | Blockchain payments need gas | Gasless - CDP facilitator handles all gas fees |
17
+ | Complex wallet integration | One JSON file - add `moltspay.services.json` to any skill |
18
+ | Payment verification is hard | Automatic on-chain verification included |
4
19
 
5
20
  ## Features
6
21
 
@@ -8,7 +23,7 @@ Blockchain payment infrastructure for AI Agents. Turn any skill into a paid serv
8
23
  - 🎫 **x402 Protocol** - HTTP-native payments (402 Payment Required)
9
24
  - 💨 **Gasless** - Both client and server pay no gas (CDP facilitator handles it)
10
25
  - ✅ **Payment Verification** - Automatic on-chain verification
11
- - 🔒 **Secure Wallet** - Limits, whitelist, and audit logging
26
+ - 🔒 **Secure Wallet** - Spending limits, whitelist, and audit logging
12
27
  - ⛓️ **Multi-chain** - Base, Polygon, Ethereum (mainnet & testnet)
13
28
  - 🤖 **Agent-to-Agent** - Complete A2A payment flow support
14
29
 
@@ -63,13 +78,39 @@ npx moltspay init --chain base
63
78
  ```
64
79
 
65
80
  **2. Fund your wallet:**
66
- Ask your owner to send USDC to your wallet address. No ETH needed!
81
+ Send USDC to your wallet address. No ETH needed!
67
82
 
68
83
  **3. Use paid services:**
69
84
  ```bash
70
85
  npx moltspay pay https://server.com text-to-video --prompt "a cat dancing"
71
86
  ```
72
87
 
88
+ ## How x402 Protocol Works
89
+
90
+ ```
91
+ Client Server CDP Facilitator
92
+ │ │ │
93
+ │ POST /execute │ │
94
+ │ ─────────────────────────> │ │
95
+ │ │ │
96
+ │ 402 + payment requirements │ │
97
+ │ <───────────────────────── │ │
98
+ │ │ │
99
+ │ [Sign EIP-3009 - NO GAS] │ │
100
+ │ │ │
101
+ │ POST + X-Payment header │ │
102
+ │ ─────────────────────────> │ Verify signature │
103
+ │ │ ─────────────────────────> │
104
+ │ │ │
105
+ │ │ Execute transfer (pays gas) │
106
+ │ │ <───────────────────────── │
107
+ │ │ │
108
+ │ 200 OK + result │ │
109
+ │ <───────────────────────── │ │
110
+ ```
111
+
112
+ **Key insight:** Client signs a payment authorization, server submits it. Neither party pays gas - the CDP facilitator handles settlement.
113
+
73
114
  ## Skill Structure
74
115
 
75
116
  MoltsPay reads your skill's existing structure:
@@ -81,10 +122,6 @@ my-skill/
81
122
  └── moltspay.services.json # Only file you add!
82
123
  ```
83
124
 
84
- **Entry point discovery:**
85
- 1. If `package.json` exists → uses `main` field
86
- 2. Otherwise → defaults to `index.js`
87
-
88
125
  **Your functions stay untouched.** Just add the JSON config.
89
126
 
90
127
  ## Services Manifest Schema
@@ -119,8 +156,6 @@ my-skill/
119
156
 
120
157
  ```bash
121
158
  npx moltspay validate ./my-skill
122
- # or
123
- npx moltspay validate ./moltspay.services.json
124
159
  ```
125
160
 
126
161
  ## Server Setup (Mainnet)
@@ -141,33 +176,6 @@ npx moltspay start ./my-skill --port 3000
141
176
 
142
177
  Server does NOT need a private key - the x402 facilitator handles settlement.
143
178
 
144
- ## How x402 Works
145
-
146
- ```
147
- Client Server CDP Facilitator
148
- │ │ │
149
- │ POST /execute │ │
150
- │ ─────────────────────────> │ │
151
- │ │ │
152
- │ 402 + payment requirements │ │
153
- │ <───────────────────────── │ │
154
- │ │ │
155
- │ [Sign EIP-3009 - NO GAS] │ │
156
- │ │ │
157
- │ POST + X-Payment header │ │
158
- │ ─────────────────────────> │ Verify signature │
159
- │ │ ─────────────────────────> │
160
- │ │ │
161
- │ │ Execute transfer (pays gas) │
162
- │ │ <───────────────────────── │
163
- │ │ │
164
- │ 200 OK + result │ │
165
- │ <───────────────────────── │ │
166
- ```
167
-
168
- **Client needs:** USDC balance only (no ETH/gas)
169
- **Server needs:** CDP credentials only (no private key)
170
-
171
179
  ## CLI Reference
172
180
 
173
181
  ```bash
@@ -227,30 +235,45 @@ server.listen(3000);
227
235
 
228
236
  | Chain | ID | Type |
229
237
  |-------|-----|------|
230
- | base | 8453 | Mainnet |
231
- | polygon | 137 | Mainnet |
232
- | ethereum | 1 | Mainnet |
233
- | base_sepolia | 84532 | Testnet |
238
+ | Base | 8453 | Mainnet |
239
+ | Polygon | 137 | Mainnet |
240
+ | Ethereum | 1 | Mainnet |
241
+ | Base Sepolia | 84532 | Testnet |
234
242
 
235
- ## Example: Zen7 Video Generation
243
+ ## Live Example: Zen7 Video Generation
236
244
 
237
245
  Live service at `https://juai8.com/zen7/`
238
246
 
239
247
  **Services:**
240
- - `text-to-video` - $0.99 USDC
241
- - `image-to-video` - $1.49 USDC
248
+ - `text-to-video` - $0.99 USDC - Generate video from text prompt
249
+ - `image-to-video` - $1.49 USDC - Animate a static image
242
250
 
243
- **Test it:**
251
+ **Try it:**
244
252
  ```bash
245
253
  npx moltspay services https://juai8.com/zen7
246
254
  npx moltspay pay https://juai8.com/zen7 text-to-video --prompt "a happy cat"
247
255
  ```
248
256
 
257
+ ## Use Cases
258
+
259
+ - **AI Video Generation** - Pay per video generated
260
+ - **Image Processing** - Pay for AI image editing/enhancement
261
+ - **Data APIs** - Monetize proprietary datasets
262
+ - **Compute Services** - Sell GPU time to other agents
263
+ - **Content Generation** - AI writing, music, code generation
264
+
265
+ ## Related Projects
266
+
267
+ - [moltspay-python](https://github.com/Yaqing2023/moltspay-python) - Python SDK with LangChain integration
268
+ - [x402 Protocol](https://www.x402.org/) - The HTTP payment standard
269
+
249
270
  ## Links
250
271
 
272
+ - **Website:** https://moltspay.com
251
273
  - **npm:** https://www.npmjs.com/package/moltspay
252
- - **GitHub:** https://github.com/Yaqing2023/moltspay
274
+ - **PyPI:** https://pypi.org/project/moltspay/
253
275
  - **x402 Protocol:** https://www.x402.org/
276
+ - **Coinbase CDP:** https://portal.cdp.coinbase.com/
254
277
 
255
278
  ## License
256
279
 
@@ -1,4 +1,4 @@
1
- import { C as ChainName } from '../index-Dg8n6wdW.mjs';
1
+ import { C as ChainName } from '../index-B3v8IWjM.mjs';
2
2
  import { getChain } from '../chains/index.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { C as ChainName } from '../index-Dg8n6wdW.js';
1
+ import { C as ChainName } from '../index-B3v8IWjM.js';
2
2
  import { getChain } from '../chains/index.js';
3
3
 
4
4
  /**
package/dist/cdp/index.js CHANGED
@@ -30361,7 +30361,20 @@ var CHAINS = {
30361
30361
  name: "Base",
30362
30362
  chainId: 8453,
30363
30363
  rpc: "https://mainnet.base.org",
30364
+ tokens: {
30365
+ USDC: {
30366
+ address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
30367
+ decimals: 6,
30368
+ symbol: "USDC"
30369
+ },
30370
+ USDT: {
30371
+ address: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
30372
+ decimals: 6,
30373
+ symbol: "USDT"
30374
+ }
30375
+ },
30364
30376
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
30377
+ // deprecated, for backward compat
30365
30378
  explorer: "https://basescan.org/address/",
30366
30379
  explorerTx: "https://basescan.org/tx/",
30367
30380
  avgBlockTime: 2
@@ -30370,6 +30383,18 @@ var CHAINS = {
30370
30383
  name: "Polygon",
30371
30384
  chainId: 137,
30372
30385
  rpc: "https://polygon-rpc.com",
30386
+ tokens: {
30387
+ USDC: {
30388
+ address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
30389
+ decimals: 6,
30390
+ symbol: "USDC"
30391
+ },
30392
+ USDT: {
30393
+ address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
30394
+ decimals: 6,
30395
+ symbol: "USDT"
30396
+ }
30397
+ },
30373
30398
  usdc: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
30374
30399
  explorer: "https://polygonscan.com/address/",
30375
30400
  explorerTx: "https://polygonscan.com/tx/",
@@ -30379,6 +30404,18 @@ var CHAINS = {
30379
30404
  name: "Ethereum",
30380
30405
  chainId: 1,
30381
30406
  rpc: "https://eth.llamarpc.com",
30407
+ tokens: {
30408
+ USDC: {
30409
+ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
30410
+ decimals: 6,
30411
+ symbol: "USDC"
30412
+ },
30413
+ USDT: {
30414
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
30415
+ decimals: 6,
30416
+ symbol: "USDT"
30417
+ }
30418
+ },
30382
30419
  usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
30383
30420
  explorer: "https://etherscan.io/address/",
30384
30421
  explorerTx: "https://etherscan.io/tx/",
@@ -30389,6 +30426,19 @@ var CHAINS = {
30389
30426
  name: "Base Sepolia",
30390
30427
  chainId: 84532,
30391
30428
  rpc: "https://sepolia.base.org",
30429
+ tokens: {
30430
+ USDC: {
30431
+ address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
30432
+ decimals: 6,
30433
+ symbol: "USDC"
30434
+ },
30435
+ USDT: {
30436
+ address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
30437
+ // Same as USDC on testnet (no official USDT)
30438
+ decimals: 6,
30439
+ symbol: "USDT"
30440
+ }
30441
+ },
30392
30442
  usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
30393
30443
  explorer: "https://sepolia.basescan.org/address/",
30394
30444
  explorerTx: "https://sepolia.basescan.org/tx/",
@@ -30398,6 +30448,19 @@ var CHAINS = {
30398
30448
  name: "Sepolia",
30399
30449
  chainId: 11155111,
30400
30450
  rpc: "https://rpc.sepolia.org",
30451
+ tokens: {
30452
+ USDC: {
30453
+ address: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
30454
+ decimals: 6,
30455
+ symbol: "USDC"
30456
+ },
30457
+ USDT: {
30458
+ address: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
30459
+ // Same as USDC on testnet
30460
+ decimals: 6,
30461
+ symbol: "USDT"
30462
+ }
30463
+ },
30401
30464
  usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
30402
30465
  explorer: "https://sepolia.etherscan.io/address/",
30403
30466
  explorerTx: "https://sepolia.etherscan.io/tx/",