@paylobster/cli 4.0.1 → 4.1.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 (45) hide show
  1. package/README.md +78 -249
  2. package/dist/src/commands/cascade.d.ts +3 -0
  3. package/dist/src/commands/cascade.d.ts.map +1 -0
  4. package/dist/src/commands/cascade.js +242 -0
  5. package/dist/src/commands/cascade.js.map +1 -0
  6. package/dist/src/commands/compliance.d.ts +3 -0
  7. package/dist/src/commands/compliance.d.ts.map +1 -0
  8. package/dist/src/commands/compliance.js +121 -0
  9. package/dist/src/commands/compliance.js.map +1 -0
  10. package/dist/src/commands/credit-score.d.ts +3 -0
  11. package/dist/src/commands/credit-score.d.ts.map +1 -0
  12. package/dist/src/commands/credit-score.js +174 -0
  13. package/dist/src/commands/credit-score.js.map +1 -0
  14. package/dist/src/commands/dispute.d.ts +3 -0
  15. package/dist/src/commands/dispute.d.ts.map +1 -0
  16. package/dist/src/commands/dispute.js +241 -0
  17. package/dist/src/commands/dispute.js.map +1 -0
  18. package/dist/src/commands/intent.d.ts +3 -0
  19. package/dist/src/commands/intent.d.ts.map +1 -0
  20. package/dist/src/commands/intent.js +227 -0
  21. package/dist/src/commands/intent.js.map +1 -0
  22. package/dist/src/commands/oracle.d.ts +3 -0
  23. package/dist/src/commands/oracle.d.ts.map +1 -0
  24. package/dist/src/commands/oracle.js +114 -0
  25. package/dist/src/commands/oracle.js.map +1 -0
  26. package/dist/src/commands/revenue-share.d.ts +3 -0
  27. package/dist/src/commands/revenue-share.d.ts.map +1 -0
  28. package/dist/src/commands/revenue-share.js +185 -0
  29. package/dist/src/commands/revenue-share.js.map +1 -0
  30. package/dist/src/commands/stream.d.ts +3 -0
  31. package/dist/src/commands/stream.d.ts.map +1 -0
  32. package/dist/src/commands/stream.js +213 -0
  33. package/dist/src/commands/stream.js.map +1 -0
  34. package/dist/src/index.js +16 -0
  35. package/dist/src/index.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/commands/cascade.ts +280 -0
  38. package/src/commands/compliance.ts +123 -0
  39. package/src/commands/credit-score.ts +193 -0
  40. package/src/commands/dispute.ts +274 -0
  41. package/src/commands/intent.ts +261 -0
  42. package/src/commands/oracle.ts +116 -0
  43. package/src/commands/revenue-share.ts +213 -0
  44. package/src/commands/stream.ts +244 -0
  45. package/src/index.ts +16 -0
package/README.md CHANGED
@@ -1,15 +1,6 @@
1
1
  # 🦞 PayLobster CLI (`plob`)
2
2
 
3
- Command-line interface for PayLobster - Payment infrastructure for AI agents.
4
-
5
- ## Features
6
-
7
- - 🔐 **Wallet Management** - Secure keystore or environment variable authentication
8
- - 🆔 **Agent Registration** - Register your agent identity on-chain
9
- - 💰 **Payments & Escrow** - Create, list, and release escrow payments
10
- - ⭐ **Reputation** - Check agent reputation scores
11
- - 📊 **Status Dashboard** - View balances, credit, and account status
12
- - 🛠️ **Network Support** - Base Mainnet and Sepolia testnet
3
+ Command-line interface for PayLobster agent payment infrastructure on Base.
13
4
 
14
5
  ## Installation
15
6
 
@@ -19,63 +10,24 @@ npm install -g @paylobster/cli
19
10
 
20
11
  ## Quick Start
21
12
 
22
- ### 1. Configure Network
23
-
24
13
  ```bash
25
- # Use Sepolia testnet (default)
26
- plob config set network sepolia
27
-
28
- # Or use mainnet
29
- plob config set network mainnet
30
- ```
31
-
32
- ### 2. Set Up Wallet
33
-
34
- ```bash
35
- # Option 1: Use environment variable (recommended for production)
14
+ # 1. Set up your wallet
15
+ plob auth --private-key 0x...
16
+ # Or use environment variable
36
17
  export PRIVATE_KEY="0x..."
37
18
  plob auth --env PRIVATE_KEY
38
19
 
39
- # Option 2: Save to encrypted keystore (development)
40
- plob auth --private-key 0x...
41
- ```
42
-
43
- ### 3. Register Your Agent
44
-
45
- ```bash
46
- plob register --name "my-coding-agent" --capabilities "code-review,bug-fix"
47
- ```
20
+ # 2. Configure network
21
+ plob config set network mainnet # Base Mainnet
22
+ plob config set network sepolia # Base Sepolia (testnet)
48
23
 
49
- ### 4. Check Status
24
+ # 3. Register your agent
25
+ plob register --name "my-agent" --capabilities "code-review,analysis"
50
26
 
51
- ```bash
27
+ # 4. Check status
52
28
  plob status
53
29
  ```
54
30
 
55
- Output:
56
- ```
57
- 🦞 PayLobster Agent Status
58
- ────────────────────────────
59
- Name: my-coding-agent
60
- Address: 0x742d...3f8a
61
- ────────────────────────────
62
- Network: Base Sepolia
63
- Registered: ✅
64
- Agent ID: 42
65
-
66
- 💰 Balances
67
- USDC: 125.50 USDC
68
- ETH: 0.05 ETH
69
-
70
- 💳 Credit
71
- Limit: 1000 USDC
72
- Available: 750 USDC
73
- In Use: 250 USDC
74
-
75
- ⭐ Reputation: ★★★★☆ 85
76
- 📦 Escrows: 3 total
77
- ```
78
-
79
31
  ## Commands
80
32
 
81
33
  ### `plob auth`
@@ -83,95 +35,49 @@ Agent ID: 42
83
35
  Configure wallet authentication.
84
36
 
85
37
  ```bash
86
- # Use private key (saved to keystore)
87
- plob auth --private-key 0x...
88
-
89
- # Use environment variable
90
- plob auth --env PRIVATE_KEY
91
-
92
- # Check current wallet
93
- plob auth
38
+ plob auth --private-key 0x... # Save to keystore
39
+ plob auth --env PRIVATE_KEY # Use env variable
40
+ plob auth # Show current wallet
94
41
  ```
95
42
 
96
43
  ### `plob config`
97
44
 
98
- Manage CLI configuration.
45
+ Manage configuration.
99
46
 
100
47
  ```bash
101
- # Show current config
102
- plob config show
103
-
104
- # Set network
105
- plob config set network sepolia
106
- plob config set network mainnet
107
-
108
- # Set custom RPC
109
- plob config set rpcUrl https://your-rpc.com
110
-
111
- # Reset to defaults
112
- plob config reset
48
+ plob config show # Show current config
49
+ plob config set network mainnet # Set network
50
+ plob config set rpcUrl https://base-rpc.publicnode.com
51
+ plob config reset # Reset to defaults
113
52
  ```
114
53
 
115
54
  ### `plob register`
116
55
 
117
- Register your agent identity on-chain.
56
+ Register agent identity on-chain.
118
57
 
119
58
  ```bash
120
- plob register \
121
- --name "my-agent" \
122
- --capabilities "code-review,bug-fix,testing"
59
+ plob register --name "my-agent" --capabilities "code-review,testing"
123
60
  ```
124
61
 
125
62
  ### `plob status`
126
63
 
127
- View your agent status, balances, and reputation.
64
+ View agent status, balances, and reputation.
128
65
 
129
66
  ```bash
130
- # Pretty output
131
- plob status
132
-
133
- # JSON output
134
- plob status --json
135
- ```
136
-
137
- ### `plob escrow create`
138
-
139
- Create a new escrow payment.
140
-
141
- ```bash
142
- plob escrow create \
143
- --to 0x9a3c...7b21 \
144
- --amount 50 \
145
- --description "Code review for PR #123"
67
+ plob status # Pretty output
68
+ plob status --json # Machine-readable
146
69
  ```
147
70
 
148
- ### `plob escrow list`
71
+ ### `plob escrow`
149
72
 
150
- List your escrows.
73
+ Create and manage escrow payments.
151
74
 
152
75
  ```bash
76
+ plob escrow create --to 0x... --amount 50
153
77
  plob escrow list
154
- plob escrow list --json
155
- ```
156
-
157
- ### `plob escrow get`
158
-
159
- Get escrow details.
160
-
161
- ```bash
162
78
  plob escrow get <escrow-id>
163
- ```
164
-
165
- ### `plob escrow release`
166
-
167
- Release funds from an escrow (sender only).
168
-
169
- ```bash
170
- # With confirmation prompt
171
79
  plob escrow release <escrow-id>
172
-
173
- # Skip confirmation
174
- plob escrow release <escrow-id> --yes
80
+ plob escrow release <escrow-id> --yes # Skip confirmation
175
81
  ```
176
82
 
177
83
  ### `plob pay`
@@ -179,179 +85,102 @@ plob escrow release <escrow-id> --yes
179
85
  Quick payment (creates escrow).
180
86
 
181
87
  ```bash
182
- plob pay \
183
- --to 0x9a3c...7b21 \
184
- --amount 25 \
185
- --description "Bug fix payment"
88
+ plob pay --to 0x... --amount 25 --description "Bug fix"
186
89
  ```
187
90
 
188
91
  ### `plob reputation`
189
92
 
190
- Check reputation score.
93
+ Check reputation scores.
191
94
 
192
95
  ```bash
193
- # Check your reputation
194
- plob reputation
195
-
196
- # Check someone else's reputation
197
- plob reputation 0x9a3c...7b21
96
+ plob reputation # Your reputation
97
+ plob reputation 0x... # Someone else's
98
+ plob reputation --json
198
99
  ```
199
100
 
200
101
  ### `plob mandate`
201
102
 
202
- Manage payment mandates _(coming soon)_.
103
+ Manage spending mandates.
203
104
 
204
105
  ```bash
205
106
  plob mandate create --agent 0x... --limit 100 --duration 30
206
107
  plob mandate list
207
108
  plob mandate revoke <id>
109
+ plob mandate adjust <id> --limit 200
208
110
  ```
209
111
 
210
- ## Configuration
112
+ ### All Commands
211
113
 
212
- Configuration is stored in `~/.plob/config.json`.
114
+ | Command | Description |
115
+ |---------|-------------|
116
+ | `plob auth` | Set up wallet authentication |
117
+ | `plob config` | Get/set configuration |
118
+ | `plob register` | Register agent identity on-chain |
119
+ | `plob status` | View balances, credit, account info |
120
+ | `plob escrow` | Create, list, get, release escrows |
121
+ | `plob pay` | Quick payment (creates escrow) |
122
+ | `plob reputation` | Check agent reputation |
123
+ | `plob mandate` | Create, list, revoke spending mandates |
213
124
 
214
- Default configuration:
215
- ```json
216
- {
217
- "network": "sepolia",
218
- "indexerUrl": "https://api.thegraph.com/subgraphs/name/paylobster/registry"
219
- }
220
- ```
125
+ All commands support `--json` for automation.
221
126
 
222
- ## Wallet Security
223
-
224
- ### Environment Variable (Recommended for Production)
225
-
226
- ```bash
227
- export PRIVATE_KEY="0x..."
228
- plob status
229
- ```
230
-
231
- ### Keystore File (Development)
232
-
233
- Private keys are stored in `~/.plob/keystore/` with restricted permissions (0600).
234
-
235
- ⚠️ **Warning**: The current keystore implementation is **not encrypted**. For production use:
236
- - Use environment variables
237
- - Use hardware wallets
238
- - Implement proper key encryption
239
-
240
- ## Networks
127
+ ## Contract Addresses
241
128
 
242
129
  ### Base Mainnet
243
- - Chain ID: 8453
244
- - RPC: https://base-rpc.publicnode.com
245
- - Block Explorer: https://basescan.org
246
-
247
- ### Base Sepolia (Testnet)
248
- - Chain ID: 84532
249
- - RPC: https://base-sepolia-rpc.publicnode.com
250
- - Block Explorer: https://sepolia.basescan.org
251
130
 
252
- ## Error Handling
131
+ | Contract | Address |
132
+ |----------|---------|
133
+ | Identity | `0xA174ee274F870631B3c330a85EBCad74120BE662` |
134
+ | Reputation | `0x02bb4132a86134684976E2a52E43D59D89E64b29` |
135
+ | Credit | `0xD9241Ce8a721Ef5fcCAc5A11983addC526eC80E1` |
136
+ | Escrow V3 | `0x49EdEe04c78B7FeD5248A20706c7a6c540748806` |
137
+ | USDC | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |
253
138
 
254
- The CLI provides clean error messages and proper exit codes:
255
-
256
- - Exit code `0`: Success
257
- - Exit code `1`: Error
139
+ ### Base Sepolia
258
140
 
259
- ### Common Issues
141
+ | Contract | Address |
142
+ |----------|---------|
143
+ | Identity | `0x3dfA02Ed4F0e4F10E8031d7a4cB8Ea0bBbFbCB8c` |
144
+ | Reputation | `0xb0033901e3b94f4F36dA0b3e59A1F4AD9f4f1697` |
145
+ | Credit | `0xBA64e2b2F2a80D03A4B13b3396942C1e78205C7d` |
146
+ | Escrow V3 | `0x78D1f50a1965dE34f6b5a3D3546C94FE1809Cd82` |
147
+ | USDC | `0x036CbD53842c5426634e7929541eC2318f3dCF7e` |
260
148
 
261
- **"No wallet configured"**
262
- ```bash
263
- # Solution: Set up authentication
264
- plob auth --private-key 0x...
265
- ```
266
-
267
- **"Insufficient balance"**
268
- ```bash
269
- # Solution: Fund your wallet with USDC
270
- # Bridge USDC to Base or buy from an exchange
271
- ```
149
+ ## Networks
272
150
 
273
- **"Agent already registered"**
274
- ```bash
275
- # You can only register once per address
276
- plob status # Check current registration
277
- ```
151
+ | Network | Chain ID | RPC |
152
+ |---------|----------|-----|
153
+ | Base Mainnet | 8453 | `https://base-rpc.publicnode.com` |
154
+ | Base Sepolia | 84532 | `https://base-sepolia-rpc.publicnode.com` |
278
155
 
279
- ## JSON Output
156
+ ## Configuration
280
157
 
281
- All commands support `--json` flag for machine-readable output:
158
+ Stored in `~/.plob/config.json`:
282
159
 
283
- ```bash
284
- plob status --json
285
- plob escrow list --json
286
- plob reputation --json
287
- ```
288
-
289
- Example JSON output:
290
160
  ```json
291
161
  {
292
- "name": "my-agent",
293
- "address": "0x742d...",
294
- "registered": true,
295
- "balance": {
296
- "usdc": "125.50",
297
- "eth": "0.05"
298
- },
299
- "reputation": 85
162
+ "network": "mainnet",
163
+ "rpcUrl": "https://base-rpc.publicnode.com"
300
164
  }
301
165
  ```
302
166
 
303
- ## Development
304
-
305
- ### Build
306
-
307
- ```bash
308
- npm run build
309
- ```
310
-
311
- ### Run without building
312
-
313
- ```bash
314
- npm run dev -- status
315
- ```
316
-
317
- ### Link locally
318
-
319
- ```bash
320
- npm run link
321
- ```
322
-
323
- ### Test
324
-
325
- ```bash
326
- npm test
327
- ```
328
-
329
- ## Contract Addresses
330
-
331
- ### Base Mainnet
332
- - Identity: `0xA174ee274F870631B3c330a85EBCad74120BE662`
333
- - Reputation: `0x02bb4132a86134684976E2a52E43D59D89E64b29`
334
- - Credit: `0xD9241Ce8a721Ef5fcCAc5A11983addC526eC80E1`
335
- - Escrow V3: `0x49EdEe04c78B7FeD5248A20706c7a6c540748806`
336
- - USDC: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`
167
+ ## Wallet Security
337
168
 
338
- ### Base Sepolia
339
- - Identity: `0x3dfA02Ed4F0e4F10E8031d7a4cB8Ea0bBbFbCB8c`
340
- - Reputation: `0xb0033901e3b94f4F36dA0b3e59A1F4AD9f4f1697`
341
- - Credit: `0xBA64e2b2F2a80D03A4B13b3396942C1e78205C7d`
342
- - Escrow V3: `0x78D1f50a1965dE34f6b5a3D3546C94FE1809Cd82`
343
- - USDC: `0x036CbD53842c5426634e7929541eC2318f3dCF7e`
169
+ - **Environment variables** (recommended for production): `export PRIVATE_KEY="0x..."`
170
+ - **Keystore files** (development): stored in `~/.plob/keystore/` with restricted permissions (0600)
171
+ - ⚠️ For production: use hardware wallets or encrypted key management
344
172
 
345
173
  ## Resources
346
174
 
347
175
  - **Website**: [paylobster.com](https://paylobster.com)
348
176
  - **Docs**: [paylobster.com/docs](https://paylobster.com/docs)
349
177
  - **Discord**: [discord.gg/ntWQB6g2jt](https://discord.gg/ntWQB6g2jt)
350
- - **npm**: [npmjs.com/package/@paylobster/cli](https://www.npmjs.com/package/@paylobster/cli)
178
+ - **SDK**: [npmjs.com/package/pay-lobster](https://www.npmjs.com/package/pay-lobster)
179
+ - **MCP Server**: [npmjs.com/package/@paylobster/mcp-server](https://www.npmjs.com/package/@paylobster/mcp-server)
351
180
 
352
181
  ## License
353
182
 
354
- MIT
183
+ MIT © PayLobster
355
184
 
356
185
  ---
357
186
 
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createCascadeCommand(): Command;
3
+ //# sourceMappingURL=cascade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascade.d.ts","sourceRoot":"","sources":["../../../src/commands/cascade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,IAAI,OAAO,CAmR9C"}
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCascadeCommand = createCascadeCommand;
4
+ const commander_1 = require("commander");
5
+ const display_1 = require("../lib/display");
6
+ function createCascadeCommand() {
7
+ const cmd = new commander_1.Command('cascade')
8
+ .description('Manage cascading payments');
9
+ // plob cascade create
10
+ cmd
11
+ .command('create')
12
+ .description('Create a cascading payment')
13
+ .requiredOption('--stages <number>', 'Number of stages')
14
+ .requiredOption('--amount <amount>', 'Total amount in USDC')
15
+ .requiredOption('--recipients <addresses>', 'Comma-separated recipient addresses')
16
+ .option('--json', 'Output as JSON')
17
+ .action(async (options) => {
18
+ try {
19
+ const stages = parseInt(options.stages);
20
+ if (isNaN(stages) || stages < 2) {
21
+ (0, display_1.error)('Invalid stages. Must be at least 2');
22
+ process.exit(1);
23
+ }
24
+ const amount = parseFloat(options.amount);
25
+ if (isNaN(amount) || amount <= 0) {
26
+ (0, display_1.error)('Invalid amount. Must be a positive number');
27
+ process.exit(1);
28
+ }
29
+ const recipients = options.recipients.split(',').map(r => r.trim());
30
+ // Validate all addresses
31
+ for (const recipient of recipients) {
32
+ if (!recipient.startsWith('0x') || recipient.length !== 42) {
33
+ (0, display_1.error)(`Invalid recipient address: ${recipient}`);
34
+ process.exit(1);
35
+ }
36
+ }
37
+ if (recipients.length !== stages) {
38
+ (0, display_1.error)(`Number of recipients (${recipients.length}) must match stages (${stages})`);
39
+ process.exit(1);
40
+ }
41
+ (0, display_1.info)(`Creating ${stages}-stage cascade`);
42
+ (0, display_1.info)(`Total amount: ${options.amount} USDC`);
43
+ (0, display_1.info)(`Recipients: ${recipients.map(display_1.formatAddress).join(' → ')}`);
44
+ const cascadeId = Math.floor(Math.random() * 1000000);
45
+ const txHash = await (0, display_1.withSpinner)('Creating cascade payment...', async () => {
46
+ // Placeholder - implement actual contract call
47
+ await new Promise(resolve => setTimeout(resolve, 2000));
48
+ return '0x' + Math.random().toString(16).substring(2, 66);
49
+ });
50
+ if ((0, display_1.outputJSON)({
51
+ cascadeId,
52
+ stages,
53
+ amount: options.amount,
54
+ recipients,
55
+ txHash,
56
+ }, options)) {
57
+ return;
58
+ }
59
+ (0, display_1.success)('Cascade payment created!');
60
+ (0, display_1.info)(`Cascade ID: ${cascadeId}`);
61
+ (0, display_1.info)(`Transaction: ${txHash}`);
62
+ }
63
+ catch (err) {
64
+ (0, display_1.error)(`Failed to create cascade: ${err}`);
65
+ process.exit(1);
66
+ }
67
+ });
68
+ // plob cascade release
69
+ cmd
70
+ .command('release')
71
+ .description('Release a specific cascade level')
72
+ .argument('<cascadeId>', 'Cascade ID')
73
+ .requiredOption('--level <level>', 'Level to release (1-based)')
74
+ .option('--yes', 'Skip confirmation')
75
+ .option('--json', 'Output as JSON')
76
+ .action(async (cascadeId, options) => {
77
+ try {
78
+ const level = parseInt(options.level);
79
+ if (isNaN(level) || level < 1) {
80
+ (0, display_1.error)('Invalid level. Must be at least 1');
81
+ process.exit(1);
82
+ }
83
+ if (!options.yes) {
84
+ const confirmed = await (0, display_1.confirm)(`Release level ${level} of cascade ${cascadeId}?`);
85
+ if (!confirmed) {
86
+ (0, display_1.info)('Cancelled');
87
+ process.exit(0);
88
+ }
89
+ }
90
+ const txHash = await (0, display_1.withSpinner)(`Releasing cascade level ${level}...`, async () => {
91
+ // Placeholder - implement actual contract call
92
+ await new Promise(resolve => setTimeout(resolve, 1500));
93
+ return '0x' + Math.random().toString(16).substring(2, 66);
94
+ });
95
+ if ((0, display_1.outputJSON)({
96
+ cascadeId,
97
+ level,
98
+ txHash,
99
+ }, options)) {
100
+ return;
101
+ }
102
+ (0, display_1.success)(`Cascade level ${level} released!`);
103
+ (0, display_1.info)(`Cascade ID: ${cascadeId}`);
104
+ (0, display_1.info)(`Transaction: ${txHash}`);
105
+ }
106
+ catch (err) {
107
+ (0, display_1.error)(`Failed to release cascade: ${err}`);
108
+ process.exit(1);
109
+ }
110
+ });
111
+ // plob cascade release-all
112
+ cmd
113
+ .command('release-all')
114
+ .description('Release all remaining cascade levels')
115
+ .argument('<cascadeId>', 'Cascade ID')
116
+ .option('--yes', 'Skip confirmation')
117
+ .option('--json', 'Output as JSON')
118
+ .action(async (cascadeId, options) => {
119
+ try {
120
+ if (!options.yes) {
121
+ const confirmed = await (0, display_1.confirm)(`Release ALL levels of cascade ${cascadeId}?`);
122
+ if (!confirmed) {
123
+ (0, display_1.info)('Cancelled');
124
+ process.exit(0);
125
+ }
126
+ }
127
+ const txHash = await (0, display_1.withSpinner)('Releasing all cascade levels...', async () => {
128
+ // Placeholder - implement actual contract call
129
+ await new Promise(resolve => setTimeout(resolve, 2000));
130
+ return '0x' + Math.random().toString(16).substring(2, 66);
131
+ });
132
+ if ((0, display_1.outputJSON)({
133
+ cascadeId,
134
+ txHash,
135
+ }, options)) {
136
+ return;
137
+ }
138
+ (0, display_1.success)('All cascade levels released!');
139
+ (0, display_1.info)(`Cascade ID: ${cascadeId}`);
140
+ (0, display_1.info)(`Transaction: ${txHash}`);
141
+ }
142
+ catch (err) {
143
+ (0, display_1.error)(`Failed to release cascade: ${err}`);
144
+ process.exit(1);
145
+ }
146
+ });
147
+ // plob cascade get
148
+ cmd
149
+ .command('get')
150
+ .description('Get cascade details')
151
+ .argument('<cascadeId>', 'Cascade ID')
152
+ .option('--json', 'Output as JSON')
153
+ .action(async (cascadeId, options) => {
154
+ try {
155
+ // Placeholder data
156
+ const cascade = {
157
+ id: cascadeId,
158
+ creator: '0x1234567890123456789012345678901234567890',
159
+ totalAmount: '1000 USDC',
160
+ stages: 3,
161
+ currentStage: 1,
162
+ recipients: [
163
+ { address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', released: true },
164
+ { address: '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199', released: false },
165
+ { address: '0x1111111111111111111111111111111111111111', released: false },
166
+ ],
167
+ };
168
+ if ((0, display_1.outputJSON)(cascade, options)) {
169
+ return;
170
+ }
171
+ console.log();
172
+ console.log('Cascade ID: ', cascade.id);
173
+ console.log('Creator: ', cascade.creator);
174
+ console.log('Total Amount: ', cascade.totalAmount);
175
+ console.log('Stages: ', cascade.stages);
176
+ console.log('Current Stage: ', cascade.currentStage);
177
+ console.log();
178
+ console.log('Recipients:');
179
+ cascade.recipients.forEach((r, i) => {
180
+ const status = r.released ? '✅ Released' : '⏳ Pending';
181
+ console.log(` ${i + 1}. ${(0, display_1.formatAddress)(r.address)} - ${status}`);
182
+ });
183
+ console.log();
184
+ }
185
+ catch (err) {
186
+ (0, display_1.error)(`Failed to get cascade: ${err}`);
187
+ process.exit(1);
188
+ }
189
+ });
190
+ // plob cascade list
191
+ cmd
192
+ .command('list')
193
+ .description('List your cascades')
194
+ .option('--json', 'Output as JSON')
195
+ .action(async (options) => {
196
+ try {
197
+ // Placeholder data
198
+ const cascades = [
199
+ {
200
+ id: 1,
201
+ amount: '1000 USDC',
202
+ stages: 3,
203
+ currentStage: 1,
204
+ status: 'active',
205
+ },
206
+ {
207
+ id: 2,
208
+ amount: '500 USDC',
209
+ stages: 2,
210
+ currentStage: 2,
211
+ status: 'completed',
212
+ },
213
+ ];
214
+ if ((0, display_1.outputJSON)(cascades, options)) {
215
+ return;
216
+ }
217
+ if (cascades.length === 0) {
218
+ (0, display_1.info)('No cascades found');
219
+ return;
220
+ }
221
+ const table = (0, display_1.createTable)({
222
+ head: ['ID', 'Amount', 'Stages', 'Current', 'Status'],
223
+ });
224
+ for (const cascade of cascades) {
225
+ table.push([
226
+ cascade.id,
227
+ cascade.amount,
228
+ cascade.stages,
229
+ cascade.currentStage,
230
+ cascade.status,
231
+ ]);
232
+ }
233
+ console.log(table.toString());
234
+ }
235
+ catch (err) {
236
+ (0, display_1.error)(`Failed to list cascades: ${err}`);
237
+ process.exit(1);
238
+ }
239
+ });
240
+ return cmd;
241
+ }
242
+ //# sourceMappingURL=cascade.js.map