moltspay 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +78 -9
  2. package/dist/cdp/index.d.mts +1 -1
  3. package/dist/cdp/index.d.ts +1 -1
  4. package/dist/cdp/index.js +16 -49
  5. package/dist/cdp/index.js.map +1 -1
  6. package/dist/cdp/index.mjs +16 -49
  7. package/dist/cdp/index.mjs.map +1 -1
  8. package/dist/chains/index.d.mts +1 -1
  9. package/dist/chains/index.d.ts +1 -1
  10. package/dist/chains/index.js +16 -49
  11. package/dist/chains/index.js.map +1 -1
  12. package/dist/chains/index.mjs +16 -49
  13. package/dist/chains/index.mjs.map +1 -1
  14. package/dist/cli/index.js +180 -111
  15. package/dist/cli/index.js.map +1 -1
  16. package/dist/cli/index.mjs +180 -111
  17. package/dist/cli/index.mjs.map +1 -1
  18. package/dist/client/index.d.mts +3 -3
  19. package/dist/client/index.d.ts +3 -3
  20. package/dist/client/index.js +32 -58
  21. package/dist/client/index.js.map +1 -1
  22. package/dist/client/index.mjs +32 -58
  23. package/dist/client/index.mjs.map +1 -1
  24. package/dist/facilitators/index.d.mts +12 -6
  25. package/dist/facilitators/index.d.ts +12 -6
  26. package/dist/facilitators/index.js +39 -33
  27. package/dist/facilitators/index.js.map +1 -1
  28. package/dist/facilitators/index.mjs +39 -33
  29. package/dist/facilitators/index.mjs.map +1 -1
  30. package/dist/{index-B3v8IWjM.d.mts → index-DgJPZMBG.d.mts} +2 -1
  31. package/dist/{index-B3v8IWjM.d.ts → index-DgJPZMBG.d.ts} +2 -1
  32. package/dist/index.d.mts +1 -1
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.js +102 -101
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +102 -101
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/server/index.js +70 -43
  39. package/dist/server/index.js.map +1 -1
  40. package/dist/server/index.mjs +70 -43
  41. package/dist/server/index.mjs.map +1 -1
  42. package/dist/verify/index.d.mts +1 -1
  43. package/dist/verify/index.d.ts +1 -1
  44. package/dist/verify/index.js +16 -49
  45. package/dist/verify/index.js.map +1 -1
  46. package/dist/verify/index.mjs +16 -49
  47. package/dist/verify/index.mjs.map +1 -1
  48. package/dist/wallet/index.d.mts +1 -1
  49. package/dist/wallet/index.d.ts +1 -1
  50. package/dist/wallet/index.js +16 -49
  51. package/dist/wallet/index.js.map +1 -1
  52. package/dist/wallet/index.mjs +16 -49
  53. package/dist/wallet/index.mjs.map +1 -1
  54. package/package.json +1 -1
package/README.md CHANGED
@@ -78,8 +78,14 @@ npx moltspay init --chain base
78
78
  # Output: Wallet address 0xABC123...
79
79
  ```
80
80
 
81
- **2. Fund your wallet:**
82
- Send USDC to your wallet address. No ETH needed!
81
+ **2. Fund your wallet (US users):**
82
+ ```bash
83
+ npx moltspay fund 50
84
+ # Opens Coinbase Pay - use debit card or Apple Pay
85
+ # USDC arrives in ~2 minutes. No ETH needed!
86
+ ```
87
+
88
+ Or send USDC directly to your wallet address from any exchange.
83
89
 
84
90
  **3. Use paid services:**
85
91
  ```bash
@@ -90,6 +96,22 @@ npx moltspay pay https://server.com text-to-video --prompt "a cat dancing"
90
96
  npx moltspay pay https://server.com text-to-video --chain polygon --prompt "a cat dancing"
91
97
  ```
92
98
 
99
+ ### Testnet Quick Start
100
+
101
+ Want to test before using real money? Use our testnet faucet:
102
+
103
+ ```bash
104
+ # 1. Create wallet (if you don't have one)
105
+ npx moltspay init
106
+
107
+ # 2. Get free testnet USDC (1 USDC per request, once per 24h)
108
+ npx moltspay faucet
109
+
110
+ # 3. Test payments on Base Sepolia
111
+ npx moltspay pay https://moltspay.com/a/yaqing text-to-video \
112
+ --chain base_sepolia --prompt "a robot dancing"
113
+ ```
114
+
93
115
  ## How x402 Protocol Works
94
116
 
95
117
  ```
@@ -183,38 +205,76 @@ If no `--chain` is specified, the client uses the first chain in the provider's
183
205
  npx moltspay validate ./my-skill
184
206
  ```
185
207
 
186
- ## Server Setup (Mainnet)
208
+ ## Server Setup
187
209
 
188
210
  **1. Get CDP credentials** from https://portal.cdp.coinbase.com/
189
211
 
190
212
  **2. Create `~/.moltspay/.env`:**
191
213
  ```env
192
- USE_MAINNET=true
193
214
  CDP_API_KEY_ID=your-key-id
194
215
  CDP_API_KEY_SECRET=your-secret
195
216
  ```
196
217
 
197
- **3. Start server:**
218
+ **3. Configure chains in your manifest:**
219
+ ```json
220
+ {
221
+ "provider": {
222
+ "wallet": "0x...",
223
+ "chains": [
224
+ { "chain": "base", "network": "eip155:8453", "tokens": ["USDC"] },
225
+ { "chain": "base_sepolia", "network": "eip155:84532", "tokens": ["USDC"] }
226
+ ]
227
+ }
228
+ }
229
+ ```
230
+
231
+ **4. Start server:**
198
232
  ```bash
199
233
  npx moltspay start ./my-skill --port 3000
200
234
  ```
201
235
 
202
236
  Server does NOT need a private key - the x402 facilitator handles settlement.
203
237
 
238
+ ### Chain Auto-Detection
239
+
240
+ The server automatically detects which chain to verify payments on based on the client's payment header:
241
+
242
+ - Client pays with `--chain base` → Server verifies on Base mainnet
243
+ - Client pays with `--chain base_sepolia` → Server verifies on Base Sepolia
244
+
245
+ **No `USE_MAINNET` env var needed!** Just configure your accepted chains in the manifest.
246
+
247
+ ### Testnet Setup (Providers)
248
+
249
+ To accept testnet payments, add `base_sepolia` to your chains array:
250
+
251
+ ```json
252
+ {
253
+ "provider": {
254
+ "wallet": "0x...",
255
+ "chains": ["base", "base_sepolia"]
256
+ }
257
+ }
258
+ ```
259
+
260
+ Clients can then pay using `--chain base_sepolia` and get free testnet USDC via `npx moltspay faucet`.
261
+
204
262
  ## CLI Reference
205
263
 
206
264
  ```bash
207
265
  # === Client Commands ===
208
266
  npx moltspay init # Create wallet
209
- npx moltspay init --chain polygon # Create wallet for Polygon
267
+ npx moltspay fund <amount> # Fund wallet via Coinbase (US)
268
+ npx moltspay faucet # Get free testnet USDC (Base Sepolia)
210
269
  npx moltspay status # Check balance
211
270
  npx moltspay config # Update limits
212
271
  npx moltspay services <url> # List provider's services
213
272
  npx moltspay pay <url> <service> # Pay and execute service
214
273
 
215
274
  # === Pay with Chain Selection ===
216
- npx moltspay pay <url> <service> --chain base # Pay on Base (default)
217
- npx moltspay pay <url> <service> --chain polygon # Pay on Polygon
275
+ npx moltspay pay <url> <service> --chain base # Pay on Base (default)
276
+ npx moltspay pay <url> <service> --chain polygon # Pay on Polygon
277
+ npx moltspay pay <url> <service> --chain base_sepolia # Pay on testnet
218
278
 
219
279
  # === Server Commands ===
220
280
  npx moltspay start <skill-dir> # Start server
@@ -223,7 +283,7 @@ npx moltspay validate <path> # Validate manifest
223
283
 
224
284
  # === Options ===
225
285
  --port <port> # Server port (default 3000)
226
- --chain <chain> # Chain: base, polygon (for pay/init)
286
+ --chain <chain> # Chain: base, polygon, base_sepolia
227
287
  --token <token> # Token: USDC, USDT
228
288
  --max-per-tx <amount> # Spending limit per transaction
229
289
  --max-per-day <amount> # Daily spending limit
@@ -306,9 +366,18 @@ npx moltspay pay https://juai8.com/zen7 text-to-video --chain polygon --prompt "
306
366
  - [moltspay-python](https://github.com/Yaqing2023/moltspay-python) - Python SDK with LangChain integration
307
367
  - [x402 Protocol](https://www.x402.org/) - The HTTP payment standard
308
368
 
369
+ ## Community & Support
370
+
371
+ Join our Discord for help, feedback, and updates:
372
+
373
+ 👉 **[MoltsPay Discord](https://discord.gg/QwCJgVBxVK)**
374
+
375
+ Or visit the [#moltspay-support](https://discord.com/channels/1472602423267819734/1480968496346304522) channel directly.
376
+
309
377
  ## Links
310
378
 
311
379
  - **Website:** https://moltspay.com
380
+ - **Discord:** https://discord.gg/QwCJgVBxVK
312
381
  - **npm:** https://www.npmjs.com/package/moltspay
313
382
  - **PyPI:** https://pypi.org/project/moltspay/
314
383
  - **x402 Protocol:** https://www.x402.org/
@@ -1,4 +1,4 @@
1
- import { C as ChainName } from '../index-B3v8IWjM.mjs';
1
+ import { C as ChainName } from '../index-DgJPZMBG.mjs';
2
2
  import { getChain } from '../chains/index.mjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { C as ChainName } from '../index-B3v8IWjM.js';
1
+ import { C as ChainName } from '../index-DgJPZMBG.js';
2
2
  import { getChain } from '../chains/index.js';
3
3
 
4
4
  /**
package/dist/cdp/index.js CHANGED
@@ -30365,12 +30365,15 @@ var CHAINS = {
30365
30365
  USDC: {
30366
30366
  address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
30367
30367
  decimals: 6,
30368
- symbol: "USDC"
30368
+ symbol: "USDC",
30369
+ eip712Name: "USD Coin"
30370
+ // EIP-712 domain name
30369
30371
  },
30370
30372
  USDT: {
30371
30373
  address: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
30372
30374
  decimals: 6,
30373
- symbol: "USDT"
30375
+ symbol: "USDT",
30376
+ eip712Name: "Tether USD"
30374
30377
  }
30375
30378
  },
30376
30379
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
@@ -30387,12 +30390,15 @@ var CHAINS = {
30387
30390
  USDC: {
30388
30391
  address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
30389
30392
  decimals: 6,
30390
- symbol: "USDC"
30393
+ symbol: "USDC",
30394
+ eip712Name: "USD Coin"
30391
30395
  },
30392
30396
  USDT: {
30393
30397
  address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
30394
30398
  decimals: 6,
30395
- symbol: "USDT"
30399
+ symbol: "USDT",
30400
+ eip712Name: "(PoS) Tether USD"
30401
+ // Polygon uses this name
30396
30402
  }
30397
30403
  },
30398
30404
  usdc: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
@@ -30400,27 +30406,6 @@ var CHAINS = {
30400
30406
  explorerTx: "https://polygonscan.com/tx/",
30401
30407
  avgBlockTime: 2
30402
30408
  },
30403
- ethereum: {
30404
- name: "Ethereum",
30405
- chainId: 1,
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
- },
30419
- usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
30420
- explorer: "https://etherscan.io/address/",
30421
- explorerTx: "https://etherscan.io/tx/",
30422
- avgBlockTime: 12
30423
- },
30424
30409
  // ============ Testnet ============
30425
30410
  base_sepolia: {
30426
30411
  name: "Base Sepolia",
@@ -30430,41 +30415,23 @@ var CHAINS = {
30430
30415
  USDC: {
30431
30416
  address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
30432
30417
  decimals: 6,
30433
- symbol: "USDC"
30418
+ symbol: "USDC",
30419
+ eip712Name: "USDC"
30420
+ // Testnet USDC uses 'USDC' not 'USD Coin'
30434
30421
  },
30435
30422
  USDT: {
30436
30423
  address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
30437
30424
  // Same as USDC on testnet (no official USDT)
30438
30425
  decimals: 6,
30439
- symbol: "USDT"
30426
+ symbol: "USDT",
30427
+ eip712Name: "USDC"
30428
+ // Uses same contract as USDC
30440
30429
  }
30441
30430
  },
30442
30431
  usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
30443
30432
  explorer: "https://sepolia.basescan.org/address/",
30444
30433
  explorerTx: "https://sepolia.basescan.org/tx/",
30445
30434
  avgBlockTime: 2
30446
- },
30447
- sepolia: {
30448
- name: "Sepolia",
30449
- chainId: 11155111,
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
- },
30464
- usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
30465
- explorer: "https://sepolia.etherscan.io/address/",
30466
- explorerTx: "https://sepolia.etherscan.io/tx/",
30467
- avgBlockTime: 12
30468
30435
  }
30469
30436
  };
30470
30437
  function getChain(name) {