@t2000/cli 1.27.0 → 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.
@@ -29,6 +29,7 @@ import {
29
29
  OVERLAY_FEE_RATE,
30
30
  ProtocolRegistry,
31
31
  SAVE_FEE_BPS,
32
+ SPONSORED_PYTH_DEPENDENT_PROVIDERS,
32
33
  STABLE_ASSETS,
33
34
  SUI_DECIMALS,
34
35
  SUI_TYPE,
@@ -78,6 +79,7 @@ import {
78
79
  deserializeCetusRoute,
79
80
  displayHandle,
80
81
  exportPrivateKey,
82
+ extractAllUserLegs,
81
83
  extractTransferDetails,
82
84
  extractTxCommands,
83
85
  extractTxSender,
@@ -97,6 +99,7 @@ import {
97
99
  getPendingRewards,
98
100
  getPendingRewardsByAddress,
99
101
  getRates,
102
+ getSponsoredSwapProviders,
100
103
  getSwapQuote,
101
104
  getTier,
102
105
  getVoloStats,
@@ -136,7 +139,7 @@ import {
136
139
  validateLabel,
137
140
  verifyCetusRouteCoinMatch,
138
141
  walletExists
139
- } from "./chunk-GGXOFR5Y.js";
142
+ } from "./chunk-Y2HI3L2W.js";
140
143
  import "./chunk-NXTB2IJH.js";
141
144
  import "./chunk-OCLKPYUU.js";
142
145
  import "./chunk-6JATGRLJ.js";
@@ -175,6 +178,7 @@ export {
175
178
  OVERLAY_FEE_RATE,
176
179
  ProtocolRegistry,
177
180
  SAVE_FEE_BPS,
181
+ SPONSORED_PYTH_DEPENDENT_PROVIDERS,
178
182
  STABLE_ASSETS,
179
183
  SUI_DECIMALS,
180
184
  SUI_TYPE,
@@ -224,6 +228,7 @@ export {
224
228
  deserializeCetusRoute,
225
229
  displayHandle,
226
230
  exportPrivateKey,
231
+ extractAllUserLegs,
227
232
  extractTransferDetails,
228
233
  extractTxCommands,
229
234
  extractTxSender,
@@ -243,6 +248,7 @@ export {
243
248
  getPendingRewards,
244
249
  getPendingRewardsByAddress,
245
250
  getRates,
251
+ getSponsoredSwapProviders,
246
252
  getSwapQuote,
247
253
  getTier,
248
254
  getVoloStats,
@@ -283,4 +289,4 @@ export {
283
289
  verifyCetusRouteCoinMatch,
284
290
  walletExists
285
291
  };
286
- //# sourceMappingURL=dist-X5FWXI7K.js.map
292
+ //# sourceMappingURL=dist-NTKXLT3L.js.map
@@ -132056,6 +132056,7 @@ __export2(cetus_swap_exports, {
132056
132056
  deserializeCetusRoute: () => deserializeCetusRoute,
132057
132057
  findSwapRoute: () => findSwapRoute,
132058
132058
  isCetusRouteFresh: () => isCetusRouteFresh,
132059
+ isPrecomputedRouteCompatibleWithProviders: () => isPrecomputedRouteCompatibleWithProviders,
132059
132060
  resolveTokenType: () => resolveTokenType,
132060
132061
  serializeCetusRoute: () => serializeCetusRoute,
132061
132062
  simulateSwap: () => simulateSwap,
@@ -132172,6 +132173,14 @@ function getClient3(walletAddress, overlayFee) {
132172
132173
  clientCache.set(key, client);
132173
132174
  return client;
132174
132175
  }
132176
+ function isPrecomputedRouteCompatibleWithProviders(route, providers) {
132177
+ if (!providers || providers.length === 0) return true;
132178
+ const allowed = new Set(providers);
132179
+ for (const path of route.routerData.paths) {
132180
+ if (!allowed.has(path.provider)) return false;
132181
+ }
132182
+ return true;
132183
+ }
132175
132184
  async function findSwapRoute(params) {
132176
132185
  const client = getClient3(params.walletAddress, params.overlayFee);
132177
132186
  const findParams = {
@@ -132249,7 +132258,7 @@ async function addSwapToTx(tx, client, address2, input) {
132249
132258
  }
132250
132259
  let route;
132251
132260
  let usedPrecomputedRoute = false;
132252
- if (input.precomputedRoute && input.precomputedRoute.amountIn === effectiveRaw.toString() && input.precomputedRoute.byAmountIn === byAmountIn) {
132261
+ if (input.precomputedRoute && input.precomputedRoute.amountIn === effectiveRaw.toString() && input.precomputedRoute.byAmountIn === byAmountIn && isPrecomputedRouteCompatibleWithProviders(input.precomputedRoute, input.providers)) {
132253
132262
  route = input.precomputedRoute;
132254
132263
  usedPrecomputedRoute = true;
132255
132264
  } else {
@@ -132790,6 +132799,26 @@ function extractTransferDetails(changes, sender) {
132790
132799
  function bigintAbs(n) {
132791
132800
  return n < 0n ? -n : n;
132792
132801
  }
132802
+ function extractAllUserLegs(changes, sender) {
132803
+ if (!changes || changes.length === 0) return [];
132804
+ const legs = [];
132805
+ for (const c of changes) {
132806
+ if (resolveOwner(c.owner) !== sender) continue;
132807
+ const raw = BigInt(c.amount);
132808
+ if (raw === 0n) continue;
132809
+ const decimals2 = getDecimalsForCoinType(c.coinType);
132810
+ const absAmount = bigintAbs(raw);
132811
+ legs.push({
132812
+ coinType: c.coinType,
132813
+ asset: resolveSymbol(c.coinType),
132814
+ decimals: decimals2,
132815
+ amount: Number(absAmount) / 10 ** decimals2,
132816
+ rawAmount: raw.toString(),
132817
+ direction: raw < 0n ? "out" : "in"
132818
+ });
132819
+ }
132820
+ return legs;
132821
+ }
132793
132822
  async function queryHistory(client, address2, limit = 20) {
132794
132823
  const txns = await client.queryTransactionBlocks({
132795
132824
  filter: { FromAddress: address2 },
@@ -132815,6 +132844,7 @@ function parseTxRecord(tx, address2) {
132815
132844
  const gasCost = gasUsed ? (Number(gasUsed.computationCost) + Number(gasUsed.storageCost) - Number(gasUsed.storageRebate)) / 1e9 : void 0;
132816
132845
  const { moveCallTargets, commandTypes } = extractCommands(tx.transaction);
132817
132846
  const balanceChanges = tx.balanceChanges ?? [];
132847
+ const legs = extractAllUserLegs(balanceChanges, address2);
132818
132848
  const { amount: amount2, asset, recipient, direction } = extractTransferDetails(balanceChanges, address2);
132819
132849
  const { action, label } = classifyTransaction(
132820
132850
  moveCallTargets,
@@ -132826,6 +132856,7 @@ function parseTxRecord(tx, address2) {
132826
132856
  digest: tx.digest,
132827
132857
  action,
132828
132858
  label,
132859
+ legs,
132829
132860
  amount: amount2,
132830
132861
  asset,
132831
132862
  recipient,
@@ -139820,7 +139851,7 @@ ${context}
139820
139851
  })
139821
139852
  );
139822
139853
  }
139823
- var PKG_VERSION = "1.27.0";
139854
+ var PKG_VERSION = "1.27.2";
139824
139855
  console.log = (...args) => console.error("[log]", ...args);
139825
139856
  console.warn = (...args) => console.error("[warn]", ...args);
139826
139857
  async function startMcpServer(opts) {
@@ -139910,4 +139941,4 @@ axios/dist/node/axios.cjs:
139910
139941
  @scure/bip39/index.js:
139911
139942
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
139912
139943
  */
139913
- //# sourceMappingURL=dist-OECMFTLF.js.map
139944
+ //# sourceMappingURL=dist-VMYL2LVD.js.map