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.
- package/README.md +292 -34
- package/dist/cdp/index.d.mts +4 -4
- package/dist/cdp/index.d.ts +4 -4
- package/dist/cdp/index.js +110 -30368
- package/dist/cdp/index.js.map +1 -1
- package/dist/cdp/index.mjs +94 -30360
- 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 +9 -8
- package/dist/chains/index.d.ts +9 -8
- package/dist/chains/index.js +86 -0
- package/dist/chains/index.js.map +1 -1
- package/dist/chains/index.mjs +86 -0
- package/dist/chains/index.mjs.map +1 -1
- package/dist/cli/index.js +2746 -290
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +2752 -282
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/index.d.mts +60 -4
- package/dist/client/index.d.ts +60 -4
- package/dist/client/index.js +734 -43
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +732 -41
- package/dist/client/index.mjs.map +1 -1
- package/dist/facilitators/index.d.mts +220 -39
- package/dist/facilitators/index.d.ts +220 -39
- package/dist/facilitators/index.js +897 -1
- package/dist/facilitators/index.js.map +1 -1
- package/dist/facilitators/index.mjs +902 -1
- package/dist/facilitators/index.mjs.map +1 -1
- package/dist/{index-DgJPZMBG.d.mts → index-D_2FkLwV.d.mts} +6 -2
- package/dist/{index-DgJPZMBG.d.ts → index-D_2FkLwV.d.ts} +6 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2238 -30837
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2167 -30766
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +30 -3
- package/dist/server/index.d.ts +30 -3
- package/dist/server/index.js +1345 -54
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +1355 -54
- 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 +86 -0
- package/dist/verify/index.js.map +1 -1
- package/dist/verify/index.mjs +86 -0
- package/dist/verify/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +3 -3
- package/dist/wallet/index.d.ts +3 -3
- package/dist/wallet/index.js +86 -0
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +86 -0
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +8 -2
- package/schemas/moltspay.services.schema.json +27 -132
package/README.md
CHANGED
|
@@ -21,11 +21,12 @@ MoltsPay enables agent-to-agent commerce using the [x402 protocol](https://www.x
|
|
|
21
21
|
|
|
22
22
|
- 🔌 **Skill Integration** - Add `moltspay.services.json` to any existing skill
|
|
23
23
|
- 🎫 **x402 Protocol** - HTTP-native payments (402 Payment Required)
|
|
24
|
-
- 💨 **Gasless** - Both client and server pay no gas (
|
|
24
|
+
- 💨 **Gasless** - Both client and server pay no gas (facilitators handle it)
|
|
25
25
|
- ✅ **Payment Verification** - Automatic on-chain verification
|
|
26
26
|
- 🔒 **Secure Wallet** - Spending limits, whitelist, and audit logging
|
|
27
|
-
- ⛓️ **Multi-chain** - Base, Polygon,
|
|
27
|
+
- ⛓️ **Multi-chain** - Base, Polygon, Solana, BNB, Tempo (mainnet & testnet)
|
|
28
28
|
- 🤖 **Agent-to-Agent** - Complete A2A payment flow support
|
|
29
|
+
- 🌐 **Multi-VM** - EVM chains + Solana (SVM) with unified API
|
|
29
30
|
|
|
30
31
|
## Installation
|
|
31
32
|
|
|
@@ -51,8 +52,9 @@ export async function textToVideo({ prompt }) {
|
|
|
51
52
|
{
|
|
52
53
|
"provider": {
|
|
53
54
|
"name": "My Video Service",
|
|
54
|
-
"wallet": "
|
|
55
|
-
"
|
|
55
|
+
"wallet": "0xYOUR_EVM_WALLET_ADDRESS",
|
|
56
|
+
"solana_wallet": "YOUR_SOLANA_ADDRESS",
|
|
57
|
+
"chains": ["base", "polygon", "solana", "bnb"]
|
|
56
58
|
},
|
|
57
59
|
"services": [{
|
|
58
60
|
"id": "text-to-video",
|
|
@@ -63,6 +65,8 @@ export async function textToVideo({ prompt }) {
|
|
|
63
65
|
}
|
|
64
66
|
```
|
|
65
67
|
|
|
68
|
+
**Note:** `solana_wallet` is optional - only needed if accepting Solana payments.
|
|
69
|
+
|
|
66
70
|
**3. Start server:**
|
|
67
71
|
```bash
|
|
68
72
|
npx moltspay start ./my-skill --port 3000
|
|
@@ -74,15 +78,15 @@ That's it! Your skill now accepts x402 payments.
|
|
|
74
78
|
|
|
75
79
|
**1. Initialize wallet (one time):**
|
|
76
80
|
```bash
|
|
77
|
-
npx moltspay init
|
|
78
|
-
#
|
|
81
|
+
npx moltspay init # EVM wallet (Base, Polygon, BNB, etc.)
|
|
82
|
+
npx moltspay init --chain solana # Solana wallet (mainnet & devnet)
|
|
79
83
|
```
|
|
80
84
|
|
|
81
85
|
**2. Fund your wallet (US users):**
|
|
82
86
|
```bash
|
|
83
|
-
npx moltspay fund
|
|
87
|
+
npx moltspay fund 5
|
|
84
88
|
# Opens Coinbase Pay - use debit card or Apple Pay
|
|
85
|
-
# USDC arrives in
|
|
89
|
+
# USDC arrives in < 1 minutes. No ETH needed!
|
|
86
90
|
```
|
|
87
91
|
|
|
88
92
|
Or send USDC directly to your wallet address from any exchange.
|
|
@@ -98,21 +102,49 @@ npx moltspay pay https://server.com text-to-video --chain polygon --prompt "a ca
|
|
|
98
102
|
|
|
99
103
|
### Testnet Quick Start
|
|
100
104
|
|
|
101
|
-
Want to test before using real money? Use our testnet
|
|
105
|
+
Want to test before using real money? Use our testnet faucets:
|
|
102
106
|
|
|
103
107
|
```bash
|
|
104
108
|
# 1. Create wallet (if you don't have one)
|
|
105
|
-
npx moltspay init
|
|
109
|
+
npx moltspay init # EVM wallet (Base, Polygon, BNB, etc.)
|
|
110
|
+
npx moltspay init --chain solana # Solana wallet (mainnet & devnet)
|
|
111
|
+
|
|
112
|
+
# 2. Get free testnet tokens (pick one or all!)
|
|
113
|
+
npx moltspay faucet # Base Sepolia (1 USDC, once per 24h)
|
|
114
|
+
npx moltspay faucet --chain solana_devnet # Solana devnet (1 USDC)
|
|
115
|
+
npx moltspay faucet --chain bnb_testnet # BNB testnet (1 USDC + 0.001 tBNB for gas)
|
|
116
|
+
npx moltspay faucet --chain tempo_moderato # Tempo testnet (1 pathUSD)
|
|
117
|
+
|
|
118
|
+
# 3. Test payments on different chains
|
|
119
|
+
# Base Sepolia (CDP, gasless)
|
|
120
|
+
npx moltspay pay https://moltspay.com/a/zen7 text-to-video \
|
|
121
|
+
--chain base_sepolia --prompt "a robot dancing"
|
|
106
122
|
|
|
107
|
-
#
|
|
108
|
-
npx moltspay
|
|
123
|
+
# Solana devnet (SPL transfer)
|
|
124
|
+
npx moltspay pay https://moltspay.com/a/zen7 text-to-video \
|
|
125
|
+
--chain solana_devnet --prompt "a cat playing piano"
|
|
109
126
|
|
|
110
|
-
#
|
|
111
|
-
npx moltspay pay https://moltspay.com/a/
|
|
112
|
-
--chain
|
|
127
|
+
# BNB testnet (gas sponsored)
|
|
128
|
+
npx moltspay pay https://moltspay.com/a/zen7 text-to-video \
|
|
129
|
+
--chain bnb_testnet --prompt "a sunset timelapse"
|
|
130
|
+
|
|
131
|
+
# Tempo Moderato (gas-free, MPP protocol)
|
|
132
|
+
npx moltspay pay https://server.com service-id \
|
|
133
|
+
--chain tempo_moderato --prompt "test"
|
|
113
134
|
```
|
|
114
135
|
|
|
115
|
-
##
|
|
136
|
+
## Payment Protocols
|
|
137
|
+
|
|
138
|
+
MoltsPay supports multiple payment protocols, each optimized for different chains:
|
|
139
|
+
|
|
140
|
+
| Protocol | Chains | Gas | Description |
|
|
141
|
+
|----------|--------|-----|-------------|
|
|
142
|
+
| x402 + CDP | Base, Polygon | Gasless (CDP pays) | HTTP 402 + EIP-3009 signatures |
|
|
143
|
+
| x402 + SOL | Solana | Gasless (server pays) | HTTP 402 + SPL transfer |
|
|
144
|
+
| x402 + BNB | BNB | Gasless (server pays) | HTTP 402 + EIP-712 intent signing |
|
|
145
|
+
| MPP | Tempo | Gas-free native | HTTP 402 + WWW-Authenticate |
|
|
146
|
+
|
|
147
|
+
### How x402 Protocol Works
|
|
116
148
|
|
|
117
149
|
```
|
|
118
150
|
Client Server CDP Facilitator
|
|
@@ -138,6 +170,85 @@ Client Server CDP Facilitator
|
|
|
138
170
|
|
|
139
171
|
**Key insight:** Client signs a payment authorization, server submits it. Neither party pays gas - the CDP facilitator handles settlement.
|
|
140
172
|
|
|
173
|
+
### How MPP Protocol Works (Tempo)
|
|
174
|
+
|
|
175
|
+
MPP (Machine Payments Protocol) is simpler - client executes the transfer directly:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
Client Server
|
|
179
|
+
│ │
|
|
180
|
+
│ POST /service │
|
|
181
|
+
│ ─────────────────────────> │
|
|
182
|
+
│ │
|
|
183
|
+
│ 402 + WWW-Authenticate │
|
|
184
|
+
│ <───────────────────────── │
|
|
185
|
+
│ │
|
|
186
|
+
│ [Execute TIP-20 transfer] │
|
|
187
|
+
│ [No gas needed on Tempo] │
|
|
188
|
+
│ │
|
|
189
|
+
│ POST + Authorization: Payment│
|
|
190
|
+
│ ─────────────────────────> │
|
|
191
|
+
│ │
|
|
192
|
+
│ [Server verifies on-chain] │
|
|
193
|
+
│ │
|
|
194
|
+
│ 200 OK + Payment-Receipt │
|
|
195
|
+
│ <───────────────────────── │
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Key insight:** On Tempo, the client executes the transfer directly (gas-free), then retries with the transaction hash. No CDP facilitator needed.
|
|
199
|
+
|
|
200
|
+
### How Solana Protocol Works
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
Client Server (Fee Payer) Solana Network
|
|
204
|
+
│ │ │
|
|
205
|
+
│ POST /execute │ │
|
|
206
|
+
│ ─────────────────────────> │ │
|
|
207
|
+
│ │ │
|
|
208
|
+
│ 402 + payment requirements │ │
|
|
209
|
+
│ (includes solana_wallet) │ │
|
|
210
|
+
│ <───────────────────────── │ │
|
|
211
|
+
│ │ │
|
|
212
|
+
│ [Sign SPL Transfer] │ │
|
|
213
|
+
│ [NO GAS - just signing] │ │
|
|
214
|
+
│ │ │
|
|
215
|
+
│ POST + X-Payment (signature) │ │
|
|
216
|
+
│ ─────────────────────────> │ Execute transfer │
|
|
217
|
+
│ │ (server pays ~$0.001 SOL) │
|
|
218
|
+
│ │ ─────────────────────────> │
|
|
219
|
+
│ │ │
|
|
220
|
+
│ 200 OK + result │ │
|
|
221
|
+
│ <───────────────────────── │ │
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Key insight:** Client only signs the SPL transfer (gasless). Server acts as fee payer and executes the transaction on-chain.
|
|
225
|
+
|
|
226
|
+
### How BNB Protocol Works
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
Client Server BNB Network
|
|
230
|
+
│ │ │
|
|
231
|
+
│ POST /execute │ │
|
|
232
|
+
│ ─────────────────────────> │ │
|
|
233
|
+
│ │ │
|
|
234
|
+
│ 402 + payment requirements │ │
|
|
235
|
+
│ (includes bnbSpender) │ │
|
|
236
|
+
│ <───────────────────────── │ │
|
|
237
|
+
│ │ │
|
|
238
|
+
│ [Sign EIP-712 intent] │ │
|
|
239
|
+
│ [NO GAS - just signing] │ │
|
|
240
|
+
│ │ │
|
|
241
|
+
│ POST + X-Payment (signature) │ │
|
|
242
|
+
│ ─────────────────────────> │ Execute transferFrom │
|
|
243
|
+
│ │ (server pays ~$0.0001 gas) │
|
|
244
|
+
│ │ ─────────────────────────> │
|
|
245
|
+
│ │ │
|
|
246
|
+
│ 200 OK + result │ │
|
|
247
|
+
│ <───────────────────────── │ │
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Key insight:** Client only signs an intent (gasless). Server executes the actual transfer and pays the minimal gas (~$0.0001). This is the "pay-for-success" model - payment only happens if service succeeds.
|
|
251
|
+
|
|
141
252
|
## Skill Structure
|
|
142
253
|
|
|
143
254
|
MoltsPay reads your skill's existing structure:
|
|
@@ -263,18 +374,35 @@ Clients can then pay using `--chain base_sepolia` and get free testnet USDC via
|
|
|
263
374
|
|
|
264
375
|
```bash
|
|
265
376
|
# === Client Commands ===
|
|
266
|
-
npx moltspay init # Create wallet
|
|
377
|
+
npx moltspay init # Create wallet (EVM + Solana)
|
|
267
378
|
npx moltspay fund <amount> # Fund wallet via Coinbase (US)
|
|
268
379
|
npx moltspay faucet # Get free testnet USDC (Base Sepolia)
|
|
269
|
-
npx moltspay
|
|
380
|
+
npx moltspay faucet --chain solana_devnet # Get Solana devnet USDC
|
|
381
|
+
npx moltspay faucet --chain bnb_testnet # Get BNB testnet USDC + tBNB
|
|
382
|
+
npx moltspay faucet --chain tempo_moderato # Get Tempo testnet tokens
|
|
383
|
+
npx moltspay status # Check balance (all chains)
|
|
270
384
|
npx moltspay config # Update limits
|
|
271
385
|
npx moltspay services <url> # List provider's services
|
|
272
386
|
npx moltspay pay <url> <service> # Pay and execute service
|
|
273
387
|
|
|
388
|
+
# === Service Discovery ===
|
|
389
|
+
npx moltspay services # List all from registry
|
|
390
|
+
npx moltspay services https://provider.com # List from specific provider
|
|
391
|
+
npx moltspay services -q "video" # Search by keyword
|
|
392
|
+
npx moltspay services --max-price 1.00 # Filter by max price
|
|
393
|
+
npx moltspay services --type api_service # Filter by type
|
|
394
|
+
npx moltspay services --tag ai # Filter by tag
|
|
395
|
+
npx moltspay services --json # Output as JSON
|
|
396
|
+
|
|
274
397
|
# === Pay with Chain Selection ===
|
|
275
398
|
npx moltspay pay <url> <service> --chain base # Pay on Base (default)
|
|
276
399
|
npx moltspay pay <url> <service> --chain polygon # Pay on Polygon
|
|
277
|
-
npx moltspay pay <url> <service> --chain base_sepolia # Pay on testnet
|
|
400
|
+
npx moltspay pay <url> <service> --chain base_sepolia # Pay on Base testnet
|
|
401
|
+
npx moltspay pay <url> <service> --chain solana # Pay on Solana
|
|
402
|
+
npx moltspay pay <url> <service> --chain solana_devnet # Pay on Solana devnet
|
|
403
|
+
npx moltspay pay <url> <service> --chain bnb # Pay on BNB
|
|
404
|
+
npx moltspay pay <url> <service> --chain bnb_testnet # Pay on BNB testnet
|
|
405
|
+
npx moltspay pay <url> <service> --chain tempo_moderato # Pay on Tempo
|
|
278
406
|
|
|
279
407
|
# === Server Commands ===
|
|
280
408
|
npx moltspay start <skill-dir> # Start server
|
|
@@ -283,10 +411,11 @@ npx moltspay validate <path> # Validate manifest
|
|
|
283
411
|
|
|
284
412
|
# === Options ===
|
|
285
413
|
--port <port> # Server port (default 3000)
|
|
286
|
-
--chain <chain> # Chain: base, polygon,
|
|
414
|
+
--chain <chain> # Chain: base, polygon, solana, bnb, tempo_moderato, + testnets
|
|
287
415
|
--token <token> # Token: USDC, USDT
|
|
288
416
|
--max-per-tx <amount> # Spending limit per transaction
|
|
289
417
|
--max-per-day <amount> # Daily spending limit
|
|
418
|
+
--config-dir <dir> # Custom wallet directory
|
|
290
419
|
```
|
|
291
420
|
|
|
292
421
|
## Programmatic Usage
|
|
@@ -324,33 +453,162 @@ server.listen(3000);
|
|
|
324
453
|
|
|
325
454
|
## Supported Chains
|
|
326
455
|
|
|
327
|
-
| Chain | ID | Type |
|
|
328
|
-
|
|
329
|
-
| Base | 8453 | Mainnet |
|
|
330
|
-
| Polygon | 137 | Mainnet |
|
|
331
|
-
|
|
|
332
|
-
|
|
|
456
|
+
| Chain | ID | Type | Facilitator | Gas Model |
|
|
457
|
+
|-------|-----|------|-------------|-----------|
|
|
458
|
+
| Base | 8453 | Mainnet | CDP | Gasless (CDP pays) |
|
|
459
|
+
| Polygon | 137 | Mainnet | CDP | Gasless (CDP pays) |
|
|
460
|
+
| Base Sepolia | 84532 | Testnet | CDP | Gasless (CDP pays) |
|
|
461
|
+
| Solana | - | Mainnet | SOL | Gasless (server pays) |
|
|
462
|
+
| Solana Devnet | - | Testnet | SOL | Gasless (server pays) |
|
|
463
|
+
| BNB | 56 | Mainnet | BNB | Gasless (server pays) |
|
|
464
|
+
| BNB Testnet | 97 | Testnet | BNB | Gasless (server pays) |
|
|
465
|
+
| Tempo Moderato | 42431 | Testnet | Tempo | Gas-free native |
|
|
466
|
+
|
|
467
|
+
**Notes:**
|
|
468
|
+
- Ethereum mainnet NOT recommended (gas too expensive)
|
|
469
|
+
- Each chain uses a specialized facilitator for optimal UX
|
|
470
|
+
|
|
471
|
+
### Facilitator Architecture
|
|
472
|
+
|
|
473
|
+
A **facilitator** is the entity that executes the on-chain payment and pays the gas fees. MoltsPay supports two types:
|
|
474
|
+
|
|
475
|
+
| Type | Facilitator | Who Pays Gas? | Trust Model |
|
|
476
|
+
|------|-------------|---------------|-------------|
|
|
477
|
+
| **External** | CDP (Coinbase) | Coinbase | Trust Coinbase infrastructure |
|
|
478
|
+
| **Self-hosted** | SOL, BNB, Tempo | Your server | Trust your own server |
|
|
479
|
+
|
|
480
|
+
**External Facilitator (CDP):**
|
|
481
|
+
- Uses Coinbase Developer Platform as a third-party settlement service
|
|
482
|
+
- Coinbase handles all on-chain execution and gas fees
|
|
483
|
+
- Requires CDP API credentials
|
|
484
|
+
- Supported chains: Base, Polygon
|
|
485
|
+
|
|
486
|
+
**Self-hosted Facilitator (SOL, BNB, Tempo):**
|
|
487
|
+
- Your MoltsPay server acts as the facilitator
|
|
488
|
+
- Server pays gas fees (~$0.001 per tx)
|
|
489
|
+
- No external dependency - fully self-sovereign
|
|
490
|
+
- You control the entire payment flow
|
|
491
|
+
|
|
492
|
+
**Why Self-hosted is More Decentralized:**
|
|
493
|
+
|
|
494
|
+
| Aspect | CDP (External) | Self-hosted |
|
|
495
|
+
|--------|----------------|-------------|
|
|
496
|
+
| Single point of failure | ❌ Coinbase down = everyone stuck | ✅ Each provider independent |
|
|
497
|
+
| Censorship risk | ❌ Coinbase can block accounts | ✅ Cannot be censored |
|
|
498
|
+
| Dependency | ❌ Relies on third-party | ✅ Fully autonomous |
|
|
499
|
+
|
|
500
|
+
This self-hosted approach is a key innovation: **any service provider can become their own facilitator** without relying on third-party infrastructure. Unlike CDP where all users depend on Coinbase, self-hosted facilitators create a truly decentralized network with no single point of failure.
|
|
501
|
+
|
|
502
|
+
**Note:** Clients never need to know the facilitator's private keys. They only sign their own payments - the facilitator handles settlement transparently.
|
|
503
|
+
|
|
504
|
+
### Facilitators Explained
|
|
505
|
+
|
|
506
|
+
| Facilitator | Chains | How It Works |
|
|
507
|
+
|-------------|--------|--------------|
|
|
508
|
+
| **CDP** | Base, Polygon | Client signs EIP-3009, Coinbase executes transfer |
|
|
509
|
+
| **SOL** | Solana | Client signs SPL transfer, server executes as fee payer |
|
|
510
|
+
| **BNB** | BNB | Client signs EIP-712 intent, server executes transfer |
|
|
511
|
+
| **Tempo** | Tempo Moderato | Client executes TIP-20 transfer (native gas-free) |
|
|
512
|
+
|
|
513
|
+
### Solana Support
|
|
514
|
+
|
|
515
|
+
Solana uses the **SolanaFacilitator** with SPL token transfers. Key differences:
|
|
516
|
+
|
|
517
|
+
- **Gasless for users** - Server acts as fee payer (~$0.001 SOL per tx)
|
|
518
|
+
- **Separate wallet** - Solana uses ed25519 keys (different from EVM's secp256k1)
|
|
519
|
+
- **Wallet stored at** `~/.moltspay/wallet-solana.json`
|
|
520
|
+
- **Token** - Official Circle USDC SPL token
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
# Initialize includes Solana wallet automatically
|
|
524
|
+
npx moltspay init
|
|
525
|
+
|
|
526
|
+
# Check Solana balance
|
|
527
|
+
npx moltspay status
|
|
528
|
+
|
|
529
|
+
# Get free devnet USDC
|
|
530
|
+
npx moltspay faucet --chain solana_devnet
|
|
531
|
+
|
|
532
|
+
# Pay on Solana
|
|
533
|
+
npx moltspay pay https://server.com service-id --chain solana --prompt "test"
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**USDC Addresses:**
|
|
537
|
+
| Network | Mint Address |
|
|
538
|
+
|---------|--------------|
|
|
539
|
+
| Mainnet | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |
|
|
540
|
+
| Devnet | `4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU` |
|
|
541
|
+
|
|
542
|
+
### BNB Chain Support
|
|
543
|
+
|
|
544
|
+
BNB uses the **BNBFacilitator** with a pre-approval flow. Since CDP doesn't support BNB, we use a different approach:
|
|
545
|
+
|
|
546
|
+
1. Client signs an EIP-712 payment intent (no gas needed)
|
|
547
|
+
2. Server validates and executes the transfer
|
|
548
|
+
3. Server sponsors gas (~$0.0001 per tx)
|
|
549
|
+
|
|
550
|
+
```bash
|
|
551
|
+
# Get free testnet USDC + tBNB for gas
|
|
552
|
+
npx moltspay faucet --chain bnb_testnet
|
|
553
|
+
|
|
554
|
+
# Pay on BNB (client pays no gas!)
|
|
555
|
+
npx moltspay pay https://server.com service-id --chain bnb_testnet --prompt "test"
|
|
556
|
+
|
|
557
|
+
# Check BNB balance
|
|
558
|
+
npx moltspay status
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
**Important:** BNB tokens use 18 decimals (not 6 like Base/Polygon).
|
|
562
|
+
|
|
563
|
+
**Token Addresses (BNB Mainnet):**
|
|
564
|
+
| Token | Address |
|
|
565
|
+
|-------|---------|
|
|
566
|
+
| USDC | `0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d` |
|
|
567
|
+
| USDT | `0x55d398326f99059fF775485246999027B3197955` |
|
|
568
|
+
|
|
569
|
+
### Tempo Testnet
|
|
570
|
+
|
|
571
|
+
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.
|
|
572
|
+
|
|
573
|
+
**Tempo Stablecoins:**
|
|
574
|
+
- pathUSD (USDC equivalent): `0x20c0000000000000000000000000000000000000`
|
|
575
|
+
- alphaUSD (USDT equivalent): `0x20c0000000000000000000000000000000000001`
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
# Get free Tempo testnet tokens
|
|
579
|
+
npx moltspay faucet --chain tempo_moderato
|
|
580
|
+
|
|
581
|
+
# Pay on Tempo (gas-free!)
|
|
582
|
+
npx moltspay pay https://server.com service-id --chain tempo_moderato --prompt "test"
|
|
583
|
+
|
|
584
|
+
# Check Tempo balance
|
|
585
|
+
npx moltspay status
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
**Explorer:** https://explore.testnet.tempo.xyz
|
|
333
589
|
|
|
334
590
|
## Live Example: Zen7 Video Generation
|
|
335
591
|
|
|
336
|
-
Live service at `https://
|
|
592
|
+
Live service at `https://moltspay.com/a/zen7`
|
|
337
593
|
|
|
338
594
|
**Services:**
|
|
339
|
-
- `text-to-video` - $0.
|
|
340
|
-
- `image-to-video` - $
|
|
595
|
+
- `text-to-video` - $0.01 USDC - Generate video from text prompt
|
|
596
|
+
- `image-to-video` - $0.01 USDC - Animate a static image
|
|
341
597
|
|
|
342
|
-
**Supported Chains:** Base, Polygon
|
|
598
|
+
**Supported Chains:** Base, Polygon, Solana, BNB, Tempo (mainnet & testnet)
|
|
343
599
|
|
|
344
600
|
**Try it:**
|
|
345
601
|
```bash
|
|
346
602
|
# List services
|
|
347
|
-
npx moltspay services https://
|
|
603
|
+
npx moltspay services https://moltspay.com/a/zen7
|
|
348
604
|
|
|
349
605
|
# Pay on Base (default)
|
|
350
|
-
npx moltspay pay https://
|
|
606
|
+
npx moltspay pay https://moltspay.com/a/zen7 text-to-video --prompt "a happy cat"
|
|
351
607
|
|
|
352
|
-
# Pay on
|
|
353
|
-
npx moltspay pay https://
|
|
608
|
+
# Pay on different chains
|
|
609
|
+
npx moltspay pay https://moltspay.com/a/zen7 text-to-video --chain polygon --prompt "a happy cat"
|
|
610
|
+
npx moltspay pay https://moltspay.com/a/zen7 text-to-video --chain bnb_testnet --prompt "a happy cat"
|
|
611
|
+
npx moltspay pay https://moltspay.com/a/zen7 text-to-video --chain solana_devnet --prompt "a happy cat"
|
|
354
612
|
```
|
|
355
613
|
|
|
356
614
|
## Use Cases
|
package/dist/cdp/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as EvmChainName } from '../index-D_2FkLwV.mjs';
|
|
2
2
|
import { getChain } from '../chains/index.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -14,7 +14,7 @@ interface CDPWalletConfig {
|
|
|
14
14
|
/** Storage directory (default: ~/.moltspay) */
|
|
15
15
|
storageDir?: string;
|
|
16
16
|
/** Chain name */
|
|
17
|
-
chain?:
|
|
17
|
+
chain?: EvmChainName;
|
|
18
18
|
/** CDP API credentials (or use env vars) */
|
|
19
19
|
apiKeyId?: string;
|
|
20
20
|
apiKeySecret?: string;
|
|
@@ -26,7 +26,7 @@ interface CDPWalletData {
|
|
|
26
26
|
/** CDP wallet ID */
|
|
27
27
|
walletId: string;
|
|
28
28
|
/** Chain */
|
|
29
|
-
chain:
|
|
29
|
+
chain: EvmChainName;
|
|
30
30
|
/** Created timestamp */
|
|
31
31
|
createdAt: string;
|
|
32
32
|
/** CDP account data (for restoration) */
|
|
@@ -75,7 +75,7 @@ declare function getCDPWalletAddress(storageDir?: string): string | null;
|
|
|
75
75
|
*/
|
|
76
76
|
declare class CDPWallet {
|
|
77
77
|
readonly address: string;
|
|
78
|
-
readonly chain:
|
|
78
|
+
readonly chain: EvmChainName;
|
|
79
79
|
readonly chainConfig: ReturnType<typeof getChain>;
|
|
80
80
|
private storageDir;
|
|
81
81
|
constructor(config?: CDPWalletConfig);
|
package/dist/cdp/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as EvmChainName } from '../index-D_2FkLwV.js';
|
|
2
2
|
import { getChain } from '../chains/index.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -14,7 +14,7 @@ interface CDPWalletConfig {
|
|
|
14
14
|
/** Storage directory (default: ~/.moltspay) */
|
|
15
15
|
storageDir?: string;
|
|
16
16
|
/** Chain name */
|
|
17
|
-
chain?:
|
|
17
|
+
chain?: EvmChainName;
|
|
18
18
|
/** CDP API credentials (or use env vars) */
|
|
19
19
|
apiKeyId?: string;
|
|
20
20
|
apiKeySecret?: string;
|
|
@@ -26,7 +26,7 @@ interface CDPWalletData {
|
|
|
26
26
|
/** CDP wallet ID */
|
|
27
27
|
walletId: string;
|
|
28
28
|
/** Chain */
|
|
29
|
-
chain:
|
|
29
|
+
chain: EvmChainName;
|
|
30
30
|
/** Created timestamp */
|
|
31
31
|
createdAt: string;
|
|
32
32
|
/** CDP account data (for restoration) */
|
|
@@ -75,7 +75,7 @@ declare function getCDPWalletAddress(storageDir?: string): string | null;
|
|
|
75
75
|
*/
|
|
76
76
|
declare class CDPWallet {
|
|
77
77
|
readonly address: string;
|
|
78
|
-
readonly chain:
|
|
78
|
+
readonly chain: EvmChainName;
|
|
79
79
|
readonly chainConfig: ReturnType<typeof getChain>;
|
|
80
80
|
private storageDir;
|
|
81
81
|
constructor(config?: CDPWalletConfig);
|