@pear-protocol/hyperliquid-sdk 0.0.55-fix → 0.0.55-fix-2
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 +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 +76 -75
- package/dist/index.js +4136 -4024
- 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
package/dist/provider.d.ts
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import type { UserProfile } from './types';
|
|
3
|
-
import { AuthStatus } from './types';
|
|
4
2
|
export interface PearHyperliquidContextType {
|
|
3
|
+
clientId: string;
|
|
5
4
|
apiBaseUrl: string;
|
|
6
5
|
wsUrl: string;
|
|
7
|
-
address: string | null;
|
|
8
|
-
setAddress: (address: string | null) => void;
|
|
9
6
|
isConnected: boolean;
|
|
10
7
|
lastError: string | null;
|
|
11
8
|
nativeIsConnected: boolean;
|
|
12
9
|
nativeLastError: string | null;
|
|
13
|
-
authStatus: AuthStatus;
|
|
14
|
-
isAuthenticated: boolean;
|
|
15
|
-
accessToken: string | null;
|
|
16
|
-
user: UserProfile | null;
|
|
17
|
-
authError: string | null;
|
|
18
|
-
getEip712: (address: string) => Promise<any>;
|
|
19
|
-
loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
20
|
-
loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
21
|
-
refreshTokens: () => Promise<any>;
|
|
22
|
-
logout: () => Promise<void>;
|
|
23
10
|
}
|
|
24
11
|
export declare const PearHyperliquidContext: React.Context<PearHyperliquidContextType | undefined>;
|
|
25
12
|
interface PearHyperliquidProviderProps {
|
|
@@ -37,19 +24,4 @@ export declare const PearHyperliquidProvider: React.FC<PearHyperliquidProviderPr
|
|
|
37
24
|
* Prefer using the more specific hooks below when possible.
|
|
38
25
|
*/
|
|
39
26
|
export declare function usePearHyperliquid(): PearHyperliquidContextType;
|
|
40
|
-
/**
|
|
41
|
-
* Provider-aware Auth hook. Uses auth state/actions provided by PearHyperliquidProvider.
|
|
42
|
-
* Callers do not need to pass baseUrl/clientId.
|
|
43
|
-
*/
|
|
44
|
-
export declare function usePearAuth(): {
|
|
45
|
-
readonly status: AuthStatus;
|
|
46
|
-
readonly isAuthenticated: boolean;
|
|
47
|
-
readonly user: UserProfile | null;
|
|
48
|
-
readonly error: string | null;
|
|
49
|
-
readonly getEip712: (address: string) => Promise<any>;
|
|
50
|
-
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
51
|
-
readonly loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
52
|
-
readonly refreshTokens: () => Promise<any>;
|
|
53
|
-
readonly logout: () => Promise<void>;
|
|
54
|
-
};
|
|
55
27
|
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -335,12 +335,6 @@ export interface AddressState {
|
|
|
335
335
|
autoConnect: boolean;
|
|
336
336
|
previousAddresses: string[];
|
|
337
337
|
}
|
|
338
|
-
export declare enum AuthStatus {
|
|
339
|
-
Idle = "idle",
|
|
340
|
-
Authenticating = "authenticating",
|
|
341
|
-
Authenticated = "authenticated",
|
|
342
|
-
Error = "error"
|
|
343
|
-
}
|
|
344
338
|
export interface UseAuthOptions {
|
|
345
339
|
baseUrl: string;
|
|
346
340
|
clientId: string;
|
|
@@ -356,7 +350,7 @@ export interface EIP712AuthDetails {
|
|
|
356
350
|
name: string;
|
|
357
351
|
version: string;
|
|
358
352
|
chainId: number;
|
|
359
|
-
verifyingContract: string
|
|
353
|
+
verifyingContract: `0x${string}`;
|
|
360
354
|
};
|
|
361
355
|
types: Record<string, Array<{
|
|
362
356
|
name: string;
|
package/dist/utils/http.d.ts
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
1
2
|
import { ApiErrorResponse } from '../types';
|
|
2
3
|
export declare function toApiError(error: unknown): ApiErrorResponse;
|
|
3
4
|
export declare function joinUrl(baseUrl: string, path: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Shared Axios instance with interceptors.
|
|
7
|
+
* - Request: inject Authorization headers from buildAuthHeaders when absent
|
|
8
|
+
* - Response: on 401, clear tokens and emit a logout event
|
|
9
|
+
*/
|
|
10
|
+
export declare const apiClient: AxiosInstance;
|
|
11
|
+
/**
|
|
12
|
+
* Attach auth-aware Axios interceptors to `apiClient`.
|
|
13
|
+
* - Request: adds `Authorization: Bearer <accessToken>` for requests to `apiBaseUrl`.
|
|
14
|
+
* - Response: if a request returns 401, attempts token refresh and retries the request.
|
|
15
|
+
* If the 401 came from the refresh endpoint (or refresh fails/returns 401), calls `logout()`.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare function addAuthInterceptors(params: {
|
|
19
|
+
apiBaseUrl: string;
|
|
20
|
+
getAccessToken: () => string | null;
|
|
21
|
+
refreshTokens: () => Promise<{
|
|
22
|
+
accessToken: string;
|
|
23
|
+
refreshToken: string;
|
|
24
|
+
} | any>;
|
|
25
|
+
logout: () => Promise<void> | void;
|
|
26
|
+
}): () => void;
|