arc402-cli 0.3.4 → 0.4.1

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 (145) hide show
  1. package/dist/commands/accept.d.ts.map +1 -1
  2. package/dist/commands/accept.js +17 -7
  3. package/dist/commands/accept.js.map +1 -1
  4. package/dist/commands/agent-handshake.d.ts.map +1 -1
  5. package/dist/commands/agent-handshake.js +9 -4
  6. package/dist/commands/agent-handshake.js.map +1 -1
  7. package/dist/commands/agent.d.ts.map +1 -1
  8. package/dist/commands/agent.js +14 -8
  9. package/dist/commands/agent.js.map +1 -1
  10. package/dist/commands/agreements.d.ts.map +1 -1
  11. package/dist/commands/agreements.js +51 -26
  12. package/dist/commands/agreements.js.map +1 -1
  13. package/dist/commands/arbitrator.d.ts.map +1 -1
  14. package/dist/commands/arbitrator.js +77 -20
  15. package/dist/commands/arbitrator.js.map +1 -1
  16. package/dist/commands/arena-handshake.d.ts.map +1 -1
  17. package/dist/commands/arena-handshake.js +14 -11
  18. package/dist/commands/arena-handshake.js.map +1 -1
  19. package/dist/commands/arena.d.ts.map +1 -1
  20. package/dist/commands/arena.js +4 -3
  21. package/dist/commands/arena.js.map +1 -1
  22. package/dist/commands/cancel.d.ts.map +1 -1
  23. package/dist/commands/cancel.js +20 -10
  24. package/dist/commands/cancel.js.map +1 -1
  25. package/dist/commands/channel.d.ts.map +1 -1
  26. package/dist/commands/channel.js +27 -17
  27. package/dist/commands/channel.js.map +1 -1
  28. package/dist/commands/coldstart.d.ts.map +1 -1
  29. package/dist/commands/coldstart.js +33 -22
  30. package/dist/commands/coldstart.js.map +1 -1
  31. package/dist/commands/config.d.ts.map +1 -1
  32. package/dist/commands/config.js +34 -17
  33. package/dist/commands/config.js.map +1 -1
  34. package/dist/commands/daemon.d.ts.map +1 -1
  35. package/dist/commands/daemon.js +44 -37
  36. package/dist/commands/daemon.js.map +1 -1
  37. package/dist/commands/deliver.d.ts.map +1 -1
  38. package/dist/commands/deliver.js +16 -3
  39. package/dist/commands/deliver.js.map +1 -1
  40. package/dist/commands/discover.d.ts.map +1 -1
  41. package/dist/commands/discover.js +2 -0
  42. package/dist/commands/discover.js.map +1 -1
  43. package/dist/commands/dispute.d.ts.map +1 -1
  44. package/dist/commands/dispute.js +11 -10
  45. package/dist/commands/dispute.js.map +1 -1
  46. package/dist/commands/endpoint.d.ts.map +1 -1
  47. package/dist/commands/endpoint.js +4 -3
  48. package/dist/commands/endpoint.js.map +1 -1
  49. package/dist/commands/feed.d.ts.map +1 -1
  50. package/dist/commands/feed.js.map +1 -1
  51. package/dist/commands/hire.d.ts.map +1 -1
  52. package/dist/commands/hire.js +15 -2
  53. package/dist/commands/hire.js.map +1 -1
  54. package/dist/commands/migrate.d.ts.map +1 -1
  55. package/dist/commands/migrate.js +29 -29
  56. package/dist/commands/migrate.js.map +1 -1
  57. package/dist/commands/negotiate.d.ts.map +1 -1
  58. package/dist/commands/negotiate.js +8 -7
  59. package/dist/commands/negotiate.js.map +1 -1
  60. package/dist/commands/openshell.d.ts.map +1 -1
  61. package/dist/commands/openshell.js +6 -5
  62. package/dist/commands/openshell.js.map +1 -1
  63. package/dist/commands/owner.d.ts.map +1 -1
  64. package/dist/commands/owner.js +7 -2
  65. package/dist/commands/owner.js.map +1 -1
  66. package/dist/commands/policy.d.ts.map +1 -1
  67. package/dist/commands/policy.js +22 -10
  68. package/dist/commands/policy.js.map +1 -1
  69. package/dist/commands/relay.d.ts.map +1 -1
  70. package/dist/commands/relay.js +6 -5
  71. package/dist/commands/relay.js.map +1 -1
  72. package/dist/commands/remediate.d.ts.map +1 -1
  73. package/dist/commands/remediate.js +3 -2
  74. package/dist/commands/remediate.js.map +1 -1
  75. package/dist/commands/reputation.d.ts.map +1 -1
  76. package/dist/commands/reputation.js +12 -5
  77. package/dist/commands/reputation.js.map +1 -1
  78. package/dist/commands/trust.d.ts.map +1 -1
  79. package/dist/commands/trust.js +16 -1
  80. package/dist/commands/trust.js.map +1 -1
  81. package/dist/commands/verify.d.ts.map +1 -1
  82. package/dist/commands/verify.js +6 -4
  83. package/dist/commands/verify.js.map +1 -1
  84. package/dist/commands/wallet.d.ts.map +1 -1
  85. package/dist/commands/wallet.js +217 -170
  86. package/dist/commands/wallet.js.map +1 -1
  87. package/dist/commands/watch.d.ts +3 -0
  88. package/dist/commands/watch.d.ts.map +1 -0
  89. package/dist/commands/watch.js +23 -0
  90. package/dist/commands/watch.js.map +1 -0
  91. package/dist/commands/watchtower.d.ts.map +1 -1
  92. package/dist/commands/watchtower.js +30 -13
  93. package/dist/commands/watchtower.js.map +1 -1
  94. package/dist/commands/workroom.d.ts.map +1 -1
  95. package/dist/commands/workroom.js +123 -95
  96. package/dist/commands/workroom.js.map +1 -1
  97. package/dist/config.d.ts.map +1 -1
  98. package/dist/config.js +16 -2
  99. package/dist/config.js.map +1 -1
  100. package/dist/index.js +73 -38
  101. package/dist/index.js.map +1 -1
  102. package/dist/ui/banner.d.ts.map +1 -1
  103. package/dist/ui/banner.js +4 -2
  104. package/dist/ui/banner.js.map +1 -1
  105. package/dist/ui/tree.d.ts +7 -0
  106. package/dist/ui/tree.d.ts.map +1 -0
  107. package/dist/ui/tree.js +13 -0
  108. package/dist/ui/tree.js.map +1 -0
  109. package/package.json +1 -1
  110. package/src/commands/accept.ts +19 -10
  111. package/src/commands/agent-handshake.ts +9 -4
  112. package/src/commands/agent.ts +15 -6
  113. package/src/commands/agreements.ts +51 -25
  114. package/src/commands/arbitrator.ts +71 -20
  115. package/src/commands/arena-handshake.ts +15 -8
  116. package/src/commands/arena.ts +4 -3
  117. package/src/commands/cancel.ts +19 -10
  118. package/src/commands/channel.ts +27 -17
  119. package/src/commands/coldstart.ts +29 -20
  120. package/src/commands/config.ts +34 -17
  121. package/src/commands/daemon.ts +45 -38
  122. package/src/commands/deliver.ts +16 -3
  123. package/src/commands/discover.ts +2 -0
  124. package/src/commands/dispute.ts +12 -10
  125. package/src/commands/endpoint.ts +4 -3
  126. package/src/commands/feed.ts +1 -0
  127. package/src/commands/hire.ts +17 -2
  128. package/src/commands/migrate.ts +28 -26
  129. package/src/commands/negotiate.ts +8 -7
  130. package/src/commands/openshell.ts +7 -5
  131. package/src/commands/owner.ts +7 -2
  132. package/src/commands/policy.ts +21 -10
  133. package/src/commands/relay.ts +6 -5
  134. package/src/commands/remediate.ts +4 -2
  135. package/src/commands/reputation.ts +13 -5
  136. package/src/commands/trust.ts +13 -1
  137. package/src/commands/verify.ts +7 -4
  138. package/src/commands/wallet.ts +218 -170
  139. package/src/commands/watch.ts +23 -0
  140. package/src/commands/watchtower.ts +29 -13
  141. package/src/commands/workroom.ts +121 -95
  142. package/src/config.ts +16 -2
  143. package/src/index.ts +43 -3
  144. package/src/ui/banner.ts +5 -2
  145. package/src/ui/tree.ts +16 -0
@@ -22,6 +22,9 @@ const walletconnect_session_1 = require("../walletconnect-session");
22
22
  const wallet_router_1 = require("../wallet-router");
23
23
  const coinbase_smart_wallet_1 = require("../coinbase-smart-wallet");
24
24
  const telegram_notify_1 = require("../telegram-notify");
25
+ const tree_1 = require("../ui/tree");
26
+ const spinner_1 = require("../ui/spinner");
27
+ const colors_1 = require("../ui/colors");
25
28
  const POLICY_ENGINE_DEFAULT = "0x44102e70c2A366632d98Fe40d892a2501fC7fFF2";
26
29
  function parseAmount(raw) {
27
30
  const lower = raw.toLowerCase();
@@ -61,9 +64,9 @@ async function runWalletOnboardingCeremony(walletAddress, ownerAddress, config,
61
64
  alreadyDefiEnabled = await policyGov.defiAccessEnabled(walletAddress);
62
65
  }
63
66
  catch { /* assume not enabled */ }
64
- console.log("\n── Onboarding ceremony ────────────────────────────────────────");
65
- console.log(` PolicyEngine: ${policyAddress}`);
66
- console.log(` Wallet: ${walletAddress}`);
67
+ console.log("\n" + colors_1.c.dim("── Onboarding ceremony ────────────────────────────────────────"));
68
+ console.log(" " + colors_1.c.dim("PolicyEngine:") + " " + colors_1.c.white(policyAddress));
69
+ console.log(" " + colors_1.c.dim("Wallet: ") + " " + colors_1.c.white(walletAddress));
67
70
  // Step 1: registerWallet (if not already done)
68
71
  if (!alreadyRegistered) {
69
72
  const registerCalldata = govIface.encodeFunctionData("registerWallet", [walletAddress, ownerAddress]);
@@ -81,7 +84,7 @@ async function runWalletOnboardingCeremony(walletAddress, ownerAddress, config,
81
84
  }, "registerWallet on PolicyEngine");
82
85
  }
83
86
  else {
84
- console.log(" registerWallet — already done by constructor");
87
+ console.log(" " + colors_1.c.success + colors_1.c.dim(" registerWallet — already done by constructor"));
85
88
  }
86
89
  // Step 2: enableDefiAccess (if not already done)
87
90
  if (!alreadyDefiEnabled) {
@@ -92,7 +95,7 @@ async function runWalletOnboardingCeremony(walletAddress, ownerAddress, config,
92
95
  }, "enableDefiAccess on PolicyEngine");
93
96
  }
94
97
  else {
95
- console.log(" enableDefiAccess — already done by constructor");
98
+ console.log(" " + colors_1.c.success + colors_1.c.dim(" enableDefiAccess — already done by constructor"));
96
99
  }
97
100
  // Steps 3–6: category limits (always set — idempotent)
98
101
  for (const { name, amountEth } of ONBOARDING_CATEGORIES) {
@@ -106,10 +109,10 @@ async function runWalletOnboardingCeremony(walletAddress, ownerAddress, config,
106
109
  value: "0x0",
107
110
  }, `setCategoryLimitFor: ${name} → ${amountEth} ETH`);
108
111
  }
109
- console.log("── Onboarding complete ─────────────────────────────────────────");
110
- console.log("💡 Tip: For production security, also configure:");
111
- console.log(" arc402 wallet set-velocity-limit <eth> — wallet-level hourly ETH cap");
112
- console.log(" arc402 wallet policy set-daily-limit --category general --amount <eth> — daily per-category cap");
112
+ console.log(colors_1.c.dim("── Onboarding complete ─────────────────────────────────────────"));
113
+ console.log(colors_1.c.dim("Tip: For production security, also configure:"));
114
+ console.log(" " + colors_1.c.dim("arc402 wallet set-velocity-limit <eth> — wallet-level hourly ETH cap"));
115
+ console.log(" " + colors_1.c.dim("arc402 wallet policy set-daily-limit --category general --amount <eth> — daily per-category cap"));
113
116
  }
114
117
  function printOpenShellHint() {
115
118
  const r = (0, child_process_1.spawnSync)("which", ["openshell"], { encoding: "utf-8" });
@@ -165,13 +168,21 @@ function registerWalletCommands(program) {
165
168
  console.log(JSON.stringify(payload, null, 2));
166
169
  }
167
170
  else {
168
- console.log(`${payload.address}\nETH=${payload.ethBalance}\nUSDC=${payload.usdcBalance}\nTrust=${payload.trustScore} ${payload.trustTier}`);
171
+ const treeItems = [
172
+ { label: "Address", value: payload.address },
173
+ { label: "Network", value: payload.network },
174
+ { label: "ETH", value: payload.ethBalance + " ETH" },
175
+ { label: "USDC", value: payload.usdcBalance + " USDC" },
176
+ { label: "Trust", value: `${payload.trustScore} ${payload.trustTier}` },
177
+ ];
169
178
  if (payload.walletContractAddress)
170
- console.log(`Contract=${payload.walletContractAddress}`);
179
+ treeItems.push({ label: "Contract", value: payload.walletContractAddress });
171
180
  if (contractFrozen !== null)
172
- console.log(`Frozen=${contractFrozen}`);
181
+ treeItems.push({ label: "Frozen", value: contractFrozen ? colors_1.c.red("YES") : colors_1.c.green("no") });
173
182
  if (contractGuardian && contractGuardian !== ethers_1.ethers.ZeroAddress)
174
- console.log(`Guardian=${contractGuardian}`);
183
+ treeItems.push({ label: "Guardian", value: contractGuardian });
184
+ treeItems[treeItems.length - 1].last = true;
185
+ (0, tree_1.renderTree)(treeItems);
175
186
  }
176
187
  });
177
188
  // ─── wc-reset ──────────────────────────────────────────────────────────────
@@ -203,7 +214,7 @@ function registerWalletCommands(program) {
203
214
  console.log(JSON.stringify({ ok: false, error: `Could not delete ${wcStoragePath}: ${msg}` }));
204
215
  }
205
216
  else {
206
- console.warn(`⚠ Could not delete ${wcStoragePath}: ${msg}`);
217
+ console.warn(" " + colors_1.c.warning + " " + colors_1.c.yellow(`Could not delete ${wcStoragePath}: ${msg}`));
207
218
  console.warn(" You may need to delete it manually.");
208
219
  }
209
220
  return;
@@ -212,12 +223,12 @@ function registerWalletCommands(program) {
212
223
  console.log(JSON.stringify({ ok: true, hadSession, storageWiped }));
213
224
  }
214
225
  else {
215
- console.log(" WalletConnect session cleared");
226
+ console.log(" " + colors_1.c.success + colors_1.c.white(" WalletConnect session cleared"));
216
227
  if (storageWiped)
217
- console.log(` Storage wiped: ${wcStoragePath}`);
228
+ console.log(" " + colors_1.c.dim("Storage wiped:") + " " + colors_1.c.white(wcStoragePath));
218
229
  else
219
- console.log(" (No storage file found — already clean)");
220
- console.log("\nNext: run any wallet command and scan the fresh QR code.");
230
+ console.log(" " + colors_1.c.dim("(No storage file found — already clean)"));
231
+ console.log("\n" + colors_1.c.dim("Next: run any wallet command and scan the fresh QR code."));
221
232
  }
222
233
  });
223
234
  // ─── new ───────────────────────────────────────────────────────────────────
@@ -240,9 +251,11 @@ function registerWalletCommands(program) {
240
251
  walletFactoryAddress: defaults.walletFactoryAddress,
241
252
  };
242
253
  (0, config_1.saveConfig)(config);
243
- console.log(`Address: ${generated.address}`);
244
- console.log(`Config saved to ${(0, config_1.getConfigPath)()}`);
245
- console.log(`Next: fund your wallet with ETH, then run: arc402 wallet deploy`);
254
+ (0, tree_1.renderTree)([
255
+ { label: "Address", value: generated.address },
256
+ { label: "Config", value: (0, config_1.getConfigPath)(), last: true },
257
+ ]);
258
+ console.log(colors_1.c.dim("Next: fund your wallet with ETH, then run: arc402 wallet deploy"));
246
259
  });
247
260
  // ─── import ────────────────────────────────────────────────────────────────
248
261
  wallet.command("import <privateKey>")
@@ -271,9 +284,11 @@ function registerWalletCommands(program) {
271
284
  walletFactoryAddress: defaults.walletFactoryAddress,
272
285
  };
273
286
  (0, config_1.saveConfig)(config);
274
- console.log(`Address: ${imported.address}`);
275
- console.log(`Config saved to ${(0, config_1.getConfigPath)()}`);
276
- console.warn(`WARN: Store your private key safely anyone with it controls your wallet`);
287
+ (0, tree_1.renderTree)([
288
+ { label: "Address", value: imported.address },
289
+ { label: "Config", value: (0, config_1.getConfigPath)(), last: true },
290
+ ]);
291
+ console.warn(" " + colors_1.c.warning + " " + colors_1.c.yellow("Store your private key safely — anyone with it controls your wallet"));
277
292
  });
278
293
  // ─── fund ──────────────────────────────────────────────────────────────────
279
294
  wallet.command("fund")
@@ -308,7 +323,10 @@ function registerWalletCommands(program) {
308
323
  console.log(JSON.stringify({ address, balance: formatted, balanceWei: ethBalance.toString() }));
309
324
  }
310
325
  else {
311
- console.log(`Balance: ${formatted} ETH`);
326
+ (0, tree_1.renderTree)([
327
+ { label: "Address", value: address },
328
+ { label: "Balance", value: `${formatted} ETH`, last: true },
329
+ ]);
312
330
  }
313
331
  });
314
332
  // ─── list ──────────────────────────────────────────────────────────────────
@@ -479,16 +497,19 @@ function registerWalletCommands(program) {
479
497
  config.walletContractAddress = senderAddress;
480
498
  config.ownerAddress = ownerAddress;
481
499
  (0, config_1.saveConfig)(config);
482
- console.log(`\n ARC402Wallet deployed (sponsored) at: ${senderAddress}`);
483
- console.log("Gas sponsorship active — initial setup ops are free");
484
- console.log(`Owner: ${ownerAddress}`);
485
- console.log(`\n⚠ IMPORTANT: Onboarding ceremony was not run on this wallet.`);
486
- console.log(` Category spend limits have NOT been configured. All executeSpend and`);
487
- console.log(` executeTokenSpend calls will fail with "PolicyEngine: category not configured"`);
488
- console.log(` until you run governance setup manually via WalletConnect:`);
489
- console.log(`\n arc402 wallet governance setup`);
490
- console.log(`\n This must be done before making any spend from this wallet.`);
491
- console.log(`\nNext: arc402 wallet set-passkey <x> <y> --sponsored`);
500
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" ARC402Wallet deployed (sponsored)"));
501
+ (0, tree_1.renderTree)([
502
+ { label: "Wallet", value: senderAddress },
503
+ { label: "Owner", value: ownerAddress },
504
+ { label: "Gas", value: "Sponsorship active initial setup ops are free", last: true },
505
+ ]);
506
+ console.log(" " + colors_1.c.warning + " " + colors_1.c.yellow("IMPORTANT: Onboarding ceremony was not run on this wallet."));
507
+ console.log(colors_1.c.dim(" Category spend limits have NOT been configured. All executeSpend and"));
508
+ console.log(colors_1.c.dim(` executeTokenSpend calls will fail with "PolicyEngine: category not configured"`));
509
+ console.log(colors_1.c.dim(" until you run governance setup manually via WalletConnect:"));
510
+ console.log("\n" + colors_1.c.dim(" arc402 wallet governance setup"));
511
+ console.log("\n" + colors_1.c.dim(" This must be done before making any spend from this wallet."));
512
+ console.log("\n" + colors_1.c.dim("Next: arc402 wallet set-passkey <x> <y> --sponsored"));
492
513
  printOpenShellHint();
493
514
  }
494
515
  else if (opts.smartWallet) {
@@ -523,10 +544,13 @@ function registerWalletCommands(program) {
523
544
  config.walletContractAddress = walletAddress;
524
545
  config.ownerAddress = account;
525
546
  (0, config_1.saveConfig)(config);
526
- console.log(`ARC402Wallet deployed at: ${walletAddress}`);
527
- console.log(`Owner: ${account} (your Base Smart Wallet)`);
528
- console.log(`Your wallet contract is ready for policy enforcement`);
529
- console.log(`\nNext: run 'arc402 wallet set-guardian' to configure the emergency guardian key.`);
547
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" ARC402Wallet deployed"));
548
+ (0, tree_1.renderTree)([
549
+ { label: "Wallet", value: walletAddress },
550
+ { label: "Owner", value: account + colors_1.c.dim(" (Base Smart Wallet)"), last: true },
551
+ ]);
552
+ console.log(colors_1.c.dim("Your wallet contract is ready for policy enforcement"));
553
+ console.log(colors_1.c.dim("\nNext: run 'arc402 wallet set-guardian' to configure the emergency guardian key."));
530
554
  printOpenShellHint();
531
555
  }
532
556
  else if (config.walletConnectProjectId) {
@@ -537,7 +561,7 @@ function registerWalletCommands(program) {
537
561
  const { client, session, account } = await (0, walletconnect_1.connectPhoneWallet)(config.walletConnectProjectId, chainId, config, { telegramOpts, prompt: "Approve ARC402Wallet deployment — you will be set as owner", hardware: !!opts.hardware });
538
562
  const networkName = chainId === 8453 ? "Base" : "Base Sepolia";
539
563
  const shortAddr = `${account.slice(0, 6)}...${account.slice(-5)}`;
540
- console.log(`\n Connected: ${shortAddr} on ${networkName}`);
564
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Connected: ${shortAddr} on ${networkName}`));
541
565
  if (telegramOpts) {
542
566
  // Send "connected" message with a deploy confirmation button.
543
567
  // TODO: wire up full callback_data round-trip when a persistent bot process is available.
@@ -583,24 +607,27 @@ function registerWalletCommands(program) {
583
607
  config.walletContractAddress = walletAddress;
584
608
  config.ownerAddress = account;
585
609
  (0, config_1.saveConfig)(config);
586
- console.log(`\n ARC402Wallet deployed at: ${walletAddress}`);
587
- console.log(`Owner: ${account} (your phone wallet)`);
610
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" ARC402Wallet deployed"));
611
+ (0, tree_1.renderTree)([
612
+ { label: "Wallet", value: walletAddress },
613
+ { label: "Owner", value: account + colors_1.c.dim(" (phone wallet)"), last: true },
614
+ ]);
588
615
  // ── Mandatory onboarding ceremony (same WalletConnect session) ────────
589
616
  console.log("\nStarting mandatory onboarding ceremony in this WalletConnect session...");
590
617
  await runWalletOnboardingCeremony(walletAddress, account, config, provider, async (call, description) => {
591
- console.log(` Sending: ${description}`);
618
+ console.log(" " + colors_1.c.dim(`Sending: ${description}`));
592
619
  const hash = await (0, walletconnect_1.sendTransactionWithSession)(client, session, account, chainId, call);
593
620
  await provider.waitForTransaction(hash, 1);
594
- console.log(` ✓ ${description}: ${hash}`);
621
+ console.log(" " + colors_1.c.success + " " + colors_1.c.dim(description) + " " + colors_1.c.dim(hash));
595
622
  return hash;
596
623
  });
597
- console.log(`Your wallet contract is ready for policy enforcement`);
624
+ console.log(colors_1.c.dim("Your wallet contract is ready for policy enforcement"));
598
625
  const paymasterUrl2 = config.paymasterUrl ?? config_1.NETWORK_DEFAULTS[config.network]?.paymasterUrl;
599
626
  const deployedBalance = await provider.getBalance(walletAddress);
600
627
  if (paymasterUrl2 && deployedBalance < BigInt(1000000000000000)) {
601
- console.log("Gas sponsorship active — initial setup ops are free");
628
+ console.log(colors_1.c.dim("Gas sponsorship active — initial setup ops are free"));
602
629
  }
603
- console.log(`\nNext: run 'arc402 wallet set-guardian' to configure the emergency guardian key.`);
630
+ console.log(colors_1.c.dim("\nNext: run 'arc402 wallet set-guardian' to configure the emergency guardian key."));
604
631
  printOpenShellHint();
605
632
  }
606
633
  else {
@@ -608,7 +635,7 @@ function registerWalletCommands(program) {
608
635
  console.warn(" Run `arc402 config set walletConnectProjectId <id>` to enable phone wallet signing.");
609
636
  const { signer, address } = await (0, client_1.requireSigner)(config);
610
637
  const factory = new ethers_1.ethers.Contract(factoryAddress, abis_1.WALLET_FACTORY_ABI, signer);
611
- console.log(`Deploying ARC402Wallet via factory at ${factoryAddress}...`);
638
+ const deploySpinner = (0, spinner_1.startSpinner)(`Deploying ARC402Wallet via factory at ${factoryAddress}...`);
612
639
  const tx = await factory.createWallet("0x0000000071727De22E5E9d8BAf0edAc6f37da032");
613
640
  const receipt = await tx.wait();
614
641
  let walletAddress = null;
@@ -623,9 +650,10 @@ function registerWalletCommands(program) {
623
650
  catch { /* skip unparseable logs */ }
624
651
  }
625
652
  if (!walletAddress) {
626
- console.error("Could not find WalletCreated event in receipt. Check the transaction on-chain.");
653
+ deploySpinner.fail("Could not find WalletCreated event in receipt. Check the transaction on-chain.");
627
654
  process.exit(1);
628
655
  }
656
+ deploySpinner.succeed("Wallet deployed");
629
657
  // Generate guardian key (separate from hot key) and call setGuardian
630
658
  const guardianWallet = ethers_1.ethers.Wallet.createRandom();
631
659
  config.walletContractAddress = walletAddress;
@@ -640,14 +668,17 @@ function registerWalletCommands(program) {
640
668
  console.log("\nRunning mandatory onboarding ceremony...");
641
669
  const provider2 = new ethers_1.ethers.JsonRpcProvider(config.rpcUrl);
642
670
  await runWalletOnboardingCeremony(walletAddress, address, config, provider2, async (call, description) => {
643
- console.log(` Sending: ${description}`);
671
+ console.log(" " + colors_1.c.dim(`Sending: ${description}`));
644
672
  const tx2 = await signer.sendTransaction({ to: call.to, data: call.data, value: call.value === "0x0" ? 0n : BigInt(call.value) });
645
673
  await tx2.wait(1);
646
- console.log(` ✓ ${description}: ${tx2.hash}`);
674
+ console.log(" " + colors_1.c.success + " " + colors_1.c.dim(description) + " " + colors_1.c.dim(tx2.hash));
647
675
  return tx2.hash;
648
676
  });
649
- console.log(`ARC402Wallet deployed at: ${walletAddress}`);
650
- console.log(`Guardian key generated: ${guardianWallet.address}`);
677
+ console.log(` ${colors_1.c.success} ARC402Wallet deployed`);
678
+ (0, tree_1.renderTree)([
679
+ { label: "Wallet", value: walletAddress },
680
+ { label: "Guardian", value: guardianWallet.address, last: true },
681
+ ]);
651
682
  console.log(`Guardian private key saved to config (keep it safe — used for emergency freeze only)`);
652
683
  console.log(`Your wallet contract is ready for policy enforcement`);
653
684
  printOpenShellHint();
@@ -826,9 +857,9 @@ function registerWalletCommands(program) {
826
857
  value: "0x0",
827
858
  }), `Approve: update policy to ${policyIdHex}`, telegramOpts, config);
828
859
  await provider.waitForTransaction(txHash);
829
- console.log(`\n Active policy updated`);
830
- console.log(` Tx: ${txHash}`);
831
- console.log(` Policy: ${policyIdHex}`);
860
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Active policy updated"));
861
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
862
+ console.log(" " + colors_1.c.dim("Policy:") + " " + colors_1.c.white(policyIdHex));
832
863
  });
833
864
  // ─── freeze (guardian key — emergency wallet freeze) ──────────────────────
834
865
  //
@@ -900,10 +931,10 @@ function registerWalletCommands(program) {
900
931
  const { client, session, account } = await (0, walletconnect_1.connectPhoneWallet)(config.walletConnectProjectId, chainId, config, { telegramOpts, prompt: "Approve: unfreeze ARC402Wallet", hardware: !!opts.hardware });
901
932
  const networkName = chainId === 8453 ? "Base" : "Base Sepolia";
902
933
  const shortAddr = `${account.slice(0, 6)}...${account.slice(-5)}`;
903
- console.log(`\n Connected: ${shortAddr} on ${networkName}`);
904
- console.log(`\nWallet to unfreeze: ${config.walletContractAddress}`);
934
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Connected: ${shortAddr} on ${networkName}`));
935
+ console.log("\n" + colors_1.c.dim("Wallet to unfreeze:") + " " + colors_1.c.white(config.walletContractAddress ?? ""));
905
936
  // WalletConnect approval already confirmed intent — sending automatically
906
- console.log("Sending transaction...");
937
+ console.log(colors_1.c.dim("Sending transaction..."));
907
938
  const txHash = await (0, walletconnect_1.sendTransactionWithSession)(client, session, account, chainId, {
908
939
  to: config.walletContractAddress,
909
940
  data: walletInterface.encodeFunctionData("unfreeze", []),
@@ -914,8 +945,8 @@ function registerWalletCommands(program) {
914
945
  console.log(JSON.stringify({ txHash, walletAddress: config.walletContractAddress }));
915
946
  }
916
947
  else {
917
- console.log(`\n Wallet ${config.walletContractAddress} unfrozen`);
918
- console.log(` Tx: ${txHash}`);
948
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Wallet ${config.walletContractAddress} unfrozen`));
949
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
919
950
  }
920
951
  });
921
952
  // ─── set-guardian ──────────────────────────────────────────────────────────
@@ -961,9 +992,9 @@ function registerWalletCommands(program) {
961
992
  const { client, session, account } = await (0, walletconnect_1.connectPhoneWallet)(config.walletConnectProjectId, chainId, config, { telegramOpts, prompt: `Approve: set guardian to ${guardianWallet.address}`, hardware: !!opts.hardware });
962
993
  const networkName = chainId === 8453 ? "Base" : "Base Sepolia";
963
994
  const shortAddr = `${account.slice(0, 6)}...${account.slice(-5)}`;
964
- console.log(`\n Connected: ${shortAddr} on ${networkName}`);
995
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Connected: ${shortAddr} on ${networkName}`));
965
996
  // WalletConnect approval already confirmed intent — sending automatically
966
- console.log("Sending transaction...");
997
+ console.log(colors_1.c.dim("Sending transaction..."));
967
998
  const txHash = await (0, walletconnect_1.sendTransactionWithSession)(client, session, account, chainId, {
968
999
  to: config.walletContractAddress,
969
1000
  data: walletInterface.encodeFunctionData("setGuardian", [guardianWallet.address]),
@@ -973,10 +1004,10 @@ function registerWalletCommands(program) {
973
1004
  config.guardianPrivateKey = guardianWallet.privateKey;
974
1005
  config.guardianAddress = guardianWallet.address;
975
1006
  (0, config_1.saveConfig)(config);
976
- console.log(`\n Guardian set to: ${guardianWallet.address}`);
977
- console.log(` Tx: ${txHash}`);
978
- console.log(` Guardian private key saved to config.`);
979
- console.log(` WARN: The guardian key can freeze your wallet. Store it separately from your hot key.`);
1007
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Guardian set to: ${guardianWallet.address}`));
1008
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
1009
+ console.log(" " + colors_1.c.dim("Guardian private key saved to config."));
1010
+ console.log(" " + colors_1.c.warning + " " + colors_1.c.yellow("The guardian key can freeze your wallet. Store it separately from your hot key."));
980
1011
  });
981
1012
  // ─── policy-engine freeze / unfreeze (legacy — for PolicyEngine-level freeze) ──
982
1013
  wallet.command("freeze-policy <walletAddress>")
@@ -1058,18 +1089,18 @@ function registerWalletCommands(program) {
1058
1089
  const { client, session, account } = await (0, walletconnect_1.connectPhoneWallet)(config.walletConnectProjectId, chainId, config, { telegramOpts, prompt: "Approve registry upgrade proposal on ARC402Wallet", hardware: !!opts.hardware });
1059
1090
  const networkName = chainId === 8453 ? "Base" : "Base Sepolia";
1060
1091
  const shortAddr = `${account.slice(0, 6)}...${account.slice(-5)}`;
1061
- console.log(`\n Connected: ${shortAddr} on ${networkName}`);
1092
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Connected: ${shortAddr} on ${networkName}`));
1062
1093
  // WalletConnect approval already confirmed intent — sending automatically
1063
- console.log("Sending transaction...");
1094
+ console.log(colors_1.c.dim("Sending transaction..."));
1064
1095
  const txHash = await (0, walletconnect_1.sendTransactionWithSession)(client, session, account, chainId, {
1065
1096
  to: config.walletContractAddress,
1066
1097
  data: calldata,
1067
1098
  value: "0x0",
1068
1099
  });
1069
1100
  const unlockAt = new Date(Date.now() + 2 * 24 * 60 * 60 * 1000);
1070
- console.log(`\n Registry upgrade proposed`);
1071
- console.log(` Tx: ${txHash}`);
1072
- console.log(` Unlock at: ${unlockAt.toISOString()} (approximately)`);
1101
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Registry upgrade proposed"));
1102
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
1103
+ console.log(" " + colors_1.c.dim("Unlock at:") + " " + colors_1.c.white(unlockAt.toISOString()) + colors_1.c.dim(" (approximately)"));
1073
1104
  console.log(`\nNext steps:`);
1074
1105
  console.log(` Wait 2 days, then run:`);
1075
1106
  console.log(` arc402 wallet execute-registry-upgrade`);
@@ -1137,9 +1168,9 @@ function registerWalletCommands(program) {
1137
1168
  confirmedRegistry = await walletContract.registry();
1138
1169
  }
1139
1170
  catch { /* use pendingRegistry as fallback */ }
1140
- console.log(`\n Registry upgrade executed`);
1141
- console.log(` Tx: ${txHash}`);
1142
- console.log(` New registry: ${confirmedRegistry}`);
1171
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Registry upgrade executed"));
1172
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
1173
+ console.log(" " + colors_1.c.dim("New registry:") + " " + colors_1.c.white(confirmedRegistry));
1143
1174
  if (confirmedRegistry.toLowerCase() === pendingRegistry.toLowerCase()) {
1144
1175
  console.log(` Registry updated successfully — addresses now resolve through new registry.`);
1145
1176
  }
@@ -1190,7 +1221,7 @@ function registerWalletCommands(program) {
1190
1221
  }
1191
1222
  catch { /* ignore */ }
1192
1223
  if (alreadyWhitelisted) {
1193
- console.log(`✓ ${checksumTarget} is already whitelisted for ${config.walletContractAddress}`);
1224
+ console.log(" " + colors_1.c.success + " " + colors_1.c.white(checksumTarget) + colors_1.c.dim(` is already whitelisted for ${config.walletContractAddress}`));
1194
1225
  process.exit(0);
1195
1226
  }
1196
1227
  console.log(`\nWallet: ${config.walletContractAddress}`);
@@ -1213,10 +1244,12 @@ function registerWalletCommands(program) {
1213
1244
  console.log(JSON.stringify({ ok: true, txHash, wallet: config.walletContractAddress, target: checksumTarget }));
1214
1245
  }
1215
1246
  else {
1216
- console.log(`\n Contract whitelisted`);
1217
- console.log(` Tx: ${txHash}`);
1218
- console.log(` Wallet: ${config.walletContractAddress}`);
1219
- console.log(` Target: ${checksumTarget}`);
1247
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Contract whitelisted"));
1248
+ (0, tree_1.renderTree)([
1249
+ { label: "Tx", value: txHash },
1250
+ { label: "Wallet", value: config.walletContractAddress ?? "" },
1251
+ { label: "Target", value: checksumTarget, last: true },
1252
+ ]);
1220
1253
  }
1221
1254
  });
1222
1255
  // ─── set-interceptor ───────────────────────────────────────────────────────
@@ -1261,9 +1294,9 @@ function registerWalletCommands(program) {
1261
1294
  value: "0x0",
1262
1295
  }), `Approve: set X402 interceptor to ${checksumAddress}`, telegramOpts, config);
1263
1296
  await provider.waitForTransaction(txHash);
1264
- console.log(`\n X402 interceptor updated`);
1265
- console.log(` Tx: ${txHash}`);
1266
- console.log(` Interceptor: ${checksumAddress}`);
1297
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" X402 interceptor updated"));
1298
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
1299
+ console.log(" " + colors_1.c.dim("Interceptor:") + " " + colors_1.c.white(checksumAddress));
1267
1300
  });
1268
1301
  // ─── set-velocity-limit ────────────────────────────────────────────────────
1269
1302
  wallet.command("set-velocity-limit <limit>")
@@ -1312,9 +1345,9 @@ function registerWalletCommands(program) {
1312
1345
  value: "0x0",
1313
1346
  }), `Approve: set velocity limit to ${limitEth} ETH`, telegramOpts, config);
1314
1347
  await provider.waitForTransaction(txHash);
1315
- console.log(`\n Velocity limit updated`);
1316
- console.log(` Tx: ${txHash}`);
1317
- console.log(` New limit: ${limitEth} ETH per rolling window`);
1348
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Velocity limit updated"));
1349
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
1350
+ console.log(" " + colors_1.c.dim("New limit:") + " " + colors_1.c.white(`${limitEth} ETH per rolling window`));
1318
1351
  });
1319
1352
  // ─── register-policy ───────────────────────────────────────────────────────
1320
1353
  //
@@ -1370,9 +1403,9 @@ function registerWalletCommands(program) {
1370
1403
  value: "0x0",
1371
1404
  }), `Approve: register wallet on PolicyEngine`, telegramOpts, config);
1372
1405
  await provider.waitForTransaction(txHash);
1373
- console.log(`\n Wallet registered on PolicyEngine`);
1374
- console.log(` Tx: ${txHash}`);
1375
- console.log(`\nNext: run 'arc402 wallet policy set-limit' to configure spending limits.`);
1406
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Wallet registered on PolicyEngine"));
1407
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
1408
+ console.log(colors_1.c.dim("\nNext: run 'arc402 wallet policy set-limit' to configure spending limits."));
1376
1409
  });
1377
1410
  // ─── cancel-registry-upgrade ───────────────────────────────────────────────
1378
1411
  wallet.command("cancel-registry-upgrade")
@@ -1426,8 +1459,8 @@ function registerWalletCommands(program) {
1426
1459
  data: walletInterface.encodeFunctionData("cancelRegistryUpdate", []),
1427
1460
  value: "0x0",
1428
1461
  }), "Approve registry upgrade cancellation on ARC402Wallet", telegramOpts, config);
1429
- console.log(`\n Registry upgrade cancelled`);
1430
- console.log(` Tx: ${txHash}`);
1462
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Registry upgrade cancelled"));
1463
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(txHash));
1431
1464
  });
1432
1465
  // ─── governance setup ──────────────────────────────────────────────────────
1433
1466
  //
@@ -1675,18 +1708,18 @@ function registerWalletCommands(program) {
1675
1708
  config.guardianAddress = guardianWallet.address;
1676
1709
  (0, config_1.saveConfig)(config);
1677
1710
  }
1678
- console.log(`\n Governance setup complete`);
1711
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Governance setup complete"));
1679
1712
  if (usedBatch) {
1680
- console.log(` Batch tx: ${txHashes[0]}`);
1713
+ console.log(" " + colors_1.c.dim("Batch tx:") + " " + colors_1.c.white(txHashes[0]));
1681
1714
  }
1682
1715
  else {
1683
- txHashes.forEach((h, i) => console.log(` Tx ${i + 1}: ${h}`));
1716
+ txHashes.forEach((h, i) => console.log(" " + colors_1.c.dim(`Tx ${i + 1}:`) + " " + colors_1.c.white(h)));
1684
1717
  }
1685
1718
  if (guardianWallet) {
1686
- console.log(` Guardian key saved to config — address: ${guardianWallet.address}`);
1687
- console.log(` WARN: Store the guardian private key separately from your hot key.`);
1719
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` Guardian key saved to config — address: ${guardianWallet.address}`));
1720
+ console.log(" " + colors_1.c.warning + " " + colors_1.c.yellow("Store the guardian private key separately from your hot key."));
1688
1721
  }
1689
- console.log(`\nVerify with: arc402 wallet status && arc402 wallet policy show`);
1722
+ console.log(colors_1.c.dim("\nVerify with: arc402 wallet status && arc402 wallet policy show"));
1690
1723
  });
1691
1724
  // ─── authorize-machine-key ─────────────────────────────────────────────────
1692
1725
  wallet.command("authorize-machine-key <key>")
@@ -1719,7 +1752,7 @@ function registerWalletCommands(program) {
1719
1752
  }
1720
1753
  catch { /* ignore */ }
1721
1754
  if (alreadyAuthorized) {
1722
- console.log(`\n ${checksumKey} is already authorized as a machine key on ${config.walletContractAddress}`);
1755
+ console.log("\n" + colors_1.c.success + " " + colors_1.c.white(checksumKey) + colors_1.c.dim(` is already authorized as a machine key on ${config.walletContractAddress}`));
1723
1756
  process.exit(0);
1724
1757
  }
1725
1758
  console.log(`\nWallet: ${config.walletContractAddress}`);
@@ -1737,21 +1770,23 @@ function registerWalletCommands(program) {
1737
1770
  telegramOpts,
1738
1771
  prompt: `Authorize machine key ${checksumKey} on ARC402Wallet — allows autonomous protocol ops`,
1739
1772
  });
1740
- console.log(`\n Connected: ${account}`);
1741
- console.log("Sending authorizeMachineKey transaction...");
1773
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Connected: ${account}`));
1774
+ console.log(colors_1.c.dim("Sending authorizeMachineKey transaction..."));
1742
1775
  const hash = await (0, walletconnect_1.sendTransactionWithSession)(client, session, account, chainId, txData);
1743
- console.log(`\nTransaction submitted: ${hash}`);
1744
- console.log("Waiting for confirmation...");
1776
+ console.log("\n" + colors_1.c.dim("Transaction submitted:") + " " + colors_1.c.white(hash));
1777
+ console.log(colors_1.c.dim("Waiting for confirmation..."));
1745
1778
  const receipt = await provider.waitForTransaction(hash, 1, 60000);
1746
1779
  if (!receipt || receipt.status !== 1) {
1747
- console.error("Transaction failed.");
1780
+ console.error(colors_1.c.failure + " " + colors_1.c.red("Transaction failed."));
1748
1781
  process.exit(1);
1749
1782
  }
1750
1783
  const confirmed = await walletContract.authorizedMachineKeys(checksumKey);
1751
- console.log(`\n Machine key authorized: ${confirmed ? "YES" : "NO"}`);
1752
- console.log(` Wallet: ${config.walletContractAddress}`);
1753
- console.log(` Machine key: ${checksumKey}`);
1754
- console.log(` Tx: ${hash}`);
1784
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Machine key authorized: ${confirmed ? "YES" : "NO"}`));
1785
+ (0, tree_1.renderTree)([
1786
+ { label: "Wallet", value: config.walletContractAddress ?? "" },
1787
+ { label: "Machine key", value: checksumKey },
1788
+ { label: "Tx", value: hash, last: true },
1789
+ ]);
1755
1790
  await client.disconnect({ topic: session.topic, reason: { code: 6000, message: "done" } });
1756
1791
  process.exit(0);
1757
1792
  });
@@ -1800,25 +1835,27 @@ function registerWalletCommands(program) {
1800
1835
  : undefined;
1801
1836
  const walletInterface = new ethers_1.ethers.Interface(abis_1.ARC402_WALLET_MACHINE_KEY_ABI);
1802
1837
  const { client, session, account } = await (0, walletconnect_1.connectPhoneWallet)(config.walletConnectProjectId, chainId, config, { telegramOpts, prompt: `Revoke machine key ${checksumKey} on ARC402Wallet` });
1803
- console.log(`\n Connected: ${account}`);
1804
- console.log("Sending revokeMachineKey transaction...");
1838
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Connected: ${account}`));
1839
+ console.log(colors_1.c.dim("Sending revokeMachineKey transaction..."));
1805
1840
  const hash = await (0, walletconnect_1.sendTransactionWithSession)(client, session, account, chainId, {
1806
1841
  to: config.walletContractAddress,
1807
1842
  data: walletInterface.encodeFunctionData("revokeMachineKey", [checksumKey]),
1808
1843
  value: "0x0",
1809
1844
  });
1810
- console.log(`\nTransaction submitted: ${hash}`);
1811
- console.log("Waiting for confirmation...");
1845
+ console.log("\n" + colors_1.c.dim("Transaction submitted:") + " " + colors_1.c.white(hash));
1846
+ console.log(colors_1.c.dim("Waiting for confirmation..."));
1812
1847
  const receipt = await provider.waitForTransaction(hash, 1, 60000);
1813
1848
  if (!receipt || receipt.status !== 1) {
1814
- console.error("Transaction failed.");
1849
+ console.error(colors_1.c.failure + " " + colors_1.c.red("Transaction failed."));
1815
1850
  process.exit(1);
1816
1851
  }
1817
1852
  const stillAuthorized = await walletContract.authorizedMachineKeys(checksumKey);
1818
- console.log(`\n Machine key revoked: ${stillAuthorized ? "NO (still authorized — check tx)" : "YES"}`);
1819
- console.log(` Wallet: ${config.walletContractAddress}`);
1820
- console.log(` Machine key: ${checksumKey}`);
1821
- console.log(` Tx: ${hash}`);
1853
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Machine key revoked: ${stillAuthorized ? "NO (still authorized — check tx)" : "YES"}`));
1854
+ (0, tree_1.renderTree)([
1855
+ { label: "Wallet", value: config.walletContractAddress ?? "" },
1856
+ { label: "Machine key", value: checksumKey },
1857
+ { label: "Tx", value: hash, last: true },
1858
+ ]);
1822
1859
  await client.disconnect({ topic: session.topic, reason: { code: 6000, message: "done" } });
1823
1860
  process.exit(0);
1824
1861
  });
@@ -1932,11 +1969,13 @@ function registerWalletCommands(program) {
1932
1969
  console.log(JSON.stringify({ walletAddress: walletAddr, contextId, taskType: opts.taskType, txHash: receipt?.hash }));
1933
1970
  }
1934
1971
  else {
1935
- console.log(`✓ Context opened`);
1936
- console.log(` contextId: ${contextId}`);
1937
- console.log(` taskType: ${opts.taskType}`);
1938
- console.log(` Tx: ${receipt?.hash}`);
1939
- console.log(`\nNote: Each context allows only one spend. Call \`arc402 wallet attest\` then \`arc402 wallet drain\` (or executeSpend directly).`);
1972
+ console.log(" " + colors_1.c.success + colors_1.c.white(" Context opened"));
1973
+ (0, tree_1.renderTree)([
1974
+ { label: "contextId", value: contextId },
1975
+ { label: "taskType", value: opts.taskType },
1976
+ { label: "Tx", value: receipt?.hash ?? "", last: true },
1977
+ ]);
1978
+ console.log(colors_1.c.dim("\nNote: Each context allows only one spend. Call `arc402 wallet attest` then `arc402 wallet drain` (or executeSpend directly)."));
1940
1979
  }
1941
1980
  });
1942
1981
  // ─── attest (J1-03) ────────────────────────────────────────────────────────
@@ -1994,14 +2033,16 @@ function registerWalletCommands(program) {
1994
2033
  }));
1995
2034
  }
1996
2035
  else {
1997
- console.log(`✓ Attestation created`);
1998
- console.log(` attestationId: ${attestationId}`);
1999
- console.log(` recipient: ${checksumRecipient}`);
2000
- console.log(` amount: ${opts.amount} ETH`);
2001
- console.log(` token: ${tokenAddress === ethers_1.ethers.ZeroAddress ? "ETH" : tokenAddress}`);
2002
- console.log(` expiresAt: ${new Date(expiresAt * 1000).toISOString()}`);
2003
- console.log(` Tx: ${receipt?.hash}`);
2004
- console.log(`\nUse this attestationId in \`arc402 wallet drain\` or your spend flow.`);
2036
+ console.log(" " + colors_1.c.success + colors_1.c.white(" Attestation created"));
2037
+ (0, tree_1.renderTree)([
2038
+ { label: "attestationId", value: attestationId },
2039
+ { label: "recipient", value: checksumRecipient },
2040
+ { label: "amount", value: opts.amount + " ETH" },
2041
+ { label: "token", value: tokenAddress === ethers_1.ethers.ZeroAddress ? "ETH" : tokenAddress },
2042
+ { label: "expiresAt", value: new Date(expiresAt * 1000).toISOString() },
2043
+ { label: "Tx", value: receipt?.hash ?? "", last: true },
2044
+ ]);
2045
+ console.log(colors_1.c.dim("\nUse this attestationId in `arc402 wallet drain` or your spend flow."));
2005
2046
  }
2006
2047
  });
2007
2048
  // ─── velocity-status (J8-03) ───────────────────────────────────────────────
@@ -2122,9 +2163,9 @@ function registerWalletCommands(program) {
2122
2163
  console.log(JSON.stringify({ walletAddress: walletAddr, txHash: receipt?.hash, contextOpen: false }));
2123
2164
  }
2124
2165
  else {
2125
- console.log(`✓ Context closed`);
2126
- console.log(` Tx: ${receipt?.hash}`);
2127
- console.log(` Wallet: ${walletAddr}`);
2166
+ console.log(" " + colors_1.c.success + colors_1.c.white(" Context closed"));
2167
+ console.log(" " + colors_1.c.dim("Tx:") + " " + colors_1.c.white(receipt?.hash ?? ""));
2168
+ console.log(" " + colors_1.c.dim("Wallet:") + " " + colors_1.c.white(walletAddr));
2128
2169
  }
2129
2170
  });
2130
2171
  // ─── drain ─────────────────────────────────────────────────────────────────
@@ -2221,26 +2262,26 @@ function registerWalletCommands(program) {
2221
2262
  // ── Step 1: context cleanup ────────────────────────────────────────────
2222
2263
  const isOpen = await walletContract.contextOpen();
2223
2264
  if (isOpen) {
2224
- console.log("Stale context found — closing it first...");
2265
+ console.log(colors_1.c.dim("Stale context found — closing it first..."));
2225
2266
  const closeTx = await walletContract.closeContext();
2226
2267
  await closeTx.wait(2);
2227
- console.log(` Closed: ${closeTx.hash}`);
2268
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` Closed: ${closeTx.hash}`));
2228
2269
  }
2229
2270
  // ── Step 2: openContext ────────────────────────────────────────────────
2230
2271
  const contextId = ethers_1.ethers.keccak256(ethers_1.ethers.toUtf8Bytes(`drain-${Date.now()}`));
2231
- console.log("Opening context...");
2272
+ console.log(colors_1.c.dim("Opening context..."));
2232
2273
  const openTx = await walletContract.openContext(contextId, "drain");
2233
2274
  const openReceipt = await openTx.wait(1);
2234
- console.log(` openContext: ${openReceipt?.hash}`);
2275
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` openContext: ${openReceipt?.hash}`));
2235
2276
  // ── Step 3: attest (direct on wallet — onlyOwnerOrMachineKey, NOT via executeContractCall)
2236
2277
  const attestationId = ethers_1.ethers.hexlify(ethers_1.ethers.randomBytes(32));
2237
2278
  const expiry = Math.floor(Date.now() / 1000) + 600; // 10 min TTL
2238
- console.log("Creating attestation (direct on wallet)...");
2279
+ console.log(colors_1.c.dim("Creating attestation (direct on wallet)..."));
2239
2280
  const attestTx = await walletContract.attest(attestationId, "spend", `drain to ${checksumRecipient}`, checksumRecipient, drainAmount, ethers_1.ethers.ZeroAddress, expiry);
2240
2281
  const attestReceipt = await attestTx.wait(1);
2241
- console.log(` attest: ${attestReceipt?.hash}`);
2282
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` attest: ${attestReceipt?.hash}`));
2242
2283
  // ── Step 4: executeSpend ───────────────────────────────────────────────
2243
- console.log("Executing spend...");
2284
+ console.log(colors_1.c.dim("Executing spend..."));
2244
2285
  let spendReceiptHash;
2245
2286
  try {
2246
2287
  const spendTx = await walletContract.executeSpend(checksumRecipient, drainAmount, opts.category, attestationId);
@@ -2250,12 +2291,12 @@ function registerWalletCommands(program) {
2250
2291
  catch (e) {
2251
2292
  (0, wallet_router_1.handleWalletError)(e);
2252
2293
  }
2253
- console.log(` executeSpend: ${spendReceiptHash}`);
2294
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` executeSpend: ${spendReceiptHash}`));
2254
2295
  // ── Step 5: closeContext ───────────────────────────────────────────────
2255
- console.log("Closing context...");
2296
+ console.log(colors_1.c.dim("Closing context..."));
2256
2297
  const closeTx2 = await walletContract.closeContext();
2257
2298
  const closeReceipt = await closeTx2.wait(1);
2258
- console.log(` closeContext: ${closeReceipt?.hash}`);
2299
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` closeContext: ${closeReceipt?.hash}`));
2259
2300
  const newBalance = await provider.getBalance(walletAddr);
2260
2301
  if (opts.json) {
2261
2302
  console.log(JSON.stringify({
@@ -2274,9 +2315,11 @@ function registerWalletCommands(program) {
2274
2315
  }));
2275
2316
  }
2276
2317
  else {
2277
- console.log(`\n Drain complete`);
2278
- console.log(` Sent: ${ethers_1.ethers.formatEther(drainAmount)} ETH → ${checksumRecipient}`);
2279
- console.log(` Remaining: ${ethers_1.ethers.formatEther(newBalance)} ETH`);
2318
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Drain complete"));
2319
+ (0, tree_1.renderTree)([
2320
+ { label: "Sent", value: `${ethers_1.ethers.formatEther(drainAmount)} ETH → ${checksumRecipient}` },
2321
+ { label: "Remaining", value: `${ethers_1.ethers.formatEther(newBalance)} ETH`, last: true },
2322
+ ]);
2280
2323
  }
2281
2324
  });
2282
2325
  // ─── drain-token ───────────────────────────────────────────────────────────
@@ -2398,34 +2441,34 @@ function registerWalletCommands(program) {
2398
2441
  // ── Step 1: context cleanup ──────────────────────────────────────────────
2399
2442
  const isOpenT = await walletContractT.contextOpen();
2400
2443
  if (isOpenT) {
2401
- console.log("Stale context found — closing it first...");
2444
+ console.log(colors_1.c.dim("Stale context found — closing it first..."));
2402
2445
  const closeTxT = await walletContractT.closeContext();
2403
2446
  await closeTxT.wait(2);
2404
- console.log(` Closed: ${closeTxT.hash}`);
2447
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` Closed: ${closeTxT.hash}`));
2405
2448
  }
2406
2449
  // ── Step 2: openContext ──────────────────────────────────────────────────
2407
2450
  const contextIdT = ethers_1.ethers.keccak256(ethers_1.ethers.toUtf8Bytes(`drain-token-${Date.now()}`));
2408
- console.log("Opening context...");
2451
+ console.log(colors_1.c.dim("Opening context..."));
2409
2452
  const openTxT = await walletContractT.openContext(contextIdT, "drain");
2410
2453
  const openReceiptT = await openTxT.wait(1);
2411
- console.log(` openContext: ${openReceiptT?.hash}`);
2454
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` openContext: ${openReceiptT?.hash}`));
2412
2455
  // ── Step 3: attest with token address ────────────────────────────────────
2413
2456
  const attestationIdT = ethers_1.ethers.hexlify(ethers_1.ethers.randomBytes(32));
2414
2457
  const expiryT = Math.floor(Date.now() / 1000) + 600; // 10 min TTL
2415
- console.log("Creating attestation (with token address)...");
2458
+ console.log(colors_1.c.dim("Creating attestation (with token address)..."));
2416
2459
  const attestTxT = await walletContractT.attest(attestationIdT, "spend", `token drain to ${checksumRecipient}`, checksumRecipient, tokenAmount, tokenAddress, expiryT);
2417
2460
  const attestReceiptT = await attestTxT.wait(1);
2418
- console.log(` attest: ${attestReceiptT?.hash}`);
2461
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` attest: ${attestReceiptT?.hash}`));
2419
2462
  // ── Step 4: executeTokenSpend ────────────────────────────────────────────
2420
- console.log("Executing token spend...");
2463
+ console.log(colors_1.c.dim("Executing token spend..."));
2421
2464
  const spendTxT = await walletContractT.executeTokenSpend(checksumRecipient, tokenAmount, tokenAddress, opts.category, attestationIdT);
2422
2465
  const spendReceiptT = await spendTxT.wait(1);
2423
- console.log(` executeTokenSpend: ${spendReceiptT?.hash}`);
2466
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` executeTokenSpend: ${spendReceiptT?.hash}`));
2424
2467
  // ── Step 5: closeContext ─────────────────────────────────────────────────
2425
- console.log("Closing context...");
2468
+ console.log(colors_1.c.dim("Closing context..."));
2426
2469
  const closeTxT2 = await walletContractT.closeContext();
2427
2470
  const closeReceiptT = await closeTxT2.wait(1);
2428
- console.log(` closeContext: ${closeReceiptT?.hash}`);
2471
+ console.log(" " + colors_1.c.success + colors_1.c.dim(` closeContext: ${closeReceiptT?.hash}`));
2429
2472
  const newTokenBalance = await erc20.balanceOf(walletAddr);
2430
2473
  if (opts.json) {
2431
2474
  console.log(JSON.stringify({
@@ -2445,10 +2488,12 @@ function registerWalletCommands(program) {
2445
2488
  }));
2446
2489
  }
2447
2490
  else {
2448
- console.log(`\n Token drain complete`);
2449
- console.log(` Sent: ${amountArg} → ${checksumRecipient}`);
2450
- console.log(` Token: ${tokenAddress}`);
2451
- console.log(` Remaining: ${ethers_1.ethers.formatUnits(newTokenBalance, decimals)}`);
2491
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Token drain complete"));
2492
+ (0, tree_1.renderTree)([
2493
+ { label: "Sent", value: `${amountArg} → ${checksumRecipient}` },
2494
+ { label: "Token", value: tokenAddress },
2495
+ { label: "Remaining", value: ethers_1.ethers.formatUnits(newTokenBalance, decimals), last: true },
2496
+ ]);
2452
2497
  }
2453
2498
  });
2454
2499
  // ─── set-passkey ───────────────────────────────────────────────────────────
@@ -2497,22 +2542,24 @@ function registerWalletCommands(program) {
2497
2542
  telegramOpts,
2498
2543
  prompt: `Activate passkey (Face ID) on ARC402Wallet — enables P256 governance signing`,
2499
2544
  });
2500
- console.log(`\n Connected: ${account}`);
2501
- console.log("Sending setPasskey transaction...");
2545
+ console.log("\n" + colors_1.c.success + colors_1.c.white(` Connected: ${account}`));
2546
+ console.log(colors_1.c.dim("Sending setPasskey transaction..."));
2502
2547
  const hash = await (0, walletconnect_1.sendTransactionWithSession)(client, session, account, chainId, txData);
2503
- console.log(`\nTransaction submitted: ${hash}`);
2504
- console.log("Waiting for confirmation...");
2548
+ console.log("\n" + colors_1.c.dim("Transaction submitted:") + " " + colors_1.c.white(hash));
2549
+ console.log(colors_1.c.dim("Waiting for confirmation..."));
2505
2550
  const receipt = await provider.waitForTransaction(hash, 1, 60000);
2506
2551
  if (!receipt || receipt.status !== 1) {
2507
- console.error("Transaction failed.");
2552
+ console.error(colors_1.c.failure + " " + colors_1.c.red("Transaction failed."));
2508
2553
  process.exit(1);
2509
2554
  }
2510
- console.log(`\n Passkey activated on ARC402Wallet`);
2511
- console.log(` Wallet: ${config.walletContractAddress}`);
2512
- console.log(` pubKeyX: ${pubKeyX}`);
2513
- console.log(` pubKeyY: ${pubKeyY}`);
2514
- console.log(` Tx: ${hash}`);
2515
- console.log(`\nGovernance ops now require Face ID instead of MetaMask.`);
2555
+ console.log("\n" + colors_1.c.success + colors_1.c.white(" Passkey activated on ARC402Wallet"));
2556
+ (0, tree_1.renderTree)([
2557
+ { label: "Wallet", value: config.walletContractAddress ?? "" },
2558
+ { label: "pubKeyX", value: pubKeyX },
2559
+ { label: "pubKeyY", value: pubKeyY },
2560
+ { label: "Tx", value: hash, last: true },
2561
+ ]);
2562
+ console.log(colors_1.c.dim("\nGovernance ops now require Face ID instead of MetaMask."));
2516
2563
  await client.disconnect({ topic: session.topic, reason: { code: 6000, message: "done" } });
2517
2564
  process.exit(0);
2518
2565
  });