@pear-protocol/hyperliquid-sdk 0.0.46 → 0.0.47
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/positions.d.ts +3 -0
- package/dist/hooks/useMarketData.d.ts +3 -1
- package/dist/hooks/useWebData.d.ts +0 -1
- package/dist/hyperliquid-websocket.d.ts +0 -2
- package/dist/index.d.ts +14 -9
- package/dist/index.js +237 -2555
- package/dist/provider.d.ts +0 -3
- package/dist/types.d.ts +14 -1
- package/dist/websocket.d.ts +0 -2
- package/package.json +3 -5
|
@@ -27,6 +27,7 @@ export interface CreatePositionRequestInput {
|
|
|
27
27
|
twapDuration?: number;
|
|
28
28
|
twapIntervalSeconds?: number;
|
|
29
29
|
randomizeExecution?: boolean;
|
|
30
|
+
referralCode?: string;
|
|
30
31
|
ladderConfig?: LadderConfigInput;
|
|
31
32
|
takeProfit?: TpSlThresholdInput | null;
|
|
32
33
|
stopLoss?: TpSlThresholdInput | null;
|
|
@@ -73,6 +74,7 @@ export interface ClosePositionRequestInput {
|
|
|
73
74
|
twapDuration?: number;
|
|
74
75
|
twapIntervalSeconds?: number;
|
|
75
76
|
randomizeExecution?: boolean;
|
|
77
|
+
referralCode?: string;
|
|
76
78
|
}
|
|
77
79
|
export interface ClosePositionResponseDto {
|
|
78
80
|
orderId: string;
|
|
@@ -97,6 +99,7 @@ export interface AdjustPositionRequestInput {
|
|
|
97
99
|
adjustmentSize: number;
|
|
98
100
|
executionType: AdjustExecutionType;
|
|
99
101
|
limitRatio?: number;
|
|
102
|
+
referralCode?: string;
|
|
100
103
|
}
|
|
101
104
|
export interface AdjustPositionResponseDto {
|
|
102
105
|
orderId: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { ActiveAssetGroupItem, ActiveAssetsResponse } from '../types';
|
|
1
|
+
import type { ActiveAssetGroupItem, ActiveAssetsResponse, ActiveAssetsAllResponse } from '../types';
|
|
2
2
|
export declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
|
|
3
|
+
export declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
|
|
3
4
|
export declare const useActiveBaskets: () => ActiveAssetGroupItem[];
|
|
4
5
|
export declare const useTopGainers: (limit?: number) => ActiveAssetGroupItem[];
|
|
5
6
|
export declare const useTopLosers: (limit?: number) => ActiveAssetGroupItem[];
|
|
6
7
|
export declare const useHighlightedBaskets: () => ActiveAssetGroupItem[];
|
|
7
8
|
export declare const useWatchlistBaskets: () => ActiveAssetGroupItem[];
|
|
9
|
+
export declare const useAllBaskets: () => ActiveAssetGroupItem[];
|
|
8
10
|
export declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ReadyState } from 'react-use-websocket';
|
|
2
1
|
export interface UseHyperliquidNativeWebSocketProps {
|
|
3
2
|
address: string | null;
|
|
4
3
|
tokens?: string[];
|
|
5
4
|
}
|
|
6
5
|
export interface UseHyperliquidNativeWebSocketReturn {
|
|
7
|
-
connectionStatus: ReadyState;
|
|
8
6
|
isConnected: boolean;
|
|
9
7
|
lastError: string | null;
|
|
10
8
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import * as react_use_websocket from 'react-use-websocket';
|
|
3
|
-
import { ReadyState } from 'react-use-websocket';
|
|
4
2
|
|
|
5
3
|
interface ApiErrorResponse {
|
|
6
4
|
statusCode: number;
|
|
@@ -30,7 +28,7 @@ type WebSocketConnectionState = 'connecting' | 'connected' | 'disconnected' | 'e
|
|
|
30
28
|
/**
|
|
31
29
|
* WebSocket channels
|
|
32
30
|
*/
|
|
33
|
-
type WebSocketChannel = 'trade-histories' | 'open-positions' | 'open-orders' | 'account-summary' | 'twap-details' | 'notifications' | 'market-data' | 'webData2' | 'allMids' | 'activeAssetData';
|
|
31
|
+
type WebSocketChannel = 'trade-histories' | 'open-positions' | 'open-orders' | 'account-summary' | 'twap-details' | 'notifications' | 'market-data' | 'market-data-all' | 'webData2' | 'allMids' | 'activeAssetData';
|
|
34
32
|
/**
|
|
35
33
|
* WebSocket subscription message
|
|
36
34
|
*/
|
|
@@ -532,6 +530,7 @@ interface ActiveAssetGroupItem {
|
|
|
532
530
|
shortAssets: PairAssetDto[];
|
|
533
531
|
openInterest: string;
|
|
534
532
|
volume: string;
|
|
533
|
+
netFunding?: string;
|
|
535
534
|
ratio?: string;
|
|
536
535
|
prevRatio?: string;
|
|
537
536
|
change24h?: string;
|
|
@@ -546,6 +545,12 @@ interface ActiveAssetsResponse {
|
|
|
546
545
|
highlighted: ActiveAssetGroupItem[];
|
|
547
546
|
watchlist: ActiveAssetGroupItem[];
|
|
548
547
|
}
|
|
548
|
+
interface ActiveAssetsAllResponse {
|
|
549
|
+
active: ActiveAssetGroupItem[];
|
|
550
|
+
all: ActiveAssetGroupItem[];
|
|
551
|
+
highlighted: ActiveAssetGroupItem[];
|
|
552
|
+
watchlist: ActiveAssetGroupItem[];
|
|
553
|
+
}
|
|
549
554
|
/**
|
|
550
555
|
* Candle interval options
|
|
551
556
|
*/
|
|
@@ -589,10 +594,8 @@ interface PearHyperliquidContextType {
|
|
|
589
594
|
wsUrl: string;
|
|
590
595
|
address: string | null;
|
|
591
596
|
setAddress: (address: string | null) => void;
|
|
592
|
-
connectionStatus: ReadyState;
|
|
593
597
|
isConnected: boolean;
|
|
594
598
|
lastError: string | null;
|
|
595
|
-
nativeConnectionStatus: ReadyState;
|
|
596
599
|
nativeIsConnected: boolean;
|
|
597
600
|
nativeLastError: string | null;
|
|
598
601
|
authStatus: AuthStatus;
|
|
@@ -719,7 +722,6 @@ declare const useWebData: () => {
|
|
|
719
722
|
perpsAtOpenInterestCap: string[] | undefined;
|
|
720
723
|
marketDataBySymbol: Record<string, AssetMarketData>;
|
|
721
724
|
isConnected: boolean;
|
|
722
|
-
connectionStatus: react_use_websocket.ReadyState;
|
|
723
725
|
error: string | null;
|
|
724
726
|
};
|
|
725
727
|
|
|
@@ -886,6 +888,7 @@ interface CreatePositionRequestInput {
|
|
|
886
888
|
twapDuration?: number;
|
|
887
889
|
twapIntervalSeconds?: number;
|
|
888
890
|
randomizeExecution?: boolean;
|
|
891
|
+
referralCode?: string;
|
|
889
892
|
ladderConfig?: LadderConfigInput;
|
|
890
893
|
takeProfit?: TpSlThresholdInput | null;
|
|
891
894
|
stopLoss?: TpSlThresholdInput | null;
|
|
@@ -932,6 +935,7 @@ interface ClosePositionRequestInput {
|
|
|
932
935
|
twapDuration?: number;
|
|
933
936
|
twapIntervalSeconds?: number;
|
|
934
937
|
randomizeExecution?: boolean;
|
|
938
|
+
referralCode?: string;
|
|
935
939
|
}
|
|
936
940
|
interface ClosePositionResponseDto {
|
|
937
941
|
orderId: string;
|
|
@@ -956,6 +960,7 @@ interface AdjustPositionRequestInput {
|
|
|
956
960
|
adjustmentSize: number;
|
|
957
961
|
executionType: AdjustExecutionType;
|
|
958
962
|
limitRatio?: number;
|
|
963
|
+
referralCode?: string;
|
|
959
964
|
}
|
|
960
965
|
interface AdjustPositionResponseDto {
|
|
961
966
|
orderId: string;
|
|
@@ -1008,11 +1013,13 @@ interface UseNotificationsResult {
|
|
|
1008
1013
|
declare function useNotifications(): UseNotificationsResult;
|
|
1009
1014
|
|
|
1010
1015
|
declare const useMarketDataPayload: () => ActiveAssetsResponse | null;
|
|
1016
|
+
declare const useMarketDataAllPayload: () => ActiveAssetsAllResponse | null;
|
|
1011
1017
|
declare const useActiveBaskets: () => ActiveAssetGroupItem[];
|
|
1012
1018
|
declare const useTopGainers: (limit?: number) => ActiveAssetGroupItem[];
|
|
1013
1019
|
declare const useTopLosers: (limit?: number) => ActiveAssetGroupItem[];
|
|
1014
1020
|
declare const useHighlightedBaskets: () => ActiveAssetGroupItem[];
|
|
1015
1021
|
declare const useWatchlistBaskets: () => ActiveAssetGroupItem[];
|
|
1022
|
+
declare const useAllBaskets: () => ActiveAssetGroupItem[];
|
|
1016
1023
|
declare const useFindBasket: (longs: string[], shorts: string[]) => ActiveAssetGroupItem | undefined;
|
|
1017
1024
|
|
|
1018
1025
|
declare function useWatchlist(): {
|
|
@@ -1078,7 +1085,6 @@ interface UseHyperliquidWebSocketProps {
|
|
|
1078
1085
|
address: string | null;
|
|
1079
1086
|
}
|
|
1080
1087
|
declare const useHyperliquidWebSocket: ({ wsUrl, address }: UseHyperliquidWebSocketProps) => {
|
|
1081
|
-
connectionStatus: ReadyState;
|
|
1082
1088
|
isConnected: boolean;
|
|
1083
1089
|
lastError: string | null;
|
|
1084
1090
|
};
|
|
@@ -1088,7 +1094,6 @@ interface UseHyperliquidNativeWebSocketProps {
|
|
|
1088
1094
|
tokens?: string[];
|
|
1089
1095
|
}
|
|
1090
1096
|
interface UseHyperliquidNativeWebSocketReturn {
|
|
1091
|
-
connectionStatus: ReadyState;
|
|
1092
1097
|
isConnected: boolean;
|
|
1093
1098
|
lastError: string | null;
|
|
1094
1099
|
}
|
|
@@ -1254,5 +1259,5 @@ declare function validatePositionSize(usdValue: number, longAssets?: PairAssetIn
|
|
|
1254
1259
|
|
|
1255
1260
|
declare const useMarketData: any;
|
|
1256
1261
|
|
|
1257
|
-
export { AccountSummaryCalculator, AuthStatus, ConflictDetector, MINIMUM_ASSET_USD_VALUE, MinimumPositionSizeError, PearHyperliquidProvider, TokenMetadataExtractor, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, getPortfolio, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toggleWatchlist, updateRiskParameters, useAccountSummary, useActiveBaskets, useAddress, useAgentWallet, useAutoSyncFills, useBasketCandles, useFindBasket, useHighlightedBaskets, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useMarketData, useMarketDataPayload, useNotifications, useOpenOrders, useOrders, usePearAgentWallet, usePearAuth, usePearHyperliquid, usePerformanceOverlays, usePortfolio, usePosition, useTokenSelectionMetadata, useTopGainers, useTopLosers, useTradeHistories, useTwap, useUserSelection, useWatchlist, useWatchlistBaskets, useWebData, validateMinimumAssetSize, validatePositionSize };
|
|
1262
|
+
export { AccountSummaryCalculator, AuthStatus, ConflictDetector, MINIMUM_ASSET_USD_VALUE, MinimumPositionSizeError, PearHyperliquidProvider, TokenMetadataExtractor, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, getCompleteTimestamps, getPortfolio, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toggleWatchlist, updateRiskParameters, useAccountSummary, useActiveBaskets, useAddress, useAgentWallet, useAllBaskets, useAutoSyncFills, useBasketCandles, useFindBasket, useHighlightedBaskets, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useMarketData, useMarketDataAllPayload, useMarketDataPayload, useNotifications, useOpenOrders, useOrders, usePearAgentWallet, usePearAuth, usePearHyperliquid, usePerformanceOverlays, usePortfolio, usePosition, useTokenSelectionMetadata, useTopGainers, useTopLosers, useTradeHistories, useTwap, useUserSelection, useWatchlist, useWatchlistBaskets, useWebData, validateMinimumAssetSize, validatePositionSize };
|
|
1258
1263
|
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, 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, PairAssetDto, PairAssetInput, PerformanceOverlay, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PositionAssetSummaryDto, PositionResponseStatus, RealtimeBar, RealtimeBarsCallback, ToggleWatchlistResponseDto, TokenConflict, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TpSlThresholdInput, TpSlThresholdType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TwapChunkStatusDto, TwapMonitoringDto, UniverseAsset, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAgentWalletOptions, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistItemDto, WebData2Response, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|