@t2000/cli 1.27.1 → 1.27.2

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.
@@ -17509,6 +17509,26 @@ function extractTransferDetails(changes, sender) {
17509
17509
  function bigintAbs(n) {
17510
17510
  return n < 0n ? -n : n;
17511
17511
  }
17512
+ function extractAllUserLegs(changes, sender) {
17513
+ if (!changes || changes.length === 0) return [];
17514
+ const legs = [];
17515
+ for (const c of changes) {
17516
+ if (resolveOwner(c.owner) !== sender) continue;
17517
+ const raw = BigInt(c.amount);
17518
+ if (raw === 0n) continue;
17519
+ const decimals = getDecimalsForCoinType(c.coinType);
17520
+ const absAmount = bigintAbs(raw);
17521
+ legs.push({
17522
+ coinType: c.coinType,
17523
+ asset: resolveSymbol(c.coinType),
17524
+ decimals,
17525
+ amount: Number(absAmount) / 10 ** decimals,
17526
+ rawAmount: raw.toString(),
17527
+ direction: raw < 0n ? "out" : "in"
17528
+ });
17529
+ }
17530
+ return legs;
17531
+ }
17512
17532
  async function queryHistory(client, address, limit = 20) {
17513
17533
  const txns = await client.queryTransactionBlocks({
17514
17534
  filter: { FromAddress: address },
@@ -17550,6 +17570,7 @@ function parseTxRecord(tx, address) {
17550
17570
  const gasCost = gasUsed ? (Number(gasUsed.computationCost) + Number(gasUsed.storageCost) - Number(gasUsed.storageRebate)) / 1e9 : void 0;
17551
17571
  const { moveCallTargets, commandTypes } = extractCommands(tx.transaction);
17552
17572
  const balanceChanges = tx.balanceChanges ?? [];
17573
+ const legs = extractAllUserLegs(balanceChanges, address);
17553
17574
  const { amount, asset, recipient, direction } = extractTransferDetails(balanceChanges, address);
17554
17575
  const { action, label } = classifyTransaction(
17555
17576
  moveCallTargets,
@@ -17561,6 +17582,7 @@ function parseTxRecord(tx, address) {
17561
17582
  digest: tx.digest,
17562
17583
  action,
17563
17584
  label,
17585
+ legs,
17564
17586
  amount,
17565
17587
  asset,
17566
17588
  recipient,
@@ -24241,6 +24263,7 @@ export {
24241
24263
  refineLendingLabel,
24242
24264
  classifyTransaction,
24243
24265
  extractTransferDetails,
24266
+ extractAllUserLegs,
24244
24267
  queryHistory,
24245
24268
  queryTransaction,
24246
24269
  parseSuiRpcTx,
@@ -24307,4 +24330,4 @@ axios/dist/node/axios.cjs:
24307
24330
  @scure/bip39/index.js:
24308
24331
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
24309
24332
  */
24310
- //# sourceMappingURL=chunk-V5GSOFGJ.js.map
24333
+ //# sourceMappingURL=chunk-Y2HI3L2W.js.map