@pear-protocol/hyperliquid-sdk 0.0.55 → 0.0.57

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.
@@ -1,3 +1,3 @@
1
1
  import type { ApiResponse, GetAgentWalletResponseDto, CreateAgentWalletResponseDto } from '../types';
2
- export declare function getAgentWallet(baseUrl: string, accessToken: string): Promise<ApiResponse<GetAgentWalletResponseDto>>;
3
- export declare function createAgentWallet(baseUrl: string, accessToken: string): Promise<ApiResponse<CreateAgentWalletResponseDto>>;
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, accessToken: string, timestampMs: number): Promise<ApiResponse<{
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, accessToken: string, id: string): Promise<ApiResponse<{
11
+ export declare function markNotificationReadById(baseUrl: string, id: string): Promise<ApiResponse<{
12
12
  updated: number;
13
13
  }>>;
@@ -9,16 +9,16 @@ export interface AdjustOrderResponseDto {
9
9
  usdValue: number;
10
10
  updatedAt: string;
11
11
  }
12
- export declare function adjustOrder(baseUrl: string, accessToken: string, orderId: string, payload: AdjustOrderRequestInput): Promise<ApiResponse<AdjustOrderResponseDto>>;
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, accessToken: string, orderId: string): Promise<ApiResponse<CancelOrderResponseDto>>;
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, accessToken: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
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
- * Caller should supply an accessToken from localStorage.getItem('accessToken')
37
+ * Authorization is derived from headers (Axios defaults or browser localStorage fallback)
38
38
  */
39
- export declare function getPortfolio(baseUrl: string, accessToken: string): Promise<ApiResponse<PortfolioResponseDto>>;
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
- * Caller should supply an accessToken from localStorage.getItem('accessToken')
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, accessToken: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
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, accessToken: string, positionId: string, payload: UpdateRiskParametersRequestInput): Promise<ApiResponse<UpdateRiskParametersResponseDto>>;
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, accessToken: string, positionId: string, payload: ClosePositionRequestInput): Promise<ApiResponse<ClosePositionResponseDto>>;
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, accessToken: string, payload: ClosePositionRequestInput): Promise<ApiResponse<CloseAllPositionsResponseDto>>;
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,19 @@ export interface AdjustPositionResponseDto {
109
109
  newSize: number;
110
110
  executedAt: string;
111
111
  }
112
- export declare function adjustPosition(baseUrl: string, accessToken: string, positionId: string, payload: AdjustPositionRequestInput): Promise<ApiResponse<AdjustPositionResponseDto>>;
113
- export declare function cancelTwap(baseUrl: string, accessToken: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
112
+ export declare function adjustPosition(baseUrl: string, positionId: string, payload: AdjustPositionRequestInput): Promise<ApiResponse<AdjustPositionResponseDto>>;
113
+ export interface AdjustAdvanceAssetInput {
114
+ asset: string;
115
+ size: number;
116
+ }
117
+ export interface AdjustAdvanceItemInput {
118
+ longAssets?: AdjustAdvanceAssetInput[];
119
+ shortAssets?: AdjustAdvanceAssetInput[];
120
+ }
121
+ export interface AdjustAdvanceResponseDto {
122
+ orderId: string;
123
+ status: string;
124
+ executedAt: string;
125
+ }
126
+ export declare function adjustAdvancePosition(baseUrl: string, accessToken: string, positionId: string, payload: AdjustAdvanceItemInput[], displayToFull: Map<string, string>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
127
+ export declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
@@ -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, accessToken: string, payload: SyncFillsRequestDto) => Promise<ApiResponse<SyncFillsResponseDto>>;
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, accessToken: string, user: string, aggregateByTime: boolean | undefined, lastSyncAt: number | null | undefined, assetPositions: AssetPosition[]) => Promise<ApiResponse<SyncFillsResponseDto>>;
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, accessToken: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
2
+ export declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
@@ -15,3 +15,4 @@ export * from './useNotifications';
15
15
  export * from './useMarketData';
16
16
  export * from './useWatchlist';
17
17
  export * from './usePortfolio';
18
+ export * from './useAuth';
@@ -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;
@@ -1,4 +1,4 @@
1
- import { type CreatePositionRequestInput, type CreatePositionResponseDto, type UpdateRiskParametersRequestInput, type UpdateRiskParametersResponseDto, type ClosePositionRequestInput, type ClosePositionResponseDto, type CloseAllPositionsResponseDto, type AdjustPositionRequestInput, type AdjustPositionResponseDto } from '../clients/positions';
1
+ import { type CreatePositionRequestInput, type CreatePositionResponseDto, type UpdateRiskParametersRequestInput, type UpdateRiskParametersResponseDto, type ClosePositionRequestInput, type ClosePositionResponseDto, type CloseAllPositionsResponseDto, type AdjustPositionRequestInput, type AdjustPositionResponseDto, type AdjustAdvanceItemInput, type AdjustAdvanceResponseDto } from '../clients/positions';
2
2
  import type { ApiResponse, OpenPositionDto } from '../types';
3
3
  export declare function usePosition(): {
4
4
  readonly createPosition: (payload: CreatePositionRequestInput) => Promise<ApiResponse<CreatePositionResponseDto>>;
@@ -6,6 +6,7 @@ export declare function usePosition(): {
6
6
  readonly closePosition: (positionId: string, payload: ClosePositionRequestInput) => Promise<ApiResponse<ClosePositionResponseDto>>;
7
7
  readonly closeAllPositions: (payload: ClosePositionRequestInput) => Promise<ApiResponse<CloseAllPositionsResponseDto>>;
8
8
  readonly adjustPosition: (positionId: string, payload: AdjustPositionRequestInput) => Promise<ApiResponse<AdjustPositionResponseDto>>;
9
+ readonly adjustAdvancePosition: (positionId: string, payload: AdjustAdvanceItemInput[]) => Promise<ApiResponse<AdjustAdvanceResponseDto>>;
9
10
  readonly openPositions: OpenPositionDto[] | null;
10
11
  readonly isLoading: boolean;
11
12
  };
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;
@@ -171,8 +196,10 @@ interface TradeHistoryDataDto {
171
196
  exitRatio: number;
172
197
  entryPriceRatio?: number;
173
198
  exitpPriceRatio?: number;
174
- longAssets: TradeHistoryAssetDataDto[];
175
- shortAssets: TradeHistoryAssetDataDto[];
199
+ closedLongAssets: TradeHistoryAssetDataDto[];
200
+ closedShortAssets: TradeHistoryAssetDataDto[];
201
+ positionLongAssets?: string[];
202
+ positionShortAssets?: string[];
176
203
  createdAt: string;
177
204
  }
178
205
  /**
@@ -198,6 +225,7 @@ interface PositionAssetDetailDto {
198
225
  unrealizedPnl: number;
199
226
  liquidationPrice: number;
200
227
  initialWeight: number;
228
+ fundingPaid?: number;
201
229
  }
202
230
  interface TpSlThreshold {
203
231
  type: 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
@@ -317,12 +345,6 @@ interface AccountSummaryResponseDto {
317
345
  balanceSummary: BalanceSummaryDto;
318
346
  agentWallet?: AgentWalletDto;
319
347
  }
320
- declare enum AuthStatus {
321
- Idle = "idle",
322
- Authenticating = "authenticating",
323
- Authenticated = "authenticated",
324
- Error = "error"
325
- }
326
348
  interface UseAuthOptions {
327
349
  baseUrl: string;
328
350
  clientId: string;
@@ -332,6 +354,29 @@ interface UserProfile {
332
354
  address: string;
333
355
  appId: string;
334
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
+ }
335
380
  type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
336
381
  interface CreateAgentWalletResponseDto {
337
382
  agentWalletAddress: string;
@@ -504,6 +549,7 @@ interface RawAssetDto {
504
549
  entryPrice: number;
505
550
  size: number;
506
551
  side: string;
552
+ fundingPaid?: number;
507
553
  }
508
554
  /**
509
555
  * Raw position data from open-positions channel
@@ -639,57 +685,6 @@ interface TokenSelectorConfig {
639
685
  index: number;
640
686
  }
641
687
 
642
- interface PearHyperliquidContextType {
643
- apiBaseUrl: string;
644
- wsUrl: string;
645
- address: string | null;
646
- setAddress: (address: string | null) => void;
647
- isConnected: boolean;
648
- lastError: string | null;
649
- nativeIsConnected: boolean;
650
- nativeLastError: string | null;
651
- authStatus: AuthStatus;
652
- isAuthenticated: boolean;
653
- accessToken: string | null;
654
- user: UserProfile | null;
655
- authError: string | null;
656
- getEip712: (address: string) => Promise<any>;
657
- loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
658
- loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
659
- refreshTokens: () => Promise<any>;
660
- logout: () => Promise<void>;
661
- }
662
- interface PearHyperliquidProviderProps {
663
- children: ReactNode;
664
- apiBaseUrl?: string;
665
- clientId?: string;
666
- wsUrl?: string;
667
- }
668
- /**
669
- * React Provider for PearHyperliquidClient
670
- */
671
- declare const PearHyperliquidProvider: React.FC<PearHyperliquidProviderProps>;
672
- /**
673
- * Hook to access the entire Pear Hyperliquid context.
674
- * Prefer using the more specific hooks below when possible.
675
- */
676
- declare function usePearHyperliquid(): PearHyperliquidContextType;
677
- /**
678
- * Provider-aware Auth hook. Uses auth state/actions provided by PearHyperliquidProvider.
679
- * Callers do not need to pass baseUrl/clientId.
680
- */
681
- declare function usePearAuth(): {
682
- readonly status: AuthStatus;
683
- readonly isAuthenticated: boolean;
684
- readonly user: UserProfile | null;
685
- readonly error: string | null;
686
- readonly getEip712: (address: string) => Promise<any>;
687
- readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
688
- readonly loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
689
- readonly refreshTokens: () => Promise<any>;
690
- readonly logout: () => Promise<void>;
691
- };
692
-
693
688
  declare const useAccountSummary: () => {
694
689
  data: AccountSummaryResponseDto | null;
695
690
  isLoading: boolean;
@@ -834,11 +829,9 @@ declare function useAgentWallet(): {
834
829
 
835
830
  interface AutoSyncFillsOptions {
836
831
  baseUrl: string;
837
- accessToken: string;
838
832
  address: string | null;
839
833
  intervalMs?: number;
840
834
  aggregateByTime?: boolean;
841
- enabled?: boolean;
842
835
  }
843
836
  interface AutoSyncFillsState {
844
837
  lastRunAt: number | null;
@@ -863,19 +856,19 @@ interface AdjustOrderResponseDto {
863
856
  usdValue: number;
864
857
  updatedAt: string;
865
858
  }
866
- declare function adjustOrder(baseUrl: string, accessToken: string, orderId: string, payload: AdjustOrderRequestInput): Promise<ApiResponse<AdjustOrderResponseDto>>;
859
+ declare function adjustOrder(baseUrl: string, orderId: string, payload: AdjustOrderRequestInput): Promise<ApiResponse<AdjustOrderResponseDto>>;
867
860
  interface CancelOrderResponseDto {
868
861
  orderId: string;
869
862
  status: string;
870
863
  cancelledAt: string;
871
864
  }
872
- declare function cancelOrder(baseUrl: string, accessToken: string, orderId: string): Promise<ApiResponse<CancelOrderResponseDto>>;
865
+ declare function cancelOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelOrderResponseDto>>;
873
866
  interface CancelTwapResponseDto {
874
867
  orderId: string;
875
868
  status: string;
876
869
  cancelledAt: string;
877
870
  }
878
- declare function cancelTwapOrder(baseUrl: string, accessToken: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
871
+ declare function cancelTwapOrder(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
879
872
 
880
873
  type ExecutionType = "MARKET" | "LIMIT" | "TWAP" | "LADDER" | "LIMIT_BTCDOM";
881
874
  type TpSlThresholdType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
@@ -930,10 +923,10 @@ interface CreatePositionResponseDto {
930
923
  }
931
924
  /**
932
925
  * Create a position (MARKET/LIMIT/TWAP) using Pear Hyperliquid service
933
- * Caller should supply an accessToken from localStorage.getItem('accessToken')
926
+ * Authorization is derived from headers (Axios defaults or browser localStorage fallback)
934
927
  * @throws MinimumPositionSizeError if any asset has less than $11 USD value
935
928
  */
936
- declare function createPosition(baseUrl: string, accessToken: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
929
+ declare function createPosition(baseUrl: string, payload: CreatePositionRequestInput, displayToFull: Map<string, string>): Promise<ApiResponse<CreatePositionResponseDto>>;
937
930
  interface UpdateRiskParametersRequestInput {
938
931
  stopLoss?: TpSlThresholdInput | null;
939
932
  takeProfit?: TpSlThresholdInput | null;
@@ -944,7 +937,7 @@ interface UpdateRiskParametersResponseDto {
944
937
  takeProfit: TpSlThresholdInput | null;
945
938
  updatedAt: string;
946
939
  }
947
- declare function updateRiskParameters(baseUrl: string, accessToken: string, positionId: string, payload: UpdateRiskParametersRequestInput): Promise<ApiResponse<UpdateRiskParametersResponseDto>>;
940
+ declare function updateRiskParameters(baseUrl: string, positionId: string, payload: UpdateRiskParametersRequestInput): Promise<ApiResponse<UpdateRiskParametersResponseDto>>;
948
941
  type CloseExecutionType = "MARKET" | "TWAP";
949
942
  interface ClosePositionRequestInput {
950
943
  executionType: CloseExecutionType;
@@ -958,7 +951,7 @@ interface ClosePositionResponseDto {
958
951
  executionTime?: string;
959
952
  chunksScheduled?: number;
960
953
  }
961
- declare function closePosition(baseUrl: string, accessToken: string, positionId: string, payload: ClosePositionRequestInput): Promise<ApiResponse<ClosePositionResponseDto>>;
954
+ declare function closePosition(baseUrl: string, positionId: string, payload: ClosePositionRequestInput): Promise<ApiResponse<ClosePositionResponseDto>>;
962
955
  interface CloseAllPositionsResultDto {
963
956
  positionId: string;
964
957
  success: boolean;
@@ -968,7 +961,7 @@ interface CloseAllPositionsResultDto {
968
961
  interface CloseAllPositionsResponseDto {
969
962
  results: CloseAllPositionsResultDto[];
970
963
  }
971
- declare function closeAllPositions(baseUrl: string, accessToken: string, payload: ClosePositionRequestInput): Promise<ApiResponse<CloseAllPositionsResponseDto>>;
964
+ declare function closeAllPositions(baseUrl: string, payload: ClosePositionRequestInput): Promise<ApiResponse<CloseAllPositionsResponseDto>>;
972
965
  type AdjustExecutionType = "MARKET" | "LIMIT";
973
966
  type PositionAdjustmentType = "REDUCE" | "INCREASE";
974
967
  interface AdjustPositionRequestInput {
@@ -986,8 +979,22 @@ interface AdjustPositionResponseDto {
986
979
  newSize: number;
987
980
  executedAt: string;
988
981
  }
989
- declare function adjustPosition(baseUrl: string, accessToken: string, positionId: string, payload: AdjustPositionRequestInput): Promise<ApiResponse<AdjustPositionResponseDto>>;
990
- declare function cancelTwap(baseUrl: string, accessToken: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
982
+ declare function adjustPosition(baseUrl: string, positionId: string, payload: AdjustPositionRequestInput): Promise<ApiResponse<AdjustPositionResponseDto>>;
983
+ interface AdjustAdvanceAssetInput {
984
+ asset: string;
985
+ size: number;
986
+ }
987
+ interface AdjustAdvanceItemInput {
988
+ longAssets?: AdjustAdvanceAssetInput[];
989
+ shortAssets?: AdjustAdvanceAssetInput[];
990
+ }
991
+ interface AdjustAdvanceResponseDto {
992
+ orderId: string;
993
+ status: string;
994
+ executedAt: string;
995
+ }
996
+ declare function adjustAdvancePosition(baseUrl: string, accessToken: string, positionId: string, payload: AdjustAdvanceItemInput[], displayToFull: Map<string, string>): Promise<ApiResponse<AdjustAdvanceResponseDto>>;
997
+ declare function cancelTwap(baseUrl: string, orderId: string): Promise<ApiResponse<CancelTwapResponseDto>>;
991
998
 
992
999
  declare function usePosition(): {
993
1000
  readonly createPosition: (payload: CreatePositionRequestInput) => Promise<ApiResponse<CreatePositionResponseDto>>;
@@ -995,6 +1002,7 @@ declare function usePosition(): {
995
1002
  readonly closePosition: (positionId: string, payload: ClosePositionRequestInput) => Promise<ApiResponse<ClosePositionResponseDto>>;
996
1003
  readonly closeAllPositions: (payload: ClosePositionRequestInput) => Promise<ApiResponse<CloseAllPositionsResponseDto>>;
997
1004
  readonly adjustPosition: (positionId: string, payload: AdjustPositionRequestInput) => Promise<ApiResponse<AdjustPositionResponseDto>>;
1005
+ readonly adjustAdvancePosition: (positionId: string, payload: AdjustAdvanceItemInput[]) => Promise<ApiResponse<AdjustAdvanceResponseDto>>;
998
1006
  readonly openPositions: OpenPositionDto[] | null;
999
1007
  readonly isLoading: boolean;
1000
1008
  };
@@ -1079,9 +1087,9 @@ interface PortfolioResponseDto {
1079
1087
  /**
1080
1088
  * Get portfolio summary buckets and overall metrics
1081
1089
  * Returns bucketed volume, open interest snapshot, win/loss trade counts, and overall metrics filtered to PEAR fills (cloid LIKE 0x50454152%)
1082
- * Caller should supply an accessToken from localStorage.getItem('accessToken')
1090
+ * Authorization is derived from headers (Axios defaults or browser localStorage fallback)
1083
1091
  */
1084
- declare function getPortfolio(baseUrl: string, accessToken: string): Promise<ApiResponse<PortfolioResponseDto>>;
1092
+ declare function getPortfolio(baseUrl: string): Promise<ApiResponse<PortfolioResponseDto>>;
1085
1093
 
1086
1094
  interface UsePortfolioResult {
1087
1095
  data: PortfolioResponseDto | null;
@@ -1096,6 +1104,18 @@ interface UsePortfolioResult {
1096
1104
  */
1097
1105
  declare function usePortfolio(): UsePortfolioResult;
1098
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
+
1099
1119
  interface UseHyperliquidWebSocketProps {
1100
1120
  wsUrl: string;
1101
1121
  address: string | null;
@@ -1120,17 +1140,17 @@ declare const useHyperliquidNativeWebSocket: ({ address, enabled, }: UseHyperliq
1120
1140
  /**
1121
1141
  * Mark notifications as read up to a given timestamp (ms)
1122
1142
  */
1123
- declare function markNotificationsRead(baseUrl: string, accessToken: string, timestampMs: number): Promise<ApiResponse<{
1143
+ declare function markNotificationsRead(baseUrl: string, timestampMs: number): Promise<ApiResponse<{
1124
1144
  updated: number;
1125
1145
  }>>;
1126
1146
  /**
1127
1147
  * Mark a single notification as read by id
1128
1148
  */
1129
- declare function markNotificationReadById(baseUrl: string, accessToken: string, id: string): Promise<ApiResponse<{
1149
+ declare function markNotificationReadById(baseUrl: string, id: string): Promise<ApiResponse<{
1130
1150
  updated: number;
1131
1151
  }>>;
1132
1152
 
1133
- declare function toggleWatchlist(baseUrl: string, accessToken: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
1153
+ declare function toggleWatchlist(baseUrl: string, longAssets: WatchlistAssetDto[], shortAssets: WatchlistAssetDto[], displayToFull: Map<string, string>): Promise<ApiResponse<ToggleWatchlistResponseDto>>;
1134
1154
 
1135
1155
  /**
1136
1156
  * Account summary calculation utility class
@@ -1272,5 +1292,5 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
1272
1292
 
1273
1293
  declare const useMarketData: any;
1274
1294
 
1275
- 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 };
1276
- 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 };
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 };
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 };