@pear-protocol/hyperliquid-sdk 0.0.60-beta → 0.0.60-beta-usdh
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 +124 -45
- package/dist/index.js +655 -259
- 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 +36 -3
- package/dist/utils/symbol-translator.d.ts +32 -3
- package/dist/utils/token-metadata-extractor.d.ts +9 -5
- package/package.json +3 -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;
|
|
@@ -227,6 +226,8 @@ interface PositionAssetDetailDto {
|
|
|
227
226
|
liquidationPrice: number;
|
|
228
227
|
initialWeight: number;
|
|
229
228
|
fundingPaid?: number;
|
|
229
|
+
marketPrefix?: string | null;
|
|
230
|
+
collateralToken?: CollateralToken;
|
|
230
231
|
}
|
|
231
232
|
interface TpSlThreshold {
|
|
232
233
|
type: 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
|
|
@@ -398,7 +399,7 @@ interface AgentWalletState {
|
|
|
398
399
|
* WebSocket message from HyperLiquid native API
|
|
399
400
|
*/
|
|
400
401
|
interface WebSocketMessage {
|
|
401
|
-
method:
|
|
402
|
+
method: 'subscribe' | 'unsubscribe';
|
|
402
403
|
subscription: {
|
|
403
404
|
type: string;
|
|
404
405
|
dex?: string;
|
|
@@ -472,6 +473,12 @@ interface AssetCtx {
|
|
|
472
473
|
impactPxs?: string[];
|
|
473
474
|
oraclePx: string;
|
|
474
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Collateral token type
|
|
478
|
+
* 0 = USDC
|
|
479
|
+
* 360 = USDH
|
|
480
|
+
*/
|
|
481
|
+
type CollateralToken = 'USDC' | 'USDH';
|
|
475
482
|
/**
|
|
476
483
|
* Universe asset metadata
|
|
477
484
|
*/
|
|
@@ -481,6 +488,8 @@ interface UniverseAsset {
|
|
|
481
488
|
maxLeverage: number;
|
|
482
489
|
onlyIsolated?: boolean;
|
|
483
490
|
isDelisted?: boolean;
|
|
491
|
+
marketPrefix?: string;
|
|
492
|
+
collateralToken?: CollateralToken;
|
|
484
493
|
}
|
|
485
494
|
interface ClearinghouseState {
|
|
486
495
|
assetPositions: AssetPosition[];
|
|
@@ -598,6 +607,7 @@ interface TokenMetadata {
|
|
|
598
607
|
leverage?: LeverageInfo;
|
|
599
608
|
maxTradeSzs?: [string, string];
|
|
600
609
|
availableToTrade?: [string, string];
|
|
610
|
+
collateralToken?: CollateralToken;
|
|
601
611
|
}
|
|
602
612
|
/**
|
|
603
613
|
* Enhanced token selection with weight and metadata for basket trading
|
|
@@ -618,9 +628,30 @@ interface AssetMarketData {
|
|
|
618
628
|
asset: WebData3AssetCtx | AssetCtx;
|
|
619
629
|
universe: UniverseAsset;
|
|
620
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Nested market data structure for multi-market assets.
|
|
633
|
+
* Each symbol maps to its market variants (keyed by prefix).
|
|
634
|
+
* For non-HIP3 assets, use "default" as the key.
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* ```ts
|
|
638
|
+
* {
|
|
639
|
+
* "TSLA": {
|
|
640
|
+
* "xyz": { asset: {...}, universe: { collateralToken: "USDC", ... } },
|
|
641
|
+
* "flx": { asset: {...}, universe: { collateralToken: "USDH", ... } }
|
|
642
|
+
* },
|
|
643
|
+
* "BTC": {
|
|
644
|
+
* "default": { asset: {...}, universe: {...} }
|
|
645
|
+
* }
|
|
646
|
+
* }
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
type MarketDataBySymbol = Record<string, Record<string, AssetMarketData>>;
|
|
621
650
|
interface PairAssetDto {
|
|
622
651
|
asset: string;
|
|
623
652
|
weight: number;
|
|
653
|
+
collateralToken: CollateralToken;
|
|
654
|
+
marketPrefix: string | null;
|
|
624
655
|
}
|
|
625
656
|
interface ActiveAssetGroupItem {
|
|
626
657
|
longAssets: PairAssetDto[];
|
|
@@ -634,6 +665,7 @@ interface ActiveAssetGroupItem {
|
|
|
634
665
|
weightedRatio?: string;
|
|
635
666
|
weightedPrevRatio?: string;
|
|
636
667
|
weightedChange24h?: string;
|
|
668
|
+
collateralType: 'USDC' | 'USDH' | 'MIXED';
|
|
637
669
|
}
|
|
638
670
|
interface ActiveAssetsResponse {
|
|
639
671
|
active: ActiveAssetGroupItem[];
|
|
@@ -651,7 +683,7 @@ interface ActiveAssetsAllResponse {
|
|
|
651
683
|
/**
|
|
652
684
|
* Candle interval options
|
|
653
685
|
*/
|
|
654
|
-
type CandleInterval =
|
|
686
|
+
type CandleInterval = '1m' | '3m' | '5m' | '15m' | '30m' | '1h' | '2h' | '4h' | '8h' | '12h' | '1d' | '3d' | '1w' | '1M';
|
|
655
687
|
/**
|
|
656
688
|
* Candle data structure from WebSocket
|
|
657
689
|
*/
|
|
@@ -679,7 +711,7 @@ interface CandleSnapshotRequest {
|
|
|
679
711
|
endTime: number;
|
|
680
712
|
interval: CandleInterval;
|
|
681
713
|
};
|
|
682
|
-
type:
|
|
714
|
+
type: 'candleSnapshot';
|
|
683
715
|
}
|
|
684
716
|
interface TokenSelectorConfig {
|
|
685
717
|
isLong: boolean;
|
|
@@ -735,8 +767,26 @@ declare const useUserSelection: () => UserSelectionState;
|
|
|
735
767
|
declare const useWebData: () => {
|
|
736
768
|
clearinghouseState: ClearinghouseState | null;
|
|
737
769
|
perpsAtOpenInterestCap: string[] | null;
|
|
738
|
-
|
|
739
|
-
|
|
770
|
+
/**
|
|
771
|
+
* Market data keyed by symbol, with nested market variants.
|
|
772
|
+
* Each symbol maps to its market variants (keyed by prefix).
|
|
773
|
+
* For non-HIP3 assets, use "default" as the key.
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```ts
|
|
777
|
+
* // HIP-3 asset with multiple markets
|
|
778
|
+
* marketDataBySymbol["TSLA"]["xyz"] // { asset, universe: { collateralToken: "USDC" } }
|
|
779
|
+
* marketDataBySymbol["TSLA"]["flx"] // { asset, universe: { collateralToken: "USDH" } }
|
|
780
|
+
*
|
|
781
|
+
* // Regular asset
|
|
782
|
+
* marketDataBySymbol["BTC"]["default"] // { asset, universe }
|
|
783
|
+
* ```
|
|
784
|
+
*/
|
|
785
|
+
marketDataBySymbol: MarketDataBySymbol;
|
|
786
|
+
/** Map of display name -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"]) */
|
|
787
|
+
hip3Assets: Map<string, string[]>;
|
|
788
|
+
/** Map of full market name -> prefix (e.g., "xyz:TSLA" -> "xyz") */
|
|
789
|
+
hip3MarketPrefixes: Map<string, string>;
|
|
740
790
|
isConnected: boolean;
|
|
741
791
|
error: string | null;
|
|
742
792
|
};
|
|
@@ -770,18 +820,7 @@ interface TokenHistoricalPriceData {
|
|
|
770
820
|
oldestTime: number | null;
|
|
771
821
|
latestTime: number | null;
|
|
772
822
|
}
|
|
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>>;
|
|
823
|
+
declare const useHistoricalPriceDataStore: any;
|
|
785
824
|
|
|
786
825
|
interface UseHistoricalPriceDataReturn {
|
|
787
826
|
fetchHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval, callback?: (data: Record<string, CandleData[]>) => void) => Promise<Record<string, CandleData[]>>;
|
|
@@ -938,7 +977,7 @@ interface CreatePositionResponseDto {
|
|
|
938
977
|
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
939
978
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
940
979
|
*/
|
|
941
|
-
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput,
|
|
980
|
+
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, hip3Assets: Map<string, string[]>): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
942
981
|
interface UpdateRiskParametersRequestInput {
|
|
943
982
|
stopLoss?: TpSlThresholdInput | null;
|
|
944
983
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -1005,7 +1044,7 @@ interface AdjustAdvanceResponseDto {
|
|
|
1005
1044
|
status: string;
|
|
1006
1045
|
executedAt: string;
|
|
1007
1046
|
}
|
|
1008
|
-
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[],
|
|
1047
|
+
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
1009
1048
|
declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
1010
1049
|
|
|
1011
1050
|
declare function usePosition(): {
|
|
@@ -1048,14 +1087,16 @@ interface UseNotificationsResult {
|
|
|
1048
1087
|
*/
|
|
1049
1088
|
declare function useNotifications(): UseNotificationsResult;
|
|
1050
1089
|
|
|
1090
|
+
type CollateralFilter = 'USDC' | 'USDH' | 'ALL';
|
|
1051
1091
|
declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
|
|
1052
1092
|
declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
|
|
1053
|
-
declare const
|
|
1054
|
-
declare const
|
|
1055
|
-
declare const
|
|
1056
|
-
declare const
|
|
1057
|
-
declare const
|
|
1058
|
-
declare const
|
|
1093
|
+
declare const usePerpMetaAssets: () => UniverseAsset[] | null;
|
|
1094
|
+
declare const useActiveBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1095
|
+
declare const useTopGainers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1096
|
+
declare const useTopLosers: (limit?: number, collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1097
|
+
declare const useHighlightedBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1098
|
+
declare const useWatchlistBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1099
|
+
declare const useAllBaskets: (collateralFilter?: CollateralFilter) => ActiveAssetGroupItem[];
|
|
1059
1100
|
declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
|
|
1060
1101
|
|
|
1061
1102
|
declare function useWatchlist(): {
|
|
@@ -1118,9 +1159,9 @@ declare function usePortfolio(): UsePortfolioResult;
|
|
|
1118
1159
|
|
|
1119
1160
|
declare function useAuth(): {
|
|
1120
1161
|
readonly isReady: boolean;
|
|
1121
|
-
readonly isAuthenticated:
|
|
1122
|
-
readonly accessToken:
|
|
1123
|
-
readonly refreshToken:
|
|
1162
|
+
readonly isAuthenticated: any;
|
|
1163
|
+
readonly accessToken: any;
|
|
1164
|
+
readonly refreshToken: any;
|
|
1124
1165
|
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
1125
1166
|
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
1126
1167
|
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
@@ -1162,7 +1203,7 @@ declare function markNotificationReadById(baseUrl: string, id: string): Promise<
|
|
|
1162
1203
|
updated: number;
|
|
1163
1204
|
}>>;
|
|
1164
1205
|
|
|
1165
|
-
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[],
|
|
1206
|
+
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], hip3Assets: Map<string, string[]>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
1166
1207
|
|
|
1167
1208
|
/**
|
|
1168
1209
|
* Account summary calculation utility class
|
|
@@ -1201,24 +1242,28 @@ declare class ConflictDetector {
|
|
|
1201
1242
|
declare class TokenMetadataExtractor {
|
|
1202
1243
|
/**
|
|
1203
1244
|
* Extracts comprehensive token metadata
|
|
1204
|
-
* @param symbol - Token symbol
|
|
1245
|
+
* @param symbol - Token symbol (base symbol without prefix, e.g., "TSLA")
|
|
1205
1246
|
* @param perpMetaAssets - Aggregated universe assets (flattened across dexes)
|
|
1206
1247
|
* @param finalAssetContexts - Aggregated asset contexts (flattened across dexes)
|
|
1207
1248
|
* @param allMids - AllMids data containing current prices
|
|
1208
1249
|
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1250
|
+
* @param marketPrefix - Optional market prefix (e.g., "xyz", "flx") for HIP3 multi-market assets
|
|
1209
1251
|
* @returns TokenMetadata or null if token not found
|
|
1210
1252
|
*/
|
|
1211
|
-
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): TokenMetadata | null;
|
|
1253
|
+
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null, marketPrefix?: string | null): TokenMetadata | null;
|
|
1212
1254
|
/**
|
|
1213
1255
|
* Extracts metadata for multiple tokens
|
|
1214
|
-
* @param
|
|
1256
|
+
* @param tokens - Array of token objects with symbol and optional marketPrefix
|
|
1215
1257
|
* @param perpMetaAssets - Aggregated universe assets
|
|
1216
1258
|
* @param finalAssetContexts - Aggregated asset contexts
|
|
1217
1259
|
* @param allMids - AllMids data
|
|
1218
1260
|
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1219
|
-
* @returns Record of
|
|
1261
|
+
* @returns Record of unique key to TokenMetadata. Key is "{prefix}:{symbol}" for HIP3 assets, or just "{symbol}" otherwise
|
|
1220
1262
|
*/
|
|
1221
|
-
static extractMultipleTokensMetadata(
|
|
1263
|
+
static extractMultipleTokensMetadata(tokens: Array<{
|
|
1264
|
+
symbol: string;
|
|
1265
|
+
marketPrefix?: string | null;
|
|
1266
|
+
}>, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
|
|
1222
1267
|
/**
|
|
1223
1268
|
* Checks if token data is available in aggregated universe assets
|
|
1224
1269
|
* @param symbol - Token symbol
|
|
@@ -1302,14 +1347,48 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
|
|
|
1302
1347
|
minimumRequired?: number;
|
|
1303
1348
|
};
|
|
1304
1349
|
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1350
|
+
/**
|
|
1351
|
+
* Convert a full/prefixed symbol (e.g., "xyz:XYZ100") to a display symbol (e.g., "XYZ100").
|
|
1352
|
+
*/
|
|
1353
|
+
declare function toDisplaySymbol(symbol: string): string;
|
|
1354
|
+
/**
|
|
1355
|
+
* Convert a display symbol back to backend form using a provided map.
|
|
1356
|
+
* If mapping is missing, returns the original symbol.
|
|
1357
|
+
* For multi-market assets, returns the first available market.
|
|
1358
|
+
* @param displaySymbol e.g., "TSLA"
|
|
1359
|
+
* @param hip3Assets map of display -> all full market names (e.g., "TSLA" -> ["xyz:TSLA", "flx:TSLA"])
|
|
1360
|
+
*/
|
|
1361
|
+
declare function toBackendSymbol(displaySymbol: string, hip3Assets: Map<string, string[]>): string;
|
|
1362
|
+
/**
|
|
1363
|
+
* Convert a display symbol to backend form for a specific market prefix.
|
|
1364
|
+
* This is useful when an asset is available on multiple markets (e.g., xyz:TSLA and flx:TSLA).
|
|
1365
|
+
* @param displaySymbol e.g., "TSLA"
|
|
1366
|
+
* @param marketPrefix e.g., "xyz" or "flx"
|
|
1367
|
+
* @param hip3Assets map of display -> all full market names
|
|
1368
|
+
* @returns Full market name if found, null if prefix not specified for multi-market asset, otherwise displaySymbol with prefix
|
|
1369
|
+
*/
|
|
1370
|
+
declare function toBackendSymbolWithMarket(displaySymbol: string, marketPrefix: string | undefined, hip3Assets: Map<string, string[]>): string | null;
|
|
1371
|
+
/**
|
|
1372
|
+
* Get all available markets for a display symbol.
|
|
1373
|
+
* @param displaySymbol e.g., "TSLA"
|
|
1374
|
+
* @param hip3Assets map of display -> all full market names
|
|
1375
|
+
* @returns Array of full market names, e.g., ["xyz:TSLA", "flx:TSLA"]
|
|
1376
|
+
*/
|
|
1377
|
+
declare function getAvailableMarkets(displaySymbol: string, hip3Assets: Map<string, string[]>): string[];
|
|
1378
|
+
/**
|
|
1379
|
+
* Extract the market prefix from a full market name.
|
|
1380
|
+
* @param fullSymbol e.g., "xyz:TSLA"
|
|
1381
|
+
* @returns The prefix (e.g., "xyz") or undefined if no prefix
|
|
1382
|
+
*/
|
|
1383
|
+
declare function getMarketPrefix(fullSymbol: string): string | undefined;
|
|
1384
|
+
/**
|
|
1385
|
+
* Check if a symbol is a HIP-3 market (has a prefix).
|
|
1386
|
+
* @param symbol e.g., "xyz:TSLA" or "TSLA"
|
|
1387
|
+
* @returns true if the symbol has a market prefix
|
|
1388
|
+
*/
|
|
1389
|
+
declare function isHip3Market(symbol: string): boolean;
|
|
1390
|
+
|
|
1391
|
+
declare const useMarketData: any;
|
|
1313
1392
|
|
|
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 };
|
|
1393
|
+
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 };
|
|
1394
|
+
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 };
|