@clawcard/cli 3.0.18 → 3.0.22
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/package.json +1 -1
- package/src/commands/agent.js +33 -10
- package/src/commands/setup.js +27 -1
- package/src/index.js +2 -0
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -53,24 +53,36 @@ export async function agentInfoCmd(options) {
|
|
|
53
53
|
try {
|
|
54
54
|
wallet = await getWallet(me.keyId);
|
|
55
55
|
} catch {
|
|
56
|
-
// No wallet
|
|
56
|
+
// No wallet
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let identity = null;
|
|
60
|
+
try {
|
|
61
|
+
identity = await getOnChainIdentity(me.keyId);
|
|
62
|
+
} catch {
|
|
63
|
+
// No identity
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
console.log();
|
|
60
|
-
console.log(` Name:
|
|
61
|
-
console.log(` Email:
|
|
62
|
-
console.log(` Phone:
|
|
67
|
+
console.log(` Name: ${orange.bold(me.name || "unnamed")}`);
|
|
68
|
+
console.log(` Email: ${me.email || "-"}`);
|
|
69
|
+
console.log(` Phone: ${me.phone || "-"}`);
|
|
63
70
|
if (wallet) {
|
|
64
|
-
console.log(` Wallet:
|
|
65
|
-
console.log(` USDC:
|
|
71
|
+
console.log(` Wallet: ${orange(wallet.address)} ${chalk.dim("(Base)")}`);
|
|
72
|
+
console.log(` USDC: ${chalk.green(wallet.balanceUsdc + " USDC")}`);
|
|
66
73
|
if (wallet.balanceEth) {
|
|
67
|
-
console.log(` ETH:
|
|
74
|
+
console.log(` ETH: ${chalk.dim(wallet.balanceEth + " ETH (gas)")}`);
|
|
68
75
|
}
|
|
69
76
|
} else {
|
|
70
|
-
console.log(` Wallet:
|
|
77
|
+
console.log(` Wallet: ${chalk.dim("none — run: clawcard agent wallet")}`);
|
|
71
78
|
}
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
if (identity && identity.walletAddress) {
|
|
80
|
+
console.log(` Identity: ${chalk.green("verified")} ${chalk.dim("ERC-8004 on Base")}`);
|
|
81
|
+
} else {
|
|
82
|
+
console.log(` Identity: ${chalk.dim("not registered — run: clawcard agent identity")}`);
|
|
83
|
+
}
|
|
84
|
+
console.log(` Key ID: ${chalk.dim(me.keyId)}`);
|
|
85
|
+
console.log(` Budget: ${chalk.green("$" + ((budget.budgetCents || 0) / 100).toFixed(2))}`);
|
|
74
86
|
console.log();
|
|
75
87
|
}
|
|
76
88
|
|
|
@@ -421,6 +433,8 @@ export async function agentWalletCmd(options) {
|
|
|
421
433
|
console.log(` ETH: ${chalk.dim((wallet.balanceEth || "0.000000") + " ETH (gas)")}`);
|
|
422
434
|
console.log(` Status: ${wallet.status}`);
|
|
423
435
|
console.log();
|
|
436
|
+
console.log(chalk.dim(` Docs: https://clawcard.sh/docs#wallet`));
|
|
437
|
+
console.log();
|
|
424
438
|
return;
|
|
425
439
|
} catch (err) {
|
|
426
440
|
// No wallet — prompt to create
|
|
@@ -524,6 +538,15 @@ export async function agentWalletSendCmd(options) {
|
|
|
524
538
|
} else if (options.url) {
|
|
525
539
|
data.url = options.url;
|
|
526
540
|
if (options.protocol) data.protocol = options.protocol;
|
|
541
|
+
if (options.method) data.method = options.method;
|
|
542
|
+
if (options.body) {
|
|
543
|
+
try {
|
|
544
|
+
data.body = JSON.parse(options.body);
|
|
545
|
+
} catch {
|
|
546
|
+
console.log(" Error: --body must be valid JSON");
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
527
550
|
}
|
|
528
551
|
|
|
529
552
|
if (options.memo) data.memo = options.memo;
|
package/src/commands/setup.js
CHANGED
|
@@ -151,7 +151,33 @@ export async function setupCommand() {
|
|
|
151
151
|
s3.stop("Wallet setup skipped");
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
// Step 7:
|
|
154
|
+
// Step 7: Register on-chain identity (if doesn't exist)
|
|
155
|
+
const s5 = p.spinner();
|
|
156
|
+
s5.start("Setting up on-chain identity...");
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
const { getOnChainIdentity, registerOnChainIdentity } = await import("../agent-api.js");
|
|
160
|
+
try {
|
|
161
|
+
const existing = await getOnChainIdentity(selectedKey.id);
|
|
162
|
+
if (existing && existing.walletAddress) {
|
|
163
|
+
s5.stop(`Identity ready: ${chalk.dim("ERC-8004 on Base")}`);
|
|
164
|
+
} else {
|
|
165
|
+
throw new Error("not found");
|
|
166
|
+
}
|
|
167
|
+
} catch {
|
|
168
|
+
// No identity — register one
|
|
169
|
+
try {
|
|
170
|
+
await registerOnChainIdentity(selectedKey.id, {});
|
|
171
|
+
s5.stop(`Identity registered: ${orange("ERC-8004 on Base")}`);
|
|
172
|
+
} catch {
|
|
173
|
+
s5.stop("Identity setup skipped (can register later with: clawcard agent identity)");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
} catch {
|
|
177
|
+
s5.stop("Identity setup skipped");
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Step 8: Summary
|
|
155
181
|
p.log.success("Your agent is ready to use ClawCard!");
|
|
156
182
|
p.log.info(
|
|
157
183
|
[
|
package/src/index.js
CHANGED
|
@@ -231,6 +231,8 @@ agentWallet
|
|
|
231
231
|
.option("--amount <usdc>", "Amount in USDC (e.g., 5.00)")
|
|
232
232
|
.option("--url <url>", "URL to pay for access (x402 or MPP)")
|
|
233
233
|
.option("--protocol <protocol>", "Payment protocol: x402 (default) or mpp")
|
|
234
|
+
.option("--method <method>", "HTTP method for URL payments: GET (default) or POST")
|
|
235
|
+
.option("--body <json>", "JSON body for POST requests")
|
|
234
236
|
.option("--memo <memo>", "Optional memo")
|
|
235
237
|
.option("--json", "Output as JSON")
|
|
236
238
|
.action(async (options) => {
|