@t2000/cli 0.25.12 → 0.25.14

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.
@@ -63840,6 +63840,96 @@ var init_errors = __esm2({
63840
63840
  };
63841
63841
  }
63842
63842
  });
63843
+ function getDecimalsForCoinType(coinType) {
63844
+ const direct = BY_TYPE.get(coinType);
63845
+ if (direct) return direct.decimals;
63846
+ const suffix = coinType.split("::").slice(1).join("::").toUpperCase();
63847
+ if (suffix) {
63848
+ for (const meta of BY_TYPE.values()) {
63849
+ const metaSuffix = meta.type.split("::").slice(1).join("::").toUpperCase();
63850
+ if (metaSuffix === suffix) return meta.decimals;
63851
+ }
63852
+ }
63853
+ return 9;
63854
+ }
63855
+ function resolveSymbol(coinType) {
63856
+ const direct = BY_TYPE.get(coinType);
63857
+ if (direct) return direct.symbol;
63858
+ const suffix = coinType.split("::").slice(1).join("::").toUpperCase();
63859
+ if (suffix) {
63860
+ for (const meta of BY_TYPE.values()) {
63861
+ const metaSuffix = meta.type.split("::").slice(1).join("::").toUpperCase();
63862
+ if (metaSuffix === suffix) return meta.symbol;
63863
+ }
63864
+ }
63865
+ return coinType.split("::").pop() ?? coinType;
63866
+ }
63867
+ function resolveTokenType(nameOrType) {
63868
+ if (nameOrType.includes("::")) return nameOrType;
63869
+ return TOKEN_MAP[nameOrType] ?? TOKEN_MAP[nameOrType.toUpperCase()] ?? null;
63870
+ }
63871
+ var COIN_REGISTRY;
63872
+ var BY_TYPE;
63873
+ var TOKEN_MAP;
63874
+ var SUI_TYPE;
63875
+ var USDC_TYPE;
63876
+ var USDT_TYPE;
63877
+ var USDSUI_TYPE;
63878
+ var USDE_TYPE;
63879
+ var ETH_TYPE;
63880
+ var WBTC_TYPE;
63881
+ var WAL_TYPE;
63882
+ var NAVX_TYPE;
63883
+ var init_token_registry = __esm2({
63884
+ "src/token-registry.ts"() {
63885
+ COIN_REGISTRY = {
63886
+ SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI" },
63887
+ USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC" },
63888
+ USDT: { type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT", decimals: 6, symbol: "USDT" },
63889
+ USDe: { type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE", decimals: 6, symbol: "USDe" },
63890
+ USDSUI: { type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI", decimals: 6, symbol: "USDsui" },
63891
+ WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL" },
63892
+ ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH" },
63893
+ wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC" },
63894
+ NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX" },
63895
+ CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS" },
63896
+ DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP" },
63897
+ NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS" },
63898
+ GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 6, symbol: "GOLD" },
63899
+ MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST" },
63900
+ vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI" },
63901
+ haSUI: { type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e136a8bc::hasui::HASUI", decimals: 9, symbol: "haSUI" },
63902
+ afSUI: { type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", decimals: 9, symbol: "afSUI" },
63903
+ FDUSD: { type: "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD", decimals: 6, symbol: "FDUSD" },
63904
+ AUSD: { type: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD", decimals: 6, symbol: "AUSD" },
63905
+ BUCK: { type: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK", decimals: 9, symbol: "BUCK" },
63906
+ BLUB: { type: "0xfa7ac3951fdca12c1b6d18eb19e1aa2fbc31e4d45773c8e45b4ded3ef8d83f8a::blub::BLUB", decimals: 9, symbol: "BLUB" },
63907
+ SCA: { type: "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA", decimals: 9, symbol: "SCA" },
63908
+ TURBOS: { type: "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS", decimals: 9, symbol: "TURBOS" }
63909
+ };
63910
+ BY_TYPE = /* @__PURE__ */ new Map();
63911
+ for (const meta of Object.values(COIN_REGISTRY)) {
63912
+ BY_TYPE.set(meta.type, meta);
63913
+ }
63914
+ TOKEN_MAP = (() => {
63915
+ const map2 = {};
63916
+ for (const [name, meta] of Object.entries(COIN_REGISTRY)) {
63917
+ map2[name] = meta.type;
63918
+ map2[name.toUpperCase()] = meta.type;
63919
+ }
63920
+ return map2;
63921
+ })();
63922
+ SUI_TYPE = COIN_REGISTRY.SUI.type;
63923
+ USDC_TYPE = COIN_REGISTRY.USDC.type;
63924
+ USDT_TYPE = COIN_REGISTRY.USDT.type;
63925
+ USDSUI_TYPE = COIN_REGISTRY.USDSUI.type;
63926
+ USDE_TYPE = COIN_REGISTRY.USDe.type;
63927
+ ETH_TYPE = COIN_REGISTRY.ETH.type;
63928
+ WBTC_TYPE = COIN_REGISTRY.wBTC.type;
63929
+ WAL_TYPE = COIN_REGISTRY.WAL.type;
63930
+ NAVX_TYPE = COIN_REGISTRY.NAVX.type;
63931
+ }
63932
+ });
63843
63933
  var volo_exports = {};
63844
63934
  __export2(volo_exports, {
63845
63935
  MIN_STAKE_MIST: () => MIN_STAKE_MIST,
@@ -64018,39 +64108,11 @@ async function simulateSwap(params) {
64018
64108
  return { success: false, error: err instanceof Error ? err.message : String(err) };
64019
64109
  }
64020
64110
  }
64021
- function resolveTokenType(nameOrType) {
64022
- if (nameOrType.includes("::")) return nameOrType;
64023
- return TOKEN_MAP[nameOrType.toUpperCase()] ?? null;
64024
- }
64025
64111
  var clientInstance;
64026
- var TOKEN_MAP;
64027
64112
  var init_cetus_swap = __esm2({
64028
64113
  "src/protocols/cetus-swap.ts"() {
64114
+ init_token_registry();
64029
64115
  clientInstance = null;
64030
- TOKEN_MAP = {
64031
- SUI: "0x2::sui::SUI",
64032
- USDC: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
64033
- USDT: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
64034
- CETUS: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
64035
- DEEP: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
64036
- NAVX: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX",
64037
- vSUI: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT",
64038
- haSUI: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e136a8bc::hasui::HASUI",
64039
- afSUI: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI",
64040
- WAL: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
64041
- ETH: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH",
64042
- wBTC: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC",
64043
- FDUSD: "0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD",
64044
- AUSD: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD",
64045
- BUCK: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK",
64046
- USDe: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE",
64047
- USDSUI: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI",
64048
- MANIFEST: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST",
64049
- NS: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS",
64050
- BLUB: "0xfa7ac3951fdca12c1b6d18eb19e1aa2fbc31e4d45773c8e45b4ded3ef8d83f8a::blub::BLUB",
64051
- SCA: "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA",
64052
- TURBOS: "0x5d1f47ea69bb0de31c313d7acf89b890dbb8991ea8e03c6c355171f84bb1ba4a::turbos::TURBOS"
64053
- };
64054
64116
  }
64055
64117
  });
64056
64118
  var MIST_PER_SUI2 = 1000000000n;
@@ -64435,7 +64497,7 @@ async function queryBalance(client, address) {
64435
64497
  stables
64436
64498
  };
64437
64499
  }
64438
- var SUI_TYPE = "0x2::sui::SUI";
64500
+ init_token_registry();
64439
64501
  var KNOWN_TARGETS = [
64440
64502
  [/::suilend|::obligation/, "lending"],
64441
64503
  [/::navi|::incentive_v\d+|::oracle_pro/, "lending"],
@@ -64491,9 +64553,9 @@ function extractTransferDetails(changes, sender) {
64491
64553
  const primaryOutflow = outflows.filter((c) => c.coinType !== SUI_TYPE).sort((a, b2) => Number(BigInt(a.amount) - BigInt(b2.amount)))[0] ?? outflows[0];
64492
64554
  if (!primaryOutflow) return {};
64493
64555
  const coinType = primaryOutflow.coinType;
64494
- const decimals = coinType.includes("::usdc::") ? 6 : 9;
64556
+ const decimals = getDecimalsForCoinType(coinType);
64495
64557
  const amount = Math.abs(Number(BigInt(primaryOutflow.amount))) / 10 ** decimals;
64496
- const asset = coinType === SUI_TYPE ? "SUI" : coinType.includes("::usdc::") ? "USDC" : coinType.split("::").pop() ?? "unknown";
64558
+ const asset = resolveSymbol(coinType);
64497
64559
  const recipientChange = inflows.find((c) => c.coinType === coinType);
64498
64560
  const recipient = recipientChange ? resolveOwner(recipientChange.owner) ?? void 0 : void 0;
64499
64561
  return { amount, asset, recipient };
@@ -64533,6 +64595,7 @@ function classifyAction(targets, commandTypes) {
64533
64595
  if (hasMoveCall) return "transaction";
64534
64596
  return "transaction";
64535
64597
  }
64598
+ init_token_registry();
64536
64599
  var FEE_RATES = {
64537
64600
  save: SAVE_FEE_BPS,
64538
64601
  borrow: BORROW_FEE_BPS
@@ -65993,8 +66056,7 @@ var T2000 = class _T2000 extends import_index.default {
65993
66056
  if (!toType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.to}. Provide the full coin type.`);
65994
66057
  const byAmountIn = params.byAmountIn ?? true;
65995
66058
  const slippage = Math.min(params.slippage ?? 0.01, 0.05);
65996
- const fromEntry = Object.values(TOKEN_MAP2).includes(fromType) ? Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === fromType) : null;
65997
- const fromDecimals = fromEntry ? fromEntry[1].decimals : fromType === "0x2::sui::SUI" ? 9 : 6;
66059
+ const fromDecimals = getDecimalsForCoinType(fromType);
65998
66060
  const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
65999
66061
  const route = await findSwapRoute2({
66000
66062
  walletAddress: this._address,
@@ -66008,6 +66070,13 @@ var T2000 = class _T2000 extends import_index.default {
66008
66070
  if (route.priceImpact > 0.05) {
66009
66071
  console.warn(`[swap] High price impact: ${(route.priceImpact * 100).toFixed(2)}%`);
66010
66072
  }
66073
+ const toDecimals = getDecimalsForCoinType(toType);
66074
+ let preBalRaw = 0n;
66075
+ try {
66076
+ const preBal = await this.client.getBalance({ owner: this._address, coinType: toType });
66077
+ preBalRaw = BigInt(preBal.totalBalance);
66078
+ } catch {
66079
+ }
66011
66080
  const gasResult = await executeWithGas(this.client, this._signer, async () => {
66012
66081
  const tx = new Transaction();
66013
66082
  tx.setSender(this._address);
@@ -66030,8 +66099,6 @@ var T2000 = class _T2000 extends import_index.default {
66030
66099
  tx.transferObjects([outputCoin], this._address);
66031
66100
  return tx;
66032
66101
  });
66033
- const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
66034
- const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
66035
66102
  const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
66036
66103
  let toAmount = Number(route.amountOut) / 10 ** toDecimals;
66037
66104
  const toTypeSuffix = toType.split("::").slice(1).join("::");
@@ -66043,10 +66110,6 @@ var T2000 = class _T2000 extends import_index.default {
66043
66110
  pollInterval: 400
66044
66111
  });
66045
66112
  const changes = fullTx.balanceChanges ?? [];
66046
- console.error(`[swap] balanceChanges count=${changes.length}, toType=${toType}`);
66047
- for (const c of changes) {
66048
- console.error(`[swap] coinType=${c.coinType} amount=${c.amount} owner=${JSON.stringify(c.owner)}`);
66049
- }
66050
66113
  const received = changes.find((c) => {
66051
66114
  if (BigInt(c.amount) <= 0n) return false;
66052
66115
  const ownerAddr = c.owner?.AddressOwner;
@@ -66057,32 +66120,22 @@ var T2000 = class _T2000 extends import_index.default {
66057
66120
  if (received) {
66058
66121
  const actual = Number(BigInt(received.amount)) / 10 ** toDecimals;
66059
66122
  if (actual > 0) toAmount = actual;
66060
- console.error(`[swap] Approach 1 success: toAmount=${toAmount}`);
66061
- } else {
66062
- console.error(`[swap] Approach 1: no matching balance change found`);
66063
66123
  }
66064
- } catch (err) {
66065
- console.error(`[swap] Approach 1 failed:`, err);
66124
+ } catch {
66066
66125
  }
66067
66126
  const cetusEstimate = Number(route.amountOut) / 10 ** toDecimals;
66068
66127
  if (Math.abs(toAmount - cetusEstimate) < 1e-3) {
66069
- console.error(`[swap] toAmount still equals Cetus estimate (${cetusEstimate}), trying balance diff`);
66070
66128
  try {
66071
66129
  await new Promise((r) => setTimeout(r, 2e3));
66072
66130
  const postBal = await this.client.getBalance({ owner: this._address, coinType: toType });
66073
66131
  const postRaw = BigInt(postBal.totalBalance);
66074
- const human = Number(postRaw) / 10 ** toDecimals;
66075
- console.error(`[swap] Approach 2: postBalance raw=${postRaw} human=${human}`);
66076
- if (human > toAmount * 10) {
66077
- toAmount = human;
66078
- console.error(`[swap] Approach 2: using total balance as estimate: ${toAmount}`);
66079
- }
66080
- } catch (err) {
66081
- console.error(`[swap] Approach 2 failed:`, err);
66132
+ const delta = Number(postRaw - preBalRaw) / 10 ** toDecimals;
66133
+ if (delta > 0) toAmount = delta;
66134
+ } catch {
66082
66135
  }
66083
66136
  }
66084
- const fromName = fromEntry ? fromEntry[0] : this._resolveTokenName(fromType, params.from);
66085
- const toName = toEntry ? toEntry[0] : this._resolveTokenName(toType, params.to);
66137
+ const fromName = resolveSymbol(fromType);
66138
+ const toName = resolveSymbol(toType);
66086
66139
  const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
66087
66140
  return {
66088
66141
  success: true,
@@ -66104,8 +66157,7 @@ var T2000 = class _T2000 extends import_index.default {
66104
66157
  if (!fromType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.from}. Provide the full coin type.`);
66105
66158
  if (!toType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.to}. Provide the full coin type.`);
66106
66159
  const byAmountIn = params.byAmountIn ?? true;
66107
- const fromEntry = Object.values(TOKEN_MAP2).includes(fromType) ? Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === fromType) : null;
66108
- const fromDecimals = fromEntry ? fromEntry[1].decimals : fromType === "0x2::sui::SUI" ? 9 : 6;
66160
+ const fromDecimals = getDecimalsForCoinType(fromType);
66109
66161
  const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
66110
66162
  const route = await findSwapRoute2({
66111
66163
  walletAddress: this._address,
@@ -66116,8 +66168,7 @@ var T2000 = class _T2000 extends import_index.default {
66116
66168
  });
66117
66169
  if (!route) throw new T2000Error("SWAP_NO_ROUTE", `No swap route found for ${params.from} -> ${params.to}.`);
66118
66170
  if (route.insufficientLiquidity) throw new T2000Error("SWAP_NO_ROUTE", `Insufficient liquidity for ${params.from} -> ${params.to}.`);
66119
- const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
66120
- const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
66171
+ const toDecimals = getDecimalsForCoinType(toType);
66121
66172
  const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
66122
66173
  const toAmount = Number(route.amountOut) / 10 ** toDecimals;
66123
66174
  const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
@@ -66493,12 +66544,6 @@ var T2000 = class _T2000 extends import_index.default {
66493
66544
  }
66494
66545
  return all3;
66495
66546
  }
66496
- _resolveTokenName(coinType, fallback) {
66497
- const entry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === coinType);
66498
- if (entry) return entry[0];
66499
- const suffix = coinType.split("::").pop();
66500
- return suffix && suffix !== coinType ? suffix : fallback;
66501
- }
66502
66547
  _mergeCoinsInTx(tx, coins) {
66503
66548
  if (coins.length === 0) throw new T2000Error("INSUFFICIENT_BALANCE", "No coins to merge");
66504
66549
  const primary = tx.object(coins[0].coinObjectId);
@@ -66948,6 +66993,7 @@ function parseMoveAbort2(errorStr) {
66948
66993
  }
66949
66994
  return { reason: errorStr };
66950
66995
  }
66996
+ init_token_registry();
66951
66997
  async function getSwapQuote(params) {
66952
66998
  const { findSwapRoute: findSwapRoute2, resolveTokenType: resolveTokenType2, TOKEN_MAP: TOKEN_MAP2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
66953
66999
  const fromType = resolveTokenType2(params.from);
@@ -66955,8 +67001,7 @@ async function getSwapQuote(params) {
66955
67001
  if (!fromType) throw new Error(`Unknown token: ${params.from}. Provide the full coin type.`);
66956
67002
  if (!toType) throw new Error(`Unknown token: ${params.to}. Provide the full coin type.`);
66957
67003
  const byAmountIn = params.byAmountIn ?? true;
66958
- const fromEntry = Object.values(TOKEN_MAP2).includes(fromType) ? Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === fromType) : null;
66959
- const fromDecimals = fromEntry ? fromEntry[1].decimals : fromType === "0x2::sui::SUI" ? 9 : 6;
67004
+ const fromDecimals = getDecimalsForCoinType(fromType);
66960
67005
  const rawAmount = BigInt(Math.floor(params.amount * 10 ** fromDecimals));
66961
67006
  const route = await findSwapRoute2({
66962
67007
  walletAddress: params.walletAddress,
@@ -66967,8 +67012,7 @@ async function getSwapQuote(params) {
66967
67012
  });
66968
67013
  if (!route) throw new Error(`No swap route found for ${params.from} -> ${params.to}.`);
66969
67014
  if (route.insufficientLiquidity) throw new Error(`Insufficient liquidity for ${params.from} -> ${params.to}.`);
66970
- const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
66971
- const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
67015
+ const toDecimals = getDecimalsForCoinType(toType);
66972
67016
  const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
66973
67017
  const toAmount = Number(route.amountOut) / 10 ** toDecimals;
66974
67018
  const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
@@ -66982,6 +67026,7 @@ async function getSwapQuote(params) {
66982
67026
  };
66983
67027
  }
66984
67028
  init_cetus_swap();
67029
+ init_token_registry();
66985
67030
  init_volo();
66986
67031
 
66987
67032
  export {
@@ -66992,6 +67037,20 @@ export {
66992
67037
  mapWalletError,
66993
67038
  mapMoveAbortCode,
66994
67039
  T2000Error,
67040
+ getDecimalsForCoinType,
67041
+ resolveSymbol,
67042
+ resolveTokenType,
67043
+ COIN_REGISTRY,
67044
+ TOKEN_MAP,
67045
+ SUI_TYPE,
67046
+ USDC_TYPE,
67047
+ USDT_TYPE,
67048
+ USDSUI_TYPE,
67049
+ USDE_TYPE,
67050
+ ETH_TYPE,
67051
+ WBTC_TYPE,
67052
+ WAL_TYPE,
67053
+ NAVX_TYPE,
66995
67054
  getVoloStats,
66996
67055
  buildStakeVSuiTx,
66997
67056
  buildUnstakeVSuiTx,
@@ -67001,8 +67060,6 @@ export {
67001
67060
  VSUI_TYPE,
67002
67061
  findSwapRoute,
67003
67062
  buildSwapTx,
67004
- resolveTokenType,
67005
- TOKEN_MAP,
67006
67063
  MIST_PER_SUI2 as MIST_PER_SUI,
67007
67064
  SUI_DECIMALS2 as SUI_DECIMALS,
67008
67065
  USDC_DECIMALS,
@@ -67104,4 +67161,4 @@ axios/dist/node/axios.cjs:
67104
67161
  @scure/bip39/index.js:
67105
67162
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
67106
67163
  */
67107
- //# sourceMappingURL=chunk-XNKVJ4IY.js.map
67164
+ //# sourceMappingURL=chunk-DNBWOMKV.js.map