opentool 0.19.5 → 0.19.6

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.
@@ -2734,10 +2734,24 @@ async function fetchHyperliquidSizeDecimals(params) {
2734
2734
  const match = universe.find(
2735
2735
  (entry) => normalizeHyperliquidMetaSymbol(entry?.name ?? "").toUpperCase() === normalized
2736
2736
  );
2737
- if (!match || typeof match.szDecimals !== "number") {
2737
+ if (match && typeof match.szDecimals === "number") {
2738
+ return match.szDecimals;
2739
+ }
2740
+ const parsed = parseHyperliquidSymbol(symbol);
2741
+ const dex = parsed?.dex ?? null;
2742
+ if (!dex) {
2743
+ throw new Error(`No size decimals found for ${symbol}.`);
2744
+ }
2745
+ const dexMetaAndCtxs = await fetchHyperliquidDexMetaAndAssetCtxs(environment, dex);
2746
+ const dexUniverse = Array.isArray(dexMetaAndCtxs?.[0]?.universe) ? dexMetaAndCtxs[0].universe : [];
2747
+ const dexMatch = dexUniverse.find(
2748
+ (entry) => normalizeHyperliquidMetaSymbol(entry?.name ?? "").toUpperCase() === normalized
2749
+ );
2750
+ const dexSizeDecimals = readHyperliquidNumber(dexMatch?.szDecimals);
2751
+ if (dexSizeDecimals == null) {
2738
2752
  throw new Error(`No size decimals found for ${symbol}.`);
2739
2753
  }
2740
- return match.szDecimals;
2754
+ return dexSizeDecimals;
2741
2755
  }
2742
2756
 
2743
2757
  // src/adapters/hyperliquid/order-utils.ts