@pear-protocol/hyperliquid-sdk 0.0.73-beta.2 → 0.0.73-beta.4

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
@@ -48,7 +48,7 @@ interface ExternalFillDto {
48
48
  coin: string;
49
49
  px: string;
50
50
  sz: string;
51
- side: "B" | "A";
51
+ side: 'B' | 'A';
52
52
  time: number;
53
53
  dir: string;
54
54
  fee: string;
@@ -75,16 +75,16 @@ interface TwapSliceFillResponseItem {
75
75
  /**
76
76
  * WebSocket connection states
77
77
  */
78
- type WebSocketConnectionState = "connecting" | "connected" | "disconnected" | "error";
78
+ type WebSocketConnectionState = 'connecting' | 'connected' | 'disconnected' | 'error';
79
79
  /**
80
80
  * WebSocket channels
81
81
  */
82
- 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';
83
83
  /**
84
84
  * WebSocket subscription message
85
85
  */
86
86
  interface WebSocketSubscribeMessage {
87
- action?: "subscribe" | "unsubscribe";
87
+ action?: 'subscribe' | 'unsubscribe';
88
88
  address: string;
89
89
  }
90
90
  /**
@@ -114,7 +114,7 @@ interface WatchlistItemDto {
114
114
  interface ToggleWatchlistResponseDto {
115
115
  items: WatchlistItemDto[];
116
116
  }
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
+ 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';
118
118
  interface NotificationDto {
119
119
  id: string;
120
120
  address: string;
@@ -131,7 +131,7 @@ interface ChunkFillDto {
131
131
  size: number;
132
132
  executedAt: string;
133
133
  }
134
- type TwapChunkStatus = "PENDING" | "SCHEDULED" | "EXECUTING" | "COMPLETED" | "FAILED" | "CANCELLED";
134
+ type TwapChunkStatus = 'PENDING' | 'SCHEDULED' | 'EXECUTING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
135
135
  interface TwapChunkStatusDto {
136
136
  chunkId: string;
137
137
  chunkIndex: number;
@@ -142,7 +142,7 @@ interface TwapChunkStatusDto {
142
142
  fills: ChunkFillDto[];
143
143
  errorMessage?: string;
144
144
  }
145
- type TwapOrderOverallStatus = "OPEN" | "EXECUTING" | "COMPLETED" | "PARTIALLY_COMPLETED" | "FAILED" | "CANCELLED";
145
+ type TwapOrderOverallStatus = 'OPEN' | 'EXECUTING' | 'COMPLETED' | 'PARTIALLY_COMPLETED' | 'FAILED' | 'CANCELLED';
146
146
  interface TwapMonitoringDto {
147
147
  orderId: string;
148
148
  positionId?: string;
@@ -179,6 +179,8 @@ interface TradeHistoryAssetDataDto {
179
179
  externalFeePaid: number;
180
180
  builderFeePaid: number;
181
181
  realizedPnl: number;
182
+ marketPrefix?: string | null;
183
+ collateralToken?: CollateralToken;
182
184
  }
183
185
  /**
184
186
  * Trade history data structure
@@ -227,9 +229,11 @@ interface PositionAssetDetailDto {
227
229
  liquidationPrice: number;
228
230
  initialWeight: number;
229
231
  fundingPaid?: number;
232
+ marketPrefix?: string | null;
233
+ collateralToken?: CollateralToken;
230
234
  }
231
235
  interface TpSlThreshold {
232
- type: "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
236
+ type: 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
233
237
  value: number;
234
238
  }
235
239
  /**
@@ -260,20 +264,22 @@ interface OpenPositionDto {
260
264
  interface OrderAssetDto {
261
265
  asset: string;
262
266
  weight: number;
267
+ marketPrefix?: string | null;
268
+ collateralToken?: CollateralToken;
263
269
  }
264
270
  /**
265
271
  * Order status
266
272
  */
267
- type OrderStatus = "OPEN" | "PARTIALLY_FILLED" | "PROCESSING";
273
+ type OrderStatus = 'OPEN' | 'PARTIALLY_FILLED' | 'PROCESSING';
268
274
  /**
269
275
  * Order type
270
276
  */
271
- type OrderType = "TP" | "SL" | "LIMIT" | "MARKET" | "LIMIT_BTCDOM" | "TWAP";
277
+ type OrderType = 'TP' | 'SL' | 'LIMIT' | 'MARKET' | 'LIMIT_BTCDOM' | 'TWAP';
272
278
  /**
273
279
  * TP/SL trigger type
274
280
  */
275
- type TpSlTriggerType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
276
- type OrderDirection = "MORE_THAN" | "LESS_THAN" | null;
281
+ type TpSlTriggerType = 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
282
+ type OrderDirection = 'MORE_THAN' | 'LESS_THAN' | null;
277
283
  /**
278
284
  * Open limit order data structure
279
285
  */
@@ -379,7 +385,7 @@ interface RefreshTokenResponse {
379
385
  tokenType: string;
380
386
  expiresIn: number;
381
387
  }
382
- type AgentWalletStatus = "ACTIVE" | "EXPIRED" | "NOT_FOUND";
388
+ type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
383
389
  interface CreateAgentWalletResponseDto {
384
390
  agentWalletAddress: string;
385
391
  message: string;
@@ -392,14 +398,14 @@ interface ExtraAgent {
392
398
  interface AgentWalletState {
393
399
  address: string | null;
394
400
  name: string | null;
395
- status: AgentWalletStatus | "PENDING" | null;
401
+ status: AgentWalletStatus | 'PENDING' | null;
396
402
  isActive: boolean;
397
403
  }
398
404
  /**
399
405
  * WebSocket message from HyperLiquid native API
400
406
  */
401
407
  interface WebSocketMessage {
402
- method: "subscribe" | "unsubscribe";
408
+ method: 'subscribe' | 'unsubscribe';
403
409
  subscription: {
404
410
  type: string;
405
411
  dex?: string;
@@ -412,12 +418,16 @@ interface WebSocketMessage {
412
418
  /**
413
419
  * WebSocket response from HyperLiquid native API
414
420
  */
415
- type HLChannel = "webData3" | "allMids" | "activeAssetData" | "candle" | "allDexsClearinghouseState" | "allDexsAssetCtxs";
421
+ type HLChannel = 'webData3' | 'allMids' | 'activeAssetData' | 'candle' | 'spotState' | 'allDexsClearinghouseState' | 'allDexsAssetCtxs';
416
422
  interface HLChannelDataMap {
417
423
  webData3: WebData3Response;
418
424
  allMids: WsAllMidsData;
419
425
  activeAssetData: ActiveAssetData;
420
426
  candle: CandleData;
427
+ spotState: {
428
+ user: string;
429
+ spotState: SpotState;
430
+ };
421
431
  allDexsClearinghouseState: AllDexsClearinghouseStateData;
422
432
  allDexsAssetCtxs: AllDexsAssetCtxsData;
423
433
  }
@@ -482,6 +492,12 @@ interface AssetCtx {
482
492
  impactPxs?: string[];
483
493
  oraclePx: string;
484
494
  }
495
+ /**
496
+ * Collateral token type
497
+ * 0 = USDC
498
+ * 360 = USDH
499
+ */
500
+ type CollateralToken = 'USDC' | 'USDH';
485
501
  /**
486
502
  * Universe asset metadata
487
503
  */
@@ -491,6 +507,8 @@ interface UniverseAsset {
491
507
  maxLeverage: number;
492
508
  onlyIsolated?: boolean;
493
509
  isDelisted?: boolean;
510
+ marketPrefix?: string;
511
+ collateralToken?: CollateralToken;
494
512
  }
495
513
  interface ClearinghouseState {
496
514
  assetPositions: AssetPosition[];
@@ -561,6 +579,8 @@ interface RawAssetDto {
561
579
  size: number;
562
580
  side: string;
563
581
  fundingPaid?: number;
582
+ marketPrefix?: string | null;
583
+ collateralToken?: CollateralToken;
564
584
  leverage: number;
565
585
  }
566
586
  /**
@@ -609,6 +629,7 @@ interface TokenMetadata {
609
629
  leverage?: LeverageInfo;
610
630
  maxTradeSzs?: [string, string];
611
631
  availableToTrade?: [string, string];
632
+ collateralToken?: CollateralToken;
612
633
  }
613
634
  /**
614
635
  * Enhanced token selection with weight and metadata for basket trading
@@ -622,16 +643,37 @@ interface TokenSelection {
622
643
  */
623
644
  interface TokenConflict {
624
645
  symbol: string;
625
- conflictType: "long" | "short";
646
+ conflictType: 'long' | 'short';
626
647
  conflictMessage: string;
627
648
  }
628
649
  interface AssetMarketData {
629
650
  asset: WebData3AssetCtx | AssetCtx;
630
651
  universe: UniverseAsset;
631
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>>;
632
672
  interface PairAssetDto {
633
673
  asset: string;
634
674
  weight: number;
675
+ collateralToken: CollateralToken;
676
+ marketPrefix: string | null;
635
677
  }
636
678
  interface ActiveAssetGroupItem {
637
679
  longAssets: PairAssetDto[];
@@ -645,6 +687,7 @@ interface ActiveAssetGroupItem {
645
687
  weightedRatio?: string;
646
688
  weightedPrevRatio?: string;
647
689
  weightedChange24h?: string;
690
+ collateralType: 'USDC' | 'USDH' | 'MIXED';
648
691
  }
649
692
  interface ActiveAssetsResponse {
650
693
  active: ActiveAssetGroupItem[];
@@ -662,7 +705,7 @@ interface ActiveAssetsAllResponse {
662
705
  /**
663
706
  * Candle interval options
664
707
  */
665
- 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';
666
709
  /**
667
710
  * Candle data structure from WebSocket
668
711
  */
@@ -690,12 +733,23 @@ interface CandleSnapshotRequest {
690
733
  endTime: number;
691
734
  interval: CandleInterval;
692
735
  };
693
- type: "candleSnapshot";
736
+ type: 'candleSnapshot';
694
737
  }
695
738
  interface TokenSelectorConfig {
696
739
  isLong: boolean;
697
740
  index: number;
698
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
+ }
699
753
 
700
754
  declare const useAccountSummary: () => {
701
755
  data: AccountSummaryResponseDto | null;
@@ -706,9 +760,6 @@ declare const useTradeHistories: () => {
706
760
  data: TradeHistoryDataDto[] | null;
707
761
  isLoading: boolean;
708
762
  };
709
- /**
710
- * Hook to access open orders with loading state
711
- */
712
763
  declare const useOpenOrders: () => {
713
764
  data: OpenLimitOrderDto[] | null;
714
765
  isLoading: boolean;
@@ -747,8 +798,26 @@ declare const useUserSelection: () => UserSelectionState;
747
798
  declare const useWebData: () => {
748
799
  clearinghouseState: ClearinghouseState | null;
749
800
  perpsAtOpenInterestCap: string[] | null;
750
- marketDataBySymbol: Record<string, AssetMarketData>;
751
- 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>;
752
821
  isConnected: boolean;
753
822
  error: string | null;
754
823
  };
@@ -893,6 +962,47 @@ interface CancelTwapResponseDto {
893
962
  cancelledAt: string;
894
963
  }
895
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>>;
896
1006
 
897
1007
  type ExecutionType = "MARKET" | "LIMIT" | "TWAP" | "LADDER" | "LIMIT_BTCDOM";
898
1008
  type TpSlThresholdType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
@@ -951,7 +1061,7 @@ interface CreatePositionResponseDto {
951
1061
  * @throws MinimumPositionSizeError if any asset has less than $11 USD value
952
1062
  * @throws MaxAssetsPerLegError if any leg exceeds the maximum allowed assets (15)
953
1063
  */
954
- 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>>;
955
1065
  interface UpdateRiskParametersRequestInput {
956
1066
  stopLoss?: TpSlThresholdInput | null;
957
1067
  takeProfit?: TpSlThresholdInput | null;
@@ -1018,7 +1128,7 @@ interface AdjustAdvanceResponseDto {
1018
1128
  status: string;
1019
1129
  executedAt: string;
1020
1130
  }
1021
- 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>>;
1022
1132
  declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
1023
1133
  interface UpdateLeverageRequestInput {
1024
1134
  leverage: number;
@@ -1048,6 +1158,18 @@ declare function useOrders(): {
1048
1158
  readonly isLoading: boolean;
1049
1159
  };
1050
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
+
1051
1173
  declare function useTwap(): {
1052
1174
  readonly orders: TwapMonitoringDto[];
1053
1175
  readonly cancelTwap: (orderId: string) => Promise<ApiResponse<CancelTwapResponseDto>>;
@@ -1069,14 +1191,16 @@ interface UseNotificationsResult {
1069
1191
  */
1070
1192
  declare function useNotifications(): UseNotificationsResult;
1071
1193
 
1194
+ type CollateralFilter = 'USDC' | 'USDH' | 'ALL';
1072
1195
  declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
1073
1196
  declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
1074
- declare const useActiveBaskets: () => ActiveAssetGroupItem[];
1075
- declare const useTopGainers: (limit?: number) => ActiveAssetGroupItem[];
1076
- declare const useTopLosers: (limit?: number) => ActiveAssetGroupItem[];
1077
- declare const useHighlightedBaskets: () => ActiveAssetGroupItem[];
1078
- declare const useWatchlistBaskets: () => ActiveAssetGroupItem[];
1079
- 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[];
1080
1204
  declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
1081
1205
 
1082
1206
  declare function useWatchlist(): {
@@ -1151,6 +1275,15 @@ declare function useAuth(): {
1151
1275
  readonly address: string | null;
1152
1276
  };
1153
1277
 
1278
+ interface AllUserBalances {
1279
+ spotUsdcBalance: number | undefined;
1280
+ availableToTradeUsdc: number | undefined;
1281
+ spotUsdhBalance: number | undefined;
1282
+ availableToTradeUsdh: number | undefined;
1283
+ isLoading: boolean;
1284
+ }
1285
+ declare const useAllUserBalances: () => AllUserBalances;
1286
+
1154
1287
  interface UseHyperliquidWebSocketProps {
1155
1288
  wsUrl: string;
1156
1289
  address: string | null;
@@ -1185,7 +1318,7 @@ declare function markNotificationReadById(baseUrl: string, id: string): Promise<
1185
1318
  updated: number;
1186
1319
  }>>;
1187
1320
 
1188
- declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
1321
+ declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
1189
1322
 
1190
1323
  /**
1191
1324
  * Account summary calculation utility class
@@ -1224,24 +1357,28 @@ declare class ConflictDetector {
1224
1357
  declare class TokenMetadataExtractor {
1225
1358
  /**
1226
1359
  * Extracts comprehensive token metadata
1227
- * @param symbol - Token symbol
1360
+ * @param symbol - Token symbol (base symbol without prefix, e.g., "TSLA")
1228
1361
  * @param perpMetaAssets - Aggregated universe assets (flattened across dexes)
1229
1362
  * @param finalAssetContexts - Aggregated asset contexts (flattened across dexes)
1230
1363
  * @param allMids - AllMids data containing current prices
1231
1364
  * @param activeAssetData - Optional active asset data containing leverage information
1365
+ * @param marketPrefix - Optional market prefix (e.g., "xyz", "flx") for HIP3 multi-market assets
1232
1366
  * @returns TokenMetadata or null if token not found
1233
1367
  */
1234
- static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): TokenMetadata | null;
1368
+ static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null, marketPrefix?: string | null): TokenMetadata | null;
1235
1369
  /**
1236
1370
  * Extracts metadata for multiple tokens
1237
- * @param symbols - Array of token symbols
1371
+ * @param tokens - Array of token objects with symbol and optional marketPrefix
1238
1372
  * @param perpMetaAssets - Aggregated universe assets
1239
1373
  * @param finalAssetContexts - Aggregated asset contexts
1240
1374
  * @param allMids - AllMids data
1241
1375
  * @param activeAssetData - Optional active asset data containing leverage information
1242
- * @returns Record of symbol to TokenMetadata
1376
+ * @returns Record of unique key to TokenMetadata. Key is "{prefix}:{symbol}" for HIP3 assets, or just "{symbol}" otherwise
1243
1377
  */
1244
- static extractMultipleTokensMetadata(symbols: string[], perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
1378
+ static extractMultipleTokensMetadata(tokens: Array<{
1379
+ symbol: string;
1380
+ marketPrefix?: string | null;
1381
+ }>, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
1245
1382
  /**
1246
1383
  * Checks if token data is available in aggregated universe assets
1247
1384
  * @param symbol - Token symbol
@@ -1345,6 +1482,47 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
1345
1482
  minimumRequired?: number;
1346
1483
  };
1347
1484
 
1485
+ /**
1486
+ * Convert a full/prefixed symbol (e.g., "xyz:XYZ100") to a display symbol (e.g., "XYZ100").
1487
+ */
1488
+ declare function toDisplaySymbol(symbol: string): string;
1489
+ /**
1490
+ * Convert a display symbol back to backend form using a provided map.
1491
+ * If mapping is missing, returns the original symbol.
1492
+ * For multi-market assets, returns the first available market.
1493
+ * @param displaySymbol e.g., "TSLA"
1494
+ * @param hip3Assets map of display -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"])
1495
+ */
1496
+ declare function toBackendSymbol(displaySymbol: string, hip3Assets: Map<string, string[]>): string;
1497
+ /**
1498
+ * Convert a display symbol to backend form for a specific market prefix.
1499
+ * This is useful when an asset is available on multiple markets (e.g., xyz:TSLA and flx:TSLA).
1500
+ * @param displaySymbol e.g., "TSLA"
1501
+ * @param marketPrefix e.g., "xyz" or "flx"
1502
+ * @param hip3Assets map of display -> all full market names
1503
+ * @returns Full market name if found, null if prefix not specified for multi-market asset, otherwise displaySymbol with prefix
1504
+ */
1505
+ declare function toBackendSymbolWithMarket(displaySymbol: string, marketPrefix: string | undefined, hip3Assets: Map<string, string[]>): string | null;
1506
+ /**
1507
+ * Get all available markets for a display symbol.
1508
+ * @param displaySymbol e.g., "TSLA"
1509
+ * @param hip3Assets map of display -> all full market names
1510
+ * @returns Array of full market names, e.g., ["xyz:TSLA", "flx:TSLA"]
1511
+ */
1512
+ declare function getAvailableMarkets(displaySymbol: string, hip3Assets: Map<string, string[]>): string[];
1513
+ /**
1514
+ * Extract the market prefix from a full market name.
1515
+ * @param fullSymbol e.g., "xyz:TSLA"
1516
+ * @returns The prefix (e.g., "xyz") or undefined if no prefix
1517
+ */
1518
+ declare function getMarketPrefix(fullSymbol: string): string | undefined;
1519
+ /**
1520
+ * Check if a symbol is a HIP-3 market (has a prefix).
1521
+ * @param symbol e.g., "xyz:TSLA" or "TSLA"
1522
+ * @returns true if the symbol has a market prefix
1523
+ */
1524
+ declare function isHip3Market(symbol: string): boolean;
1525
+
1348
1526
  interface MarketDataState {
1349
1527
  marketData: ActiveAssetsResponse | null;
1350
1528
  marketDataAll: ActiveAssetsAllResponse | null;
@@ -1354,5 +1532,5 @@ interface MarketDataState {
1354
1532
  }
1355
1533
  declare const useMarketData: zustand.UseBoundStore<zustand.StoreApi<MarketDataState>>;
1356
1534
 
1357
- 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 };
1358
- 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 };
1535
+ 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 };
1536
+ 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 };