@trustwallet/cli 0.6.7 → 0.6.8

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":"alert.d.ts","sourceRoot":"","sources":["../../src/commands/alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0H3D"}
1
+ {"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/commands/alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6H3D"}
@@ -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;AAmBpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqf3D"}
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,CA2f3D"}
@@ -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;AA4BpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+rB5D"}
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/commands/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4BpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmsB5D"}
package/dist/index.js CHANGED
@@ -12813,7 +12813,7 @@ var init_dapps_service = __esm({
12813
12813
  let protocols = await this.getProtocols();
12814
12814
  if (category) {
12815
12815
  const lower = category.toLowerCase();
12816
- protocols = protocols.filter((p3) => p3.category.toLowerCase() === lower);
12816
+ protocols = protocols.filter((p3) => p3.category.toLowerCase().includes(lower));
12817
12817
  }
12818
12818
  return protocols.sort((a3, b3) => b3.tvl - a3.tvl).slice(0, limit);
12819
12819
  }
@@ -38861,15 +38861,18 @@ ${qr3}`;
38861
38861
  const exists = await store.exists();
38862
38862
  const kc2 = new KeychainManager();
38863
38863
  const keychainHasPassword = kc2.isAvailable() ? !!await kc2.getWalletPassword() : false;
38864
+ const totalChains = Object.keys(CHAINS).length;
38864
38865
  const result = {
38865
38866
  agentWallet: exists ? "configured" : "not configured",
38866
- keychainPassword: keychainHasPassword ? "stored" : "not stored"
38867
+ keychainPassword: keychainHasPassword ? "stored" : "not stored",
38868
+ chains: totalChains
38867
38869
  };
38868
38870
  if (opts.json) {
38869
38871
  output(result, true);
38870
38872
  } else {
38871
38873
  console.log(` ${import_chalk5.default.dim("Wallet")} ${exists ? import_chalk5.default.green("configured") : import_chalk5.default.yellow("not configured")}`);
38872
38874
  console.log(` ${import_chalk5.default.dim("Keychain")} ${keychainHasPassword ? import_chalk5.default.green("password stored") : import_chalk5.default.yellow("no password")}`);
38875
+ console.log(` ${import_chalk5.default.dim("Chains")} ${totalChains} supported`);
38873
38876
  if (!exists) info("\nRun `twak wallet create --password <pw>` to create a wallet.");
38874
38877
  }
38875
38878
  });
@@ -39169,7 +39172,7 @@ var SwapClient = class {
39169
39172
  to: { asset: step.to.asset, address: step.to.address, amount: step.to.amount, minAmountOut: step.to.minAmountOut },
39170
39173
  slippage: step.slippage,
39171
39174
  priceInfo: step.priceInfo,
39172
- priceImpact: step.priceImpact,
39175
+ priceImpact: step.priceImpact ?? "0",
39173
39176
  providerFees: step.providerFees,
39174
39177
  networkFee: step.networkFee,
39175
39178
  provider: step.provider,
@@ -39667,6 +39670,16 @@ function registerErc20Command(program3) {
39667
39670
  // src/commands/alert.ts
39668
39671
  init_dist();
39669
39672
  init_dist2();
39673
+ function resolveTokenLabel(tokenId) {
39674
+ try {
39675
+ const { coinId, contractAddress } = parseTokenId(tokenId);
39676
+ const chain2 = getChainByCoinId(coinId);
39677
+ if (chain2 && !contractAddress) return chain2.symbol;
39678
+ return tokenId;
39679
+ } catch {
39680
+ return tokenId;
39681
+ }
39682
+ }
39670
39683
  function registerAlertCommand(program3) {
39671
39684
  const alert = program3.command("alert").description("Manage price alerts");
39672
39685
  const alertStore = new AlertStore();
@@ -39720,7 +39733,10 @@ function registerAlertCommand(program3) {
39720
39733
  return;
39721
39734
  }
39722
39735
  for (const a3 of alerts) {
39723
- info(`${a3.id} | ${a3.tokenId} | ${a3.condition} $${a3.targetPrice} | ${a3.active ? "active" : "triggered"}`);
39736
+ const label = resolveTokenLabel(a3.tokenId);
39737
+ const chain2 = tokenIdToChain(a3.tokenId);
39738
+ const chainHint = chain2 ? ` (${chain2})` : "";
39739
+ info(`${a3.id} | ${label}${chainHint} | ${a3.condition} $${a3.targetPrice} | ${a3.active ? "active" : "triggered"}`);
39724
39740
  }
39725
39741
  }
39726
39742
  });
@@ -39891,20 +39907,25 @@ function registerQueryCommand(program3) {
39891
39907
  if (opts.history) {
39892
39908
  const chainInfo = getChainById(chain2);
39893
39909
  if (!chainInfo) throw new Error(`Unknown chain: ${chain2}`);
39894
- const assetId = tokenInfo.address ? `c${chainInfo.coinId}_t${tokenInfo.address}` : `c${chainInfo.coinId}`;
39895
- const chartData = await client.gateway(
39910
+ const isNative = !tokenInfo.address || tokenInfo.address === NATIVE_TOKEN_ADDRESS || tokenInfo.address === SOLANA_NATIVE_ADDRESS;
39911
+ const assetId = isNative ? `c${chainInfo.coinId}` : `c${chainInfo.coinId}_t${tokenInfo.address}`;
39912
+ const chartData = await client.market(
39896
39913
  "GET",
39897
- `/v2/market/charts/${encodeURIComponent(assetId)}`,
39898
- void 0,
39899
- `currency=USD&period=${opts.history}`
39914
+ `/v2/market/charts/${encodeURIComponent(assetId)}?currency=USD&period=${opts.history}`
39900
39915
  );
39901
39916
  output({ token: token.toUpperCase(), chain: chain2, priceUsd: price, history: chartData.prices }, opts.json);
39902
39917
  return;
39903
39918
  }
39919
+ if (price === null) {
39920
+ error(`Token not found: ${token}`);
39921
+ if (opts.json) output({ token: token.toUpperCase(), chain: chain2, priceUsd: null, error: "Token not found" }, true);
39922
+ process.exitCode = 1;
39923
+ return;
39924
+ }
39904
39925
  if (opts.json) {
39905
39926
  output({ token: token.toUpperCase(), chain: chain2, priceUsd: price }, true);
39906
39927
  } else {
39907
- const priceStr = price !== null ? `$${price.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 6 })}` : "N/A";
39928
+ const priceStr = `$${price.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 6 })}`;
39908
39929
  console.log(`${import_chalk6.default.bold(token.toUpperCase())} ${priceStr} ${import_chalk6.default.dim(chain2)}`);
39909
39930
  }
39910
39931
  } catch (err) {
@@ -54236,7 +54257,7 @@ var crypto5 = __toESM(require("crypto"));
54236
54257
  // package.json
54237
54258
  var package_default = {
54238
54259
  name: "@trustwallet/cli",
54239
- version: "0.6.7",
54260
+ version: "0.6.8",
54240
54261
  description: "TWAK CLI \u2014 command-line interface for Trust Wallet Agent Kit",
54241
54262
  main: "dist/index.js",
54242
54263
  types: "dist/index.d.ts",
@@ -54256,6 +54277,7 @@ var package_default = {
54256
54277
  clean: "rm -rf dist"
54257
54278
  },
54258
54279
  dependencies: {
54280
+ "node-fetch": "2.7.0",
54259
54281
  "qrcode-terminal": "0.12.0"
54260
54282
  },
54261
54283
  optionalDependencies: {
@@ -54266,7 +54288,6 @@ var package_default = {
54266
54288
  boxen: "5.1.2",
54267
54289
  chalk: "4.1.2",
54268
54290
  commander: "12.1.0",
54269
- "node-fetch": "2.7.0",
54270
54291
  ora: "5.4.1",
54271
54292
  "@twak/actions": "workspace:*",
54272
54293
  "@twak/blockchain": "workspace:*",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustwallet/cli",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
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",
@@ -13,6 +13,7 @@
13
13
  "scripts"
14
14
  ],
15
15
  "dependencies": {
16
+ "node-fetch": "2.7.0",
16
17
  "qrcode-terminal": "0.12.0"
17
18
  },
18
19
  "optionalDependencies": {
@@ -23,21 +24,20 @@
23
24
  "boxen": "5.1.2",
24
25
  "chalk": "4.1.2",
25
26
  "commander": "12.1.0",
26
- "node-fetch": "2.7.0",
27
27
  "ora": "5.4.1",
28
28
  "tsup": "8.5.1",
29
29
  "typescript": "5.7.3",
30
- "@twak/actions": "0.6.7",
31
- "@twak/storage": "0.6.7",
32
- "@twak/swap": "0.6.7",
33
- "@twak/transactions": "0.6.7",
34
- "@twak/wallet": "0.6.7",
35
- "@twak/wallet-core": "0.6.7",
36
- "@twak/walletconnect": "0.6.7",
37
- "@twak/blockchain": "0.6.7",
38
- "@twak/core": "0.6.7",
39
- "@twak/security": "0.6.7",
40
- "@twak/mcp": "0.6.7"
30
+ "@twak/actions": "0.6.8",
31
+ "@twak/blockchain": "0.6.8",
32
+ "@twak/core": "0.6.8",
33
+ "@twak/mcp": "0.6.8",
34
+ "@twak/security": "0.6.8",
35
+ "@twak/storage": "0.6.8",
36
+ "@twak/transactions": "0.6.8",
37
+ "@twak/wallet": "0.6.8",
38
+ "@twak/wallet-core": "0.6.8",
39
+ "@twak/swap": "0.6.8",
40
+ "@twak/walletconnect": "0.6.8"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"