moltspay 1.2.0 → 1.3.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.
- package/README.md +161 -17
- package/dist/cdp/index.d.mts +1 -1
- package/dist/cdp/index.d.ts +1 -1
- package/dist/cdp/index.js +60 -30408
- package/dist/cdp/index.js.map +1 -1
- package/dist/cdp/index.mjs +44 -30400
- package/dist/cdp/index.mjs.map +1 -1
- package/dist/cdp-DeohBe1o.d.ts +66 -0
- package/dist/cdp-p_eHuQpb.d.mts +66 -0
- package/dist/chains/index.d.mts +1 -1
- package/dist/chains/index.d.ts +1 -1
- package/dist/chains/index.js +36 -40
- package/dist/chains/index.js.map +1 -1
- package/dist/chains/index.mjs +36 -40
- package/dist/chains/index.mjs.map +1 -1
- package/dist/cli/index.js +997 -174
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1001 -174
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/index.d.mts +27 -4
- package/dist/client/index.d.ts +27 -4
- package/dist/client/index.js +217 -60
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +207 -60
- package/dist/client/index.mjs.map +1 -1
- package/dist/facilitators/index.d.mts +15 -47
- package/dist/facilitators/index.d.ts +15 -47
- package/dist/facilitators/index.js +273 -34
- package/dist/facilitators/index.js.map +1 -1
- package/dist/facilitators/index.mjs +272 -34
- package/dist/facilitators/index.mjs.map +1 -1
- package/dist/{index-B3v8IWjM.d.mts → index-On9ZaGDW.d.mts} +2 -1
- package/dist/{index-B3v8IWjM.d.ts → index-On9ZaGDW.d.ts} +2 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +792 -30657
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +782 -30657
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +17 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.js +513 -48
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +513 -48
- package/dist/server/index.mjs.map +1 -1
- package/dist/verify/index.d.mts +1 -1
- package/dist/verify/index.d.ts +1 -1
- package/dist/verify/index.js +36 -40
- package/dist/verify/index.js.map +1 -1
- package/dist/verify/index.mjs +36 -40
- package/dist/verify/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +1 -1
- package/dist/wallet/index.d.ts +1 -1
- package/dist/wallet/index.js +36 -40
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +36 -40
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +5 -2
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
|
-
|
|
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,7 +96,38 @@ 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
|
|
|
93
|
-
|
|
99
|
+
### Testnet Quick Start
|
|
100
|
+
|
|
101
|
+
Want to test before using real money? Use our testnet faucets:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# 1. Create wallet (if you don't have one)
|
|
105
|
+
npx moltspay init
|
|
106
|
+
|
|
107
|
+
# 2. Get free testnet tokens
|
|
108
|
+
npx moltspay faucet # Base Sepolia (1 USDC, once per 24h)
|
|
109
|
+
npx moltspay faucet --chain tempo_moderato # Tempo testnet (pathUSD)
|
|
110
|
+
|
|
111
|
+
# 3. Test payments
|
|
112
|
+
# Option A: Base Sepolia
|
|
113
|
+
npx moltspay pay https://moltspay.com/a/yaqing text-to-video \
|
|
114
|
+
--chain base_sepolia --prompt "a robot dancing"
|
|
115
|
+
|
|
116
|
+
# Option B: Tempo Moderato (gas-free, MPP protocol)
|
|
117
|
+
npx moltspay pay https://server.com service-id \
|
|
118
|
+
--chain tempo_moderato --prompt "test"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Payment Protocols
|
|
122
|
+
|
|
123
|
+
MoltsPay supports two payment protocols:
|
|
124
|
+
|
|
125
|
+
| Protocol | Chains | Gas | Description |
|
|
126
|
+
|----------|--------|-----|-------------|
|
|
127
|
+
| x402 | Base, Polygon, Ethereum | Gasless (CDP pays) | HTTP 402 + EIP-3009 signatures |
|
|
128
|
+
| MPP | Tempo Moderato | Gas-free native | HTTP 402 + WWW-Authenticate |
|
|
129
|
+
|
|
130
|
+
### How x402 Protocol Works
|
|
94
131
|
|
|
95
132
|
```
|
|
96
133
|
Client Server CDP Facilitator
|
|
@@ -116,6 +153,33 @@ Client Server CDP Facilitator
|
|
|
116
153
|
|
|
117
154
|
**Key insight:** Client signs a payment authorization, server submits it. Neither party pays gas - the CDP facilitator handles settlement.
|
|
118
155
|
|
|
156
|
+
### How MPP Protocol Works (Tempo)
|
|
157
|
+
|
|
158
|
+
MPP (Machine Payments Protocol) is simpler - client executes the transfer directly:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Client Server
|
|
162
|
+
│ │
|
|
163
|
+
│ POST /service │
|
|
164
|
+
│ ─────────────────────────> │
|
|
165
|
+
│ │
|
|
166
|
+
│ 402 + WWW-Authenticate │
|
|
167
|
+
│ <───────────────────────── │
|
|
168
|
+
│ │
|
|
169
|
+
│ [Execute TIP-20 transfer] │
|
|
170
|
+
│ [No gas needed on Tempo] │
|
|
171
|
+
│ │
|
|
172
|
+
│ POST + Authorization: Payment│
|
|
173
|
+
│ ─────────────────────────> │
|
|
174
|
+
│ │
|
|
175
|
+
│ [Server verifies on-chain] │
|
|
176
|
+
│ │
|
|
177
|
+
│ 200 OK + Payment-Receipt │
|
|
178
|
+
│ <───────────────────────── │
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Key insight:** On Tempo, the client executes the transfer directly (gas-free), then retries with the transaction hash. No CDP facilitator needed.
|
|
182
|
+
|
|
119
183
|
## Skill Structure
|
|
120
184
|
|
|
121
185
|
MoltsPay reads your skill's existing structure:
|
|
@@ -183,38 +247,86 @@ If no `--chain` is specified, the client uses the first chain in the provider's
|
|
|
183
247
|
npx moltspay validate ./my-skill
|
|
184
248
|
```
|
|
185
249
|
|
|
186
|
-
## Server Setup
|
|
250
|
+
## Server Setup
|
|
187
251
|
|
|
188
252
|
**1. Get CDP credentials** from https://portal.cdp.coinbase.com/
|
|
189
253
|
|
|
190
254
|
**2. Create `~/.moltspay/.env`:**
|
|
191
255
|
```env
|
|
192
|
-
USE_MAINNET=true
|
|
193
256
|
CDP_API_KEY_ID=your-key-id
|
|
194
257
|
CDP_API_KEY_SECRET=your-secret
|
|
195
258
|
```
|
|
196
259
|
|
|
197
|
-
**3.
|
|
260
|
+
**3. Configure chains in your manifest:**
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"provider": {
|
|
264
|
+
"wallet": "0x...",
|
|
265
|
+
"chains": [
|
|
266
|
+
{ "chain": "base", "network": "eip155:8453", "tokens": ["USDC"] },
|
|
267
|
+
{ "chain": "base_sepolia", "network": "eip155:84532", "tokens": ["USDC"] }
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**4. Start server:**
|
|
198
274
|
```bash
|
|
199
275
|
npx moltspay start ./my-skill --port 3000
|
|
200
276
|
```
|
|
201
277
|
|
|
202
278
|
Server does NOT need a private key - the x402 facilitator handles settlement.
|
|
203
279
|
|
|
280
|
+
### Chain Auto-Detection
|
|
281
|
+
|
|
282
|
+
The server automatically detects which chain to verify payments on based on the client's payment header:
|
|
283
|
+
|
|
284
|
+
- Client pays with `--chain base` → Server verifies on Base mainnet
|
|
285
|
+
- Client pays with `--chain base_sepolia` → Server verifies on Base Sepolia
|
|
286
|
+
|
|
287
|
+
**No `USE_MAINNET` env var needed!** Just configure your accepted chains in the manifest.
|
|
288
|
+
|
|
289
|
+
### Testnet Setup (Providers)
|
|
290
|
+
|
|
291
|
+
To accept testnet payments, add `base_sepolia` to your chains array:
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"provider": {
|
|
296
|
+
"wallet": "0x...",
|
|
297
|
+
"chains": ["base", "base_sepolia"]
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Clients can then pay using `--chain base_sepolia` and get free testnet USDC via `npx moltspay faucet`.
|
|
303
|
+
|
|
204
304
|
## CLI Reference
|
|
205
305
|
|
|
206
306
|
```bash
|
|
207
307
|
# === Client Commands ===
|
|
208
308
|
npx moltspay init # Create wallet
|
|
209
|
-
npx moltspay
|
|
210
|
-
npx moltspay
|
|
309
|
+
npx moltspay fund <amount> # Fund wallet via Coinbase (US)
|
|
310
|
+
npx moltspay faucet # Get free testnet USDC
|
|
311
|
+
npx moltspay faucet --chain tempo_moderato # Get Tempo testnet tokens
|
|
312
|
+
npx moltspay status # Check balance (all chains)
|
|
211
313
|
npx moltspay config # Update limits
|
|
212
314
|
npx moltspay services <url> # List provider's services
|
|
213
315
|
npx moltspay pay <url> <service> # Pay and execute service
|
|
214
316
|
|
|
317
|
+
# === Service Discovery ===
|
|
318
|
+
npx moltspay services # List all from registry
|
|
319
|
+
npx moltspay services https://provider.com # List from specific provider
|
|
320
|
+
npx moltspay services -q "video" # Search by keyword
|
|
321
|
+
npx moltspay services --max-price 1.00 # Filter by max price
|
|
322
|
+
npx moltspay services --type api_service # Filter by type
|
|
323
|
+
npx moltspay services --tag ai # Filter by tag
|
|
324
|
+
npx moltspay services --json # Output as JSON
|
|
325
|
+
|
|
215
326
|
# === Pay with Chain Selection ===
|
|
216
|
-
npx moltspay pay <url> <service> --chain base
|
|
217
|
-
npx moltspay pay <url> <service> --chain polygon
|
|
327
|
+
npx moltspay pay <url> <service> --chain base # Pay on Base (default)
|
|
328
|
+
npx moltspay pay <url> <service> --chain polygon # Pay on Polygon
|
|
329
|
+
npx moltspay pay <url> <service> --chain base_sepolia # Pay on testnet
|
|
218
330
|
|
|
219
331
|
# === Server Commands ===
|
|
220
332
|
npx moltspay start <skill-dir> # Start server
|
|
@@ -223,10 +335,11 @@ npx moltspay validate <path> # Validate manifest
|
|
|
223
335
|
|
|
224
336
|
# === Options ===
|
|
225
337
|
--port <port> # Server port (default 3000)
|
|
226
|
-
--chain <chain> # Chain: base, polygon
|
|
338
|
+
--chain <chain> # Chain: base, polygon, base_sepolia, tempo_moderato
|
|
227
339
|
--token <token> # Token: USDC, USDT
|
|
228
340
|
--max-per-tx <amount> # Spending limit per transaction
|
|
229
341
|
--max-per-day <amount> # Daily spending limit
|
|
342
|
+
--config-dir <dir> # Custom wallet directory
|
|
230
343
|
```
|
|
231
344
|
|
|
232
345
|
## Programmatic Usage
|
|
@@ -264,12 +377,34 @@ server.listen(3000);
|
|
|
264
377
|
|
|
265
378
|
## Supported Chains
|
|
266
379
|
|
|
267
|
-
| Chain | ID | Type |
|
|
268
|
-
|
|
269
|
-
| Base | 8453 | Mainnet |
|
|
270
|
-
| Polygon | 137 | Mainnet |
|
|
271
|
-
| Ethereum | 1 | Mainnet |
|
|
272
|
-
| Base Sepolia | 84532 | Testnet |
|
|
380
|
+
| Chain | ID | Type | Notes |
|
|
381
|
+
|-------|-----|------|-------|
|
|
382
|
+
| Base | 8453 | Mainnet | Primary chain |
|
|
383
|
+
| Polygon | 137 | Mainnet | |
|
|
384
|
+
| Ethereum | 1 | Mainnet | |
|
|
385
|
+
| Base Sepolia | 84532 | Testnet | For testing |
|
|
386
|
+
| Tempo Moderato | 42431 | Testnet | MPP protocol, gas-free |
|
|
387
|
+
|
|
388
|
+
### Tempo Testnet (New!)
|
|
389
|
+
|
|
390
|
+
Tempo Moderato is a gas-free testnet that supports the **MPP (Machine Payments Protocol)**. Perfect for testing agent-to-agent payments without any gas fees.
|
|
391
|
+
|
|
392
|
+
**Tempo Stablecoins:**
|
|
393
|
+
- pathUSD (USDC equivalent): `0x20c0000000000000000000000000000000000000`
|
|
394
|
+
- alphaUSD (USDT equivalent): `0x20c0000000000000000000000000000000000001`
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
# Get free Tempo testnet tokens
|
|
398
|
+
npx moltspay faucet --chain tempo_moderato
|
|
399
|
+
|
|
400
|
+
# Pay on Tempo (gas-free!)
|
|
401
|
+
npx moltspay pay https://server.com service-id --chain tempo_moderato --prompt "test"
|
|
402
|
+
|
|
403
|
+
# Check Tempo balance
|
|
404
|
+
npx moltspay status
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**Explorer:** https://explore.testnet.tempo.xyz
|
|
273
408
|
|
|
274
409
|
## Live Example: Zen7 Video Generation
|
|
275
410
|
|
|
@@ -306,9 +441,18 @@ npx moltspay pay https://juai8.com/zen7 text-to-video --chain polygon --prompt "
|
|
|
306
441
|
- [moltspay-python](https://github.com/Yaqing2023/moltspay-python) - Python SDK with LangChain integration
|
|
307
442
|
- [x402 Protocol](https://www.x402.org/) - The HTTP payment standard
|
|
308
443
|
|
|
444
|
+
## Community & Support
|
|
445
|
+
|
|
446
|
+
Join our Discord for help, feedback, and updates:
|
|
447
|
+
|
|
448
|
+
👉 **[MoltsPay Discord](https://discord.gg/QwCJgVBxVK)**
|
|
449
|
+
|
|
450
|
+
Or visit the [#moltspay-support](https://discord.com/channels/1472602423267819734/1480968496346304522) channel directly.
|
|
451
|
+
|
|
309
452
|
## Links
|
|
310
453
|
|
|
311
454
|
- **Website:** https://moltspay.com
|
|
455
|
+
- **Discord:** https://discord.gg/QwCJgVBxVK
|
|
312
456
|
- **npm:** https://www.npmjs.com/package/moltspay
|
|
313
457
|
- **PyPI:** https://pypi.org/project/moltspay/
|
|
314
458
|
- **x402 Protocol:** https://www.x402.org/
|
package/dist/cdp/index.d.mts
CHANGED
package/dist/cdp/index.d.ts
CHANGED