@pear-protocol/hyperliquid-sdk 0.1.4 → 0.1.5-pnl

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,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React, { ReactNode } from "react";
2
2
  export interface PearHyperliquidContextType {
3
3
  clientId: string;
4
4
  apiBaseUrl: string;
@@ -9,6 +9,8 @@ interface TokenHistoricalPriceData {
9
9
  candles: CandleData[];
10
10
  oldestTime: number | null;
11
11
  latestTime: number | null;
12
+ requestedRanges: HistoricalRange[];
13
+ noDataBefore: number | null;
12
14
  }
13
15
  interface HistoricalPriceDataState {
14
16
  historicalPriceData: Record<string, TokenHistoricalPriceData>;
@@ -16,6 +18,7 @@ interface HistoricalPriceDataState {
16
18
  addHistoricalPriceData: (symbol: string, interval: CandleInterval, candles: CandleData[], range: HistoricalRange) => void;
17
19
  hasHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => boolean;
18
20
  getHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => CandleData[];
21
+ getEffectiveDataBoundary: (symbols: string[], interval: CandleInterval) => number | null;
19
22
  setTokenLoading: (symbol: string, loading: boolean) => void;
20
23
  isTokenLoading: (symbol: string) => boolean;
21
24
  removeTokenPriceData: (symbol: string, interval: CandleInterval) => void;
@@ -1,5 +1,5 @@
1
- import { ActiveAssetData, CandleChartData, CandleData, ClearinghouseState, UniverseAsset, WebData3AssetCtx, WsAllMidsData, PerpDexsResponse } from '../types';
2
- import { TokenMetadataBySymbol } from '../utils/token-metadata-extractor';
1
+ import { ActiveAssetData, CandleChartData, CandleData, ClearinghouseState, UniverseAsset, WebData3AssetCtx, WsAllMidsData, PerpDexsResponse } from "../types";
2
+ import { TokenMetadataBySymbol } from "../utils/token-metadata-extractor";
3
3
  interface HyperliquidDataState {
4
4
  allMids: WsAllMidsData | null;
5
5
  activeAssetData: Record<string, ActiveAssetData> | null;
@@ -28,6 +28,7 @@ interface HyperliquidDataState {
28
28
  setPerpDexs: (value: PerpDexsResponse | null) => void;
29
29
  setPerpMetasByDex: (value: Map<string, UniverseAsset[]> | null) => void;
30
30
  setAssetContextsByDex: (value: Map<string, WebData3AssetCtx[]> | null) => void;
31
+ clearUserData: () => void;
31
32
  }
32
33
  export declare const useHyperliquidData: import("zustand").UseBoundStore<import("zustand").StoreApi<HyperliquidDataState>>;
33
34
  export {};
@@ -1,8 +1,9 @@
1
- import { PlatformAccountSummaryResponseDto, OpenLimitOrderDto, RawPositionDto, TradeHistoryDataDto, TwapMonitoringDto, NotificationDto, ExtraAgent, SpotState } from "../types";
1
+ import { PlatformAccountSummaryResponseDto, OpenLimitOrderDto, RawPositionDto, TradeHistoryDataDto, TwapMonitoringDto, NotificationDto, ExtraAgent, SpotState, UserAbstraction } from "../types";
2
2
  interface UserDataState {
3
3
  accessToken: string | null;
4
4
  refreshToken: string | null;
5
5
  isAuthenticated: boolean;
6
+ isReady: boolean;
6
7
  address: string | null;
7
8
  tradeHistories: TradeHistoryDataDto[] | null;
8
9
  rawOpenPositions: RawPositionDto[] | null;
@@ -12,6 +13,7 @@ interface UserDataState {
12
13
  notifications: NotificationDto[] | null;
13
14
  userExtraAgents: ExtraAgent[] | null;
14
15
  spotState: SpotState | null;
16
+ userAbstractionMode: UserAbstraction | null;
15
17
  setAccessToken: (token: string | null) => void;
16
18
  setRefreshToken: (token: string | null) => void;
17
19
  setIsAuthenticated: (value: boolean) => void;
@@ -24,6 +26,8 @@ interface UserDataState {
24
26
  setTwapDetails: (value: TwapMonitoringDto[] | null) => void;
25
27
  setNotifications: (value: NotificationDto[] | null) => void;
26
28
  setSpotState: (value: SpotState | null) => void;
29
+ setUserAbstractionMode: (value: UserAbstraction | null) => void;
30
+ setIsReady: (value: boolean) => void;
27
31
  clean: () => void;
28
32
  }
29
33
  export declare const useUserData: import("zustand").UseBoundStore<import("zustand").StoreApi<UserDataState>>;
package/dist/types.d.ts CHANGED
@@ -200,6 +200,7 @@ export interface TwapMonitoringDto {
200
200
  export interface TradeHistoryAssetDataDto {
201
201
  coin: string;
202
202
  entryWeight: number;
203
+ closeWeight: number;
203
204
  entryPrice: number;
204
205
  limitPrice: number;
205
206
  leverage: number;
@@ -255,7 +256,9 @@ export interface PositionAssetDetailDto {
255
256
  unrealizedPnl: number;
256
257
  liquidationPrice: number;
257
258
  initialWeight: number;
259
+ currentWeight: number;
258
260
  fundingPaid?: number;
261
+ targetWeight?: number;
259
262
  metadata?: TokenMetadata | null;
260
263
  }
261
264
  export interface TpSlThreshold {
@@ -563,6 +566,7 @@ export interface HLChannelDataMap {
563
566
  allDexsAssetCtxs: AllDexsAssetCtxsData;
564
567
  userFills: any;
565
568
  }
569
+ export type UserAbstraction = 'dexAbstraction' | 'disabled' | 'unifiedAccount' | 'portfolioMargin';
566
570
  export interface WebData3UserState {
567
571
  agentAddress?: string;
568
572
  agentValidUntil?: number;
@@ -571,6 +575,7 @@ export interface WebData3UserState {
571
575
  isVault: boolean;
572
576
  user: string;
573
577
  dexAbstractionEnabled?: boolean;
578
+ abstraction: UserAbstraction;
574
579
  }
575
580
  export interface WebData3AssetCtx {
576
581
  funding: string;
@@ -731,6 +736,7 @@ export interface RawAssetDto {
731
736
  side: string;
732
737
  fundingPaid?: number;
733
738
  leverage: number;
739
+ targetWeight?: number;
734
740
  }
735
741
  /**
736
742
  * Raw position data from open-positions channel
@@ -1,5 +1,5 @@
1
- import type { AxiosInstance } from 'axios';
2
- import { ApiErrorResponse } from '../types';
1
+ import type { AxiosInstance } from "axios";
2
+ import { ApiErrorResponse } from "../types";
3
3
  export declare function toApiError(error: unknown): ApiErrorResponse;
4
4
  export declare function joinUrl(baseUrl: string, path: string): string;
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/hyperliquid-sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.5-pnl",
4
4
  "description": "React SDK for Pear Protocol Hyperliquid API integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",