@pear-protocol/hyperliquid-sdk 0.0.54 → 0.0.55-fix-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/agentWallet.d.ts +2 -2
- package/dist/clients/hyperliquid.d.ts +5 -1
- 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 +7 -7
- 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 +102 -76
- package/dist/index.js +4167 -4017
- package/dist/provider.d.ts +1 -29
- package/dist/types.d.ts +5 -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>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiResponse, CandleInterval, CandleData, ExternalFillDto, AllPerpMetasResponse, ExtraAgent } from '../types';
|
|
1
|
+
import type { ApiResponse, CandleInterval, CandleData, ExternalFillDto, AllPerpMetasResponse, ExtraAgent, TwapSliceFillResponseItem } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Fetch historical candle data from HyperLiquid API
|
|
4
4
|
*/
|
|
@@ -7,6 +7,10 @@ export declare const fetchHistoricalCandles: (coin: string, startTime: number, e
|
|
|
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
|
+
* Retrieve user TWAP slice fills from HyperLiquid and map to ExternalFillDto within items
|
|
12
|
+
*/
|
|
13
|
+
export declare const fetchUserTwapSliceFillsByTime: (user: string, startTime: number, aggregateByTime?: boolean) => Promise<ApiResponse<TwapSliceFillResponseItem[]>>;
|
|
10
14
|
/**
|
|
11
15
|
* Fetch all perp metas from HyperLiquid API
|
|
12
16
|
* Endpoint: https://api.hyperliquid.xyz/info
|
|
@@ -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,5 +109,5 @@ export interface AdjustPositionResponseDto {
|
|
|
109
109
|
newSize: number;
|
|
110
110
|
executedAt: string;
|
|
111
111
|
}
|
|
112
|
-
export declare function adjustPosition(baseUrl: string,
|
|
113
|
-
export declare function cancelTwap(baseUrl: string,
|
|
112
|
+
export declare function adjustPosition(baseUrl: string, positionId: string, payload: AdjustPositionRequestInput): Promise<ApiResponse<AdjustPositionResponseDto>>;
|
|
113
|
+
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;
|
|
@@ -13,6 +38,27 @@ interface ApiResponse<T> {
|
|
|
13
38
|
status: number;
|
|
14
39
|
headers: Record<string, string>;
|
|
15
40
|
}
|
|
41
|
+
interface ExternalLiquidationDto {
|
|
42
|
+
liquidatedUser: string;
|
|
43
|
+
markPx: string;
|
|
44
|
+
method: string;
|
|
45
|
+
}
|
|
46
|
+
interface ExternalFillDto {
|
|
47
|
+
coin: string;
|
|
48
|
+
px: string;
|
|
49
|
+
sz: string;
|
|
50
|
+
side: 'B' | 'A';
|
|
51
|
+
time: number;
|
|
52
|
+
dir: string;
|
|
53
|
+
fee: string;
|
|
54
|
+
builderFee?: string;
|
|
55
|
+
oid?: string | number;
|
|
56
|
+
tid?: string | number;
|
|
57
|
+
cloid?: string | null;
|
|
58
|
+
hash?: string | null;
|
|
59
|
+
feeToken?: string | null;
|
|
60
|
+
liquidation?: ExternalLiquidationDto | null;
|
|
61
|
+
}
|
|
16
62
|
interface SyncFillsResponseDto {
|
|
17
63
|
insertedFills: number;
|
|
18
64
|
skippedDuplicates: number;
|
|
@@ -21,6 +67,10 @@ interface SyncFillsResponseDto {
|
|
|
21
67
|
createdPositions: number;
|
|
22
68
|
closedPositions: number;
|
|
23
69
|
}
|
|
70
|
+
interface TwapSliceFillResponseItem {
|
|
71
|
+
fill: ExternalFillDto;
|
|
72
|
+
twapId: number;
|
|
73
|
+
}
|
|
24
74
|
/**
|
|
25
75
|
* WebSocket connection states
|
|
26
76
|
*/
|
|
@@ -292,12 +342,6 @@ interface AccountSummaryResponseDto {
|
|
|
292
342
|
balanceSummary: BalanceSummaryDto;
|
|
293
343
|
agentWallet?: AgentWalletDto;
|
|
294
344
|
}
|
|
295
|
-
declare enum AuthStatus {
|
|
296
|
-
Idle = "idle",
|
|
297
|
-
Authenticating = "authenticating",
|
|
298
|
-
Authenticated = "authenticated",
|
|
299
|
-
Error = "error"
|
|
300
|
-
}
|
|
301
345
|
interface UseAuthOptions {
|
|
302
346
|
baseUrl: string;
|
|
303
347
|
clientId: string;
|
|
@@ -307,6 +351,29 @@ interface UserProfile {
|
|
|
307
351
|
address: string;
|
|
308
352
|
appId: string;
|
|
309
353
|
}
|
|
354
|
+
interface EIP712AuthDetails {
|
|
355
|
+
primaryType: string;
|
|
356
|
+
domain: {
|
|
357
|
+
name: string;
|
|
358
|
+
version: string;
|
|
359
|
+
chainId: number;
|
|
360
|
+
verifyingContract: `0x${string}`;
|
|
361
|
+
};
|
|
362
|
+
types: Record<string, Array<{
|
|
363
|
+
name: string;
|
|
364
|
+
type: string;
|
|
365
|
+
}>>;
|
|
366
|
+
message: Record<string, unknown>;
|
|
367
|
+
timestamp: number;
|
|
368
|
+
}
|
|
369
|
+
interface GetEIP712MessageResponse extends EIP712AuthDetails {
|
|
370
|
+
}
|
|
371
|
+
interface RefreshTokenResponse {
|
|
372
|
+
accessToken: string;
|
|
373
|
+
refreshToken: string;
|
|
374
|
+
tokenType: string;
|
|
375
|
+
expiresIn: number;
|
|
376
|
+
}
|
|
310
377
|
type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
|
|
311
378
|
interface CreateAgentWalletResponseDto {
|
|
312
379
|
agentWalletAddress: string;
|
|
@@ -614,57 +681,6 @@ interface TokenSelectorConfig {
|
|
|
614
681
|
index: number;
|
|
615
682
|
}
|
|
616
683
|
|
|
617
|
-
interface PearHyperliquidContextType {
|
|
618
|
-
apiBaseUrl: string;
|
|
619
|
-
wsUrl: string;
|
|
620
|
-
address: string | null;
|
|
621
|
-
setAddress: (address: string | null) => void;
|
|
622
|
-
isConnected: boolean;
|
|
623
|
-
lastError: string | null;
|
|
624
|
-
nativeIsConnected: boolean;
|
|
625
|
-
nativeLastError: string | null;
|
|
626
|
-
authStatus: AuthStatus;
|
|
627
|
-
isAuthenticated: boolean;
|
|
628
|
-
accessToken: string | null;
|
|
629
|
-
user: UserProfile | null;
|
|
630
|
-
authError: string | null;
|
|
631
|
-
getEip712: (address: string) => Promise<any>;
|
|
632
|
-
loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
633
|
-
loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
634
|
-
refreshTokens: () => Promise<any>;
|
|
635
|
-
logout: () => Promise<void>;
|
|
636
|
-
}
|
|
637
|
-
interface PearHyperliquidProviderProps {
|
|
638
|
-
children: ReactNode;
|
|
639
|
-
apiBaseUrl?: string;
|
|
640
|
-
clientId?: string;
|
|
641
|
-
wsUrl?: string;
|
|
642
|
-
}
|
|
643
|
-
/**
|
|
644
|
-
* React Provider for PearHyperliquidClient
|
|
645
|
-
*/
|
|
646
|
-
declare const PearHyperliquidProvider: React.FC<PearHyperliquidProviderProps>;
|
|
647
|
-
/**
|
|
648
|
-
* Hook to access the entire Pear Hyperliquid context.
|
|
649
|
-
* Prefer using the more specific hooks below when possible.
|
|
650
|
-
*/
|
|
651
|
-
declare function usePearHyperliquid(): PearHyperliquidContextType;
|
|
652
|
-
/**
|
|
653
|
-
* Provider-aware Auth hook. Uses auth state/actions provided by PearHyperliquidProvider.
|
|
654
|
-
* Callers do not need to pass baseUrl/clientId.
|
|
655
|
-
*/
|
|
656
|
-
declare function usePearAuth(): {
|
|
657
|
-
readonly status: AuthStatus;
|
|
658
|
-
readonly isAuthenticated: boolean;
|
|
659
|
-
readonly user: UserProfile | null;
|
|
660
|
-
readonly error: string | null;
|
|
661
|
-
readonly getEip712: (address: string) => Promise<any>;
|
|
662
|
-
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
663
|
-
readonly loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
664
|
-
readonly refreshTokens: () => Promise<any>;
|
|
665
|
-
readonly logout: () => Promise<void>;
|
|
666
|
-
};
|
|
667
|
-
|
|
668
684
|
declare const useAccountSummary: () => {
|
|
669
685
|
data: AccountSummaryResponseDto | null;
|
|
670
686
|
isLoading: boolean;
|
|
@@ -809,11 +825,9 @@ declare function useAgentWallet(): {
|
|
|
809
825
|
|
|
810
826
|
interface AutoSyncFillsOptions {
|
|
811
827
|
baseUrl: string;
|
|
812
|
-
accessToken: string;
|
|
813
828
|
address: string | null;
|
|
814
829
|
intervalMs?: number;
|
|
815
830
|
aggregateByTime?: boolean;
|
|
816
|
-
enabled?: boolean;
|
|
817
831
|
}
|
|
818
832
|
interface AutoSyncFillsState {
|
|
819
833
|
lastRunAt: number | null;
|
|
@@ -838,19 +852,19 @@ interface AdjustOrderResponseDto {
|
|
|
838
852
|
usdValue: number;
|
|
839
853
|
updatedAt: string;
|
|
840
854
|
}
|
|
841
|
-
declare function adjustOrder(baseUrl: string,
|
|
855
|
+
declare function adjustOrder(baseUrl: string, orderId: string, payload: AdjustOrderRequestInput): Promise<ApiResponse<AdjustOrderResponseDto>>;
|
|
842
856
|
interface CancelOrderResponseDto {
|
|
843
857
|
orderId: string;
|
|
844
858
|
status: string;
|
|
845
859
|
cancelledAt: string;
|
|
846
860
|
}
|
|
847
|
-
declare function cancelOrder(baseUrl: string,
|
|
861
|
+
declare function cancelOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelOrderResponseDto>>;
|
|
848
862
|
interface CancelTwapResponseDto {
|
|
849
863
|
orderId: string;
|
|
850
864
|
status: string;
|
|
851
865
|
cancelledAt: string;
|
|
852
866
|
}
|
|
853
|
-
declare function cancelTwapOrder(baseUrl: string,
|
|
867
|
+
declare function cancelTwapOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
854
868
|
|
|
855
869
|
type ExecutionType = "MARKET" | "LIMIT" | "TWAP" | "LADDER" | "LIMIT_BTCDOM";
|
|
856
870
|
type TpSlThresholdType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
|
|
@@ -905,10 +919,10 @@ interface CreatePositionResponseDto {
|
|
|
905
919
|
}
|
|
906
920
|
/**
|
|
907
921
|
* Create a position (MARKET/LIMIT/TWAP) using Pear Hyperliquid service
|
|
908
|
-
*
|
|
922
|
+
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
909
923
|
* @throws MinimumPositionSizeError if any asset has less than $11 USD value
|
|
910
924
|
*/
|
|
911
|
-
declare function createPosition(baseUrl: string,
|
|
925
|
+
declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
912
926
|
interface UpdateRiskParametersRequestInput {
|
|
913
927
|
stopLoss?: TpSlThresholdInput | null;
|
|
914
928
|
takeProfit?: TpSlThresholdInput | null;
|
|
@@ -919,7 +933,7 @@ interface UpdateRiskParametersResponseDto {
|
|
|
919
933
|
takeProfit: TpSlThresholdInput | null;
|
|
920
934
|
updatedAt: string;
|
|
921
935
|
}
|
|
922
|
-
declare function updateRiskParameters(baseUrl: string,
|
|
936
|
+
declare function updateRiskParameters(baseUrl: string, positionId: string, payload: UpdateRiskParametersRequestInput): Promise<ApiResponse<UpdateRiskParametersResponseDto>>;
|
|
923
937
|
type CloseExecutionType = "MARKET" | "TWAP";
|
|
924
938
|
interface ClosePositionRequestInput {
|
|
925
939
|
executionType: CloseExecutionType;
|
|
@@ -933,7 +947,7 @@ interface ClosePositionResponseDto {
|
|
|
933
947
|
executionTime?: string;
|
|
934
948
|
chunksScheduled?: number;
|
|
935
949
|
}
|
|
936
|
-
declare function closePosition(baseUrl: string,
|
|
950
|
+
declare function closePosition(baseUrl: string, positionId: string, payload: ClosePositionRequestInput): Promise<ApiResponse<ClosePositionResponseDto>>;
|
|
937
951
|
interface CloseAllPositionsResultDto {
|
|
938
952
|
positionId: string;
|
|
939
953
|
success: boolean;
|
|
@@ -943,7 +957,7 @@ interface CloseAllPositionsResultDto {
|
|
|
943
957
|
interface CloseAllPositionsResponseDto {
|
|
944
958
|
results: CloseAllPositionsResultDto[];
|
|
945
959
|
}
|
|
946
|
-
declare function closeAllPositions(baseUrl: string,
|
|
960
|
+
declare function closeAllPositions(baseUrl: string, payload: ClosePositionRequestInput): Promise<ApiResponse<CloseAllPositionsResponseDto>>;
|
|
947
961
|
type AdjustExecutionType = "MARKET" | "LIMIT";
|
|
948
962
|
type PositionAdjustmentType = "REDUCE" | "INCREASE";
|
|
949
963
|
interface AdjustPositionRequestInput {
|
|
@@ -961,8 +975,8 @@ interface AdjustPositionResponseDto {
|
|
|
961
975
|
newSize: number;
|
|
962
976
|
executedAt: string;
|
|
963
977
|
}
|
|
964
|
-
declare function adjustPosition(baseUrl: string,
|
|
965
|
-
declare function cancelTwap(baseUrl: string,
|
|
978
|
+
declare function adjustPosition(baseUrl: string, positionId: string, payload: AdjustPositionRequestInput): Promise<ApiResponse<AdjustPositionResponseDto>>;
|
|
979
|
+
declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
|
|
966
980
|
|
|
967
981
|
declare function usePosition(): {
|
|
968
982
|
readonly createPosition: (payload: CreatePositionRequestInput) => Promise<ApiResponse<CreatePositionResponseDto>>;
|
|
@@ -1054,9 +1068,9 @@ interface PortfolioResponseDto {
|
|
|
1054
1068
|
/**
|
|
1055
1069
|
* Get portfolio summary buckets and overall metrics
|
|
1056
1070
|
* Returns bucketed volume, open interest snapshot, win/loss trade counts, and overall metrics filtered to PEAR fills (cloid LIKE 0x50454152%)
|
|
1057
|
-
*
|
|
1071
|
+
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
1058
1072
|
*/
|
|
1059
|
-
declare function getPortfolio(baseUrl: string
|
|
1073
|
+
declare function getPortfolio(baseUrl: string): Promise<ApiResponse<PortfolioResponseDto>>;
|
|
1060
1074
|
|
|
1061
1075
|
interface UsePortfolioResult {
|
|
1062
1076
|
data: PortfolioResponseDto | null;
|
|
@@ -1071,6 +1085,18 @@ interface UsePortfolioResult {
|
|
|
1071
1085
|
*/
|
|
1072
1086
|
declare function usePortfolio(): UsePortfolioResult;
|
|
1073
1087
|
|
|
1088
|
+
declare function useAuth(): {
|
|
1089
|
+
readonly isReady: boolean;
|
|
1090
|
+
readonly isAuthenticated: any;
|
|
1091
|
+
readonly accessToken: any;
|
|
1092
|
+
readonly refreshToken: any;
|
|
1093
|
+
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
1094
|
+
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
1095
|
+
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
1096
|
+
readonly refreshTokens: () => Promise<RefreshTokenResponse>;
|
|
1097
|
+
readonly logout: () => Promise<void>;
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1074
1100
|
interface UseHyperliquidWebSocketProps {
|
|
1075
1101
|
wsUrl: string;
|
|
1076
1102
|
address: string | null;
|
|
@@ -1095,17 +1121,17 @@ declare const useHyperliquidNativeWebSocket: ({ address, enabled, }: UseHyperliq
|
|
|
1095
1121
|
/**
|
|
1096
1122
|
* Mark notifications as read up to a given timestamp (ms)
|
|
1097
1123
|
*/
|
|
1098
|
-
declare function markNotificationsRead(baseUrl: string,
|
|
1124
|
+
declare function markNotificationsRead(baseUrl: string, timestampMs: number): Promise<ApiResponse<{
|
|
1099
1125
|
updated: number;
|
|
1100
1126
|
}>>;
|
|
1101
1127
|
/**
|
|
1102
1128
|
* Mark a single notification as read by id
|
|
1103
1129
|
*/
|
|
1104
|
-
declare function markNotificationReadById(baseUrl: string,
|
|
1130
|
+
declare function markNotificationReadById(baseUrl: string, id: string): Promise<ApiResponse<{
|
|
1105
1131
|
updated: number;
|
|
1106
1132
|
}>>;
|
|
1107
1133
|
|
|
1108
|
-
declare function toggleWatchlist(baseUrl: string,
|
|
1134
|
+
declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
|
|
1109
1135
|
|
|
1110
1136
|
/**
|
|
1111
1137
|
* Account summary calculation utility class
|
|
@@ -1247,5 +1273,5 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
|
|
|
1247
1273
|
|
|
1248
1274
|
declare const useMarketData: any;
|
|
1249
1275
|
|
|
1250
|
-
export { AccountSummaryCalculator,
|
|
1251
|
-
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 };
|
|
1276
|
+
export { AccountSummaryCalculator, 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, 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 };
|
|
1277
|
+
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, TwapSliceFillResponseItem, UniverseAsset, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistItemDto, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|