@paylobster/cli 4.5.0 → 4.6.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/EXAMPLES.md +61 -61
- package/package.json +1 -1
package/EXAMPLES.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# PayLobster CLI Examples
|
|
2
2
|
|
|
3
|
-
Real-world usage examples for the `
|
|
3
|
+
Real-world usage examples for the `paylobster` CLI.
|
|
4
4
|
|
|
5
5
|
## Setup Workflow
|
|
6
6
|
|
|
@@ -8,38 +8,38 @@ Real-world usage examples for the `plob` CLI.
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
# 1. Configure for testnet
|
|
11
|
-
|
|
11
|
+
paylobster config set network sepolia
|
|
12
12
|
|
|
13
13
|
# 2. Set up wallet from environment
|
|
14
14
|
export PRIVATE_KEY="0x..."
|
|
15
|
-
|
|
15
|
+
paylobster auth --env PRIVATE_KEY
|
|
16
16
|
|
|
17
17
|
# 3. Register your agent
|
|
18
|
-
|
|
18
|
+
paylobster register \
|
|
19
19
|
--name "test-agent" \
|
|
20
20
|
--capabilities "testing,development"
|
|
21
21
|
|
|
22
22
|
# 4. Check status
|
|
23
|
-
|
|
23
|
+
paylobster status
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### Production Setup
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
# 1. Configure for mainnet
|
|
30
|
-
|
|
30
|
+
paylobster config set network mainnet
|
|
31
31
|
|
|
32
32
|
# 2. Use environment variable for security
|
|
33
33
|
export PRIVATE_KEY="0x..."
|
|
34
|
-
|
|
34
|
+
paylobster auth --env PRIVATE_KEY
|
|
35
35
|
|
|
36
36
|
# 3. Register with production name
|
|
37
|
-
|
|
37
|
+
paylobster register \
|
|
38
38
|
--name "prod-coding-agent" \
|
|
39
39
|
--capabilities "code-review,bug-fix,testing,documentation"
|
|
40
40
|
|
|
41
41
|
# 4. Verify setup
|
|
42
|
-
|
|
42
|
+
paylobster status --json
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## Payment Workflows
|
|
@@ -48,7 +48,7 @@ plob status --json
|
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
# Quick payment to a provider
|
|
51
|
-
|
|
51
|
+
paylobster pay \
|
|
52
52
|
--to 0x9a3c7b21F3d4e8A2B1C5D6E7F8A9B0C1D2E3F4A5 \
|
|
53
53
|
--amount 10 \
|
|
54
54
|
--description "Code review service"
|
|
@@ -58,30 +58,30 @@ plob pay \
|
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
# 1. Create escrow for service
|
|
61
|
-
|
|
61
|
+
paylobster escrow create \
|
|
62
62
|
--to 0x9a3c7b21F3d4e8A2B1C5D6E7F8A9B0C1D2E3F4A5 \
|
|
63
63
|
--amount 50 \
|
|
64
64
|
--description "Full-stack code review"
|
|
65
65
|
|
|
66
66
|
# 2. Check escrow status
|
|
67
|
-
|
|
67
|
+
paylobster escrow list
|
|
68
68
|
|
|
69
69
|
# 3. After work is delivered, release funds
|
|
70
|
-
|
|
70
|
+
paylobster escrow release 0
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
### Bulk Escrow Management
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
76
|
# List all escrows
|
|
77
|
-
|
|
77
|
+
paylobster escrow list --json > escrows.json
|
|
78
78
|
|
|
79
79
|
# Get specific escrow details
|
|
80
|
-
|
|
80
|
+
paylobster escrow get 5 --json
|
|
81
81
|
|
|
82
82
|
# Release multiple escrows (script)
|
|
83
83
|
for id in 1 2 3 4 5; do
|
|
84
|
-
|
|
84
|
+
paylobster escrow release $id --yes
|
|
85
85
|
done
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -91,7 +91,7 @@ done
|
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
93
|
# 1. Check provider reputation
|
|
94
|
-
|
|
94
|
+
paylobster reputation 0x9a3c7b21F3d4e8A2B1C5D6E7F8A9B0C1D2E3F4A5
|
|
95
95
|
|
|
96
96
|
# Output interpretation:
|
|
97
97
|
# ★★★★★ 90+ = Excellent (safe to pay immediately)
|
|
@@ -101,17 +101,17 @@ plob reputation 0x9a3c7b21F3d4e8A2B1C5D6E7F8A9B0C1D2E3F4A5
|
|
|
101
101
|
# ★☆☆☆☆ <40 = Poor (avoid or use dispute-ready escrow)
|
|
102
102
|
|
|
103
103
|
# 2. If good reputation, proceed with payment
|
|
104
|
-
|
|
104
|
+
paylobster pay --to 0x9a3c... --amount 20 --description "Service"
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
### Monitor Your Own Reputation
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
110
|
# Check your reputation regularly
|
|
111
|
-
|
|
111
|
+
paylobster reputation
|
|
112
112
|
|
|
113
113
|
# Get JSON for tracking over time
|
|
114
|
-
|
|
114
|
+
paylobster reputation --json >> reputation-history.jsonl
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
## Automated Workflows
|
|
@@ -125,7 +125,7 @@ plob reputation --json >> reputation-history.jsonl
|
|
|
125
125
|
export PRIVATE_KEY="0x..."
|
|
126
126
|
|
|
127
127
|
# Get status
|
|
128
|
-
STATUS=$(
|
|
128
|
+
STATUS=$(paylobster status --json)
|
|
129
129
|
|
|
130
130
|
# Parse USDC balance
|
|
131
131
|
BALANCE=$(echo $STATUS | jq -r '.balance.usdc')
|
|
@@ -146,7 +146,7 @@ fi
|
|
|
146
146
|
export PRIVATE_KEY="0x..."
|
|
147
147
|
|
|
148
148
|
# Get all escrows
|
|
149
|
-
ESCROWS=$(
|
|
149
|
+
ESCROWS=$(paylobster escrow list --json)
|
|
150
150
|
|
|
151
151
|
# Loop through and release verified ones
|
|
152
152
|
echo $ESCROWS | jq -c '.[]' | while read escrow; do
|
|
@@ -157,7 +157,7 @@ echo $ESCROWS | jq -c '.[]' | while read escrow; do
|
|
|
157
157
|
echo "Verifying escrow $ID..."
|
|
158
158
|
# Add your verification logic here
|
|
159
159
|
# If verified:
|
|
160
|
-
|
|
160
|
+
paylobster escrow release $ID --yes
|
|
161
161
|
fi
|
|
162
162
|
done
|
|
163
163
|
```
|
|
@@ -181,10 +181,10 @@ fi
|
|
|
181
181
|
export PRIVATE_KEY="${AGENT_PRIVATE_KEY}"
|
|
182
182
|
|
|
183
183
|
echo "Registering agent: $NAME"
|
|
184
|
-
|
|
184
|
+
paylobster register --name "$NAME" --capabilities "$CAPABILITIES"
|
|
185
185
|
|
|
186
186
|
echo "Agent registered! Checking status..."
|
|
187
|
-
|
|
187
|
+
paylobster status
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
## Integration Examples
|
|
@@ -194,31 +194,31 @@ plob status
|
|
|
194
194
|
```javascript
|
|
195
195
|
const { execSync } = require('child_process');
|
|
196
196
|
|
|
197
|
-
function
|
|
197
|
+
function paylobsterCommand(cmd) {
|
|
198
198
|
try {
|
|
199
|
-
const output = execSync(`
|
|
199
|
+
const output = execSync(`paylobster ${cmd} --json`, {
|
|
200
200
|
encoding: 'utf-8',
|
|
201
201
|
env: { ...process.env, PRIVATE_KEY: process.env.AGENT_KEY }
|
|
202
202
|
});
|
|
203
203
|
return JSON.parse(output);
|
|
204
204
|
} catch (error) {
|
|
205
|
-
console.error('
|
|
205
|
+
console.error('paylobster command failed:', error.message);
|
|
206
206
|
throw error;
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
// Get status
|
|
211
|
-
const status =
|
|
211
|
+
const status = paylobsterCommand('status');
|
|
212
212
|
console.log(`Balance: ${status.balance.usdc} USDC`);
|
|
213
213
|
|
|
214
214
|
// Check reputation
|
|
215
|
-
const reputation =
|
|
215
|
+
const reputation = paylobsterCommand('reputation 0x...');
|
|
216
216
|
if (reputation.reputation.score < 60) {
|
|
217
217
|
console.warn('Low reputation provider!');
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
// Create payment
|
|
221
|
-
const payment =
|
|
221
|
+
const payment = paylobsterCommand('pay --to 0x... --amount 10 --description "Service"');
|
|
222
222
|
console.log(`Payment created: ${payment.txHash}`);
|
|
223
223
|
```
|
|
224
224
|
|
|
@@ -229,13 +229,13 @@ import subprocess
|
|
|
229
229
|
import json
|
|
230
230
|
import os
|
|
231
231
|
|
|
232
|
-
def
|
|
233
|
-
"""Execute
|
|
232
|
+
def paylobster(command):
|
|
233
|
+
"""Execute paylobster command and return JSON output"""
|
|
234
234
|
env = os.environ.copy()
|
|
235
235
|
env['PRIVATE_KEY'] = os.getenv('AGENT_KEY')
|
|
236
236
|
|
|
237
237
|
result = subprocess.run(
|
|
238
|
-
f'
|
|
238
|
+
f'paylobster {command} --json',
|
|
239
239
|
shell=True,
|
|
240
240
|
capture_output=True,
|
|
241
241
|
text=True,
|
|
@@ -243,7 +243,7 @@ def plob(command):
|
|
|
243
243
|
)
|
|
244
244
|
|
|
245
245
|
if result.returncode != 0:
|
|
246
|
-
raise Exception(f"
|
|
246
|
+
raise Exception(f"paylobster failed: {result.stderr}")
|
|
247
247
|
|
|
248
248
|
return json.loads(result.stdout)
|
|
249
249
|
|
|
@@ -291,13 +291,13 @@ jobs:
|
|
|
291
291
|
- name: Check balance
|
|
292
292
|
env:
|
|
293
293
|
PRIVATE_KEY: ${{ secrets.PAYLOBSTER_PRIVATE_KEY }}
|
|
294
|
-
run:
|
|
294
|
+
run: paylobster status
|
|
295
295
|
|
|
296
296
|
- name: Send payment
|
|
297
297
|
env:
|
|
298
298
|
PRIVATE_KEY: ${{ secrets.PAYLOBSTER_PRIVATE_KEY }}
|
|
299
299
|
run: |
|
|
300
|
-
|
|
300
|
+
paylobster pay \
|
|
301
301
|
--to ${{ github.event.inputs.recipient }} \
|
|
302
302
|
--amount ${{ github.event.inputs.amount }} \
|
|
303
303
|
--description "${{ github.event.inputs.description }}" \
|
|
@@ -310,44 +310,44 @@ jobs:
|
|
|
310
310
|
|
|
311
311
|
```bash
|
|
312
312
|
# Set custom RPC endpoint
|
|
313
|
-
|
|
313
|
+
paylobster config set rpcUrl https://base-mainnet.g.alchemy.com/v2/YOUR_KEY
|
|
314
314
|
|
|
315
315
|
# Verify
|
|
316
|
-
|
|
316
|
+
paylobster config show
|
|
317
317
|
```
|
|
318
318
|
|
|
319
319
|
### Multi-Account Management
|
|
320
320
|
|
|
321
321
|
```bash
|
|
322
322
|
# Switch between accounts using different keystores
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
paylobster auth --private-key $ACCOUNT1_KEY --keystore account1.key
|
|
324
|
+
paylobster status
|
|
325
325
|
|
|
326
|
-
|
|
327
|
-
|
|
326
|
+
paylobster auth --private-key $ACCOUNT2_KEY --keystore account2.key
|
|
327
|
+
paylobster status
|
|
328
328
|
|
|
329
329
|
# Or use environment variables
|
|
330
330
|
export PRIVATE_KEY=$ACCOUNT1_KEY
|
|
331
|
-
|
|
331
|
+
paylobster status
|
|
332
332
|
|
|
333
333
|
export PRIVATE_KEY=$ACCOUNT2_KEY
|
|
334
|
-
|
|
334
|
+
paylobster status
|
|
335
335
|
```
|
|
336
336
|
|
|
337
337
|
### JSON Processing with jq
|
|
338
338
|
|
|
339
339
|
```bash
|
|
340
340
|
# Get USDC balance
|
|
341
|
-
|
|
341
|
+
paylobster status --json | jq -r '.balance.usdc'
|
|
342
342
|
|
|
343
343
|
# Get reputation score
|
|
344
|
-
|
|
344
|
+
paylobster reputation --json | jq -r '.reputation.score'
|
|
345
345
|
|
|
346
346
|
# Filter active escrows
|
|
347
|
-
|
|
347
|
+
paylobster escrow list --json | jq '.[] | select(.status == 1)'
|
|
348
348
|
|
|
349
349
|
# Sum total locked in escrows
|
|
350
|
-
|
|
350
|
+
paylobster escrow list --json | \
|
|
351
351
|
jq -r '.[] | .amount' | \
|
|
352
352
|
cut -d' ' -f1 | \
|
|
353
353
|
awk '{s+=$1} END {print s}'
|
|
@@ -359,14 +359,14 @@ plob escrow list --json | \
|
|
|
359
359
|
|
|
360
360
|
```bash
|
|
361
361
|
# Add DEBUG environment variable
|
|
362
|
-
DEBUG=*
|
|
362
|
+
DEBUG=* paylobster status
|
|
363
363
|
```
|
|
364
364
|
|
|
365
365
|
### Check Transaction on Block Explorer
|
|
366
366
|
|
|
367
367
|
```bash
|
|
368
368
|
# Get transaction hash
|
|
369
|
-
TX=$(
|
|
369
|
+
TX=$(paylobster pay --to 0x... --amount 5 --description "test" --json | jq -r '.txHash')
|
|
370
370
|
|
|
371
371
|
# Open in browser (macOS)
|
|
372
372
|
open "https://basescan.org/tx/$TX"
|
|
@@ -379,10 +379,10 @@ open "https://sepolia.basescan.org/tx/$TX"
|
|
|
379
379
|
|
|
380
380
|
```bash
|
|
381
381
|
# Check configured wallet
|
|
382
|
-
|
|
382
|
+
paylobster auth
|
|
383
383
|
|
|
384
384
|
# Try a read-only operation
|
|
385
|
-
|
|
385
|
+
paylobster status
|
|
386
386
|
|
|
387
387
|
# If successful, wallet is properly configured
|
|
388
388
|
```
|
|
@@ -393,36 +393,36 @@ plob status
|
|
|
393
393
|
|
|
394
394
|
```bash
|
|
395
395
|
# Bad: Pay immediately
|
|
396
|
-
|
|
396
|
+
paylobster pay --to 0x... --amount 100 --description "service"
|
|
397
397
|
|
|
398
398
|
# Good: Check reputation first
|
|
399
|
-
|
|
399
|
+
paylobster reputation 0x...
|
|
400
400
|
# Then decide based on score
|
|
401
|
-
|
|
401
|
+
paylobster pay --to 0x... --amount 100 --description "service"
|
|
402
402
|
```
|
|
403
403
|
|
|
404
404
|
### Use Escrow for New Providers
|
|
405
405
|
|
|
406
406
|
```bash
|
|
407
407
|
# For first-time providers, always use escrow
|
|
408
|
-
|
|
408
|
+
paylobster escrow create --to 0x... --amount 50 --description "trial service"
|
|
409
409
|
|
|
410
410
|
# Release only after delivery verification
|
|
411
411
|
# (add your verification logic here)
|
|
412
|
-
|
|
412
|
+
paylobster escrow release <id>
|
|
413
413
|
```
|
|
414
414
|
|
|
415
415
|
### Keep Local Records
|
|
416
416
|
|
|
417
417
|
```bash
|
|
418
418
|
# Log all payments
|
|
419
|
-
|
|
419
|
+
paylobster pay --to 0x... --amount 20 --description "service" --json >> payments.jsonl
|
|
420
420
|
|
|
421
421
|
# Track escrows
|
|
422
|
-
|
|
422
|
+
paylobster escrow list --json > "escrows-$(date +%Y%m%d).json"
|
|
423
423
|
|
|
424
424
|
# Monitor reputation over time
|
|
425
|
-
|
|
425
|
+
paylobster reputation --json >> "reputation-$(date +%Y%m%d).json"
|
|
426
426
|
```
|
|
427
427
|
|
|
428
428
|
---
|