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.
package/dist/index.js CHANGED
@@ -4453,10 +4453,24 @@ async function fetchHyperliquidSizeDecimals(params) {
4453
4453
  const match = universe.find(
4454
4454
  (entry) => normalizeHyperliquidMetaSymbol(entry?.name ?? "").toUpperCase() === normalized
4455
4455
  );
4456
- if (!match || typeof match.szDecimals !== "number") {
4456
+ if (match && typeof match.szDecimals === "number") {
4457
+ return match.szDecimals;
4458
+ }
4459
+ const parsed = parseHyperliquidSymbol(symbol);
4460
+ const dex = parsed?.dex ?? null;
4461
+ if (!dex) {
4462
+ throw new Error(`No size decimals found for ${symbol}.`);
4463
+ }
4464
+ const dexMetaAndCtxs = await fetchHyperliquidDexMetaAndAssetCtxs(environment, dex);
4465
+ const dexUniverse = Array.isArray(dexMetaAndCtxs?.[0]?.universe) ? dexMetaAndCtxs[0].universe : [];
4466
+ const dexMatch = dexUniverse.find(
4467
+ (entry) => normalizeHyperliquidMetaSymbol(entry?.name ?? "").toUpperCase() === normalized
4468
+ );
4469
+ const dexSizeDecimals = readHyperliquidNumber(dexMatch?.szDecimals);
4470
+ if (dexSizeDecimals == null) {
4457
4471
  throw new Error(`No size decimals found for ${symbol}.`);
4458
4472
  }
4459
- return match.szDecimals;
4473
+ return dexSizeDecimals;
4460
4474
  }
4461
4475
  function buildHyperliquidSpotUsdPriceMap(params) {
4462
4476
  const universe = params.meta.universe ?? [];