@t2000/cli 0.46.1 → 0.46.3

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.
@@ -130548,12 +130548,26 @@ async function queryBalance(client, address2) {
130548
130548
  };
130549
130549
  }
130550
130550
  init_token_registry();
130551
- init_token_registry();
130552
130551
  var KNOWN_TARGETS = [
130553
130552
  [/::suilend|::obligation/, "lending"],
130554
130553
  [/::navi|::lending_core|::incentive_v\d+|::oracle_pro/, "lending"],
130555
- [/::cetus|::pool/, "swap"],
130556
- [/::deepbook/, "swap"],
130554
+ /**
130555
+ * DEX modules — both direct calls and aggregator legs. The Cetus
130556
+ * aggregator dispatches through a per-DEX module (e.g.
130557
+ * `cetus::swap`, `flowx_amm::swap`, `aftermath::swap`, …) plus
130558
+ * router glue functions. We list every DEX module the aggregator
130559
+ * supports today so a single-DEX call still classifies cleanly.
130560
+ */
130561
+ [/::cetus(?:_dlmm)?::|::pool::|::deepbook|::flowx_(?:amm|clmm)::|::kriya_(?:amm|clmm)::|::turbos::|::aftermath::|::afsui::|::bluefin::|::bluemove::|::ferra_(?:clmm|dlmm)::|::haedal_hmm::|::hasui::|::hawal::|::magma::|::momentum::|::obric::|::springsui::|::steamm_cpmm::|::fullsail::|::alphafi::|::volo_swap::/, "swap"],
130562
+ /**
130563
+ * Cetus aggregator router glue. These are the swap-context and
130564
+ * balance-handling helpers the aggregator emits around per-DEX
130565
+ * legs. Without this entry a tx that ONLY had router calls
130566
+ * (theoretically possible for setup/cleanup) would slip through;
130567
+ * in practice these always coexist with a DEX leg, but the entry
130568
+ * is cheap insurance.
130569
+ */
130570
+ [/::router::(?:new_swap_context(?:_v)?|confirm_swap|transfer_balance|take_balance|transfer_or_destroy_coin)/, "swap"],
130557
130571
  [/::transfer::public_transfer/, "send"]
130558
130572
  ];
130559
130573
  var LABEL_PATTERNS = [
@@ -130596,6 +130610,8 @@ function classifyLabel(targets, commandTypes) {
130596
130610
  }
130597
130611
  }
130598
130612
  if (commandTypes.includes("TransferObjects") && !commandTypes.includes("MoveCall")) return "send";
130613
+ const action = classifyAction(targets, commandTypes);
130614
+ if (action !== "transaction") return action;
130599
130615
  return fallbackLabel(targets);
130600
130616
  }
130601
130617
  function refineLendingLabel(currentAction, currentLabel, moveCallTargets, changes, address2) {
@@ -130620,6 +130636,39 @@ function classifyTransaction(moveCallTargets, commandTypes, balanceChanges, addr
130620
130636
  const label = refineLendingLabel(action, baseLabel, moveCallTargets, balanceChanges, address2);
130621
130637
  return { action, label };
130622
130638
  }
130639
+ function extractTransferDetails(changes, sender) {
130640
+ if (!changes || changes.length === 0) return {};
130641
+ const userChanges = changes.filter((c) => resolveOwner(c.owner) === sender);
130642
+ if (userChanges.length === 0) return {};
130643
+ const userNonSui = userChanges.filter((c) => c.coinType !== SUI_TYPE2);
130644
+ const pool = userNonSui.length > 0 ? userNonSui : userChanges;
130645
+ let primary = pool[0];
130646
+ let primaryAbs = bigintAbs(BigInt(primary.amount));
130647
+ for (let i = 1; i < pool.length; i++) {
130648
+ const abs2 = bigintAbs(BigInt(pool[i].amount));
130649
+ if (abs2 > primaryAbs) {
130650
+ primary = pool[i];
130651
+ primaryAbs = abs2;
130652
+ }
130653
+ }
130654
+ const raw = BigInt(primary.amount);
130655
+ if (raw === 0n) return {};
130656
+ const decimals2 = getDecimalsForCoinType(primary.coinType);
130657
+ const amount2 = Number(primaryAbs) / 10 ** decimals2;
130658
+ const asset = resolveSymbol(primary.coinType);
130659
+ const direction = raw < 0n ? "out" : "in";
130660
+ let recipient;
130661
+ if (direction === "out") {
130662
+ const recipientChange = changes.find(
130663
+ (c) => resolveOwner(c.owner) !== sender && c.coinType === primary.coinType && BigInt(c.amount) > 0n
130664
+ );
130665
+ recipient = recipientChange ? resolveOwner(recipientChange.owner) ?? void 0 : void 0;
130666
+ }
130667
+ return { amount: amount2, asset, recipient, direction };
130668
+ }
130669
+ function bigintAbs(n) {
130670
+ return n < 0n ? -n : n;
130671
+ }
130623
130672
  async function queryHistory(client, address2, limit = 20) {
130624
130673
  const txns = await client.queryTransactionBlocks({
130625
130674
  filter: { FromAddress: address2 },
@@ -130645,7 +130694,7 @@ function parseTxRecord(tx, address2) {
130645
130694
  const gasCost = gasUsed ? (Number(gasUsed.computationCost) + Number(gasUsed.storageCost) - Number(gasUsed.storageRebate)) / 1e9 : void 0;
130646
130695
  const { moveCallTargets, commandTypes } = extractCommands(tx.transaction);
130647
130696
  const balanceChanges = tx.balanceChanges ?? [];
130648
- const { amount: amount2, asset, recipient } = extractTransferDetails(balanceChanges, address2);
130697
+ const { amount: amount2, asset, recipient, direction } = extractTransferDetails(balanceChanges, address2);
130649
130698
  const { action, label } = classifyTransaction(
130650
130699
  moveCallTargets,
130651
130700
  commandTypes,
@@ -130659,29 +130708,11 @@ function parseTxRecord(tx, address2) {
130659
130708
  amount: amount2,
130660
130709
  asset,
130661
130710
  recipient,
130711
+ direction,
130662
130712
  timestamp: Number(tx.timestampMs ?? 0),
130663
130713
  gasCost
130664
130714
  };
130665
130715
  }
130666
- function resolveOwner2(owner) {
130667
- if (typeof owner === "object" && owner.AddressOwner) return owner.AddressOwner;
130668
- if (typeof owner === "string") return owner;
130669
- return null;
130670
- }
130671
- function extractTransferDetails(changes, sender) {
130672
- if (!changes || changes.length === 0) return {};
130673
- const outflows = changes.filter((c) => resolveOwner2(c.owner) === sender && BigInt(c.amount) < 0n);
130674
- const inflows = changes.filter((c) => resolveOwner2(c.owner) !== sender && BigInt(c.amount) > 0n);
130675
- const primaryOutflow = outflows.filter((c) => c.coinType !== SUI_TYPE2).sort((a, b2) => Number(BigInt(a.amount) - BigInt(b2.amount)))[0] ?? outflows[0];
130676
- if (!primaryOutflow) return {};
130677
- const coinType = primaryOutflow.coinType;
130678
- const decimals2 = getDecimalsForCoinType(coinType);
130679
- const amount2 = Math.abs(Number(BigInt(primaryOutflow.amount))) / 10 ** decimals2;
130680
- const asset = resolveSymbol(coinType);
130681
- const recipientChange = inflows.find((c) => c.coinType === coinType);
130682
- const recipient = recipientChange ? resolveOwner2(recipientChange.owner) ?? void 0 : void 0;
130683
- return { amount: amount2, asset, recipient };
130684
- }
130685
130716
  function extractCommands(txBlock) {
130686
130717
  const result = { moveCallTargets: [], commandTypes: [] };
130687
130718
  try {
@@ -138029,7 +138060,7 @@ ${context}
138029
138060
  })
138030
138061
  );
138031
138062
  }
138032
- var PKG_VERSION = "0.46.1";
138063
+ var PKG_VERSION = "0.46.3";
138033
138064
  console.log = (...args) => console.error("[log]", ...args);
138034
138065
  console.warn = (...args) => console.error("[warn]", ...args);
138035
138066
  async function startMcpServer(opts) {
@@ -138119,4 +138150,4 @@ axios/dist/node/axios.cjs:
138119
138150
  *)
138120
138151
  *)
138121
138152
  */
138122
- //# sourceMappingURL=dist-LGHHHTO2.js.map
138153
+ //# sourceMappingURL=dist-4YHW4PXA.js.map