@paylobster/cli 4.0.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/BUILD_SUMMARY.md +429 -0
- package/CHANGELOG.md +78 -0
- package/CONTRIBUTING.md +368 -0
- package/EXAMPLES.md +432 -0
- package/LICENSE +21 -0
- package/QUICKSTART.md +189 -0
- package/README.md +377 -0
- package/TEST_REPORT.md +191 -0
- package/bin/plob.js +9 -0
- package/bin/plob.ts +9 -0
- package/demo.sh +154 -0
- package/dist/bin/plob.d.ts +7 -0
- package/dist/bin/plob.d.ts.map +1 -0
- package/dist/bin/plob.js +10 -0
- package/dist/bin/plob.js.map +1 -0
- package/dist/src/commands/auth.d.ts +3 -0
- package/dist/src/commands/auth.d.ts.map +1 -0
- package/dist/src/commands/auth.js +75 -0
- package/dist/src/commands/auth.js.map +1 -0
- package/dist/src/commands/config.d.ts +3 -0
- package/dist/src/commands/config.d.ts.map +1 -0
- package/dist/src/commands/config.js +79 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/escrow.d.ts +3 -0
- package/dist/src/commands/escrow.d.ts.map +1 -0
- package/dist/src/commands/escrow.js +193 -0
- package/dist/src/commands/escrow.js.map +1 -0
- package/dist/src/commands/mandate.d.ts +8 -0
- package/dist/src/commands/mandate.d.ts.map +1 -0
- package/dist/src/commands/mandate.js +54 -0
- package/dist/src/commands/mandate.js.map +1 -0
- package/dist/src/commands/pay.d.ts +6 -0
- package/dist/src/commands/pay.d.ts.map +1 -0
- package/dist/src/commands/pay.js +77 -0
- package/dist/src/commands/pay.js.map +1 -0
- package/dist/src/commands/register.d.ts +3 -0
- package/dist/src/commands/register.d.ts.map +1 -0
- package/dist/src/commands/register.js +51 -0
- package/dist/src/commands/register.js.map +1 -0
- package/dist/src/commands/reputation.d.ts +3 -0
- package/dist/src/commands/reputation.d.ts.map +1 -0
- package/dist/src/commands/reputation.js +116 -0
- package/dist/src/commands/reputation.js.map +1 -0
- package/dist/src/commands/status.d.ts +3 -0
- package/dist/src/commands/status.d.ts.map +1 -0
- package/dist/src/commands/status.js +82 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +59 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/config.d.ts +26 -0
- package/dist/src/lib/config.d.ts.map +1 -0
- package/dist/src/lib/config.js +91 -0
- package/dist/src/lib/config.js.map +1 -0
- package/dist/src/lib/contracts.d.ts +18798 -0
- package/dist/src/lib/contracts.d.ts.map +1 -0
- package/dist/src/lib/contracts.js +361 -0
- package/dist/src/lib/contracts.js.map +1 -0
- package/dist/src/lib/display.d.ts +83 -0
- package/dist/src/lib/display.d.ts.map +1 -0
- package/dist/src/lib/display.js +293 -0
- package/dist/src/lib/display.js.map +1 -0
- package/dist/src/lib/types.d.ts +49 -0
- package/dist/src/lib/types.d.ts.map +1 -0
- package/dist/src/lib/types.js +3 -0
- package/dist/src/lib/types.js.map +1 -0
- package/dist/src/lib/wallet.d.ts +30 -0
- package/dist/src/lib/wallet.d.ts.map +1 -0
- package/dist/src/lib/wallet.js +143 -0
- package/dist/src/lib/wallet.js.map +1 -0
- package/jest.config.js +15 -0
- package/package.json +55 -0
- package/src/__tests__/cli.test.ts +38 -0
- package/src/commands/auth.ts +75 -0
- package/src/commands/config.ts +84 -0
- package/src/commands/escrow.ts +222 -0
- package/src/commands/mandate.ts +56 -0
- package/src/commands/pay.ts +96 -0
- package/src/commands/register.ts +57 -0
- package/src/commands/reputation.ts +84 -0
- package/src/commands/status.ts +91 -0
- package/src/index.ts +63 -0
- package/src/lib/config.ts +90 -0
- package/src/lib/contracts.ts +392 -0
- package/src/lib/display.ts +265 -0
- package/src/lib/types.ts +57 -0
- package/src/lib/wallet.ts +146 -0
- package/tsconfig.json +21 -0
package/demo.sh
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# PayLobster CLI Demo Script
|
|
4
|
+
# This script demonstrates the key features of plob
|
|
5
|
+
|
|
6
|
+
set -e # Exit on error
|
|
7
|
+
|
|
8
|
+
# Colors
|
|
9
|
+
GREEN='\033[0;32m'
|
|
10
|
+
BLUE='\033[0;34m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
NC='\033[0m' # No Color
|
|
13
|
+
|
|
14
|
+
echo_step() {
|
|
15
|
+
echo -e "\n${BLUE}==>${NC} ${GREEN}$1${NC}\n"
|
|
16
|
+
sleep 1
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
echo_info() {
|
|
20
|
+
echo -e "${YELLOW}$1${NC}"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Check if plob is installed
|
|
24
|
+
if ! command -v plob &> /dev/null; then
|
|
25
|
+
echo "Error: plob CLI not found"
|
|
26
|
+
echo "Install with: npm install -g @paylobster/cli"
|
|
27
|
+
echo "Or from source: npm run link"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Check for private key
|
|
32
|
+
if [ -z "$PRIVATE_KEY" ]; then
|
|
33
|
+
echo "Error: PRIVATE_KEY environment variable not set"
|
|
34
|
+
echo "Set it with: export PRIVATE_KEY='0x...'"
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
echo -e "${GREEN}"
|
|
39
|
+
cat << "EOF"
|
|
40
|
+
┌─────────────────────────────────┐
|
|
41
|
+
│ 🦞 PayLobster CLI Demo │
|
|
42
|
+
│ Payment infrastructure for AI │
|
|
43
|
+
└─────────────────────────────────┘
|
|
44
|
+
EOF
|
|
45
|
+
echo -e "${NC}"
|
|
46
|
+
|
|
47
|
+
# 1. Configure network
|
|
48
|
+
echo_step "1. Configure Network (Sepolia Testnet)"
|
|
49
|
+
plob config set network sepolia
|
|
50
|
+
plob config show
|
|
51
|
+
|
|
52
|
+
# 2. Set up authentication
|
|
53
|
+
echo_step "2. Authenticate Wallet"
|
|
54
|
+
plob auth --env PRIVATE_KEY
|
|
55
|
+
plob auth # Show current wallet
|
|
56
|
+
|
|
57
|
+
# 3. Check initial status
|
|
58
|
+
echo_step "3. Check Agent Status"
|
|
59
|
+
plob status
|
|
60
|
+
|
|
61
|
+
# 4. Check if already registered
|
|
62
|
+
echo_info "Checking if agent is already registered..."
|
|
63
|
+
REGISTERED=$(plob status --json | jq -r '.registered')
|
|
64
|
+
|
|
65
|
+
if [ "$REGISTERED" = "false" ]; then
|
|
66
|
+
# 5. Register agent
|
|
67
|
+
echo_step "4. Register Agent Identity"
|
|
68
|
+
plob register \
|
|
69
|
+
--name "demo-agent" \
|
|
70
|
+
--capabilities "code-review,testing,documentation"
|
|
71
|
+
|
|
72
|
+
# Wait for transaction
|
|
73
|
+
sleep 5
|
|
74
|
+
else
|
|
75
|
+
echo_info "Agent already registered, skipping registration..."
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# 6. Check reputation
|
|
79
|
+
echo_step "5. Check Reputation"
|
|
80
|
+
plob reputation
|
|
81
|
+
|
|
82
|
+
# 7. Get balance
|
|
83
|
+
echo_step "6. Check Balance"
|
|
84
|
+
USDC_BALANCE=$(plob status --json | jq -r '.balance.usdc')
|
|
85
|
+
echo_info "Current USDC balance: $USDC_BALANCE USDC"
|
|
86
|
+
|
|
87
|
+
if (( $(echo "$USDC_BALANCE < 1" | bc -l) )); then
|
|
88
|
+
echo_info "⚠️ Low balance! Please fund your wallet with testnet USDC"
|
|
89
|
+
echo_info "Sepolia USDC faucet: https://faucet.circle.com/"
|
|
90
|
+
echo_info ""
|
|
91
|
+
echo_info "Demo will continue with read-only operations..."
|
|
92
|
+
|
|
93
|
+
# 8. List escrows (read-only)
|
|
94
|
+
echo_step "7. List Escrows"
|
|
95
|
+
plob escrow list
|
|
96
|
+
|
|
97
|
+
echo_step "Demo Complete! (Limited - no balance for transactions)"
|
|
98
|
+
exit 0
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# 9. Create test escrow (if balance available)
|
|
102
|
+
echo_step "7. Create Test Escrow"
|
|
103
|
+
echo_info "Creating 0.1 USDC escrow to self (for demo purposes)..."
|
|
104
|
+
|
|
105
|
+
SELF_ADDRESS=$(plob status --json | jq -r '.address')
|
|
106
|
+
|
|
107
|
+
plob escrow create \
|
|
108
|
+
--to $SELF_ADDRESS \
|
|
109
|
+
--amount 0.1 \
|
|
110
|
+
--description "Demo escrow created by plob CLI"
|
|
111
|
+
|
|
112
|
+
# Wait for transaction
|
|
113
|
+
sleep 5
|
|
114
|
+
|
|
115
|
+
# 10. List escrows
|
|
116
|
+
echo_step "8. List Your Escrows"
|
|
117
|
+
plob escrow list
|
|
118
|
+
|
|
119
|
+
# 11. Get specific escrow details
|
|
120
|
+
echo_step "9. Get Escrow Details"
|
|
121
|
+
LATEST_ESCROW=$(plob escrow list --json | jq -r '.[0].id // 0')
|
|
122
|
+
if [ "$LATEST_ESCROW" != "0" ]; then
|
|
123
|
+
plob escrow get $LATEST_ESCROW
|
|
124
|
+
else
|
|
125
|
+
echo_info "No escrows found"
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
# 12. JSON output examples
|
|
129
|
+
echo_step "10. JSON Output Examples"
|
|
130
|
+
echo_info "All commands support --json flag for machine-readable output:"
|
|
131
|
+
echo ""
|
|
132
|
+
plob status --json | jq '{name, address, balance}'
|
|
133
|
+
|
|
134
|
+
# 13. Check config
|
|
135
|
+
echo_step "11. View Configuration"
|
|
136
|
+
plob config show
|
|
137
|
+
|
|
138
|
+
# Complete
|
|
139
|
+
echo_step "Demo Complete!"
|
|
140
|
+
echo_info "You've seen the key features of the PayLobster CLI:"
|
|
141
|
+
echo_info " ✅ Network configuration"
|
|
142
|
+
echo_info " ✅ Wallet authentication"
|
|
143
|
+
echo_info " ✅ Agent registration"
|
|
144
|
+
echo_info " ✅ Status checking"
|
|
145
|
+
echo_info " ✅ Reputation queries"
|
|
146
|
+
echo_info " ✅ Escrow creation and management"
|
|
147
|
+
echo_info " ✅ JSON output for automation"
|
|
148
|
+
echo ""
|
|
149
|
+
echo_info "Next steps:"
|
|
150
|
+
echo_info " • Try: plob --help"
|
|
151
|
+
echo_info " • Read: README.md and EXAMPLES.md"
|
|
152
|
+
echo_info " • Build: Your own payment automation!"
|
|
153
|
+
echo ""
|
|
154
|
+
echo_info "Happy building! 🦞"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plob.d.ts","sourceRoot":"","sources":["../../bin/plob.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAGH,OAAO,cAAc,CAAC"}
|
package/dist/bin/plob.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* PayLobster CLI entry point
|
|
5
|
+
* This file imports and runs the main CLI application
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
// Enable source map support for better error messages during development
|
|
9
|
+
require("../src/index");
|
|
10
|
+
//# sourceMappingURL=plob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plob.js","sourceRoot":"","sources":["../../bin/plob.ts"],"names":[],"mappings":";;AAEA;;;GAGG;;AAEH,yEAAyE;AACzE,wBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,iBAAiB,IAAI,OAAO,CAqE3C"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAuthCommand = createAuthCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const wallet_1 = require("../lib/wallet");
|
|
6
|
+
const config_1 = require("../lib/config");
|
|
7
|
+
const display_1 = require("../lib/display");
|
|
8
|
+
function createAuthCommand() {
|
|
9
|
+
const cmd = new commander_1.Command('auth')
|
|
10
|
+
.description('Set up wallet authentication');
|
|
11
|
+
cmd
|
|
12
|
+
.option('--private-key <key>', 'Set private key directly')
|
|
13
|
+
.option('--env <var>', 'Use environment variable (PRIVATE_KEY or custom)')
|
|
14
|
+
.option('--keystore <file>', 'Save to keystore file')
|
|
15
|
+
.action(async (options) => {
|
|
16
|
+
try {
|
|
17
|
+
if (options.privateKey) {
|
|
18
|
+
// Validate private key format
|
|
19
|
+
if (!options.privateKey.startsWith('0x') || options.privateKey.length !== 66) {
|
|
20
|
+
(0, display_1.error)('Invalid private key format. Must be 0x-prefixed 64-character hex string');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
// Save to keystore
|
|
24
|
+
const keystorePath = (0, wallet_1.saveToKeystore)(options.privateKey, options.keystore || 'default.key');
|
|
25
|
+
// Update config
|
|
26
|
+
(0, config_1.saveConfig)({
|
|
27
|
+
wallet: {
|
|
28
|
+
type: 'keystore',
|
|
29
|
+
path: options.keystore || 'default.key',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
(0, display_1.success)('Wallet configured successfully');
|
|
33
|
+
(0, display_1.info)(`Private key saved to keystore: ${keystorePath}`);
|
|
34
|
+
(0, display_1.warning)('Keep your keystore file secure!');
|
|
35
|
+
// Show address
|
|
36
|
+
const address = (0, wallet_1.getWalletAddress)();
|
|
37
|
+
(0, display_1.info)(`Wallet address: ${address}`);
|
|
38
|
+
}
|
|
39
|
+
else if (options.env) {
|
|
40
|
+
// Use environment variable
|
|
41
|
+
(0, config_1.saveConfig)({
|
|
42
|
+
wallet: {
|
|
43
|
+
type: 'env',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
(0, display_1.success)(`Configured to use environment variable: ${options.env}`);
|
|
47
|
+
(0, display_1.info)('Set the environment variable before running commands:');
|
|
48
|
+
console.log(` export ${options.env}="0x..."`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Default: check if wallet is already configured
|
|
52
|
+
try {
|
|
53
|
+
const address = (0, wallet_1.getWalletAddress)();
|
|
54
|
+
(0, display_1.success)('Wallet is already configured');
|
|
55
|
+
(0, display_1.info)(`Address: ${address}`);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
(0, display_1.error)('No wallet configured');
|
|
59
|
+
console.log();
|
|
60
|
+
console.log('Usage:');
|
|
61
|
+
console.log(' plob auth --private-key 0x...');
|
|
62
|
+
console.log(' plob auth --env PRIVATE_KEY');
|
|
63
|
+
console.log();
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
(0, display_1.error)(`Failed to configure wallet: ${err}`);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return cmd;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":";;AAKA,8CAqEC;AA1ED,yCAAoC;AACpC,0CAA6E;AAC7E,0CAA2C;AAC3C,4CAA+D;AAE/D,SAAgB,iBAAiB;IAC/B,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;SAC5B,WAAW,CAAC,8BAA8B,CAAC,CAAC;IAE/C,GAAG;SACA,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;SACzD,MAAM,CAAC,aAAa,EAAE,kDAAkD,CAAC;SACzE,MAAM,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;SACpD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBACvB,8BA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M,OAAO,GAAG,IAAA,yBAAgB,GAAE,CAAC;oBACnC,IAAA,iBAAO,EAAC,8BAA8B,CAAC,CAAC;oBACxC,IAAA,cAAI,EAAC,YAAY,OAAO,EAAE,CAAC,CAAC;gBAC9B,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,IAAA,eAAK,EAAC,sBAAsB,CAAC,CAAC;oBAC9B,OAAO,CAAC,GAAG,EAAE,CAAC;oBACd,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBACtB,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;oBAC/C,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;oBAC7C,OAAO,CAAC,GAAG,EAAE,CAAC;oBACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAA,eAAK,EAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,IAAI,OAAO,CA8E7C"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConfigCommand = createConfigCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const config_1 = require("../lib/config");
|
|
6
|
+
const display_1 = require("../lib/display");
|
|
7
|
+
function createConfigCommand() {
|
|
8
|
+
const cmd = new commander_1.Command('config')
|
|
9
|
+
.description('Manage CLI configuration');
|
|
10
|
+
// plob config show
|
|
11
|
+
cmd
|
|
12
|
+
.command('show')
|
|
13
|
+
.description('Show current configuration')
|
|
14
|
+
.option('--json', 'Output as JSON')
|
|
15
|
+
.action(async (options) => {
|
|
16
|
+
try {
|
|
17
|
+
const config = (0, config_1.loadConfig)();
|
|
18
|
+
if ((0, display_1.outputJSON)(config, options)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
console.log();
|
|
22
|
+
(0, display_1.printConfig)({
|
|
23
|
+
network: (0, display_1.formatNetwork)(config.network),
|
|
24
|
+
rpcUrl: config.rpcUrl || 'default',
|
|
25
|
+
indexerUrl: config.indexerUrl || 'default',
|
|
26
|
+
wallet: config.wallet?.type || 'env',
|
|
27
|
+
});
|
|
28
|
+
console.log();
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
(0, display_1.error)(`Failed to load config: ${err}`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
// plob config set <key> <value>
|
|
36
|
+
cmd
|
|
37
|
+
.command('set')
|
|
38
|
+
.description('Set a configuration value')
|
|
39
|
+
.argument('<key>', 'Configuration key (network, rpcUrl, indexerUrl)')
|
|
40
|
+
.argument('<value>', 'Configuration value')
|
|
41
|
+
.action(async (key, value) => {
|
|
42
|
+
try {
|
|
43
|
+
const validKeys = ['network', 'rpcUrl', 'indexerUrl'];
|
|
44
|
+
if (!validKeys.includes(key)) {
|
|
45
|
+
(0, display_1.error)(`Invalid config key: ${key}`);
|
|
46
|
+
console.log(`Valid keys: ${validKeys.join(', ')}`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
if (key === 'network' && !['mainnet', 'sepolia'].includes(value)) {
|
|
50
|
+
(0, display_1.error)('Network must be "mainnet" or "sepolia"');
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
const config = (0, config_1.loadConfig)();
|
|
54
|
+
config[key] = value;
|
|
55
|
+
(0, config_1.saveConfig)(config);
|
|
56
|
+
(0, display_1.success)(`Set ${key} = ${value}`);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
(0, display_1.error)(`Failed to set config: ${err}`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
// plob config reset
|
|
64
|
+
cmd
|
|
65
|
+
.command('reset')
|
|
66
|
+
.description('Reset configuration to defaults')
|
|
67
|
+
.action(async () => {
|
|
68
|
+
try {
|
|
69
|
+
(0, config_1.clearConfig)();
|
|
70
|
+
(0, display_1.success)('Configuration reset to defaults');
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
(0, display_1.error)(`Failed to reset config: ${err}`);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return cmd;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/commands/config.ts"],"names":[],"mappings":";;AAKA,kDA8EC;AAnFD,yCAAoC;AACpC,0CAAoE;AACpE,4CAAwF;AAGxF,SAAgB,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;SAC9B,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAE3C,mBAAmB;IACnB,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,4BAA4B,CAAC;SACzC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,OAAsB,EAAE,EAAE;QACvC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;YAE5B,IAAI,IAAA,oBAAU,EAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;gBAChC,OAAO;YACT,CAAC;YAED,OAAO,CAAC,GAA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,eAAK,EAAC,wCAAwC,CAAC,CAAC;gBAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;YAC3B,MAAc,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC7B,IAAA,mBAAU,EAAC,MAAM,CAAC,CAAC;YAEnB,IAAA,iBAAO,EAAC,OAAO,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAA,eAAK,EAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,oBAAoB;IACpB,GAAG;SACA,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,iCAAiC,CAAC;SAC9C,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,IAAA,oBAAW,GAAE,CAAC;YACd,IAAA,iBAAO,EAAC,iCAAiC,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAA,eAAK,EAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../../../src/commands/escrow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,mBAAmB,IAAI,OAAO,CAuN7C"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEscrowCommand = createEscrowCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const contracts_1 = require("../lib/contracts");
|
|
6
|
+
const wallet_1 = require("../lib/wallet");
|
|
7
|
+
const display_1 = require("../lib/display");
|
|
8
|
+
function createEscrowCommand() {
|
|
9
|
+
const cmd = new commander_1.Command('escrow')
|
|
10
|
+
.description('Manage escrows');
|
|
11
|
+
// plob escrow create
|
|
12
|
+
cmd
|
|
13
|
+
.command('create')
|
|
14
|
+
.description('Create a new escrow')
|
|
15
|
+
.requiredOption('--to <address>', 'Recipient address')
|
|
16
|
+
.requiredOption('--amount <amount>', 'Amount in USDC')
|
|
17
|
+
.option('--description <desc>', 'Escrow description', 'Payment via PayLobster CLI')
|
|
18
|
+
.option('--json', 'Output as JSON')
|
|
19
|
+
.action(async (options) => {
|
|
20
|
+
try {
|
|
21
|
+
// Validate address format
|
|
22
|
+
if (!options.to.startsWith('0x') || options.to.length !== 42) {
|
|
23
|
+
(0, display_1.error)('Invalid recipient address format');
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
// Validate amount
|
|
27
|
+
const amount = parseFloat(options.amount);
|
|
28
|
+
if (isNaN(amount) || amount <= 0) {
|
|
29
|
+
(0, display_1.error)('Invalid amount. Must be a positive number');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
(0, display_1.info)(`Creating escrow for ${options.amount} USDC to ${(0, display_1.formatAddress)(options.to)}`);
|
|
33
|
+
const txHash = await (0, display_1.withSpinner)('Creating escrow (approving USDC + creating escrow)...', async () => {
|
|
34
|
+
return await (0, contracts_1.createEscrow)(options.to, options.amount, options.description);
|
|
35
|
+
});
|
|
36
|
+
if ((0, display_1.outputJSON)({
|
|
37
|
+
txHash: txHash.toString(),
|
|
38
|
+
to: options.to,
|
|
39
|
+
amount: options.amount,
|
|
40
|
+
description: options.description,
|
|
41
|
+
}, options)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
(0, display_1.success)('Escrow created successfully!');
|
|
45
|
+
(0, display_1.info)(`Transaction: ${txHash.toString()}`);
|
|
46
|
+
(0, display_1.info)(`Recipient: ${options.to}`);
|
|
47
|
+
(0, display_1.info)(`Amount: ${options.amount} USDC`);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
(0, display_1.error)(`Failed to create escrow: ${err}`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
// plob escrow list
|
|
55
|
+
cmd
|
|
56
|
+
.command('list')
|
|
57
|
+
.description('List your escrows')
|
|
58
|
+
.option('--json', 'Output as JSON')
|
|
59
|
+
.action(async (options) => {
|
|
60
|
+
try {
|
|
61
|
+
const address = (0, wallet_1.getWalletAddress)();
|
|
62
|
+
const count = await (0, contracts_1.getUserEscrowCount)(address);
|
|
63
|
+
if (count === 0) {
|
|
64
|
+
(0, display_1.info)('No escrows found');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
(0, display_1.info)(`Total escrows: ${count}`);
|
|
68
|
+
// Fetch details for each escrow
|
|
69
|
+
// Note: This is a simplified implementation. In production, you'd want pagination
|
|
70
|
+
// or fetch from an indexer
|
|
71
|
+
const escrows = [];
|
|
72
|
+
for (let i = 0; i < Math.min(count, 10); i++) {
|
|
73
|
+
try {
|
|
74
|
+
const escrowData = await (0, contracts_1.getEscrow)(BigInt(i));
|
|
75
|
+
escrows.push({
|
|
76
|
+
id: i,
|
|
77
|
+
from: escrowData.sender,
|
|
78
|
+
to: escrowData.recipient,
|
|
79
|
+
amount: (0, contracts_1.formatUSDC)(escrowData.amount) + ' USDC',
|
|
80
|
+
status: escrowData.status,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
// Skip if can't fetch
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if ((0, display_1.outputJSON)(escrows, options)) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
(0, display_1.printEscrowTable)(escrows);
|
|
91
|
+
if (count > 10) {
|
|
92
|
+
(0, display_1.info)(`Showing first 10 of ${count} escrows`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
(0, display_1.error)(`Failed to list escrows: ${err}`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
// plob escrow get
|
|
101
|
+
cmd
|
|
102
|
+
.command('get')
|
|
103
|
+
.description('Get escrow details')
|
|
104
|
+
.argument('<id>', 'Escrow ID')
|
|
105
|
+
.option('--json', 'Output as JSON')
|
|
106
|
+
.action(async (id, options) => {
|
|
107
|
+
try {
|
|
108
|
+
const escrowId = BigInt(id);
|
|
109
|
+
const escrow = await (0, contracts_1.getEscrow)(escrowId);
|
|
110
|
+
if ((0, display_1.outputJSON)({
|
|
111
|
+
id: id,
|
|
112
|
+
sender: escrow.sender,
|
|
113
|
+
recipient: escrow.recipient,
|
|
114
|
+
amount: (0, contracts_1.formatUSDC)(escrow.amount),
|
|
115
|
+
token: escrow.token,
|
|
116
|
+
status: escrow.status,
|
|
117
|
+
}, options)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
console.log();
|
|
121
|
+
console.log('Escrow ID: ', id);
|
|
122
|
+
console.log('From: ', escrow.sender);
|
|
123
|
+
console.log('To: ', escrow.recipient);
|
|
124
|
+
console.log('Amount: ', (0, contracts_1.formatUSDC)(escrow.amount), 'USDC');
|
|
125
|
+
console.log('Token: ', escrow.token);
|
|
126
|
+
console.log('Status: ', (0, display_1.formatStatus)(escrow.status));
|
|
127
|
+
console.log();
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
(0, display_1.error)(`Failed to get escrow: ${err}`);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
// plob escrow release
|
|
135
|
+
cmd
|
|
136
|
+
.command('release')
|
|
137
|
+
.description('Release an escrow')
|
|
138
|
+
.argument('<id>', 'Escrow ID')
|
|
139
|
+
.option('--yes', 'Skip confirmation')
|
|
140
|
+
.option('--json', 'Output as JSON')
|
|
141
|
+
.action(async (id, options) => {
|
|
142
|
+
try {
|
|
143
|
+
const escrowId = BigInt(id);
|
|
144
|
+
// Get escrow details
|
|
145
|
+
const escrow = await (0, contracts_1.getEscrow)(escrowId);
|
|
146
|
+
// Verify sender
|
|
147
|
+
const address = (0, wallet_1.getWalletAddress)();
|
|
148
|
+
if (escrow.sender.toLowerCase() !== address.toLowerCase()) {
|
|
149
|
+
(0, display_1.error)('You are not the sender of this escrow');
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
// Check status
|
|
153
|
+
if (escrow.status !== 1) { // 1 = active
|
|
154
|
+
(0, display_1.error)(`Escrow is not active (status: ${(0, display_1.formatStatus)(escrow.status)})`);
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
// Confirm
|
|
158
|
+
if (!options.yes) {
|
|
159
|
+
console.log();
|
|
160
|
+
console.log('Escrow details:');
|
|
161
|
+
console.log(' ID: ', id);
|
|
162
|
+
console.log(' To: ', escrow.recipient);
|
|
163
|
+
console.log(' Amount: ', (0, contracts_1.formatUSDC)(escrow.amount), 'USDC');
|
|
164
|
+
console.log();
|
|
165
|
+
const confirmed = await (0, display_1.confirm)('Release this escrow?');
|
|
166
|
+
if (!confirmed) {
|
|
167
|
+
(0, display_1.info)('Cancelled');
|
|
168
|
+
process.exit(0);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const txHash = await (0, display_1.withSpinner)('Releasing escrow...', async () => {
|
|
172
|
+
return await (0, contracts_1.releaseEscrow)(escrowId);
|
|
173
|
+
});
|
|
174
|
+
if ((0, display_1.outputJSON)({
|
|
175
|
+
txHash,
|
|
176
|
+
escrowId: id,
|
|
177
|
+
released: (0, contracts_1.formatUSDC)(escrow.amount),
|
|
178
|
+
}, options)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
(0, display_1.success)('Escrow released successfully!');
|
|
182
|
+
(0, display_1.info)(`Transaction: ${txHash}`);
|
|
183
|
+
(0, display_1.info)(`Released: ${(0, contracts_1.formatUSDC)(escrow.amount)} USDC`);
|
|
184
|
+
(0, display_1.info)(`Recipient: ${escrow.recipient}`);
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
(0, display_1.error)(`Failed to release escrow: ${err}`);
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
return cmd;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=escrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow.js","sourceRoot":"","sources":["../../../src/commands/escrow.ts"],"names":[],"mappings":";;AAMA,kDAuNC;AA7ND,yCAAoC;AACpC,gDAA0G;AAC1G,0CAAiD;AACjD,4CAAuI;AAGvI,SAAgB,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;SAC9B,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAEjC,qBAAqB;IACrB,GAAG;SACA,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,qBAAqB,CAAC;SAClC,cAAc,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;SACrD,cAAc,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;SACrD,MAAM,CAAC,sBAAsB,EAAE,oBAAoB,EAAE,4BAA4B,CAAC;SAClF,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,OAA4E,EAAE,EAAE;QAC7F,IAAI,CAAC;YACH,0BAA0B;YAC1B,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;gBAC7D,IAAA,eAAK,EAAC,kCAAkC,CAA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EAAC;gBACb,MAAM;gBACN,QAAQ,EAAE,EAAE;gBACZ,QAAQ,EAAE,IAAA,sBAAU,EAAC,MAAM,CAAC,MAAM,CAAC;aACpC,EAAE,OAAO,CAAC,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YAED,IAAA,iBAAO,EAAC,+BAA+B,CAAC,CAAC;YACzC,IAAA,cAAI,EAAC,gBAAgB,MAAM,EAAE,CAAC,CAAC;YAC/B,IAAA,cAAI,EAAC,aAAa,IAAA,sBAAU,EAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACpD,IAAA,cAAI,EAAC,cAAc,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAA,eAAK,EAAC,6BAA6B,GAAG,EAAE,CAAC,CAAC;YAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Mandate commands
|
|
4
|
+
* Note: Full mandate implementation requires additional contract functions
|
|
5
|
+
* This is a placeholder for future implementation
|
|
6
|
+
*/
|
|
7
|
+
export declare function createMandateCommand(): Command;
|
|
8
|
+
//# sourceMappingURL=mandate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mandate.d.ts","sourceRoot":"","sources":["../../../src/commands/mandate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CA+C9C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMandateCommand = createMandateCommand;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const display_1 = require("../lib/display");
|
|
6
|
+
/**
|
|
7
|
+
* Mandate commands
|
|
8
|
+
* Note: Full mandate implementation requires additional contract functions
|
|
9
|
+
* This is a placeholder for future implementation
|
|
10
|
+
*/
|
|
11
|
+
function createMandateCommand() {
|
|
12
|
+
const cmd = new commander_1.Command('mandate')
|
|
13
|
+
.description('Manage payment mandates (coming soon)');
|
|
14
|
+
cmd
|
|
15
|
+
.command('create')
|
|
16
|
+
.description('Create a new mandate')
|
|
17
|
+
.option('--agent <address>', 'Agent address')
|
|
18
|
+
.option('--limit <amount>', 'Spending limit in USDC')
|
|
19
|
+
.option('--duration <days>', 'Duration in days')
|
|
20
|
+
.action(async () => {
|
|
21
|
+
(0, display_1.warning)('Mandate creation is not yet implemented');
|
|
22
|
+
(0, display_1.info)('This feature will be available in a future update');
|
|
23
|
+
console.log();
|
|
24
|
+
console.log('Mandates allow you to delegate spending permissions to agents');
|
|
25
|
+
console.log('with configurable limits and time restrictions.');
|
|
26
|
+
console.log();
|
|
27
|
+
});
|
|
28
|
+
cmd
|
|
29
|
+
.command('list')
|
|
30
|
+
.description('List your mandates')
|
|
31
|
+
.action(async () => {
|
|
32
|
+
(0, display_1.warning)('Mandate listing is not yet implemented');
|
|
33
|
+
(0, display_1.info)('This feature will be available in a future update');
|
|
34
|
+
});
|
|
35
|
+
cmd
|
|
36
|
+
.command('revoke')
|
|
37
|
+
.description('Revoke a mandate')
|
|
38
|
+
.argument('<id>', 'Mandate ID')
|
|
39
|
+
.action(async () => {
|
|
40
|
+
(0, display_1.warning)('Mandate revocation is not yet implemented');
|
|
41
|
+
(0, display_1.info)('This feature will be available in a future update');
|
|
42
|
+
});
|
|
43
|
+
cmd
|
|
44
|
+
.command('adjust')
|
|
45
|
+
.description('Adjust mandate limits')
|
|
46
|
+
.argument('<id>', 'Mandate ID')
|
|
47
|
+
.option('--limit <amount>', 'New spending limit')
|
|
48
|
+
.action(async () => {
|
|
49
|
+
(0, display_1.warning)('Mandate adjustment is not yet implemented');
|
|
50
|
+
(0, display_1.info)('This feature will be available in a future update');
|
|
51
|
+
});
|
|
52
|
+
return cmd;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=mandate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mandate.js","sourceRoot":"","sources":["../../../src/commands/mandate.ts"],"names":[],"mappings":";;AAQA,oDA+CC;AAvDD,yCAAoC;AACpC,4CAAsD;AAEtD;;;;GAIG;AACH,SAAgB,oBAAoB;IAClC,MAAM,GAAG,GAAG,IAAI,mBAAO,CAAC,SAAS,CAAC;SAC/B,WAAW,CAAC,uCAAuC,CAAC,CAAC;IAExD,GAAG;SACA,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC;SAC5C,MAAM,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;SACpD,MAAM,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;SAC/C,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAA,iBAAO,EAAC,yCAAyC,CAAC,CAAC;QACnD,IAAA,cAAI,EAAC,mDAAmD,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;QAC/D,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEL,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oBAAoB,CAAC;SACjC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAA,iBAAO,EAAC,wCAAwC,CAAC,CAAC;QAClD,IAAA,cAAI,EAAC,mDAAmD,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEL,GAAG;SACA,OAAO,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