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/adapters/hyperliquid/browser.js +16 -2
- package/dist/adapters/hyperliquid/browser.js.map +1 -1
- package/dist/adapters/hyperliquid/index.d.ts +6 -3
- package/dist/adapters/hyperliquid/index.js +16 -2
- package/dist/adapters/hyperliquid/index.js.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/base/package.json +1 -1
- package/templates/polymarket-simple-trade/package.json +1 -1
|
@@ -23,12 +23,15 @@ type HyperliquidTradePlan = {
|
|
|
23
23
|
reduceOnly: boolean;
|
|
24
24
|
targetSize: number;
|
|
25
25
|
};
|
|
26
|
-
|
|
27
|
-
allocationMode: "
|
|
26
|
+
type HyperliquidTargetSizeConfig = {
|
|
27
|
+
allocationMode: "fixed";
|
|
28
|
+
amountUsd?: number;
|
|
29
|
+
} | {
|
|
30
|
+
allocationMode: "percent_equity";
|
|
28
31
|
percentOfEquity: number;
|
|
29
32
|
maxPercentOfEquity: number;
|
|
30
33
|
amountUsd?: number;
|
|
31
|
-
}
|
|
34
|
+
};
|
|
32
35
|
interface HyperliquidTargetSizeExecution {
|
|
33
36
|
size?: number;
|
|
34
37
|
}
|
|
@@ -3206,10 +3206,24 @@ async function fetchHyperliquidSizeDecimals(params) {
|
|
|
3206
3206
|
const match = universe.find(
|
|
3207
3207
|
(entry) => normalizeHyperliquidMetaSymbol(entry?.name ?? "").toUpperCase() === normalized
|
|
3208
3208
|
);
|
|
3209
|
-
if (
|
|
3209
|
+
if (match && typeof match.szDecimals === "number") {
|
|
3210
|
+
return match.szDecimals;
|
|
3211
|
+
}
|
|
3212
|
+
const parsed = parseHyperliquidSymbol(symbol);
|
|
3213
|
+
const dex = parsed?.dex ?? null;
|
|
3214
|
+
if (!dex) {
|
|
3215
|
+
throw new Error(`No size decimals found for ${symbol}.`);
|
|
3216
|
+
}
|
|
3217
|
+
const dexMetaAndCtxs = await fetchHyperliquidDexMetaAndAssetCtxs(environment, dex);
|
|
3218
|
+
const dexUniverse = Array.isArray(dexMetaAndCtxs?.[0]?.universe) ? dexMetaAndCtxs[0].universe : [];
|
|
3219
|
+
const dexMatch = dexUniverse.find(
|
|
3220
|
+
(entry) => normalizeHyperliquidMetaSymbol(entry?.name ?? "").toUpperCase() === normalized
|
|
3221
|
+
);
|
|
3222
|
+
const dexSizeDecimals = readHyperliquidNumber(dexMatch?.szDecimals);
|
|
3223
|
+
if (dexSizeDecimals == null) {
|
|
3210
3224
|
throw new Error(`No size decimals found for ${symbol}.`);
|
|
3211
3225
|
}
|
|
3212
|
-
return
|
|
3226
|
+
return dexSizeDecimals;
|
|
3213
3227
|
}
|
|
3214
3228
|
function buildHyperliquidSpotUsdPriceMap(params) {
|
|
3215
3229
|
const universe = params.meta.universe ?? [];
|