@orderly.network/hooks 2.2.0 → 2.3.0

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/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import * as swr from 'swr';
2
- import swr__default, { SWRConfiguration, SWRResponse } from 'swr';
3
- export { SWRConfiguration, unstable_serialize, default as useSWR, useSWRConfig } from 'swr';
2
+ import { SWRConfiguration, SWRHook, SWRResponse } from 'swr';
3
+ export { swr };
4
+ export { KeyedMutator, Middleware, SWRConfiguration, SWRHook, SWRResponse, unstable_serialize, default as useSWR, useSWRConfig } from 'swr';
4
5
  import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
5
6
  import * as swr_infinite from 'swr/infinite';
6
7
  import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
8
+ import * as _orderly_network_types from '@orderly.network/types';
9
+ import { NetworkId, TrackerEventName, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, OrderlyOrder, OrderType, AlgoOrderEntity, AlgoOrderType, RequireKeys } from '@orderly.network/types';
7
10
  import * as _orderly_network_core from '@orderly.network/core';
8
11
  import { AccountState, Account, EventEmitter, ConfigStore, ConfigKey, SimpleDI, OrderlyKeyStore, WalletAdapter, IContract, DefaultConfigStore } from '@orderly.network/core';
9
- export { WalletAdapter } from '@orderly.network/core';
10
- import * as _orderly_network_types from '@orderly.network/types';
11
- import { NetworkId, TrackerEventName, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, OrderType, OrderlyOrder, AlgoOrderEntity, AlgoOrderType, RequireKeys } from '@orderly.network/types';
12
+ export { SubAccount, WalletAdapter } from '@orderly.network/core';
12
13
  import * as lodash from 'lodash';
13
14
  export { default as useConstant } from 'use-constant';
14
15
  import { WS } from '@orderly.network/net';
@@ -18,6 +19,7 @@ import { EIP1193Provider } from '@web3-onboard/common';
18
19
  import { SolanaWalletProvider } from '@orderly.network/default-solana-adapter';
19
20
  import * as swr_subscription from 'swr/subscription';
20
21
  import * as _orderly_network_utils from '@orderly.network/utils';
22
+ import { Decimal } from '@orderly.network/utils';
21
23
  export * from 'use-debounce';
22
24
  import * as immer from 'immer';
23
25
  import * as zustand from 'zustand';
@@ -29,8 +31,9 @@ declare global {
29
31
  };
30
32
  }
31
33
  }
32
- declare const _default: "2.2.0";
34
+ declare const _default: "2.3.0";
33
35
 
36
+ declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
34
37
  type useQueryOptions<T> = SWRConfiguration & {
35
38
  formatter?: (data: any) => T;
36
39
  };
@@ -41,7 +44,7 @@ type useQueryOptions<T> = SWRConfiguration & {
41
44
  * @param query
42
45
  * @param options
43
46
  */
44
- declare const useQuery: <T>(query: Parameters<typeof swr__default>["0"], options?: useQueryOptions<T>) => SWRResponse<T>;
47
+ declare const useQuery: <T>(query: Parameters<SWRHook>[0], options?: useQueryOptions<T>) => SWRResponse<T>;
45
48
 
46
49
  /**
47
50
  * useQuery
@@ -49,12 +52,12 @@ declare const useQuery: <T>(query: Parameters<typeof swr__default>["0"], options
49
52
  * @param query
50
53
  * @param options
51
54
  */
52
- declare const useLazyQuery: <T, R = any>(query: Parameters<typeof swr__default>["0"], options?: SWRMutationConfiguration<any, any> & {
55
+ declare const useLazyQuery: <T, R = any>(query: Parameters<SWRHook>[0], options?: SWRMutationConfiguration<any, any> & {
53
56
  formatter?: (data: any) => R;
54
57
  init?: RequestInit;
55
58
  }) => SWRMutationResponse;
56
59
 
57
- type HTTP_METHOD = "POST" | "PUT" | "DELETE" | "GET";
60
+ type HTTP_METHOD$1 = "POST" | "PUT" | "DELETE" | "GET";
58
61
  /**
59
62
  * This hook is used to execute API requests for data mutation, such as POST, DELETE, PUT, etc.
60
63
  */
@@ -67,7 +70,7 @@ url: string,
67
70
  /**
68
71
  * The HTTP method to use for the request. Defaults to "POST".
69
72
  */
70
- method?: HTTP_METHOD,
73
+ method?: HTTP_METHOD$1,
71
74
  /**
72
75
  * The configuration object for the mutation.
73
76
  * @see [useSWRMutation](https://swr.vercel.app/docs/mutation#api)
@@ -87,9 +90,9 @@ options?: SWRMutationConfiguration<T, E>) => readonly [(data: Record<string, any
87
90
  * @param query
88
91
  * @param options
89
92
  */
90
- declare const usePrivateQuery: <T>(query: Parameters<typeof swr__default>["0"], options?: useQueryOptions<T>) => SWRResponse<T>;
93
+ declare const usePrivateQuery: <T>(query: Parameters<SWRHook>[0], options?: useQueryOptions<T>) => SWRResponse<T>;
91
94
 
92
- declare const usePrivateInfiniteQuery: <T>(getKey: SWRInfiniteKeyLoader, options?: SWRInfiniteConfiguration & {
95
+ declare const usePrivateInfiniteQuery: <T>(getKey: SWRInfiniteKeyLoader | null, options?: SWRInfiniteConfiguration & {
93
96
  formatter?: (data: any) => any;
94
97
  }) => swr_infinite.SWRInfiniteResponse<T, any>;
95
98
 
@@ -106,6 +109,17 @@ declare const useBoolean: (initialValue?: boolean) => [boolean, {
106
109
  declare const useAccount: () => {
107
110
  account: _orderly_network_core.Account;
108
111
  state: AccountState;
112
+ isSubAccount: boolean;
113
+ isMainAccount: boolean;
114
+ subAccount: {
115
+ refresh: () => Promise<Record<string, _orderly_network_types.API.Holding[]>>;
116
+ create: (description?: string) => Promise<any>;
117
+ update: (value: {
118
+ subAccountId: string;
119
+ description?: string;
120
+ }) => Promise<any>;
121
+ };
122
+ switchAccount: (accountId: string) => Promise<void>;
109
123
  createOrderlyKey: (remember: boolean) => Promise<any>;
110
124
  createAccount: () => Promise<any>;
111
125
  };
@@ -121,7 +135,11 @@ declare const useEventEmitter: () => EventEmitter<string | symbol, any>;
121
135
 
122
136
  declare function useSessionStorage<T>(key: string, initialValue: T): [T, (data: any) => void];
123
137
 
124
- declare function useLocalStorage<T>(key: string, initialValue: T): [any, (value: T) => void];
138
+ declare function parseJSON<T>(value: string | null): T | undefined;
139
+
140
+ declare function useLocalStorage<T>(key: string, initialValue: T, options?: {
141
+ parseJSON: typeof parseJSON;
142
+ }): [any, (value: T) => void];
125
143
 
126
144
  type CurrentChain = {
127
145
  id: number;
@@ -157,8 +175,6 @@ declare class AmplitudeTracker {
157
175
 
158
176
  declare const useTrackingInstance: () => AmplitudeTracker;
159
177
 
160
- declare function parseJSON<T>(value: string | null): T | undefined;
161
-
162
178
  declare const useWS: () => WS;
163
179
 
164
180
  declare function useConfig(): ConfigStore;
@@ -328,7 +344,7 @@ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, opti
328
344
  } | {
329
345
  onDepthChange: (depth: number) => void;
330
346
  depth: number | undefined;
331
- allDepths: any[];
347
+ allDepths: number[];
332
348
  isLoading: boolean;
333
349
  onItemClick: (item: OrderBookItem) => void;
334
350
  asks?: undefined;
@@ -337,14 +353,35 @@ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, opti
337
353
  middlePrice?: undefined;
338
354
  })[];
339
355
 
340
- type ValueOf<T> = T[keyof T];
341
-
356
+ /**
357
+ * Type alias for the return type of useSymbolsInfo hook
358
+ */
342
359
  type SymbolInfo = ReturnType<typeof useSymbolsInfo>;
343
- declare const useSymbolsInfo: () => {
344
- [x: string]: (key?: keyof API.SymbolExt | undefined, defaultValue?: ValueOf<API.SymbolExt> | undefined) => any;
345
- } & {
360
+ /**
361
+ * A hook that provides access to symbol information.
362
+ *
363
+ * @returns A getter object that provides access to symbol information.
364
+ * The getter allows accessing symbol data either by symbol name directly,
365
+ * or through a two-level access pattern (symbol and property).
366
+ *
367
+ * @example
368
+ * ```typescript
369
+ * const symbolsInfo = useSymbolsInfo();
370
+ *
371
+ * // Get all info for a symbol
372
+ * const ethInfo = symbolsInfo["PERP_ETH_USDC"]();
373
+ *
374
+ * // Get specific property for a symbol
375
+ * const baseDP = symbolsInfo["PERP_ETH_USDC"]('base_dp');
376
+ *
377
+ * // Get specific property for a symbol with default value
378
+ * const quoteDP = symbolsInfo["PERP_ETH_USDC"]('quote_dp', 2);
379
+ * ```
380
+ */
381
+ declare const useSymbolsInfo: () => Record<string, <Key extends keyof _orderly_network_types.API.SymbolExt>(key: Key, defaultValue?: _orderly_network_types.API.SymbolExt[Key] | undefined) => _orderly_network_types.API.SymbolExt[Key]> & Record<string, () => _orderly_network_types.API.SymbolExt> & {
346
382
  isNil: boolean;
347
383
  };
384
+ declare const useSymbolsInfoStore: () => Record<string, _orderly_network_types.API.SymbolExt> | undefined;
348
385
 
349
386
  declare const useAccountInfo: () => swr.SWRResponse<API.AccountInfo, any, any>;
350
387
 
@@ -444,6 +481,7 @@ type MarketsItem = {
444
481
  isFavorite: boolean;
445
482
  leverage?: number;
446
483
  };
484
+ type MarketsStore = ReturnType<typeof useMarketsStore>;
447
485
  declare const MarketsStorageKey = "orderly_markets";
448
486
  declare const useMarketsStore: () => {
449
487
  favoriteTabs: FavoriteTab[];
@@ -470,42 +508,56 @@ declare const useMarketsStore: () => {
470
508
  updateSelectedFavoriteTab: (tab: FavoriteTab) => void;
471
509
  updateTabsSortState: (tabId: string, sortKey: string, sortOrder: "desc" | "asc") => void;
472
510
  };
473
- declare const useMarkets: (type?: MarketsType) => readonly [MarketsItem[], {
474
- favoriteTabs: FavoriteTab[];
475
- favorites: {
476
- tabs: FavoriteTab[];
477
- name: string;
478
- }[];
479
- recent: Recent[];
480
- newListing: NewListing[];
481
- tabSort: TabSort;
482
- selectedFavoriteTab: FavoriteTab;
483
- updateFavorites: react.Dispatch<react.SetStateAction<{
484
- tabs: FavoriteTab[];
485
- name: string;
486
- }[]>>;
487
- updateFavoriteTabs: (tab: FavoriteTab | FavoriteTab[], operator?: {
488
- add?: boolean;
489
- update?: boolean;
490
- delete?: boolean;
491
- }) => void;
492
- updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab | FavoriteTab[], remove?: boolean) => void;
493
- pinToTop: (symbol: API.MarketInfoExt) => void;
494
- addToHistory: (symbol: API.MarketInfoExt) => void;
495
- updateSelectedFavoriteTab: (tab: FavoriteTab) => void;
496
- updateTabsSortState: (tabId: string, sortKey: string, sortOrder: "desc" | "asc") => void;
497
- }];
511
+ /**
512
+ * Hook for accessing filtered market data based on type
513
+ * @param type - Type of markets to filter (defaults to ALL)
514
+ * @returns Tuple containing filtered markets array and markets store
515
+ */
516
+ declare const useMarkets: (type?: MarketsType) => [MarketsItem[], MarketsStore];
498
517
 
499
518
  declare const useMarkPricesStream: () => {
500
519
  data: Record<string, number>;
501
520
  };
502
521
 
522
+ declare const useIndexPricesStream: () => {
523
+ data: Record<string, number>;
524
+ };
525
+
503
526
  declare const useMarkPrice: (symbol: string) => {
504
527
  data: number;
505
528
  };
506
529
 
507
530
  declare const useIndexPrice: (symbol: string) => swr_subscription.SWRSubscriptionResponse<any, any>;
508
531
 
532
+ /**
533
+ * A hook for managing leverage in trading.
534
+ *
535
+ * @remarks
536
+ * This hook provides functionality to get and update the user's leverage settings.
537
+ *
538
+ * It fetches the current leverage from client info and available leverage options from config.
539
+ *
540
+ * @returns A tuple containing:
541
+ * - The current maximum leverage value
542
+ * - An object with:
543
+ * - `update`: Function to update leverage
544
+ * - `isMutating`: Boolean indicating if an update is in progress
545
+ * - `config`: Array of available leverage options (e.g. [1, 2, 3, 4, 5, 10, 15, 20])
546
+ *
547
+ * @example
548
+ * ```typescript
549
+ * const [maxLeverage, { update, isMutating, config }] = useLeverage();
550
+ *
551
+ * // Get current max leverage
552
+ * console.log(maxLeverage);
553
+ *
554
+ * // Update leverage
555
+ * update({ leverage: 5 });
556
+ *
557
+ * // Available leverage options
558
+ * console.log(config); // e.g., [1, 2, 3, 4, 5, 10, 15, 20]
559
+ * ```
560
+ */
509
561
  declare const useLeverage: () => {
510
562
  readonly update: (data: {
511
563
  leverage: number;
@@ -534,11 +586,11 @@ declare const useFundingRate: (symbol: string) => {
534
586
  sum_unitary_funding?: number | undefined;
535
587
  };
536
588
 
537
- declare const useFundingRates: () => {
538
- [x: string]: (key?: keyof API.FundingRate | undefined, defaultValue?: ValueOf<API.FundingRate> | undefined) => any;
539
- } & {
589
+ type FundingRates = ReturnType<typeof useFundingRates>;
590
+ declare const useFundingRates: () => Record<string, <Key extends keyof API.FundingRate>(key: Key, defaultValue?: API.FundingRate[Key] | undefined) => API.FundingRate[Key]> & Record<string, () => API.FundingRate> & {
540
591
  isNil: boolean;
541
592
  };
593
+ declare const useFundingRatesStore: () => Record<string, API.FundingRate> | undefined;
542
594
 
543
595
  type PeriodKey = "1d" | "3d" | "7d" | "14d" | "30d" | "90d";
544
596
  declare const useFundingRateHistory: () => {
@@ -564,26 +616,7 @@ symbol?: string, options?: SWRConfiguration & {
564
616
  readonly totalCollateral: _orderly_network_utils.Decimal;
565
617
  readonly totalValue: _orderly_network_utils.Decimal | null;
566
618
  readonly totalUnrealizedROI: number;
567
- }, {
568
- unsettledPnL: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
569
- margin_ratio: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
570
- initial_margin_ratio: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
571
- maintenance_margin_ratio: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
572
- open_margin_ratio: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
573
- current_margin_ratio_with_orders: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
574
- initial_margin_ratio_with_orders: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
575
- maintenance_margin_ratio_with_orders: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
576
- total_collateral_value: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
577
- free_collateral: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
578
- total_pnl_24_h: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
579
- unrealPnL: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
580
- total_unreal_pnl: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
581
- total_unreal_pnl_index: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
582
- total_unsettled_pnl: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
583
- notional: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
584
- unrealPnlROI: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
585
- unrealPnlROI_index: (key?: "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index" | undefined, defaultValue?: ValueOf<Omit<API.PositionInfo, "rows">>) => any;
586
- } & {
619
+ }, Record<"unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index", <Key extends "unsettledPnL" | "margin_ratio" | "initial_margin_ratio" | "maintenance_margin_ratio" | "open_margin_ratio" | "current_margin_ratio_with_orders" | "initial_margin_ratio_with_orders" | "maintenance_margin_ratio_with_orders" | "total_collateral_value" | "free_collateral" | "total_pnl_24_h" | "unrealPnL" | "total_unreal_pnl" | "total_unreal_pnl_index" | "total_unsettled_pnl" | "notional" | "unrealPnlROI" | "unrealPnlROI_index">(defaultValue?: Omit<API.PositionInfo, "rows">[Key] | undefined) => Omit<API.PositionInfo, "rows">[Key]> & {
587
620
  isNil: boolean;
588
621
  }, {
589
622
  /**
@@ -604,6 +637,7 @@ params: {
604
637
  page?: number;
605
638
  size?: number;
606
639
  side?: OrderSide;
640
+ sourceTypeAll?: boolean;
607
641
  /**
608
642
  * Include the order type
609
643
  * @default ["ALL"]
@@ -630,7 +664,7 @@ params: {
630
664
  }) => readonly [any[] | null, {
631
665
  readonly total: number;
632
666
  readonly isLoading: boolean;
633
- readonly refresh: swr.KeyedMutator<unknown[]>;
667
+ readonly refresh: () => void;
634
668
  readonly loadMore: () => void;
635
669
  readonly cancelAllOrders: () => Promise<[any, any]>;
636
670
  readonly cancelAllTPSLOrders: () => Promise<any[]>;
@@ -664,32 +698,126 @@ declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStream
664
698
  isLoading: boolean;
665
699
  };
666
700
 
701
+ /**
702
+ * The return type of useCollateral hook, containing account collateral information
703
+ */
667
704
  type CollateralOutputs = {
705
+ /**
706
+ * Total collateral value in the account
707
+ *
708
+ * This includes all assets that can be used as margin
709
+ */
668
710
  totalCollateral: number;
711
+ /**
712
+ * Available collateral that can be used for new positions
713
+ *
714
+ * Calculated as: totalCollateral - margin requirements
715
+ */
669
716
  freeCollateral: number;
717
+ /**
718
+ * Total portfolio value including all positions and collateral
719
+ *
720
+ * Can be null if data is not available
721
+ */
670
722
  totalValue: number | null;
723
+ /**
724
+ * Current available balance that can be withdrawn
725
+ *
726
+ * Excludes locked collateral and pending settlements
727
+ */
671
728
  availableBalance: number;
729
+ /**
730
+ * Unrealized profit and loss across all open positions
731
+ *
732
+ * Positive value indicates profit, negative indicates loss
733
+ */
672
734
  unsettledPnL: number;
735
+ /**
736
+ * List of holdings in the account
737
+ *
738
+ * Each holding represents a specific token and its quantity
739
+ */
740
+ holding?: API.Holding[];
741
+ /**
742
+ * Detailed account information and settings
743
+ *
744
+ * Contains account configuration, limits and risk parameters
745
+ */
673
746
  accountInfo?: API.AccountInfo;
674
747
  };
748
+ /**
749
+ * Hook to get and calculate collateral-related data for an account
750
+ * @example
751
+ * ```typescript
752
+ * const {
753
+ * totalCollateral,
754
+ * freeCollateral,
755
+ * totalValue,
756
+ * availableBalance,
757
+ * unsettledPnL,
758
+ * accountInfo,
759
+ * } = useCollateral({ dp: 4 });
760
+ * ```
761
+ */
675
762
  declare const useCollateral: (options?: {
676
- /** decimal precision */
763
+ /**
764
+ * Decimal precision for numerical values (default: 6)
765
+ * */
677
766
  dp: number;
678
767
  }) => CollateralOutputs;
679
768
 
680
769
  /**
681
- * @param symbol
682
- * @param side
683
- * @param reduceOnly
684
- * @returns the maximum quantity available for trading in USD
770
+ * A hook that calculates the maximum tradeable quantity for a given symbol and side
771
+ * @returns Maximum tradeable quantity
772
+ * @example
773
+ * ```tsx
774
+ * // Get max buy quantity for BTC
775
+ * const maxBuyQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY);
776
+ *
777
+ * // Get max sell quantity with reduce only
778
+ * const maxSellQty = useMaxQty("PERP_BTC_USDC", OrderSide.SELL, true);
779
+ * ```
685
780
  */
686
- declare const useMaxQty: (symbol: string, side: OrderSide, reduceOnly?: boolean) => number;
781
+ declare const useMaxQty: (
782
+ /**
783
+ * Trading pair symbol (e.g. "PERP_BTC_USDC")
784
+ * */
785
+ symbol: string,
786
+ /**
787
+ * Order side ("BUY" or "SELL")
788
+ * */
789
+ side: OrderSide,
790
+ /**
791
+ * Executes buy or sell orders which only reduce a current position.
792
+ *
793
+ * If true, only allows orders that reduce current position
794
+ * */
795
+ reduceOnly?: boolean) => number;
687
796
 
797
+ /**
798
+ * The return type of useMarginRatio hook
799
+ */
688
800
  type MarginRatioReturn = {
689
- marginRatio: number;
801
+ /**
802
+ * Current leverage of the account, null if trading is not enabled
803
+ */
690
804
  currentLeverage: number | null;
805
+ /**
806
+ * Current margin ratio of the account
807
+ */
808
+ marginRatio: number;
809
+ /**
810
+ * Maintenance margin ratio (MMR) of the account, null if user has no positions
811
+ */
691
812
  mmr: number | null;
692
813
  };
814
+ /**
815
+ * Hook to calculate and monitor account's margin ratio, leverage, and maintenance margin ratio (MMR)
816
+ * @example
817
+ * ```typescript
818
+ * const { marginRatio, currentLeverage, mmr } = useMarginRatio();
819
+ * ```
820
+ */
693
821
  declare const useMarginRatio: () => MarginRatioReturn;
694
822
 
695
823
  declare function useStorageChain(): {
@@ -704,6 +832,7 @@ declare const useChain: (token: string) => {
704
832
 
705
833
  type UseWithdrawOptions = {
706
834
  srcChainId?: number;
835
+ decimals?: number;
707
836
  };
708
837
  declare const useWithdraw: (options?: UseWithdrawOptions) => {
709
838
  dst: {
@@ -726,7 +855,7 @@ declare const useWithdraw: (options?: UseWithdrawOptions) => {
726
855
  unsettledPnL: number;
727
856
  };
728
857
 
729
- type useDepositOptions = {
858
+ type DepositOptions = {
730
859
  address?: string;
731
860
  decimals?: number;
732
861
  networkId?: NetworkId;
@@ -734,7 +863,7 @@ type useDepositOptions = {
734
863
  srcToken?: string;
735
864
  quantity?: string;
736
865
  };
737
- declare const useDeposit: (options?: useDepositOptions) => {
866
+ declare const useDeposit: (options: DepositOptions) => {
738
867
  /** orderly support chain dst */
739
868
  dst: {
740
869
  symbol: string;
@@ -762,6 +891,23 @@ declare const useDeposit: (options?: useDepositOptions) => {
762
891
  setQuantity: react.Dispatch<react.SetStateAction<string>>;
763
892
  };
764
893
 
894
+ type Receiver = {
895
+ account_id: string;
896
+ amount: number;
897
+ };
898
+ type TransferOptions = {
899
+ fromAccountId?: string;
900
+ };
901
+ declare const useTransfer: (options?: TransferOptions) => {
902
+ submitting: boolean;
903
+ transfer: (token: string, receivers: Receiver | Receiver[]) => Promise<any>;
904
+ maxAmount: number;
905
+ unsettledPnL: number;
906
+ availableBalance: number;
907
+ availableTransfer: number;
908
+ holding: _orderly_network_types.API.Holding[] | undefined;
909
+ };
910
+
765
911
  declare const useHoldingStream: () => {
766
912
  data: API.Holding[] | undefined;
767
913
  usdc: API.Holding | undefined;
@@ -811,6 +957,7 @@ type ValuesDepConfig = {
811
957
  symbol: API.SymbolExt;
812
958
  maxQty: number;
813
959
  markPrice: number;
960
+ estSlippage?: number | null;
814
961
  };
815
962
  interface OrderCreator<T> {
816
963
  create: (values: T, configs: ValuesDepConfig) => T;
@@ -862,7 +1009,9 @@ ComputedAlgoOrder, {
862
1009
  /**
863
1010
  * Submit the TP/SL order
864
1011
  */
865
- submit: () => Promise<any>;
1012
+ submit: (params?: {
1013
+ accountId?: string;
1014
+ }) => Promise<any>;
866
1015
  deleteOrder: (orderId: number, symbol: string) => Promise<any>;
867
1016
  errors: ValidateError | null;
868
1017
  /**
@@ -886,6 +1035,21 @@ position: Partial<API.PositionTPSLExt> & Pick<API.PositionTPSLExt, "symbol" | "a
886
1035
  isEditing?: boolean;
887
1036
  }) => ReturnType<typeof useTaskProfitAndStopLossInternal>;
888
1037
 
1038
+ /**
1039
+ * A custom hook that calculates the maximum allowed leverage for a given trading pair symbol.
1040
+ *
1041
+ * The final leverage is determined by taking the minimum value between the account's maximum
1042
+ * leverage and the symbol's maximum leverage.
1043
+ *
1044
+ * @param symbol - Trading pair symbol (e.g. "PERP_BTC_USDC")
1045
+ * @returns The maximum allowed leverage as a number, or "-" if the leverage cannot be determined
1046
+ *
1047
+ * @example
1048
+ * ```typescript
1049
+ * const leverage = useSymbolLeverage("PERP_BTC_USDC");
1050
+ * console.log(`Maximum leverage for PERP_BTC_USDC: ${leverage}x`);
1051
+ * ```
1052
+ */
889
1053
  declare const useSymbolLeverage: (symbol: string) => number | "-";
890
1054
 
891
1055
  /**
@@ -972,6 +1136,19 @@ declare const useDistributionHistory: (parmas: DistributionSearchParams) => read
972
1136
  readonly isValidating: boolean;
973
1137
  }];
974
1138
 
1139
+ interface TransferHistorySearchParams {
1140
+ dataRange?: number[];
1141
+ page: number;
1142
+ size: number;
1143
+ fromId?: string;
1144
+ toId?: string;
1145
+ side: "IN" | "OUT";
1146
+ }
1147
+ declare const useTransferHistory: (parmas: TransferHistorySearchParams) => readonly [API.TransferHistoryRow[], {
1148
+ readonly meta: API.RecordsMeta | undefined;
1149
+ readonly isLoading: boolean;
1150
+ }];
1151
+
975
1152
  /** 0 for nothing, 2 for maintenance */
976
1153
  declare enum MaintenanceStatus {
977
1154
  None = 0,
@@ -1208,8 +1385,11 @@ data: DrawOptions, options?: {
1208
1385
 
1209
1386
  declare const DefaultLayoutConfig: PosterLayoutConfig;
1210
1387
 
1388
+ type FullOrderState$1 = OrderlyOrder;
1389
+
1211
1390
  declare const cleanStringStyle: (str: string | number) => string;
1212
1391
  declare function formatNumber(qty?: string | number, dp?: number | string): string | undefined;
1392
+ declare function calculate(values: Partial<FullOrderState$1>, fieldName: "symbol" | "order_type" | "order_type_ext" | "order_price" | "order_quantity" | "order_amount" | "visible_quantity" | "side" | "reduce_only" | "slippage" | "order_tag" | "level" | "post_only_adjust" | "total" | "algo_type" | "trigger_price_type" | "trigger_price" | "child_orders" | "tp_pnl" | "tp_offset" | "tp_offset_percentage" | "tp_ROI" | "tp_trigger_price" | "sl_pnl" | "sl_offset" | "sl_offset_percentage" | "sl_ROI" | "sl_trigger_price" | "quantity" | "price" | "type", value: any, markPrice: number, config: API.SymbolExt): Partial<FullOrderState$1>;
1213
1393
 
1214
1394
  /**
1215
1395
  * get the min notional for the order
@@ -1265,7 +1445,6 @@ declare function calcTPSL_ROI(inputs: {
1265
1445
  price: number | string;
1266
1446
  }): string;
1267
1447
 
1268
- type index_ValueOf<T> = ValueOf<T>;
1269
1448
  declare const index_calcTPSL_ROI: typeof calcTPSL_ROI;
1270
1449
  declare const index_cleanStringStyle: typeof cleanStringStyle;
1271
1450
  declare const index_findPositionTPSLFromOrders: typeof findPositionTPSLFromOrders;
@@ -1275,7 +1454,7 @@ declare const index_formatNumber: typeof formatNumber;
1275
1454
  declare const index_getPositionBySymbol: typeof getPositionBySymbol;
1276
1455
  declare const index_priceToPnl: typeof priceToPnl;
1277
1456
  declare namespace index {
1278
- export { type index_ValueOf as ValueOf, index_calcTPSL_ROI as calcTPSL_ROI, index_cleanStringStyle as cleanStringStyle, index_findPositionTPSLFromOrders as findPositionTPSLFromOrders, index_findTPSLFromOrder as findTPSLFromOrder, index_findTPSLFromOrders as findTPSLFromOrders, index_formatNumber as formatNumber, index_getPositionBySymbol as getPositionBySymbol, index_priceToPnl as priceToPnl };
1457
+ export { index_calcTPSL_ROI as calcTPSL_ROI, index_cleanStringStyle as cleanStringStyle, index_findPositionTPSLFromOrders as findPositionTPSLFromOrders, index_findTPSLFromOrder as findTPSLFromOrder, index_findTPSLFromOrders as findTPSLFromOrders, index_formatNumber as formatNumber, index_getPositionBySymbol as getPositionBySymbol, index_priceToPnl as priceToPnl };
1279
1458
  }
1280
1459
 
1281
1460
  declare const useCommission: (options?: {
@@ -1295,6 +1474,11 @@ declare namespace RefferalAPI {
1295
1474
  total_invites: number;
1296
1475
  total_traded: number;
1297
1476
  };
1477
+ type AutoGenerateCode = {
1478
+ code: string;
1479
+ requireVolume: number;
1480
+ completedVolume: number;
1481
+ };
1298
1482
  type Referrer = {
1299
1483
  total_invites: number;
1300
1484
  total_traded: number;
@@ -1569,6 +1753,20 @@ type WalletRewardsHistoryReturns = [
1569
1753
  ];
1570
1754
  declare const useWalletRewardsHistory: (type: TWType) => WalletRewardsHistoryReturns;
1571
1755
 
1756
+ declare enum EpochStatus {
1757
+ active = "Active",
1758
+ paused = "Paused",
1759
+ ended = "Ended"
1760
+ }
1761
+ type StatusInfo = {
1762
+ epochStatus: EpochStatus;
1763
+ currentEpoch: number | undefined;
1764
+ lastCompletedEpoch: number | undefined;
1765
+ };
1766
+ declare function useTradingRewardsStatus(isMMRewards: boolean): {
1767
+ statusInfo: StatusInfo | undefined;
1768
+ };
1769
+
1572
1770
  declare enum ENVType {
1573
1771
  prod = "prod",
1574
1772
  staging = "staging",
@@ -1683,6 +1881,7 @@ declare const useOrderEntryNextInternal: (symbol: string, options?: {
1683
1881
  readonly validate: (order: Partial<OrderlyOrder>, creator: OrderCreator<any>, options: {
1684
1882
  maxQty: number;
1685
1883
  markPrice: number;
1884
+ estSlippage?: number | null;
1686
1885
  }) => Promise<{
1687
1886
  [x: string]: OrderValidationItem | undefined;
1688
1887
  }>;
@@ -1690,7 +1889,7 @@ declare const useOrderEntryNextInternal: (symbol: string, options?: {
1690
1889
  };
1691
1890
 
1692
1891
  type OrderEntryParameters = Parameters<typeof useOrderEntryNextInternal>;
1693
- type Options = Omit<OrderEntryParameters["1"], "symbolInfo">;
1892
+ type Options$1 = Omit<OrderEntryParameters["1"], "symbolInfo">;
1694
1893
  type OrderEntryReturn = {
1695
1894
  submit: (options?: {
1696
1895
  resetOnSuccess?: boolean;
@@ -1712,6 +1911,7 @@ type OrderEntryReturn = {
1712
1911
  * The estimated leverage after order creation.
1713
1912
  */
1714
1913
  estLeverage: number | null;
1914
+ estSlippage: number | null;
1715
1915
  helper: {
1716
1916
  /**
1717
1917
  * @deprecated Use `validate` instead.
@@ -1798,7 +1998,7 @@ type OrderEntryReturn = {
1798
1998
  * await submit();
1799
1999
  * ```
1800
2000
  */
1801
- declare const useOrderEntry: (symbol: string, options?: Options) => OrderEntryReturn;
2001
+ declare const useOrderEntry: (symbol: string, options?: Options$1) => OrderEntryReturn;
1802
2002
 
1803
2003
  declare const useOrderEntity: (order: {
1804
2004
  symbol: string;
@@ -1811,9 +2011,7 @@ declare const useOrderEntity: (order: {
1811
2011
  validate: () => Promise<OrderValidationResult | null>;
1812
2012
  errors: Partial<Record<string | number, OrderValidationItem>> | undefined;
1813
2013
  markPrice: number;
1814
- symbolInfo: {
1815
- [x: string]: (key?: keyof _orderly_network_types.API.SymbolExt | undefined, defaultValue?: ValueOf<_orderly_network_types.API.SymbolExt> | undefined) => any;
1816
- } & {
2014
+ symbolInfo: Record<string, <Key extends keyof _orderly_network_types.API.SymbolExt>(key: Key, defaultValue?: _orderly_network_types.API.SymbolExt[Key] | undefined) => _orderly_network_types.API.SymbolExt[Key]> & Record<string, () => _orderly_network_types.API.SymbolExt> & {
1817
2015
  isNil: boolean;
1818
2016
  };
1819
2017
  };
@@ -1838,4 +2036,78 @@ declare const useRestrictedInfo: (options?: RestrictedInfoOptions) => {
1838
2036
  }) => ReactNode);
1839
2037
  };
1840
2038
 
1841
- export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, AssetHistoryStatusEnum, type Brokers, type Chain, type Chains, type CheckReferralCodeReturns, type CollateralOutputs, type ComputedAlgoOrder, type ConfigProviderProps, type ConnectedChain, type CurrentEpochEstimate, DefaultLayoutConfig, DistributionId, type DrawOptions, ENVType, type EpochInfoItem, type EpochInfoType, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, MaintenanceStatus, MarketsStorageKey, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderValidationItem, type OrderValidationResult, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, type PosterLayoutConfig, type PriceMode, type Recent, RefferalAPI, type RestrictedInfoOptions, type RestrictedInfoReturns, ScopeType, StatusContext, type StatusContextState, StatusProvider, type SymbolInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseOrderEntryMetaState, WalletConnectorContext, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, type chainFilter, type chainFilterFunc, checkNotional, cleanStringStyle, type filteredChains$1 as filteredChains, getMinNotional, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useConfig, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useInfiniteQuery, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, usePositionActions, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useTPSLOrder, useTickerStream, useTrack, useTrackingInstance, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
2039
+ type QueryOptions<T> = SWRConfiguration & {
2040
+ formatter?: (data: any) => T;
2041
+ accountId?: string;
2042
+ };
2043
+ declare function useSubAccountQuery<T>(query: Parameters<SWRHook>[0], options?: QueryOptions<T>): SWRResponse<T>;
2044
+
2045
+ type HTTP_METHOD = "POST" | "PUT" | "DELETE" | "GET";
2046
+ type SubAccountMutationOptions<T, E> = SWRMutationConfiguration<T, E> & {
2047
+ /** sub account id */
2048
+ accountId?: string;
2049
+ };
2050
+ /**
2051
+ * This hook is used to execute API requests for data mutation, such as POST, DELETE, PUT, etc.
2052
+ */
2053
+ declare const useSubAccountMutation: <T, E>(
2054
+ /**
2055
+ * The URL to send the request to. If the URL does not start with "http",
2056
+ * it will be prefixed with the API base URL.
2057
+ */
2058
+ url: string,
2059
+ /**
2060
+ * The HTTP method to use for the request. Defaults to "POST".
2061
+ */
2062
+ method?: HTTP_METHOD,
2063
+ /**
2064
+ * The configuration object for the mutation.
2065
+ * @see [useSWRMutation](https://swr.vercel.app/docs/mutation#api)
2066
+ *
2067
+ * @link https://swr.vercel.app/docs/mutation#api
2068
+ */
2069
+ options?: SubAccountMutationOptions<T, E>) => readonly [(data: Record<string, any> | null, params?: Record<string, any>, options?: SubAccountMutationOptions<T, E>) => Promise<any>, {
2070
+ readonly data: any;
2071
+ readonly error: any;
2072
+ readonly reset: () => void;
2073
+ readonly isMutating: boolean;
2074
+ }];
2075
+
2076
+ type Portfolio = {
2077
+ holding?: API.Holding[];
2078
+ totalCollateral: Decimal;
2079
+ freeCollateral: Decimal;
2080
+ totalValue: Decimal | null;
2081
+ availableBalance: number;
2082
+ unsettledPnL: number;
2083
+ totalUnrealizedROI: number;
2084
+ };
2085
+
2086
+ declare const useSubAccountDataObserver: (accountId?: string) => {
2087
+ portfolio: Portfolio | undefined;
2088
+ positions: API.PositionsTPSLExt;
2089
+ };
2090
+
2091
+ type Options = {
2092
+ accountId?: string;
2093
+ };
2094
+ declare const useSubAccountWS: (options: Options) => WS;
2095
+
2096
+ type PositionCloseOptions = {
2097
+ position: API.PositionExt;
2098
+ order: {
2099
+ type: OrderType;
2100
+ quantity: string;
2101
+ price: string;
2102
+ };
2103
+ };
2104
+ declare const usePositionClose: (options: PositionCloseOptions) => {
2105
+ submit: () => Promise<any>;
2106
+ isMutating: boolean;
2107
+ side: OrderSide;
2108
+ closeOrderData: Partial<OrderlyOrder>;
2109
+ errors: OrderValidationResult | null;
2110
+ calculate: typeof calculate;
2111
+ };
2112
+
2113
+ export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, AssetHistoryStatusEnum, type Brokers, type Chain, type Chains, type CheckReferralCodeReturns, type CollateralOutputs, type ComputedAlgoOrder, type ConfigProviderProps, type ConnectedChain, type CurrentEpochEstimate, DefaultLayoutConfig, DistributionId, type DrawOptions, ENVType, type EpochInfoItem, type EpochInfoType, EpochStatus, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, type FundingRates, MaintenanceStatus, type MarginRatioReturn, type MarketsItem, MarketsStorageKey, type MarketsStore, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderValidationItem, type OrderValidationResult, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, type PosterLayoutConfig, type PriceMode, type Recent, RefferalAPI, type RestrictedInfoOptions, type RestrictedInfoReturns, ScopeType, StatusContext, type StatusContextState, type StatusInfo, StatusProvider, type SymbolInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseOrderEntryMetaState, WalletConnectorContext, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, type chainFilter, type chainFilterFunc, checkNotional, cleanStringStyle, fetcher, type filteredChains$1 as filteredChains, getMinNotional, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useConfig, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, usePositionActions, usePositionClose, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountDataObserver, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTickerStream, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };