@pear-protocol/hyperliquid-sdk 0.0.15 → 0.0.17

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/types.d.ts CHANGED
@@ -223,7 +223,7 @@ export interface WebSocketSubscribeMessage {
223
223
  /**
224
224
  * WebSocket response message
225
225
  */
226
- export interface WebSocketResponse {
226
+ export interface WebSocketAckResponse {
227
227
  success?: boolean;
228
228
  message?: string;
229
229
  error?: string;
@@ -422,9 +422,16 @@ export interface WebSocketMessage {
422
422
  /**
423
423
  * WebSocket response from HyperLiquid native API
424
424
  */
425
- export interface WebSocketResponse {
426
- channel: string;
427
- data: any;
425
+ export type HLChannel = 'webData2' | 'allMids' | 'activeAssetData' | 'candle';
426
+ export interface HLChannelDataMap {
427
+ webData2: WebData2Response;
428
+ allMids: WsAllMidsData;
429
+ activeAssetData: ActiveAssetData;
430
+ candle: CandleData;
431
+ }
432
+ export interface HLWebSocketResponse<T extends HLChannel = HLChannel> {
433
+ channel: T;
434
+ data: HLChannelDataMap[T];
428
435
  }
429
436
  /**
430
437
  * All mids data structure
@@ -463,26 +470,27 @@ export interface WebData2Response {
463
470
  meta: {
464
471
  universe: UniverseAsset[];
465
472
  };
466
- clearinghouseState: {
467
- assetPositions: AssetPosition[];
468
- crossMaintenanceMarginUsed: string;
469
- crossMarginSummary: {
470
- accountValue: string;
471
- totalMarginUsed: string;
472
- totalNtlPos: string;
473
- totalRawUsd: string;
474
- };
475
- marginSummary: {
476
- accountValue: string;
477
- totalMarginUsed: string;
478
- totalNtlPos: string;
479
- totalRawUsd: string;
480
- };
481
- time: number;
482
- withdrawable: string;
483
- };
473
+ clearinghouseState: ClearinghouseState;
484
474
  perpsAtOpenInterestCap?: string[];
485
475
  }
476
+ export interface ClearinghouseState {
477
+ assetPositions: AssetPosition[];
478
+ crossMaintenanceMarginUsed: string;
479
+ crossMarginSummary: {
480
+ accountValue: string;
481
+ totalMarginUsed: string;
482
+ totalNtlPos: string;
483
+ totalRawUsd: string;
484
+ };
485
+ marginSummary: {
486
+ accountValue: string;
487
+ totalMarginUsed: string;
488
+ totalNtlPos: string;
489
+ totalRawUsd: string;
490
+ };
491
+ time: number;
492
+ withdrawable: string;
493
+ }
486
494
  /**
487
495
  * Asset position data
488
496
  */
@@ -16,24 +16,7 @@ export declare class AccountSummaryCalculator {
16
16
  /**
17
17
  * Get real-time clearinghouse state from webData2
18
18
  */
19
- getClearinghouseState(): {
20
- assetPositions: import("../types").AssetPosition[];
21
- crossMaintenanceMarginUsed: string;
22
- crossMarginSummary: {
23
- accountValue: string;
24
- totalMarginUsed: string;
25
- totalNtlPos: string;
26
- totalRawUsd: string;
27
- };
28
- marginSummary: {
29
- accountValue: string;
30
- totalMarginUsed: string;
31
- totalNtlPos: string;
32
- totalRawUsd: string;
33
- };
34
- time: number;
35
- withdrawable: string;
36
- } | null;
19
+ getClearinghouseState(): import("../types").ClearinghouseState | null;
37
20
  /**
38
21
  * Check if real-time data is available
39
22
  */
@@ -1,4 +1,4 @@
1
- import type { TokenSelection, TokenConflict } from '../types';
1
+ import type { TokenSelection, TokenConflict, RawPositionDto } from '../types';
2
2
  /**
3
3
  * Detects conflicts between selected tokens and existing positions
4
4
  */
@@ -10,5 +10,5 @@ export declare class ConflictDetector {
10
10
  * @param openPositions - Current open positions from API
11
11
  * @returns Array of detected conflicts
12
12
  */
13
- static detectConflicts(longTokens: TokenSelection[], shortTokens: TokenSelection[], openPositions: any[] | null): TokenConflict[];
13
+ static detectConflicts(longTokens: TokenSelection[], shortTokens: TokenSelection[], openPositions: RawPositionDto[] | null): TokenConflict[];
14
14
  }
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@pear-protocol/hyperliquid-sdk",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "React SDK for Pear Protocol Hyperliquid API integration",
5
+ "type": "module",
5
6
  "main": "dist/index.js",
6
7
  "module": "dist/index.js",
7
8
  "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
8
15
  "files": [
9
16
  "dist"
10
17
  ],
@@ -15,12 +22,12 @@
15
22
  "clean": "rimraf dist"
16
23
  },
17
24
  "dependencies": {
25
+ "axios": "^1.6.0",
18
26
  "react-use-websocket": "^4.8.1"
19
27
  },
20
28
  "peerDependencies": {
21
- "react": ">=16.8.0",
22
- "react-dom": ">=16.8.0",
23
- "axios": "^1.6.0"
29
+ "react": "^18.0.0",
30
+ "react-dom": "^18.0.0"
24
31
  },
25
32
  "devDependencies": {
26
33
  "@rollup/plugin-commonjs": "^25.0.0",
@@ -28,6 +35,8 @@
28
35
  "@rollup/plugin-terser": "^0.4.4",
29
36
  "@rollup/plugin-typescript": "^11.0.0",
30
37
  "@types/react": "^18.0.0",
38
+ "react": "^18.3.1",
39
+ "react-dom": "^18.3.1",
31
40
  "esbuild": "^0.25.9",
32
41
  "rimraf": "^5.0.0",
33
42
  "rollup": "^3.0.0",
@@ -55,5 +64,6 @@
55
64
  "registry": "https://registry.npmjs.org",
56
65
  "access": "public"
57
66
  },
67
+ "sideEffects": false,
58
68
  "private": false
59
69
  }