@t2000/cli 1.24.6 → 1.24.7

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.
@@ -23908,13 +23908,24 @@ function parseMoveAbort(errorStr) {
23908
23908
  }
23909
23909
  return { reason: errorStr };
23910
23910
  }
23911
+ init_errors();
23911
23912
  init_token_registry();
23912
23913
  async function getSwapQuote(params) {
23913
23914
  const { findSwapRoute: findSwapRoute2, resolveTokenType: resolveTokenType2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
23914
23915
  const fromType = resolveTokenType2(params.from);
23915
23916
  const toType = resolveTokenType2(params.to);
23916
- if (!fromType) throw new Error(`Unknown token: ${params.from}. Provide the full coin type.`);
23917
- if (!toType) throw new Error(`Unknown token: ${params.to}. Provide the full coin type.`);
23917
+ if (!fromType) {
23918
+ throw new T2000Error(
23919
+ "ASSET_NOT_SUPPORTED",
23920
+ `Unknown token: ${params.from}. Provide the symbol (USDC, SUI, ...) or full coin type.`
23921
+ );
23922
+ }
23923
+ if (!toType) {
23924
+ throw new T2000Error(
23925
+ "ASSET_NOT_SUPPORTED",
23926
+ `Unknown token: ${params.to}. Provide the symbol (USDC, SUI, ...) or full coin type.`
23927
+ );
23928
+ }
23918
23929
  const byAmountIn = params.byAmountIn ?? true;
23919
23930
  const fromDecimals = getDecimalsForCoinType(fromType);
23920
23931
  const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
@@ -23925,8 +23936,10 @@ async function getSwapQuote(params) {
23925
23936
  amount: rawAmount,
23926
23937
  byAmountIn
23927
23938
  });
23928
- if (!route) throw new Error(`No swap route found for ${params.from} -> ${params.to}.`);
23929
- if (route.insufficientLiquidity) throw new Error(`Insufficient liquidity for ${params.from} -> ${params.to}.`);
23939
+ if (!route) throw new T2000Error("SWAP_FAILED", `No swap route found for ${params.from} -> ${params.to}.`);
23940
+ if (route.insufficientLiquidity) {
23941
+ throw new T2000Error("SWAP_FAILED", `Insufficient liquidity for ${params.from} -> ${params.to}.`);
23942
+ }
23930
23943
  const toDecimals = getDecimalsForCoinType(toType);
23931
23944
  const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
23932
23945
  const toAmount = Number(route.amountOut) / 10 ** toDecimals;
@@ -24162,4 +24175,4 @@ axios/dist/node/axios.cjs:
24162
24175
  @scure/bip39/index.js:
24163
24176
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
24164
24177
  */
24165
- //# sourceMappingURL=chunk-P7CVUSZI.js.map
24178
+ //# sourceMappingURL=chunk-TTDWK2PS.js.map