@pear-protocol/hyperliquid-sdk 0.0.49 → 0.0.50
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 +14 -2
- package/dist/clients/positions.d.ts +1 -1
- package/dist/clients/sync.d.ts +1 -1
- package/dist/clients/watchlist.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useAccountSummary.d.ts +5 -0
- package/dist/hooks/useAgentWallet.d.ts +4 -9
- package/dist/hooks/usePortfolio.d.ts +1 -1
- package/dist/hooks/useTrading.d.ts +1 -8
- package/dist/hooks/useWebData.d.ts +3 -2
- package/dist/hyperliquid-websocket.d.ts +2 -1
- package/dist/index.d.ts +81 -96
- package/dist/index.js +399 -307
- package/dist/provider.d.ts +0 -20
- package/dist/store/tokenSelectionMetadataStore.d.ts +3 -2
- package/dist/types.d.ts +66 -21
- package/dist/utils/account-summary-calculator.d.ts +6 -13
- package/dist/utils/position-processor.d.ts +2 -2
- package/dist/utils/symbol-translator.d.ts +11 -0
- package/dist/utils/token-metadata-extractor.d.ts +11 -9
- package/dist/websocket.d.ts +2 -1
- package/package.json +1 -1
- package/README.md +0 -735
- package/dist/hooks/useAddress.d.ts +0 -9
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import type { ApiResponse, CandleInterval, CandleData, ExternalFillDto } from '../types';
|
|
1
|
+
import type { ApiResponse, CandleInterval, CandleData, ExternalFillDto, AllPerpMetasResponse, ExtraAgent } 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) => Promise<ApiResponse<CandleData[]>>;
|
|
5
|
+
export declare const fetchHistoricalCandles: (coin: string, startTime: number, endTime: number, interval: CandleInterval, displayToFull: Map<string, string>) => Promise<ApiResponse<CandleData[]>>;
|
|
6
6
|
/**
|
|
7
7
|
* Retrieve recent user fills from HyperLiquid and map to ExternalFillDto[]
|
|
8
8
|
*/
|
|
9
9
|
export declare const fetchUserFillsFromHyperliquid: (user: string, startTime: number, aggregateByTime?: boolean) => Promise<ApiResponse<ExternalFillDto[]>>;
|
|
10
|
+
/**
|
|
11
|
+
* Fetch all perp metas from HyperLiquid API
|
|
12
|
+
* Endpoint: https://api.hyperliquid.xyz/info
|
|
13
|
+
* Payload: { "type": "allPerpMetas" }
|
|
14
|
+
*/
|
|
15
|
+
export declare const fetchAllPerpMetas: () => Promise<ApiResponse<AllPerpMetasResponse>>;
|
|
16
|
+
/**
|
|
17
|
+
* Fetch extra agent approvals for a given user from HyperLiquid API
|
|
18
|
+
* Endpoint: https://api.hyperliquid.xyz/info
|
|
19
|
+
* Payload: { "type": "extraAgents", "user": "0x..." }
|
|
20
|
+
*/
|
|
21
|
+
export declare const fetchExtraAgents: (user: string) => Promise<ApiResponse<ExtraAgent[]>>;
|
|
@@ -56,7 +56,7 @@ export interface CreatePositionResponseDto {
|
|
|
56
56
|
* Caller should supply an accessToken from localStorage.getItem('accessToken')
|
|
57
57
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
58
58
|
*/
|
|
59
|
-
export declare function createPosition(baseUrl: string, accessToken: string, payload: CreatePositionRequestInput): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
59
|
+
export declare function createPosition(baseUrl: string, accessToken: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
60
60
|
export interface UpdateRiskParametersRequestInput {
|
|
61
61
|
stopLoss?: TpSlThresholdInput | null;
|
|
62
62
|
takeProfit?: TpSlThresholdInput | null;
|
package/dist/clients/sync.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export declare const syncFills: (baseUrl: string, accessToken: string, payload:
|
|
|
6
6
|
/**
|
|
7
7
|
* Convenience: fetch user fills from HyperLiquid, then sync them to Pear backend
|
|
8
8
|
*/
|
|
9
|
-
export declare const syncUserFillsFromHyperliquid: (baseUrl: string, accessToken: string, user: string, aggregateByTime?: boolean) => Promise<ApiResponse<SyncFillsResponseDto>>;
|
|
9
|
+
export declare const syncUserFillsFromHyperliquid: (baseUrl: string, accessToken: string, user: string, aggregateByTime?: boolean, lastSyncAt?: number | null) => Promise<ApiResponse<SyncFillsResponseDto>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ApiResponse, ToggleWatchlistResponseDto, WatchlistAssetDto } from '../types';
|
|
2
|
-
export declare function toggleWatchlist(baseUrl: string, accessToken: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[]): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
2
|
+
export declare function toggleWatchlist(baseUrl: string, accessToken: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly loading: false;
|
|
6
|
-
readonly error: null;
|
|
7
|
-
readonly refreshAgentWalletStatus: () => Promise<GetAgentWalletResponseDto>;
|
|
8
|
-
readonly createAgentWallet: () => Promise<CreateAgentWalletResponseDto>;
|
|
9
|
-
readonly notifyAgentWalletApproved: () => Promise<GetAgentWalletResponseDto>;
|
|
1
|
+
export declare function useAgentWallet(): {
|
|
2
|
+
readonly refreshAgentWalletStatus: () => Promise<void>;
|
|
3
|
+
readonly createAgentWallet: () => Promise<import("../types").CreateAgentWalletResponseDto>;
|
|
4
|
+
readonly notifyAgentWalletApproved: () => Promise<void>;
|
|
10
5
|
};
|
|
@@ -8,6 +8,6 @@ export interface UsePortfolioResult {
|
|
|
8
8
|
/**
|
|
9
9
|
* Hook to fetch and manage portfolio data
|
|
10
10
|
* Returns bucketed volume, open interest snapshot, win/loss trade counts,
|
|
11
|
-
* and overall metrics
|
|
11
|
+
* and overall metrics
|
|
12
12
|
*/
|
|
13
13
|
export declare function usePortfolio(): UsePortfolioResult;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OpenLimitOrderDto } from '../types';
|
|
2
2
|
import type { TradeHistoryDataDto } from '../types';
|
|
3
3
|
export declare const useTradeHistories: () => {
|
|
4
4
|
data: TradeHistoryDataDto[] | null;
|
|
@@ -11,10 +11,3 @@ export declare const useOpenOrders: () => {
|
|
|
11
11
|
data: OpenLimitOrderDto[] | null;
|
|
12
12
|
isLoading: boolean;
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Hook to access account summary with real-time calculations and loading state
|
|
16
|
-
*/
|
|
17
|
-
export declare const useAccountSummary: () => {
|
|
18
|
-
data: AccountSummaryResponseDto | null;
|
|
19
|
-
isLoading: boolean;
|
|
20
|
-
};
|
|
@@ -3,9 +3,10 @@ import type { AssetMarketData, ClearinghouseState } from '../types';
|
|
|
3
3
|
* Hook to access webData and native WebSocket state
|
|
4
4
|
*/
|
|
5
5
|
export declare const useWebData: () => {
|
|
6
|
-
clearinghouseState: ClearinghouseState |
|
|
7
|
-
perpsAtOpenInterestCap: string[] |
|
|
6
|
+
clearinghouseState: ClearinghouseState | null;
|
|
7
|
+
perpsAtOpenInterestCap: string[] | null;
|
|
8
8
|
marketDataBySymbol: Record<string, AssetMarketData>;
|
|
9
|
+
hip3Assets: Map<string, string>;
|
|
9
10
|
isConnected: boolean;
|
|
10
11
|
error: string | null;
|
|
11
12
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export interface UseHyperliquidNativeWebSocketProps {
|
|
2
2
|
address: string | null;
|
|
3
3
|
tokens?: string[];
|
|
4
|
+
enabled?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export interface UseHyperliquidNativeWebSocketReturn {
|
|
6
7
|
isConnected: boolean;
|
|
7
8
|
lastError: string | null;
|
|
8
9
|
}
|
|
9
|
-
export declare const useHyperliquidNativeWebSocket: ({ address, }: UseHyperliquidNativeWebSocketProps) => UseHyperliquidNativeWebSocketReturn;
|
|
10
|
+
export declare const useHyperliquidNativeWebSocket: ({ address, enabled, }: UseHyperliquidNativeWebSocketProps) => UseHyperliquidNativeWebSocketReturn;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ type WebSocketConnectionState = 'connecting' | 'connected' | 'disconnected' | 'e
|
|
|
28
28
|
/**
|
|
29
29
|
* WebSocket channels
|
|
30
30
|
*/
|
|
31
|
-
type WebSocketChannel = 'trade-histories' | 'open-positions' | 'open-orders' | 'account-summary' | 'twap-details' | 'notifications' | 'market-data' | 'market-data-all' | '
|
|
31
|
+
type WebSocketChannel = 'trade-histories' | 'open-positions' | 'open-orders' | 'account-summary' | 'twap-details' | 'notifications' | 'market-data' | 'market-data-all' | 'webData3' | 'allMids' | 'activeAssetData';
|
|
32
32
|
/**
|
|
33
33
|
* WebSocket subscription message
|
|
34
34
|
*/
|
|
@@ -272,15 +272,22 @@ interface BalanceSummaryDto {
|
|
|
272
272
|
* Agent wallet information
|
|
273
273
|
*/
|
|
274
274
|
interface AgentWalletDto {
|
|
275
|
-
address
|
|
275
|
+
address?: string;
|
|
276
276
|
status: string;
|
|
277
277
|
}
|
|
278
|
+
interface PlatformAccountSummaryResponseDto {
|
|
279
|
+
agentWalletAddress: string | null;
|
|
280
|
+
totalClosedTrades: number;
|
|
281
|
+
totalLimitOrderUsdValue?: number;
|
|
282
|
+
totalTwapChunkUsdValue?: number;
|
|
283
|
+
lastSyncedAt?: number;
|
|
284
|
+
}
|
|
278
285
|
/**
|
|
279
286
|
* Account balance response (renamed to AccountSummaryResponseDto for consistency)
|
|
280
287
|
*/
|
|
281
288
|
interface AccountSummaryResponseDto {
|
|
282
289
|
balanceSummary: BalanceSummaryDto;
|
|
283
|
-
agentWallet
|
|
290
|
+
agentWallet?: AgentWalletDto;
|
|
284
291
|
}
|
|
285
292
|
declare enum AuthStatus {
|
|
286
293
|
Idle = "idle",
|
|
@@ -298,17 +305,14 @@ interface UserProfile {
|
|
|
298
305
|
appId: string;
|
|
299
306
|
}
|
|
300
307
|
type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
|
|
301
|
-
interface GetAgentWalletResponseDto {
|
|
302
|
-
agentWalletAddress?: string;
|
|
303
|
-
agentName: string;
|
|
304
|
-
status: AgentWalletStatus;
|
|
305
|
-
}
|
|
306
308
|
interface CreateAgentWalletResponseDto {
|
|
307
309
|
agentWalletAddress: string;
|
|
308
310
|
message: string;
|
|
309
311
|
}
|
|
310
|
-
interface
|
|
311
|
-
|
|
312
|
+
interface ExtraAgent {
|
|
313
|
+
name: string;
|
|
314
|
+
address: string;
|
|
315
|
+
validUntil: number;
|
|
312
316
|
}
|
|
313
317
|
interface AgentWalletState {
|
|
314
318
|
address: string | null;
|
|
@@ -323,6 +327,7 @@ interface WebSocketMessage {
|
|
|
323
327
|
method: "subscribe" | "unsubscribe";
|
|
324
328
|
subscription: {
|
|
325
329
|
type: string;
|
|
330
|
+
dex?: string;
|
|
326
331
|
coin?: string;
|
|
327
332
|
interval?: string;
|
|
328
333
|
user?: string;
|
|
@@ -332,13 +337,44 @@ interface WebSocketMessage {
|
|
|
332
337
|
/**
|
|
333
338
|
* WebSocket response from HyperLiquid native API
|
|
334
339
|
*/
|
|
335
|
-
type HLChannel = '
|
|
340
|
+
type HLChannel = 'webData3' | 'allMids' | 'activeAssetData' | 'candle';
|
|
336
341
|
interface HLChannelDataMap {
|
|
337
|
-
|
|
342
|
+
webData3: WebData3Response;
|
|
338
343
|
allMids: WsAllMidsData;
|
|
339
344
|
activeAssetData: ActiveAssetData;
|
|
340
345
|
candle: CandleData;
|
|
341
346
|
}
|
|
347
|
+
interface WebData3UserState {
|
|
348
|
+
agentAddress?: string;
|
|
349
|
+
agentValidUntil?: number;
|
|
350
|
+
cumLedger: string;
|
|
351
|
+
serverTime: number;
|
|
352
|
+
isVault: boolean;
|
|
353
|
+
user: string;
|
|
354
|
+
dexAbstractionEnabled?: boolean;
|
|
355
|
+
}
|
|
356
|
+
interface WebData3AssetCtx {
|
|
357
|
+
funding: string;
|
|
358
|
+
openInterest: string;
|
|
359
|
+
prevDayPx: string;
|
|
360
|
+
dayNtlVlm: string;
|
|
361
|
+
premium: string | null;
|
|
362
|
+
oraclePx: string;
|
|
363
|
+
markPx: string;
|
|
364
|
+
midPx: string | null;
|
|
365
|
+
impactPxs: string[] | null;
|
|
366
|
+
dayBaseVlm: string;
|
|
367
|
+
}
|
|
368
|
+
interface WebData3PerpDexState {
|
|
369
|
+
clearinghouseState: ClearinghouseState;
|
|
370
|
+
totalVaultEquity: string;
|
|
371
|
+
assetCtxs: WebData3AssetCtx[];
|
|
372
|
+
perpsAtOpenInterestCap: string[];
|
|
373
|
+
}
|
|
374
|
+
interface WebData3Response {
|
|
375
|
+
userState: WebData3UserState;
|
|
376
|
+
perpDexStates: WebData3PerpDexState[];
|
|
377
|
+
}
|
|
342
378
|
interface HLWebSocketResponse<T extends HLChannel = HLChannel> {
|
|
343
379
|
channel: T;
|
|
344
380
|
data: HLChannelDataMap[T];
|
|
@@ -372,17 +408,6 @@ interface UniverseAsset {
|
|
|
372
408
|
onlyIsolated?: boolean;
|
|
373
409
|
isDelisted?: boolean;
|
|
374
410
|
}
|
|
375
|
-
/**
|
|
376
|
-
* WebData2 response structure
|
|
377
|
-
*/
|
|
378
|
-
interface WebData2Response {
|
|
379
|
-
assetCtxs: AssetCtx[];
|
|
380
|
-
meta: {
|
|
381
|
-
universe: UniverseAsset[];
|
|
382
|
-
};
|
|
383
|
-
clearinghouseState: ClearinghouseState;
|
|
384
|
-
perpsAtOpenInterestCap?: string[];
|
|
385
|
-
}
|
|
386
411
|
interface ClearinghouseState {
|
|
387
412
|
assetPositions: AssetPosition[];
|
|
388
413
|
crossMaintenanceMarginUsed: string;
|
|
@@ -484,9 +509,6 @@ interface ActiveAssetData {
|
|
|
484
509
|
availableToTrade: [string, string];
|
|
485
510
|
markPx: string;
|
|
486
511
|
}
|
|
487
|
-
/**
|
|
488
|
-
* Token metadata from WebData2 and AllMids
|
|
489
|
-
*/
|
|
490
512
|
interface TokenMetadata {
|
|
491
513
|
currentPrice: number;
|
|
492
514
|
prevDayPrice: number;
|
|
@@ -518,7 +540,7 @@ interface TokenConflict {
|
|
|
518
540
|
conflictMessage: string;
|
|
519
541
|
}
|
|
520
542
|
interface AssetMarketData {
|
|
521
|
-
asset: AssetCtx;
|
|
543
|
+
asset: WebData3AssetCtx | AssetCtx;
|
|
522
544
|
universe: UniverseAsset;
|
|
523
545
|
}
|
|
524
546
|
interface PairAssetDto {
|
|
@@ -608,13 +630,6 @@ interface PearHyperliquidContextType {
|
|
|
608
630
|
loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
609
631
|
refreshTokens: () => Promise<any>;
|
|
610
632
|
logout: () => Promise<void>;
|
|
611
|
-
agentWallet: AgentWalletState;
|
|
612
|
-
isAgentWalletReady: boolean;
|
|
613
|
-
agentWalletError: string | null;
|
|
614
|
-
agentWalletLoading: boolean;
|
|
615
|
-
refreshAgentWalletStatus: () => Promise<any>;
|
|
616
|
-
createAgentWallet: () => Promise<any>;
|
|
617
|
-
notifyAgentWalletApproved: () => Promise<any>;
|
|
618
633
|
}
|
|
619
634
|
interface PearHyperliquidProviderProps {
|
|
620
635
|
children: ReactNode;
|
|
@@ -646,27 +661,10 @@ declare function usePearAuth(): {
|
|
|
646
661
|
readonly refreshTokens: () => Promise<any>;
|
|
647
662
|
readonly logout: () => Promise<void>;
|
|
648
663
|
};
|
|
649
|
-
/**
|
|
650
|
-
* Provider-aware Agent Wallet hook. Uses agent wallet state/actions provided by PearHyperliquidProvider.
|
|
651
|
-
*/
|
|
652
|
-
declare function usePearAgentWallet(): {
|
|
653
|
-
readonly agentWallet: AgentWalletState;
|
|
654
|
-
readonly isReady: boolean;
|
|
655
|
-
readonly loading: boolean;
|
|
656
|
-
readonly error: string | null;
|
|
657
|
-
readonly refreshAgentWalletStatus: () => Promise<any>;
|
|
658
|
-
readonly createAgentWallet: () => Promise<any>;
|
|
659
|
-
readonly notifyAgentWalletApproved: () => Promise<any>;
|
|
660
|
-
};
|
|
661
664
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
declare const useAddress: () => {
|
|
666
|
-
address: string | null;
|
|
667
|
-
setAddress: (address: string | null) => void;
|
|
668
|
-
clearAddress: () => void;
|
|
669
|
-
isLoggedIn: boolean;
|
|
665
|
+
declare const useAccountSummary: () => {
|
|
666
|
+
data: AccountSummaryResponseDto | null;
|
|
667
|
+
isLoading: boolean;
|
|
670
668
|
};
|
|
671
669
|
|
|
672
670
|
declare const useTradeHistories: () => {
|
|
@@ -680,13 +678,6 @@ declare const useOpenOrders: () => {
|
|
|
680
678
|
data: OpenLimitOrderDto[] | null;
|
|
681
679
|
isLoading: boolean;
|
|
682
680
|
};
|
|
683
|
-
/**
|
|
684
|
-
* Hook to access account summary with real-time calculations and loading state
|
|
685
|
-
*/
|
|
686
|
-
declare const useAccountSummary: () => {
|
|
687
|
-
data: AccountSummaryResponseDto | null;
|
|
688
|
-
isLoading: boolean;
|
|
689
|
-
};
|
|
690
681
|
|
|
691
682
|
interface UserSelectionState {
|
|
692
683
|
longTokens: TokenSelection[];
|
|
@@ -718,9 +709,10 @@ declare const useUserSelection: () => UserSelectionState;
|
|
|
718
709
|
* Hook to access webData and native WebSocket state
|
|
719
710
|
*/
|
|
720
711
|
declare const useWebData: () => {
|
|
721
|
-
clearinghouseState: ClearinghouseState |
|
|
722
|
-
perpsAtOpenInterestCap: string[] |
|
|
712
|
+
clearinghouseState: ClearinghouseState | null;
|
|
713
|
+
perpsAtOpenInterestCap: string[] | null;
|
|
723
714
|
marketDataBySymbol: Record<string, AssetMarketData>;
|
|
715
|
+
hip3Assets: Map<string, string>;
|
|
724
716
|
isConnected: boolean;
|
|
725
717
|
error: string | null;
|
|
726
718
|
};
|
|
@@ -806,14 +798,10 @@ interface UsePerformanceOverlaysReturn {
|
|
|
806
798
|
}
|
|
807
799
|
declare const usePerformanceOverlays: () => UsePerformanceOverlaysReturn;
|
|
808
800
|
|
|
809
|
-
declare function useAgentWallet(
|
|
810
|
-
readonly
|
|
811
|
-
readonly isReady: boolean;
|
|
812
|
-
readonly loading: false;
|
|
813
|
-
readonly error: null;
|
|
814
|
-
readonly refreshAgentWalletStatus: () => Promise<GetAgentWalletResponseDto>;
|
|
801
|
+
declare function useAgentWallet(): {
|
|
802
|
+
readonly refreshAgentWalletStatus: () => Promise<void>;
|
|
815
803
|
readonly createAgentWallet: () => Promise<CreateAgentWalletResponseDto>;
|
|
816
|
-
readonly notifyAgentWalletApproved: () => Promise<
|
|
804
|
+
readonly notifyAgentWalletApproved: () => Promise<void>;
|
|
817
805
|
};
|
|
818
806
|
|
|
819
807
|
interface AutoSyncFillsOptions {
|
|
@@ -917,7 +905,7 @@ interface CreatePositionResponseDto {
|
|
|
917
905
|
* Caller should supply an accessToken from localStorage.getItem('accessToken')
|
|
918
906
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
919
907
|
*/
|
|
920
|
-
declare function createPosition(baseUrl: string, accessToken: string, payload: CreatePositionRequestInput): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
908
|
+
declare function createPosition(baseUrl: string, accessToken: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
921
909
|
interface UpdateRiskParametersRequestInput {
|
|
922
910
|
stopLoss?: TpSlThresholdInput | null;
|
|
923
911
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -1076,15 +1064,16 @@ interface UsePortfolioResult {
|
|
|
1076
1064
|
/**
|
|
1077
1065
|
* Hook to fetch and manage portfolio data
|
|
1078
1066
|
* Returns bucketed volume, open interest snapshot, win/loss trade counts,
|
|
1079
|
-
* and overall metrics
|
|
1067
|
+
* and overall metrics
|
|
1080
1068
|
*/
|
|
1081
1069
|
declare function usePortfolio(): UsePortfolioResult;
|
|
1082
1070
|
|
|
1083
1071
|
interface UseHyperliquidWebSocketProps {
|
|
1084
1072
|
wsUrl: string;
|
|
1085
1073
|
address: string | null;
|
|
1074
|
+
enabled?: boolean;
|
|
1086
1075
|
}
|
|
1087
|
-
declare const useHyperliquidWebSocket: ({ wsUrl, address }: UseHyperliquidWebSocketProps) => {
|
|
1076
|
+
declare const useHyperliquidWebSocket: ({ wsUrl, address, enabled, }: UseHyperliquidWebSocketProps) => {
|
|
1088
1077
|
isConnected: boolean;
|
|
1089
1078
|
lastError: string | null;
|
|
1090
1079
|
};
|
|
@@ -1092,12 +1081,13 @@ declare const useHyperliquidWebSocket: ({ wsUrl, address }: UseHyperliquidWebSoc
|
|
|
1092
1081
|
interface UseHyperliquidNativeWebSocketProps {
|
|
1093
1082
|
address: string | null;
|
|
1094
1083
|
tokens?: string[];
|
|
1084
|
+
enabled?: boolean;
|
|
1095
1085
|
}
|
|
1096
1086
|
interface UseHyperliquidNativeWebSocketReturn {
|
|
1097
1087
|
isConnected: boolean;
|
|
1098
1088
|
lastError: string | null;
|
|
1099
1089
|
}
|
|
1100
|
-
declare const useHyperliquidNativeWebSocket: ({ address, }: UseHyperliquidNativeWebSocketProps) => UseHyperliquidNativeWebSocketReturn;
|
|
1090
|
+
declare const useHyperliquidNativeWebSocket: ({ address, enabled, }: UseHyperliquidNativeWebSocketProps) => UseHyperliquidNativeWebSocketReturn;
|
|
1101
1091
|
|
|
1102
1092
|
/**
|
|
1103
1093
|
* Mark notifications as read up to a given timestamp (ms)
|
|
@@ -1112,25 +1102,18 @@ declare function markNotificationReadById(baseUrl: string, accessToken: string,
|
|
|
1112
1102
|
updated: number;
|
|
1113
1103
|
}>>;
|
|
1114
1104
|
|
|
1115
|
-
declare function toggleWatchlist(baseUrl: string, accessToken: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[]): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
1105
|
+
declare function toggleWatchlist(baseUrl: string, accessToken: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
1116
1106
|
|
|
1117
1107
|
/**
|
|
1118
1108
|
* Account summary calculation utility class
|
|
1119
1109
|
*/
|
|
1120
1110
|
declare class AccountSummaryCalculator {
|
|
1121
|
-
private
|
|
1122
|
-
constructor(
|
|
1123
|
-
/**
|
|
1124
|
-
* Calculate account summary from webData2 and platform orders
|
|
1125
|
-
*/
|
|
1126
|
-
calculateAccountSummary(platformAccountSummary: AccountSummaryResponseDto | null, platformOpenOrders: OpenLimitOrderDto[] | null, agentWalletAddress?: string, agentWalletStatus?: string): AccountSummaryResponseDto | null;
|
|
1127
|
-
/**
|
|
1128
|
-
* Calculate total USD value of open limit orders
|
|
1129
|
-
*/
|
|
1130
|
-
private calculateTotalLimitOrderValue;
|
|
1111
|
+
private clearinghouseState;
|
|
1112
|
+
constructor(clearinghouseState: ClearinghouseState | null);
|
|
1131
1113
|
/**
|
|
1132
|
-
*
|
|
1114
|
+
* Calculate account summary from real-time clearinghouse state and platform orders
|
|
1133
1115
|
*/
|
|
1116
|
+
calculateAccountSummary(platformAccountSummary: PlatformAccountSummaryResponseDto | null, registeredAgentWallets: ExtraAgent[]): AccountSummaryResponseDto | null;
|
|
1134
1117
|
getClearinghouseState(): ClearinghouseState | null;
|
|
1135
1118
|
/**
|
|
1136
1119
|
* Check if real-time data is available
|
|
@@ -1153,34 +1136,36 @@ declare class ConflictDetector {
|
|
|
1153
1136
|
}
|
|
1154
1137
|
|
|
1155
1138
|
/**
|
|
1156
|
-
* Extracts token metadata from
|
|
1139
|
+
* Extracts token metadata from aggregated WebData3 contexts and AllMids data
|
|
1157
1140
|
*/
|
|
1158
1141
|
declare class TokenMetadataExtractor {
|
|
1159
1142
|
/**
|
|
1160
1143
|
* Extracts comprehensive token metadata
|
|
1161
1144
|
* @param symbol - Token symbol
|
|
1162
|
-
* @param
|
|
1145
|
+
* @param perpMetaAssets - Aggregated universe assets (flattened across dexes)
|
|
1146
|
+
* @param finalAssetContexts - Aggregated asset contexts (flattened across dexes)
|
|
1163
1147
|
* @param allMids - AllMids data containing current prices
|
|
1164
1148
|
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1165
1149
|
* @returns TokenMetadata or null if token not found
|
|
1166
1150
|
*/
|
|
1167
|
-
static extractTokenMetadata(symbol: string,
|
|
1151
|
+
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): TokenMetadata | null;
|
|
1168
1152
|
/**
|
|
1169
1153
|
* Extracts metadata for multiple tokens
|
|
1170
1154
|
* @param symbols - Array of token symbols
|
|
1171
|
-
* @param
|
|
1155
|
+
* @param perpMetaAssets - Aggregated universe assets
|
|
1156
|
+
* @param finalAssetContexts - Aggregated asset contexts
|
|
1172
1157
|
* @param allMids - AllMids data
|
|
1173
1158
|
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1174
1159
|
* @returns Record of symbol to TokenMetadata
|
|
1175
1160
|
*/
|
|
1176
|
-
static extractMultipleTokensMetadata(symbols: string[],
|
|
1161
|
+
static extractMultipleTokensMetadata(symbols: string[], perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null): Record<string, TokenMetadata | null>;
|
|
1177
1162
|
/**
|
|
1178
|
-
* Checks if token data is available in
|
|
1163
|
+
* Checks if token data is available in aggregated universe assets
|
|
1179
1164
|
* @param symbol - Token symbol
|
|
1180
|
-
* @param
|
|
1165
|
+
* @param perpMetaAssets - Aggregated universe assets
|
|
1181
1166
|
* @returns boolean indicating if token exists in universe
|
|
1182
1167
|
*/
|
|
1183
|
-
static isTokenAvailable(symbol: string,
|
|
1168
|
+
static isTokenAvailable(symbol: string, perpMetaAssets: UniverseAsset[] | null): boolean;
|
|
1184
1169
|
}
|
|
1185
1170
|
|
|
1186
1171
|
/**
|
|
@@ -1259,5 +1244,5 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
|
|
|
1259
1244
|
|
|
1260
1245
|
declare const useMarketData: any;
|
|
1261
1246
|
|
|
1262
|
-
export { AccountSummaryCalculator, AuthStatus, ConflictDetector, MINIMUM_ASSET_USD_VALUE, MinimumPositionSizeError, PearHyperliquidProvider, TokenMetadataExtractor, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, getPortfolio, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toggleWatchlist, updateRiskParameters, useAccountSummary, useActiveBaskets,
|
|
1263
|
-
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, 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, HLWebSocketResponse, HistoricalRange, LadderConfigInput, MarginSummaryDto, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderStatus, PairAssetDto, PairAssetInput, PerformanceOverlay, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PositionAssetSummaryDto, PositionResponseStatus, RealtimeBar, RealtimeBarsCallback, ToggleWatchlistResponseDto, TokenConflict, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TpSlThresholdInput, TpSlThresholdType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TwapChunkStatusDto, TwapMonitoringDto, UniverseAsset, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto,
|
|
1247
|
+
export { AccountSummaryCalculator, AuthStatus, ConflictDetector, MINIMUM_ASSET_USD_VALUE, MinimumPositionSizeError, PearHyperliquidProvider, TokenMetadataExtractor, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, getPortfolio, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toggleWatchlist, updateRiskParameters, useAccountSummary, useActiveBaskets, useAgentWallet, useAllBaskets, useAutoSyncFills, useBasketCandles, useFindBasket, useHighlightedBaskets, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useMarketData, useMarketDataAllPayload, useMarketDataPayload, useNotifications, useOpenOrders, useOrders, usePearAuth, usePearHyperliquid, usePerformanceOverlays, usePortfolio, usePosition, useTokenSelectionMetadata, useTopGainers, useTopLosers, useTradeHistories, useTwap, useUserSelection, useWatchlist, useWatchlistBaskets, useWebData, validateMinimumAssetSize, validatePositionSize };
|
|
1248
|
+
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, 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, UniverseAsset, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistItemDto, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|