@pear-protocol/hyperliquid-sdk 0.1.25 → 0.1.27

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,5 +1,5 @@
1
1
  import type { ApiResponse, GetEIP712MessageResponse, AuthenticateRequest, AuthenticateResponse, RefreshTokenResponse, LogoutResponse } from "../types";
2
- export declare function getEIP712Message(baseUrl: string, address: string, clientId: string): Promise<ApiResponse<GetEIP712MessageResponse>>;
2
+ export declare function getEIP712Message(baseUrl: string, address: string, clientId: string, chainId?: number): Promise<ApiResponse<GetEIP712MessageResponse>>;
3
3
  export declare function authenticate(baseUrl: string, body: AuthenticateRequest): Promise<ApiResponse<AuthenticateResponse>>;
4
4
  /**
5
5
  * Convenience wrapper for Privy access token authentication
@@ -5,8 +5,8 @@ export declare function useAuth(): {
5
5
  readonly address: string | null;
6
6
  readonly accessToken: string | null;
7
7
  readonly refreshToken: string | null;
8
- readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
9
- readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
8
+ readonly getEip712: (address: string, chainId?: number) => Promise<GetEIP712MessageResponse>;
9
+ readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number, chainId?: number) => Promise<void>;
10
10
  readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
11
11
  readonly refreshTokens: () => Promise<import("../types").RefreshTokenResponse>;
12
12
  readonly logout: () => Promise<void>;
package/dist/index.d.ts CHANGED
@@ -1472,8 +1472,8 @@ declare function useAuth(): {
1472
1472
  readonly address: string | null;
1473
1473
  readonly accessToken: string | null;
1474
1474
  readonly refreshToken: string | null;
1475
- readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
1476
- readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
1475
+ readonly getEip712: (address: string, chainId?: number) => Promise<GetEIP712MessageResponse>;
1476
+ readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number, chainId?: number) => Promise<void>;
1477
1477
  readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
1478
1478
  readonly refreshTokens: () => Promise<RefreshTokenResponse>;
1479
1479
  readonly logout: () => Promise<void>;
package/dist/index.js CHANGED
@@ -7817,11 +7817,15 @@ function usePortfolio() {
7817
7817
  };
7818
7818
  }
7819
7819
 
7820
- async function getEIP712Message(baseUrl, address, clientId) {
7820
+ async function getEIP712Message(baseUrl, address, clientId, chainId) {
7821
7821
  const url = joinUrl(baseUrl, "/auth/eip712-message");
7822
7822
  try {
7823
7823
  const resp = await apiClient.get(url, {
7824
- params: { address, clientId },
7824
+ params: {
7825
+ address,
7826
+ chainId,
7827
+ clientId,
7828
+ },
7825
7829
  timeout: 30000,
7826
7830
  });
7827
7831
  return {
@@ -8044,17 +8048,17 @@ function useAuth() {
8044
8048
  clearTimeout(timer);
8045
8049
  };
8046
8050
  }, [address, refreshToken$1]);
8047
- async function getEip712(address) {
8048
- const { data } = await getEIP712Message(apiBaseUrl, address, clientId);
8051
+ async function getEip712(address, chainId) {
8052
+ const { data } = await getEIP712Message(apiBaseUrl, address, clientId, chainId);
8049
8053
  return data;
8050
8054
  }
8051
- async function loginWithSignedMessage(address, signature, timestamp) {
8055
+ async function loginWithSignedMessage(address, signature, timestamp, chainId) {
8052
8056
  try {
8053
8057
  const { data } = await authenticate(apiBaseUrl, {
8054
8058
  method: 'eip712',
8055
8059
  address,
8056
8060
  clientId,
8057
- details: { signature, timestamp },
8061
+ details: { signature, timestamp, chainId },
8058
8062
  });
8059
8063
  const accessTokenKey = `${address}_accessToken`;
8060
8064
  const refreshTokenKey = `${address}_refreshToken`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/hyperliquid-sdk",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "React SDK for Pear Protocol Hyperliquid API integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",