@pear-protocol/hyperliquid-sdk 0.0.7-2.1 → 0.0.7-2.2
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/hooks/useAuth.d.ts +3 -3
- package/dist/index.d.ts +24 -5
- package/dist/index.js +52 -12
- package/dist/store/historicalPriceDataStore.d.ts +12 -1
- package/dist/store/hyperliquidDataStore.d.ts +31 -1
- package/dist/store/marketDataStore.d.ts +10 -1
- package/dist/store/tokenSelectionMetadataStore.d.ts +2 -2
- package/dist/store/userDataStore.d.ts +30 -1
- package/dist/store/userSelection.d.ts +1 -1
- package/package.json +3 -2
package/dist/hooks/useAuth.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { GetEIP712MessageResponse } from "../types";
|
|
2
2
|
export declare function useAuth(): {
|
|
3
3
|
readonly isReady: boolean;
|
|
4
|
-
readonly isAuthenticated:
|
|
5
|
-
readonly accessToken:
|
|
6
|
-
readonly refreshToken:
|
|
4
|
+
readonly isAuthenticated: boolean;
|
|
5
|
+
readonly accessToken: string | null;
|
|
6
|
+
readonly refreshToken: string | null;
|
|
7
7
|
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
8
8
|
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
9
9
|
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import * as zustand from 'zustand';
|
|
2
3
|
|
|
3
4
|
interface PearHyperliquidContextType {
|
|
4
5
|
clientId: string;
|
|
@@ -850,7 +851,18 @@ interface TokenHistoricalPriceData {
|
|
|
850
851
|
oldestTime: number | null;
|
|
851
852
|
latestTime: number | null;
|
|
852
853
|
}
|
|
853
|
-
|
|
854
|
+
interface HistoricalPriceDataState {
|
|
855
|
+
historicalPriceData: Record<string, TokenHistoricalPriceData>;
|
|
856
|
+
loadingTokens: Set<string>;
|
|
857
|
+
addHistoricalPriceData: (symbol: string, interval: CandleInterval, candles: CandleData[], range: HistoricalRange) => void;
|
|
858
|
+
hasHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => boolean;
|
|
859
|
+
getHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => CandleData[];
|
|
860
|
+
setTokenLoading: (symbol: string, loading: boolean) => void;
|
|
861
|
+
isTokenLoading: (symbol: string) => boolean;
|
|
862
|
+
removeTokenPriceData: (symbol: string, interval: CandleInterval) => void;
|
|
863
|
+
clearData: () => void;
|
|
864
|
+
}
|
|
865
|
+
declare const useHistoricalPriceDataStore: zustand.UseBoundStore<zustand.StoreApi<HistoricalPriceDataState>>;
|
|
854
866
|
|
|
855
867
|
interface UseHistoricalPriceDataReturn {
|
|
856
868
|
fetchHistoricalPriceData: (startTime: number, endTime: number, interval: CandleInterval, callback?: (data: Record<string, CandleData[]>) => void) => Promise<Record<string, CandleData[]>>;
|
|
@@ -1251,9 +1263,9 @@ declare function usePortfolio(): UsePortfolioResult;
|
|
|
1251
1263
|
|
|
1252
1264
|
declare function useAuth(): {
|
|
1253
1265
|
readonly isReady: boolean;
|
|
1254
|
-
readonly isAuthenticated:
|
|
1255
|
-
readonly accessToken:
|
|
1256
|
-
readonly refreshToken:
|
|
1266
|
+
readonly isAuthenticated: boolean;
|
|
1267
|
+
readonly accessToken: string | null;
|
|
1268
|
+
readonly refreshToken: string | null;
|
|
1257
1269
|
readonly getEip712: (address: string) => Promise<GetEIP712MessageResponse>;
|
|
1258
1270
|
readonly loginWithSignedMessage: (address: string, signature: string, timestamp: number) => Promise<void>;
|
|
1259
1271
|
readonly loginWithPrivyToken: (address: string, appId: string, privyAccessToken: string) => Promise<void>;
|
|
@@ -1509,7 +1521,14 @@ declare function getMarketPrefix(fullSymbol: string): string | undefined;
|
|
|
1509
1521
|
*/
|
|
1510
1522
|
declare function isHip3Market(symbol: string): boolean;
|
|
1511
1523
|
|
|
1512
|
-
|
|
1524
|
+
interface MarketDataState {
|
|
1525
|
+
marketData: ActiveAssetsResponse | null;
|
|
1526
|
+
marketDataAll: ActiveAssetsAllResponse | null;
|
|
1527
|
+
setMarketData: (value: ActiveAssetsResponse | null) => void;
|
|
1528
|
+
setMarketDataAll: (value: ActiveAssetsAllResponse | null) => void;
|
|
1529
|
+
clean: () => void;
|
|
1530
|
+
}
|
|
1531
|
+
declare const useMarketData: zustand.UseBoundStore<zustand.StoreApi<MarketDataState>>;
|
|
1513
1532
|
|
|
1514
1533
|
export { AccountSummaryCalculator, ConflictDetector, MAX_ASSETS_PER_LEG, MINIMUM_ASSET_USD_VALUE, MaxAssetsPerLegError, MinimumPositionSizeError, PearHyperliquidProvider, TokenMetadataExtractor, adjustAdvancePosition, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, executeSpotOrder, getAvailableMarkets, getCompleteTimestamps, getMarketPrefix, getPortfolio, isHip3Market, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toBackendSymbol, toBackendSymbolWithMarket, toDisplaySymbol, toggleWatchlist, updateLeverage, updateRiskParameters, useAccountSummary, useActiveBaskets, useAgentWallet, useAllBaskets, useAllUserBalances, useAuth, useAutoSyncFills, useBasketCandles, useFindBasket, useHighlightedBaskets, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidNativeWebSocket, useHyperliquidWebSocket, useMarketData, useMarketDataAllPayload, useMarketDataPayload, useNotifications, useOpenOrders, useOrders, usePearHyperliquid, usePerformanceOverlays, usePerpMetaAssets, usePortfolio, usePosition, useSpotOrder, useTokenSelectionMetadata, useTopGainers, useTopLosers, useTradeHistories, useTwap, useUserSelection, useWatchlist, useWatchlistBaskets, useWebData, validateMaxAssetsPerLeg, validateMinimumAssetSize, validatePositionSize };
|
|
1515
1534
|
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, 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, CollateralFilter, CollateralToken, CreatePositionRequestInput, CreatePositionResponseDto, CrossMarginSummaryDto, CumFundingDto, ExecutionType, ExtraAgent, HLWebSocketResponse, HistoricalRange, LadderConfigInput, MarginSummaryDto, MarketDataBySymbol, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderStatus, PairAssetDto, PairAssetInput, PerformanceOverlay, PlatformAccountSummaryResponseDto, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PositionAssetSummaryDto, PositionResponseStatus, RealtimeBar, RealtimeBarsCallback, SpotBalance, SpotOrderFilledStatus, SpotOrderHyperliquidData, SpotOrderHyperliquidResult, SpotOrderRequestInput, SpotOrderResponseDto, SpotState, ToggleWatchlistResponseDto, TokenConflict, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TpSlThresholdInput, TpSlThresholdType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TwapChunkStatusDto, TwapMonitoringDto, TwapSliceFillResponseItem, UniverseAsset, UpdateLeverageRequestInput, UpdateLeverageResponseDto, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseSpotOrderResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistItemDto, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useRef, useCallback, useEffect, useMemo, useContext, createContext } from 'react';
|
|
3
|
-
import { create } from 'zustand';
|
|
2
|
+
import React, { useState, useRef, useCallback, useEffect, useMemo, useContext, createContext } from 'react';
|
|
4
3
|
|
|
5
4
|
// Browser-compatible WebSocket ready state enum (mirrors native values)
|
|
6
5
|
var ReadyState;
|
|
@@ -11,6 +10,47 @@ var ReadyState;
|
|
|
11
10
|
ReadyState[ReadyState["CLOSED"] = 3] = "CLOSED";
|
|
12
11
|
})(ReadyState || (ReadyState = {}));
|
|
13
12
|
|
|
13
|
+
const createStoreImpl = (createState) => {
|
|
14
|
+
let state;
|
|
15
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
16
|
+
const setState = (partial, replace) => {
|
|
17
|
+
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
18
|
+
if (!Object.is(nextState, state)) {
|
|
19
|
+
const previousState = state;
|
|
20
|
+
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
21
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const getState = () => state;
|
|
25
|
+
const getInitialState = () => initialState;
|
|
26
|
+
const subscribe = (listener) => {
|
|
27
|
+
listeners.add(listener);
|
|
28
|
+
return () => listeners.delete(listener);
|
|
29
|
+
};
|
|
30
|
+
const api = { setState, getState, getInitialState, subscribe };
|
|
31
|
+
const initialState = state = createState(setState, getState, api);
|
|
32
|
+
return api;
|
|
33
|
+
};
|
|
34
|
+
const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
35
|
+
|
|
36
|
+
const identity = (arg) => arg;
|
|
37
|
+
function useStore(api, selector = identity) {
|
|
38
|
+
const slice = React.useSyncExternalStore(
|
|
39
|
+
api.subscribe,
|
|
40
|
+
React.useCallback(() => selector(api.getState()), [api, selector]),
|
|
41
|
+
React.useCallback(() => selector(api.getInitialState()), [api, selector])
|
|
42
|
+
);
|
|
43
|
+
React.useDebugValue(slice);
|
|
44
|
+
return slice;
|
|
45
|
+
}
|
|
46
|
+
const createImpl = (createState) => {
|
|
47
|
+
const api = createStore(createState);
|
|
48
|
+
const useBoundStore = (selector) => useStore(api, selector);
|
|
49
|
+
Object.assign(useBoundStore, api);
|
|
50
|
+
return useBoundStore;
|
|
51
|
+
};
|
|
52
|
+
const create = ((createState) => createState ? createImpl(createState) : createImpl);
|
|
53
|
+
|
|
14
54
|
const useUserData = create((set) => ({
|
|
15
55
|
accessToken: null,
|
|
16
56
|
refreshToken: null,
|
|
@@ -1600,9 +1640,9 @@ class TokenMetadataExtractor {
|
|
|
1600
1640
|
* This allows us to keep the full name (xyz:GOOGL) for URLs/tags while extracting just the symbol for SDK lookups.
|
|
1601
1641
|
*/
|
|
1602
1642
|
function parseTokenWithPrefix(token) {
|
|
1603
|
-
if (token.includes(
|
|
1604
|
-
const [prefix, ...rest] = token.split(
|
|
1605
|
-
const symbol = rest.join(
|
|
1643
|
+
if (token.includes(":")) {
|
|
1644
|
+
const [prefix, ...rest] = token.split(":");
|
|
1645
|
+
const symbol = rest.join(":").toUpperCase();
|
|
1606
1646
|
return {
|
|
1607
1647
|
prefix: prefix.toLowerCase(),
|
|
1608
1648
|
symbol,
|
|
@@ -1624,8 +1664,8 @@ const useTokenSelectionMetadataStore = create((set) => ({
|
|
|
1624
1664
|
weightedRatio24h: 1,
|
|
1625
1665
|
priceRatio: 1,
|
|
1626
1666
|
priceRatio24h: 1,
|
|
1627
|
-
openInterest:
|
|
1628
|
-
volume:
|
|
1667
|
+
openInterest: "0",
|
|
1668
|
+
volume: "0",
|
|
1629
1669
|
sumNetFunding: 0,
|
|
1630
1670
|
maxLeverage: 0,
|
|
1631
1671
|
minMargin: 0,
|
|
@@ -1699,7 +1739,7 @@ const useTokenSelectionMetadataStore = create((set) => ({
|
|
|
1699
1739
|
// Open interest and volume (from market data for matching asset basket)
|
|
1700
1740
|
// Use base symbols (without prefix) for matching against market data
|
|
1701
1741
|
const { openInterest, volume } = (() => {
|
|
1702
|
-
const empty = { openInterest:
|
|
1742
|
+
const empty = { openInterest: "0", volume: "0" };
|
|
1703
1743
|
if (!(marketData === null || marketData === void 0 ? void 0 : marketData.active) || (!longTokens.length && !shortTokens.length))
|
|
1704
1744
|
return empty;
|
|
1705
1745
|
const selectedLong = longBaseSymbols.slice().sort();
|
|
@@ -1795,7 +1835,7 @@ const useTokenSelectionMetadataStore = create((set) => ({
|
|
|
1795
1835
|
});
|
|
1796
1836
|
return totalFunding;
|
|
1797
1837
|
})();
|
|
1798
|
-
// Max leverage (
|
|
1838
|
+
// Max leverage (maximum across all tokens)
|
|
1799
1839
|
// Use tokens with their market prefixes for proper lookup in perpMetaAssets
|
|
1800
1840
|
const maxLeverage = (() => {
|
|
1801
1841
|
if (!perpMetaAssets)
|
|
@@ -1806,7 +1846,7 @@ const useTokenSelectionMetadataStore = create((set) => ({
|
|
|
1806
1846
|
];
|
|
1807
1847
|
if (allTokensForLookup.length === 0)
|
|
1808
1848
|
return 0;
|
|
1809
|
-
let
|
|
1849
|
+
let maxLev = 0;
|
|
1810
1850
|
allTokensForLookup.forEach(({ symbol, marketPrefix }) => {
|
|
1811
1851
|
// Match by both name AND marketPrefix for HIP3 assets
|
|
1812
1852
|
const tokenUniverse = perpMetaAssets.find((u) => u.name === symbol &&
|
|
@@ -1816,9 +1856,9 @@ const useTokenSelectionMetadataStore = create((set) => ({
|
|
|
1816
1856
|
// Fallback to just matching by name if no exact match
|
|
1817
1857
|
const fallbackUniverse = tokenUniverse || perpMetaAssets.find((u) => u.name === symbol);
|
|
1818
1858
|
if (fallbackUniverse === null || fallbackUniverse === void 0 ? void 0 : fallbackUniverse.maxLeverage)
|
|
1819
|
-
|
|
1859
|
+
maxLev = Math.max(maxLev, fallbackUniverse.maxLeverage);
|
|
1820
1860
|
});
|
|
1821
|
-
return
|
|
1861
|
+
return maxLev;
|
|
1822
1862
|
})();
|
|
1823
1863
|
// Min margin (10 * total number of tokens)
|
|
1824
1864
|
const minMargin = (() => {
|
|
@@ -10,5 +10,16 @@ interface TokenHistoricalPriceData {
|
|
|
10
10
|
oldestTime: number | null;
|
|
11
11
|
latestTime: number | null;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
interface HistoricalPriceDataState {
|
|
14
|
+
historicalPriceData: Record<string, TokenHistoricalPriceData>;
|
|
15
|
+
loadingTokens: Set<string>;
|
|
16
|
+
addHistoricalPriceData: (symbol: string, interval: CandleInterval, candles: CandleData[], range: HistoricalRange) => void;
|
|
17
|
+
hasHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => boolean;
|
|
18
|
+
getHistoricalPriceData: (symbol: string, interval: CandleInterval, startTime: number, endTime: number) => CandleData[];
|
|
19
|
+
setTokenLoading: (symbol: string, loading: boolean) => void;
|
|
20
|
+
isTokenLoading: (symbol: string) => boolean;
|
|
21
|
+
removeTokenPriceData: (symbol: string, interval: CandleInterval) => void;
|
|
22
|
+
clearData: () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const useHistoricalPriceDataStore: import("zustand").UseBoundStore<import("zustand").StoreApi<HistoricalPriceDataState>>;
|
|
14
25
|
export type { HistoricalRange, TokenHistoricalPriceData };
|
|
@@ -1 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import { ActiveAssetData, CandleChartData, CandleData, ClearinghouseState, UniverseAsset, WebData3AssetCtx, WsAllMidsData } from '../types';
|
|
2
|
+
interface HyperliquidDataState {
|
|
3
|
+
allMids: WsAllMidsData | null;
|
|
4
|
+
activeAssetData: Record<string, ActiveAssetData> | null;
|
|
5
|
+
candleData: CandleChartData | null;
|
|
6
|
+
finalAssetContexts: WebData3AssetCtx[] | null;
|
|
7
|
+
finalAtOICaps: string[] | null;
|
|
8
|
+
aggregatedClearingHouseState: ClearinghouseState | null;
|
|
9
|
+
rawClearinghouseStates: [string, ClearinghouseState][] | null;
|
|
10
|
+
perpMetaAssets: UniverseAsset[] | null;
|
|
11
|
+
allPerpMetaAssets: UniverseAsset[] | null;
|
|
12
|
+
hip3Assets: Map<string, string[]>;
|
|
13
|
+
hip3MarketPrefixes: Map<string, string>;
|
|
14
|
+
setAllMids: (value: WsAllMidsData | null) => void;
|
|
15
|
+
setActiveAssetData: (value: Record<string, ActiveAssetData> | null | ((prev: Record<string, ActiveAssetData> | null) => Record<string, ActiveAssetData> | null)) => void;
|
|
16
|
+
deleteActiveAssetData: (key: string) => void;
|
|
17
|
+
addCandleData: (symbol: string, candle: CandleData) => void;
|
|
18
|
+
deleteCandleSymbol: (symbol: string) => void;
|
|
19
|
+
setCandleData: (value: CandleChartData | null) => void;
|
|
20
|
+
upsertActiveAssetData: (key: string, value: ActiveAssetData) => void;
|
|
21
|
+
setFinalAssetContexts: (value: WebData3AssetCtx[] | null) => void;
|
|
22
|
+
setFinalAtOICaps: (value: string[] | null) => void;
|
|
23
|
+
setAggregatedClearingHouseState: (value: ClearinghouseState | null) => void;
|
|
24
|
+
setRawClearinghouseStates: (value: [string, ClearinghouseState][] | null) => void;
|
|
25
|
+
setPerpMetaAssets: (value: UniverseAsset[] | null) => void;
|
|
26
|
+
setAllPerpMetaAssets: (value: UniverseAsset[] | null) => void;
|
|
27
|
+
setHip3Assets: (value: Map<string, string[]>) => void;
|
|
28
|
+
setHip3MarketPrefixes: (value: Map<string, string>) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare const useHyperliquidData: import("zustand").UseBoundStore<import("zustand").StoreApi<HyperliquidDataState>>;
|
|
31
|
+
export {};
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ActiveAssetsAllResponse, ActiveAssetsResponse } from '../types';
|
|
2
|
+
interface MarketDataState {
|
|
3
|
+
marketData: ActiveAssetsResponse | null;
|
|
4
|
+
marketDataAll: ActiveAssetsAllResponse | null;
|
|
5
|
+
setMarketData: (value: ActiveAssetsResponse | null) => void;
|
|
6
|
+
setMarketDataAll: (value: ActiveAssetsAllResponse | null) => void;
|
|
7
|
+
clean: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useMarketData: import("zustand").UseBoundStore<import("zustand").StoreApi<MarketDataState>>;
|
|
10
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActiveAssetData, TokenSelection, TokenMetadata, WsAllMidsData, ActiveAssetsResponse, UniverseAsset, WebData3AssetCtx } from
|
|
1
|
+
import type { ActiveAssetData, TokenSelection, TokenMetadata, WsAllMidsData, ActiveAssetsResponse, UniverseAsset, WebData3AssetCtx } from "../types";
|
|
2
2
|
export interface TokenSelectionMetadataState {
|
|
3
3
|
isPriceDataReady: boolean;
|
|
4
4
|
isLoading: boolean;
|
|
@@ -24,4 +24,4 @@ export interface TokenSelectionMetadataState {
|
|
|
24
24
|
shortTokens: TokenSelection[];
|
|
25
25
|
}) => void;
|
|
26
26
|
}
|
|
27
|
-
export declare const useTokenSelectionMetadataStore:
|
|
27
|
+
export declare const useTokenSelectionMetadataStore: import("zustand").UseBoundStore<import("zustand").StoreApi<TokenSelectionMetadataState>>;
|
|
@@ -1 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import { PlatformAccountSummaryResponseDto, OpenLimitOrderDto, RawPositionDto, TradeHistoryDataDto, TwapMonitoringDto, NotificationDto, ExtraAgent, SpotState } from "../types";
|
|
2
|
+
interface UserDataState {
|
|
3
|
+
accessToken: string | null;
|
|
4
|
+
refreshToken: string | null;
|
|
5
|
+
isAuthenticated: boolean;
|
|
6
|
+
address: string | null;
|
|
7
|
+
tradeHistories: TradeHistoryDataDto[] | null;
|
|
8
|
+
rawOpenPositions: RawPositionDto[] | null;
|
|
9
|
+
openOrders: OpenLimitOrderDto[] | null;
|
|
10
|
+
accountSummary: PlatformAccountSummaryResponseDto | null;
|
|
11
|
+
twapDetails: TwapMonitoringDto[] | null;
|
|
12
|
+
notifications: NotificationDto[] | null;
|
|
13
|
+
userExtraAgents: ExtraAgent[] | null;
|
|
14
|
+
spotState: SpotState | null;
|
|
15
|
+
setAccessToken: (token: string | null) => void;
|
|
16
|
+
setRefreshToken: (token: string | null) => void;
|
|
17
|
+
setIsAuthenticated: (value: boolean) => void;
|
|
18
|
+
setAddress: (address: string | null) => void;
|
|
19
|
+
setTradeHistories: (value: TradeHistoryDataDto[] | null) => void;
|
|
20
|
+
setRawOpenPositions: (value: RawPositionDto[] | null) => void;
|
|
21
|
+
setOpenOrders: (value: OpenLimitOrderDto[] | null) => void;
|
|
22
|
+
setAccountSummary: (value: PlatformAccountSummaryResponseDto | null) => void;
|
|
23
|
+
setUserExtraAgents: (value: ExtraAgent[] | null) => void;
|
|
24
|
+
setTwapDetails: (value: TwapMonitoringDto[] | null) => void;
|
|
25
|
+
setNotifications: (value: NotificationDto[] | null) => void;
|
|
26
|
+
setSpotState: (value: SpotState | null) => void;
|
|
27
|
+
clean: () => void;
|
|
28
|
+
}
|
|
29
|
+
export declare const useUserData: import("zustand").UseBoundStore<import("zustand").StoreApi<UserDataState>>;
|
|
30
|
+
export {};
|
|
@@ -23,5 +23,5 @@ interface UserSelectionState {
|
|
|
23
23
|
setTokenSelections: (longTokens: TokenSelection[], shortTokens: TokenSelection[]) => void;
|
|
24
24
|
resetToDefaults: () => void;
|
|
25
25
|
}
|
|
26
|
-
export declare const useUserSelection:
|
|
26
|
+
export declare const useUserSelection: import("zustand").UseBoundStore<import("zustand").StoreApi<UserSelectionState>>;
|
|
27
27
|
export type { UserSelectionState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pear-protocol/hyperliquid-sdk",
|
|
3
|
-
"version": "0.0.72.
|
|
3
|
+
"version": "0.0.72.2",
|
|
4
4
|
"description": "React SDK for Pear Protocol Hyperliquid API integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"clean": "rimraf dist"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"axios": "^1.6.0"
|
|
27
|
+
"axios": "^1.6.0",
|
|
28
|
+
"zustand": "^5.0.9"
|
|
28
29
|
},
|
|
29
30
|
"peerDependencies": {
|
|
30
31
|
"react": "^18.0.0",
|