opentool 0.16.0 → 0.17.1
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.d.ts +1 -1
- package/dist/adapters/hyperliquid/browser.js +208 -83
- package/dist/adapters/hyperliquid/browser.js.map +1 -1
- package/dist/adapters/hyperliquid/index.d.ts +2 -2
- package/dist/adapters/hyperliquid/index.js +114 -83
- package/dist/adapters/hyperliquid/index.js.map +1 -1
- package/dist/{browser-CY6nxlxO.d.ts → browser-DA4UUBo1.d.ts} +22 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +114 -83
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/base/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS, a as DEFAULT_HYPERLIQUID_TPSL_MARKET_SLIPPAGE_BPS, H as HyperliquidAbstraction, b as HyperliquidAccountMode, c as HyperliquidApiError,
|
|
1
|
+
export { D as DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS, a as DEFAULT_HYPERLIQUID_TPSL_MARKET_SLIPPAGE_BPS, H as HyperliquidAbstraction, b as HyperliquidAccountMode, c as HyperliquidApiError, b3 as HyperliquidApproveBuilderFeeOptions, b4 as HyperliquidApproveBuilderFeeResponse, d as HyperliquidApproximateLiquidationParams, g as HyperliquidBuilderApprovalError, h as HyperliquidBuilderFee, b5 as HyperliquidClearinghouseState, b6 as HyperliquidDepositResult, i as HyperliquidEnvironment, j as HyperliquidExchangeClient, k as HyperliquidExchangeResponse, l as HyperliquidGrouping, m as HyperliquidGuardError, o as HyperliquidInfoClient, p as HyperliquidMarketIdentityInput, r as HyperliquidOrderIntent, b7 as HyperliquidOrderOptions, b8 as HyperliquidOrderResponse, b9 as HyperliquidOrderStatus, s as HyperliquidParsedSymbol, t as HyperliquidParsedSymbolKind, v as HyperliquidPlaceOrderWithTpSlOptions, w as HyperliquidPlacePositionTpSlOptions, A as HyperliquidResolvedMarketDescriptor, C as HyperliquidTermsError, F as HyperliquidTimeInForce, G as HyperliquidTpSlExecutionType, I as HyperliquidTpSlLegInput, J as HyperliquidTriggerOptions, K as HyperliquidTriggerType, ba as HyperliquidWithdrawResult, M as MarketIdentity, bb as approveHyperliquidBuilderFee, L as batchModifyHyperliquidOrders, N as buildHyperliquidMarketIdentity, O as buildHyperliquidProfileAssets, Q as cancelAllHyperliquidOrders, R as cancelHyperliquidOrders, S as cancelHyperliquidOrdersByCloid, T as cancelHyperliquidTwapOrder, U as computeHyperliquidMarketIocLimitPrice, bc as createHyperliquidActionHash, V as createHyperliquidSubAccount, W as createMonotonicNonceFactory, bd as depositToHyperliquidBridge, X as estimateHyperliquidLiquidationPrice, Y as extractHyperliquidDex, a0 as fetchHyperliquidAssetCtxs, be as fetchHyperliquidClearinghouseState, a3 as fetchHyperliquidFrontendOpenOrders, a4 as fetchHyperliquidHistoricalOrders, a5 as fetchHyperliquidMeta, a6 as fetchHyperliquidMetaAndAssetCtxs, a7 as fetchHyperliquidOpenOrders, a8 as fetchHyperliquidOrderStatus, aa as fetchHyperliquidPreTransferCheck, ab as fetchHyperliquidResolvedMarketDescriptor, ac as fetchHyperliquidSizeDecimals, ae as fetchHyperliquidSpotAssetCtxs, af as fetchHyperliquidSpotClearinghouseState, ah as fetchHyperliquidSpotMeta, ai as fetchHyperliquidSpotMetaAndAssetCtxs, al as fetchHyperliquidTickSize, am as fetchHyperliquidUserFills, an as fetchHyperliquidUserFillsByTime, ao as fetchHyperliquidUserRateLimit, ap as formatHyperliquidMarketablePrice, ar as formatHyperliquidPrice, as as formatHyperliquidSize, bf as getHyperliquidMaxBuilderFee, at as isHyperliquidSpotSymbol, au as modifyHyperliquidOrder, av as normalizeHyperliquidBaseSymbol, ax as normalizeHyperliquidMetaSymbol, ay as normalizeSpotTokenName, az as parseHyperliquidSymbol, aA as parseSpotPairSymbol, bg as placeHyperliquidOrder, aB as placeHyperliquidOrderWithTpSl, aC as placeHyperliquidPositionTpSl, aD as placeHyperliquidTwapOrder, aE as reserveHyperliquidRequestWeight, aF as resolveHyperliquidAbstractionFromMode, aH as resolveHyperliquidLeverageMode, aI as resolveHyperliquidMarketDataCoin, aK as resolveHyperliquidOrderSymbol, aL as resolveHyperliquidPair, aM as resolveHyperliquidPerpSymbol, aN as resolveHyperliquidProfileChain, aO as resolveHyperliquidSpotSymbol, aP as resolveHyperliquidSymbol, aQ as resolveSpotMidCandidates, aR as resolveSpotTokenCandidates, aT as scheduleHyperliquidCancel, aU as sendHyperliquidSpot, aV as setHyperliquidAccountAbstractionMode, aW as setHyperliquidPortfolioMargin, aX as supportsHyperliquidBuilderFee, aY as transferHyperliquidSubAccount, aZ as updateHyperliquidIsolatedMargin, a_ as updateHyperliquidLeverage, bh as withdrawFromHyperliquid } from '../../browser-DA4UUBo1.js';
|
|
2
2
|
import '../../types-BaTmu0gS.js';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import 'viem/accounts';
|
|
@@ -582,37 +582,6 @@ async function signUserPortfolioMargin(args) {
|
|
|
582
582
|
});
|
|
583
583
|
return splitSignature(signatureHex);
|
|
584
584
|
}
|
|
585
|
-
async function signUserDexAbstraction(args) {
|
|
586
|
-
const { wallet, action } = args;
|
|
587
|
-
const domain = {
|
|
588
|
-
name: "HyperliquidSignTransaction",
|
|
589
|
-
version: "1",
|
|
590
|
-
chainId: Number.parseInt(action.signatureChainId, 16),
|
|
591
|
-
verifyingContract: ZERO_ADDRESS
|
|
592
|
-
};
|
|
593
|
-
const message = {
|
|
594
|
-
hyperliquidChain: action.hyperliquidChain,
|
|
595
|
-
user: action.user,
|
|
596
|
-
enabled: action.enabled,
|
|
597
|
-
nonce: BigInt(action.nonce)
|
|
598
|
-
};
|
|
599
|
-
const types = {
|
|
600
|
-
"HyperliquidTransaction:UserDexAbstraction": [
|
|
601
|
-
{ name: "hyperliquidChain", type: "string" },
|
|
602
|
-
{ name: "user", type: "address" },
|
|
603
|
-
{ name: "enabled", type: "bool" },
|
|
604
|
-
{ name: "nonce", type: "uint64" }
|
|
605
|
-
]
|
|
606
|
-
};
|
|
607
|
-
const signatureHex = await wallet.walletClient.signTypedData({
|
|
608
|
-
account: wallet.account,
|
|
609
|
-
domain,
|
|
610
|
-
types,
|
|
611
|
-
primaryType: "HyperliquidTransaction:UserDexAbstraction",
|
|
612
|
-
message
|
|
613
|
-
});
|
|
614
|
-
return splitSignature(signatureHex);
|
|
615
|
-
}
|
|
616
585
|
async function signUserSetAbstraction(args) {
|
|
617
586
|
const { wallet, action } = args;
|
|
618
587
|
const domain = {
|
|
@@ -1027,17 +996,6 @@ var HyperliquidExchangeClient = class {
|
|
|
1027
996
|
...params
|
|
1028
997
|
});
|
|
1029
998
|
}
|
|
1030
|
-
setDexAbstraction(params) {
|
|
1031
|
-
const base = {
|
|
1032
|
-
wallet: this.wallet,
|
|
1033
|
-
enabled: params.enabled,
|
|
1034
|
-
environment: this.environment,
|
|
1035
|
-
vaultAddress: this.vaultAddress,
|
|
1036
|
-
expiresAfter: this.expiresAfter,
|
|
1037
|
-
nonceSource: this.nonceSource
|
|
1038
|
-
};
|
|
1039
|
-
return setHyperliquidDexAbstraction(params.user ? { ...base, user: params.user } : base);
|
|
1040
|
-
}
|
|
1041
999
|
setAccountAbstractionMode(params) {
|
|
1042
1000
|
const base = {
|
|
1043
1001
|
wallet: this.wallet,
|
|
@@ -1103,46 +1061,6 @@ async function setHyperliquidPortfolioMargin(options) {
|
|
|
1103
1061
|
}
|
|
1104
1062
|
return postExchange(env, body);
|
|
1105
1063
|
}
|
|
1106
|
-
async function setHyperliquidDexAbstraction(options) {
|
|
1107
|
-
const env = options.environment ?? "mainnet";
|
|
1108
|
-
if (!options.wallet?.account || !options.wallet.walletClient) {
|
|
1109
|
-
throw new Error("Wallet with signing capability is required for dex abstraction.");
|
|
1110
|
-
}
|
|
1111
|
-
const nonce = resolveRequiredExchangeNonce({
|
|
1112
|
-
nonce: options.nonce,
|
|
1113
|
-
nonceSource: options.nonceSource,
|
|
1114
|
-
walletNonceProvider: options.walletNonceProvider,
|
|
1115
|
-
wallet: options.wallet,
|
|
1116
|
-
action: "Hyperliquid dex abstraction"
|
|
1117
|
-
});
|
|
1118
|
-
const signatureChainId = getSignatureChainId(env);
|
|
1119
|
-
const hyperliquidChain = HL_CHAIN_LABEL[env];
|
|
1120
|
-
const user = normalizeAddress(options.user ?? options.wallet.address);
|
|
1121
|
-
const action = {
|
|
1122
|
-
type: "userDexAbstraction",
|
|
1123
|
-
enabled: Boolean(options.enabled),
|
|
1124
|
-
hyperliquidChain,
|
|
1125
|
-
signatureChainId,
|
|
1126
|
-
user,
|
|
1127
|
-
nonce
|
|
1128
|
-
};
|
|
1129
|
-
const signature = await signUserDexAbstraction({
|
|
1130
|
-
wallet: options.wallet,
|
|
1131
|
-
action
|
|
1132
|
-
});
|
|
1133
|
-
const body = {
|
|
1134
|
-
action,
|
|
1135
|
-
nonce,
|
|
1136
|
-
signature
|
|
1137
|
-
};
|
|
1138
|
-
if (options.vaultAddress) {
|
|
1139
|
-
body.vaultAddress = normalizeAddress(options.vaultAddress);
|
|
1140
|
-
}
|
|
1141
|
-
if (typeof options.expiresAfter === "number") {
|
|
1142
|
-
body.expiresAfter = options.expiresAfter;
|
|
1143
|
-
}
|
|
1144
|
-
return postExchange(env, body);
|
|
1145
|
-
}
|
|
1146
1064
|
async function setHyperliquidAccountAbstractionMode(options) {
|
|
1147
1065
|
const env = options.environment ?? "mainnet";
|
|
1148
1066
|
if (!options.wallet?.account || !options.wallet.walletClient) {
|
|
@@ -2219,6 +2137,20 @@ async function getHyperliquidMaxBuilderFee(params) {
|
|
|
2219
2137
|
function createHyperliquidActionHash(params) {
|
|
2220
2138
|
return createL1ActionHash(params);
|
|
2221
2139
|
}
|
|
2140
|
+
|
|
2141
|
+
// src/adapters/hyperliquid/state-readers.ts
|
|
2142
|
+
function readHyperliquidNumber(value) {
|
|
2143
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
2144
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
2145
|
+
const parsed = Number(value);
|
|
2146
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2147
|
+
}
|
|
2148
|
+
return null;
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
// src/adapters/hyperliquid/market-data.ts
|
|
2152
|
+
var META_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
2153
|
+
var allMidsCache = /* @__PURE__ */ new Map();
|
|
2222
2154
|
function gcd(a, b) {
|
|
2223
2155
|
let left = a < 0n ? -a : a;
|
|
2224
2156
|
let right = b < 0n ? -b : b;
|
|
@@ -2298,6 +2230,25 @@ function resolveSpotSizeDecimals(meta, symbol) {
|
|
|
2298
2230
|
}
|
|
2299
2231
|
throw new Error(`No size decimals found for ${symbol}.`);
|
|
2300
2232
|
}
|
|
2233
|
+
async function fetchHyperliquidAllMids(environment) {
|
|
2234
|
+
const cacheKey = environment;
|
|
2235
|
+
const cached = allMidsCache.get(cacheKey);
|
|
2236
|
+
if (cached && Date.now() - cached.fetchedAt < META_CACHE_TTL_MS) {
|
|
2237
|
+
return cached.mids;
|
|
2238
|
+
}
|
|
2239
|
+
const baseUrl = API_BASES[environment];
|
|
2240
|
+
const res = await fetch(`${baseUrl}/info`, {
|
|
2241
|
+
method: "POST",
|
|
2242
|
+
headers: { "content-type": "application/json" },
|
|
2243
|
+
body: JSON.stringify({ type: "allMids" })
|
|
2244
|
+
});
|
|
2245
|
+
const json = await res.json().catch(() => null);
|
|
2246
|
+
if (!res.ok || !json || typeof json !== "object") {
|
|
2247
|
+
throw new Error(`Failed to load Hyperliquid mid prices (${res.status}).`);
|
|
2248
|
+
}
|
|
2249
|
+
allMidsCache.set(cacheKey, { fetchedAt: Date.now(), mids: json });
|
|
2250
|
+
return json;
|
|
2251
|
+
}
|
|
2301
2252
|
async function fetchHyperliquidTickSize(params) {
|
|
2302
2253
|
return fetchHyperliquidTickSizeForCoin(params.environment, params.symbol);
|
|
2303
2254
|
}
|
|
@@ -2331,6 +2282,180 @@ async function fetchHyperliquidTickSizeForCoin(environment, coin) {
|
|
|
2331
2282
|
}
|
|
2332
2283
|
return { tickSizeInt: tick, tickDecimals: decimals };
|
|
2333
2284
|
}
|
|
2285
|
+
async function fetchHyperliquidSpotMarketInfo(params) {
|
|
2286
|
+
const mids = params.mids === void 0 ? await fetchHyperliquidAllMids(params.environment).catch(() => null) : params.mids;
|
|
2287
|
+
const data = await fetchHyperliquidSpotMetaAndAssetCtxs(params.environment);
|
|
2288
|
+
const universe = data?.[0]?.universe ?? [];
|
|
2289
|
+
const tokens = data?.[0]?.tokens ?? [];
|
|
2290
|
+
const contexts = data?.[1] ?? [];
|
|
2291
|
+
const tokenMap = /* @__PURE__ */ new Map();
|
|
2292
|
+
for (const token of tokens) {
|
|
2293
|
+
const index = token?.index;
|
|
2294
|
+
const szDecimals = readHyperliquidNumber(token?.szDecimals);
|
|
2295
|
+
if (typeof index !== "number" || szDecimals == null) continue;
|
|
2296
|
+
tokenMap.set(index, {
|
|
2297
|
+
name: normalizeSpotTokenName2(token?.name),
|
|
2298
|
+
szDecimals
|
|
2299
|
+
});
|
|
2300
|
+
}
|
|
2301
|
+
const baseCandidates = resolveSpotTokenCandidates(params.base);
|
|
2302
|
+
const quoteCandidates = resolveSpotTokenCandidates(params.quote);
|
|
2303
|
+
const normalizedBase = normalizeSpotTokenName2(params.base).toUpperCase();
|
|
2304
|
+
const normalizedQuote = normalizeSpotTokenName2(params.quote).toUpperCase();
|
|
2305
|
+
for (let idx = 0; idx < universe.length; idx += 1) {
|
|
2306
|
+
const market = universe[idx];
|
|
2307
|
+
const [baseIndex, quoteIndex] = Array.isArray(market?.tokens) ? market.tokens : [];
|
|
2308
|
+
const baseToken = tokenMap.get(baseIndex ?? -1);
|
|
2309
|
+
const quoteToken = tokenMap.get(quoteIndex ?? -1);
|
|
2310
|
+
if (!baseToken || !quoteToken) continue;
|
|
2311
|
+
const marketBaseCandidates = resolveSpotTokenCandidates(baseToken.name);
|
|
2312
|
+
const marketQuoteCandidates = resolveSpotTokenCandidates(quoteToken.name);
|
|
2313
|
+
if (baseCandidates.some((candidate) => marketBaseCandidates.includes(candidate)) && quoteCandidates.some((candidate) => marketQuoteCandidates.includes(candidate))) {
|
|
2314
|
+
const contextIndex = typeof market?.index === "number" ? market.index : idx;
|
|
2315
|
+
const ctx = (contextIndex >= 0 && contextIndex < contexts.length ? contexts[contextIndex] : null) ?? contexts[idx] ?? null;
|
|
2316
|
+
let price = null;
|
|
2317
|
+
if (mids) {
|
|
2318
|
+
for (const candidate of resolveSpotMidCandidates(baseToken.name)) {
|
|
2319
|
+
const mid = readHyperliquidNumber(mids[candidate]);
|
|
2320
|
+
if (mid != null && mid > 0) {
|
|
2321
|
+
price = mid;
|
|
2322
|
+
break;
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
if (!price || price <= 0) {
|
|
2327
|
+
price = readHyperliquidNumber(ctx?.markPx ?? ctx?.midPx ?? ctx?.oraclePx);
|
|
2328
|
+
}
|
|
2329
|
+
if (!price || price <= 0) {
|
|
2330
|
+
throw new Error(`No spot price available for ${normalizedBase}/${normalizedQuote}`);
|
|
2331
|
+
}
|
|
2332
|
+
const marketIndex = typeof market?.index === "number" ? market.index : idx;
|
|
2333
|
+
return {
|
|
2334
|
+
symbol: `${baseToken.name.toUpperCase()}/${quoteToken.name.toUpperCase()}`,
|
|
2335
|
+
base: baseToken.name.toUpperCase(),
|
|
2336
|
+
quote: quoteToken.name.toUpperCase(),
|
|
2337
|
+
assetId: 1e4 + marketIndex,
|
|
2338
|
+
marketIndex,
|
|
2339
|
+
price,
|
|
2340
|
+
szDecimals: baseToken.szDecimals
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
throw new Error(`Unknown Hyperliquid spot market: ${normalizedBase}/${normalizedQuote}`);
|
|
2345
|
+
}
|
|
2346
|
+
async function fetchHyperliquidSpotMarketInfoByIndex(params) {
|
|
2347
|
+
const mids = params.mids === void 0 ? await fetchHyperliquidAllMids(params.environment).catch(() => null) : params.mids;
|
|
2348
|
+
const data = await fetchHyperliquidSpotMetaAndAssetCtxs(params.environment);
|
|
2349
|
+
const universe = data?.[0]?.universe ?? [];
|
|
2350
|
+
const tokens = data?.[0]?.tokens ?? [];
|
|
2351
|
+
const contexts = data?.[1] ?? [];
|
|
2352
|
+
const tokenMap = /* @__PURE__ */ new Map();
|
|
2353
|
+
for (const token of tokens) {
|
|
2354
|
+
const index = token?.index;
|
|
2355
|
+
const szDecimals = readHyperliquidNumber(token?.szDecimals);
|
|
2356
|
+
if (typeof index !== "number" || szDecimals == null) continue;
|
|
2357
|
+
tokenMap.set(index, {
|
|
2358
|
+
name: normalizeSpotTokenName2(token?.name),
|
|
2359
|
+
szDecimals
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
for (let idx = 0; idx < universe.length; idx += 1) {
|
|
2363
|
+
const market = universe[idx];
|
|
2364
|
+
const marketIndex = typeof market?.index === "number" ? market.index : idx;
|
|
2365
|
+
if (marketIndex !== params.marketIndex) continue;
|
|
2366
|
+
const [baseIndex, quoteIndex] = Array.isArray(market?.tokens) ? market.tokens : [];
|
|
2367
|
+
const baseToken = tokenMap.get(baseIndex ?? -1);
|
|
2368
|
+
const quoteToken = tokenMap.get(quoteIndex ?? -1);
|
|
2369
|
+
if (!baseToken || !quoteToken) {
|
|
2370
|
+
break;
|
|
2371
|
+
}
|
|
2372
|
+
const ctx = (marketIndex >= 0 && marketIndex < contexts.length ? contexts[marketIndex] : null) ?? contexts[idx] ?? null;
|
|
2373
|
+
let price = null;
|
|
2374
|
+
if (mids) {
|
|
2375
|
+
for (const candidate of resolveSpotMidCandidates(baseToken.name)) {
|
|
2376
|
+
const mid = readHyperliquidNumber(mids[candidate]);
|
|
2377
|
+
if (mid != null && mid > 0) {
|
|
2378
|
+
price = mid;
|
|
2379
|
+
break;
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
if (!price || price <= 0) {
|
|
2384
|
+
price = readHyperliquidNumber(ctx?.markPx ?? ctx?.midPx ?? ctx?.oraclePx);
|
|
2385
|
+
}
|
|
2386
|
+
if (!price || price <= 0) {
|
|
2387
|
+
throw new Error(`No spot price available for @${params.marketIndex}`);
|
|
2388
|
+
}
|
|
2389
|
+
return {
|
|
2390
|
+
symbol: `${baseToken.name.toUpperCase()}/${quoteToken.name.toUpperCase()}`,
|
|
2391
|
+
base: baseToken.name.toUpperCase(),
|
|
2392
|
+
quote: quoteToken.name.toUpperCase(),
|
|
2393
|
+
assetId: 1e4 + marketIndex,
|
|
2394
|
+
marketIndex,
|
|
2395
|
+
price,
|
|
2396
|
+
szDecimals: baseToken.szDecimals
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
throw new Error(`Unknown Hyperliquid spot market index: @${params.marketIndex}`);
|
|
2400
|
+
}
|
|
2401
|
+
async function fetchHyperliquidResolvedMarketDescriptor(params) {
|
|
2402
|
+
const parsed = parseHyperliquidSymbol(params.symbol);
|
|
2403
|
+
if (!parsed) {
|
|
2404
|
+
throw new Error(`Unable to parse Hyperliquid symbol: ${params.symbol}`);
|
|
2405
|
+
}
|
|
2406
|
+
if (parsed.kind === "spot" || parsed.kind === "spotIndex") {
|
|
2407
|
+
const spotInfo = parsed.kind === "spotIndex" ? await fetchHyperliquidSpotMarketInfoByIndex({
|
|
2408
|
+
environment: params.environment,
|
|
2409
|
+
marketIndex: Number.parseInt(parsed.normalized.slice(1), 10),
|
|
2410
|
+
...params.mids !== void 0 ? { mids: params.mids } : {}
|
|
2411
|
+
}) : await fetchHyperliquidSpotMarketInfo({
|
|
2412
|
+
environment: params.environment,
|
|
2413
|
+
base: parsed.base ?? "",
|
|
2414
|
+
quote: parsed.quote ?? "USDC",
|
|
2415
|
+
...params.mids !== void 0 ? { mids: params.mids } : {}
|
|
2416
|
+
});
|
|
2417
|
+
const orderSymbol2 = resolveHyperliquidOrderSymbol(spotInfo.symbol);
|
|
2418
|
+
if (!orderSymbol2) {
|
|
2419
|
+
throw new Error(`Unable to resolve Hyperliquid spot order symbol: ${params.symbol}`);
|
|
2420
|
+
}
|
|
2421
|
+
return {
|
|
2422
|
+
rawSymbol: params.symbol,
|
|
2423
|
+
kind: "spot",
|
|
2424
|
+
routeTicker: `${spotInfo.base}-${spotInfo.quote}`,
|
|
2425
|
+
displaySymbol: `${spotInfo.base}-${spotInfo.quote}`,
|
|
2426
|
+
normalized: spotInfo.symbol,
|
|
2427
|
+
orderSymbol: orderSymbol2,
|
|
2428
|
+
marketDataCoin: `@${spotInfo.marketIndex}`,
|
|
2429
|
+
base: spotInfo.base,
|
|
2430
|
+
quote: spotInfo.quote,
|
|
2431
|
+
pair: spotInfo.symbol,
|
|
2432
|
+
dex: null,
|
|
2433
|
+
leverageMode: "cross",
|
|
2434
|
+
spotIndex: spotInfo.marketIndex,
|
|
2435
|
+
assetId: spotInfo.assetId
|
|
2436
|
+
};
|
|
2437
|
+
}
|
|
2438
|
+
const orderSymbol = resolveHyperliquidOrderSymbol(parsed.normalized);
|
|
2439
|
+
if (!orderSymbol) {
|
|
2440
|
+
throw new Error(`Unable to resolve Hyperliquid order symbol: ${params.symbol}`);
|
|
2441
|
+
}
|
|
2442
|
+
return {
|
|
2443
|
+
rawSymbol: params.symbol,
|
|
2444
|
+
kind: parsed.kind,
|
|
2445
|
+
routeTicker: parsed.routeTicker,
|
|
2446
|
+
displaySymbol: parsed.displaySymbol,
|
|
2447
|
+
normalized: parsed.normalized,
|
|
2448
|
+
orderSymbol,
|
|
2449
|
+
marketDataCoin: parsed.normalized,
|
|
2450
|
+
base: parsed.base,
|
|
2451
|
+
quote: parsed.quote,
|
|
2452
|
+
pair: parsed.pair,
|
|
2453
|
+
dex: parsed.dex,
|
|
2454
|
+
leverageMode: parsed.leverageMode,
|
|
2455
|
+
spotIndex: null,
|
|
2456
|
+
assetId: null
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2334
2459
|
async function fetchHyperliquidSizeDecimals(params) {
|
|
2335
2460
|
const { symbol, environment } = params;
|
|
2336
2461
|
if (isHyperliquidSpotSymbol(symbol)) {
|
|
@@ -2783,6 +2908,6 @@ function estimateHyperliquidLiquidationPrice(params) {
|
|
|
2783
2908
|
return liquidationPrice;
|
|
2784
2909
|
}
|
|
2785
2910
|
|
|
2786
|
-
export { DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS, DEFAULT_HYPERLIQUID_TPSL_MARKET_SLIPPAGE_BPS, HyperliquidApiError, HyperliquidBuilderApprovalError, HyperliquidExchangeClient, HyperliquidGuardError, HyperliquidInfoClient, HyperliquidTermsError, approveHyperliquidBuilderFee, batchModifyHyperliquidOrders, buildHyperliquidMarketIdentity, buildHyperliquidProfileAssets, cancelAllHyperliquidOrders, cancelHyperliquidOrders, cancelHyperliquidOrdersByCloid, cancelHyperliquidTwapOrder, computeHyperliquidMarketIocLimitPrice, createHyperliquidActionHash, createHyperliquidSubAccount, createMonotonicNonceFactory, depositToHyperliquidBridge, estimateHyperliquidLiquidationPrice, extractHyperliquidDex, fetchHyperliquidAssetCtxs, fetchHyperliquidClearinghouseState, fetchHyperliquidFrontendOpenOrders, fetchHyperliquidHistoricalOrders, fetchHyperliquidMeta, fetchHyperliquidMetaAndAssetCtxs, fetchHyperliquidOpenOrders, fetchHyperliquidOrderStatus, fetchHyperliquidPreTransferCheck, fetchHyperliquidSizeDecimals, fetchHyperliquidSpotAssetCtxs, fetchHyperliquidSpotClearinghouseState, fetchHyperliquidSpotMeta, fetchHyperliquidSpotMetaAndAssetCtxs, fetchHyperliquidTickSize, fetchHyperliquidUserFills, fetchHyperliquidUserFillsByTime, fetchHyperliquidUserRateLimit, formatHyperliquidMarketablePrice, formatHyperliquidPrice, formatHyperliquidSize, getHyperliquidMaxBuilderFee, isHyperliquidSpotSymbol, modifyHyperliquidOrder, normalizeHyperliquidBaseSymbol, normalizeHyperliquidMetaSymbol, normalizeSpotTokenName2 as normalizeSpotTokenName, parseHyperliquidSymbol, parseSpotPairSymbol, placeHyperliquidOrder, placeHyperliquidOrderWithTpSl, placeHyperliquidPositionTpSl, placeHyperliquidTwapOrder, reserveHyperliquidRequestWeight, resolveHyperliquidAbstractionFromMode, resolveHyperliquidLeverageMode, resolveHyperliquidMarketDataCoin, resolveHyperliquidOrderSymbol, resolveHyperliquidPair, resolveHyperliquidPerpSymbol, resolveHyperliquidProfileChain, resolveHyperliquidSpotSymbol, resolveHyperliquidSymbol, resolveSpotMidCandidates, resolveSpotTokenCandidates, scheduleHyperliquidCancel, sendHyperliquidSpot, setHyperliquidAccountAbstractionMode,
|
|
2911
|
+
export { DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS, DEFAULT_HYPERLIQUID_TPSL_MARKET_SLIPPAGE_BPS, HyperliquidApiError, HyperliquidBuilderApprovalError, HyperliquidExchangeClient, HyperliquidGuardError, HyperliquidInfoClient, HyperliquidTermsError, approveHyperliquidBuilderFee, batchModifyHyperliquidOrders, buildHyperliquidMarketIdentity, buildHyperliquidProfileAssets, cancelAllHyperliquidOrders, cancelHyperliquidOrders, cancelHyperliquidOrdersByCloid, cancelHyperliquidTwapOrder, computeHyperliquidMarketIocLimitPrice, createHyperliquidActionHash, createHyperliquidSubAccount, createMonotonicNonceFactory, depositToHyperliquidBridge, estimateHyperliquidLiquidationPrice, extractHyperliquidDex, fetchHyperliquidAssetCtxs, fetchHyperliquidClearinghouseState, fetchHyperliquidFrontendOpenOrders, fetchHyperliquidHistoricalOrders, fetchHyperliquidMeta, fetchHyperliquidMetaAndAssetCtxs, fetchHyperliquidOpenOrders, fetchHyperliquidOrderStatus, fetchHyperliquidPreTransferCheck, fetchHyperliquidResolvedMarketDescriptor, fetchHyperliquidSizeDecimals, fetchHyperliquidSpotAssetCtxs, fetchHyperliquidSpotClearinghouseState, fetchHyperliquidSpotMeta, fetchHyperliquidSpotMetaAndAssetCtxs, fetchHyperliquidTickSize, fetchHyperliquidUserFills, fetchHyperliquidUserFillsByTime, fetchHyperliquidUserRateLimit, formatHyperliquidMarketablePrice, formatHyperliquidPrice, formatHyperliquidSize, getHyperliquidMaxBuilderFee, isHyperliquidSpotSymbol, modifyHyperliquidOrder, normalizeHyperliquidBaseSymbol, normalizeHyperliquidMetaSymbol, normalizeSpotTokenName2 as normalizeSpotTokenName, parseHyperliquidSymbol, parseSpotPairSymbol, placeHyperliquidOrder, placeHyperliquidOrderWithTpSl, placeHyperliquidPositionTpSl, placeHyperliquidTwapOrder, reserveHyperliquidRequestWeight, resolveHyperliquidAbstractionFromMode, resolveHyperliquidLeverageMode, resolveHyperliquidMarketDataCoin, resolveHyperliquidOrderSymbol, resolveHyperliquidPair, resolveHyperliquidPerpSymbol, resolveHyperliquidProfileChain, resolveHyperliquidSpotSymbol, resolveHyperliquidSymbol, resolveSpotMidCandidates, resolveSpotTokenCandidates, scheduleHyperliquidCancel, sendHyperliquidSpot, setHyperliquidAccountAbstractionMode, setHyperliquidPortfolioMargin, supportsHyperliquidBuilderFee, transferHyperliquidSubAccount, updateHyperliquidIsolatedMargin, updateHyperliquidLeverage, withdrawFromHyperliquid };
|
|
2787
2912
|
//# sourceMappingURL=browser.js.map
|
|
2788
2913
|
//# sourceMappingURL=browser.js.map
|