@pear-protocol/hyperliquid-sdk 0.0.60-beta.3 → 0.0.60-beta.4

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.
@@ -9,4 +9,6 @@ export declare function useAuth(): {
9
9
  readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
10
10
  readonly refreshTokens: () => Promise<import("../types").RefreshTokenResponse>;
11
11
  readonly logout: () => Promise<void>;
12
+ readonly setAddress: (address: string | null) => void;
13
+ readonly address: string | null;
12
14
  };
package/dist/index.d.ts CHANGED
@@ -9,8 +9,6 @@ interface PearHyperliquidContextType {
9
9
  lastError: string | null;
10
10
  nativeIsConnected: boolean;
11
11
  nativeLastError: string | null;
12
- setAddress: (address: string) => void;
13
- address: string | null;
14
12
  }
15
13
  interface PearHyperliquidProviderProps {
16
14
  children: ReactNode;
@@ -1128,6 +1126,8 @@ declare function useAuth(): {
1128
1126
  readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
1129
1127
  readonly refreshTokens: () => Promise<RefreshTokenResponse>;
1130
1128
  readonly logout: () => Promise<void>;
1129
+ readonly setAddress: (address: string | null) => void;
1130
+ readonly address: string | null;
1131
1131
  };
1132
1132
 
1133
1133
  interface UseHyperliquidWebSocketProps {
package/dist/index.js CHANGED
@@ -7029,7 +7029,7 @@ async function logout(baseUrl, refreshTokenVal) {
7029
7029
  function useAuth() {
7030
7030
  const context = useContext(PearHyperliquidContext);
7031
7031
  if (!context) {
7032
- throw new Error("usePortfolio must be used within a PearHyperliquidProvider");
7032
+ throw new Error("useAuth must be used within a PearHyperliquidProvider");
7033
7033
  }
7034
7034
  const { apiBaseUrl, clientId } = context;
7035
7035
  const [isReady, setIsReady] = useState(false);
@@ -7047,12 +7047,14 @@ function useAuth() {
7047
7047
  }
7048
7048
  // Get the current address from state if it exists
7049
7049
  const currentAddress = address;
7050
+ console.log({ currentAddress });
7050
7051
  if (currentAddress) {
7051
7052
  // If we already have an address in state, use it to load the session
7052
7053
  const accessTokenKey = `${currentAddress}_accessToken`;
7053
7054
  const refreshTokenKey = `${currentAddress}_refreshToken`;
7054
7055
  const storedAccessToken = localStorage.getItem(accessTokenKey);
7055
7056
  const storedRefreshToken = localStorage.getItem(refreshTokenKey);
7057
+ console.log({ storedAccessToken, storedRefreshToken });
7056
7058
  if (storedAccessToken && storedRefreshToken) {
7057
7059
  setAccessToken(storedAccessToken);
7058
7060
  setRefreshToken(storedRefreshToken);
@@ -7186,6 +7188,8 @@ function useAuth() {
7186
7188
  loginWithPrivyToken,
7187
7189
  refreshTokens,
7188
7190
  logout: logout$1,
7191
+ setAddress,
7192
+ address,
7189
7193
  };
7190
7194
  }
7191
7195
 
@@ -7,8 +7,6 @@ export interface PearHyperliquidContextType {
7
7
  lastError: string | null;
8
8
  nativeIsConnected: boolean;
9
9
  nativeLastError: string | null;
10
- setAddress: (address: string) => void;
11
- address: string | null;
12
10
  }
13
11
  export declare const PearHyperliquidContext: React.Context<PearHyperliquidContextType | undefined>;
14
12
  interface PearHyperliquidProviderProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/hyperliquid-sdk",
3
- "version": "0.0.60-beta.3",
3
+ "version": "0.0.60-beta.4",
4
4
  "description": "React SDK for Pear Protocol Hyperliquid API integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",