@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
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createStreamCommand = createStreamCommand;
4
+ const commander_1 = require("commander");
5
+ const display_1 = require("../lib/display");
6
+ function createStreamCommand() {
7
+ const cmd = new commander_1.Command('stream')
8
+ .description('Manage payment streams');
9
+ // plob stream create
10
+ cmd
11
+ .command('create')
12
+ .description('Create a new payment stream')
13
+ .requiredOption('--to <address>', 'Recipient address')
14
+ .requiredOption('--amount <amount>', 'Total amount in USDC')
15
+ .requiredOption('--duration <duration>', 'Duration (e.g., 30d, 1h, 60m)')
16
+ .option('--interval <interval>', 'Payment interval (e.g., 1d, 1h)', '1d')
17
+ .option('--json', 'Output as JSON')
18
+ .action(async (options) => {
19
+ try {
20
+ // Validate address
21
+ if (!options.to.startsWith('0x') || options.to.length !== 42) {
22
+ (0, display_1.error)('Invalid recipient address format');
23
+ process.exit(1);
24
+ }
25
+ // Validate amount
26
+ const amount = parseFloat(options.amount);
27
+ if (isNaN(amount) || amount <= 0) {
28
+ (0, display_1.error)('Invalid amount. Must be a positive number');
29
+ process.exit(1);
30
+ }
31
+ (0, display_1.info)(`Creating stream: ${options.amount} USDC over ${options.duration}`);
32
+ (0, display_1.info)(`To: ${(0, display_1.formatAddress)(options.to)}`);
33
+ (0, display_1.info)(`Interval: ${options.interval}`);
34
+ // TODO: Implement actual stream creation
35
+ const streamId = Math.floor(Math.random() * 1000000); // Placeholder
36
+ const txHash = await (0, display_1.withSpinner)('Creating payment stream...', async () => {
37
+ // Placeholder - implement actual contract call
38
+ await new Promise(resolve => setTimeout(resolve, 2000));
39
+ return '0x' + Math.random().toString(16).substring(2, 66);
40
+ });
41
+ if ((0, display_1.outputJSON)({
42
+ streamId,
43
+ txHash,
44
+ to: options.to,
45
+ amount: options.amount,
46
+ duration: options.duration,
47
+ interval: options.interval,
48
+ }, options)) {
49
+ return;
50
+ }
51
+ (0, display_1.success)('Payment stream created!');
52
+ (0, display_1.info)(`Stream ID: ${streamId}`);
53
+ (0, display_1.info)(`Transaction: ${txHash}`);
54
+ }
55
+ catch (err) {
56
+ (0, display_1.error)(`Failed to create stream: ${err}`);
57
+ process.exit(1);
58
+ }
59
+ });
60
+ // plob stream cancel
61
+ cmd
62
+ .command('cancel')
63
+ .description('Cancel a payment stream')
64
+ .argument('<streamId>', 'Stream ID')
65
+ .option('--yes', 'Skip confirmation')
66
+ .option('--json', 'Output as JSON')
67
+ .action(async (streamId, options) => {
68
+ try {
69
+ if (!options.yes) {
70
+ const confirmed = await (0, display_1.confirm)(`Cancel stream ${streamId}?`);
71
+ if (!confirmed) {
72
+ (0, display_1.info)('Cancelled');
73
+ process.exit(0);
74
+ }
75
+ }
76
+ const txHash = await (0, display_1.withSpinner)('Cancelling stream...', async () => {
77
+ // Placeholder - implement actual contract call
78
+ await new Promise(resolve => setTimeout(resolve, 1500));
79
+ return '0x' + Math.random().toString(16).substring(2, 66);
80
+ });
81
+ if ((0, display_1.outputJSON)({ streamId, txHash }, options)) {
82
+ return;
83
+ }
84
+ (0, display_1.success)(`Stream ${streamId} cancelled!`);
85
+ (0, display_1.info)(`Transaction: ${txHash}`);
86
+ }
87
+ catch (err) {
88
+ (0, display_1.error)(`Failed to cancel stream: ${err}`);
89
+ process.exit(1);
90
+ }
91
+ });
92
+ // plob stream list
93
+ cmd
94
+ .command('list')
95
+ .description('List your payment streams')
96
+ .option('--json', 'Output as JSON')
97
+ .action(async (options) => {
98
+ try {
99
+ // Placeholder data
100
+ const streams = [
101
+ {
102
+ id: 1,
103
+ to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
104
+ amount: '1000 USDC',
105
+ streamed: '300 USDC',
106
+ remaining: '700 USDC',
107
+ status: 'active',
108
+ },
109
+ {
110
+ id: 2,
111
+ to: '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199',
112
+ amount: '500 USDC',
113
+ streamed: '500 USDC',
114
+ remaining: '0 USDC',
115
+ status: 'completed',
116
+ },
117
+ ];
118
+ if ((0, display_1.outputJSON)(streams, options)) {
119
+ return;
120
+ }
121
+ if (streams.length === 0) {
122
+ (0, display_1.info)('No streams found');
123
+ return;
124
+ }
125
+ const table = (0, display_1.createTable)({
126
+ head: ['ID', 'To', 'Amount', 'Streamed', 'Remaining', 'Status'],
127
+ });
128
+ for (const stream of streams) {
129
+ table.push([
130
+ stream.id,
131
+ (0, display_1.formatAddress)(stream.to),
132
+ stream.amount,
133
+ stream.streamed,
134
+ stream.remaining,
135
+ stream.status,
136
+ ]);
137
+ }
138
+ console.log(table.toString());
139
+ }
140
+ catch (err) {
141
+ (0, display_1.error)(`Failed to list streams: ${err}`);
142
+ process.exit(1);
143
+ }
144
+ });
145
+ // plob stream get
146
+ cmd
147
+ .command('get')
148
+ .description('Get stream details')
149
+ .argument('<streamId>', 'Stream ID')
150
+ .option('--json', 'Output as JSON')
151
+ .action(async (streamId, options) => {
152
+ try {
153
+ // Placeholder data
154
+ const stream = {
155
+ id: streamId,
156
+ from: '0x1234567890123456789012345678901234567890',
157
+ to: '0x0987654321098765432109876543210987654321',
158
+ totalAmount: '1000 USDC',
159
+ streamedAmount: '300 USDC',
160
+ remainingAmount: '700 USDC',
161
+ startTime: new Date().toISOString(),
162
+ duration: '30 days',
163
+ interval: '1 day',
164
+ status: 'active',
165
+ };
166
+ if ((0, display_1.outputJSON)(stream, options)) {
167
+ return;
168
+ }
169
+ console.log();
170
+ console.log('Stream ID: ', stream.id);
171
+ console.log('From: ', stream.from);
172
+ console.log('To: ', stream.to);
173
+ console.log('Total Amount: ', stream.totalAmount);
174
+ console.log('Streamed: ', stream.streamedAmount);
175
+ console.log('Remaining: ', stream.remainingAmount);
176
+ console.log('Start Time: ', stream.startTime);
177
+ console.log('Duration: ', stream.duration);
178
+ console.log('Interval: ', stream.interval);
179
+ console.log('Status: ', stream.status);
180
+ console.log();
181
+ }
182
+ catch (err) {
183
+ (0, display_1.error)(`Failed to get stream: ${err}`);
184
+ process.exit(1);
185
+ }
186
+ });
187
+ // plob stream withdraw
188
+ cmd
189
+ .command('withdraw')
190
+ .description('Withdraw from a stream')
191
+ .argument('<streamId>', 'Stream ID')
192
+ .option('--json', 'Output as JSON')
193
+ .action(async (streamId, options) => {
194
+ try {
195
+ const txHash = await (0, display_1.withSpinner)('Withdrawing from stream...', async () => {
196
+ // Placeholder - implement actual contract call
197
+ await new Promise(resolve => setTimeout(resolve, 1500));
198
+ return '0x' + Math.random().toString(16).substring(2, 66);
199
+ });
200
+ if ((0, display_1.outputJSON)({ streamId, txHash }, options)) {
201
+ return;
202
+ }
203
+ (0, display_1.success)('Withdrawal successful!');
204
+ (0, display_1.info)(`Transaction: ${txHash}`);
205
+ }
206
+ catch (err) {
207
+ (0, display_1.error)(`Failed to withdraw: ${err}`);
208
+ process.exit(1);
209
+ }
210
+ });
211
+ return cmd;
212
+ }
213
+ //# sourceMappingURL=stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../src/commands/stream.ts"],"names":[],"mappings":";;AAIA,kDA+OC;AAnPD,yCAAoC;AACpC,4CAAoH;AAGpH,SAAgB,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;SAC9B,WAAW,CAAC,wBAAwB,CAAC,CAAC;IAEzC,qBAAqB;IACrB,GAAG;SACA,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,6BAA6B,CAAC;SAC1C,cAAc,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;SACrD,cAAc,CAAC,mBAAmB,EAAE,sBAAsB,CAAC;SAC3D,cAAc,CAA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gB,MAAM,EAAE,CAAC,CAAC;QACjC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAA,eAAK,EAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
package/dist/src/index.js CHANGED
@@ -13,6 +13,14 @@ const escrow_1 = require("./commands/escrow");
13
13
  const mandate_1 = require("./commands/mandate");
14
14
  const pay_1 = require("./commands/pay");
15
15
  const reputation_1 = require("./commands/reputation");
16
+ const stream_1 = require("./commands/stream");
17
+ const dispute_1 = require("./commands/dispute");
18
+ const credit_score_1 = require("./commands/credit-score");
19
+ const cascade_1 = require("./commands/cascade");
20
+ const intent_1 = require("./commands/intent");
21
+ const compliance_1 = require("./commands/compliance");
22
+ const oracle_1 = require("./commands/oracle");
23
+ const revenue_share_1 = require("./commands/revenue-share");
16
24
  const chalk_1 = __importDefault(require("chalk"));
17
25
  // Load environment variables from .env file if present
18
26
  const dotenv_1 = __importDefault(require("dotenv"));
@@ -42,6 +50,14 @@ program.addCommand((0, escrow_1.createEscrowCommand)());
42
50
  program.addCommand((0, mandate_1.createMandateCommand)());
43
51
  program.addCommand((0, pay_1.createPayCommand)());
44
52
  program.addCommand((0, reputation_1.createReputationCommand)());
53
+ program.addCommand((0, stream_1.createStreamCommand)());
54
+ program.addCommand((0, dispute_1.createDisputeCommand)());
55
+ program.addCommand((0, credit_score_1.createCreditScoreCommand)());
56
+ program.addCommand((0, cascade_1.createCascadeCommand)());
57
+ program.addCommand((0, intent_1.createIntentCommand)());
58
+ program.addCommand((0, compliance_1.createComplianceCommand)());
59
+ program.addCommand((0, oracle_1.createOracleCommand)());
60
+ program.addCommand((0, revenue_share_1.createRevenueShareCommand)());
45
61
  // Handle errors
46
62
  program.exitOverride((err) => {
47
63
  if (err.code === 'commander.help') {
@@ -1 +1 @@
1
- {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,UAAU,CAAC,IAAA,8BAAoB,GAAE,CAAC,CAAC;AAC3C,OAAO,CAAC,UAAU,CAAC,IAAA,uCAAwB,GAAE,CAAC,CAAC;AAC/C,OAAO,CAAC,UAAU,CAAC,IAAA,8BAAoB,GAAE,CAAC,CAAC;AAC3C,OAAO,CAAC,UAAU,CAAC,IAAA,4BAAmB,GAAE,CAAC,CAAC;AAC1C,OAAO,CAAC,UAAU,CAAC,IAAA,oCAAuB,GAAE,CAAC,CAAC;AAC9C,OAAO,CAAC,UAAU,CAAC,IAAA,4BAAmB,GAAE,CAAC,CAAC;AAC1C,OAAO,CAAC,UAAU,CAAC,IAAA,yCAAyB,GAAE,CAAC,CAAC;AAEhD,gBAAgB;AAChB,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,EAAE;IAC3B,IAAI,GAAG,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEH,kBAAkB;AAClB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,mCAAmC;AACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paylobster/cli",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
4
4
  "description": "PayLobster command-line interface for agent payments and service discovery",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,280 @@
1
+ import { Command } from 'commander';
2
+ import { success, error, info, warning, withSpinner, outputJSON, formatAddress, confirm, createTable } from '../lib/display';
3
+ import type { OutputOptions } from '../lib/types';
4
+
5
+ export function createCascadeCommand(): Command {
6
+ const cmd = new Command('cascade')
7
+ .description('Manage cascading payments');
8
+
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
+ stages: string;
19
+ amount: string;
20
+ recipients: string;
21
+ } & OutputOptions) => {
22
+ try {
23
+ const stages = parseInt(options.stages);
24
+ if (isNaN(stages) || stages < 2) {
25
+ error('Invalid stages. Must be at least 2');
26
+ process.exit(1);
27
+ }
28
+
29
+ const amount = parseFloat(options.amount);
30
+ if (isNaN(amount) || amount <= 0) {
31
+ error('Invalid amount. Must be a positive number');
32
+ process.exit(1);
33
+ }
34
+
35
+ const recipients = options.recipients.split(',').map(r => r.trim());
36
+
37
+ // Validate all addresses
38
+ for (const recipient of recipients) {
39
+ if (!recipient.startsWith('0x') || recipient.length !== 42) {
40
+ error(`Invalid recipient address: ${recipient}`);
41
+ process.exit(1);
42
+ }
43
+ }
44
+
45
+ if (recipients.length !== stages) {
46
+ error(`Number of recipients (${recipients.length}) must match stages (${stages})`);
47
+ process.exit(1);
48
+ }
49
+
50
+ info(`Creating ${stages}-stage cascade`);
51
+ info(`Total amount: ${options.amount} USDC`);
52
+ info(`Recipients: ${recipients.map(formatAddress).join(' → ')}`);
53
+
54
+ const cascadeId = Math.floor(Math.random() * 1000000);
55
+
56
+ const txHash = await withSpinner(
57
+ 'Creating cascade payment...',
58
+ async () => {
59
+ // Placeholder - implement actual contract call
60
+ await new Promise(resolve => setTimeout(resolve, 2000));
61
+ return '0x' + Math.random().toString(16).substring(2, 66);
62
+ }
63
+ );
64
+
65
+ if (outputJSON({
66
+ cascadeId,
67
+ stages,
68
+ amount: options.amount,
69
+ recipients,
70
+ txHash,
71
+ }, options)) {
72
+ return;
73
+ }
74
+
75
+ success('Cascade payment created!');
76
+ info(`Cascade ID: ${cascadeId}`);
77
+ info(`Transaction: ${txHash}`);
78
+ } catch (err) {
79
+ error(`Failed to create cascade: ${err}`);
80
+ process.exit(1);
81
+ }
82
+ });
83
+
84
+ // plob cascade release
85
+ cmd
86
+ .command('release')
87
+ .description('Release a specific cascade level')
88
+ .argument('<cascadeId>', 'Cascade ID')
89
+ .requiredOption('--level <level>', 'Level to release (1-based)')
90
+ .option('--yes', 'Skip confirmation')
91
+ .option('--json', 'Output as JSON')
92
+ .action(async (cascadeId: string, options: {
93
+ level: string;
94
+ yes?: boolean;
95
+ } & OutputOptions) => {
96
+ try {
97
+ const level = parseInt(options.level);
98
+ if (isNaN(level) || level < 1) {
99
+ error('Invalid level. Must be at least 1');
100
+ process.exit(1);
101
+ }
102
+
103
+ if (!options.yes) {
104
+ const confirmed = await confirm(`Release level ${level} of cascade ${cascadeId}?`);
105
+ if (!confirmed) {
106
+ info('Cancelled');
107
+ process.exit(0);
108
+ }
109
+ }
110
+
111
+ const txHash = await withSpinner(
112
+ `Releasing cascade level ${level}...`,
113
+ async () => {
114
+ // Placeholder - implement actual contract call
115
+ await new Promise(resolve => setTimeout(resolve, 1500));
116
+ return '0x' + Math.random().toString(16).substring(2, 66);
117
+ }
118
+ );
119
+
120
+ if (outputJSON({
121
+ cascadeId,
122
+ level,
123
+ txHash,
124
+ }, options)) {
125
+ return;
126
+ }
127
+
128
+ success(`Cascade level ${level} released!`);
129
+ info(`Cascade ID: ${cascadeId}`);
130
+ info(`Transaction: ${txHash}`);
131
+ } catch (err) {
132
+ error(`Failed to release cascade: ${err}`);
133
+ process.exit(1);
134
+ }
135
+ });
136
+
137
+ // plob cascade release-all
138
+ cmd
139
+ .command('release-all')
140
+ .description('Release all remaining cascade levels')
141
+ .argument('<cascadeId>', 'Cascade ID')
142
+ .option('--yes', 'Skip confirmation')
143
+ .option('--json', 'Output as JSON')
144
+ .action(async (cascadeId: string, options: { yes?: boolean } & OutputOptions) => {
145
+ try {
146
+ if (!options.yes) {
147
+ const confirmed = await confirm(`Release ALL levels of cascade ${cascadeId}?`);
148
+ if (!confirmed) {
149
+ info('Cancelled');
150
+ process.exit(0);
151
+ }
152
+ }
153
+
154
+ const txHash = await withSpinner(
155
+ 'Releasing all cascade levels...',
156
+ async () => {
157
+ // Placeholder - implement actual contract call
158
+ await new Promise(resolve => setTimeout(resolve, 2000));
159
+ return '0x' + Math.random().toString(16).substring(2, 66);
160
+ }
161
+ );
162
+
163
+ if (outputJSON({
164
+ cascadeId,
165
+ txHash,
166
+ }, options)) {
167
+ return;
168
+ }
169
+
170
+ success('All cascade levels released!');
171
+ info(`Cascade ID: ${cascadeId}`);
172
+ info(`Transaction: ${txHash}`);
173
+ } catch (err) {
174
+ error(`Failed to release cascade: ${err}`);
175
+ process.exit(1);
176
+ }
177
+ });
178
+
179
+ // plob cascade get
180
+ cmd
181
+ .command('get')
182
+ .description('Get cascade details')
183
+ .argument('<cascadeId>', 'Cascade ID')
184
+ .option('--json', 'Output as JSON')
185
+ .action(async (cascadeId: string, options: OutputOptions) => {
186
+ try {
187
+ // Placeholder data
188
+ const cascade = {
189
+ id: cascadeId,
190
+ creator: '0x1234567890123456789012345678901234567890',
191
+ totalAmount: '1000 USDC',
192
+ stages: 3,
193
+ currentStage: 1,
194
+ recipients: [
195
+ { address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', released: true },
196
+ { address: '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199', released: false },
197
+ { address: '0x1111111111111111111111111111111111111111', released: false },
198
+ ],
199
+ };
200
+
201
+ if (outputJSON(cascade, options)) {
202
+ return;
203
+ }
204
+
205
+ console.log();
206
+ console.log('Cascade ID: ', cascade.id);
207
+ console.log('Creator: ', cascade.creator);
208
+ console.log('Total Amount: ', cascade.totalAmount);
209
+ console.log('Stages: ', cascade.stages);
210
+ console.log('Current Stage: ', cascade.currentStage);
211
+ console.log();
212
+ console.log('Recipients:');
213
+ cascade.recipients.forEach((r, i) => {
214
+ const status = r.released ? '✅ Released' : '⏳ Pending';
215
+ console.log(` ${i + 1}. ${formatAddress(r.address)} - ${status}`);
216
+ });
217
+ console.log();
218
+ } catch (err) {
219
+ error(`Failed to get cascade: ${err}`);
220
+ process.exit(1);
221
+ }
222
+ });
223
+
224
+ // plob cascade list
225
+ cmd
226
+ .command('list')
227
+ .description('List your cascades')
228
+ .option('--json', 'Output as JSON')
229
+ .action(async (options: OutputOptions) => {
230
+ try {
231
+ // Placeholder data
232
+ const cascades = [
233
+ {
234
+ id: 1,
235
+ amount: '1000 USDC',
236
+ stages: 3,
237
+ currentStage: 1,
238
+ status: 'active',
239
+ },
240
+ {
241
+ id: 2,
242
+ amount: '500 USDC',
243
+ stages: 2,
244
+ currentStage: 2,
245
+ status: 'completed',
246
+ },
247
+ ];
248
+
249
+ if (outputJSON(cascades, options)) {
250
+ return;
251
+ }
252
+
253
+ if (cascades.length === 0) {
254
+ info('No cascades found');
255
+ return;
256
+ }
257
+
258
+ const table = createTable({
259
+ head: ['ID', 'Amount', 'Stages', 'Current', 'Status'],
260
+ });
261
+
262
+ for (const cascade of cascades) {
263
+ table.push([
264
+ cascade.id,
265
+ cascade.amount,
266
+ cascade.stages,
267
+ cascade.currentStage,
268
+ cascade.status,
269
+ ]);
270
+ }
271
+
272
+ console.log(table.toString());
273
+ } catch (err) {
274
+ error(`Failed to list cascades: ${err}`);
275
+ process.exit(1);
276
+ }
277
+ });
278
+
279
+ return cmd;
280
+ }
@@ -0,0 +1,123 @@
1
+ import { Command } from 'commander';
2
+ import { success, error, info, warning, outputJSON, formatAddress, formatBoolean } from '../lib/display';
3
+ import type { OutputOptions } from '../lib/types';
4
+ import chalk from 'chalk';
5
+
6
+ export function createComplianceCommand(): Command {
7
+ const cmd = new Command('compliance')
8
+ .description('Check compliance and policy status');
9
+
10
+ // plob compliance check
11
+ cmd
12
+ .command('check')
13
+ .description('Check compliance status for an address')
14
+ .argument('<address>', 'Address to check')
15
+ .option('--json', 'Output as JSON')
16
+ .action(async (address: string, options: OutputOptions) => {
17
+ try {
18
+ if (!address.startsWith('0x') || address.length !== 42) {
19
+ error('Invalid address format');
20
+ process.exit(1);
21
+ }
22
+
23
+ info(`Checking compliance for ${formatAddress(address)}`);
24
+
25
+ // Placeholder data
26
+ const compliance = {
27
+ address,
28
+ approved: true,
29
+ sanctioned: false,
30
+ kycVerified: true,
31
+ riskLevel: 'low',
32
+ jurisdiction: 'US',
33
+ lastChecked: new Date().toISOString(),
34
+ policies: [
35
+ { id: 1, name: 'AML Policy', compliant: true },
36
+ { id: 2, name: 'KYC Policy', compliant: true },
37
+ { id: 3, name: 'Sanctions Screening', compliant: true },
38
+ ],
39
+ };
40
+
41
+ if (outputJSON(compliance, options)) {
42
+ return;
43
+ }
44
+
45
+ console.log();
46
+ console.log(chalk.bold.cyan('🦞 Compliance Check'));
47
+ console.log(chalk.gray('─'.repeat(50)));
48
+ console.log('Address: ', compliance.address);
49
+ console.log('Approved: ', formatBoolean(compliance.approved));
50
+ console.log('Sanctioned: ', formatBoolean(compliance.sanctioned));
51
+ console.log('KYC Verified: ', formatBoolean(compliance.kycVerified));
52
+ console.log('Risk Level: ', compliance.riskLevel === 'low' ? chalk.green(compliance.riskLevel) : chalk.yellow(compliance.riskLevel));
53
+ console.log('Jurisdiction: ', compliance.jurisdiction);
54
+ console.log('Last Checked: ', compliance.lastChecked);
55
+ console.log();
56
+ console.log(chalk.bold('Policy Compliance:'));
57
+ compliance.policies.forEach(policy => {
58
+ console.log(` ${formatBoolean(policy.compliant)} ${policy.name}`);
59
+ });
60
+ console.log();
61
+
62
+ if (!compliance.approved) {
63
+ warning('This address is NOT approved for transactions');
64
+ } else {
65
+ success('Address is compliant');
66
+ }
67
+ } catch (err) {
68
+ error(`Failed to check compliance: ${err}`);
69
+ process.exit(1);
70
+ }
71
+ });
72
+
73
+ // plob compliance policy
74
+ cmd
75
+ .command('policy')
76
+ .description('Get policy details')
77
+ .argument('<policyId>', 'Policy ID')
78
+ .option('--json', 'Output as JSON')
79
+ .action(async (policyId: string, options: OutputOptions) => {
80
+ try {
81
+ // Placeholder data
82
+ const policy = {
83
+ id: policyId,
84
+ name: 'AML Policy',
85
+ version: '1.2.0',
86
+ description: 'Anti-Money Laundering compliance policy',
87
+ requirements: [
88
+ 'Transaction monitoring',
89
+ 'Suspicious activity reporting',
90
+ 'Record keeping (5 years)',
91
+ 'Customer due diligence',
92
+ ],
93
+ effectiveDate: '2024-01-01',
94
+ jurisdiction: 'Global',
95
+ };
96
+
97
+ if (outputJSON(policy, options)) {
98
+ return;
99
+ }
100
+
101
+ console.log();
102
+ console.log(chalk.bold.cyan('🦞 Policy Details'));
103
+ console.log(chalk.gray('─'.repeat(50)));
104
+ console.log('Policy ID: ', policy.id);
105
+ console.log('Name: ', policy.name);
106
+ console.log('Version: ', policy.version);
107
+ console.log('Description: ', policy.description);
108
+ console.log('Effective Date: ', policy.effectiveDate);
109
+ console.log('Jurisdiction: ', policy.jurisdiction);
110
+ console.log();
111
+ console.log(chalk.bold('Requirements:'));
112
+ policy.requirements.forEach(req => {
113
+ console.log(` • ${req}`);
114
+ });
115
+ console.log();
116
+ } catch (err) {
117
+ error(`Failed to get policy: ${err}`);
118
+ process.exit(1);
119
+ }
120
+ });
121
+
122
+ return cmd;
123
+ }