@pear-protocol/hyperliquid-sdk 0.0.60-beta.2 → 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.
- package/dist/hooks/useAuth.d.ts +2 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -3
- package/dist/provider.d.ts +0 -2
- package/package.json +1 -1
package/dist/hooks/useAuth.d.ts
CHANGED
|
@@ -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("
|
|
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,21 +7047,22 @@ 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);
|
|
7059
7061
|
setIsAuthenticated(true);
|
|
7060
|
-
setIsReady(true);
|
|
7061
7062
|
return;
|
|
7062
7063
|
}
|
|
7064
|
+
setIsReady(true);
|
|
7063
7065
|
}
|
|
7064
|
-
setIsReady(true);
|
|
7065
7066
|
}, [
|
|
7066
7067
|
setAccessToken,
|
|
7067
7068
|
setRefreshToken,
|
|
@@ -7187,6 +7188,8 @@ function useAuth() {
|
|
|
7187
7188
|
loginWithPrivyToken,
|
|
7188
7189
|
refreshTokens,
|
|
7189
7190
|
logout: logout$1,
|
|
7191
|
+
setAddress,
|
|
7192
|
+
address,
|
|
7190
7193
|
};
|
|
7191
7194
|
}
|
|
7192
7195
|
|
package/dist/provider.d.ts
CHANGED
|
@@ -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 {
|