@t2000/cli 5.5.0 → 5.5.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.
package/dist/index.js CHANGED
@@ -28067,7 +28067,7 @@ var TX_NODE_FRAGMENT = `
28067
28067
  }
28068
28068
  `;
28069
28069
  var HISTORY_QUERY = `query History($address: SuiAddress!, $last: Int!) {
28070
- transactions(last: $last, filter: { sentAddress: $address }) {
28070
+ transactions(last: $last, filter: { affectedAddress: $address }) {
28071
28071
  nodes {${TX_NODE_FRAGMENT}}
28072
28072
  }
28073
28073
  }`;
@@ -28137,7 +28137,9 @@ function buildRecord(args) {
28137
28137
  return { digest, action, label, legs, amount, asset, recipient, direction, timestamp: timestampMs, gasCost };
28138
28138
  }
28139
28139
  init_token_registry();
28140
- var SUI_MAINNET_URL = "https://fullnode.mainnet.sui.io:443";
28140
+ var RESOLVE_NAME_QUERY = `query ResolveSuins($name: String!) {
28141
+ address(name: $name) { address }
28142
+ }`;
28141
28143
  var SUI_ADDRESS_REGEX = /^0x[a-fA-F0-9]{1,64}$/i;
28142
28144
  var SUINS_NAME_REGEX = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.sui$/;
28143
28145
  var InvalidAddressError = class extends Error {
@@ -28174,38 +28176,22 @@ async function resolveSuinsViaRpc(rawName, ctx = {}) {
28174
28176
  if (!SUINS_NAME_REGEX.test(name)) {
28175
28177
  throw new InvalidAddressError(rawName);
28176
28178
  }
28177
- const url = ctx.suiRpcUrl || SUI_MAINNET_URL;
28179
+ const gql = getSuiGraphQLClient();
28178
28180
  let res;
28179
28181
  try {
28180
- res = await fetch(url, {
28181
- method: "POST",
28182
- headers: { "Content-Type": "application/json" },
28183
- body: JSON.stringify({
28184
- jsonrpc: "2.0",
28185
- id: 1,
28186
- method: "suix_resolveNameServiceAddress",
28187
- params: [name]
28188
- }),
28189
- signal: ctx.signal ?? AbortSignal.timeout(8e3)
28182
+ res = await gql.query({
28183
+ query: RESOLVE_NAME_QUERY,
28184
+ variables: { name },
28185
+ signal: ctx.signal
28190
28186
  });
28191
28187
  } catch (err) {
28192
28188
  const msg = err instanceof Error ? err.message : String(err);
28193
28189
  throw new SuinsRpcError(name, msg);
28194
28190
  }
28195
- if (!res.ok) {
28196
- throw new SuinsRpcError(name, `HTTP ${res.status}`);
28197
- }
28198
- let body;
28199
- try {
28200
- body = await res.json();
28201
- } catch (err) {
28202
- const msg = err instanceof Error ? err.message : String(err);
28203
- throw new SuinsRpcError(name, `JSON parse failed: ${msg}`);
28204
- }
28205
- if (body.error) {
28206
- throw new SuinsRpcError(name, body.error.message);
28191
+ if (res.errors?.length) {
28192
+ throw new SuinsRpcError(name, res.errors.map((e) => e.message ?? "unknown error").join("; "));
28207
28193
  }
28208
- return body.result ?? null;
28194
+ return res.data?.address?.address ?? null;
28209
28195
  }
28210
28196
  init_errors();
28211
28197
  var DEFAULT_CONFIG_DIR = join2(homedir(), ".t2000");
@@ -31452,9 +31438,9 @@ function printTxSummary(tx) {
31452
31438
  const label = ACTION_LABELS[tx.action] ?? `\u{1F4E6} ${tx.action}`;
31453
31439
  const time = tx.timestamp ? relativeTime(tx.timestamp) : "";
31454
31440
  const amount = formatAmount(tx);
31455
- const recipient = tx.recipient ? import_picocolors4.default.dim(`\u2192 ${truncateAddress(tx.recipient)}`) : "";
31441
+ const direction = tx.direction === "in" ? import_picocolors4.default.green("\u2190 received") : tx.recipient ? import_picocolors4.default.dim(`\u2192 ${truncateAddress(tx.recipient)}`) : "";
31456
31442
  const link = import_picocolors4.default.dim(explorerUrl(tx.digest));
31457
- printLine(`${label} ${amount} ${recipient}`);
31443
+ printLine(`${label} ${amount} ${direction}`);
31458
31444
  printLine(` ${import_picocolors4.default.dim(truncateAddress(tx.digest))} ${import_picocolors4.default.dim(time)}`);
31459
31445
  printLine(` ${link}`);
31460
31446
  }
@@ -31464,6 +31450,7 @@ function printTxDetail(tx) {
31464
31450
  printKeyValue("Type", label);
31465
31451
  printKeyValue("Digest", tx.digest);
31466
31452
  if (tx.amount) printKeyValue("Amount", `${tx.amount.toFixed(tx.amount < 0.01 ? 6 : 4)} ${tx.asset ?? ""}`);
31453
+ if (tx.direction) printKeyValue("Direction", tx.direction === "in" ? "Received" : "Sent");
31467
31454
  if (tx.recipient) printKeyValue("Recipient", tx.recipient);
31468
31455
  if (tx.timestamp) {
31469
31456
  printKeyValue("Time", `${new Date(tx.timestamp).toLocaleString()} (${relativeTime(tx.timestamp)})`);
@@ -32403,7 +32390,7 @@ function registerMcpStart(parent) {
32403
32390
  parent.command("start", { isDefault: true }).description("Start MCP server (stdio transport \u2014 for AI client integration)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
32404
32391
  let mod2;
32405
32392
  try {
32406
- mod2 = await import("./dist-4JZ33TE5.js");
32393
+ mod2 = await import("./dist-OMYCTHXH.js");
32407
32394
  } catch {
32408
32395
  console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
32409
32396
  process.exit(1);