@pear-protocol/hyperliquid-sdk 0.0.60-beta → 0.0.60-beta-usdh-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/hyperliquid.d.ts +1 -1
- package/dist/clients/positions.d.ts +2 -2
- package/dist/clients/watchlist.d.ts +1 -1
- package/dist/hooks/useAuth.d.ts +4 -4
- package/dist/hooks/useMarketData.d.ts +9 -7
- package/dist/hooks/useWebData.d.ts +21 -3
- package/dist/index.d.ts +126 -45
- package/dist/index.js +709 -260
- package/dist/provider.d.ts +1 -1
- package/dist/store/historicalPriceDataStore.d.ts +1 -12
- package/dist/store/hyperliquidDataStore.d.ts +1 -25
- package/dist/store/marketDataStore.d.ts +1 -10
- package/dist/store/tokenSelectionMetadataStore.d.ts +2 -2
- package/dist/store/userDataStore.d.ts +1 -28
- package/dist/store/userSelection.d.ts +1 -1
- package/dist/types.d.ts +38 -3
- package/dist/utils/symbol-translator.d.ts +32 -3
- package/dist/utils/token-metadata-extractor.d.ts +9 -5
- package/package.json +2 -3
|
@@ -2,7 +2,7 @@ import type { ApiResponse, CandleInterval, CandleData, ExternalFillDto, AllPerpM
|
|
|
2
2
|
/**
|
|
3
3
|
* Fetch historical candle data from HyperLiquid API
|
|
4
4
|
*/
|
|
5
|
-
export declare const fetchHistoricalCandles: (coin: string, startTime: number, endTime: number, interval: CandleInterval,
|
|
5
|
+
export declare const fetchHistoricalCandles: (coin: string, startTime: number, endTime: number, interval: CandleInterval, hip3Assets: Map<string, string[]>) => Promise<ApiResponse<CandleData[]>>;
|
|
6
6
|
/**
|
|
7
7
|
* Retrieve recent user fills from HyperLiquid and map to ExternalFillDto[]
|
|
8
8
|
*/
|
|
@@ -56,7 +56,7 @@ export interface CreatePositionResponseDto {
|
|
|
56
56
|
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
57
57
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
58
58
|
*/
|
|
59
|
-
export declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput,
|
|
59
|
+
export declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, hip3Assets: Map<string, string[]>): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
60
60
|
export interface UpdateRiskParametersRequestInput {
|
|
61
61
|
stopLoss?: TpSlThresholdInput | null;
|
|
62
62
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -123,5 +123,5 @@ export interface AdjustAdvanceResponseDto {
|
|
|
123
123
|
status: string;
|
|
124
124
|
executedAt: string;
|
|
125
125
|
}
|
|
126
|
-
export declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[],
|
|
126
|
+
export declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
127
127
|
export declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ApiResponse, ToggleWatchlistResponseDto, WatchlistAssetDto } from '../types';
|
|
2
|
-
export declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[],
|
|
2
|
+
export declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
package/dist/hooks/useAuth.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { GetEIP712MessageResponse } from
|
|
1
|
+
import type { GetEIP712MessageResponse } from '../types';
|
|
2
2
|
export declare function useAuth(): {
|
|
3
3
|
readonly isReady: boolean;
|
|
4
|
-
readonly isAuthenticated:
|
|
5
|
-
readonly accessToken:
|
|
6
|
-
readonly refreshToken:
|
|
4
|
+
readonly isAuthenticated: any;
|
|
5
|
+
readonly accessToken: any;
|
|
6
|
+
readonly refreshToken: any;
|
|
7
7
|
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
8
8
|
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
9
9
|
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { ActiveAssetGroupItem, ActiveAssetsResponse, ActiveAssetsAllResponse } from '../types';
|
|
1
|
+
import type { ActiveAssetGroupItem, ActiveAssetsResponse, ActiveAssetsAllResponse, UniverseAsset } from '../types';
|
|
2
|
+
export type CollateralFilter = 'USDC' | 'USDH' | 'ALL';
|
|
2
3
|
export declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
|
|
3
4
|
export declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
5
|
+
export declare const usePerpMetaAssets: () => UniverseAsset[] | null;
|
|
6
|
+
export declare const useActiveBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
7
|
+
export declare const useTopGainers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
8
|
+
export declare const useTopLosers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
9
|
+
export declare const useHighlightedBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
10
|
+
export declare const useWatchlistBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
11
|
+
export declare const useAllBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
10
12
|
export declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
|
|
@@ -1,12 +1,30 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ClearinghouseState, MarketDataBySymbol } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Hook to access webData and native WebSocket state
|
|
4
4
|
*/
|
|
5
5
|
export declare const useWebData: () => {
|
|
6
6
|
clearinghouseState: ClearinghouseState | null;
|
|
7
7
|
perpsAtOpenInterestCap: string[] | null;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Market data keyed by symbol, with nested market variants.
|
|
10
|
+
* Each symbol maps to its market variants (keyed by prefix).
|
|
11
|
+
* For non-HIP3 assets, use "default" as the key.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // HIP-3 asset with multiple markets
|
|
16
|
+
* marketDataBySymbol["TSLA"]["xyz"] // { asset, universe: { collateralToken: "USDC" } }
|
|
17
|
+
* marketDataBySymbol["TSLA"]["flx"] // { asset, universe: { collateralToken: "USDH" } }
|
|
18
|
+
*
|
|
19
|
+
* // Regular asset
|
|
20
|
+
* marketDataBySymbol["BTC"]["default"] // { asset, universe }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
marketDataBySymbol: MarketDataBySymbol;
|
|
24
|
+
/** Map of display name -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"]) */
|
|
25
|
+
hip3Assets: Map<string, string[]>;
|
|
26
|
+
/** Map of full market name -> prefix (e.g., "xyz:TSLA" -> "xyz") */
|
|
27
|
+
hip3MarketPrefixes: Map<string, string>;
|
|
10
28
|
isConnected: boolean;
|
|
11
29
|
error: string | null;
|
|
12
30
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import * as zustand from 'zustand';
|
|
3
2
|
|
|
4
3
|
interface PearHyperliquidContextType {
|
|
5
4
|
clientId: string;
|
|
@@ -179,6 +178,8 @@ interface TradeHistoryAssetDataDto {
|
|
|
179
178
|
externalFeePaid: number;
|
|
180
179
|
builderFeePaid: number;
|
|
181
180
|
realizedPnl: number;
|
|
181
|
+
marketPrefix?: string | null;
|
|
182
|
+
collateralToken?: CollateralToken;
|
|
182
183
|
}
|
|
183
184
|
/**
|
|
184
185
|
* Trade history data structure
|
|
@@ -227,6 +228,8 @@ interface PositionAssetDetailDto {
|
|
|
227
228
|
liquidationPrice: number;
|
|
228
229
|
initialWeight: number;
|
|
229
230
|
fundingPaid?: number;
|
|
231
|
+
marketPrefix?: string | null;
|
|
232
|
+
collateralToken?: CollateralToken;
|
|
230
233
|
}
|
|
231
234
|
interface TpSlThreshold {
|
|
232
235
|
type: 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
|
|
@@ -398,7 +401,7 @@ interface AgentWalletState {
|
|
|
398
401
|
* WebSocket message from HyperLiquid native API
|
|
399
402
|
*/
|
|
400
403
|
interface WebSocketMessage {
|
|
401
|
-
method:
|
|
404
|
+
method: 'subscribe' | 'unsubscribe';
|
|
402
405
|
subscription: {
|
|
403
406
|
type: string;
|
|
404
407
|
dex?: string;
|
|
@@ -472,6 +475,12 @@ interface AssetCtx {
|
|
|
472
475
|
impactPxs?: string[];
|
|
473
476
|
oraclePx: string;
|
|
474
477
|
}
|
|
478
|
+
/**
|
|
479
|
+
* Collateral token type
|
|
480
|
+
* 0 = USDC
|
|
481
|
+
* 360 = USDH
|
|
482
|
+
*/
|
|
483
|
+
type CollateralToken = 'USDC' | 'USDH';
|
|
475
484
|
/**
|
|
476
485
|
* Universe asset metadata
|
|
477
486
|
*/
|
|
@@ -481,6 +490,8 @@ interface UniverseAsset {
|
|
|
481
490
|
maxLeverage: number;
|
|
482
491
|
onlyIsolated?: boolean;
|
|
483
492
|
isDelisted?: boolean;
|
|
493
|
+
marketPrefix?: string;
|
|
494
|
+
collateralToken?: CollateralToken;
|
|
484
495
|
}
|
|
485
496
|
interface ClearinghouseState {
|
|
486
497
|
assetPositions: AssetPosition[];
|
|
@@ -598,6 +609,7 @@ interface TokenMetadata {
|
|
|
598
609
|
leverage?: LeverageInfo;
|
|
599
610
|
maxTradeSzs?: [string, string];
|
|
600
611
|
availableToTrade?: [string, string];
|
|
612
|
+
collateralToken?: CollateralToken;
|
|
601
613
|
}
|
|
602
614
|
/**
|
|
603
615
|
* Enhanced token selection with weight and metadata for basket trading
|
|
@@ -618,9 +630,30 @@ interface AssetMarketData {
|
|
|
618
630
|
asset: WebData3AssetCtx | AssetCtx;
|
|
619
631
|
universe: UniverseAsset;
|
|
620
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Nested market data structure for multi-market assets.
|
|
635
|
+
* Each symbol maps to its market variants (keyed by prefix).
|
|
636
|
+
* For non-HIP3 assets, use "default" as the key.
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```ts
|
|
640
|
+
* {
|
|
641
|
+
* "TSLA": {
|
|
642
|
+
* "xyz": { asset: {...}, universe: { collateralToken: "USDC", ... } },
|
|
643
|
+
* "flx": { asset: {...}, universe: { collateralToken: "USDH", ... } }
|
|
644
|
+
* },
|
|
645
|
+
* "BTC": {
|
|
646
|
+
* "default": { asset: {...}, universe: {...} }
|
|
647
|
+
* }
|
|
648
|
+
* }
|
|
649
|
+
* ```
|
|
650
|
+
*/
|
|
651
|
+
type MarketDataBySymbol = Record<string, Record<string, AssetMarketData>>;
|
|
621
652
|
interface PairAssetDto {
|
|
622
653
|
asset: string;
|
|
623
654
|
weight: number;
|
|
655
|
+
collateralToken: CollateralToken;
|
|
656
|
+
marketPrefix: string | null;
|
|
624
657
|
}
|
|
625
658
|
interface ActiveAssetGroupItem {
|
|
626
659
|
longAssets: PairAssetDto[];
|
|
@@ -634,6 +667,7 @@ interface ActiveAssetGroupItem {
|
|
|
634
667
|
weightedRatio?: string;
|
|
635
668
|
weightedPrevRatio?: string;
|
|
636
669
|
weightedChange24h?: string;
|
|
670
|
+
collateralType: 'USDC' | 'USDH' | 'MIXED';
|
|
637
671
|
}
|
|
638
672
|
interface ActiveAssetsResponse {
|
|
639
673
|
active: ActiveAssetGroupItem[];
|
|
@@ -651,7 +685,7 @@ interface ActiveAssetsAllResponse {
|
|
|
651
685
|
/**
|
|
652
686
|
* Candle interval options
|
|
653
687
|
*/
|
|
654
|
-
type CandleInterval =
|
|
688
|
+
type CandleInterval = '1m' | '3m' | '5m' | '15m' | '30m' | '1h' | '2h' | '4h' | '8h' | '12h' | '1d' | '3d' | '1w' | '1M';
|
|
655
689
|
/**
|
|
656
690
|
* Candle data structure from WebSocket
|
|
657
691
|
*/
|
|
@@ -679,7 +713,7 @@ interface CandleSnapshotRequest {
|
|
|
679
713
|
endTime: number;
|
|
680
714
|
interval: CandleInterval;
|
|
681
715
|
};
|
|
682
|
-
type:
|
|
716
|
+
type: 'candleSnapshot';
|
|
683
717
|
}
|
|
684
718
|
interface TokenSelectorConfig {
|
|
685
719
|
isLong: boolean;
|
|
@@ -735,8 +769,26 @@ declare const useUserSelection: () => UserSelectionState;
|
|
|
735
769
|
declare const useWebData: () => {
|
|
736
770
|
clearinghouseState: ClearinghouseState | null;
|
|
737
771
|
perpsAtOpenInterestCap: string[] | null;
|
|
738
|
-
|
|
739
|
-
|
|
772
|
+
/**
|
|
773
|
+
* Market data keyed by symbol, with nested market variants.
|
|
774
|
+
* Each symbol maps to its market variants (keyed by prefix).
|
|
775
|
+
* For non-HIP3 assets, use "default" as the key.
|
|
776
|
+
*
|
|
777
|
+
* @example
|
|
778
|
+
* ```ts
|
|
779
|
+
* // HIP-3 asset with multiple markets
|
|
780
|
+
* marketDataBySymbol["TSLA"]["xyz"] // { asset, universe: { collateralToken: "USDC" } }
|
|
781
|
+
* marketDataBySymbol["TSLA"]["flx"] // { asset, universe: { collateralToken: "USDH" } }
|
|
782
|
+
*
|
|
783
|
+
* // Regular asset
|
|
784
|
+
* marketDataBySymbol["BTC"]["default"] // { asset, universe }
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
787
|
+
marketDataBySymbol: MarketDataBySymbol;
|
|
788
|
+
/** Map of display name -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"]) */
|
|
789
|
+
hip3Assets: Map<string, string[]>;
|
|
790
|
+
/** Map of full market name -> prefix (e.g., "xyz:TSLA" -> "xyz") */
|
|
791
|
+
hip3MarketPrefixes: Map<string, string>;
|
|
740
792
|
isConnected: boolean;
|
|
741
793
|
error: string | null;
|
|
742
794
|
};
|
|
@@ -770,18 +822,7 @@ interface TokenHistoricalPriceData {
|
|
|
770
822
|
oldestTime: number | null;
|
|
771
823
|
latestTime: number | null;
|
|
772
824
|
}
|
|
773
|
-
|
|
774
|
-
historicalPriceData: Record<string, TokenHistoricalPriceData>;
|
|
775
|
-
loadingTokens: Set<string>;
|
|
776
|
-
addHistoricalPriceData: (symbol: string, interval: CandleInterval, candles: CandleData[], range: HistoricalRange) => void;
|
|
777
|
-
hasHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => boolean;
|
|
778
|
-
getHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => CandleData[];
|
|
779
|
-
setTokenLoading: (symbol: string, loading: boolean) => void;
|
|
780
|
-
isTokenLoading: (symbol: string) => boolean;
|
|
781
|
-
removeTokenPriceData: (symbol: string, interval: CandleInterval) => void;
|
|
782
|
-
clearData: () => void;
|
|
783
|
-
}
|
|
784
|
-
declare const useHistoricalPriceDataStore: zustand.UseBoundStore<zustand.StoreApi<HistoricalPriceDataState>>;
|
|
825
|
+
declare const useHistoricalPriceDataStore: any;
|
|
785
826
|
|
|
786
827
|
interface UseHistoricalPriceDataReturn {
|
|
787
828
|
fetchHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval, callback?: (data: Record<string, CandleData[]>) => void) => Promise<Record<string, CandleData[]>>;
|
|
@@ -938,7 +979,7 @@ interface CreatePositionResponseDto {
|
|
|
938
979
|
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
939
980
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
940
981
|
*/
|
|
941
|
-
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput,
|
|
982
|
+
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, hip3Assets: Map<string, string[]>): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
942
983
|
interface UpdateRiskParametersRequestInput {
|
|
943
984
|
stopLoss?: TpSlThresholdInput | null;
|
|
944
985
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -1005,7 +1046,7 @@ interface AdjustAdvanceResponseDto {
|
|
|
1005
1046
|
status: string;
|
|
1006
1047
|
executedAt: string;
|
|
1007
1048
|
}
|
|
1008
|
-
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[],
|
|
1049
|
+
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
1009
1050
|
declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
1010
1051
|
|
|
1011
1052
|
declare function usePosition(): {
|
|
@@ -1048,14 +1089,16 @@ interface UseNotificationsResult {
|
|
|
1048
1089
|
*/
|
|
1049
1090
|
declare function useNotifications(): UseNotificationsResult;
|
|
1050
1091
|
|
|
1092
|
+
type CollateralFilter = 'USDC' | 'USDH' | 'ALL';
|
|
1051
1093
|
declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
|
|
1052
1094
|
declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
|
|
1053
|
-
declare const
|
|
1054
|
-
declare const
|
|
1055
|
-
declare const
|
|
1056
|
-
declare const
|
|
1057
|
-
declare const
|
|
1058
|
-
declare const
|
|
1095
|
+
declare const usePerpMetaAssets: () => UniverseAsset[] | null;
|
|
1096
|
+
declare const useActiveBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1097
|
+
declare const useTopGainers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1098
|
+
declare const useTopLosers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1099
|
+
declare const useHighlightedBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1100
|
+
declare const useWatchlistBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1101
|
+
declare const useAllBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1059
1102
|
declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
|
|
1060
1103
|
|
|
1061
1104
|
declare function useWatchlist(): {
|
|
@@ -1118,9 +1161,9 @@ declare function usePortfolio(): UsePortfolioResult;
|
|
|
1118
1161
|
|
|
1119
1162
|
declare function useAuth(): {
|
|
1120
1163
|
readonly isReady: boolean;
|
|
1121
|
-
readonly isAuthenticated:
|
|
1122
|
-
readonly accessToken:
|
|
1123
|
-
readonly refreshToken:
|
|
1164
|
+
readonly isAuthenticated: any;
|
|
1165
|
+
readonly accessToken: any;
|
|
1166
|
+
readonly refreshToken: any;
|
|
1124
1167
|
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
1125
1168
|
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
1126
1169
|
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
@@ -1162,7 +1205,7 @@ declare function markNotificationReadById(baseUrl: string, id: string): Promise<
|
|
|
1162
1205
|
updated: number;
|
|
1163
1206
|
}>>;
|
|
1164
1207
|
|
|
1165
|
-
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[],
|
|
1208
|
+
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
1166
1209
|
|
|
1167
1210
|
/**
|
|
1168
1211
|
* Account summary calculation utility class
|
|
@@ -1201,24 +1244,28 @@ declare class ConflictDetector {
|
|
|
1201
1244
|
declare class TokenMetadataExtractor {
|
|
1202
1245
|
/**
|
|
1203
1246
|
* Extracts comprehensive token metadata
|
|
1204
|
-
* @param symbol - Token symbol
|
|
1247
|
+
* @param symbol - Token symbol (base symbol without prefix, e.g., "TSLA")
|
|
1205
1248
|
* @param perpMetaAssets - Aggregated universe assets (flattened across dexes)
|
|
1206
1249
|
* @param finalAssetContexts - Aggregated asset contexts (flattened across dexes)
|
|
1207
1250
|
* @param allMids - AllMids data containing current prices
|
|
1208
1251
|
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1252
|
+
* @param marketPrefix - Optional market prefix (e.g., "xyz", "flx") for HIP3 multi-market assets
|
|
1209
1253
|
* @returns TokenMetadata or null if token not found
|
|
1210
1254
|
*/
|
|
1211
|
-
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): TokenMetadata | null;
|
|
1255
|
+
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null, marketPrefix?: string | null): TokenMetadata | null;
|
|
1212
1256
|
/**
|
|
1213
1257
|
* Extracts metadata for multiple tokens
|
|
1214
|
-
* @param
|
|
1258
|
+
* @param tokens - Array of token objects with symbol and optional marketPrefix
|
|
1215
1259
|
* @param perpMetaAssets - Aggregated universe assets
|
|
1216
1260
|
* @param finalAssetContexts - Aggregated asset contexts
|
|
1217
1261
|
* @param allMids - AllMids data
|
|
1218
1262
|
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1219
|
-
* @returns Record of
|
|
1263
|
+
* @returns Record of unique key to TokenMetadata. Key is "{prefix}:{symbol}" for HIP3 assets, or just "{symbol}" otherwise
|
|
1220
1264
|
*/
|
|
1221
|
-
static extractMultipleTokensMetadata(
|
|
1265
|
+
static extractMultipleTokensMetadata(tokens: Array<{
|
|
1266
|
+
symbol: string;
|
|
1267
|
+
marketPrefix?: string | null;
|
|
1268
|
+
}>, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
|
|
1222
1269
|
/**
|
|
1223
1270
|
* Checks if token data is available in aggregated universe assets
|
|
1224
1271
|
* @param symbol - Token symbol
|
|
@@ -1302,14 +1349,48 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
|
|
|
1302
1349
|
minimumRequired?: number;
|
|
1303
1350
|
};
|
|
1304
1351
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1352
|
+
/**
|
|
1353
|
+
* Convert a full/prefixed symbol (e.g., "xyz:XYZ100") to a display symbol (e.g., "XYZ100").
|
|
1354
|
+
*/
|
|
1355
|
+
declare function toDisplaySymbol(symbol: string): string;
|
|
1356
|
+
/**
|
|
1357
|
+
* Convert a display symbol back to backend form using a provided map.
|
|
1358
|
+
* If mapping is missing, returns the original symbol.
|
|
1359
|
+
* For multi-market assets, returns the first available market.
|
|
1360
|
+
* @param displaySymbol e.g., "TSLA"
|
|
1361
|
+
* @param hip3Assets map of display -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"])
|
|
1362
|
+
*/
|
|
1363
|
+
declare function toBackendSymbol(displaySymbol: string, hip3Assets: Map<string, string[]>): string;
|
|
1364
|
+
/**
|
|
1365
|
+
* Convert a display symbol to backend form for a specific market prefix.
|
|
1366
|
+
* This is useful when an asset is available on multiple markets (e.g., xyz:TSLA and flx:TSLA).
|
|
1367
|
+
* @param displaySymbol e.g., "TSLA"
|
|
1368
|
+
* @param marketPrefix e.g., "xyz" or "flx"
|
|
1369
|
+
* @param hip3Assets map of display -> all full market names
|
|
1370
|
+
* @returns Full market name if found, null if prefix not specified for multi-market asset, otherwise displaySymbol with prefix
|
|
1371
|
+
*/
|
|
1372
|
+
declare function toBackendSymbolWithMarket(displaySymbol: string, marketPrefix: string | undefined, hip3Assets: Map<string, string[]>): string | null;
|
|
1373
|
+
/**
|
|
1374
|
+
* Get all available markets for a display symbol.
|
|
1375
|
+
* @param displaySymbol e.g., "TSLA"
|
|
1376
|
+
* @param hip3Assets map of display -> all full market names
|
|
1377
|
+
* @returns Array of full market names, e.g., ["xyz:TSLA", "flx:TSLA"]
|
|
1378
|
+
*/
|
|
1379
|
+
declare function getAvailableMarkets(displaySymbol: string, hip3Assets: Map<string, string[]>): string[];
|
|
1380
|
+
/**
|
|
1381
|
+
* Extract the market prefix from a full market name.
|
|
1382
|
+
* @param fullSymbol e.g., "xyz:TSLA"
|
|
1383
|
+
* @returns The prefix (e.g., "xyz") or undefined if no prefix
|
|
1384
|
+
*/
|
|
1385
|
+
declare function getMarketPrefix(fullSymbol: string): string | undefined;
|
|
1386
|
+
/**
|
|
1387
|
+
* Check if a symbol is a HIP-3 market (has a prefix).
|
|
1388
|
+
* @param symbol e.g., "xyz:TSLA" or "TSLA"
|
|
1389
|
+
* @returns true if the symbol has a market prefix
|
|
1390
|
+
*/
|
|
1391
|
+
declare function isHip3Market(symbol: string): boolean;
|
|
1392
|
+
|
|
1393
|
+
declare const useMarketData: any;
|
|
1313
1394
|
|
|
1314
|
-
export { AccountSummaryCalculator, ConflictDetector, MINIMUM_ASSET_USD_VALUE, 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, validateMinimumAssetSize, validatePositionSize };
|
|
1315
|
-
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 };
|
|
1395
|
+
export { AccountSummaryCalculator, ConflictDetector, MINIMUM_ASSET_USD_VALUE, MinimumPositionSizeError, PearHyperliquidProvider, TokenMetadataExtractor, adjustAdvancePosition, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getAvailableMarkets, getCompleteTimestamps, getMarketPrefix, getPortfolio, isHip3Market, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toBackendSymbol, toBackendSymbolWithMarket, toDisplaySymbol, toggleWatchlist, updateRiskParameters, useAccountSummary, useActiveBaskets, useAgentWallet, useAllBaskets, useAuth, useAutoSyncFills, useBasketCandles, useFindBasket, useHighlightedBaskets, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useMarketData, useMarketDataAllPayload, useMarketDataPayload, useNotifications, useOpenOrders, useOrders, usePearHyperliquid, usePerformanceOverlays, usePerpMetaAssets, usePortfolio, usePosition, useTokenSelectionMetadata, useTopGainers, useTopLosers, useTradeHistories, useTwap, useUserSelection, useWatchlist, useWatchlistBaskets, useWebData, validateMinimumAssetSize, validatePositionSize };
|
|
1396
|
+
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, 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 };
|