opentool 0.13.0 → 0.15.0

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.
@@ -0,0 +1,701 @@
1
+ import { h as WalletFullContext } from './types-BaTmu0gS.js';
2
+
3
+ type HyperliquidEnvironment = "mainnet" | "testnet";
4
+ type MarketIdentity = {
5
+ market_type: "perp" | "spot" | "dex";
6
+ venue: "hyperliquid";
7
+ environment: HyperliquidEnvironment;
8
+ base: string;
9
+ quote?: string | null;
10
+ dex?: string | null;
11
+ chain_id?: number | null;
12
+ pool_address?: string | null;
13
+ token0_address?: string | null;
14
+ token1_address?: string | null;
15
+ fee_tier?: number | null;
16
+ raw_symbol?: string | null;
17
+ canonical_symbol: string;
18
+ };
19
+ type HyperliquidMarketIdentityInput = {
20
+ environment: HyperliquidEnvironment;
21
+ symbol: string;
22
+ rawSymbol?: string | null;
23
+ isSpot?: boolean;
24
+ base?: string | null;
25
+ quote?: string | null;
26
+ };
27
+ declare function buildHyperliquidMarketIdentity(input: HyperliquidMarketIdentityInput): MarketIdentity | null;
28
+ type HyperliquidTimeInForce = "Gtc" | "Ioc" | "Alo" | "FrontendMarket" | "LiquidationMarket";
29
+ type HyperliquidGrouping = "na" | "normalTpsl" | "positionTpsl";
30
+ type HyperliquidTriggerType = "tp" | "sl";
31
+ type HyperliquidAbstraction = "unifiedAccount" | "portfolioMargin" | "disabled";
32
+ type HyperliquidAccountMode = "standard" | "unified" | "portfolio";
33
+ declare function resolveHyperliquidAbstractionFromMode(mode: HyperliquidAccountMode): HyperliquidAbstraction;
34
+ declare const DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS = 30;
35
+ declare function computeHyperliquidMarketIocLimitPrice(params: {
36
+ markPrice: number;
37
+ side: "buy" | "sell";
38
+ slippageBps?: number;
39
+ decimals?: number;
40
+ }): string;
41
+ interface HyperliquidTriggerOptions {
42
+ triggerPx: string | number | bigint;
43
+ isMarket?: boolean;
44
+ tpsl: HyperliquidTriggerType;
45
+ }
46
+ interface HyperliquidBuilderFee {
47
+ address: `0x${string}`;
48
+ /**
49
+ * Fee in tenths of basis points (10 = 1bp = 0.01%). Max defaults to 0.1% (100).
50
+ */
51
+ fee: number;
52
+ }
53
+ interface HyperliquidOrderIntent {
54
+ symbol: string;
55
+ side: "buy" | "sell";
56
+ price: string | number | bigint;
57
+ size: string | number | bigint;
58
+ tif?: HyperliquidTimeInForce;
59
+ reduceOnly?: boolean;
60
+ clientId?: `0x${string}`;
61
+ trigger?: HyperliquidTriggerOptions;
62
+ }
63
+ type ExchangeOrderAction = {
64
+ type: "order";
65
+ orders: Array<{
66
+ a: number;
67
+ b: boolean;
68
+ p: string;
69
+ s: string;
70
+ r: boolean;
71
+ t: {
72
+ limit: {
73
+ tif: HyperliquidTimeInForce;
74
+ };
75
+ } | {
76
+ trigger: {
77
+ isMarket: boolean;
78
+ triggerPx: string;
79
+ tpsl: HyperliquidTriggerType;
80
+ };
81
+ };
82
+ c?: `0x${string}`;
83
+ }>;
84
+ grouping: HyperliquidGrouping;
85
+ builder?: {
86
+ b: `0x${string}`;
87
+ f: number;
88
+ };
89
+ };
90
+ type ExchangeSignature = {
91
+ r: `0x${string}`;
92
+ s: `0x${string}`;
93
+ v: 27 | 28;
94
+ };
95
+ type HyperliquidExchangeResponse<T = unknown> = {
96
+ status: string;
97
+ response?: {
98
+ type: string;
99
+ data?: T;
100
+ };
101
+ error?: string;
102
+ };
103
+ type NonceSource = () => number;
104
+ declare class HyperliquidApiError extends Error {
105
+ readonly response: unknown;
106
+ constructor(message: string, response: unknown);
107
+ }
108
+ declare class HyperliquidGuardError extends Error {
109
+ constructor(message: string);
110
+ }
111
+ declare class HyperliquidTermsError extends HyperliquidGuardError {
112
+ constructor(message?: string);
113
+ }
114
+ declare class HyperliquidBuilderApprovalError extends HyperliquidGuardError {
115
+ constructor(message?: string);
116
+ }
117
+ declare function createMonotonicNonceFactory(start?: number): NonceSource;
118
+ declare function toApiDecimal(value: string | number | bigint): string;
119
+ declare function splitSignature(signature: `0x${string}`): ExchangeSignature;
120
+ declare function createL1ActionHash(args: {
121
+ action: ExchangeOrderAction | Record<string, unknown>;
122
+ nonce: number;
123
+ vaultAddress?: `0x${string}` | undefined;
124
+ expiresAfter?: number | undefined;
125
+ }): `0x${string}`;
126
+
127
+ declare class HyperliquidInfoClient {
128
+ private readonly environment;
129
+ constructor(environment?: HyperliquidEnvironment);
130
+ meta(): Promise<any>;
131
+ metaAndAssetCtxs(): Promise<any>;
132
+ spotMeta(): Promise<any>;
133
+ spotMetaAndAssetCtxs(): Promise<any>;
134
+ assetCtxs(): Promise<any>;
135
+ spotAssetCtxs(): Promise<any>;
136
+ openOrders(user: `0x${string}`): Promise<any>;
137
+ frontendOpenOrders(user: `0x${string}`): Promise<any>;
138
+ orderStatus(user: `0x${string}`, oid: number | string): Promise<any>;
139
+ historicalOrders(user: `0x${string}`): Promise<any>;
140
+ userFills(user: `0x${string}`): Promise<any>;
141
+ userFillsByTime(user: `0x${string}`, startTime: number, endTime: number): Promise<any>;
142
+ userRateLimit(user: `0x${string}`): Promise<any>;
143
+ preTransferCheck(user: `0x${string}`, source: `0x${string}`): Promise<any>;
144
+ spotClearinghouseState(user: `0x${string}`): Promise<any>;
145
+ }
146
+ declare function fetchHyperliquidMeta(environment?: HyperliquidEnvironment): Promise<any>;
147
+ declare function fetchHyperliquidMetaAndAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
148
+ declare function fetchHyperliquidSpotMeta(environment?: HyperliquidEnvironment): Promise<any>;
149
+ declare function fetchHyperliquidSpotMetaAndAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
150
+ declare function fetchHyperliquidAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
151
+ declare function fetchHyperliquidSpotAssetCtxs(environment?: HyperliquidEnvironment): Promise<any>;
152
+ declare function fetchHyperliquidOpenOrders(params: {
153
+ environment?: HyperliquidEnvironment;
154
+ user: `0x${string}`;
155
+ }): Promise<any>;
156
+ declare function fetchHyperliquidFrontendOpenOrders(params: {
157
+ environment?: HyperliquidEnvironment;
158
+ user: `0x${string}`;
159
+ }): Promise<any>;
160
+ declare function fetchHyperliquidOrderStatus(params: {
161
+ environment?: HyperliquidEnvironment;
162
+ user: `0x${string}`;
163
+ oid: number | string;
164
+ }): Promise<any>;
165
+ declare function fetchHyperliquidHistoricalOrders(params: {
166
+ environment?: HyperliquidEnvironment;
167
+ user: `0x${string}`;
168
+ }): Promise<any>;
169
+ declare function fetchHyperliquidUserFills(params: {
170
+ environment?: HyperliquidEnvironment;
171
+ user: `0x${string}`;
172
+ }): Promise<any>;
173
+ declare function fetchHyperliquidUserFillsByTime(params: {
174
+ environment?: HyperliquidEnvironment;
175
+ user: `0x${string}`;
176
+ startTime: number;
177
+ endTime: number;
178
+ }): Promise<any>;
179
+ declare function fetchHyperliquidUserRateLimit(params: {
180
+ environment?: HyperliquidEnvironment;
181
+ user: `0x${string}`;
182
+ }): Promise<any>;
183
+ declare function fetchHyperliquidPreTransferCheck(params: {
184
+ environment?: HyperliquidEnvironment;
185
+ user: `0x${string}`;
186
+ source: `0x${string}`;
187
+ }): Promise<any>;
188
+ declare function fetchHyperliquidSpotClearinghouseState(params: {
189
+ environment?: HyperliquidEnvironment;
190
+ user: `0x${string}`;
191
+ }): Promise<any>;
192
+
193
+ type CommonActionOptions = {
194
+ environment?: HyperliquidEnvironment;
195
+ vaultAddress?: `0x${string}` | undefined;
196
+ expiresAfter?: number | undefined;
197
+ nonce?: number | undefined;
198
+ nonceSource?: NonceSource | undefined;
199
+ /**
200
+ * Optional per-wallet nonce provider (preferred if available).
201
+ */
202
+ walletNonceProvider?: NonceSource | undefined;
203
+ };
204
+ type CancelInput = {
205
+ symbol: string;
206
+ oid: number | string;
207
+ };
208
+ type CancelByCloidInput = {
209
+ symbol: string;
210
+ cloid: `0x${string}`;
211
+ };
212
+ type ModifyOrderInput = {
213
+ oid: number | `0x${string}`;
214
+ order: HyperliquidOrderIntent;
215
+ };
216
+ type TwapOrderInput = {
217
+ symbol: string;
218
+ side: "buy" | "sell";
219
+ size: string | number | bigint;
220
+ reduceOnly?: boolean;
221
+ minutes: number;
222
+ randomize?: boolean;
223
+ };
224
+ type TwapCancelInput = {
225
+ symbol: string;
226
+ twapId: number;
227
+ };
228
+ type UpdateLeverageInput = {
229
+ symbol: string;
230
+ leverageMode: "cross" | "isolated";
231
+ leverage: number;
232
+ };
233
+ type UpdateIsolatedMarginInput = {
234
+ symbol: string;
235
+ isBuy: boolean;
236
+ ntli: number;
237
+ };
238
+ declare class HyperliquidExchangeClient {
239
+ private readonly nonceSource;
240
+ private readonly environment;
241
+ private readonly vaultAddress;
242
+ private readonly expiresAfter;
243
+ private readonly wallet;
244
+ constructor(args: {
245
+ wallet: WalletFullContext;
246
+ environment?: HyperliquidEnvironment;
247
+ vaultAddress?: `0x${string}`;
248
+ expiresAfter?: number;
249
+ nonceSource?: NonceSource;
250
+ walletNonceProvider?: NonceSource;
251
+ });
252
+ cancel(cancels: CancelInput[]): Promise<HyperliquidExchangeResponse<unknown>>;
253
+ cancelByCloid(cancels: CancelByCloidInput[]): Promise<HyperliquidExchangeResponse<unknown>>;
254
+ cancelAll(): Promise<HyperliquidExchangeResponse<unknown>>;
255
+ scheduleCancel(time: number | null): Promise<HyperliquidExchangeResponse<unknown>>;
256
+ modify(modification: ModifyOrderInput): Promise<HyperliquidExchangeResponse<unknown>>;
257
+ batchModify(modifications: ModifyOrderInput[]): Promise<HyperliquidExchangeResponse<unknown>>;
258
+ twapOrder(twap: TwapOrderInput): Promise<HyperliquidExchangeResponse<unknown>>;
259
+ twapCancel(cancel: TwapCancelInput): Promise<HyperliquidExchangeResponse<unknown>>;
260
+ updateLeverage(input: UpdateLeverageInput): Promise<HyperliquidExchangeResponse<unknown>>;
261
+ updateIsolatedMargin(input: UpdateIsolatedMarginInput): Promise<HyperliquidExchangeResponse<unknown>>;
262
+ reserveRequestWeight(weight: number): Promise<HyperliquidExchangeResponse<unknown>>;
263
+ spotSend(params: {
264
+ destination: `0x${string}`;
265
+ token: string;
266
+ amount: string | number | bigint;
267
+ }): Promise<HyperliquidExchangeResponse<unknown>>;
268
+ setDexAbstraction(params: {
269
+ enabled: boolean;
270
+ user?: `0x${string}`;
271
+ }): Promise<HyperliquidExchangeResponse<unknown>>;
272
+ setAccountAbstractionMode(params: {
273
+ mode: HyperliquidAccountMode;
274
+ user?: `0x${string}`;
275
+ }): Promise<HyperliquidExchangeResponse<unknown>>;
276
+ setPortfolioMargin(params: {
277
+ enabled: boolean;
278
+ user?: `0x${string}`;
279
+ }): Promise<HyperliquidExchangeResponse<unknown>>;
280
+ }
281
+ declare function setHyperliquidPortfolioMargin(options: {
282
+ wallet: WalletFullContext;
283
+ enabled: boolean;
284
+ user?: `0x${string}`;
285
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
286
+ declare function setHyperliquidDexAbstraction(options: {
287
+ wallet: WalletFullContext;
288
+ enabled: boolean;
289
+ user?: `0x${string}`;
290
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
291
+ declare function setHyperliquidAccountAbstractionMode(options: {
292
+ wallet: WalletFullContext;
293
+ mode: HyperliquidAccountMode;
294
+ user?: `0x${string}`;
295
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
296
+ declare function cancelHyperliquidOrders(options: {
297
+ wallet: WalletFullContext;
298
+ cancels: CancelInput[];
299
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
300
+ declare function cancelHyperliquidOrdersByCloid(options: {
301
+ wallet: WalletFullContext;
302
+ cancels: CancelByCloidInput[];
303
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
304
+ declare function cancelAllHyperliquidOrders(options: {
305
+ wallet: WalletFullContext;
306
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
307
+ declare function scheduleHyperliquidCancel(options: {
308
+ wallet: WalletFullContext;
309
+ time?: number | null;
310
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
311
+ declare function modifyHyperliquidOrder(options: {
312
+ wallet: WalletFullContext;
313
+ modification: ModifyOrderInput;
314
+ grouping?: HyperliquidGrouping;
315
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
316
+ declare function batchModifyHyperliquidOrders(options: {
317
+ wallet: WalletFullContext;
318
+ modifications: ModifyOrderInput[];
319
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
320
+ declare function placeHyperliquidTwapOrder(options: {
321
+ wallet: WalletFullContext;
322
+ twap: TwapOrderInput;
323
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
324
+ declare function cancelHyperliquidTwapOrder(options: {
325
+ wallet: WalletFullContext;
326
+ cancel: TwapCancelInput;
327
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
328
+ declare function updateHyperliquidLeverage(options: {
329
+ wallet: WalletFullContext;
330
+ input: UpdateLeverageInput;
331
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
332
+ declare function updateHyperliquidIsolatedMargin(options: {
333
+ wallet: WalletFullContext;
334
+ input: UpdateIsolatedMarginInput;
335
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
336
+ declare function reserveHyperliquidRequestWeight(options: {
337
+ wallet: WalletFullContext;
338
+ weight: number;
339
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
340
+ declare function createHyperliquidSubAccount(options: {
341
+ wallet: WalletFullContext;
342
+ name: string;
343
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
344
+ declare function transferHyperliquidSubAccount(options: {
345
+ wallet: WalletFullContext;
346
+ subAccountUser: `0x${string}`;
347
+ isDeposit: boolean;
348
+ usd: string | number | bigint;
349
+ } & CommonActionOptions): Promise<HyperliquidExchangeResponse<unknown>>;
350
+ declare function sendHyperliquidSpot(options: {
351
+ wallet: WalletFullContext;
352
+ destination: `0x${string}`;
353
+ token: string;
354
+ amount: string | number | bigint;
355
+ environment?: HyperliquidEnvironment;
356
+ nonce?: number;
357
+ nonceSource?: NonceSource | undefined;
358
+ }): Promise<HyperliquidExchangeResponse<unknown>>;
359
+
360
+ type HyperliquidParsedSymbolKind = "perp" | "spot" | "spotIndex";
361
+ type HyperliquidParsedSymbol = {
362
+ raw: string;
363
+ kind: HyperliquidParsedSymbolKind;
364
+ normalized: string;
365
+ routeTicker: string;
366
+ displaySymbol: string;
367
+ base: string | null;
368
+ quote: string | null;
369
+ pair: string | null;
370
+ dex: string | null;
371
+ leverageMode: "cross" | "isolated";
372
+ };
373
+ declare function extractHyperliquidDex(symbol: string): string | null;
374
+ declare function parseHyperliquidSymbol(value?: string | null): HyperliquidParsedSymbol | null;
375
+ declare function normalizeSpotTokenName(value?: string | null): string;
376
+ declare function normalizeHyperliquidBaseSymbol(value?: string | null): string | null;
377
+ declare function normalizeHyperliquidMetaSymbol(symbol: string): string;
378
+ declare function resolveHyperliquidPair(value?: string | null): string | null;
379
+ declare function resolveHyperliquidLeverageMode(symbol: string): "cross" | "isolated";
380
+ type HyperliquidProfileChain = "hyperliquid" | "hyperliquid-testnet";
381
+ type HyperliquidProfileAssetInput = {
382
+ assetSymbols: string[];
383
+ pair?: string | null;
384
+ leverage?: number | null;
385
+ walletAddress?: string | null;
386
+ };
387
+ type HyperliquidProfileAsset = {
388
+ venue: "hyperliquid";
389
+ chain: HyperliquidProfileChain;
390
+ assetSymbols: string[];
391
+ pair?: string;
392
+ leverage?: number;
393
+ walletAddress?: string;
394
+ };
395
+ declare function resolveHyperliquidProfileChain(environment: HyperliquidEnvironment): HyperliquidProfileChain;
396
+ declare function buildHyperliquidProfileAssets(params: {
397
+ environment: HyperliquidEnvironment;
398
+ assets: HyperliquidProfileAssetInput[];
399
+ }): HyperliquidProfileAsset[];
400
+ declare function parseSpotPairSymbol(symbol: string): {
401
+ base: string;
402
+ quote: string;
403
+ } | null;
404
+ declare function isHyperliquidSpotSymbol(symbol: string): boolean;
405
+ declare function resolveSpotMidCandidates(baseSymbol: string): string[];
406
+ declare function resolveSpotTokenCandidates(value: string): string[];
407
+ declare function resolveHyperliquidOrderSymbol(value?: string | null): string | null;
408
+ declare function resolveHyperliquidSymbol(asset: string, override?: string): string;
409
+ declare function resolveHyperliquidPerpSymbol(asset: string): string;
410
+ declare function resolveHyperliquidSpotSymbol(asset: string, defaultQuote?: string): {
411
+ symbol: string;
412
+ base: string;
413
+ quote: string;
414
+ };
415
+
416
+ type HyperliquidTickSize = {
417
+ tickSizeInt: bigint;
418
+ tickDecimals: number;
419
+ };
420
+ type HyperliquidMarketType = "perp" | "spot";
421
+ type HyperliquidOrderResponseLike = {
422
+ response?: {
423
+ data?: {
424
+ statuses?: Array<Record<string, unknown>>;
425
+ };
426
+ };
427
+ };
428
+ declare function formatHyperliquidPrice(price: string | number, szDecimals: number, marketType?: HyperliquidMarketType): string;
429
+ declare function formatHyperliquidSize(size: string | number, szDecimals: number): string;
430
+ declare function formatHyperliquidOrderSize(value: number, szDecimals: number): string;
431
+ declare function roundHyperliquidPriceToTick(price: string | number, tick: HyperliquidTickSize, side: "buy" | "sell"): string;
432
+ declare function formatHyperliquidMarketablePrice(params: {
433
+ mid: number;
434
+ side: "buy" | "sell";
435
+ slippageBps: number;
436
+ tick?: HyperliquidTickSize | null;
437
+ }): string;
438
+ declare function extractHyperliquidOrderIds(responses: HyperliquidOrderResponseLike[]): {
439
+ cloids: string[];
440
+ oids: string[];
441
+ };
442
+ declare function resolveHyperliquidOrderRef(params: {
443
+ response?: HyperliquidOrderResponseLike | null;
444
+ fallbackCloid?: string | null;
445
+ fallbackOid?: string | null;
446
+ prefix?: string;
447
+ index?: number;
448
+ }): string;
449
+ declare function resolveHyperliquidErrorDetail(error: unknown): unknown | null;
450
+
451
+ type SpotUniverseItem = {
452
+ name?: string;
453
+ index?: number;
454
+ tokens?: number[];
455
+ };
456
+ type SpotToken = {
457
+ name?: string;
458
+ index?: number;
459
+ szDecimals?: number;
460
+ };
461
+ type SpotAssetContext = {
462
+ markPx?: string | number;
463
+ midPx?: string | number;
464
+ oraclePx?: string | number;
465
+ };
466
+ type SpotMetaResponse = {
467
+ universe?: SpotUniverseItem[];
468
+ tokens?: SpotToken[];
469
+ };
470
+ type HyperliquidBarResolution = "1" | "5" | "15" | "30" | "60" | "240" | "1D" | "1W";
471
+ type HyperliquidBar = {
472
+ time: number;
473
+ open?: number;
474
+ high?: number;
475
+ low?: number;
476
+ close: number;
477
+ volume?: number;
478
+ [key: string]: unknown;
479
+ };
480
+ type HyperliquidIndicatorBar = {
481
+ time: number;
482
+ open: number;
483
+ high: number;
484
+ low: number;
485
+ close: number;
486
+ volume: number;
487
+ };
488
+ type HyperliquidPerpMarketInfo = {
489
+ symbol: string;
490
+ price: number;
491
+ fundingRate: number | null;
492
+ szDecimals: number;
493
+ };
494
+ type HyperliquidSpotMarketInfo = {
495
+ symbol: string;
496
+ base: string;
497
+ quote: string;
498
+ assetId: number;
499
+ marketIndex: number;
500
+ price: number;
501
+ szDecimals: number;
502
+ };
503
+ declare function maxDecimals(values: string[]): number;
504
+ declare function toScaledInt(value: string, decimals: number): bigint;
505
+ declare function formatScaledInt(value: bigint, decimals: number): string;
506
+ declare function fetchHyperliquidAllMids(environment: HyperliquidEnvironment): Promise<Record<string, string | number>>;
507
+ declare function fetchHyperliquidBars(params: {
508
+ symbol: string;
509
+ resolution: HyperliquidBarResolution;
510
+ countBack: number;
511
+ fromSeconds?: number;
512
+ toSeconds?: number;
513
+ gatewayBase?: string | null;
514
+ }): Promise<HyperliquidBar[]>;
515
+ declare function normalizeHyperliquidIndicatorBars(bars: HyperliquidBar[]): HyperliquidIndicatorBar[];
516
+ declare function fetchHyperliquidTickSize(params: {
517
+ environment: HyperliquidEnvironment;
518
+ symbol: string;
519
+ }): Promise<HyperliquidTickSize>;
520
+ declare function fetchHyperliquidSpotTickSize(params: {
521
+ environment: HyperliquidEnvironment;
522
+ marketIndex: number;
523
+ }): Promise<HyperliquidTickSize>;
524
+ declare function fetchHyperliquidPerpMarketInfo(params: {
525
+ environment: HyperliquidEnvironment;
526
+ symbol: string;
527
+ }): Promise<HyperliquidPerpMarketInfo>;
528
+ declare function fetchHyperliquidSpotMarketInfo(params: {
529
+ environment: HyperliquidEnvironment;
530
+ base: string;
531
+ quote: string;
532
+ mids?: Record<string, string | number> | null;
533
+ }): Promise<HyperliquidSpotMarketInfo>;
534
+ declare function fetchHyperliquidSizeDecimals(params: {
535
+ environment: HyperliquidEnvironment;
536
+ symbol: string;
537
+ }): Promise<number>;
538
+ declare function buildHyperliquidSpotUsdPriceMap(params: {
539
+ meta: SpotMetaResponse;
540
+ ctxs: SpotAssetContext[];
541
+ mids?: Record<string, string | number> | null;
542
+ }): Map<string, number>;
543
+ declare function fetchHyperliquidSpotUsdPriceMap(environment: HyperliquidEnvironment): Promise<Map<string, number>>;
544
+ declare function fetchHyperliquidSpotAccountValue(params: {
545
+ environment: HyperliquidEnvironment;
546
+ balances: unknown;
547
+ }): Promise<number | null>;
548
+ declare const __hyperliquidMarketDataInternals: {
549
+ maxDecimals: typeof maxDecimals;
550
+ toScaledInt: typeof toScaledInt;
551
+ formatScaledInt: typeof formatScaledInt;
552
+ };
553
+
554
+ interface HyperliquidOrderOptions {
555
+ wallet: WalletFullContext;
556
+ orders: HyperliquidOrderIntent[];
557
+ grouping?: HyperliquidGrouping;
558
+ environment?: HyperliquidEnvironment;
559
+ vaultAddress?: `0x${string}`;
560
+ expiresAfter?: number;
561
+ nonce?: number;
562
+ nonceSource?: NonceSource;
563
+ }
564
+ type HyperliquidOrderStatus = {
565
+ resting: {
566
+ oid: number;
567
+ cloid?: `0x${string}`;
568
+ };
569
+ } | {
570
+ filled: {
571
+ totalSz: string;
572
+ avgPx: string;
573
+ oid: number;
574
+ cloid?: `0x${string}`;
575
+ };
576
+ } | {
577
+ error: string;
578
+ } | "waitingForFill" | "waitingForTrigger";
579
+ interface HyperliquidOrderResponse {
580
+ status: "ok";
581
+ response: {
582
+ type: "order";
583
+ data: {
584
+ statuses: HyperliquidOrderStatus[];
585
+ };
586
+ };
587
+ }
588
+ interface HyperliquidDepositResult {
589
+ txHash: `0x${string}`;
590
+ amount: number;
591
+ amountUnits: string;
592
+ environment: HyperliquidEnvironment;
593
+ bridgeAddress: `0x${string}`;
594
+ }
595
+ interface HyperliquidWithdrawResult {
596
+ amount: number;
597
+ destination: `0x${string}`;
598
+ environment: HyperliquidEnvironment;
599
+ nonce: number;
600
+ status: string;
601
+ }
602
+ interface HyperliquidClearinghouseState {
603
+ ok: boolean;
604
+ data: Record<string, unknown> | null;
605
+ }
606
+ interface HyperliquidApproveBuilderFeeOptions {
607
+ environment: HyperliquidEnvironment;
608
+ wallet: WalletFullContext;
609
+ nonce?: number;
610
+ nonceSource?: NonceSource;
611
+ signatureChainId?: string;
612
+ }
613
+ interface HyperliquidApproveBuilderFeeResponse {
614
+ status: string;
615
+ response?: unknown;
616
+ error?: string;
617
+ }
618
+ declare function placeHyperliquidOrder(options: HyperliquidOrderOptions): Promise<HyperliquidOrderResponse>;
619
+ declare function depositToHyperliquidBridge(options: {
620
+ environment: HyperliquidEnvironment;
621
+ amount: string;
622
+ wallet: WalletFullContext;
623
+ }): Promise<HyperliquidDepositResult>;
624
+ declare function withdrawFromHyperliquid(options: {
625
+ environment: HyperliquidEnvironment;
626
+ amount: string;
627
+ destination: `0x${string}`;
628
+ wallet: WalletFullContext;
629
+ nonce?: number;
630
+ nonceSource?: NonceSource;
631
+ }): Promise<HyperliquidWithdrawResult>;
632
+ declare function fetchHyperliquidClearinghouseState(params: {
633
+ environment: HyperliquidEnvironment;
634
+ walletAddress: `0x${string}`;
635
+ }): Promise<HyperliquidClearinghouseState>;
636
+ declare function approveHyperliquidBuilderFee(options: HyperliquidApproveBuilderFeeOptions): Promise<HyperliquidApproveBuilderFeeResponse>;
637
+ declare function getHyperliquidMaxBuilderFee(params: {
638
+ environment: HyperliquidEnvironment;
639
+ user: `0x${string}`;
640
+ }): Promise<unknown>;
641
+ declare function createHyperliquidActionHash(params: {
642
+ action: Record<string, unknown> | ExchangeOrderAction;
643
+ nonce: number;
644
+ isTestnet: boolean;
645
+ vaultAddress?: `0x${string}`;
646
+ expiresAfter?: number;
647
+ }): `0x${string}`;
648
+
649
+ declare const DEFAULT_HYPERLIQUID_TPSL_MARKET_SLIPPAGE_BPS = 1000;
650
+ type HyperliquidTpSlExecutionType = "market" | "limit";
651
+ interface HyperliquidTpSlLegInput {
652
+ triggerPx: string | number | bigint;
653
+ execution?: HyperliquidTpSlExecutionType;
654
+ price?: string | number | bigint;
655
+ clientId?: `0x${string}`;
656
+ }
657
+ interface HyperliquidPlaceOrderWithTpSlOptions {
658
+ wallet: WalletFullContext;
659
+ parent: HyperliquidOrderIntent;
660
+ referencePrice: string | number;
661
+ takeProfit?: HyperliquidTpSlLegInput | null;
662
+ stopLoss?: HyperliquidTpSlLegInput | null;
663
+ environment?: HyperliquidEnvironment;
664
+ grouping?: Extract<HyperliquidGrouping, "normalTpsl">;
665
+ vaultAddress?: `0x${string}`;
666
+ expiresAfter?: number;
667
+ nonce?: number;
668
+ nonceSource?: NonceSource;
669
+ triggerMarketSlippageBps?: number;
670
+ }
671
+ interface HyperliquidPlacePositionTpSlOptions {
672
+ wallet: WalletFullContext;
673
+ symbol: string;
674
+ positionSide: "long" | "short";
675
+ size: string | number | bigint;
676
+ referencePrice: string | number;
677
+ takeProfit?: HyperliquidTpSlLegInput | null;
678
+ stopLoss?: HyperliquidTpSlLegInput | null;
679
+ environment?: HyperliquidEnvironment;
680
+ grouping?: Extract<HyperliquidGrouping, "positionTpsl">;
681
+ vaultAddress?: `0x${string}`;
682
+ expiresAfter?: number;
683
+ nonce?: number;
684
+ nonceSource?: NonceSource;
685
+ triggerMarketSlippageBps?: number;
686
+ }
687
+ declare function placeHyperliquidOrderWithTpSl(options: HyperliquidPlaceOrderWithTpSlOptions): Promise<HyperliquidOrderResponse>;
688
+ declare function placeHyperliquidPositionTpSl(options: HyperliquidPlacePositionTpSlOptions): Promise<HyperliquidOrderResponse>;
689
+
690
+ type HyperliquidApproximateLiquidationParams = {
691
+ entryPrice: number;
692
+ side: "buy" | "sell";
693
+ notionalUsd: number;
694
+ leverage: number;
695
+ maxLeverage: number;
696
+ marginMode: "cross" | "isolated";
697
+ availableCollateralUsd?: number | null;
698
+ };
699
+ declare function estimateHyperliquidLiquidationPrice(params: HyperliquidApproximateLiquidationParams): number | null;
700
+
701
+ export { fetchHyperliquidAssetCtxs as $, type HyperliquidSpotMarketInfo as A, HyperliquidTermsError as B, type HyperliquidTickSize as C, DEFAULT_HYPERLIQUID_MARKET_SLIPPAGE_BPS as D, type HyperliquidTimeInForce as E, type HyperliquidTpSlExecutionType as F, type HyperliquidTpSlLegInput as G, type HyperliquidAbstraction as H, type HyperliquidTriggerOptions as I, type HyperliquidTriggerType as J, batchModifyHyperliquidOrders as K, buildHyperliquidMarketIdentity as L, type MarketIdentity as M, buildHyperliquidProfileAssets as N, buildHyperliquidSpotUsdPriceMap as O, cancelAllHyperliquidOrders as P, cancelHyperliquidOrders as Q, cancelHyperliquidOrdersByCloid as R, cancelHyperliquidTwapOrder as S, computeHyperliquidMarketIocLimitPrice as T, createHyperliquidSubAccount as U, createMonotonicNonceFactory as V, estimateHyperliquidLiquidationPrice as W, extractHyperliquidDex as X, extractHyperliquidOrderIds as Y, fetchHyperliquidAllMids as Z, __hyperliquidMarketDataInternals as _, DEFAULT_HYPERLIQUID_TPSL_MARKET_SLIPPAGE_BPS as a, type HyperliquidApproveBuilderFeeOptions as a$, fetchHyperliquidBars as a0, fetchHyperliquidFrontendOpenOrders as a1, fetchHyperliquidHistoricalOrders as a2, fetchHyperliquidMeta as a3, fetchHyperliquidMetaAndAssetCtxs as a4, fetchHyperliquidOpenOrders as a5, fetchHyperliquidOrderStatus as a6, fetchHyperliquidPerpMarketInfo as a7, fetchHyperliquidPreTransferCheck as a8, fetchHyperliquidSizeDecimals as a9, placeHyperliquidTwapOrder as aA, reserveHyperliquidRequestWeight as aB, resolveHyperliquidAbstractionFromMode as aC, resolveHyperliquidErrorDetail as aD, resolveHyperliquidLeverageMode as aE, resolveHyperliquidOrderRef as aF, resolveHyperliquidOrderSymbol as aG, resolveHyperliquidPair as aH, resolveHyperliquidPerpSymbol as aI, resolveHyperliquidProfileChain as aJ, resolveHyperliquidSpotSymbol as aK, resolveHyperliquidSymbol as aL, resolveSpotMidCandidates as aM, resolveSpotTokenCandidates as aN, roundHyperliquidPriceToTick as aO, scheduleHyperliquidCancel as aP, sendHyperliquidSpot as aQ, setHyperliquidAccountAbstractionMode as aR, setHyperliquidDexAbstraction as aS, setHyperliquidPortfolioMargin as aT, transferHyperliquidSubAccount as aU, updateHyperliquidIsolatedMargin as aV, updateHyperliquidLeverage as aW, type NonceSource as aX, toApiDecimal as aY, createL1ActionHash as aZ, splitSignature as a_, fetchHyperliquidSpotAccountValue as aa, fetchHyperliquidSpotAssetCtxs as ab, fetchHyperliquidSpotClearinghouseState as ac, fetchHyperliquidSpotMarketInfo as ad, fetchHyperliquidSpotMeta as ae, fetchHyperliquidSpotMetaAndAssetCtxs as af, fetchHyperliquidSpotTickSize as ag, fetchHyperliquidSpotUsdPriceMap as ah, fetchHyperliquidTickSize as ai, fetchHyperliquidUserFills as aj, fetchHyperliquidUserFillsByTime as ak, fetchHyperliquidUserRateLimit as al, formatHyperliquidMarketablePrice as am, formatHyperliquidOrderSize as an, formatHyperliquidPrice as ao, formatHyperliquidSize as ap, isHyperliquidSpotSymbol as aq, modifyHyperliquidOrder as ar, normalizeHyperliquidBaseSymbol as as, normalizeHyperliquidIndicatorBars as at, normalizeHyperliquidMetaSymbol as au, normalizeSpotTokenName as av, parseHyperliquidSymbol as aw, parseSpotPairSymbol as ax, placeHyperliquidOrderWithTpSl as ay, placeHyperliquidPositionTpSl as az, type HyperliquidAccountMode as b, type HyperliquidApproveBuilderFeeResponse as b0, type HyperliquidClearinghouseState as b1, type HyperliquidDepositResult as b2, type HyperliquidOrderOptions as b3, type HyperliquidOrderResponse as b4, type HyperliquidOrderStatus as b5, type HyperliquidWithdrawResult as b6, approveHyperliquidBuilderFee as b7, createHyperliquidActionHash as b8, depositToHyperliquidBridge as b9, fetchHyperliquidClearinghouseState as ba, getHyperliquidMaxBuilderFee as bb, placeHyperliquidOrder as bc, withdrawFromHyperliquid as bd, HyperliquidApiError as c, type HyperliquidApproximateLiquidationParams as d, type HyperliquidBar as e, type HyperliquidBarResolution as f, HyperliquidBuilderApprovalError as g, type HyperliquidBuilderFee as h, type HyperliquidEnvironment as i, HyperliquidExchangeClient as j, type HyperliquidExchangeResponse as k, type HyperliquidGrouping as l, HyperliquidGuardError as m, type HyperliquidIndicatorBar as n, HyperliquidInfoClient as o, type HyperliquidMarketIdentityInput as p, type HyperliquidMarketType as q, type HyperliquidOrderIntent as r, type HyperliquidParsedSymbol as s, type HyperliquidParsedSymbolKind as t, type HyperliquidPerpMarketInfo as u, type HyperliquidPlaceOrderWithTpSlOptions as v, type HyperliquidPlacePositionTpSlOptions as w, type HyperliquidProfileAsset as x, type HyperliquidProfileAssetInput as y, type HyperliquidProfileChain as z };