@pear-protocol/hyperliquid-sdk 0.0.56 → 0.0.58
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/agentWallet.d.ts +2 -2
- package/dist/clients/notifications.d.ts +2 -2
- package/dist/clients/orders.d.ts +3 -3
- package/dist/clients/portfolio.d.ts +2 -2
- package/dist/clients/positions.d.ts +8 -8
- package/dist/clients/sync.d.ts +2 -2
- package/dist/clients/watchlist.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useAuth.d.ts +12 -0
- package/dist/hooks/useAutoSyncFills.d.ts +0 -2
- package/dist/index.d.ts +77 -76
- package/dist/index.js +4125 -4015
- package/dist/provider.d.ts +1 -29
- package/dist/types.d.ts +1 -7
- package/dist/utils/http.d.ts +23 -0
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ApiResponse, GetAgentWalletResponseDto, CreateAgentWalletResponseDto } from '../types';
|
|
2
|
-
export declare function getAgentWallet(baseUrl: string
|
|
3
|
-
export declare function createAgentWallet(baseUrl: string
|
|
2
|
+
export declare function getAgentWallet(baseUrl: string): Promise<ApiResponse<GetAgentWalletResponseDto>>;
|
|
3
|
+
export declare function createAgentWallet(baseUrl: string): Promise<ApiResponse<CreateAgentWalletResponseDto>>;
|
|
@@ -2,12 +2,12 @@ import type { ApiResponse } from '../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Mark notifications as read up to a given timestamp (ms)
|
|
4
4
|
*/
|
|
5
|
-
export declare function markNotificationsRead(baseUrl: string,
|
|
5
|
+
export declare function markNotificationsRead(baseUrl: string, timestampMs: number): Promise<ApiResponse<{
|
|
6
6
|
updated: number;
|
|
7
7
|
}>>;
|
|
8
8
|
/**
|
|
9
9
|
* Mark a single notification as read by id
|
|
10
10
|
*/
|
|
11
|
-
export declare function markNotificationReadById(baseUrl: string,
|
|
11
|
+
export declare function markNotificationReadById(baseUrl: string, id: string): Promise<ApiResponse<{
|
|
12
12
|
updated: number;
|
|
13
13
|
}>>;
|
package/dist/clients/orders.d.ts
CHANGED
|
@@ -9,16 +9,16 @@ export interface AdjustOrderResponseDto {
|
|
|
9
9
|
usdValue: number;
|
|
10
10
|
updatedAt: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function adjustOrder(baseUrl: string,
|
|
12
|
+
export declare function adjustOrder(baseUrl: string, orderId: string, payload: AdjustOrderRequestInput): Promise<ApiResponse<AdjustOrderResponseDto>>;
|
|
13
13
|
export interface CancelOrderResponseDto {
|
|
14
14
|
orderId: string;
|
|
15
15
|
status: string;
|
|
16
16
|
cancelledAt: string;
|
|
17
17
|
}
|
|
18
|
-
export declare function cancelOrder(baseUrl: string,
|
|
18
|
+
export declare function cancelOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelOrderResponseDto>>;
|
|
19
19
|
export interface CancelTwapResponseDto {
|
|
20
20
|
orderId: string;
|
|
21
21
|
status: string;
|
|
22
22
|
cancelledAt: string;
|
|
23
23
|
}
|
|
24
|
-
export declare function cancelTwapOrder(baseUrl: string,
|
|
24
|
+
export declare function cancelTwapOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
@@ -34,6 +34,6 @@ export interface PortfolioResponseDto {
|
|
|
34
34
|
/**
|
|
35
35
|
* Get portfolio summary buckets and overall metrics
|
|
36
36
|
* Returns bucketed volume, open interest snapshot, win/loss trade counts, and overall metrics filtered to PEAR fills (cloid LIKE 0x50454152%)
|
|
37
|
-
*
|
|
37
|
+
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
38
38
|
*/
|
|
39
|
-
export declare function getPortfolio(baseUrl: string
|
|
39
|
+
export declare function getPortfolio(baseUrl: string): Promise<ApiResponse<PortfolioResponseDto>>;
|
|
@@ -53,10 +53,10 @@ export interface CreatePositionResponseDto {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Create a position (MARKET/LIMIT/TWAP) using Pear Hyperliquid service
|
|
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,
|
|
59
|
+
export declare function createPosition(baseUrl: 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;
|
|
@@ -67,7 +67,7 @@ export interface UpdateRiskParametersResponseDto {
|
|
|
67
67
|
takeProfit: TpSlThresholdInput | null;
|
|
68
68
|
updatedAt: string;
|
|
69
69
|
}
|
|
70
|
-
export declare function updateRiskParameters(baseUrl: string,
|
|
70
|
+
export declare function updateRiskParameters(baseUrl: string, positionId: string, payload: UpdateRiskParametersRequestInput): Promise<ApiResponse<UpdateRiskParametersResponseDto>>;
|
|
71
71
|
export type CloseExecutionType = "MARKET" | "TWAP";
|
|
72
72
|
export interface ClosePositionRequestInput {
|
|
73
73
|
executionType: CloseExecutionType;
|
|
@@ -81,7 +81,7 @@ export interface ClosePositionResponseDto {
|
|
|
81
81
|
executionTime?: string;
|
|
82
82
|
chunksScheduled?: number;
|
|
83
83
|
}
|
|
84
|
-
export declare function closePosition(baseUrl: string,
|
|
84
|
+
export declare function closePosition(baseUrl: string, positionId: string, payload: ClosePositionRequestInput): Promise<ApiResponse<ClosePositionResponseDto>>;
|
|
85
85
|
export interface CloseAllPositionsResultDto {
|
|
86
86
|
positionId: string;
|
|
87
87
|
success: boolean;
|
|
@@ -91,7 +91,7 @@ export interface CloseAllPositionsResultDto {
|
|
|
91
91
|
export interface CloseAllPositionsResponseDto {
|
|
92
92
|
results: CloseAllPositionsResultDto[];
|
|
93
93
|
}
|
|
94
|
-
export declare function closeAllPositions(baseUrl: string,
|
|
94
|
+
export declare function closeAllPositions(baseUrl: string, payload: ClosePositionRequestInput): Promise<ApiResponse<CloseAllPositionsResponseDto>>;
|
|
95
95
|
export type AdjustExecutionType = "MARKET" | "LIMIT";
|
|
96
96
|
export type PositionAdjustmentType = "REDUCE" | "INCREASE";
|
|
97
97
|
export interface AdjustPositionRequestInput {
|
|
@@ -109,7 +109,7 @@ export interface AdjustPositionResponseDto {
|
|
|
109
109
|
newSize: number;
|
|
110
110
|
executedAt: string;
|
|
111
111
|
}
|
|
112
|
-
export declare function adjustPosition(baseUrl: string,
|
|
112
|
+
export declare function adjustPosition(baseUrl: string, positionId: string, payload: AdjustPositionRequestInput): Promise<ApiResponse<AdjustPositionResponseDto>>;
|
|
113
113
|
export interface AdjustAdvanceAssetInput {
|
|
114
114
|
asset: string;
|
|
115
115
|
size: number;
|
|
@@ -123,5 +123,5 @@ export interface AdjustAdvanceResponseDto {
|
|
|
123
123
|
status: string;
|
|
124
124
|
executedAt: string;
|
|
125
125
|
}
|
|
126
|
-
export declare function adjustAdvancePosition(baseUrl: string,
|
|
127
|
-
export declare function cancelTwap(baseUrl: string,
|
|
126
|
+
export declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[], displayToFull: Map<string, string>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
127
|
+
export declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
package/dist/clients/sync.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { ApiResponse, AssetPosition, SyncFillsRequestDto, SyncFillsResponse
|
|
|
2
2
|
/**
|
|
3
3
|
* Sync external fills into Pear Hyperliquid service (POST /sync/fills)
|
|
4
4
|
*/
|
|
5
|
-
export declare const syncFills: (baseUrl: string,
|
|
5
|
+
export declare const syncFills: (baseUrl: string, payload: SyncFillsRequestDto) => Promise<ApiResponse<SyncFillsResponseDto>>;
|
|
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,
|
|
9
|
+
export declare const syncUserFillsFromHyperliquid: (baseUrl: string, user: string, aggregateByTime: boolean | undefined, lastSyncAt: number | null | undefined, assetPositions: AssetPosition[]) => Promise<ApiResponse<SyncFillsResponseDto>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ApiResponse, ToggleWatchlistResponseDto, WatchlistAssetDto } from '../types';
|
|
2
|
-
export declare function toggleWatchlist(baseUrl: string,
|
|
2
|
+
export declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GetEIP712MessageResponse } from '../types';
|
|
2
|
+
export declare function useAuth(): {
|
|
3
|
+
readonly isReady: boolean;
|
|
4
|
+
readonly isAuthenticated: any;
|
|
5
|
+
readonly accessToken: any;
|
|
6
|
+
readonly refreshToken: any;
|
|
7
|
+
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
8
|
+
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
9
|
+
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
10
|
+
readonly refreshTokens: () => Promise<import("../types").RefreshTokenResponse>;
|
|
11
|
+
readonly logout: () => Promise<void>;
|
|
12
|
+
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { SyncFillsResponseDto } from '../types';
|
|
2
2
|
export interface AutoSyncFillsOptions {
|
|
3
3
|
baseUrl: string;
|
|
4
|
-
accessToken: string;
|
|
5
4
|
address: string | null;
|
|
6
5
|
intervalMs?: number;
|
|
7
6
|
aggregateByTime?: boolean;
|
|
8
|
-
enabled?: boolean;
|
|
9
7
|
}
|
|
10
8
|
export interface AutoSyncFillsState {
|
|
11
9
|
lastRunAt: number | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
+
interface PearHyperliquidContextType {
|
|
4
|
+
clientId: string;
|
|
5
|
+
apiBaseUrl: string;
|
|
6
|
+
wsUrl: string;
|
|
7
|
+
isConnected: boolean;
|
|
8
|
+
lastError: string | null;
|
|
9
|
+
nativeIsConnected: boolean;
|
|
10
|
+
nativeLastError: string | null;
|
|
11
|
+
}
|
|
12
|
+
interface PearHyperliquidProviderProps {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
apiBaseUrl?: string;
|
|
15
|
+
clientId?: string;
|
|
16
|
+
wsUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* React Provider for PearHyperliquidClient
|
|
20
|
+
*/
|
|
21
|
+
declare const PearHyperliquidProvider: React.FC<PearHyperliquidProviderProps>;
|
|
22
|
+
/**
|
|
23
|
+
* Hook to access the entire Pear Hyperliquid context.
|
|
24
|
+
* Prefer using the more specific hooks below when possible.
|
|
25
|
+
*/
|
|
26
|
+
declare function usePearHyperliquid(): PearHyperliquidContextType;
|
|
27
|
+
|
|
3
28
|
interface ApiErrorResponse {
|
|
4
29
|
statusCode: number;
|
|
5
30
|
message: string;
|
|
@@ -320,12 +345,6 @@ interface AccountSummaryResponseDto {
|
|
|
320
345
|
balanceSummary: BalanceSummaryDto;
|
|
321
346
|
agentWallet?: AgentWalletDto;
|
|
322
347
|
}
|
|
323
|
-
declare enum AuthStatus {
|
|
324
|
-
Idle = "idle",
|
|
325
|
-
Authenticating = "authenticating",
|
|
326
|
-
Authenticated = "authenticated",
|
|
327
|
-
Error = "error"
|
|
328
|
-
}
|
|
329
348
|
interface UseAuthOptions {
|
|
330
349
|
baseUrl: string;
|
|
331
350
|
clientId: string;
|
|
@@ -335,6 +354,29 @@ interface UserProfile {
|
|
|
335
354
|
address: string;
|
|
336
355
|
appId: string;
|
|
337
356
|
}
|
|
357
|
+
interface EIP712AuthDetails {
|
|
358
|
+
primaryType: string;
|
|
359
|
+
domain: {
|
|
360
|
+
name: string;
|
|
361
|
+
version: string;
|
|
362
|
+
chainId: number;
|
|
363
|
+
verifyingContract: `0x${string}`;
|
|
364
|
+
};
|
|
365
|
+
types: Record<string, Array<{
|
|
366
|
+
name: string;
|
|
367
|
+
type: string;
|
|
368
|
+
}>>;
|
|
369
|
+
message: Record<string, unknown>;
|
|
370
|
+
timestamp: number;
|
|
371
|
+
}
|
|
372
|
+
interface GetEIP712MessageResponse extends EIP712AuthDetails {
|
|
373
|
+
}
|
|
374
|
+
interface RefreshTokenResponse {
|
|
375
|
+
accessToken: string;
|
|
376
|
+
refreshToken: string;
|
|
377
|
+
tokenType: string;
|
|
378
|
+
expiresIn: number;
|
|
379
|
+
}
|
|
338
380
|
type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
|
|
339
381
|
interface CreateAgentWalletResponseDto {
|
|
340
382
|
agentWalletAddress: string;
|
|
@@ -643,57 +685,6 @@ interface TokenSelectorConfig {
|
|
|
643
685
|
index: number;
|
|
644
686
|
}
|
|
645
687
|
|
|
646
|
-
interface PearHyperliquidContextType {
|
|
647
|
-
apiBaseUrl: string;
|
|
648
|
-
wsUrl: string;
|
|
649
|
-
address: string | null;
|
|
650
|
-
setAddress: (address: string | null) => void;
|
|
651
|
-
isConnected: boolean;
|
|
652
|
-
lastError: string | null;
|
|
653
|
-
nativeIsConnected: boolean;
|
|
654
|
-
nativeLastError: string | null;
|
|
655
|
-
authStatus: AuthStatus;
|
|
656
|
-
isAuthenticated: boolean;
|
|
657
|
-
accessToken: string | null;
|
|
658
|
-
user: UserProfile | null;
|
|
659
|
-
authError: string | null;
|
|
660
|
-
getEip712: (address: string) => Promise<any>;
|
|
661
|
-
loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
662
|
-
loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
663
|
-
refreshTokens: () => Promise<any>;
|
|
664
|
-
logout: () => Promise<void>;
|
|
665
|
-
}
|
|
666
|
-
interface PearHyperliquidProviderProps {
|
|
667
|
-
children: ReactNode;
|
|
668
|
-
apiBaseUrl?: string;
|
|
669
|
-
clientId?: string;
|
|
670
|
-
wsUrl?: string;
|
|
671
|
-
}
|
|
672
|
-
/**
|
|
673
|
-
* React Provider for PearHyperliquidClient
|
|
674
|
-
*/
|
|
675
|
-
declare const PearHyperliquidProvider: React.FC<PearHyperliquidProviderProps>;
|
|
676
|
-
/**
|
|
677
|
-
* Hook to access the entire Pear Hyperliquid context.
|
|
678
|
-
* Prefer using the more specific hooks below when possible.
|
|
679
|
-
*/
|
|
680
|
-
declare function usePearHyperliquid(): PearHyperliquidContextType;
|
|
681
|
-
/**
|
|
682
|
-
* Provider-aware Auth hook. Uses auth state/actions provided by PearHyperliquidProvider.
|
|
683
|
-
* Callers do not need to pass baseUrl/clientId.
|
|
684
|
-
*/
|
|
685
|
-
declare function usePearAuth(): {
|
|
686
|
-
readonly status: AuthStatus;
|
|
687
|
-
readonly isAuthenticated: boolean;
|
|
688
|
-
readonly user: UserProfile | null;
|
|
689
|
-
readonly error: string | null;
|
|
690
|
-
readonly getEip712: (address: string) => Promise<any>;
|
|
691
|
-
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
692
|
-
readonly loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
693
|
-
readonly refreshTokens: () => Promise<any>;
|
|
694
|
-
readonly logout: () => Promise<void>;
|
|
695
|
-
};
|
|
696
|
-
|
|
697
688
|
declare const useAccountSummary: () => {
|
|
698
689
|
data: AccountSummaryResponseDto | null;
|
|
699
690
|
isLoading: boolean;
|
|
@@ -838,11 +829,9 @@ declare function useAgentWallet(): {
|
|
|
838
829
|
|
|
839
830
|
interface AutoSyncFillsOptions {
|
|
840
831
|
baseUrl: string;
|
|
841
|
-
accessToken: string;
|
|
842
832
|
address: string | null;
|
|
843
833
|
intervalMs?: number;
|
|
844
834
|
aggregateByTime?: boolean;
|
|
845
|
-
enabled?: boolean;
|
|
846
835
|
}
|
|
847
836
|
interface AutoSyncFillsState {
|
|
848
837
|
lastRunAt: number | null;
|
|
@@ -867,19 +856,19 @@ interface AdjustOrderResponseDto {
|
|
|
867
856
|
usdValue: number;
|
|
868
857
|
updatedAt: string;
|
|
869
858
|
}
|
|
870
|
-
declare function adjustOrder(baseUrl: string,
|
|
859
|
+
declare function adjustOrder(baseUrl: string, orderId: string, payload: AdjustOrderRequestInput): Promise<ApiResponse<AdjustOrderResponseDto>>;
|
|
871
860
|
interface CancelOrderResponseDto {
|
|
872
861
|
orderId: string;
|
|
873
862
|
status: string;
|
|
874
863
|
cancelledAt: string;
|
|
875
864
|
}
|
|
876
|
-
declare function cancelOrder(baseUrl: string,
|
|
865
|
+
declare function cancelOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelOrderResponseDto>>;
|
|
877
866
|
interface CancelTwapResponseDto {
|
|
878
867
|
orderId: string;
|
|
879
868
|
status: string;
|
|
880
869
|
cancelledAt: string;
|
|
881
870
|
}
|
|
882
|
-
declare function cancelTwapOrder(baseUrl: string,
|
|
871
|
+
declare function cancelTwapOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
883
872
|
|
|
884
873
|
type ExecutionType = "MARKET" | "LIMIT" | "TWAP" | "LADDER" | "LIMIT_BTCDOM";
|
|
885
874
|
type TpSlThresholdType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
|
|
@@ -934,10 +923,10 @@ interface CreatePositionResponseDto {
|
|
|
934
923
|
}
|
|
935
924
|
/**
|
|
936
925
|
* Create a position (MARKET/LIMIT/TWAP) using Pear Hyperliquid service
|
|
937
|
-
*
|
|
926
|
+
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
938
927
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
939
928
|
*/
|
|
940
|
-
declare function createPosition(baseUrl: string,
|
|
929
|
+
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
941
930
|
interface UpdateRiskParametersRequestInput {
|
|
942
931
|
stopLoss?: TpSlThresholdInput | null;
|
|
943
932
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -948,7 +937,7 @@ interface UpdateRiskParametersResponseDto {
|
|
|
948
937
|
takeProfit: TpSlThresholdInput | null;
|
|
949
938
|
updatedAt: string;
|
|
950
939
|
}
|
|
951
|
-
declare function updateRiskParameters(baseUrl: string,
|
|
940
|
+
declare function updateRiskParameters(baseUrl: string, positionId: string, payload: UpdateRiskParametersRequestInput): Promise<ApiResponse<UpdateRiskParametersResponseDto>>;
|
|
952
941
|
type CloseExecutionType = "MARKET" | "TWAP";
|
|
953
942
|
interface ClosePositionRequestInput {
|
|
954
943
|
executionType: CloseExecutionType;
|
|
@@ -962,7 +951,7 @@ interface ClosePositionResponseDto {
|
|
|
962
951
|
executionTime?: string;
|
|
963
952
|
chunksScheduled?: number;
|
|
964
953
|
}
|
|
965
|
-
declare function closePosition(baseUrl: string,
|
|
954
|
+
declare function closePosition(baseUrl: string, positionId: string, payload: ClosePositionRequestInput): Promise<ApiResponse<ClosePositionResponseDto>>;
|
|
966
955
|
interface CloseAllPositionsResultDto {
|
|
967
956
|
positionId: string;
|
|
968
957
|
success: boolean;
|
|
@@ -972,7 +961,7 @@ interface CloseAllPositionsResultDto {
|
|
|
972
961
|
interface CloseAllPositionsResponseDto {
|
|
973
962
|
results: CloseAllPositionsResultDto[];
|
|
974
963
|
}
|
|
975
|
-
declare function closeAllPositions(baseUrl: string,
|
|
964
|
+
declare function closeAllPositions(baseUrl: string, payload: ClosePositionRequestInput): Promise<ApiResponse<CloseAllPositionsResponseDto>>;
|
|
976
965
|
type AdjustExecutionType = "MARKET" | "LIMIT";
|
|
977
966
|
type PositionAdjustmentType = "REDUCE" | "INCREASE";
|
|
978
967
|
interface AdjustPositionRequestInput {
|
|
@@ -990,7 +979,7 @@ interface AdjustPositionResponseDto {
|
|
|
990
979
|
newSize: number;
|
|
991
980
|
executedAt: string;
|
|
992
981
|
}
|
|
993
|
-
declare function adjustPosition(baseUrl: string,
|
|
982
|
+
declare function adjustPosition(baseUrl: string, positionId: string, payload: AdjustPositionRequestInput): Promise<ApiResponse<AdjustPositionResponseDto>>;
|
|
994
983
|
interface AdjustAdvanceAssetInput {
|
|
995
984
|
asset: string;
|
|
996
985
|
size: number;
|
|
@@ -1004,8 +993,8 @@ interface AdjustAdvanceResponseDto {
|
|
|
1004
993
|
status: string;
|
|
1005
994
|
executedAt: string;
|
|
1006
995
|
}
|
|
1007
|
-
declare function adjustAdvancePosition(baseUrl: string,
|
|
1008
|
-
declare function cancelTwap(baseUrl: string,
|
|
996
|
+
declare function adjustAdvancePosition(baseUrl: string, positionId: string, payload: AdjustAdvanceItemInput[], displayToFull: Map<string, string>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
|
|
997
|
+
declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
1009
998
|
|
|
1010
999
|
declare function usePosition(): {
|
|
1011
1000
|
readonly createPosition: (payload: CreatePositionRequestInput) => Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
@@ -1098,9 +1087,9 @@ interface PortfolioResponseDto {
|
|
|
1098
1087
|
/**
|
|
1099
1088
|
* Get portfolio summary buckets and overall metrics
|
|
1100
1089
|
* Returns bucketed volume, open interest snapshot, win/loss trade counts, and overall metrics filtered to PEAR fills (cloid LIKE 0x50454152%)
|
|
1101
|
-
*
|
|
1090
|
+
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
1102
1091
|
*/
|
|
1103
|
-
declare function getPortfolio(baseUrl: string
|
|
1092
|
+
declare function getPortfolio(baseUrl: string): Promise<ApiResponse<PortfolioResponseDto>>;
|
|
1104
1093
|
|
|
1105
1094
|
interface UsePortfolioResult {
|
|
1106
1095
|
data: PortfolioResponseDto | null;
|
|
@@ -1115,6 +1104,18 @@ interface UsePortfolioResult {
|
|
|
1115
1104
|
*/
|
|
1116
1105
|
declare function usePortfolio(): UsePortfolioResult;
|
|
1117
1106
|
|
|
1107
|
+
declare function useAuth(): {
|
|
1108
|
+
readonly isReady: boolean;
|
|
1109
|
+
readonly isAuthenticated: any;
|
|
1110
|
+
readonly accessToken: any;
|
|
1111
|
+
readonly refreshToken: any;
|
|
1112
|
+
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
1113
|
+
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
1114
|
+
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
1115
|
+
readonly refreshTokens: () => Promise<RefreshTokenResponse>;
|
|
1116
|
+
readonly logout: () => Promise<void>;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1118
1119
|
interface UseHyperliquidWebSocketProps {
|
|
1119
1120
|
wsUrl: string;
|
|
1120
1121
|
address: string | null;
|
|
@@ -1139,17 +1140,17 @@ declare const useHyperliquidNativeWebSocket: ({ address, enabled, }: UseHyperliq
|
|
|
1139
1140
|
/**
|
|
1140
1141
|
* Mark notifications as read up to a given timestamp (ms)
|
|
1141
1142
|
*/
|
|
1142
|
-
declare function markNotificationsRead(baseUrl: string,
|
|
1143
|
+
declare function markNotificationsRead(baseUrl: string, timestampMs: number): Promise<ApiResponse<{
|
|
1143
1144
|
updated: number;
|
|
1144
1145
|
}>>;
|
|
1145
1146
|
/**
|
|
1146
1147
|
* Mark a single notification as read by id
|
|
1147
1148
|
*/
|
|
1148
|
-
declare function markNotificationReadById(baseUrl: string,
|
|
1149
|
+
declare function markNotificationReadById(baseUrl: string, id: string): Promise<ApiResponse<{
|
|
1149
1150
|
updated: number;
|
|
1150
1151
|
}>>;
|
|
1151
1152
|
|
|
1152
|
-
declare function toggleWatchlist(baseUrl: string,
|
|
1153
|
+
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
1153
1154
|
|
|
1154
1155
|
/**
|
|
1155
1156
|
* Account summary calculation utility class
|
|
@@ -1291,5 +1292,5 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
|
|
|
1291
1292
|
|
|
1292
1293
|
declare const useMarketData: any;
|
|
1293
1294
|
|
|
1294
|
-
export { AccountSummaryCalculator,
|
|
1295
|
+
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 };
|
|
1295
1296
|
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 };
|