@pear-protocol/hyperliquid-sdk 0.0.36 → 0.0.37
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/clients/notifications.d.ts +6 -0
- package/dist/hooks/useNotifications.d.ts +3 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.js +24 -1
- package/package.json +1 -1
|
@@ -5,3 +5,9 @@ import type { ApiResponse } from '../types';
|
|
|
5
5
|
export declare function markNotificationsRead(baseUrl: string, accessToken: string, timestampMs: number): Promise<ApiResponse<{
|
|
6
6
|
updated: number;
|
|
7
7
|
}>>;
|
|
8
|
+
/**
|
|
9
|
+
* Mark a single notification as read by id
|
|
10
|
+
*/
|
|
11
|
+
export declare function markNotificationReadById(baseUrl: string, accessToken: string, id: string): Promise<ApiResponse<{
|
|
12
|
+
updated: number;
|
|
13
|
+
}>>;
|
|
@@ -5,6 +5,9 @@ export interface UseNotificationsResult {
|
|
|
5
5
|
markReadUntil: (timestampMs: number) => Promise<{
|
|
6
6
|
updated: number;
|
|
7
7
|
}>;
|
|
8
|
+
markReadById: (id: string) => Promise<{
|
|
9
|
+
updated: number;
|
|
10
|
+
}>;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* Provides notifications and fills checkpoint data sourced from the SDK WebSocket.
|
package/dist/index.d.ts
CHANGED
|
@@ -964,6 +964,9 @@ interface UseNotificationsResult {
|
|
|
964
964
|
markReadUntil: (timestampMs: number) => Promise<{
|
|
965
965
|
updated: number;
|
|
966
966
|
}>;
|
|
967
|
+
markReadById: (id: string) => Promise<{
|
|
968
|
+
updated: number;
|
|
969
|
+
}>;
|
|
967
970
|
}
|
|
968
971
|
/**
|
|
969
972
|
* Provides notifications and fills checkpoint data sourced from the SDK WebSocket.
|
|
@@ -998,6 +1001,12 @@ declare const useHyperliquidNativeWebSocket: ({ address, }: UseHyperliquidNative
|
|
|
998
1001
|
declare function markNotificationsRead(baseUrl: string, accessToken: string, timestampMs: number): Promise<ApiResponse<{
|
|
999
1002
|
updated: number;
|
|
1000
1003
|
}>>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Mark a single notification as read by id
|
|
1006
|
+
*/
|
|
1007
|
+
declare function markNotificationReadById(baseUrl: string, accessToken: string, id: string): Promise<ApiResponse<{
|
|
1008
|
+
updated: number;
|
|
1009
|
+
}>>;
|
|
1001
1010
|
|
|
1002
1011
|
/**
|
|
1003
1012
|
* Account summary calculation utility class
|
|
@@ -1101,5 +1110,5 @@ declare function mapTradingViewIntervalToCandleInterval(interval: string): Candl
|
|
|
1101
1110
|
*/
|
|
1102
1111
|
declare function mapCandleIntervalToTradingViewInterval(interval: CandleInterval): string;
|
|
1103
1112
|
|
|
1104
|
-
export { AccountSummaryCalculator, AuthStatus, ConflictDetector, PearHyperliquidProvider, TokenMetadataExtractor, adjustOrder, adjustPosition, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationsRead, updateRiskParameters, useAccountSummary, useAddress, useAgentWallet, useAuth, useAutoSyncFills, useBasketCandles, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useNotifications, useOpenOrders, useOrders, usePearAgentWallet, usePearAuth, usePearHyperliquid, usePerformanceOverlays, usePosition, useTokenSelectionMetadata, useTradeHistories, useTwap, useUserSelection, useWebData };
|
|
1113
|
+
export { AccountSummaryCalculator, AuthStatus, ConflictDetector, PearHyperliquidProvider, TokenMetadataExtractor, adjustOrder, adjustPosition, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, updateRiskParameters, useAccountSummary, useAddress, useAgentWallet, useAuth, useAutoSyncFills, useBasketCandles, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useNotifications, useOpenOrders, useOrders, usePearAgentWallet, usePearAuth, usePearHyperliquid, usePerformanceOverlays, usePosition, useTokenSelectionMetadata, useTradeHistories, useTwap, useUserSelection, useWebData };
|
|
1105
1114
|
export type { AccountSummaryResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, AutoSyncFillsOptions, AutoSyncFillsState, BalanceSummaryDto, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto, CreatePositionRequestInput, CreatePositionResponseDto, CrossMarginSummaryDto, CumFundingDto, ExecutionType, HLWebSocketResponse, HistoricalRange, LadderConfigInput, MarginSummaryDto, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderStatus, PairAssetInput, PerformanceOverlay, PositionAdjustmentType, PositionAssetDetailDto, PositionAssetSummaryDto, PositionResponseStatus, RealtimeBar, RealtimeBarsCallback, TokenConflict, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TpSlThresholdInput, TpSlThresholdType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TwapChunkStatusDto, TwapMonitoringDto, UniverseAsset, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAgentWalletOptions, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseNotificationsResult, UsePerformanceOverlaysReturn, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WebData2Response, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|
package/dist/index.js
CHANGED
|
@@ -8598,6 +8598,19 @@ async function markNotificationsRead(baseUrl, accessToken, timestampMs) {
|
|
|
8598
8598
|
throw toApiError(error);
|
|
8599
8599
|
}
|
|
8600
8600
|
}
|
|
8601
|
+
/**
|
|
8602
|
+
* Mark a single notification as read by id
|
|
8603
|
+
*/
|
|
8604
|
+
async function markNotificationReadById(baseUrl, accessToken, id) {
|
|
8605
|
+
const url = joinUrl(baseUrl, '/notifications/read');
|
|
8606
|
+
try {
|
|
8607
|
+
const response = await axios$1.post(url, { id }, { headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${accessToken}` } });
|
|
8608
|
+
return { data: response.data, status: response.status, headers: response.headers };
|
|
8609
|
+
}
|
|
8610
|
+
catch (error) {
|
|
8611
|
+
throw toApiError(error);
|
|
8612
|
+
}
|
|
8613
|
+
}
|
|
8601
8614
|
|
|
8602
8615
|
/**
|
|
8603
8616
|
* Provides notifications and fills checkpoint data sourced from the SDK WebSocket.
|
|
@@ -8632,6 +8645,16 @@ function useNotifications() {
|
|
|
8632
8645
|
}
|
|
8633
8646
|
return data;
|
|
8634
8647
|
}, [apiBaseUrl, accessToken, isAuthenticated, notifications, setNotifications]),
|
|
8648
|
+
markReadById: useCallback(async (id) => {
|
|
8649
|
+
if (!isAuthenticated || !accessToken)
|
|
8650
|
+
throw new Error('Not authenticated');
|
|
8651
|
+
const { data } = await markNotificationReadById(apiBaseUrl, accessToken, id);
|
|
8652
|
+
if (notifications) {
|
|
8653
|
+
const updated = notifications.map((n) => (n.id === id ? { ...n, is_read: true } : n));
|
|
8654
|
+
setNotifications(updated);
|
|
8655
|
+
}
|
|
8656
|
+
return data;
|
|
8657
|
+
}, [apiBaseUrl, accessToken, isAuthenticated, notifications, setNotifications]),
|
|
8635
8658
|
};
|
|
8636
8659
|
}
|
|
8637
8660
|
|
|
@@ -8933,4 +8956,4 @@ function mapCandleIntervalToTradingViewInterval(interval) {
|
|
|
8933
8956
|
}
|
|
8934
8957
|
}
|
|
8935
8958
|
|
|
8936
|
-
export { AccountSummaryCalculator, AuthStatus, ConflictDetector, PearHyperliquidProvider, TokenMetadataExtractor, adjustOrder, adjustPosition, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationsRead, updateRiskParameters, useAccountSummary, useAddress, useAgentWallet, useAuth, useAutoSyncFills, useBasketCandles, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useNotifications, useOpenOrders, useOrders, usePearAgentWallet, usePearAuth, usePearHyperliquid, usePerformanceOverlays, usePosition, useTokenSelectionMetadata, useTradeHistories, useTwap, useUserSelection, useWebData };
|
|
8959
|
+
export { AccountSummaryCalculator, AuthStatus, ConflictDetector, PearHyperliquidProvider, TokenMetadataExtractor, adjustOrder, adjustPosition, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, updateRiskParameters, useAccountSummary, useAddress, useAgentWallet, useAuth, useAutoSyncFills, useBasketCandles, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useNotifications, useOpenOrders, useOrders, usePearAgentWallet, usePearAuth, usePearHyperliquid, usePerformanceOverlays, usePosition, useTokenSelectionMetadata, useTradeHistories, useTwap, useUserSelection, useWebData };
|