@pear-protocol/hyperliquid-sdk 0.0.60 → 0.0.62

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 type { GetEIP712MessageResponse } from '../types';
1
+ import type { GetEIP712MessageResponse } from "../types";
2
2
  export declare function useAuth(): {
3
3
  readonly isReady: boolean;
4
4
  readonly isAuthenticated: any;
package/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@ interface ExternalFillDto {
47
47
  coin: string;
48
48
  px: string;
49
49
  sz: string;
50
- side: 'B' | 'A';
50
+ side: "B" | "A";
51
51
  time: number;
52
52
  dir: string;
53
53
  fee: string;
@@ -74,16 +74,16 @@ interface TwapSliceFillResponseItem {
74
74
  /**
75
75
  * WebSocket connection states
76
76
  */
77
- type WebSocketConnectionState = 'connecting' | 'connected' | 'disconnected' | 'error';
77
+ type WebSocketConnectionState = "connecting" | "connected" | "disconnected" | "error";
78
78
  /**
79
79
  * WebSocket channels
80
80
  */
81
- type WebSocketChannel = 'trade-histories' | 'open-positions' | 'open-orders' | 'account-summary' | 'twap-details' | 'notifications' | 'market-data' | 'market-data-all' | 'webData3' | 'allMids' | 'activeAssetData';
81
+ type WebSocketChannel = "trade-histories" | "open-positions" | "open-orders" | "account-summary" | "twap-details" | "notifications" | "market-data" | "market-data-all" | "webData3" | "allMids" | "activeAssetData";
82
82
  /**
83
83
  * WebSocket subscription message
84
84
  */
85
85
  interface WebSocketSubscribeMessage {
86
- action?: 'subscribe' | 'unsubscribe';
86
+ action?: "subscribe" | "unsubscribe";
87
87
  address: string;
88
88
  }
89
89
  /**
@@ -113,7 +113,7 @@ interface WatchlistItemDto {
113
113
  interface ToggleWatchlistResponseDto {
114
114
  items: WatchlistItemDto[];
115
115
  }
116
- type NotificationCategory = 'TRADE_OPENED_OUTSIDE_PEAR' | 'TRADE_CLOSED_OUTSIDE_PEAR' | 'POSITION_LIQUIDATED' | 'LIMIT_ORDER_FILLED' | 'LIMIT_ORDER_FAILED' | 'TP_ORDER_FILLED' | 'TP_ORDER_FAILED' | 'SL_ORDER_FILLED' | 'SL_ORDER_FAILED';
116
+ type NotificationCategory = "TRADE_OPENED_OUTSIDE_PEAR" | "TRADE_CLOSED_OUTSIDE_PEAR" | "POSITION_LIQUIDATED" | "LIMIT_ORDER_FILLED" | "LIMIT_ORDER_FAILED" | "TP_ORDER_FILLED" | "TP_ORDER_FAILED" | "SL_ORDER_FILLED" | "SL_ORDER_FAILED";
117
117
  interface NotificationDto {
118
118
  id: string;
119
119
  address: string;
@@ -130,7 +130,7 @@ interface ChunkFillDto {
130
130
  size: number;
131
131
  executedAt: string;
132
132
  }
133
- type TwapChunkStatus = 'PENDING' | 'SCHEDULED' | 'EXECUTING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
133
+ type TwapChunkStatus = "PENDING" | "SCHEDULED" | "EXECUTING" | "COMPLETED" | "FAILED" | "CANCELLED";
134
134
  interface TwapChunkStatusDto {
135
135
  chunkId: string;
136
136
  chunkIndex: number;
@@ -141,7 +141,7 @@ interface TwapChunkStatusDto {
141
141
  fills: ChunkFillDto[];
142
142
  errorMessage?: string;
143
143
  }
144
- type TwapOrderOverallStatus = 'OPEN' | 'EXECUTING' | 'COMPLETED' | 'PARTIALLY_COMPLETED' | 'FAILED' | 'CANCELLED';
144
+ type TwapOrderOverallStatus = "OPEN" | "EXECUTING" | "COMPLETED" | "PARTIALLY_COMPLETED" | "FAILED" | "CANCELLED";
145
145
  interface TwapMonitoringDto {
146
146
  orderId: string;
147
147
  positionId?: string;
@@ -228,7 +228,7 @@ interface PositionAssetDetailDto {
228
228
  fundingPaid?: number;
229
229
  }
230
230
  interface TpSlThreshold {
231
- type: 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
231
+ type: "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
232
232
  value: number;
233
233
  }
234
234
  /**
@@ -263,16 +263,16 @@ interface OrderAssetDto {
263
263
  /**
264
264
  * Order status
265
265
  */
266
- type OrderStatus = 'OPEN' | 'PARTIALLY_FILLED' | 'PROCESSING';
266
+ type OrderStatus = "OPEN" | "PARTIALLY_FILLED" | "PROCESSING";
267
267
  /**
268
268
  * Order type
269
269
  */
270
- type OrderType = 'TP' | 'SL' | 'LIMIT' | 'MARKET' | 'LIMIT_BTCDOM' | 'TWAP';
270
+ type OrderType = "TP" | "SL" | "LIMIT" | "MARKET" | "LIMIT_BTCDOM" | "TWAP";
271
271
  /**
272
272
  * TP/SL trigger type
273
273
  */
274
- type TpSlTriggerType = 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
275
- type OrderDirection = 'MORE_THAN' | 'LESS_THAN' | null;
274
+ type TpSlTriggerType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
275
+ type OrderDirection = "MORE_THAN" | "LESS_THAN" | null;
276
276
  /**
277
277
  * Open limit order data structure
278
278
  */
@@ -343,6 +343,7 @@ interface PlatformAccountSummaryResponseDto {
343
343
  */
344
344
  interface AccountSummaryResponseDto {
345
345
  balanceSummary: BalanceSummaryDto;
346
+ platformAccountSummary: PlatformAccountSummaryResponseDto | null;
346
347
  agentWallet?: AgentWalletDto;
347
348
  }
348
349
  interface UseAuthOptions {
@@ -377,7 +378,7 @@ interface RefreshTokenResponse {
377
378
  tokenType: string;
378
379
  expiresIn: number;
379
380
  }
380
- type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
381
+ type AgentWalletStatus = "ACTIVE" | "EXPIRED" | "NOT_FOUND";
381
382
  interface CreateAgentWalletResponseDto {
382
383
  agentWalletAddress: string;
383
384
  message: string;
@@ -390,7 +391,7 @@ interface ExtraAgent {
390
391
  interface AgentWalletState {
391
392
  address: string | null;
392
393
  name: string | null;
393
- status: AgentWalletStatus | 'PENDING' | null;
394
+ status: AgentWalletStatus | "PENDING" | null;
394
395
  isActive: boolean;
395
396
  }
396
397
  /**
@@ -410,7 +411,7 @@ interface WebSocketMessage {
410
411
  /**
411
412
  * WebSocket response from HyperLiquid native API
412
413
  */
413
- type HLChannel = 'webData3' | 'allMids' | 'activeAssetData' | 'candle';
414
+ type HLChannel = "webData3" | "allMids" | "activeAssetData" | "candle";
414
415
  interface HLChannelDataMap {
415
416
  webData3: WebData3Response;
416
417
  allMids: WsAllMidsData;
@@ -610,7 +611,7 @@ interface TokenSelection {
610
611
  */
611
612
  interface TokenConflict {
612
613
  symbol: string;
613
- conflictType: 'long' | 'short';
614
+ conflictType: "long" | "short";
614
615
  conflictMessage: string;
615
616
  }
616
617
  interface AssetMarketData {
package/dist/index.js CHANGED
@@ -579,7 +579,9 @@ const useHyperliquidNativeWebSocket = ({ address, enabled = true, }) => {
579
579
  {
580
580
  const data = response.data;
581
581
  const remapped = {
582
- mids: Object.fromEntries(Object.entries(data.mids || {}).map(([k, v]) => [toDisplaySymbol(k), v]))
582
+ mids: Object.fromEntries(
583
+ // only support non hip-3 and xyz market
584
+ Object.entries(data.mids || {}).filter(([k, v]) => !k.includes(':') || k.includes('xyz:')).map(([k, v]) => [toDisplaySymbol(k), v]))
583
585
  };
584
586
  setAllMids(remapped);
585
587
  }
@@ -847,31 +849,40 @@ class AccountSummaryCalculator {
847
849
  return null;
848
850
  }
849
851
  const clearinghouseState = this.clearinghouseState;
850
- const withdrawableAmount = parseFloat(clearinghouseState.withdrawable || '0');
851
- const adjustedWithdrawable = Math.max(0, withdrawableAmount - ((_a = platformAccountSummary === null || platformAccountSummary === void 0 ? void 0 : platformAccountSummary.totalTwapChunkUsdValue) !== null && _a !== void 0 ? _a : 0) - ((_b = platformAccountSummary === null || platformAccountSummary === void 0 ? void 0 : platformAccountSummary.totalLimitOrderUsdValue) !== null && _b !== void 0 ? _b : 0));
852
+ const withdrawableAmount = parseFloat(clearinghouseState.withdrawable || "0");
853
+ const adjustedWithdrawable = Math.max(0, withdrawableAmount -
854
+ ((_a = platformAccountSummary === null || platformAccountSummary === void 0 ? void 0 : platformAccountSummary.totalTwapChunkUsdValue) !== null && _a !== void 0 ? _a : 0) -
855
+ ((_b = platformAccountSummary === null || platformAccountSummary === void 0 ? void 0 : platformAccountSummary.totalLimitOrderUsdValue) !== null && _b !== void 0 ? _b : 0));
852
856
  const accountSummary = {
853
857
  balanceSummary: {
854
- crossMaintenanceMarginUsed: clearinghouseState.crossMaintenanceMarginUsed || '0',
858
+ crossMaintenanceMarginUsed: clearinghouseState.crossMaintenanceMarginUsed || "0",
855
859
  crossMarginSummary: {
856
- accountValue: ((_c = clearinghouseState.crossMarginSummary) === null || _c === void 0 ? void 0 : _c.accountValue) || '0',
857
- totalMarginUsed: ((_d = clearinghouseState.crossMarginSummary) === null || _d === void 0 ? void 0 : _d.totalMarginUsed) || '0',
858
- totalNtlPos: ((_e = clearinghouseState.crossMarginSummary) === null || _e === void 0 ? void 0 : _e.totalNtlPos) || '0',
859
- totalRawUsd: ((_f = clearinghouseState.crossMarginSummary) === null || _f === void 0 ? void 0 : _f.totalRawUsd) || '0'
860
+ accountValue: ((_c = clearinghouseState.crossMarginSummary) === null || _c === void 0 ? void 0 : _c.accountValue) || "0",
861
+ totalMarginUsed: ((_d = clearinghouseState.crossMarginSummary) === null || _d === void 0 ? void 0 : _d.totalMarginUsed) || "0",
862
+ totalNtlPos: ((_e = clearinghouseState.crossMarginSummary) === null || _e === void 0 ? void 0 : _e.totalNtlPos) || "0",
863
+ totalRawUsd: ((_f = clearinghouseState.crossMarginSummary) === null || _f === void 0 ? void 0 : _f.totalRawUsd) || "0",
860
864
  },
861
865
  marginSummary: {
862
- accountValue: ((_g = clearinghouseState.marginSummary) === null || _g === void 0 ? void 0 : _g.accountValue) || '0',
863
- totalMarginUsed: ((_h = clearinghouseState.marginSummary) === null || _h === void 0 ? void 0 : _h.totalMarginUsed) || '0',
864
- totalNtlPos: ((_j = clearinghouseState.marginSummary) === null || _j === void 0 ? void 0 : _j.totalNtlPos) || '0',
865
- totalRawUsd: ((_k = clearinghouseState.marginSummary) === null || _k === void 0 ? void 0 : _k.totalRawUsd) || '0'
866
+ accountValue: ((_g = clearinghouseState.marginSummary) === null || _g === void 0 ? void 0 : _g.accountValue) || "0",
867
+ totalMarginUsed: ((_h = clearinghouseState.marginSummary) === null || _h === void 0 ? void 0 : _h.totalMarginUsed) || "0",
868
+ totalNtlPos: ((_j = clearinghouseState.marginSummary) === null || _j === void 0 ? void 0 : _j.totalNtlPos) || "0",
869
+ totalRawUsd: ((_k = clearinghouseState.marginSummary) === null || _k === void 0 ? void 0 : _k.totalRawUsd) || "0",
866
870
  },
867
871
  time: clearinghouseState.time || Date.now(),
868
- withdrawable: adjustedWithdrawable.toString()
869
- }
872
+ withdrawable: adjustedWithdrawable.toString(),
873
+ },
874
+ platformAccountSummary,
870
875
  };
871
876
  if (platformAccountSummary === null || platformAccountSummary === void 0 ? void 0 : platformAccountSummary.agentWalletAddress) {
872
877
  accountSummary.agentWallet = {
873
878
  address: platformAccountSummary.agentWalletAddress,
874
- status: registeredAgentWallets.find((agent) => { var _a; return agent.address.toLowerCase() === ((_a = platformAccountSummary.agentWalletAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()); }) ? 'ACTIVE' : 'EXPIRED'
879
+ status: registeredAgentWallets.find((agent) => {
880
+ var _a;
881
+ return agent.address.toLowerCase() ===
882
+ ((_a = platformAccountSummary.agentWalletAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase());
883
+ })
884
+ ? "ACTIVE"
885
+ : "EXPIRED",
875
886
  };
876
887
  }
877
888
  return accountSummary;
@@ -6989,7 +7000,7 @@ async function logout(baseUrl, refreshTokenVal) {
6989
7000
  function useAuth() {
6990
7001
  const context = useContext(PearHyperliquidContext);
6991
7002
  if (!context) {
6992
- throw new Error('usePortfolio must be used within a PearHyperliquidProvider');
7003
+ throw new Error("usePortfolio must be used within a PearHyperliquidProvider");
6993
7004
  }
6994
7005
  const { apiBaseUrl, clientId } = context;
6995
7006
  const [isReady, setIsReady] = useState(false);
@@ -7001,12 +7012,12 @@ function useAuth() {
7001
7012
  const setIsAuthenticated = useUserData((s) => s.setIsAuthenticated);
7002
7013
  const setAddress = useUserData((s) => s.setAddress);
7003
7014
  useEffect(() => {
7004
- if (typeof window == 'undefined') {
7015
+ if (typeof window == "undefined") {
7005
7016
  return;
7006
7017
  }
7007
- const access = localStorage.getItem('accessToken');
7008
- const refresh = localStorage.getItem('refreshToken');
7009
- const addr = localStorage.getItem('address');
7018
+ const access = localStorage.getItem("accessToken");
7019
+ const refresh = localStorage.getItem("refreshToken");
7020
+ const addr = localStorage.getItem("address");
7010
7021
  setAccessToken(access);
7011
7022
  setRefreshToken(refresh);
7012
7023
  setAddress(addr);
@@ -7018,7 +7029,9 @@ function useAuth() {
7018
7029
  const cleanup = addAuthInterceptors({
7019
7030
  apiBaseUrl,
7020
7031
  getAccessToken: () => {
7021
- return typeof window !== 'undefined' ? window.localStorage.getItem('accessToken') : null;
7032
+ return typeof window !== "undefined"
7033
+ ? window.localStorage.getItem("accessToken")
7034
+ : null;
7022
7035
  },
7023
7036
  refreshTokens: async () => {
7024
7037
  const data = await refreshTokens();
@@ -7039,14 +7052,14 @@ function useAuth() {
7039
7052
  async function loginWithSignedMessage(address, signature, timestamp) {
7040
7053
  try {
7041
7054
  const { data } = await authenticate(apiBaseUrl, {
7042
- method: 'eip712',
7055
+ method: "eip712",
7043
7056
  address,
7044
7057
  clientId,
7045
7058
  details: { signature, timestamp },
7046
7059
  });
7047
- window.localStorage.setItem('accessToken', data.accessToken);
7048
- window.localStorage.setItem('refreshToken', data.refreshToken);
7049
- window.localStorage.setItem('address', address);
7060
+ window.localStorage.setItem("accessToken", data.accessToken);
7061
+ window.localStorage.setItem("refreshToken", data.refreshToken);
7062
+ window.localStorage.setItem("address", address);
7050
7063
  setAccessToken(data.accessToken);
7051
7064
  setRefreshToken(data.refreshToken);
7052
7065
  setAddress(address);
@@ -7058,10 +7071,15 @@ function useAuth() {
7058
7071
  }
7059
7072
  async function loginWithPrivyToken(address, appId, privyAccessToken) {
7060
7073
  try {
7061
- const { data } = await authenticateWithPrivy(apiBaseUrl, { address, clientId, appId, accessToken: privyAccessToken });
7062
- window.localStorage.setItem('accessToken', data.accessToken);
7063
- window.localStorage.setItem('refreshToken', data.refreshToken);
7064
- window.localStorage.setItem('address', address);
7074
+ const { data } = await authenticateWithPrivy(apiBaseUrl, {
7075
+ address,
7076
+ clientId,
7077
+ appId,
7078
+ accessToken: privyAccessToken,
7079
+ });
7080
+ window.localStorage.setItem("accessToken", data.accessToken);
7081
+ window.localStorage.setItem("refreshToken", data.refreshToken);
7082
+ window.localStorage.setItem("address", address);
7065
7083
  setAccessToken(data.accessToken);
7066
7084
  setRefreshToken(data.refreshToken);
7067
7085
  setAddress(address);
@@ -7072,28 +7090,30 @@ function useAuth() {
7072
7090
  }
7073
7091
  }
7074
7092
  async function refreshTokens() {
7075
- const refresh = window.localStorage.getItem('refreshToken');
7093
+ const refresh = window.localStorage.getItem("refreshToken");
7076
7094
  if (!refresh)
7077
- throw new Error('No refresh token');
7095
+ throw new Error("No refresh token");
7078
7096
  const { data } = await refreshToken(apiBaseUrl, refresh);
7079
- window.localStorage.setItem('accessToken', data.accessToken);
7080
- window.localStorage.setItem('refreshToken', data.refreshToken);
7097
+ window.localStorage.setItem("accessToken", data.accessToken);
7098
+ window.localStorage.setItem("refreshToken", data.refreshToken);
7081
7099
  setAccessToken(data.accessToken);
7082
7100
  setRefreshToken(data.refreshToken);
7083
7101
  setIsAuthenticated(true);
7084
7102
  return data;
7085
7103
  }
7086
7104
  async function logout$1() {
7087
- const refresh = window.localStorage.getItem('refreshToken');
7105
+ const refresh = window.localStorage.getItem("refreshToken");
7088
7106
  if (refresh) {
7089
7107
  try {
7090
7108
  await logout(apiBaseUrl, refresh);
7091
7109
  }
7092
- catch ( /* ignore */_a) { /* ignore */ }
7110
+ catch (_a) {
7111
+ /* ignore */
7112
+ }
7093
7113
  }
7094
- window.localStorage.removeItem('accessToken');
7095
- window.localStorage.removeItem('refreshToken');
7096
- window.localStorage.removeItem('address');
7114
+ window.localStorage.removeItem("accessToken");
7115
+ window.localStorage.removeItem("refreshToken");
7116
+ window.localStorage.removeItem("address");
7097
7117
  setAccessToken(null);
7098
7118
  setRefreshToken(null);
7099
7119
  setAddress(null);
@@ -7116,7 +7136,7 @@ const PearHyperliquidContext = createContext(undefined);
7116
7136
  /**
7117
7137
  * React Provider for PearHyperliquidClient
7118
7138
  */
7119
- const PearHyperliquidProvider = ({ children, apiBaseUrl = 'https://hl-v2.pearprotocol.io', clientId = 'PEARPROTOCOLUI', wsUrl = 'wss://hl-v2.pearprotocol.io/ws', }) => {
7139
+ const PearHyperliquidProvider = ({ children, apiBaseUrl = "https://hl-v2.pearprotocol.io", clientId = "PEARPROTOCOLUI", wsUrl = "wss://hl-v2.pearprotocol.io/ws", }) => {
7120
7140
  const address = useUserData((s) => s.address);
7121
7141
  const setAddress = useUserData((s) => s.setAddress);
7122
7142
  const perpsMetaAssets = useHyperliquidData((state) => state.perpMetaAssets);
@@ -7134,8 +7154,12 @@ const PearHyperliquidProvider = ({ children, apiBaseUrl = 'https://hl-v2.pearpro
7134
7154
  });
7135
7155
  useEffect(() => {
7136
7156
  if (perpsMetaAssets === null) {
7137
- fetchAllPerpMetas().then(res => {
7138
- const aggregatedPerpMetas = res.data.flatMap(item => item.universe);
7157
+ fetchAllPerpMetas()
7158
+ .then((res) => {
7159
+ // Only show HL and XYZ for now as other are using USDH collateral and need more work
7160
+ const aggregatedPerpMetas = res.data
7161
+ .slice(0, 2)
7162
+ .flatMap((item) => item.universe);
7139
7163
  const hip3Map = new Map();
7140
7164
  const displayToFull = new Map();
7141
7165
  const cleanedPerpMetas = aggregatedPerpMetas.map((asset) => {
@@ -7153,7 +7177,8 @@ const PearHyperliquidProvider = ({ children, apiBaseUrl = 'https://hl-v2.pearpro
7153
7177
  });
7154
7178
  setHip3DisplayToFull(displayToFull);
7155
7179
  setPerpMetaAssets(cleanedPerpMetas);
7156
- }).catch(() => { });
7180
+ })
7181
+ .catch(() => { });
7157
7182
  }
7158
7183
  }, [perpsMetaAssets, setPerpMetaAssets, setHip3DisplayToFull]);
7159
7184
  // Auth methods now sourced from useAuth hook
@@ -7176,10 +7201,14 @@ const PearHyperliquidProvider = ({ children, apiBaseUrl = 'https://hl-v2.pearpro
7176
7201
  nativeIsConnected,
7177
7202
  nativeLastError,
7178
7203
  }), [
7179
- apiBaseUrl, wsUrl,
7180
- address, setAddress,
7181
- isConnected, lastError,
7182
- nativeIsConnected, nativeLastError,
7204
+ apiBaseUrl,
7205
+ wsUrl,
7206
+ address,
7207
+ setAddress,
7208
+ isConnected,
7209
+ lastError,
7210
+ nativeIsConnected,
7211
+ nativeLastError,
7183
7212
  ]);
7184
7213
  return (jsx(PearHyperliquidContext.Provider, { value: contextValue, children: children }));
7185
7214
  };
@@ -7190,7 +7219,7 @@ const PearHyperliquidProvider = ({ children, apiBaseUrl = 'https://hl-v2.pearpro
7190
7219
  function usePearHyperliquid() {
7191
7220
  const ctx = useContext(PearHyperliquidContext);
7192
7221
  if (!ctx)
7193
- throw new Error('usePearHyperliquid must be used within a PearHyperliquidProvider');
7222
+ throw new Error("usePearHyperliquid must be used within a PearHyperliquidProvider");
7194
7223
  return ctx;
7195
7224
  }
7196
7225
 
@@ -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;
package/dist/types.d.ts CHANGED
@@ -20,7 +20,7 @@ export interface ExternalFillDto {
20
20
  coin: string;
21
21
  px: string;
22
22
  sz: string;
23
- side: 'B' | 'A';
23
+ side: "B" | "A";
24
24
  time: number;
25
25
  dir: string;
26
26
  fee: string;
@@ -52,7 +52,7 @@ export interface TwapSliceFillResponseItem {
52
52
  /**
53
53
  * WebSocket connection states
54
54
  */
55
- export type WebSocketConnectionState = 'connecting' | 'connected' | 'disconnected' | 'error';
55
+ export type WebSocketConnectionState = "connecting" | "connected" | "disconnected" | "error";
56
56
  export declare enum ReadyState {
57
57
  CONNECTING = 0,
58
58
  OPEN = 1,
@@ -62,12 +62,12 @@ export declare enum ReadyState {
62
62
  /**
63
63
  * WebSocket channels
64
64
  */
65
- export type WebSocketChannel = 'trade-histories' | 'open-positions' | 'open-orders' | 'account-summary' | 'twap-details' | 'notifications' | 'market-data' | 'market-data-all' | 'webData3' | 'allMids' | 'activeAssetData';
65
+ export type WebSocketChannel = "trade-histories" | "open-positions" | "open-orders" | "account-summary" | "twap-details" | "notifications" | "market-data" | "market-data-all" | "webData3" | "allMids" | "activeAssetData";
66
66
  /**
67
67
  * WebSocket subscription message
68
68
  */
69
69
  export interface WebSocketSubscribeMessage {
70
- action?: 'subscribe' | 'unsubscribe';
70
+ action?: "subscribe" | "unsubscribe";
71
71
  address: string;
72
72
  }
73
73
  /**
@@ -97,7 +97,7 @@ export interface WatchlistItemDto {
97
97
  export interface ToggleWatchlistResponseDto {
98
98
  items: WatchlistItemDto[];
99
99
  }
100
- export type NotificationCategory = 'TRADE_OPENED_OUTSIDE_PEAR' | 'TRADE_CLOSED_OUTSIDE_PEAR' | 'POSITION_LIQUIDATED' | 'LIMIT_ORDER_FILLED' | 'LIMIT_ORDER_FAILED' | 'TP_ORDER_FILLED' | 'TP_ORDER_FAILED' | 'SL_ORDER_FILLED' | 'SL_ORDER_FAILED';
100
+ export type NotificationCategory = "TRADE_OPENED_OUTSIDE_PEAR" | "TRADE_CLOSED_OUTSIDE_PEAR" | "POSITION_LIQUIDATED" | "LIMIT_ORDER_FILLED" | "LIMIT_ORDER_FAILED" | "TP_ORDER_FILLED" | "TP_ORDER_FAILED" | "SL_ORDER_FILLED" | "SL_ORDER_FAILED";
101
101
  export interface NotificationDto {
102
102
  id: string;
103
103
  address: string;
@@ -114,7 +114,7 @@ export interface ChunkFillDto {
114
114
  size: number;
115
115
  executedAt: string;
116
116
  }
117
- export type TwapChunkStatus = 'PENDING' | 'SCHEDULED' | 'EXECUTING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
117
+ export type TwapChunkStatus = "PENDING" | "SCHEDULED" | "EXECUTING" | "COMPLETED" | "FAILED" | "CANCELLED";
118
118
  export interface TwapChunkStatusDto {
119
119
  chunkId: string;
120
120
  chunkIndex: number;
@@ -125,7 +125,7 @@ export interface TwapChunkStatusDto {
125
125
  fills: ChunkFillDto[];
126
126
  errorMessage?: string;
127
127
  }
128
- export type TwapOrderOverallStatus = 'OPEN' | 'EXECUTING' | 'COMPLETED' | 'PARTIALLY_COMPLETED' | 'FAILED' | 'CANCELLED';
128
+ export type TwapOrderOverallStatus = "OPEN" | "EXECUTING" | "COMPLETED" | "PARTIALLY_COMPLETED" | "FAILED" | "CANCELLED";
129
129
  export interface TwapMonitoringDto {
130
130
  orderId: string;
131
131
  positionId?: string;
@@ -212,7 +212,7 @@ export interface PositionAssetDetailDto {
212
212
  fundingPaid?: number;
213
213
  }
214
214
  export interface TpSlThreshold {
215
- type: 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
215
+ type: "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
216
216
  value: number;
217
217
  }
218
218
  /**
@@ -247,16 +247,16 @@ export interface OrderAssetDto {
247
247
  /**
248
248
  * Order status
249
249
  */
250
- export type OrderStatus = 'OPEN' | 'PARTIALLY_FILLED' | 'PROCESSING';
250
+ export type OrderStatus = "OPEN" | "PARTIALLY_FILLED" | "PROCESSING";
251
251
  /**
252
252
  * Order type
253
253
  */
254
- export type OrderType = 'TP' | 'SL' | 'LIMIT' | 'MARKET' | 'LIMIT_BTCDOM' | 'TWAP';
254
+ export type OrderType = "TP" | "SL" | "LIMIT" | "MARKET" | "LIMIT_BTCDOM" | "TWAP";
255
255
  /**
256
256
  * TP/SL trigger type
257
257
  */
258
- export type TpSlTriggerType = 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE';
259
- export type OrderDirection = 'MORE_THAN' | 'LESS_THAN' | null;
258
+ export type TpSlTriggerType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE";
259
+ export type OrderDirection = "MORE_THAN" | "LESS_THAN" | null;
260
260
  /**
261
261
  * Open limit order data structure
262
262
  */
@@ -327,6 +327,7 @@ export interface PlatformAccountSummaryResponseDto {
327
327
  */
328
328
  export interface AccountSummaryResponseDto {
329
329
  balanceSummary: BalanceSummaryDto;
330
+ platformAccountSummary: PlatformAccountSummaryResponseDto | null;
330
331
  agentWallet?: AgentWalletDto;
331
332
  }
332
333
  /**
@@ -369,7 +370,7 @@ export interface PrivyAuthDetails {
369
370
  accessToken: string;
370
371
  }
371
372
  export interface AuthenticateRequest {
372
- method: 'eip712' | 'api_key' | 'privy_access_token';
373
+ method: "eip712" | "api_key" | "privy_access_token";
373
374
  address: string;
374
375
  clientId: string;
375
376
  details: {
@@ -402,7 +403,7 @@ export interface LogoutRequest {
402
403
  export interface LogoutResponse {
403
404
  message: string;
404
405
  }
405
- export type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
406
+ export type AgentWalletStatus = "ACTIVE" | "EXPIRED" | "NOT_FOUND";
406
407
  export interface GetAgentWalletResponseDto {
407
408
  agentWalletAddress?: string;
408
409
  agentName: string;
@@ -420,7 +421,7 @@ export interface ExtraAgent {
420
421
  export interface AgentWalletState {
421
422
  address: string | null;
422
423
  name: string | null;
423
- status: AgentWalletStatus | 'PENDING' | null;
424
+ status: AgentWalletStatus | "PENDING" | null;
424
425
  isActive: boolean;
425
426
  }
426
427
  /**
@@ -440,7 +441,7 @@ export interface WebSocketMessage {
440
441
  /**
441
442
  * WebSocket response from HyperLiquid native API
442
443
  */
443
- export type HLChannel = 'webData3' | 'allMids' | 'activeAssetData' | 'candle';
444
+ export type HLChannel = "webData3" | "allMids" | "activeAssetData" | "candle";
444
445
  export interface HLChannelDataMap {
445
446
  webData3: WebData3Response;
446
447
  allMids: WsAllMidsData;
@@ -658,7 +659,7 @@ export interface TokenSelection {
658
659
  */
659
660
  export interface TokenConflict {
660
661
  symbol: string;
661
- conflictType: 'long' | 'short';
662
+ conflictType: "long" | "short";
662
663
  conflictMessage: string;
663
664
  }
664
665
  export interface AssetMarketData {
@@ -1,4 +1,4 @@
1
- import type { AccountSummaryResponseDto, ClearinghouseState, ExtraAgent, PlatformAccountSummaryResponseDto } from '../types';
1
+ import type { AccountSummaryResponseDto, ClearinghouseState, ExtraAgent, PlatformAccountSummaryResponseDto } from "../types";
2
2
  /**
3
3
  * Account summary calculation utility class
4
4
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/hyperliquid-sdk",
3
- "version": "0.0.60",
3
+ "version": "0.0.62",
4
4
  "description": "React SDK for Pear Protocol Hyperliquid API integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -38,7 +38,6 @@
38
38
  "@types/react": "^18.0.0",
39
39
  "concurrently": "^9.2.1",
40
40
  "esbuild": "^0.25.9",
41
-
42
41
  "rimraf": "^5.0.0",
43
42
  "rollup": "^3.0.0",
44
43
  "rollup-plugin-dts": "^6.0.0",