@pear-protocol/hyperliquid-sdk 0.0.44 → 0.0.46
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/README.md +111 -98
- package/dist/clients/portfolio.d.ts +39 -0
- package/dist/clients/positions.d.ts +11 -10
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/usePortfolio.d.ts +13 -0
- package/dist/index.d.ts +104 -23
- package/dist/index.js +231 -44
- package/dist/utils/position-validator.d.ts +41 -0
- package/package.json +1 -1
- package/dist/hooks/useAuth.d.ts +0 -12
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PairAssetInput } from "../clients/positions";
|
|
2
|
+
/**
|
|
3
|
+
* Minimum USD value required per asset when creating a position
|
|
4
|
+
*/
|
|
5
|
+
export declare const MINIMUM_ASSET_USD_VALUE = 11;
|
|
6
|
+
/**
|
|
7
|
+
* Validation error for minimum position size
|
|
8
|
+
*/
|
|
9
|
+
export declare class MinimumPositionSizeError extends Error {
|
|
10
|
+
assetName: string;
|
|
11
|
+
assetValue: number;
|
|
12
|
+
minimumRequired: number;
|
|
13
|
+
constructor(assetName: string, assetValue: number, minimumRequired: number);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validates that each asset in a position has at least the minimum USD value
|
|
17
|
+
* @param usdValue Total USD value for the position
|
|
18
|
+
* @param longAssets Array of long assets with weights
|
|
19
|
+
* @param shortAssets Array of short assets with weights
|
|
20
|
+
* @throws MinimumPositionSizeError if any asset has less than the minimum USD value
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateMinimumAssetSize(usdValue: number, longAssets?: PairAssetInput[], shortAssets?: PairAssetInput[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Calculates the minimum USD value required for a position based on the number of assets
|
|
25
|
+
* @param longAssets Array of long assets
|
|
26
|
+
* @param shortAssets Array of short assets
|
|
27
|
+
* @returns The minimum total USD value required
|
|
28
|
+
*/
|
|
29
|
+
export declare function calculateMinimumPositionValue(longAssets?: PairAssetInput[], shortAssets?: PairAssetInput[]): number;
|
|
30
|
+
/**
|
|
31
|
+
* Validates and provides a user-friendly error message with suggestions
|
|
32
|
+
* @param usdValue Total USD value for the position
|
|
33
|
+
* @param longAssets Array of long assets with weights
|
|
34
|
+
* @param shortAssets Array of short assets with weights
|
|
35
|
+
* @returns Validation result with success flag and optional error message
|
|
36
|
+
*/
|
|
37
|
+
export declare function validatePositionSize(usdValue: number, longAssets?: PairAssetInput[], shortAssets?: PairAssetInput[]): {
|
|
38
|
+
valid: boolean;
|
|
39
|
+
error?: string;
|
|
40
|
+
minimumRequired?: number;
|
|
41
|
+
};
|
package/package.json
CHANGED
package/dist/hooks/useAuth.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare function useAuth(): {
|
|
2
|
-
readonly status: import("..").AuthStatus;
|
|
3
|
-
readonly isAuthenticated: boolean;
|
|
4
|
-
readonly accessToken: string | null;
|
|
5
|
-
readonly user: import("..").UserProfile | null;
|
|
6
|
-
readonly error: string | null;
|
|
7
|
-
readonly getEip712: (address: string) => Promise<any>;
|
|
8
|
-
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
9
|
-
readonly loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
10
|
-
readonly refreshTokens: () => Promise<any>;
|
|
11
|
-
readonly logout: () => Promise<void>;
|
|
12
|
-
};
|