@pear-protocol/hyperliquid-sdk 0.0.66-usdh-1 → 0.0.67
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/clients/hyperliquid.d.ts +1 -1
- package/dist/clients/orders.d.ts +0 -41
- package/dist/clients/positions.d.ts +2 -2
- package/dist/clients/watchlist.d.ts +1 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/useMarketData.d.ts +7 -9
- package/dist/hooks/useTrading.d.ts +3 -0
- package/dist/hooks/useWebData.d.ts +3 -21
- package/dist/index.d.ts +41 -216
- package/dist/index.js +192 -1181
- package/dist/provider.d.ts +1 -1
- package/dist/store/tokenSelectionMetadataStore.d.ts +1 -1
- package/dist/types.d.ts +21 -74
- package/dist/utils/symbol-translator.d.ts +3 -32
- package/dist/utils/token-metadata-extractor.d.ts +5 -9
- package/package.json +1 -1
- package/dist/hooks/useSpotBalances.d.ts +0 -7
- package/dist/hooks/useSpotOrder.d.ts +0 -13
package/dist/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ interface ExternalFillDto {
|
|
|
47
47
|
coin: string;
|
|
48
48
|
px: string;
|
|
49
49
|
sz: string;
|
|
50
|
-
side:
|
|
50
|
+
side: "B" | "A";
|
|
51
51
|
time: number;
|
|
52
52
|
dir: string;
|
|
53
53
|
fee: string;
|
|
@@ -74,16 +74,16 @@ interface TwapSliceFillResponseItem {
|
|
|
74
74
|
/**
|
|
75
75
|
* WebSocket connection states
|
|
76
76
|
*/
|
|
77
|
-
type WebSocketConnectionState =
|
|
77
|
+
type WebSocketConnectionState = "connecting" | "connected" | "disconnected" | "error";
|
|
78
78
|
/**
|
|
79
79
|
* WebSocket channels
|
|
80
80
|
*/
|
|
81
|
-
type WebSocketChannel =
|
|
81
|
+
type WebSocketChannel = "trade-histories" | "open-positions" | "open-orders" | "account-summary" | "twap-details" | "notifications" | "market-data" | "market-data-all" | "webData3" | "allMids" | "activeAssetData";
|
|
82
82
|
/**
|
|
83
83
|
* WebSocket subscription message
|
|
84
84
|
*/
|
|
85
85
|
interface WebSocketSubscribeMessage {
|
|
86
|
-
action?:
|
|
86
|
+
action?: "subscribe" | "unsubscribe";
|
|
87
87
|
address: string;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
@@ -113,7 +113,7 @@ interface WatchlistItemDto {
|
|
|
113
113
|
interface ToggleWatchlistResponseDto {
|
|
114
114
|
items: WatchlistItemDto[];
|
|
115
115
|
}
|
|
116
|
-
type NotificationCategory =
|
|
116
|
+
type NotificationCategory = "TRADE_OPENED_OUTSIDE_PEAR" | "TRADE_CLOSED_OUTSIDE_PEAR" | "POSITION_LIQUIDATED" | "LIMIT_ORDER_FILLED" | "LIMIT_ORDER_FAILED" | "TP_ORDER_FILLED" | "TP_ORDER_FAILED" | "SL_ORDER_FILLED" | "SL_ORDER_FAILED";
|
|
117
117
|
interface NotificationDto {
|
|
118
118
|
id: string;
|
|
119
119
|
address: string;
|
|
@@ -130,7 +130,7 @@ interface ChunkFillDto {
|
|
|
130
130
|
size: number;
|
|
131
131
|
executedAt: string;
|
|
132
132
|
}
|
|
133
|
-
type TwapChunkStatus =
|
|
133
|
+
type TwapChunkStatus = "PENDING" | "SCHEDULED" | "EXECUTING" | "COMPLETED" | "FAILED" | "CANCELLED";
|
|
134
134
|
interface TwapChunkStatusDto {
|
|
135
135
|
chunkId: string;
|
|
136
136
|
chunkIndex: number;
|
|
@@ -141,7 +141,7 @@ interface TwapChunkStatusDto {
|
|
|
141
141
|
fills: ChunkFillDto[];
|
|
142
142
|
errorMessage?: string;
|
|
143
143
|
}
|
|
144
|
-
type TwapOrderOverallStatus =
|
|
144
|
+
type TwapOrderOverallStatus = "OPEN" | "EXECUTING" | "COMPLETED" | "PARTIALLY_COMPLETED" | "FAILED" | "CANCELLED";
|
|
145
145
|
interface TwapMonitoringDto {
|
|
146
146
|
orderId: string;
|
|
147
147
|
positionId?: string;
|
|
@@ -178,8 +178,6 @@ interface TradeHistoryAssetDataDto {
|
|
|
178
178
|
externalFeePaid: number;
|
|
179
179
|
builderFeePaid: number;
|
|
180
180
|
realizedPnl: number;
|
|
181
|
-
marketPrefix?: string | null;
|
|
182
|
-
collateralToken?: CollateralToken;
|
|
183
181
|
}
|
|
184
182
|
/**
|
|
185
183
|
* Trade history data structure
|
|
@@ -228,11 +226,9 @@ interface PositionAssetDetailDto {
|
|
|
228
226
|
liquidationPrice: number;
|
|
229
227
|
initialWeight: number;
|
|
230
228
|
fundingPaid?: number;
|
|
231
|
-
marketPrefix?: string | null;
|
|
232
|
-
collateralToken?: CollateralToken;
|
|
233
229
|
}
|
|
234
230
|
interface TpSlThreshold {
|
|
235
|
-
type:
|
|
231
|
+
type: "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
|
|
236
232
|
value: number;
|
|
237
233
|
}
|
|
238
234
|
/**
|
|
@@ -263,22 +259,20 @@ interface OpenPositionDto {
|
|
|
263
259
|
interface OrderAssetDto {
|
|
264
260
|
asset: string;
|
|
265
261
|
weight: number;
|
|
266
|
-
marketPrefix?: string | null;
|
|
267
|
-
collateralToken?: CollateralToken;
|
|
268
262
|
}
|
|
269
263
|
/**
|
|
270
264
|
* Order status
|
|
271
265
|
*/
|
|
272
|
-
type OrderStatus =
|
|
266
|
+
type OrderStatus = "OPEN" | "PARTIALLY_FILLED" | "PROCESSING";
|
|
273
267
|
/**
|
|
274
268
|
* Order type
|
|
275
269
|
*/
|
|
276
|
-
type OrderType =
|
|
270
|
+
type OrderType = "TP" | "SL" | "LIMIT" | "MARKET" | "LIMIT_BTCDOM" | "TWAP";
|
|
277
271
|
/**
|
|
278
272
|
* TP/SL trigger type
|
|
279
273
|
*/
|
|
280
|
-
type TpSlTriggerType =
|
|
281
|
-
type OrderDirection =
|
|
274
|
+
type TpSlTriggerType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
|
|
275
|
+
type OrderDirection = "MORE_THAN" | "LESS_THAN" | null;
|
|
282
276
|
/**
|
|
283
277
|
* Open limit order data structure
|
|
284
278
|
*/
|
|
@@ -384,7 +378,7 @@ interface RefreshTokenResponse {
|
|
|
384
378
|
tokenType: string;
|
|
385
379
|
expiresIn: number;
|
|
386
380
|
}
|
|
387
|
-
type AgentWalletStatus =
|
|
381
|
+
type AgentWalletStatus = "ACTIVE" | "EXPIRED" | "NOT_FOUND";
|
|
388
382
|
interface CreateAgentWalletResponseDto {
|
|
389
383
|
agentWalletAddress: string;
|
|
390
384
|
message: string;
|
|
@@ -397,14 +391,14 @@ interface ExtraAgent {
|
|
|
397
391
|
interface AgentWalletState {
|
|
398
392
|
address: string | null;
|
|
399
393
|
name: string | null;
|
|
400
|
-
status: AgentWalletStatus |
|
|
394
|
+
status: AgentWalletStatus | "PENDING" | null;
|
|
401
395
|
isActive: boolean;
|
|
402
396
|
}
|
|
403
397
|
/**
|
|
404
398
|
* WebSocket message from HyperLiquid native API
|
|
405
399
|
*/
|
|
406
400
|
interface WebSocketMessage {
|
|
407
|
-
method:
|
|
401
|
+
method: "subscribe" | "unsubscribe";
|
|
408
402
|
subscription: {
|
|
409
403
|
type: string;
|
|
410
404
|
dex?: string;
|
|
@@ -417,16 +411,12 @@ interface WebSocketMessage {
|
|
|
417
411
|
/**
|
|
418
412
|
* WebSocket response from HyperLiquid native API
|
|
419
413
|
*/
|
|
420
|
-
type HLChannel =
|
|
414
|
+
type HLChannel = "webData3" | "allMids" | "activeAssetData" | "candle" | "allDexsClearinghouseState" | "allDexsAssetCtxs";
|
|
421
415
|
interface HLChannelDataMap {
|
|
422
416
|
webData3: WebData3Response;
|
|
423
417
|
allMids: WsAllMidsData;
|
|
424
418
|
activeAssetData: ActiveAssetData;
|
|
425
419
|
candle: CandleData;
|
|
426
|
-
spotState: {
|
|
427
|
-
user: string;
|
|
428
|
-
spotState: SpotState;
|
|
429
|
-
};
|
|
430
420
|
allDexsClearinghouseState: AllDexsClearinghouseStateData;
|
|
431
421
|
allDexsAssetCtxs: AllDexsAssetCtxsData;
|
|
432
422
|
}
|
|
@@ -491,12 +481,6 @@ interface AssetCtx {
|
|
|
491
481
|
impactPxs?: string[];
|
|
492
482
|
oraclePx: string;
|
|
493
483
|
}
|
|
494
|
-
/**
|
|
495
|
-
* Collateral token type
|
|
496
|
-
* 0 = USDC
|
|
497
|
-
* 360 = USDH
|
|
498
|
-
*/
|
|
499
|
-
type CollateralToken = 'USDC' | 'USDH';
|
|
500
484
|
/**
|
|
501
485
|
* Universe asset metadata
|
|
502
486
|
*/
|
|
@@ -506,8 +490,6 @@ interface UniverseAsset {
|
|
|
506
490
|
maxLeverage: number;
|
|
507
491
|
onlyIsolated?: boolean;
|
|
508
492
|
isDelisted?: boolean;
|
|
509
|
-
marketPrefix?: string;
|
|
510
|
-
collateralToken?: CollateralToken;
|
|
511
493
|
}
|
|
512
494
|
interface ClearinghouseState {
|
|
513
495
|
assetPositions: AssetPosition[];
|
|
@@ -578,8 +560,7 @@ interface RawAssetDto {
|
|
|
578
560
|
size: number;
|
|
579
561
|
side: string;
|
|
580
562
|
fundingPaid?: number;
|
|
581
|
-
|
|
582
|
-
collateralToken?: CollateralToken;
|
|
563
|
+
leverage: number;
|
|
583
564
|
}
|
|
584
565
|
/**
|
|
585
566
|
* Raw position data from open-positions channel
|
|
@@ -627,7 +608,6 @@ interface TokenMetadata {
|
|
|
627
608
|
leverage?: LeverageInfo;
|
|
628
609
|
maxTradeSzs?: [string, string];
|
|
629
610
|
availableToTrade?: [string, string];
|
|
630
|
-
collateralToken?: CollateralToken;
|
|
631
611
|
}
|
|
632
612
|
/**
|
|
633
613
|
* Enhanced token selection with weight and metadata for basket trading
|
|
@@ -641,37 +621,16 @@ interface TokenSelection {
|
|
|
641
621
|
*/
|
|
642
622
|
interface TokenConflict {
|
|
643
623
|
symbol: string;
|
|
644
|
-
conflictType:
|
|
624
|
+
conflictType: "long" | "short";
|
|
645
625
|
conflictMessage: string;
|
|
646
626
|
}
|
|
647
627
|
interface AssetMarketData {
|
|
648
628
|
asset: WebData3AssetCtx | AssetCtx;
|
|
649
629
|
universe: UniverseAsset;
|
|
650
630
|
}
|
|
651
|
-
/**
|
|
652
|
-
* Nested market data structure for multi-market assets.
|
|
653
|
-
* Each symbol maps to its market variants (keyed by prefix).
|
|
654
|
-
* For non-HIP3 assets, use "default" as the key.
|
|
655
|
-
*
|
|
656
|
-
* @example
|
|
657
|
-
* ```ts
|
|
658
|
-
* {
|
|
659
|
-
* "TSLA": {
|
|
660
|
-
* "xyz": { asset: {...}, universe: { collateralToken: "USDC", ... } },
|
|
661
|
-
* "flx": { asset: {...}, universe: { collateralToken: "USDH", ... } }
|
|
662
|
-
* },
|
|
663
|
-
* "BTC": {
|
|
664
|
-
* "default": { asset: {...}, universe: {...} }
|
|
665
|
-
* }
|
|
666
|
-
* }
|
|
667
|
-
* ```
|
|
668
|
-
*/
|
|
669
|
-
type MarketDataBySymbol = Record<string, Record<string, AssetMarketData>>;
|
|
670
631
|
interface PairAssetDto {
|
|
671
632
|
asset: string;
|
|
672
633
|
weight: number;
|
|
673
|
-
collateralToken: CollateralToken;
|
|
674
|
-
marketPrefix: string | null;
|
|
675
634
|
}
|
|
676
635
|
interface ActiveAssetGroupItem {
|
|
677
636
|
longAssets: PairAssetDto[];
|
|
@@ -685,7 +644,6 @@ interface ActiveAssetGroupItem {
|
|
|
685
644
|
weightedRatio?: string;
|
|
686
645
|
weightedPrevRatio?: string;
|
|
687
646
|
weightedChange24h?: string;
|
|
688
|
-
collateralType: 'USDC' | 'USDH' | 'MIXED';
|
|
689
647
|
}
|
|
690
648
|
interface ActiveAssetsResponse {
|
|
691
649
|
active: ActiveAssetGroupItem[];
|
|
@@ -703,7 +661,7 @@ interface ActiveAssetsAllResponse {
|
|
|
703
661
|
/**
|
|
704
662
|
* Candle interval options
|
|
705
663
|
*/
|
|
706
|
-
type CandleInterval =
|
|
664
|
+
type CandleInterval = "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1M";
|
|
707
665
|
/**
|
|
708
666
|
* Candle data structure from WebSocket
|
|
709
667
|
*/
|
|
@@ -731,23 +689,12 @@ interface CandleSnapshotRequest {
|
|
|
731
689
|
endTime: number;
|
|
732
690
|
interval: CandleInterval;
|
|
733
691
|
};
|
|
734
|
-
type:
|
|
692
|
+
type: "candleSnapshot";
|
|
735
693
|
}
|
|
736
694
|
interface TokenSelectorConfig {
|
|
737
695
|
isLong: boolean;
|
|
738
696
|
index: number;
|
|
739
697
|
}
|
|
740
|
-
interface SpotBalance {
|
|
741
|
-
coin: string;
|
|
742
|
-
token: number;
|
|
743
|
-
total: string;
|
|
744
|
-
hold: string;
|
|
745
|
-
entryNtl: string;
|
|
746
|
-
}
|
|
747
|
-
interface SpotState {
|
|
748
|
-
user: string;
|
|
749
|
-
balances: SpotBalance[];
|
|
750
|
-
}
|
|
751
698
|
|
|
752
699
|
declare const useAccountSummary: () => {
|
|
753
700
|
data: AccountSummaryResponseDto | null;
|
|
@@ -758,6 +705,9 @@ declare const useTradeHistories: () => {
|
|
|
758
705
|
data: TradeHistoryDataDto[] | null;
|
|
759
706
|
isLoading: boolean;
|
|
760
707
|
};
|
|
708
|
+
/**
|
|
709
|
+
* Hook to access open orders with loading state
|
|
710
|
+
*/
|
|
761
711
|
declare const useOpenOrders: () => {
|
|
762
712
|
data: OpenLimitOrderDto[] | null;
|
|
763
713
|
isLoading: boolean;
|
|
@@ -796,26 +746,8 @@ declare const useUserSelection: () => UserSelectionState;
|
|
|
796
746
|
declare const useWebData: () => {
|
|
797
747
|
clearinghouseState: ClearinghouseState | null;
|
|
798
748
|
perpsAtOpenInterestCap: string[] | null;
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
* Each symbol maps to its market variants (keyed by prefix).
|
|
802
|
-
* For non-HIP3 assets, use "default" as the key.
|
|
803
|
-
*
|
|
804
|
-
* @example
|
|
805
|
-
* ```ts
|
|
806
|
-
* // HIP-3 asset with multiple markets
|
|
807
|
-
* marketDataBySymbol["TSLA"]["xyz"] // { asset, universe: { collateralToken: "USDC" } }
|
|
808
|
-
* marketDataBySymbol["TSLA"]["flx"] // { asset, universe: { collateralToken: "USDH" } }
|
|
809
|
-
*
|
|
810
|
-
* // Regular asset
|
|
811
|
-
* marketDataBySymbol["BTC"]["default"] // { asset, universe }
|
|
812
|
-
* ```
|
|
813
|
-
*/
|
|
814
|
-
marketDataBySymbol: MarketDataBySymbol;
|
|
815
|
-
/** Map of display name -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"]) */
|
|
816
|
-
hip3Assets: Map<string, string[]>;
|
|
817
|
-
/** Map of full market name -> prefix (e.g., "xyz:TSLA" -> "xyz") */
|
|
818
|
-
hip3MarketPrefixes: Map<string, string>;
|
|
749
|
+
marketDataBySymbol: Record<string, AssetMarketData>;
|
|
750
|
+
hip3Assets: Map<string, string>;
|
|
819
751
|
isConnected: boolean;
|
|
820
752
|
error: string | null;
|
|
821
753
|
};
|
|
@@ -949,47 +881,6 @@ interface CancelTwapResponseDto {
|
|
|
949
881
|
cancelledAt: string;
|
|
950
882
|
}
|
|
951
883
|
declare function cancelTwapOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
952
|
-
interface SpotOrderRequestInput {
|
|
953
|
-
/** Asset to buy/sell (e.g., "USDH") */
|
|
954
|
-
asset: string;
|
|
955
|
-
/** Whether to buy (true) or sell (false) the asset */
|
|
956
|
-
isBuy: boolean;
|
|
957
|
-
/** Amount of asset to buy/sell (minimum: 11) */
|
|
958
|
-
amount: number;
|
|
959
|
-
}
|
|
960
|
-
/** Filled order status from Hyperliquid */
|
|
961
|
-
interface SpotOrderFilledStatus {
|
|
962
|
-
filled: {
|
|
963
|
-
totalSz: string;
|
|
964
|
-
avgPx: string;
|
|
965
|
-
oid: number;
|
|
966
|
-
cloid: string;
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
/** Hyperliquid order response data */
|
|
970
|
-
interface SpotOrderHyperliquidData {
|
|
971
|
-
statuses: SpotOrderFilledStatus[];
|
|
972
|
-
}
|
|
973
|
-
/** Hyperliquid result from spot order execution */
|
|
974
|
-
interface SpotOrderHyperliquidResult {
|
|
975
|
-
status: 'ok' | 'error';
|
|
976
|
-
response: {
|
|
977
|
-
type: 'order';
|
|
978
|
-
data: SpotOrderHyperliquidData;
|
|
979
|
-
};
|
|
980
|
-
}
|
|
981
|
-
interface SpotOrderResponseDto {
|
|
982
|
-
orderId: string;
|
|
983
|
-
status: 'EXECUTED' | 'FAILED' | 'PENDING';
|
|
984
|
-
asset: string;
|
|
985
|
-
createdAt: string;
|
|
986
|
-
hyperliquidResult?: SpotOrderHyperliquidResult;
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* Execute a spot order (swap) using Pear Hyperliquid service
|
|
990
|
-
* POST /orders/spot
|
|
991
|
-
*/
|
|
992
|
-
declare function executeSpotOrder(baseUrl: string, payload: SpotOrderRequestInput): Promise<ApiResponse<SpotOrderResponseDto>>;
|
|
993
884
|
|
|
994
885
|
type ExecutionType = "MARKET" | "LIMIT" | "TWAP" | "LADDER" | "LIMIT_BTCDOM";
|
|
995
886
|
type TpSlThresholdType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
|
|
@@ -1048,7 +939,7 @@ interface CreatePositionResponseDto {
|
|
|
1048
939
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
1049
940
|
* @throws MaxAssetsPerLegError if any leg exceeds the maximum allowed assets (15)
|
|
1050
941
|
*/
|
|
1051
|
-
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput,
|
|
942
|
+
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
1052
943
|
interface UpdateRiskParametersRequestInput {
|
|
1053
944
|
stopLoss?: TpSlThresholdInput | null;
|
|
1054
945
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -1115,7 +1006,7 @@ interface AdjustAdvanceResponseDto {
|
|
|
1115
1006
|
status: string;
|
|
1116
1007
|
executedAt: string;
|
|
1117
1008
|
}
|
|
1118
|
-
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[],
|
|
1009
|
+
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[], displayToFull: Map<string, string>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
1119
1010
|
declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
1120
1011
|
|
|
1121
1012
|
declare function usePosition(): {
|
|
@@ -1137,18 +1028,6 @@ declare function useOrders(): {
|
|
|
1137
1028
|
readonly isLoading: boolean;
|
|
1138
1029
|
};
|
|
1139
1030
|
|
|
1140
|
-
interface UseSpotOrderResult {
|
|
1141
|
-
executeSpotOrder: (payload: SpotOrderRequestInput) => Promise<ApiResponse<SpotOrderResponseDto>>;
|
|
1142
|
-
isLoading: boolean;
|
|
1143
|
-
error: ApiErrorResponse | null;
|
|
1144
|
-
resetError: () => void;
|
|
1145
|
-
}
|
|
1146
|
-
/**
|
|
1147
|
-
* Hook for executing spot orders (swaps) on Hyperliquid
|
|
1148
|
-
* Use this to swap between USDC and USDH or other spot assets
|
|
1149
|
-
*/
|
|
1150
|
-
declare function useSpotOrder(): UseSpotOrderResult;
|
|
1151
|
-
|
|
1152
1031
|
declare function useTwap(): {
|
|
1153
1032
|
readonly orders: TwapMonitoringDto[];
|
|
1154
1033
|
readonly cancelTwap: (orderId: string) => Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
@@ -1170,16 +1049,14 @@ interface UseNotificationsResult {
|
|
|
1170
1049
|
*/
|
|
1171
1050
|
declare function useNotifications(): UseNotificationsResult;
|
|
1172
1051
|
|
|
1173
|
-
type CollateralFilter = 'USDC' | 'USDH' | 'ALL';
|
|
1174
1052
|
declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
|
|
1175
1053
|
declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
|
|
1176
|
-
declare const
|
|
1177
|
-
declare const
|
|
1178
|
-
declare const
|
|
1179
|
-
declare const
|
|
1180
|
-
declare const
|
|
1181
|
-
declare const
|
|
1182
|
-
declare const useAllBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1054
|
+
declare const useActiveBaskets: () => ActiveAssetGroupItem[];
|
|
1055
|
+
declare const useTopGainers: (limit?: number) => ActiveAssetGroupItem[];
|
|
1056
|
+
declare const useTopLosers: (limit?: number) => ActiveAssetGroupItem[];
|
|
1057
|
+
declare const useHighlightedBaskets: () => ActiveAssetGroupItem[];
|
|
1058
|
+
declare const useWatchlistBaskets: () => ActiveAssetGroupItem[];
|
|
1059
|
+
declare const useAllBaskets: () => ActiveAssetGroupItem[];
|
|
1183
1060
|
declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
|
|
1184
1061
|
|
|
1185
1062
|
declare function useWatchlist(): {
|
|
@@ -1252,13 +1129,6 @@ declare function useAuth(): {
|
|
|
1252
1129
|
readonly logout: () => Promise<void>;
|
|
1253
1130
|
};
|
|
1254
1131
|
|
|
1255
|
-
interface SpotBalances {
|
|
1256
|
-
usdhBalance: number | undefined;
|
|
1257
|
-
spotUsdcBalance: number | undefined;
|
|
1258
|
-
isLoading: boolean;
|
|
1259
|
-
}
|
|
1260
|
-
declare const useSpotBalances: () => SpotBalances;
|
|
1261
|
-
|
|
1262
1132
|
interface UseHyperliquidWebSocketProps {
|
|
1263
1133
|
wsUrl: string;
|
|
1264
1134
|
address: string | null;
|
|
@@ -1293,7 +1163,7 @@ declare function markNotificationReadById(baseUrl: string, id: string): Promise<
|
|
|
1293
1163
|
updated: number;
|
|
1294
1164
|
}>>;
|
|
1295
1165
|
|
|
1296
|
-
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[],
|
|
1166
|
+
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
1297
1167
|
|
|
1298
1168
|
/**
|
|
1299
1169
|
* Account summary calculation utility class
|
|
@@ -1332,28 +1202,24 @@ declare class ConflictDetector {
|
|
|
1332
1202
|
declare class TokenMetadataExtractor {
|
|
1333
1203
|
/**
|
|
1334
1204
|
* Extracts comprehensive token metadata
|
|
1335
|
-
* @param symbol - Token symbol
|
|
1205
|
+
* @param symbol - Token symbol
|
|
1336
1206
|
* @param perpMetaAssets - Aggregated universe assets (flattened across dexes)
|
|
1337
1207
|
* @param finalAssetContexts - Aggregated asset contexts (flattened across dexes)
|
|
1338
1208
|
* @param allMids - AllMids data containing current prices
|
|
1339
1209
|
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1340
|
-
* @param marketPrefix - Optional market prefix (e.g., "xyz", "flx") for HIP3 multi-market assets
|
|
1341
1210
|
* @returns TokenMetadata or null if token not found
|
|
1342
1211
|
*/
|
|
1343
|
-
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null
|
|
1212
|
+
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): TokenMetadata | null;
|
|
1344
1213
|
/**
|
|
1345
1214
|
* Extracts metadata for multiple tokens
|
|
1346
|
-
* @param
|
|
1215
|
+
* @param symbols - Array of token symbols
|
|
1347
1216
|
* @param perpMetaAssets - Aggregated universe assets
|
|
1348
1217
|
* @param finalAssetContexts - Aggregated asset contexts
|
|
1349
1218
|
* @param allMids - AllMids data
|
|
1350
1219
|
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1351
|
-
* @returns Record of
|
|
1220
|
+
* @returns Record of symbol to TokenMetadata
|
|
1352
1221
|
*/
|
|
1353
|
-
static extractMultipleTokensMetadata(
|
|
1354
|
-
symbol: string;
|
|
1355
|
-
marketPrefix?: string | null;
|
|
1356
|
-
}>, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
|
|
1222
|
+
static extractMultipleTokensMetadata(symbols: string[], perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
|
|
1357
1223
|
/**
|
|
1358
1224
|
* Checks if token data is available in aggregated universe assets
|
|
1359
1225
|
* @param symbol - Token symbol
|
|
@@ -1457,48 +1323,7 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
|
|
|
1457
1323
|
minimumRequired?: number;
|
|
1458
1324
|
};
|
|
1459
1325
|
|
|
1460
|
-
/**
|
|
1461
|
-
* Convert a full/prefixed symbol (e.g., "xyz:XYZ100") to a display symbol (e.g., "XYZ100").
|
|
1462
|
-
*/
|
|
1463
|
-
declare function toDisplaySymbol(symbol: string): string;
|
|
1464
|
-
/**
|
|
1465
|
-
* Convert a display symbol back to backend form using a provided map.
|
|
1466
|
-
* If mapping is missing, returns the original symbol.
|
|
1467
|
-
* For multi-market assets, returns the first available market.
|
|
1468
|
-
* @param displaySymbol e.g., "TSLA"
|
|
1469
|
-
* @param hip3Assets map of display -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"])
|
|
1470
|
-
*/
|
|
1471
|
-
declare function toBackendSymbol(displaySymbol: string, hip3Assets: Map<string, string[]>): string;
|
|
1472
|
-
/**
|
|
1473
|
-
* Convert a display symbol to backend form for a specific market prefix.
|
|
1474
|
-
* This is useful when an asset is available on multiple markets (e.g., xyz:TSLA and flx:TSLA).
|
|
1475
|
-
* @param displaySymbol e.g., "TSLA"
|
|
1476
|
-
* @param marketPrefix e.g., "xyz" or "flx"
|
|
1477
|
-
* @param hip3Assets map of display -> all full market names
|
|
1478
|
-
* @returns Full market name if found, null if prefix not specified for multi-market asset, otherwise displaySymbol with prefix
|
|
1479
|
-
*/
|
|
1480
|
-
declare function toBackendSymbolWithMarket(displaySymbol: string, marketPrefix: string | undefined, hip3Assets: Map<string, string[]>): string | null;
|
|
1481
|
-
/**
|
|
1482
|
-
* Get all available markets for a display symbol.
|
|
1483
|
-
* @param displaySymbol e.g., "TSLA"
|
|
1484
|
-
* @param hip3Assets map of display -> all full market names
|
|
1485
|
-
* @returns Array of full market names, e.g., ["xyz:TSLA", "flx:TSLA"]
|
|
1486
|
-
*/
|
|
1487
|
-
declare function getAvailableMarkets(displaySymbol: string, hip3Assets: Map<string, string[]>): string[];
|
|
1488
|
-
/**
|
|
1489
|
-
* Extract the market prefix from a full market name.
|
|
1490
|
-
* @param fullSymbol e.g., "xyz:TSLA"
|
|
1491
|
-
* @returns The prefix (e.g., "xyz") or undefined if no prefix
|
|
1492
|
-
*/
|
|
1493
|
-
declare function getMarketPrefix(fullSymbol: string): string | undefined;
|
|
1494
|
-
/**
|
|
1495
|
-
* Check if a symbol is a HIP-3 market (has a prefix).
|
|
1496
|
-
* @param symbol e.g., "xyz:TSLA" or "TSLA"
|
|
1497
|
-
* @returns true if the symbol has a market prefix
|
|
1498
|
-
*/
|
|
1499
|
-
declare function isHip3Market(symbol: string): boolean;
|
|
1500
|
-
|
|
1501
1326
|
declare const useMarketData: any;
|
|
1502
1327
|
|
|
1503
|
-
export { AccountSummaryCalculator, ConflictDetector, MAX_ASSETS_PER_LEG, MINIMUM_ASSET_USD_VALUE, MaxAssetsPerLegError, MinimumPositionSizeError, PearHyperliquidProvider, TokenMetadataExtractor, adjustAdvancePosition, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition,
|
|
1504
|
-
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, AutoSyncFillsOptions, AutoSyncFillsState, BalanceSummaryDto, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto,
|
|
1328
|
+
export { AccountSummaryCalculator, ConflictDetector, MAX_ASSETS_PER_LEG, MINIMUM_ASSET_USD_VALUE, MaxAssetsPerLegError, MinimumPositionSizeError, PearHyperliquidProvider, TokenMetadataExtractor, adjustAdvancePosition, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, getPortfolio, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toggleWatchlist, updateRiskParameters, useAccountSummary, useActiveBaskets, useAgentWallet, useAllBaskets, useAuth, useAutoSyncFills, useBasketCandles, useFindBasket, useHighlightedBaskets, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useMarketData, useMarketDataAllPayload, useMarketDataPayload, useNotifications, useOpenOrders, useOrders, usePearHyperliquid, usePerformanceOverlays, usePortfolio, usePosition, useTokenSelectionMetadata, useTopGainers, useTopLosers, useTradeHistories, useTwap, useUserSelection, useWatchlist, useWatchlistBaskets, useWebData, validateMaxAssetsPerLeg, validateMinimumAssetSize, validatePositionSize };
|
|
1329
|
+
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, AutoSyncFillsOptions, AutoSyncFillsState, BalanceSummaryDto, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto, CreatePositionRequestInput, CreatePositionResponseDto, CrossMarginSummaryDto, CumFundingDto, ExecutionType, ExtraAgent, HLWebSocketResponse, HistoricalRange, LadderConfigInput, MarginSummaryDto, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderStatus, PairAssetDto, PairAssetInput, PerformanceOverlay, PlatformAccountSummaryResponseDto, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PositionAssetSummaryDto, PositionResponseStatus, RealtimeBar, RealtimeBarsCallback, ToggleWatchlistResponseDto, TokenConflict, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TpSlThresholdInput, TpSlThresholdType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TwapChunkStatusDto, TwapMonitoringDto, TwapSliceFillResponseItem, UniverseAsset, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistItemDto, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|