@pear-protocol/hyperliquid-sdk 0.0.79 → 0.1.2
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/README.md +1141 -0
- package/dist/clients/hyperliquid.d.ts +9 -2
- package/dist/clients/positions.d.ts +2 -2
- package/dist/clients/watchlist.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useMarket.d.ts +8 -0
- package/dist/hooks/useMarketData.d.ts +1 -4
- package/dist/hooks/useTrading.d.ts +1 -2
- package/dist/index.d.ts +35 -139
- package/dist/index.js +594 -1218
- package/dist/store/hyperliquidDataStore.d.ts +9 -7
- package/dist/store/marketDataStore.d.ts +1 -3
- package/dist/store/tokenSelectionMetadataStore.d.ts +2 -4
- package/dist/types.d.ts +28 -32
- package/dist/utils/market-symbol.d.ts +5 -0
- package/dist/utils/position-processor.d.ts +2 -2
- package/dist/utils/token-metadata-extractor.d.ts +35 -24
- package/dist/utils/token-metadata-selectors.d.ts +4 -0
- package/package.json +1 -1
- package/dist/hooks/useWebData.d.ts +0 -30
- package/dist/utils/symbol-translator.d.ts +0 -40
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ApiResponse, CandleInterval, CandleData, ExternalFillDto, AllPerpMetasResponse, ExtraAgent, TwapSliceFillResponseItem } from '../types';
|
|
1
|
+
import type { ApiResponse, CandleInterval, CandleData, ExternalFillDto, AllPerpMetasResponse, ExtraAgent, TwapSliceFillResponseItem, PerpDexsResponse } from '../types';
|
|
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) => Promise<ApiResponse<CandleData[]>>;
|
|
6
6
|
/**
|
|
7
7
|
* Retrieve recent user fills from HyperLiquid and map to ExternalFillDto[]
|
|
8
8
|
*/
|
|
@@ -23,3 +23,10 @@ export declare const fetchAllPerpMetas: () => Promise<ApiResponse<AllPerpMetasRe
|
|
|
23
23
|
* Payload: { "type": "extraAgents", "user": "0x..." }
|
|
24
24
|
*/
|
|
25
25
|
export declare const fetchExtraAgents: (user: string) => Promise<ApiResponse<ExtraAgent[]>>;
|
|
26
|
+
/**
|
|
27
|
+
* Fetch perp dexes from HyperLiquid API
|
|
28
|
+
* Endpoint: https://api.hyperliquid.xyz/info
|
|
29
|
+
* Payload: { "type": "perpDexs" }
|
|
30
|
+
* Returns array where index 0 is null (HYPERLIQUID), index 1+ are named DEXes
|
|
31
|
+
*/
|
|
32
|
+
export declare const fetchPerpDexs: () => Promise<ApiResponse<PerpDexsResponse>>;
|
|
@@ -49,7 +49,7 @@ export interface CreatePositionResponseDto {
|
|
|
49
49
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
50
50
|
* @throws MaxAssetsPerLegError if any leg exceeds the maximum allowed assets (15)
|
|
51
51
|
*/
|
|
52
|
-
export declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput
|
|
52
|
+
export declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
53
53
|
export interface UpdateRiskParametersRequestInput {
|
|
54
54
|
stopLoss?: TpSlThresholdInput | null;
|
|
55
55
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -116,7 +116,7 @@ export interface AdjustAdvanceResponseDto {
|
|
|
116
116
|
status: string;
|
|
117
117
|
executedAt: string;
|
|
118
118
|
}
|
|
119
|
-
export declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[]
|
|
119
|
+
export declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[]): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
120
120
|
export declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
121
121
|
export interface UpdateLeverageRequestInput {
|
|
122
122
|
leverage: number;
|
|
@@ -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[]): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './useAccountSummary';
|
|
2
2
|
export * from './useTrading';
|
|
3
3
|
export * from './useUserSelection';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './useMarket';
|
|
5
5
|
export * from './useTokenSelectionMetadata';
|
|
6
6
|
export * from './useHistoricalPriceData';
|
|
7
7
|
export * from './useBasketCandles';
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type { ActiveAssetGroupItem, ActiveAssetsResponse
|
|
1
|
+
import type { ActiveAssetGroupItem, ActiveAssetsResponse } from '../types';
|
|
2
2
|
export type CollateralFilter = 'USDC' | 'USDH' | 'ALL';
|
|
3
3
|
export declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
|
|
4
|
-
export declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
|
|
5
|
-
export declare const usePerpMetaAssets: () => UniverseAsset[] | null;
|
|
6
4
|
export declare const useActiveBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
7
5
|
export declare const useTopGainers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
8
6
|
export declare const useTopLosers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
9
7
|
export declare const useHighlightedBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
10
8
|
export declare const useWatchlistBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
11
|
-
export declare const useAllBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
12
9
|
export declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { OpenLimitOrderDto } from '../types';
|
|
2
|
-
import type { TradeHistoryDataDto } from '../types';
|
|
1
|
+
import type { OpenLimitOrderDto, TradeHistoryDataDto } from '../types';
|
|
3
2
|
export declare const useTradeHistories: () => {
|
|
4
3
|
data: TradeHistoryDataDto[] | null;
|
|
5
4
|
isLoading: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -224,8 +224,7 @@ interface TradeHistoryAssetDataDto {
|
|
|
224
224
|
externalFeePaid: number;
|
|
225
225
|
builderFeePaid: number;
|
|
226
226
|
realizedPnl: number;
|
|
227
|
-
|
|
228
|
-
collateralToken?: CollateralToken;
|
|
227
|
+
metadata?: TokenMetadata | null;
|
|
229
228
|
}
|
|
230
229
|
/**
|
|
231
230
|
* Trade history data structure
|
|
@@ -274,8 +273,7 @@ interface PositionAssetDetailDto {
|
|
|
274
273
|
liquidationPrice: number;
|
|
275
274
|
initialWeight: number;
|
|
276
275
|
fundingPaid?: number;
|
|
277
|
-
|
|
278
|
-
collateralToken?: CollateralToken;
|
|
276
|
+
metadata?: TokenMetadata | null;
|
|
279
277
|
}
|
|
280
278
|
interface TpSlThreshold {
|
|
281
279
|
type: 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE' | 'PRICE' | 'PRICE_RATIO' | 'WEIGHTED_RATIO';
|
|
@@ -312,8 +310,7 @@ interface OpenPositionDto {
|
|
|
312
310
|
interface OrderAssetDto {
|
|
313
311
|
asset: string;
|
|
314
312
|
weight: number;
|
|
315
|
-
|
|
316
|
-
collateralToken?: CollateralToken;
|
|
313
|
+
metadata?: TokenMetadata | null;
|
|
317
314
|
}
|
|
318
315
|
/**
|
|
319
316
|
* Order status
|
|
@@ -602,8 +599,10 @@ interface AssetCtx {
|
|
|
602
599
|
* Collateral token type
|
|
603
600
|
* 0 = USDC
|
|
604
601
|
* 360 = USDH
|
|
602
|
+
* 235 = USDE
|
|
603
|
+
* 268 = USDT
|
|
605
604
|
*/
|
|
606
|
-
type CollateralToken = 'USDC' | 'USDH';
|
|
605
|
+
type CollateralToken = 'USDC' | 'USDH' | 'USDE' | 'USDT';
|
|
607
606
|
/**
|
|
608
607
|
* Universe asset metadata
|
|
609
608
|
*/
|
|
@@ -613,8 +612,7 @@ interface UniverseAsset {
|
|
|
613
612
|
maxLeverage: number;
|
|
614
613
|
onlyIsolated?: boolean;
|
|
615
614
|
isDelisted?: boolean;
|
|
616
|
-
|
|
617
|
-
collateralToken?: CollateralToken;
|
|
615
|
+
collateralToken: CollateralToken;
|
|
618
616
|
}
|
|
619
617
|
interface ClearinghouseState {
|
|
620
618
|
assetPositions: AssetPosition[];
|
|
@@ -685,8 +683,6 @@ interface RawAssetDto {
|
|
|
685
683
|
size: number;
|
|
686
684
|
side: string;
|
|
687
685
|
fundingPaid?: number;
|
|
688
|
-
marketPrefix?: string | null;
|
|
689
|
-
collateralToken?: CollateralToken;
|
|
690
686
|
leverage: number;
|
|
691
687
|
}
|
|
692
688
|
/**
|
|
@@ -722,6 +718,10 @@ interface ActiveAssetData {
|
|
|
722
718
|
markPx: string;
|
|
723
719
|
}
|
|
724
720
|
interface TokenMetadata {
|
|
721
|
+
assetName: string;
|
|
722
|
+
symbolName: string;
|
|
723
|
+
marketName: string;
|
|
724
|
+
isAtOiCaps: boolean;
|
|
725
725
|
currentPrice: number;
|
|
726
726
|
prevDayPrice: number;
|
|
727
727
|
priceChange24h: number;
|
|
@@ -756,30 +756,9 @@ interface AssetMarketData {
|
|
|
756
756
|
asset: WebData3AssetCtx | AssetCtx;
|
|
757
757
|
universe: UniverseAsset;
|
|
758
758
|
}
|
|
759
|
-
/**
|
|
760
|
-
* Nested market data structure for multi-market assets.
|
|
761
|
-
* Each symbol maps to its market variants (keyed by prefix).
|
|
762
|
-
* For non-HIP3 assets, use "default" as the key.
|
|
763
|
-
*
|
|
764
|
-
* @example
|
|
765
|
-
* ```ts
|
|
766
|
-
* {
|
|
767
|
-
* "TSLA": {
|
|
768
|
-
* "xyz": { asset: {...}, universe: { collateralToken: "USDC", ... } },
|
|
769
|
-
* "flx": { asset: {...}, universe: { collateralToken: "USDH", ... } }
|
|
770
|
-
* },
|
|
771
|
-
* "BTC": {
|
|
772
|
-
* "default": { asset: {...}, universe: {...} }
|
|
773
|
-
* }
|
|
774
|
-
* }
|
|
775
|
-
* ```
|
|
776
|
-
*/
|
|
777
|
-
type MarketDataBySymbol = Record<string, Record<string, AssetMarketData>>;
|
|
778
759
|
interface PairAssetDto {
|
|
779
760
|
asset: string;
|
|
780
761
|
weight: number;
|
|
781
|
-
collateralToken: CollateralToken;
|
|
782
|
-
marketPrefix: string | null;
|
|
783
762
|
}
|
|
784
763
|
interface ActiveAssetGroupItem {
|
|
785
764
|
longAssets: PairAssetDto[];
|
|
@@ -802,12 +781,6 @@ interface ActiveAssetsResponse {
|
|
|
802
781
|
highlighted: ActiveAssetGroupItem[];
|
|
803
782
|
watchlist: ActiveAssetGroupItem[];
|
|
804
783
|
}
|
|
805
|
-
interface ActiveAssetsAllResponse {
|
|
806
|
-
active: ActiveAssetGroupItem[];
|
|
807
|
-
all: ActiveAssetGroupItem[];
|
|
808
|
-
highlighted: ActiveAssetGroupItem[];
|
|
809
|
-
watchlist: ActiveAssetGroupItem[];
|
|
810
|
-
}
|
|
811
784
|
/**
|
|
812
785
|
* Candle interval options
|
|
813
786
|
*/
|
|
@@ -899,33 +872,11 @@ interface UserSelectionState {
|
|
|
899
872
|
declare const useUserSelection: () => UserSelectionState;
|
|
900
873
|
|
|
901
874
|
/**
|
|
902
|
-
* Hook to access webData
|
|
875
|
+
* Hook to access webData
|
|
903
876
|
*/
|
|
904
|
-
declare const
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
/**
|
|
908
|
-
* Market data keyed by symbol, with nested market variants.
|
|
909
|
-
* Each symbol maps to its market variants (keyed by prefix).
|
|
910
|
-
* For non-HIP3 assets, use "default" as the key.
|
|
911
|
-
*
|
|
912
|
-
* @example
|
|
913
|
-
* ```ts
|
|
914
|
-
* // HIP-3 asset with multiple markets
|
|
915
|
-
* marketDataBySymbol["TSLA"]["xyz"] // { asset, universe: { collateralToken: "USDC" } }
|
|
916
|
-
* marketDataBySymbol["TSLA"]["flx"] // { asset, universe: { collateralToken: "USDH" } }
|
|
917
|
-
*
|
|
918
|
-
* // Regular asset
|
|
919
|
-
* marketDataBySymbol["BTC"]["default"] // { asset, universe }
|
|
920
|
-
* ```
|
|
921
|
-
*/
|
|
922
|
-
marketDataBySymbol: MarketDataBySymbol;
|
|
923
|
-
/** Map of display name -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"]) */
|
|
924
|
-
hip3Assets: Map<string, string[]>;
|
|
925
|
-
/** Map of full market name -> prefix (e.g., "xyz:TSLA" -> "xyz") */
|
|
926
|
-
hip3MarketPrefixes: Map<string, string>;
|
|
927
|
-
isConnected: boolean;
|
|
928
|
-
error: string | null;
|
|
877
|
+
declare const useMarket: () => {
|
|
878
|
+
allTokenMetadata: TokenMetadata[];
|
|
879
|
+
getAssetByName: (symbol: string) => TokenMetadata | null;
|
|
929
880
|
};
|
|
930
881
|
|
|
931
882
|
interface UseTokenSelectionMetadataReturn {
|
|
@@ -1140,7 +1091,7 @@ interface CreatePositionResponseDto {
|
|
|
1140
1091
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
1141
1092
|
* @throws MaxAssetsPerLegError if any leg exceeds the maximum allowed assets (15)
|
|
1142
1093
|
*/
|
|
1143
|
-
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput
|
|
1094
|
+
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
1144
1095
|
interface UpdateRiskParametersRequestInput {
|
|
1145
1096
|
stopLoss?: TpSlThresholdInput | null;
|
|
1146
1097
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -1207,7 +1158,7 @@ interface AdjustAdvanceResponseDto {
|
|
|
1207
1158
|
status: string;
|
|
1208
1159
|
executedAt: string;
|
|
1209
1160
|
}
|
|
1210
|
-
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[]
|
|
1161
|
+
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[]): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
1211
1162
|
declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
1212
1163
|
interface UpdateLeverageRequestInput {
|
|
1213
1164
|
leverage: number;
|
|
@@ -1272,14 +1223,11 @@ declare function useNotifications(): UseNotificationsResult;
|
|
|
1272
1223
|
|
|
1273
1224
|
type CollateralFilter = 'USDC' | 'USDH' | 'ALL';
|
|
1274
1225
|
declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
|
|
1275
|
-
declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
|
|
1276
|
-
declare const usePerpMetaAssets: () => UniverseAsset[] | null;
|
|
1277
1226
|
declare const useActiveBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1278
1227
|
declare const useTopGainers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1279
1228
|
declare const useTopLosers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1280
1229
|
declare const useHighlightedBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1281
1230
|
declare const useWatchlistBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1282
|
-
declare const useAllBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1283
1231
|
declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
|
|
1284
1232
|
|
|
1285
1233
|
declare function useWatchlist(): {
|
|
@@ -1413,7 +1361,7 @@ declare function markNotificationReadById(baseUrl: string, id: string): Promise<
|
|
|
1413
1361
|
updated: number;
|
|
1414
1362
|
}>>;
|
|
1415
1363
|
|
|
1416
|
-
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[]
|
|
1364
|
+
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[]): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
1417
1365
|
|
|
1418
1366
|
interface KalshiPriceRange {
|
|
1419
1367
|
start: string;
|
|
@@ -1537,30 +1485,6 @@ declare class ConflictDetector {
|
|
|
1537
1485
|
* Extracts token metadata from aggregated WebData3 contexts and AllMids data
|
|
1538
1486
|
*/
|
|
1539
1487
|
declare class TokenMetadataExtractor {
|
|
1540
|
-
/**
|
|
1541
|
-
* Extracts comprehensive token metadata
|
|
1542
|
-
* @param symbol - Token symbol (base symbol without prefix, e.g., "TSLA")
|
|
1543
|
-
* @param perpMetaAssets - Aggregated universe assets (flattened across dexes)
|
|
1544
|
-
* @param finalAssetContexts - Aggregated asset contexts (flattened across dexes)
|
|
1545
|
-
* @param allMids - AllMids data containing current prices
|
|
1546
|
-
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1547
|
-
* @param marketPrefix - Optional market prefix (e.g., "xyz", "flx") for HIP3 multi-market assets
|
|
1548
|
-
* @returns TokenMetadata or null if token not found
|
|
1549
|
-
*/
|
|
1550
|
-
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null, marketPrefix?: string | null): TokenMetadata | null;
|
|
1551
|
-
/**
|
|
1552
|
-
* Extracts metadata for multiple tokens
|
|
1553
|
-
* @param tokens - Array of token objects with symbol and optional marketPrefix
|
|
1554
|
-
* @param perpMetaAssets - Aggregated universe assets
|
|
1555
|
-
* @param finalAssetContexts - Aggregated asset contexts
|
|
1556
|
-
* @param allMids - AllMids data
|
|
1557
|
-
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1558
|
-
* @returns Record of unique key to TokenMetadata. Key is "{prefix}:{symbol}" for HIP3 assets, or just "{symbol}" otherwise
|
|
1559
|
-
*/
|
|
1560
|
-
static extractMultipleTokensMetadata(tokens: Array<{
|
|
1561
|
-
symbol: string;
|
|
1562
|
-
marketPrefix?: string | null;
|
|
1563
|
-
}>, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
|
|
1564
1488
|
/**
|
|
1565
1489
|
* Checks if token data is available in aggregated universe assets
|
|
1566
1490
|
* @param symbol - Token symbol
|
|
@@ -1568,8 +1492,23 @@ declare class TokenMetadataExtractor {
|
|
|
1568
1492
|
* @returns boolean indicating if token exists in universe
|
|
1569
1493
|
*/
|
|
1570
1494
|
static isTokenAvailable(symbol: string, perpMetaAssets: UniverseAsset[] | null): boolean;
|
|
1495
|
+
/**
|
|
1496
|
+
* Extracts token metadata using DEX-aware lookup (correctly matches perpMetas to assetContexts)
|
|
1497
|
+
* @param symbol - Token symbol (e.g., "BTC", "TSLA")
|
|
1498
|
+
* @param perpMetasByDex - Map of DEX name to UniverseAsset[]
|
|
1499
|
+
* @param assetContextsByDex - Map of DEX name to WebData3AssetCtx[]
|
|
1500
|
+
* @param allMids - AllMids data containing current prices
|
|
1501
|
+
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1502
|
+
* @param finalAtOICaps - Optional array of symbols at OI caps
|
|
1503
|
+
* @returns TokenMetadata or null if token not found
|
|
1504
|
+
*/
|
|
1505
|
+
static extractTokenMetadataByDex(symbol: string, perpMetasByDex: Map<string, UniverseAsset[]>, assetContextsByDex: Map<string, WebData3AssetCtx[]>, allMids: WsAllMidsData, activeAssetData?: Record<string, ActiveAssetData> | null, finalAtOICaps?: string[] | null): TokenMetadata | null;
|
|
1571
1506
|
}
|
|
1572
1507
|
|
|
1508
|
+
type TokenMetadataBySymbol = Record<string, TokenMetadata | null>;
|
|
1509
|
+
declare const selectTokenMetadataBySymbols: (tokenMetadata: TokenMetadataBySymbol, symbols: string[]) => TokenMetadataBySymbol;
|
|
1510
|
+
declare const getAssetByName: (tokenMetadata: TokenMetadataBySymbol, symbol: string) => TokenMetadata | null;
|
|
1511
|
+
|
|
1573
1512
|
/**
|
|
1574
1513
|
* Create efficient timestamp-based lookup maps for candle data
|
|
1575
1514
|
*/
|
|
@@ -1664,47 +1603,6 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
|
|
|
1664
1603
|
minimumRequired?: number;
|
|
1665
1604
|
};
|
|
1666
1605
|
|
|
1667
|
-
/**
|
|
1668
|
-
* Convert a full/prefixed symbol (e.g., "xyz:XYZ100") to a display symbol (e.g., "XYZ100").
|
|
1669
|
-
*/
|
|
1670
|
-
declare function toDisplaySymbol(symbol: string): string;
|
|
1671
|
-
/**
|
|
1672
|
-
* Convert a display symbol back to backend form using a provided map.
|
|
1673
|
-
* If mapping is missing, returns the original symbol.
|
|
1674
|
-
* For multi-market assets, returns the first available market.
|
|
1675
|
-
* @param displaySymbol e.g., "TSLA"
|
|
1676
|
-
* @param hip3Assets map of display -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"])
|
|
1677
|
-
*/
|
|
1678
|
-
declare function toBackendSymbol(displaySymbol: string, hip3Assets: Map<string, string[]>): string;
|
|
1679
|
-
/**
|
|
1680
|
-
* Convert a display symbol to backend form for a specific market prefix.
|
|
1681
|
-
* This is useful when an asset is available on multiple markets (e.g., xyz:TSLA and flx:TSLA).
|
|
1682
|
-
* @param displaySymbol e.g., "TSLA"
|
|
1683
|
-
* @param marketPrefix e.g., "xyz" or "flx"
|
|
1684
|
-
* @param hip3Assets map of display -> all full market names
|
|
1685
|
-
* @returns Full market name if found, null if prefix not specified for multi-market asset, otherwise displaySymbol with prefix
|
|
1686
|
-
*/
|
|
1687
|
-
declare function toBackendSymbolWithMarket(displaySymbol: string, marketPrefix: string | undefined, hip3Assets: Map<string, string[]>): string | null;
|
|
1688
|
-
/**
|
|
1689
|
-
* Get all available markets for a display symbol.
|
|
1690
|
-
* @param displaySymbol e.g., "TSLA"
|
|
1691
|
-
* @param hip3Assets map of display -> all full market names
|
|
1692
|
-
* @returns Array of full market names, e.g., ["xyz:TSLA", "flx:TSLA"]
|
|
1693
|
-
*/
|
|
1694
|
-
declare function getAvailableMarkets(displaySymbol: string, hip3Assets: Map<string, string[]>): string[];
|
|
1695
|
-
/**
|
|
1696
|
-
* Extract the market prefix from a full market name.
|
|
1697
|
-
* @param fullSymbol e.g., "xyz:TSLA"
|
|
1698
|
-
* @returns The prefix (e.g., "xyz") or undefined if no prefix
|
|
1699
|
-
*/
|
|
1700
|
-
declare function getMarketPrefix(fullSymbol: string): string | undefined;
|
|
1701
|
-
/**
|
|
1702
|
-
* Check if a symbol is a HIP-3 market (has a prefix).
|
|
1703
|
-
* @param symbol e.g., "xyz:TSLA" or "TSLA"
|
|
1704
|
-
* @returns true if the symbol has a market prefix
|
|
1705
|
-
*/
|
|
1706
|
-
declare function isHip3Market(symbol: string): boolean;
|
|
1707
|
-
|
|
1708
1606
|
/**
|
|
1709
1607
|
* Helper functions to safely extract values from order parameters
|
|
1710
1608
|
* based on the order type and parameter structure.
|
|
@@ -1764,12 +1662,10 @@ declare function getOrderTrailingInfo(order: OpenLimitOrderDto): {
|
|
|
1764
1662
|
|
|
1765
1663
|
interface MarketDataState {
|
|
1766
1664
|
marketData: ActiveAssetsResponse | null;
|
|
1767
|
-
marketDataAll: ActiveAssetsAllResponse | null;
|
|
1768
1665
|
setMarketData: (value: ActiveAssetsResponse | null) => void;
|
|
1769
|
-
setMarketDataAll: (value: ActiveAssetsAllResponse | null) => void;
|
|
1770
1666
|
clean: () => void;
|
|
1771
1667
|
}
|
|
1772
1668
|
declare const useMarketData: zustand.UseBoundStore<zustand.StoreApi<MarketDataState>>;
|
|
1773
1669
|
|
|
1774
|
-
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,
|
|
1775
|
-
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, BalanceSummaryDto, BaseTriggerOrderNotificationParams, BtcDomTriggerParams, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto, CollateralFilter, CollateralToken, CreatePositionRequestInput, CreatePositionResponseDto, CrossAssetPriceTriggerParams, CrossMarginSummaryDto, CumFundingDto, ExecutionType, ExtraAgent, GetKalshiMarketsParams, HLWebSocketResponse, HistoricalRange, KalshiMarket, KalshiMarketsResponse, KalshiMveLeg, KalshiPriceRange, LadderConfigInput, MarginSummaryDto,
|
|
1670
|
+
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, getAssetByName, getCompleteTimestamps, getKalshiMarkets, getOrderDirection, getOrderLadderConfig, getOrderLeverage, getOrderReduceOnly, getOrderTpSlTriggerType, getOrderTrailingInfo, getOrderTriggerType, getOrderTriggerValue, getOrderTwapDuration, getOrderUsdValue, getPortfolio, isBtcDomOrder, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, selectTokenMetadataBySymbols, toggleWatchlist, updateLeverage, updateRiskParameters, useAccountSummary, useActiveBaskets, useAgentWallet, useAllUserBalances, useAuth, useBasketCandles, useFindBasket, useHighlightedBaskets, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidUserFills, useHyperliquidWebSocket, useMarket, useMarketData, useMarketDataPayload, useNotifications, useOpenOrders, useOrders, usePearHyperliquid, usePerformanceOverlays, usePortfolio, usePosition, useSpotOrder, useTokenSelectionMetadata, useTopGainers, useTopLosers, useTradeHistories, useTwap, useUserSelection, useWatchlist, useWatchlistBaskets, validateMaxAssetsPerLeg, validateMinimumAssetSize, validatePositionSize };
|
|
1671
|
+
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, BalanceSummaryDto, BaseTriggerOrderNotificationParams, BtcDomTriggerParams, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto, CollateralFilter, CollateralToken, CreatePositionRequestInput, CreatePositionResponseDto, CrossAssetPriceTriggerParams, CrossMarginSummaryDto, CumFundingDto, ExecutionType, ExtraAgent, GetKalshiMarketsParams, HLWebSocketResponse, HistoricalRange, KalshiMarket, KalshiMarketsResponse, KalshiMveLeg, KalshiPriceRange, LadderConfigInput, MarginSummaryDto, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderStatus, PairAssetDto, PairAssetInput, PerformanceOverlay, PlatformAccountSummaryResponseDto, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PredictionMarketOutcomeTriggerParams, PriceRatioTriggerParams, PriceTriggerParams, RealtimeBar, RealtimeBarsCallback, SpotBalance, SpotOrderFilledStatus, SpotOrderHyperliquidData, SpotOrderHyperliquidResult, SpotOrderRequestInput, SpotOrderResponseDto, SpotState, ToggleWatchlistResponseDto, TokenConflict, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TpSlOrderParameters, TpSlThresholdInput, TpSlThresholdType, TpSlTriggerType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TriggerOrderNotificationAsset, TriggerOrderNotificationParams, TriggerOrderNotificationType, TriggerOrderParameters, TriggerType, TwapChunkStatusDto, TwapMonitoringDto, TwapSliceFillResponseItem, UniverseAsset, UpdateLeverageRequestInput, UpdateLeverageResponseDto, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseHyperliquidUserFillsOptions, UseHyperliquidUserFillsState, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseSpotOrderResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistItemDto, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|