@t2000/cli 0.24.0 → 0.24.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.
@@ -66845,6 +66845,41 @@ function parseMoveAbort2(errorStr) {
66845
66845
  }
66846
66846
  return { reason: errorStr };
66847
66847
  }
66848
+ async function getSwapQuote(params) {
66849
+ const { findSwapRoute: findSwapRoute2, resolveTokenType: resolveTokenType2, TOKEN_MAP: TOKEN_MAP2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
66850
+ const fromType = resolveTokenType2(params.from);
66851
+ const toType = resolveTokenType2(params.to);
66852
+ if (!fromType) throw new Error(`Unknown token: ${params.from}. Provide the full coin type.`);
66853
+ if (!toType) throw new Error(`Unknown token: ${params.to}. Provide the full coin type.`);
66854
+ const byAmountIn = params.byAmountIn ?? true;
66855
+ const fromEntry = Object.values(TOKEN_MAP2).includes(fromType) ? Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === fromType) : null;
66856
+ const fromDecimals = fromEntry ? fromEntry[1].decimals : fromType === "0x2::sui::SUI" ? 9 : 6;
66857
+ const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
66858
+ const route = await findSwapRoute2({
66859
+ walletAddress: params.walletAddress,
66860
+ from: fromType,
66861
+ to: toType,
66862
+ amount: rawAmount,
66863
+ byAmountIn
66864
+ });
66865
+ if (!route) throw new Error(`No swap route found for ${params.from} -> ${params.to}.`);
66866
+ if (route.insufficientLiquidity) throw new Error(`Insufficient liquidity for ${params.from} -> ${params.to}.`);
66867
+ const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
66868
+ const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
66869
+ const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
66870
+ const toAmount = Number(route.amountOut) / 10 ** toDecimals;
66871
+ const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
66872
+ return {
66873
+ fromToken: params.from,
66874
+ toToken: params.to,
66875
+ fromAmount,
66876
+ toAmount,
66877
+ priceImpact: route.priceImpact,
66878
+ route: routeDesc
66879
+ };
66880
+ }
66881
+ init_cetus_swap();
66882
+ init_volo();
66848
66883
 
66849
66884
  export {
66850
66885
  ZodOptional,
@@ -66854,6 +66889,17 @@ export {
66854
66889
  mapWalletError,
66855
66890
  mapMoveAbortCode,
66856
66891
  T2000Error,
66892
+ getVoloStats,
66893
+ buildStakeVSuiTx,
66894
+ buildUnstakeVSuiTx,
66895
+ VOLO_PKG,
66896
+ VOLO_POOL,
66897
+ VOLO_METADATA,
66898
+ VSUI_TYPE,
66899
+ findSwapRoute,
66900
+ buildSwapTx,
66901
+ resolveTokenType,
66902
+ TOKEN_MAP,
66857
66903
  MIST_PER_SUI2 as MIST_PER_SUI,
66858
66904
  SUI_DECIMALS2 as SUI_DECIMALS,
66859
66905
  USDC_DECIMALS,
@@ -66904,7 +66950,8 @@ export {
66904
66950
  ContactManager,
66905
66951
  T2000,
66906
66952
  simulateTransaction,
66907
- throwIfSimulationFailed
66953
+ throwIfSimulationFailed,
66954
+ getSwapQuote
66908
66955
  };
66909
66956
  /*! Bundled license information:
66910
66957
 
@@ -66953,4 +67000,4 @@ axios/dist/node/axios.cjs:
66953
67000
  @scure/bip39/index.js:
66954
67001
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
66955
67002
  */
66956
- //# sourceMappingURL=chunk-JJCGJTSI.js.map
67003
+ //# sourceMappingURL=chunk-NVVRO5EM.js.map