@pear-protocol/hyperliquid-sdk 0.0.72 → 0.0.73

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.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
+ import * as zustand from 'zustand';
2
3
 
3
4
  interface PearHyperliquidContextType {
4
5
  clientId: string;
@@ -47,7 +48,7 @@ interface ExternalFillDto {
47
48
  coin: string;
48
49
  px: string;
49
50
  sz: string;
50
- side: "B" | "A";
51
+ side: 'B' | 'A';
51
52
  time: number;
52
53
  dir: string;
53
54
  fee: string;
@@ -74,16 +75,16 @@ interface TwapSliceFillResponseItem {
74
75
  /**
75
76
  * WebSocket connection states
76
77
  */
77
- type WebSocketConnectionState = "connecting" | "connected" | "disconnected" | "error";
78
+ type WebSocketConnectionState = 'connecting' | 'connected' | 'disconnected' | 'error';
78
79
  /**
79
80
  * WebSocket channels
80
81
  */
81
- type WebSocketChannel = "trade-histories" | "open-positions" | "open-orders" | "account-summary" | "twap-details" | "notifications" | "market-data" | "market-data-all" | "webData3" | "allMids" | "activeAssetData";
82
+ type WebSocketChannel = 'trade-histories' | 'open-positions' | 'open-orders' | 'account-summary' | 'twap-details' | 'notifications' | 'market-data' | 'market-data-all' | 'webData3' | 'allMids' | 'activeAssetData';
82
83
  /**
83
84
  * WebSocket subscription message
84
85
  */
85
86
  interface WebSocketSubscribeMessage {
86
- action?: "subscribe" | "unsubscribe";
87
+ action?: 'subscribe' | 'unsubscribe';
87
88
  address: string;
88
89
  }
89
90
  /**
@@ -113,7 +114,7 @@ interface WatchlistItemDto {
113
114
  interface ToggleWatchlistResponseDto {
114
115
  items: WatchlistItemDto[];
115
116
  }
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
+ 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
118
  interface NotificationDto {
118
119
  id: string;
119
120
  address: string;
@@ -130,7 +131,7 @@ interface ChunkFillDto {
130
131
  size: number;
131
132
  executedAt: string;
132
133
  }
133
- type TwapChunkStatus = "PENDING" | "SCHEDULED" | "EXECUTING" | "COMPLETED" | "FAILED" | "CANCELLED";
134
+ type TwapChunkStatus = 'PENDING' | 'SCHEDULED' | 'EXECUTING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
134
135
  interface TwapChunkStatusDto {
135
136
  chunkId: string;
136
137
  chunkIndex: number;
@@ -141,7 +142,7 @@ interface TwapChunkStatusDto {
141
142
  fills: ChunkFillDto[];
142
143
  errorMessage?: string;
143
144
  }
144
- type TwapOrderOverallStatus = "OPEN" | "EXECUTING" | "COMPLETED" | "PARTIALLY_COMPLETED" | "FAILED" | "CANCELLED";
145
+ type TwapOrderOverallStatus = 'OPEN' | 'EXECUTING' | 'COMPLETED' | 'PARTIALLY_COMPLETED' | 'FAILED' | 'CANCELLED';
145
146
  interface TwapMonitoringDto {
146
147
  orderId: string;
147
148
  positionId?: string;
@@ -178,6 +179,8 @@ interface TradeHistoryAssetDataDto {
178
179
  externalFeePaid: number;
179
180
  builderFeePaid: number;
180
181
  realizedPnl: number;
182
+ marketPrefix?: string | null;
183
+ collateralToken?: CollateralToken;
181
184
  }
182
185
  /**
183
186
  * Trade history data structure
@@ -226,9 +229,11 @@ interface PositionAssetDetailDto {
226
229
  liquidationPrice: number;
227
230
  initialWeight: number;
228
231
  fundingPaid?: number;
232
+ marketPrefix?: string | null;
233
+ collateralToken?: CollateralToken;
229
234
  }
230
235
  interface TpSlThreshold {
231
- type: "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
236
+ type: 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
232
237
  value: number;
233
238
  }
234
239
  /**
@@ -259,20 +264,22 @@ interface OpenPositionDto {
259
264
  interface OrderAssetDto {
260
265
  asset: string;
261
266
  weight: number;
267
+ marketPrefix?: string | null;
268
+ collateralToken?: CollateralToken;
262
269
  }
263
270
  /**
264
271
  * Order status
265
272
  */
266
- type OrderStatus = "OPEN" | "PARTIALLY_FILLED" | "PROCESSING";
273
+ type OrderStatus = 'OPEN' | 'PARTIALLY_FILLED' | 'PROCESSING';
267
274
  /**
268
275
  * Order type
269
276
  */
270
- type OrderType = "TP" | "SL" | "LIMIT" | "MARKET" | "LIMIT_BTCDOM" | "TWAP";
277
+ type OrderType = 'TP' | 'SL' | 'LIMIT' | 'MARKET' | 'LIMIT_BTCDOM' | 'TWAP';
271
278
  /**
272
279
  * TP/SL trigger type
273
280
  */
274
- type TpSlTriggerType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
275
- type OrderDirection = "MORE_THAN" | "LESS_THAN" | null;
281
+ type TpSlTriggerType = 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
282
+ type OrderDirection = 'MORE_THAN' | 'LESS_THAN' | null;
276
283
  /**
277
284
  * Open limit order data structure
278
285
  */
@@ -378,7 +385,7 @@ interface RefreshTokenResponse {
378
385
  tokenType: string;
379
386
  expiresIn: number;
380
387
  }
381
- type AgentWalletStatus = "ACTIVE" | "EXPIRED" | "NOT_FOUND";
388
+ type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
382
389
  interface CreateAgentWalletResponseDto {
383
390
  agentWalletAddress: string;
384
391
  message: string;
@@ -391,14 +398,14 @@ interface ExtraAgent {
391
398
  interface AgentWalletState {
392
399
  address: string | null;
393
400
  name: string | null;
394
- status: AgentWalletStatus | "PENDING" | null;
401
+ status: AgentWalletStatus | 'PENDING' | null;
395
402
  isActive: boolean;
396
403
  }
397
404
  /**
398
405
  * WebSocket message from HyperLiquid native API
399
406
  */
400
407
  interface WebSocketMessage {
401
- method: "subscribe" | "unsubscribe";
408
+ method: 'subscribe' | 'unsubscribe';
402
409
  subscription: {
403
410
  type: string;
404
411
  dex?: string;
@@ -411,12 +418,16 @@ interface WebSocketMessage {
411
418
  /**
412
419
  * WebSocket response from HyperLiquid native API
413
420
  */
414
- type HLChannel = "webData3" | "allMids" | "activeAssetData" | "candle" | "allDexsClearinghouseState" | "allDexsAssetCtxs";
421
+ type HLChannel = 'webData3' | 'allMids' | 'activeAssetData' | 'candle' | 'spotState' | 'allDexsClearinghouseState' | 'allDexsAssetCtxs';
415
422
  interface HLChannelDataMap {
416
423
  webData3: WebData3Response;
417
424
  allMids: WsAllMidsData;
418
425
  activeAssetData: ActiveAssetData;
419
426
  candle: CandleData;
427
+ spotState: {
428
+ user: string;
429
+ spotState: SpotState;
430
+ };
420
431
  allDexsClearinghouseState: AllDexsClearinghouseStateData;
421
432
  allDexsAssetCtxs: AllDexsAssetCtxsData;
422
433
  }
@@ -481,6 +492,12 @@ interface AssetCtx {
481
492
  impactPxs?: string[];
482
493
  oraclePx: string;
483
494
  }
495
+ /**
496
+ * Collateral token type
497
+ * 0 = USDC
498
+ * 360 = USDH
499
+ */
500
+ type CollateralToken = 'USDC' | 'USDH';
484
501
  /**
485
502
  * Universe asset metadata
486
503
  */
@@ -490,6 +507,8 @@ interface UniverseAsset {
490
507
  maxLeverage: number;
491
508
  onlyIsolated?: boolean;
492
509
  isDelisted?: boolean;
510
+ marketPrefix?: string;
511
+ collateralToken?: CollateralToken;
493
512
  }
494
513
  interface ClearinghouseState {
495
514
  assetPositions: AssetPosition[];
@@ -560,6 +579,8 @@ interface RawAssetDto {
560
579
  size: number;
561
580
  side: string;
562
581
  fundingPaid?: number;
582
+ marketPrefix?: string | null;
583
+ collateralToken?: CollateralToken;
563
584
  leverage: number;
564
585
  }
565
586
  /**
@@ -608,6 +629,7 @@ interface TokenMetadata {
608
629
  leverage?: LeverageInfo;
609
630
  maxTradeSzs?: [string, string];
610
631
  availableToTrade?: [string, string];
632
+ collateralToken?: CollateralToken;
611
633
  }
612
634
  /**
613
635
  * Enhanced token selection with weight and metadata for basket trading
@@ -621,16 +643,37 @@ interface TokenSelection {
621
643
  */
622
644
  interface TokenConflict {
623
645
  symbol: string;
624
- conflictType: "long" | "short";
646
+ conflictType: 'long' | 'short';
625
647
  conflictMessage: string;
626
648
  }
627
649
  interface AssetMarketData {
628
650
  asset: WebData3AssetCtx | AssetCtx;
629
651
  universe: UniverseAsset;
630
652
  }
653
+ /**
654
+ * Nested market data structure for multi-market assets.
655
+ * Each symbol maps to its market variants (keyed by prefix).
656
+ * For non-HIP3 assets, use "default" as the key.
657
+ *
658
+ * @example
659
+ * ```ts
660
+ * {
661
+ * "TSLA": {
662
+ * "xyz": { asset: {...}, universe: { collateralToken: "USDC", ... } },
663
+ * "flx": { asset: {...}, universe: { collateralToken: "USDH", ... } }
664
+ * },
665
+ * "BTC": {
666
+ * "default": { asset: {...}, universe: {...} }
667
+ * }
668
+ * }
669
+ * ```
670
+ */
671
+ type MarketDataBySymbol = Record<string, Record<string, AssetMarketData>>;
631
672
  interface PairAssetDto {
632
673
  asset: string;
633
674
  weight: number;
675
+ collateralToken: CollateralToken;
676
+ marketPrefix: string | null;
634
677
  }
635
678
  interface ActiveAssetGroupItem {
636
679
  longAssets: PairAssetDto[];
@@ -644,6 +687,7 @@ interface ActiveAssetGroupItem {
644
687
  weightedRatio?: string;
645
688
  weightedPrevRatio?: string;
646
689
  weightedChange24h?: string;
690
+ collateralType: 'USDC' | 'USDH' | 'MIXED';
647
691
  }
648
692
  interface ActiveAssetsResponse {
649
693
  active: ActiveAssetGroupItem[];
@@ -661,7 +705,7 @@ interface ActiveAssetsAllResponse {
661
705
  /**
662
706
  * Candle interval options
663
707
  */
664
- type CandleInterval = "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1M";
708
+ type CandleInterval = '1m' | '3m' | '5m' | '15m' | '30m' | '1h' | '2h' | '4h' | '8h' | '12h' | '1d' | '3d' | '1w' | '1M';
665
709
  /**
666
710
  * Candle data structure from WebSocket
667
711
  */
@@ -689,12 +733,23 @@ interface CandleSnapshotRequest {
689
733
  endTime: number;
690
734
  interval: CandleInterval;
691
735
  };
692
- type: "candleSnapshot";
736
+ type: 'candleSnapshot';
693
737
  }
694
738
  interface TokenSelectorConfig {
695
739
  isLong: boolean;
696
740
  index: number;
697
741
  }
742
+ interface SpotBalance {
743
+ coin: string;
744
+ token: number;
745
+ total: string;
746
+ hold: string;
747
+ entryNtl: string;
748
+ }
749
+ interface SpotState {
750
+ user: string;
751
+ balances: SpotBalance[];
752
+ }
698
753
 
699
754
  declare const useAccountSummary: () => {
700
755
  data: AccountSummaryResponseDto | null;
@@ -705,9 +760,6 @@ declare const useTradeHistories: () => {
705
760
  data: TradeHistoryDataDto[] | null;
706
761
  isLoading: boolean;
707
762
  };
708
- /**
709
- * Hook to access open orders with loading state
710
- */
711
763
  declare const useOpenOrders: () => {
712
764
  data: OpenLimitOrderDto[] | null;
713
765
  isLoading: boolean;
@@ -746,8 +798,26 @@ declare const useUserSelection: () => UserSelectionState;
746
798
  declare const useWebData: () => {
747
799
  clearinghouseState: ClearinghouseState | null;
748
800
  perpsAtOpenInterestCap: string[] | null;
749
- marketDataBySymbol: Record<string, AssetMarketData>;
750
- hip3Assets: Map<string, string>;
801
+ /**
802
+ * Market data keyed by symbol, with nested market variants.
803
+ * Each symbol maps to its market variants (keyed by prefix).
804
+ * For non-HIP3 assets, use "default" as the key.
805
+ *
806
+ * @example
807
+ * ```ts
808
+ * // HIP-3 asset with multiple markets
809
+ * marketDataBySymbol["TSLA"]["xyz"] // { asset, universe: { collateralToken: "USDC" } }
810
+ * marketDataBySymbol["TSLA"]["flx"] // { asset, universe: { collateralToken: "USDH" } }
811
+ *
812
+ * // Regular asset
813
+ * marketDataBySymbol["BTC"]["default"] // { asset, universe }
814
+ * ```
815
+ */
816
+ marketDataBySymbol: MarketDataBySymbol;
817
+ /** Map of display name -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"]) */
818
+ hip3Assets: Map<string, string[]>;
819
+ /** Map of full market name -> prefix (e.g., "xyz:TSLA" -> "xyz") */
820
+ hip3MarketPrefixes: Map<string, string>;
751
821
  isConnected: boolean;
752
822
  error: string | null;
753
823
  };
@@ -781,7 +851,18 @@ interface TokenHistoricalPriceData {
781
851
  oldestTime: number | null;
782
852
  latestTime: number | null;
783
853
  }
784
- declare const useHistoricalPriceDataStore: any;
854
+ interface HistoricalPriceDataState {
855
+ historicalPriceData: Record<string, TokenHistoricalPriceData>;
856
+ loadingTokens: Set<string>;
857
+ addHistoricalPriceData: (symbol: string, interval: CandleInterval, candles: CandleData[], range: HistoricalRange) => void;
858
+ hasHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => boolean;
859
+ getHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => CandleData[];
860
+ setTokenLoading: (symbol: string, loading: boolean) => void;
861
+ isTokenLoading: (symbol: string) => boolean;
862
+ removeTokenPriceData: (symbol: string, interval: CandleInterval) => void;
863
+ clearData: () => void;
864
+ }
865
+ declare const useHistoricalPriceDataStore: zustand.UseBoundStore<zustand.StoreApi<HistoricalPriceDataState>>;
785
866
 
786
867
  interface UseHistoricalPriceDataReturn {
787
868
  fetchHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval, callback?: (data: Record<string, CandleData[]>) => void) => Promise<Record<string, CandleData[]>>;
@@ -881,6 +962,47 @@ interface CancelTwapResponseDto {
881
962
  cancelledAt: string;
882
963
  }
883
964
  declare function cancelTwapOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
965
+ interface SpotOrderRequestInput {
966
+ /** Asset to buy/sell (e.g., "USDH") */
967
+ asset: string;
968
+ /** Whether to buy (true) or sell (false) the asset */
969
+ isBuy: boolean;
970
+ /** Amount of asset to buy/sell (minimum: 11) */
971
+ amount: number;
972
+ }
973
+ /** Filled order status from Hyperliquid */
974
+ interface SpotOrderFilledStatus {
975
+ filled: {
976
+ totalSz: string;
977
+ avgPx: string;
978
+ oid: number;
979
+ cloid: string;
980
+ };
981
+ }
982
+ /** Hyperliquid order response data */
983
+ interface SpotOrderHyperliquidData {
984
+ statuses: SpotOrderFilledStatus[];
985
+ }
986
+ /** Hyperliquid result from spot order execution */
987
+ interface SpotOrderHyperliquidResult {
988
+ status: 'ok' | 'error';
989
+ response: {
990
+ type: 'order';
991
+ data: SpotOrderHyperliquidData;
992
+ };
993
+ }
994
+ interface SpotOrderResponseDto {
995
+ orderId: string;
996
+ status: 'EXECUTED' | 'FAILED' | 'PENDING';
997
+ asset: string;
998
+ createdAt: string;
999
+ hyperliquidResult?: SpotOrderHyperliquidResult;
1000
+ }
1001
+ /**
1002
+ * Execute a spot order (swap) using Pear Hyperliquid service
1003
+ * POST /orders/spot
1004
+ */
1005
+ declare function executeSpotOrder(baseUrl: string, payload: SpotOrderRequestInput): Promise<ApiResponse<SpotOrderResponseDto>>;
884
1006
 
885
1007
  type ExecutionType = "MARKET" | "LIMIT" | "TWAP" | "LADDER" | "LIMIT_BTCDOM";
886
1008
  type TpSlThresholdType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
@@ -939,7 +1061,7 @@ interface CreatePositionResponseDto {
939
1061
  * @throws MinimumPositionSizeError if any asset has less than $11 USD value
940
1062
  * @throws MaxAssetsPerLegError if any leg exceeds the maximum allowed assets (15)
941
1063
  */
942
- declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
1064
+ declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, hip3Assets: Map<string, string[]>): Promise<ApiResponse<CreatePositionResponseDto>>;
943
1065
  interface UpdateRiskParametersRequestInput {
944
1066
  stopLoss?: TpSlThresholdInput | null;
945
1067
  takeProfit?: TpSlThresholdInput | null;
@@ -1006,7 +1128,7 @@ interface AdjustAdvanceResponseDto {
1006
1128
  status: string;
1007
1129
  executedAt: string;
1008
1130
  }
1009
- declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[], displayToFull: Map<string, string>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
1131
+ declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
1010
1132
  declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
1011
1133
  interface UpdateLeverageRequestInput {
1012
1134
  leverage: number;
@@ -1036,6 +1158,18 @@ declare function useOrders(): {
1036
1158
  readonly isLoading: boolean;
1037
1159
  };
1038
1160
 
1161
+ interface UseSpotOrderResult {
1162
+ executeSpotOrder: (payload: SpotOrderRequestInput) => Promise<ApiResponse<SpotOrderResponseDto>>;
1163
+ isLoading: boolean;
1164
+ error: ApiErrorResponse | null;
1165
+ resetError: () => void;
1166
+ }
1167
+ /**
1168
+ * Hook for executing spot orders (swaps) on Hyperliquid
1169
+ * Use this to swap between USDC and USDH or other spot assets
1170
+ */
1171
+ declare function useSpotOrder(): UseSpotOrderResult;
1172
+
1039
1173
  declare function useTwap(): {
1040
1174
  readonly orders: TwapMonitoringDto[];
1041
1175
  readonly cancelTwap: (orderId: string) => Promise<ApiResponse<CancelTwapResponseDto>>;
@@ -1057,14 +1191,16 @@ interface UseNotificationsResult {
1057
1191
  */
1058
1192
  declare function useNotifications(): UseNotificationsResult;
1059
1193
 
1194
+ type CollateralFilter = 'USDC' | 'USDH' | 'ALL';
1060
1195
  declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
1061
1196
  declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
1062
- declare const useActiveBaskets: () => ActiveAssetGroupItem[];
1063
- declare const useTopGainers: (limit?: number) => ActiveAssetGroupItem[];
1064
- declare const useTopLosers: (limit?: number) => ActiveAssetGroupItem[];
1065
- declare const useHighlightedBaskets: () => ActiveAssetGroupItem[];
1066
- declare const useWatchlistBaskets: () => ActiveAssetGroupItem[];
1067
- declare const useAllBaskets: () => ActiveAssetGroupItem[];
1197
+ declare const usePerpMetaAssets: () => UniverseAsset[] | null;
1198
+ declare const useActiveBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
1199
+ declare const useTopGainers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
1200
+ declare const useTopLosers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
1201
+ declare const useHighlightedBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
1202
+ declare const useWatchlistBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
1203
+ declare const useAllBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
1068
1204
  declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
1069
1205
 
1070
1206
  declare function useWatchlist(): {
@@ -1127,9 +1263,9 @@ declare function usePortfolio(): UsePortfolioResult;
1127
1263
 
1128
1264
  declare function useAuth(): {
1129
1265
  readonly isReady: boolean;
1130
- readonly isAuthenticated: any;
1131
- readonly accessToken: any;
1132
- readonly refreshToken: any;
1266
+ readonly isAuthenticated: boolean;
1267
+ readonly accessToken: string | null;
1268
+ readonly refreshToken: string | null;
1133
1269
  readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
1134
1270
  readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
1135
1271
  readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
@@ -1137,6 +1273,15 @@ declare function useAuth(): {
1137
1273
  readonly logout: () => Promise<void>;
1138
1274
  };
1139
1275
 
1276
+ interface AllUserBalances {
1277
+ spotUsdcBalance: number | undefined;
1278
+ availableToTradeUsdc: number | undefined;
1279
+ spotUsdhBalance: number | undefined;
1280
+ availableToTradeUsdh: number | undefined;
1281
+ isLoading: boolean;
1282
+ }
1283
+ declare const useAllUserBalances: () => AllUserBalances;
1284
+
1140
1285
  interface UseHyperliquidWebSocketProps {
1141
1286
  wsUrl: string;
1142
1287
  address: string | null;
@@ -1171,7 +1316,7 @@ declare function markNotificationReadById(baseUrl: string, id: string): Promise<
1171
1316
  updated: number;
1172
1317
  }>>;
1173
1318
 
1174
- declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
1319
+ declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
1175
1320
 
1176
1321
  /**
1177
1322
  * Account summary calculation utility class
@@ -1210,24 +1355,28 @@ declare class ConflictDetector {
1210
1355
  declare class TokenMetadataExtractor {
1211
1356
  /**
1212
1357
  * Extracts comprehensive token metadata
1213
- * @param symbol - Token symbol
1358
+ * @param symbol - Token symbol (base symbol without prefix, e.g., "TSLA")
1214
1359
  * @param perpMetaAssets - Aggregated universe assets (flattened across dexes)
1215
1360
  * @param finalAssetContexts - Aggregated asset contexts (flattened across dexes)
1216
1361
  * @param allMids - AllMids data containing current prices
1217
1362
  * @param activeAssetData - Optional active asset data containing leverage information
1363
+ * @param marketPrefix - Optional market prefix (e.g., "xyz", "flx") for HIP3 multi-market assets
1218
1364
  * @returns TokenMetadata or null if token not found
1219
1365
  */
1220
- static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): TokenMetadata | null;
1366
+ static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null, marketPrefix?: string | null): TokenMetadata | null;
1221
1367
  /**
1222
1368
  * Extracts metadata for multiple tokens
1223
- * @param symbols - Array of token symbols
1369
+ * @param tokens - Array of token objects with symbol and optional marketPrefix
1224
1370
  * @param perpMetaAssets - Aggregated universe assets
1225
1371
  * @param finalAssetContexts - Aggregated asset contexts
1226
1372
  * @param allMids - AllMids data
1227
1373
  * @param activeAssetData - Optional active asset data containing leverage information
1228
- * @returns Record of symbol to TokenMetadata
1374
+ * @returns Record of unique key to TokenMetadata. Key is "{prefix}:{symbol}" for HIP3 assets, or just "{symbol}" otherwise
1229
1375
  */
1230
- static extractMultipleTokensMetadata(symbols: string[], perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
1376
+ static extractMultipleTokensMetadata(tokens: Array<{
1377
+ symbol: string;
1378
+ marketPrefix?: string | null;
1379
+ }>, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
1231
1380
  /**
1232
1381
  * Checks if token data is available in aggregated universe assets
1233
1382
  * @param symbol - Token symbol
@@ -1331,7 +1480,55 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
1331
1480
  minimumRequired?: number;
1332
1481
  };
1333
1482
 
1334
- declare const useMarketData: any;
1483
+ /**
1484
+ * Convert a full/prefixed symbol (e.g., "xyz:XYZ100") to a display symbol (e.g., "XYZ100").
1485
+ */
1486
+ declare function toDisplaySymbol(symbol: string): string;
1487
+ /**
1488
+ * Convert a display symbol back to backend form using a provided map.
1489
+ * If mapping is missing, returns the original symbol.
1490
+ * For multi-market assets, returns the first available market.
1491
+ * @param displaySymbol e.g., "TSLA"
1492
+ * @param hip3Assets map of display -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"])
1493
+ */
1494
+ declare function toBackendSymbol(displaySymbol: string, hip3Assets: Map<string, string[]>): string;
1495
+ /**
1496
+ * Convert a display symbol to backend form for a specific market prefix.
1497
+ * This is useful when an asset is available on multiple markets (e.g., xyz:TSLA and flx:TSLA).
1498
+ * @param displaySymbol e.g., "TSLA"
1499
+ * @param marketPrefix e.g., "xyz" or "flx"
1500
+ * @param hip3Assets map of display -> all full market names
1501
+ * @returns Full market name if found, null if prefix not specified for multi-market asset, otherwise displaySymbol with prefix
1502
+ */
1503
+ declare function toBackendSymbolWithMarket(displaySymbol: string, marketPrefix: string | undefined, hip3Assets: Map<string, string[]>): string | null;
1504
+ /**
1505
+ * Get all available markets for a display symbol.
1506
+ * @param displaySymbol e.g., "TSLA"
1507
+ * @param hip3Assets map of display -> all full market names
1508
+ * @returns Array of full market names, e.g., ["xyz:TSLA", "flx:TSLA"]
1509
+ */
1510
+ declare function getAvailableMarkets(displaySymbol: string, hip3Assets: Map<string, string[]>): string[];
1511
+ /**
1512
+ * Extract the market prefix from a full market name.
1513
+ * @param fullSymbol e.g., "xyz:TSLA"
1514
+ * @returns The prefix (e.g., "xyz") or undefined if no prefix
1515
+ */
1516
+ declare function getMarketPrefix(fullSymbol: string): string | undefined;
1517
+ /**
1518
+ * Check if a symbol is a HIP-3 market (has a prefix).
1519
+ * @param symbol e.g., "xyz:TSLA" or "TSLA"
1520
+ * @returns true if the symbol has a market prefix
1521
+ */
1522
+ declare function isHip3Market(symbol: string): boolean;
1523
+
1524
+ interface MarketDataState {
1525
+ marketData: ActiveAssetsResponse | null;
1526
+ marketDataAll: ActiveAssetsAllResponse | null;
1527
+ setMarketData: (value: ActiveAssetsResponse | null) => void;
1528
+ setMarketDataAll: (value: ActiveAssetsAllResponse | null) => void;
1529
+ clean: () => void;
1530
+ }
1531
+ declare const useMarketData: zustand.UseBoundStore<zustand.StoreApi<MarketDataState>>;
1335
1532
 
1336
- 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, updateLeverage, 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 };
1337
- 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, UpdateLeverageRequestInput, UpdateLeverageResponseDto, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistItemDto, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
1533
+ 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, executeSpotOrder, getAvailableMarkets, getCompleteTimestamps, getMarketPrefix, getPortfolio, isHip3Market, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toBackendSymbol, toBackendSymbolWithMarket, toDisplaySymbol, toggleWatchlist, updateLeverage, updateRiskParameters, useAccountSummary, useActiveBaskets, useAgentWallet, useAllBaskets, useAllUserBalances, useAuth, useAutoSyncFills, useBasketCandles, useFindBasket, useHighlightedBaskets, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useMarketData, useMarketDataAllPayload, useMarketDataPayload, useNotifications, useOpenOrders, useOrders, usePearHyperliquid, usePerformanceOverlays, usePerpMetaAssets, usePortfolio, usePosition, useSpotOrder, useTokenSelectionMetadata, useTopGainers, useTopLosers, useTradeHistories, useTwap, useUserSelection, useWatchlist, useWatchlistBaskets, useWebData, validateMaxAssetsPerLeg, validateMinimumAssetSize, validatePositionSize };
1534
+ 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, CollateralFilter, CollateralToken, CreatePositionRequestInput, CreatePositionResponseDto, CrossMarginSummaryDto, CumFundingDto, ExecutionType, ExtraAgent, HLWebSocketResponse, HistoricalRange, LadderConfigInput, MarginSummaryDto, MarketDataBySymbol, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderStatus, PairAssetDto, PairAssetInput, PerformanceOverlay, PlatformAccountSummaryResponseDto, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PositionAssetSummaryDto, PositionResponseStatus, RealtimeBar, RealtimeBarsCallback, SpotBalance, SpotOrderFilledStatus, SpotOrderHyperliquidData, SpotOrderHyperliquidResult, SpotOrderRequestInput, SpotOrderResponseDto, SpotState, ToggleWatchlistResponseDto, TokenConflict, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TpSlThresholdInput, TpSlThresholdType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TwapChunkStatusDto, TwapMonitoringDto, TwapSliceFillResponseItem, UniverseAsset, UpdateLeverageRequestInput, UpdateLeverageResponseDto, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseSpotOrderResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistItemDto, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };