@orderly.network/hooks 2.10.2-alpha.0 → 2.11.0-alpha.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.mts +190 -59
- package/dist/index.d.ts +190 -59
- package/dist/index.js +1623 -926
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1618 -927
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
|
|
|
9
9
|
import * as react from 'react';
|
|
10
10
|
import { PropsWithChildren, FC, ReactNode } from 'react';
|
|
11
11
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
12
|
-
import { NetworkId, TrackerEventName, API, OrderlyOrder, ChainNamespace, WSMessage, OrderType, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, PositionType, AlgoOrderEntity, AssetHistoryStatusEnum,
|
|
12
|
+
import { NetworkId, TrackerEventName, API, OrderlyOrder, ChainNamespace, WSMessage, MarginMode, OrderType, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, PositionType, AlgoOrderEntity, AssetHistoryStatusEnum, RequireKeys, AlgoOrderType } from '@orderly.network/types';
|
|
13
13
|
import * as _orderly_network_core from '@orderly.network/core';
|
|
14
14
|
import { AccountState, Account, EventEmitter, ConfigStore, ConfigKey, SimpleDI, OrderlyKeyStore, WalletAdapter, IContract, DefaultConfigStore } from '@orderly.network/core';
|
|
15
15
|
export { SubAccount, WalletAdapter } from '@orderly.network/core';
|
|
@@ -37,7 +37,7 @@ declare global {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
declare const _default: "2.
|
|
40
|
+
declare const _default: "2.11.0-alpha.0";
|
|
41
41
|
|
|
42
42
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
43
43
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
@@ -1015,6 +1015,51 @@ declare const useLeverage: () => {
|
|
|
1015
1015
|
readonly maxLeverage: number;
|
|
1016
1016
|
};
|
|
1017
1017
|
|
|
1018
|
+
type SymbolLeverageMap = Record<string, number>;
|
|
1019
|
+
declare const useSymbolLeverageMap: () => {
|
|
1020
|
+
readonly leverages: SymbolLeverageMap;
|
|
1021
|
+
readonly getSymbolLeverage: (symbol?: string, marginMode?: MarginMode) => number | undefined;
|
|
1022
|
+
readonly isLoading: boolean;
|
|
1023
|
+
readonly error: any;
|
|
1024
|
+
readonly refresh: swr.KeyedMutator<API.LeverageInfo[]>;
|
|
1025
|
+
};
|
|
1026
|
+
|
|
1027
|
+
type SetMarginModePayload = {
|
|
1028
|
+
symbol_list: string[];
|
|
1029
|
+
default_margin_mode: MarginMode;
|
|
1030
|
+
};
|
|
1031
|
+
type SetMarginModeResult = {
|
|
1032
|
+
success: boolean;
|
|
1033
|
+
message?: string;
|
|
1034
|
+
};
|
|
1035
|
+
type MarginModesResponseItem = {
|
|
1036
|
+
symbol: string;
|
|
1037
|
+
default_margin_mode: MarginMode;
|
|
1038
|
+
};
|
|
1039
|
+
/**
|
|
1040
|
+
* A high-level hook to manage margin modes for all symbols.
|
|
1041
|
+
*
|
|
1042
|
+
* It encapsulates both:
|
|
1043
|
+
* - fetching current default margin modes for all symbols
|
|
1044
|
+
* - updating margin mode for one or multiple symbols
|
|
1045
|
+
*/
|
|
1046
|
+
declare const useMarginModes: () => {
|
|
1047
|
+
marginModes: Record<string, MarginMode>;
|
|
1048
|
+
isLoading: boolean;
|
|
1049
|
+
error: any;
|
|
1050
|
+
refresh: swr.KeyedMutator<MarginModesResponseItem[]>;
|
|
1051
|
+
setMarginMode: (payload: SetMarginModePayload) => Promise<SetMarginModeResult>;
|
|
1052
|
+
updateMarginMode: (payload: SetMarginModePayload) => Promise<SetMarginModeResult>;
|
|
1053
|
+
isMutating: boolean;
|
|
1054
|
+
};
|
|
1055
|
+
declare const useMarginModeBySymbol: (symbol: string, fallback?: MarginMode | null) => {
|
|
1056
|
+
marginMode: MarginMode;
|
|
1057
|
+
isLoading: boolean;
|
|
1058
|
+
error: any;
|
|
1059
|
+
refresh: swr.KeyedMutator<MarginModesResponseItem[]>;
|
|
1060
|
+
update: (mode: MarginMode) => Promise<SetMarginModeResult>;
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1018
1063
|
declare const useOdosQuote: () => readonly [(this: unknown, data: Record<string, any> | null, params?: Record<string, any> | undefined, options?: swr_mutation.SWRMutationConfiguration<unknown, unknown> | undefined) => Promise<any>, {
|
|
1019
1064
|
readonly data: any;
|
|
1020
1065
|
readonly error: unknown;
|
|
@@ -1050,7 +1095,7 @@ type FundingRates = ReturnType<typeof useFundingRates>;
|
|
|
1050
1095
|
declare const useFundingRates: () => Record<string, <Key extends keyof API.FundingRate>(key: Key, defaultValue?: API.FundingRate[Key] | undefined) => API.FundingRate[Key]> & Record<string, () => API.FundingRate> & {
|
|
1051
1096
|
isNil: boolean;
|
|
1052
1097
|
};
|
|
1053
|
-
declare const useFundingRatesStore: () => Record<string, API.FundingRate
|
|
1098
|
+
declare const useFundingRatesStore: () => Record<string, API.FundingRate>;
|
|
1054
1099
|
|
|
1055
1100
|
type PeriodKey = "1d" | "3d" | "7d" | "14d" | "30d" | "90d";
|
|
1056
1101
|
declare const useFundingRateHistory: () => {
|
|
@@ -1167,7 +1212,7 @@ declare const findTPSLOrderPriceFromOrder: (order: API.AlgoOrder) => {
|
|
|
1167
1212
|
tp_order_price: OrderType | number | undefined;
|
|
1168
1213
|
sl_order_price: OrderType | number | undefined;
|
|
1169
1214
|
};
|
|
1170
|
-
declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => {
|
|
1215
|
+
declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string, marginMode?: MarginMode) => {
|
|
1171
1216
|
fullPositionOrder?: API.AlgoOrder;
|
|
1172
1217
|
partialPositionOrders?: API.AlgoOrder[];
|
|
1173
1218
|
};
|
|
@@ -1223,7 +1268,11 @@ params: {
|
|
|
1223
1268
|
readonly cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise<any>;
|
|
1224
1269
|
readonly updateTPSLOrder: (orderId: number, childOrders: API.AlgoOrder["child_orders"]) => Promise<any>;
|
|
1225
1270
|
readonly cancelPostionOrdersByTypes: (symbol: string, types: AlgoOrderRootType[]) => Promise<any>;
|
|
1226
|
-
readonly meta:
|
|
1271
|
+
readonly meta: {
|
|
1272
|
+
total: number;
|
|
1273
|
+
current_page: number;
|
|
1274
|
+
records_per_page: number;
|
|
1275
|
+
} | undefined;
|
|
1227
1276
|
readonly errors: {
|
|
1228
1277
|
readonly cancelOrder: unknown;
|
|
1229
1278
|
readonly updateOrder: unknown;
|
|
@@ -1314,6 +1363,12 @@ type CollateralOutputs = {
|
|
|
1314
1363
|
* Calculated as: totalCollateral - margin requirements
|
|
1315
1364
|
*/
|
|
1316
1365
|
freeCollateral: number;
|
|
1366
|
+
/**
|
|
1367
|
+
* Free collateral that can be used for new positions (USDC only)
|
|
1368
|
+
*
|
|
1369
|
+
* Calculated as: freeCollateral - SUM(non-USDC holding.holding × mark_price × discount)
|
|
1370
|
+
*/
|
|
1371
|
+
freeCollateralUSDCOnly: number;
|
|
1317
1372
|
/**
|
|
1318
1373
|
* Total portfolio value including all positions and collateral
|
|
1319
1374
|
*
|
|
@@ -1344,6 +1399,10 @@ type CollateralOutputs = {
|
|
|
1344
1399
|
* Contains account configuration, limits and risk parameters
|
|
1345
1400
|
*/
|
|
1346
1401
|
accountInfo?: API.AccountInfo;
|
|
1402
|
+
/**
|
|
1403
|
+
* USDC holding in the account
|
|
1404
|
+
*/
|
|
1405
|
+
usdcHolding: number;
|
|
1347
1406
|
};
|
|
1348
1407
|
/**
|
|
1349
1408
|
* Hook to get and calculate collateral-related data for an account
|
|
@@ -1366,33 +1425,55 @@ declare const useCollateral: (options?: {
|
|
|
1366
1425
|
dp: number;
|
|
1367
1426
|
}) => CollateralOutputs;
|
|
1368
1427
|
|
|
1428
|
+
/**
|
|
1429
|
+
* Options for useMaxQty hook
|
|
1430
|
+
*/
|
|
1431
|
+
interface UseMaxQtyOptions {
|
|
1432
|
+
/**
|
|
1433
|
+
* Executes buy or sell orders which only reduce a current position.
|
|
1434
|
+
* If true, only allows orders that reduce current position
|
|
1435
|
+
* @default false
|
|
1436
|
+
*/
|
|
1437
|
+
reduceOnly?: boolean;
|
|
1438
|
+
/**
|
|
1439
|
+
* Margin mode ("CROSS" or "ISOLATED")
|
|
1440
|
+
* @default MarginMode.CROSS
|
|
1441
|
+
*/
|
|
1442
|
+
marginMode?: MarginMode;
|
|
1443
|
+
/**
|
|
1444
|
+
* Optional reference price for the **new order** when using isolated margin.
|
|
1445
|
+
*
|
|
1446
|
+
* If provided, this value will be used as `currentOrderReferencePrice`
|
|
1447
|
+
* in the isolated-margin max quantity formula instead of the mark price.
|
|
1448
|
+
* When omitted, the hook will fall back to `markPrice`.
|
|
1449
|
+
*/
|
|
1450
|
+
currentOrderReferencePrice?: number;
|
|
1451
|
+
}
|
|
1369
1452
|
/**
|
|
1370
1453
|
* A hook that calculates the maximum tradeable quantity for a given symbol and side
|
|
1371
1454
|
* @returns Maximum tradeable quantity
|
|
1372
1455
|
* @example
|
|
1373
1456
|
* ```tsx
|
|
1374
|
-
* // Get max buy quantity for BTC
|
|
1457
|
+
* // Get max buy quantity for BTC (backward compatible)
|
|
1375
1458
|
* const maxBuyQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY);
|
|
1376
1459
|
*
|
|
1377
|
-
* // Get max sell quantity with reduce only
|
|
1460
|
+
* // Get max sell quantity with reduce only (backward compatible)
|
|
1378
1461
|
* const maxSellQty = useMaxQty("PERP_BTC_USDC", OrderSide.SELL, true);
|
|
1462
|
+
*
|
|
1463
|
+
* // New object parameter style (recommended)
|
|
1464
|
+
* const maxQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY, {
|
|
1465
|
+
* reduceOnly: false,
|
|
1466
|
+
* marginMode: MarginMode.ISOLATED,
|
|
1467
|
+
* });
|
|
1468
|
+
*
|
|
1469
|
+
* // Only specify marginMode without reduceOnly
|
|
1470
|
+
* const maxQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY, {
|
|
1471
|
+
* marginMode: MarginMode.ISOLATED,
|
|
1472
|
+
* });
|
|
1379
1473
|
* ```
|
|
1380
1474
|
*/
|
|
1381
|
-
declare
|
|
1382
|
-
|
|
1383
|
-
* Trading pair symbol (e.g. "PERP_BTC_USDC")
|
|
1384
|
-
* */
|
|
1385
|
-
symbol: string,
|
|
1386
|
-
/**
|
|
1387
|
-
* Order side ("BUY" or "SELL")
|
|
1388
|
-
* */
|
|
1389
|
-
side: OrderSide,
|
|
1390
|
-
/**
|
|
1391
|
-
* Executes buy or sell orders which only reduce a current position.
|
|
1392
|
-
*
|
|
1393
|
-
* If true, only allows orders that reduce current position
|
|
1394
|
-
* */
|
|
1395
|
-
reduceOnly?: boolean) => number;
|
|
1475
|
+
declare function useMaxQty(symbol: string, side: OrderSide, reduceOnly?: boolean, marginMode?: MarginMode): number;
|
|
1476
|
+
declare function useMaxQty(symbol: string, side: OrderSide, options?: UseMaxQtyOptions): number;
|
|
1396
1477
|
|
|
1397
1478
|
/**
|
|
1398
1479
|
* The return type of useMarginRatio hook
|
|
@@ -1752,7 +1833,11 @@ declare const useMaxLeverage: (symbol: string) => number;
|
|
|
1752
1833
|
*/
|
|
1753
1834
|
declare const useSymbolLeverage: (symbol?: string) => {
|
|
1754
1835
|
maxLeverage: number;
|
|
1755
|
-
update: (
|
|
1836
|
+
update: (data: {
|
|
1837
|
+
leverage: number;
|
|
1838
|
+
symbol: string;
|
|
1839
|
+
margin_mode?: MarginMode;
|
|
1840
|
+
}) => Promise<any>;
|
|
1756
1841
|
isLoading: boolean;
|
|
1757
1842
|
};
|
|
1758
1843
|
|
|
@@ -1762,14 +1847,16 @@ declare const useSymbolLeverage: (symbol?: string) => {
|
|
|
1762
1847
|
* updates through a WebSocket subscription to keep the leverage value current.
|
|
1763
1848
|
*
|
|
1764
1849
|
* @param symbol - The trading symbol (e.g. "PERP_BTC_USDC")
|
|
1850
|
+
* @param marginMode - Optional margin mode (CROSS or ISOLATED). If not provided, defaults to CROSS.
|
|
1765
1851
|
* @returns The current leverage value associated with the symbol, or undefined if not available
|
|
1766
1852
|
*
|
|
1767
1853
|
* @example
|
|
1768
1854
|
* ```typescript
|
|
1769
1855
|
* const leverage = useLeverageBySymbol("PERP_BTC_USDC");
|
|
1856
|
+
* const isolatedLeverage = useLeverageBySymbol("PERP_BTC_USDC", MarginMode.ISOLATED);
|
|
1770
1857
|
* ```
|
|
1771
1858
|
*/
|
|
1772
|
-
declare const useLeverageBySymbol: (symbol?: string) => number | undefined;
|
|
1859
|
+
declare const useLeverageBySymbol: (symbol?: string, marginMode?: MarginMode) => number | undefined;
|
|
1773
1860
|
|
|
1774
1861
|
type AssetHistoryOptions = {
|
|
1775
1862
|
/** token name you want to search */
|
|
@@ -1918,6 +2005,7 @@ type PositionActions = {
|
|
|
1918
2005
|
clearAll: () => void;
|
|
1919
2006
|
closePosition: (symbol: string) => void;
|
|
1920
2007
|
};
|
|
2008
|
+
declare const usePositions: (symbol?: string) => API.PositionTPSLExt[] | null;
|
|
1921
2009
|
declare const usePositionActions: () => PositionActions;
|
|
1922
2010
|
|
|
1923
2011
|
declare const useStorageLedgerAddress: () => {
|
|
@@ -1944,10 +2032,12 @@ type Portfolio$1 = {
|
|
|
1944
2032
|
holding?: API.Holding[];
|
|
1945
2033
|
totalCollateral: Decimal;
|
|
1946
2034
|
freeCollateral: Decimal;
|
|
2035
|
+
freeCollateralUSDCOnly: Decimal;
|
|
1947
2036
|
totalValue: Decimal | null;
|
|
1948
2037
|
availableBalance: number;
|
|
1949
2038
|
unsettledPnL: number;
|
|
1950
2039
|
totalUnrealizedROI: number;
|
|
2040
|
+
usdcHolding: number;
|
|
1951
2041
|
};
|
|
1952
2042
|
type AppState = {
|
|
1953
2043
|
accountInfo?: API.AccountInfo;
|
|
@@ -2161,6 +2251,7 @@ type posterDataSource = {
|
|
|
2161
2251
|
position: {
|
|
2162
2252
|
symbol: string;
|
|
2163
2253
|
side: "LONG" | "SHORT";
|
|
2254
|
+
marginMode?: "isolated" | "cross";
|
|
2164
2255
|
/**
|
|
2165
2256
|
* The leverage of the position
|
|
2166
2257
|
*/
|
|
@@ -2299,7 +2390,42 @@ data: DrawOptions, options?: {
|
|
|
2299
2390
|
|
|
2300
2391
|
declare const DefaultLayoutConfig: PosterLayoutConfig;
|
|
2301
2392
|
|
|
2302
|
-
type FullOrderState
|
|
2393
|
+
type FullOrderState = OrderlyOrder;
|
|
2394
|
+
type OrderEntryStateEntity = RequireKeys<FullOrderState, "side" | "order_type" | "symbol">;
|
|
2395
|
+
type OrderEntryState = {
|
|
2396
|
+
entry: OrderEntryStateEntity;
|
|
2397
|
+
estLeverage: number | null;
|
|
2398
|
+
estLiquidationPrice: number | null;
|
|
2399
|
+
errors: Partial<Record<keyof FullOrderState, string>>;
|
|
2400
|
+
};
|
|
2401
|
+
type OrderEntryActions = {
|
|
2402
|
+
/** Initializes order state (e.g. when switching symbol). Resets computed values and errors. */
|
|
2403
|
+
initOrder: (symbol: string, options?: {
|
|
2404
|
+
side?: OrderSide;
|
|
2405
|
+
order_type?: OrderType;
|
|
2406
|
+
margin_mode?: MarginMode;
|
|
2407
|
+
}) => void;
|
|
2408
|
+
updateOrder: (order: Partial<FullOrderState>) => void;
|
|
2409
|
+
updateOrderByKey: <K extends keyof FullOrderState>(key: K, value: FullOrderState[K]) => void;
|
|
2410
|
+
restoreOrder: (order?: Partial<FullOrderState>) => void;
|
|
2411
|
+
updateOrderComputed: (data: {
|
|
2412
|
+
estLeverage: number | null;
|
|
2413
|
+
estLiquidationPrice: number | null;
|
|
2414
|
+
}) => void;
|
|
2415
|
+
resetOrder: (order?: Partial<FullOrderState>) => void;
|
|
2416
|
+
hasTP_SL: () => boolean;
|
|
2417
|
+
};
|
|
2418
|
+
declare const useOrderStore: zustand.UseBoundStore<Omit<zustand.StoreApi<OrderEntryState & {
|
|
2419
|
+
actions: OrderEntryActions;
|
|
2420
|
+
}>, "setState"> & {
|
|
2421
|
+
setState(nextStateOrUpdater: (OrderEntryState & {
|
|
2422
|
+
actions: OrderEntryActions;
|
|
2423
|
+
}) | Partial<OrderEntryState & {
|
|
2424
|
+
actions: OrderEntryActions;
|
|
2425
|
+
}> | ((state: immer.WritableDraft<OrderEntryState & {
|
|
2426
|
+
actions: OrderEntryActions;
|
|
2427
|
+
}>) => void), shouldReplace?: boolean | undefined): void;
|
|
2428
|
+
}>;
|
|
2303
2429
|
|
|
2304
2430
|
declare const cleanStringStyle: (str: string | number) => string;
|
|
2305
2431
|
/**
|
|
@@ -2307,7 +2433,7 @@ declare const cleanStringStyle: (str: string | number) => string;
|
|
|
2307
2433
|
* TODO: refactor this
|
|
2308
2434
|
*/
|
|
2309
2435
|
declare function formatNumber(qty?: string | number, dp?: number | string): string | undefined;
|
|
2310
|
-
declare function calculate(values: Partial<FullOrderState
|
|
2436
|
+
declare function calculate(values: Partial<FullOrderState>, fieldName: keyof FullOrderState, value: any, markPrice: number, config: API.SymbolExt): Partial<FullOrderState>;
|
|
2311
2437
|
|
|
2312
2438
|
/**
|
|
2313
2439
|
* get the min notional for the order
|
|
@@ -2630,37 +2756,6 @@ type IndexedDBPersistOptions<T, U = T> = Omit<PersistOptions<T, U>, "storage"> &
|
|
|
2630
2756
|
*/
|
|
2631
2757
|
declare const persistIndexedDB: <T, Mps extends [StoreMutatorIdentifier, unknown][] = [], Mcs extends [StoreMutatorIdentifier, unknown][] = [], U = T>(initializer: StateCreator<T, [...Mps, ["zustand/persist", unknown]], Mcs>, options: IndexedDBPersistOptions<T, U>) => StateCreator<T, Mps, [["zustand/persist", U], ...Mcs]>;
|
|
2632
2758
|
|
|
2633
|
-
type FullOrderState = OrderlyOrder;
|
|
2634
|
-
type OrderEntryStateEntity = RequireKeys<FullOrderState, "side" | "order_type" | "symbol">;
|
|
2635
|
-
type OrderEntryState = {
|
|
2636
|
-
entry: OrderEntryStateEntity;
|
|
2637
|
-
estLeverage: number | null;
|
|
2638
|
-
estLiquidationPrice: number | null;
|
|
2639
|
-
errors: Partial<Record<keyof FullOrderState, string>>;
|
|
2640
|
-
};
|
|
2641
|
-
type OrderEntryActions = {
|
|
2642
|
-
updateOrder: (order: Partial<FullOrderState>) => void;
|
|
2643
|
-
updateOrderByKey: <K extends keyof FullOrderState>(key: K, value: FullOrderState[K]) => void;
|
|
2644
|
-
restoreOrder: (order?: Partial<FullOrderState>) => void;
|
|
2645
|
-
updateOrderComputed: (data: {
|
|
2646
|
-
estLeverage: number | null;
|
|
2647
|
-
estLiquidationPrice: number | null;
|
|
2648
|
-
}) => void;
|
|
2649
|
-
resetOrder: (order?: Partial<FullOrderState>) => void;
|
|
2650
|
-
hasTP_SL: () => boolean;
|
|
2651
|
-
};
|
|
2652
|
-
declare const useOrderStore: zustand.UseBoundStore<Omit<zustand.StoreApi<OrderEntryState & {
|
|
2653
|
-
actions: OrderEntryActions;
|
|
2654
|
-
}>, "setState"> & {
|
|
2655
|
-
setState(nextStateOrUpdater: (OrderEntryState & {
|
|
2656
|
-
actions: OrderEntryActions;
|
|
2657
|
-
}) | Partial<OrderEntryState & {
|
|
2658
|
-
actions: OrderEntryActions;
|
|
2659
|
-
}> | ((state: immer.WritableDraft<OrderEntryState & {
|
|
2660
|
-
actions: OrderEntryActions;
|
|
2661
|
-
}>) => void), shouldReplace?: boolean | undefined): void;
|
|
2662
|
-
}>;
|
|
2663
|
-
|
|
2664
2759
|
declare const useOrderEntryNextInternal: (symbol: string, options?: {
|
|
2665
2760
|
/**
|
|
2666
2761
|
* initial order state, default is buy limit order
|
|
@@ -2900,6 +2995,7 @@ type Portfolio = {
|
|
|
2900
2995
|
holding?: API.Holding[];
|
|
2901
2996
|
totalCollateral: Decimal;
|
|
2902
2997
|
freeCollateral: Decimal;
|
|
2998
|
+
freeCollateralUSDCOnly: Decimal;
|
|
2903
2999
|
totalValue: Decimal | null;
|
|
2904
3000
|
availableBalance: number;
|
|
2905
3001
|
unsettledPnL: number;
|
|
@@ -2964,7 +3060,7 @@ declare const ERROR_MSG_CODES: {
|
|
|
2964
3060
|
SL_PRICE_ERROR: number;
|
|
2965
3061
|
};
|
|
2966
3062
|
|
|
2967
|
-
declare const useEstLiqPriceBySymbol: (symbol: string) => number | undefined;
|
|
3063
|
+
declare const useEstLiqPriceBySymbol: (symbol: string, marginMode: MarginMode) => number | undefined;
|
|
2968
3064
|
|
|
2969
3065
|
declare const useGetEstLiqPrice: (props: {
|
|
2970
3066
|
estLiqPrice: number | null;
|
|
@@ -2972,4 +3068,39 @@ declare const useGetEstLiqPrice: (props: {
|
|
|
2972
3068
|
side: OrderSide;
|
|
2973
3069
|
}) => number | null;
|
|
2974
3070
|
|
|
2975
|
-
|
|
3071
|
+
/**
|
|
3072
|
+
* Feature flag keys enum
|
|
3073
|
+
*/
|
|
3074
|
+
declare enum FlagKeys {
|
|
3075
|
+
IsolatedMargin = "isolated-margin"
|
|
3076
|
+
}
|
|
3077
|
+
|
|
3078
|
+
/**
|
|
3079
|
+
* Feature flag item from API response
|
|
3080
|
+
*/
|
|
3081
|
+
interface FeatureFlagItem {
|
|
3082
|
+
key: string;
|
|
3083
|
+
description: string;
|
|
3084
|
+
}
|
|
3085
|
+
/**
|
|
3086
|
+
* Return type for useFeatureFlag hook
|
|
3087
|
+
*/
|
|
3088
|
+
interface UseFeatureFlagReturn {
|
|
3089
|
+
enabled: boolean;
|
|
3090
|
+
data: FeatureFlagItem | undefined;
|
|
3091
|
+
}
|
|
3092
|
+
/**
|
|
3093
|
+
* Hook to check if a feature flag is enabled
|
|
3094
|
+
*
|
|
3095
|
+
* Logic:
|
|
3096
|
+
* 1. Hidden by default - returns false when loading
|
|
3097
|
+
* 2. In public but not in private, hidden - returns { enabled: false, data: undefined }
|
|
3098
|
+
* 3. In both public and private, shown - returns { enabled: true, data: FeatureFlagItem }
|
|
3099
|
+
* 4. Not in public, shown - returns { enabled: true, data: undefined }
|
|
3100
|
+
*
|
|
3101
|
+
* @param key - The feature flag key to check
|
|
3102
|
+
* @returns { enabled: boolean, data: FeatureFlagItem | undefined }
|
|
3103
|
+
*/
|
|
3104
|
+
declare const useFeatureFlag: (key: FlagKeys) => UseFeatureFlagReturn;
|
|
3105
|
+
|
|
3106
|
+
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, type Brokers, type Chain, type ChainFilter, type Chains, type CheckReferralCodeReturns, type CollateralOutputs, type ComputedAlgoOrder, type ConfigProviderProps, type ConnectedChain, type CurrentEpochEstimate, DefaultLayoutConfig, DistributionId, type DrawOptions, ENVType, ERROR_MSG_CODES, type EpochInfoItem, type EpochInfoType, EpochStatus, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, type FeatureFlagItem, type FilteredChains, FlagKeys, type FundingRates, MaintenanceStatus, type MarginRatioReturn, type MarketsItem, MarketsStorageKey, type MarketsStore, MarketsType, type NewListing, ORDERLY_ORDERBOOK_DEPTH_KEY, type OrderBookItem, type OrderEntryReturn, type OrderMetadata, type OrderMetadataConfig, 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, type RwaSymbolResult, type RwaSymbolsInfo, ScopeType, type StatusInfo, StatusProvider, type SymbolsInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseDepositReturn, type UseFeatureFlagReturn, type UseOrderEntryMetaState, WalletConnectorContext, type WalletConnectorContextState, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, checkNotional, cleanStringStyle, fetcher, findPositionTPSLFromOrders, findTPSLFromOrder, findTPSLOrderPriceFromOrder, getMinNotional, getPriceKey, indexedDBManager, initializeAppDatabase, isCurrentlyClosed, isCurrentlyTrading, noCacheConfig, parseJSON, persistIndexedDB, resetTimestampOffsetState, timestampWaitingMiddleware, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAppStore, useAssetsHistory, useAudioPlayer, useBalanceSubscription, useBalanceTopic, useBoolean, useChain, useChainInfo, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEstLiqPriceBySymbol, useEventEmitter, useFeatureFlag, useFeeState, useFundingDetails, useFundingFeeHistory, useFundingRate, useFundingRateBySymbol, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetEstLiqPrice, useGetReferralCode, useGetRwaSymbolCloseTimeInterval, useGetRwaSymbolInfo, useGetRwaSymbolOpenStatus, useGetRwaSymbolOpenTimeInterval, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useInitRwaSymbolsRuntime, useInternalTransfer, useKeyStore, useLazyQuery, useLeverage, useLeverageBySymbol, useLocalStorage, useMainTokenStore, useMainnetChainsStore, useMaintenanceStatus, useMarginModeBySymbol, useMarginModes, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketList, useMarketMap, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxLeverage, useMaxQty, useMaxWithdrawal, useMediaQuery, useMemoizedFn, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, useOrderlyContext, usePortfolio, usePositionActions, usePositionClose, usePositionStream, usePositions, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, type useQueryOptions, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useRwaSymbolsInfo, useRwaSymbolsInfoStore, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountAlgoOrderStream, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSwapSupportStore, useSymbolInfo, useSymbolLeverage, useSymbolLeverageMap, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTestTokenStore, useTestnetChainsStore, useTickerStream, useTokenInfo, useTokensInfo, useTpslPriceChecker, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useUpdatedRef, useUserStatistics, useVaultsHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWalletTopic, useWithdraw, useWsStatus, index as utils, _default as version };
|