@trustwallet/cli 0.6.3 → 0.6.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmC1D"}
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,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2D1D"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2D1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsb3D"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/commands/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgd3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/commands/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAspB5D"}
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/commands/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0pB5D"}
package/dist/index.js CHANGED
@@ -49,6 +49,13 @@
49
49
  head: { appendChild: function(){} }
50
50
  };
51
51
  }
52
+ // --- Suppress Node.js --localstorage-file warning from Trust SDK WASM ---
53
+ var _origEmit = process.emitWarning;
54
+ process.emitWarning = function(warning) {
55
+ if (typeof warning === 'string' && warning.indexOf('--localstorage-file') !== -1) return;
56
+ return _origEmit.apply(process, arguments);
57
+ };
58
+
52
59
  if (typeof globalThis.window === 'undefined') globalThis.window = globalThis;
53
60
  if (typeof globalThis.self === 'undefined') globalThis.self = globalThis;
54
61
  if (typeof globalThis.navigator === 'undefined') globalThis.navigator = { onLine: true, userAgent: 'Mozilla/5.0 (twak)' };
@@ -216,8 +223,8 @@ var init_dist = __esm({
216
223
  setPassword(service, account, password) {
217
224
  (0, import_child_process.execFileSync)(
218
225
  "security",
219
- ["add-generic-password", "-s", service, "-a", account, "-w", "-U"],
220
- { input: password, stdio: ["pipe", "pipe", "pipe"] }
226
+ ["add-generic-password", "-U", "-s", service, "-a", account, "-w"],
227
+ { input: password + "\n", stdio: ["pipe", "pipe", "pipe"] }
221
228
  );
222
229
  },
223
230
  deletePassword(service, account) {
@@ -12170,59 +12177,9 @@ function info(message) {
12170
12177
  console.log(import_chalk.default.cyan(message));
12171
12178
  }
12172
12179
 
12173
- // src/branding.ts
12174
- var import_chalk2 = __toESM(require("chalk"));
12175
- var boxen = require("boxen");
12176
- var SHIELD = [
12177
- " @@=+ ",
12178
- " @@@@@@@======= ",
12179
- " @@@@@@@@@@@@@============+ ",
12180
- " @@@@@@@@@@@@@@@@================ ",
12181
- " @@@@@@@@@@@@@@@@+=============== ",
12182
- " @@@@@@@@@@@@@@@@++++============ ",
12183
- " @@@@@@@@@@@@@@@@++++++++++=====+ ",
12184
- " @@@@@@@@@@@@@@@@**++++++++++++++ ",
12185
- " @@@@@@@@@@@@@@@@********++++++++ ",
12186
- " @@@@@@@@@@@@@@@@**************++ ",
12187
- " @@@@@@@@@@@@@@@@#####*********** ",
12188
- " @@@@@@@@@@@@@@@###########**** ",
12189
- " @@@@@@@@@@@@@@%############## ",
12190
- " @@@@@@@@@@@@@@%%%%%%%####### ",
12191
- " @@@@@@@@@@@@@%%%%%%%%%%%%% ",
12192
- " @@@@@@@@@@@%%%%%%%%%%% ",
12193
- " @@@@@@@@@@@@@%%%%% ",
12194
- " @@@@@@@@@@@@@@ ",
12195
- " @@@@@@@@@@ ",
12196
- " @@ "
12197
- ];
12198
- function printBanner(version2) {
12199
- const logo = SHIELD.map((l) => import_chalk2.default.green(l)).join("\n");
12200
- const title = import_chalk2.default.green.bold(" Trust Wallet Agent Kit");
12201
- const ver = import_chalk2.default.dim(` v${version2}`);
12202
- console.log(
12203
- boxen(`${logo}
12204
-
12205
- ${title}
12206
- ${ver}`, {
12207
- borderColor: "green",
12208
- borderStyle: "round",
12209
- padding: { top: 1, bottom: 1, left: 2, right: 2 }
12210
- })
12211
- );
12212
- }
12213
- function box(content) {
12214
- return boxen(content, {
12215
- borderColor: "green",
12216
- borderStyle: "round",
12217
- padding: { top: 0, bottom: 0, left: 1, right: 1 }
12218
- });
12219
- }
12220
-
12221
12180
  // src/commands/init.ts
12222
12181
  function registerInitCommand(program2) {
12223
12182
  program2.command("init").description("Initialize twak configuration").option("--api-key <key>", "TWAK API access ID (prefer TWAK_ACCESS_ID env var)").option("--api-secret <secret>", "TWAK HMAC secret (prefer TWAK_HMAC_SECRET env var)").option("--wc-project-id <id>", "WalletConnect project ID").action(async (opts) => {
12224
- printBanner(program2.version() ?? "0.2.0");
12225
- console.log("");
12226
12183
  const credManager = new CredentialManager();
12227
12184
  if (opts.apiKey && opts.apiSecret) {
12228
12185
  warn("Secrets passed as CLI arguments are visible in shell history.");
@@ -12234,6 +12191,7 @@ function registerInitCommand(program2) {
12234
12191
  walletConnectProjectId: opts.wcProjectId
12235
12192
  });
12236
12193
  success("Credentials saved to ~/.twak/credentials.json");
12194
+ info("\nNext step: create a wallet with `twak wallet create --password <pw>`");
12237
12195
  return;
12238
12196
  }
12239
12197
  const envAccessId = process.env.TWAK_ACCESS_ID;
@@ -12246,6 +12204,7 @@ function registerInitCommand(program2) {
12246
12204
  walletConnectProjectId: envWcId
12247
12205
  });
12248
12206
  success("Credentials saved from environment variables to ~/.twak/credentials.json");
12207
+ info("\nNext step: create a wallet with `twak wallet create --password <pw>`");
12249
12208
  return;
12250
12209
  }
12251
12210
  const existing = await credManager.load();
@@ -12267,6 +12226,7 @@ function registerInitCommand(program2) {
12267
12226
  }
12268
12227
 
12269
12228
  // src/commands/auth.ts
12229
+ var import_chalk2 = __toESM(require("chalk"));
12270
12230
  init_dist();
12271
12231
  function registerAuthCommand(program2) {
12272
12232
  const auth = program2.command("auth").description("Manage authentication");
@@ -12283,12 +12243,17 @@ function registerAuthCommand(program2) {
12283
12243
  const credManager = new CredentialManager();
12284
12244
  const creds = await credManager.load();
12285
12245
  const envConfigured = !!(process.env.TWAK_ACCESS_ID && process.env.TWAK_HMAC_SECRET);
12286
- const result = {
12287
- configured: !!creds || envConfigured,
12288
- source: creds ? "file" : envConfigured ? "environment" : "none",
12289
- accessId: creds?.accessId?.slice(0, 8) || process.env.TWAK_ACCESS_ID?.slice(0, 8) || null
12290
- };
12291
- output(result, opts.json);
12246
+ const configured = !!creds || envConfigured;
12247
+ const source = creds ? "file" : envConfigured ? "environment" : "none";
12248
+ const accessId = creds?.accessId?.slice(0, 8) || process.env.TWAK_ACCESS_ID?.slice(0, 8) || null;
12249
+ if (opts.json) {
12250
+ output({ configured, source, accessId }, true);
12251
+ } else {
12252
+ console.log(` ${import_chalk2.default.dim("Status")} ${configured ? import_chalk2.default.green("configured") : import_chalk2.default.yellow("not configured")}`);
12253
+ console.log(` ${import_chalk2.default.dim("Source")} ${source}`);
12254
+ if (accessId) console.log(` ${import_chalk2.default.dim("Access ID")} ${accessId}...`);
12255
+ if (!configured) info("\nRun `twak init` to set up credentials.");
12256
+ }
12292
12257
  });
12293
12258
  }
12294
12259
 
@@ -12300,7 +12265,7 @@ init_dist3();
12300
12265
 
12301
12266
  // src/commands/wallet.ts
12302
12267
  init_dist();
12303
- var import_chalk4 = __toESM(require("chalk"));
12268
+ var import_chalk5 = __toESM(require("chalk"));
12304
12269
 
12305
12270
  // src/config-loader.ts
12306
12271
  var import_chalk3 = __toESM(require("chalk"));
@@ -12368,6 +12333,56 @@ async function resolvePassword(opts) {
12368
12333
 
12369
12334
  // src/commands/wallet.ts
12370
12335
  init_dist2();
12336
+
12337
+ // src/branding.ts
12338
+ var import_chalk4 = __toESM(require("chalk"));
12339
+ var boxen = require("boxen");
12340
+ var SHIELD = [
12341
+ " @@=+ ",
12342
+ " @@@@@@@======= ",
12343
+ " @@@@@@@@@@@@@============+ ",
12344
+ " @@@@@@@@@@@@@@@@================ ",
12345
+ " @@@@@@@@@@@@@@@@+=============== ",
12346
+ " @@@@@@@@@@@@@@@@++++============ ",
12347
+ " @@@@@@@@@@@@@@@@++++++++++=====+ ",
12348
+ " @@@@@@@@@@@@@@@@**++++++++++++++ ",
12349
+ " @@@@@@@@@@@@@@@@********++++++++ ",
12350
+ " @@@@@@@@@@@@@@@@**************++ ",
12351
+ " @@@@@@@@@@@@@@@@#####*********** ",
12352
+ " @@@@@@@@@@@@@@@###########**** ",
12353
+ " @@@@@@@@@@@@@@%############## ",
12354
+ " @@@@@@@@@@@@@@%%%%%%%####### ",
12355
+ " @@@@@@@@@@@@@%%%%%%%%%%%%% ",
12356
+ " @@@@@@@@@@@%%%%%%%%%%% ",
12357
+ " @@@@@@@@@@@@@%%%%% ",
12358
+ " @@@@@@@@@@@@@@ ",
12359
+ " @@@@@@@@@@ ",
12360
+ " @@ "
12361
+ ];
12362
+ function printBanner(version2) {
12363
+ const logo = SHIELD.map((l) => import_chalk4.default.green(l)).join("\n");
12364
+ const title = import_chalk4.default.green.bold(" Trust Wallet Agent Kit");
12365
+ const ver = import_chalk4.default.dim(` v${version2}`);
12366
+ console.log(
12367
+ boxen(`${logo}
12368
+
12369
+ ${title}
12370
+ ${ver}`, {
12371
+ borderColor: "green",
12372
+ borderStyle: "round",
12373
+ padding: { top: 1, bottom: 1, left: 2, right: 2 }
12374
+ })
12375
+ );
12376
+ }
12377
+ function box(content) {
12378
+ return boxen(content, {
12379
+ borderColor: "green",
12380
+ borderStyle: "round",
12381
+ padding: { top: 0, bottom: 0, left: 1, right: 1 }
12382
+ });
12383
+ }
12384
+
12385
+ // src/commands/wallet.ts
12371
12386
  var qrcode = require("qrcode-terminal");
12372
12387
  function getQRString(address) {
12373
12388
  let result = "";
@@ -12383,7 +12398,7 @@ function registerWalletCommand(program2) {
12383
12398
  await ensureTrustSDK();
12384
12399
  const store = new WalletConfigStore();
12385
12400
  if (await store.exists()) {
12386
- const msg = "Wallet already exists. Use `twak wallet export` to back up, then delete ~/.twak/wallet.json to create a new one.";
12401
+ const msg = "Wallet already exists. Back up ~/.twak/wallet.json, then delete it to create a new one.";
12387
12402
  error(msg);
12388
12403
  if (opts.json) output({ error: msg }, true);
12389
12404
  process.exitCode = 1;
@@ -12392,7 +12407,6 @@ function registerWalletCommand(program2) {
12392
12407
  }
12393
12408
  const provider = await AgentWalletProvider.create(opts.password);
12394
12409
  const addresses = await provider.getAddresses();
12395
- if (!opts.json) success("Agent wallet created successfully");
12396
12410
  if (opts.keychain !== false) {
12397
12411
  const kc = new KeychainManager();
12398
12412
  if (kc.isAvailable()) {
@@ -12400,6 +12414,7 @@ function registerWalletCommand(program2) {
12400
12414
  if (!opts.json) info("Password saved to OS keychain (use --no-keychain to skip)");
12401
12415
  }
12402
12416
  }
12417
+ if (!opts.json) success("Agent wallet created successfully");
12403
12418
  try {
12404
12419
  const creds = await getCredentials();
12405
12420
  await registerWalletWithBackend(creds, provider);
@@ -12430,8 +12445,8 @@ function registerWalletCommand(program2) {
12430
12445
  output({ chain: opts.chain, address }, true);
12431
12446
  } else {
12432
12447
  const qr = getQRString(address);
12433
- const content = `${import_chalk4.default.dim("Chain")} ${import_chalk4.default.bold(opts.chain)}
12434
- ${import_chalk4.default.dim("Address")} ${import_chalk4.default.green(address)}
12448
+ const content = `${import_chalk5.default.dim("Chain")} ${import_chalk5.default.bold(opts.chain)}
12449
+ ${import_chalk5.default.dim("Address")} ${import_chalk5.default.green(address)}
12435
12450
 
12436
12451
  ${qr}`;
12437
12452
  console.log(box(content));
@@ -12462,7 +12477,7 @@ ${qr}`;
12462
12477
  for (const [address, chains] of grouped) {
12463
12478
  const qr = getQRString(address);
12464
12479
  const maxWidth = Math.max(address.length + 9, 50);
12465
- const chainLabel = `${import_chalk4.default.dim("Chains")} `;
12480
+ const chainLabel = `${import_chalk5.default.dim("Chains")} `;
12466
12481
  const chainLabelLen = 9;
12467
12482
  const chainLines = [];
12468
12483
  let line = "";
@@ -12476,9 +12491,9 @@ ${qr}`;
12476
12491
  }
12477
12492
  }
12478
12493
  if (line) chainLines.push(line);
12479
- const chainsStr = chainLines.map((l, i) => (i === 0 ? chainLabel : " ".repeat(chainLabelLen)) + import_chalk4.default.bold(l)).join("\n");
12494
+ const chainsStr = chainLines.map((l, i) => (i === 0 ? chainLabel : " ".repeat(chainLabelLen)) + import_chalk5.default.bold(l)).join("\n");
12480
12495
  const content = `${chainsStr}
12481
- ${import_chalk4.default.dim("Address")} ${import_chalk4.default.green(address)}
12496
+ ${import_chalk5.default.dim("Address")} ${import_chalk5.default.green(address)}
12482
12497
 
12483
12498
  ${qr}`;
12484
12499
  console.log(box(content));
@@ -12652,17 +12667,17 @@ ${qr}`;
12652
12667
  for (let i = 0; i < results.length; i++) {
12653
12668
  const r = results[i];
12654
12669
  if (i > 0) console.log("");
12655
- console.log(import_chalk4.default.bold.underline(`${String(r.chain)} (${String(r.symbol)})`));
12656
- console.log(` ${import_chalk4.default.dim("Address")} ${r.address}`);
12657
- console.log(` ${import_chalk4.default.dim("Available")} ${r.available}`);
12658
- if (r.staked) console.log(` ${import_chalk4.default.dim("Staked")} ${r.staked}`);
12659
- if (r.pending) console.log(` ${import_chalk4.default.dim("Pending")} ${r.pending}`);
12660
- console.log(` ${import_chalk4.default.dim("Total")} ${r.total}`);
12670
+ console.log(import_chalk5.default.bold.underline(`${String(r.chain)} (${String(r.symbol)})`));
12671
+ console.log(` ${import_chalk5.default.dim("Address")} ${r.address}`);
12672
+ console.log(` ${import_chalk5.default.dim("Available")} ${r.available}`);
12673
+ if (r.staked) console.log(` ${import_chalk5.default.dim("Staked")} ${r.staked}`);
12674
+ if (r.pending) console.log(` ${import_chalk5.default.dim("Pending")} ${r.pending}`);
12675
+ console.log(` ${import_chalk5.default.dim("Total")} ${r.total}`);
12661
12676
  const tokens = r.tokens;
12662
12677
  if (tokens.length > 0) {
12663
- console.log(` ${import_chalk4.default.dim("Tokens:")}`);
12678
+ console.log(` ${import_chalk5.default.dim("Tokens:")}`);
12664
12679
  for (const t of tokens) {
12665
- console.log(` ${import_chalk4.default.bold(t.symbol.padEnd(10))} ${t.balance}`);
12680
+ console.log(` ${import_chalk5.default.bold(t.symbol.padEnd(10))} ${t.balance}`);
12666
12681
  }
12667
12682
  }
12668
12683
  }
@@ -12688,20 +12703,16 @@ ${qr}`;
12688
12703
  if (opts.json) {
12689
12704
  output(result, true);
12690
12705
  } else {
12691
- output({
12692
- chain: result.chain,
12693
- address: result.address,
12694
- symbol: result.symbol,
12695
- available: result.available,
12696
- ...result.staked ? { staked: result.staked } : {},
12697
- ...result.pending ? { pending: result.pending } : {},
12698
- total: result.total
12699
- }, false);
12706
+ console.log(import_chalk5.default.bold.underline(`${result.chain} (${result.symbol})`));
12707
+ console.log(` ${import_chalk5.default.dim("Address")} ${result.address}`);
12708
+ console.log(` ${import_chalk5.default.dim("Available")} ${result.available}`);
12709
+ if (result.staked) console.log(` ${import_chalk5.default.dim("Staked")} ${result.staked}`);
12710
+ if (result.pending) console.log(` ${import_chalk5.default.dim("Pending")} ${result.pending}`);
12711
+ console.log(` ${import_chalk5.default.dim("Total")} ${result.total}`);
12700
12712
  if (result.tokens.length > 0) {
12701
- console.log("");
12702
- info("Token balances:");
12713
+ console.log(` ${import_chalk5.default.dim("Tokens:")}`);
12703
12714
  for (const t of result.tokens) {
12704
- console.log(` ${import_chalk4.default.bold(t.symbol.padEnd(10))} ${t.balance}`);
12715
+ console.log(` ${import_chalk5.default.bold(t.symbol.padEnd(10))} ${t.balance}`);
12705
12716
  }
12706
12717
  }
12707
12718
  }
@@ -12756,10 +12767,17 @@ ${qr}`;
12756
12767
  const exists = await store.exists();
12757
12768
  const kc = new KeychainManager();
12758
12769
  const keychainHasPassword = kc.isAvailable() ? !!await kc.getWalletPassword() : false;
12759
- output({
12770
+ const result = {
12760
12771
  agentWallet: exists ? "configured" : "not configured",
12761
12772
  keychainPassword: keychainHasPassword ? "stored" : "not stored"
12762
- }, opts.json);
12773
+ };
12774
+ if (opts.json) {
12775
+ output(result, true);
12776
+ } else {
12777
+ console.log(` ${import_chalk5.default.dim("Wallet")} ${exists ? import_chalk5.default.green("configured") : import_chalk5.default.yellow("not configured")}`);
12778
+ console.log(` ${import_chalk5.default.dim("Keychain")} ${keychainHasPassword ? import_chalk5.default.green("password stored") : import_chalk5.default.yellow("no password")}`);
12779
+ if (!exists) info("\nRun `twak wallet create --password <pw>` to create a wallet.");
12780
+ }
12763
12781
  });
12764
12782
  wallet.command("portfolio").description("Show portfolio balances and USD values across chains, including token holdings").option("--chains <list>", "Comma-separated chain keys (default: all EVM + major L1s)", "ethereum,base,bsc,polygon,arbitrum,optimism,avalanche,fantom,linea,scroll,zksync,blast,sonic,celo,aurora,solana,tron").option("--password <password>", "Wallet password (falls back to keychain / TWAK_WALLET_PASSWORD)").option("--json", "JSON output").action(async (opts) => {
12765
12783
  try {
@@ -13748,9 +13766,11 @@ var TransactionService = class {
13748
13766
  // src/commands/query.ts
13749
13767
  init_dist5();
13750
13768
  init_dist4();
13769
+ var import_chalk6 = __toESM(require("chalk"));
13751
13770
  function handleError(err, json) {
13752
13771
  const msg = err instanceof Error ? err.message : String(err);
13753
- error(msg);
13772
+ const hint = msg.includes("403 Forbidden") ? " \u2014 check your API key at https://portal.trustwallet.com" : "";
13773
+ error(`${msg}${hint}`);
13754
13774
  if (json) output({ error: msg }, true);
13755
13775
  process.exitCode = 1;
13756
13776
  }
@@ -13787,7 +13807,14 @@ function registerQueryCommand(program2) {
13787
13807
  chain: m.chain,
13788
13808
  priceUsd: priceMap.get(assetIds[i]) ?? null
13789
13809
  }));
13790
- output(results, opts.json);
13810
+ if (opts.json) {
13811
+ output(results, true);
13812
+ } else {
13813
+ for (const r of results) {
13814
+ const priceStr = r.priceUsd !== null ? `$${r.priceUsd.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 6 })}` : "N/A";
13815
+ console.log(`${import_chalk6.default.bold(r.token.padEnd(10))} ${priceStr.padStart(14)} ${import_chalk6.default.dim(r.chain)}`);
13816
+ }
13817
+ }
13791
13818
  return;
13792
13819
  }
13793
13820
  const chain = resolveChain(token);
@@ -13812,7 +13839,12 @@ function registerQueryCommand(program2) {
13812
13839
  output({ token: token.toUpperCase(), chain, priceUsd: price, history: chartData.prices }, opts.json);
13813
13840
  return;
13814
13841
  }
13815
- output({ token: token.toUpperCase(), chain, priceUsd: price }, opts.json);
13842
+ if (opts.json) {
13843
+ output({ token: token.toUpperCase(), chain, priceUsd: price }, true);
13844
+ } else {
13845
+ const priceStr = price !== null ? `$${price.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 6 })}` : "N/A";
13846
+ console.log(`${import_chalk6.default.bold(token.toUpperCase())} ${priceStr} ${import_chalk6.default.dim(chain)}`);
13847
+ }
13816
13848
  } catch (err) {
13817
13849
  handleError(err, opts.json);
13818
13850
  }
@@ -13821,7 +13853,7 @@ function registerQueryCommand(program2) {
13821
13853
  try {
13822
13854
  const client = await getClient();
13823
13855
  const swapClient = new SwapClient(client);
13824
- const result = await swapClient.searchTokens({ query, limit: parseInt(opts.limit) });
13856
+ const result = await swapClient.searchTokens({ query, limit: parseInt(opts.limit, 10) });
13825
13857
  output(result, opts.json);
13826
13858
  } catch (err) {
13827
13859
  handleError(err, opts.json);
@@ -13845,7 +13877,14 @@ function registerQueryCommand(program2) {
13845
13877
  from: opts.from,
13846
13878
  to: opts.to
13847
13879
  });
13848
- output(result2.slice(0, parseInt(opts.limit)), opts.json);
13880
+ const sliced = result2.slice(0, parseInt(opts.limit, 10));
13881
+ if (opts.json) {
13882
+ output(sliced, true);
13883
+ } else if (sliced.length === 0) {
13884
+ info("No transactions found.");
13885
+ } else {
13886
+ output(sliced, false);
13887
+ }
13849
13888
  return;
13850
13889
  }
13851
13890
  let address = opts.address;
@@ -13860,7 +13899,7 @@ function registerQueryCommand(program2) {
13860
13899
  chain: opts.chain,
13861
13900
  from: opts.from,
13862
13901
  to: opts.to,
13863
- limit: parseInt(opts.limit)
13902
+ limit: parseInt(opts.limit, 10)
13864
13903
  });
13865
13904
  if (result.length > 0) {
13866
13905
  const chain = getChainById(opts.chain);
@@ -13885,7 +13924,13 @@ function registerQueryCommand(program2) {
13885
13924
  return;
13886
13925
  }
13887
13926
  }
13888
- output(result, opts.json);
13927
+ if (opts.json) {
13928
+ output(result, true);
13929
+ } else if (result.length === 0) {
13930
+ info("No transactions found.");
13931
+ } else {
13932
+ output(result, false);
13933
+ }
13889
13934
  } catch (err) {
13890
13935
  handleError(err, opts.json);
13891
13936
  }
@@ -13901,12 +13946,13 @@ function registerQueryCommand(program2) {
13901
13946
  }
13902
13947
  });
13903
13948
  program2.command("chains").description("List supported chains").option("--json", "JSON output").action(async (opts) => {
13904
- const chains = getSupportedChains();
13949
+ const chainEntries = Object.entries(CHAINS);
13905
13950
  if (opts.json) {
13906
- output(chains, true);
13951
+ output(chainEntries.map(([key, chain]) => ({ key, ...chain })), true);
13907
13952
  } else {
13908
- for (const chain of chains) {
13909
- console.log(`${chain.id.padEnd(15)} ${chain.name.padEnd(25)} coinId:${chain.coinId}`);
13953
+ for (const [key, chain] of chainEntries) {
13954
+ const idHint = key !== chain.id ? import_chalk6.default.dim(` (${chain.id})`) : "";
13955
+ console.log(`${key.padEnd(15)} ${chain.name.padEnd(25)} coinId:${chain.coinId}${idHint}`);
13910
13956
  }
13911
13957
  }
13912
13958
  });
@@ -14016,9 +14062,9 @@ function registerQueryCommand(program2) {
14016
14062
  if (opts.category) {
14017
14063
  const categoryId = categoryMap[opts.category] ?? opts.category;
14018
14064
  const sort = opts.sort ? sortMap[opts.sort] ?? opts.sort : "percent_change_24h";
14019
- tokens = await service.getAssetListings({ categoryId, sort, limit: parseInt(opts.limit) });
14065
+ tokens = await service.getAssetListings({ categoryId, sort, limit: parseInt(opts.limit, 10) });
14020
14066
  } else {
14021
- tokens = await service.getTrendingTokens(parseInt(opts.limit));
14067
+ tokens = await service.getTrendingTokens(parseInt(opts.limit, 10));
14022
14068
  }
14023
14069
  const seen = /* @__PURE__ */ new Map();
14024
14070
  for (const t of tokens) {
@@ -14055,7 +14101,7 @@ function registerQueryCommand(program2) {
14055
14101
  }
14056
14102
  return;
14057
14103
  }
14058
- const dapps = opts.search ? await service.search(opts.search, parseInt(opts.limit)) : await service.getTop(parseInt(opts.limit), opts.category);
14104
+ const dapps = opts.search ? await service.search(opts.search, parseInt(opts.limit, 10)) : await service.getTop(parseInt(opts.limit, 10), opts.category);
14059
14105
  if (opts.json) {
14060
14106
  output(dapps, true);
14061
14107
  } else {
@@ -28099,7 +28145,7 @@ var crypto3 = __toESM(require("crypto"));
28099
28145
  // package.json
28100
28146
  var package_default = {
28101
28147
  name: "@trustwallet/cli",
28102
- version: "0.6.3",
28148
+ version: "0.6.4",
28103
28149
  description: "TWAK CLI \u2014 command-line interface for Trust Wallet Agent Kit",
28104
28150
  main: "dist/index.js",
28105
28151
  types: "dist/index.d.ts",
@@ -28259,7 +28305,7 @@ function registerTelemetryCommand(program2) {
28259
28305
  // src/index.ts
28260
28306
  var VERSION2 = package_default.version;
28261
28307
  var program = new import_commander.Command();
28262
- program.name("twak").description("Trust Wallet Agent \u2014 AI-powered multichain wallet SDK").version(VERSION2).option("--no-analytics", "Disable telemetry for this invocation").addHelpText("beforeAll", () => {
28308
+ program.name("twak").description("Trust Wallet Agent \u2014 AI-powered multichain wallet SDK").version(VERSION2).option("--no-analytics", "Disable telemetry for this invocation").addHelpText("before", () => {
28263
28309
  printBanner(VERSION2);
28264
28310
  return "";
28265
28311
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustwallet/cli",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "TWAK CLI — command-line interface for Trust Wallet Agent Kit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,17 +27,17 @@
27
27
  "devDependencies": {
28
28
  "tsup": "8.5.1",
29
29
  "typescript": "5.7.3",
30
- "@twak/actions": "0.6.3",
31
- "@twak/blockchain": "0.6.3",
32
- "@twak/core": "0.6.3",
33
- "@twak/mcp": "0.6.3",
34
- "@twak/security": "0.6.3",
35
- "@twak/storage": "0.6.3",
36
- "@twak/swap": "0.6.3",
37
- "@twak/wallet": "0.6.3",
38
- "@twak/wallet-core": "0.6.3",
39
- "@twak/walletconnect": "0.6.3",
40
- "@twak/transactions": "0.6.3"
30
+ "@twak/core": "0.6.4",
31
+ "@twak/mcp": "0.6.4",
32
+ "@twak/security": "0.6.4",
33
+ "@twak/blockchain": "0.6.4",
34
+ "@twak/storage": "0.6.4",
35
+ "@twak/actions": "0.6.4",
36
+ "@twak/swap": "0.6.4",
37
+ "@twak/transactions": "0.6.4",
38
+ "@twak/wallet": "0.6.4",
39
+ "@twak/wallet-core": "0.6.4",
40
+ "@twak/walletconnect": "0.6.4"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -48,6 +48,13 @@
48
48
  head: { appendChild: function(){} }
49
49
  };
50
50
  }
51
+ // --- Suppress Node.js --localstorage-file warning from Trust SDK WASM ---
52
+ var _origEmit = process.emitWarning;
53
+ process.emitWarning = function(warning) {
54
+ if (typeof warning === 'string' && warning.indexOf('--localstorage-file') !== -1) return;
55
+ return _origEmit.apply(process, arguments);
56
+ };
57
+
51
58
  if (typeof globalThis.window === 'undefined') globalThis.window = globalThis;
52
59
  if (typeof globalThis.self === 'undefined') globalThis.self = globalThis;
53
60
  if (typeof globalThis.navigator === 'undefined') globalThis.navigator = { onLine: true, userAgent: 'Mozilla/5.0 (twak)' };