@kodiak-finance/orderly-hooks 2.8.33 → 2.9.0-rc.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/index.d.mts CHANGED
@@ -7,9 +7,9 @@ import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
7
7
  import * as swr_infinite from 'swr/infinite';
8
8
  import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
9
9
  import * as react from 'react';
10
- import react__default, { PropsWithChildren, FC, ReactNode } from 'react';
10
+ import { PropsWithChildren, FC, ReactNode } from 'react';
11
11
  import * as _kodiak_finance_orderly_types from '@kodiak-finance/orderly-types';
12
- import { NetworkId, TrackerEventName, API, OrderlyOrder, ChainNamespace, WSMessage, OrderType, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, PositionType, AlgoOrderEntity, AssetHistoryStatusEnum, AlgoOrderType, RequireKeys } from '@kodiak-finance/orderly-types';
12
+ import { NetworkId, TrackerEventName, API, OrderlyOrder, ChainNamespace, WSMessage, MarginMode, OrderType, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, PositionType, AlgoOrderEntity, AssetHistoryStatusEnum, RequireKeys, AlgoOrderType } from '@kodiak-finance/orderly-types';
13
13
  import * as _kodiak_finance_orderly_core from '@kodiak-finance/orderly-core';
14
14
  import { AccountState, Account, EventEmitter, ConfigStore, ConfigKey, SimpleDI, OrderlyKeyStore, WalletAdapter, IContract, DefaultConfigStore } from '@kodiak-finance/orderly-core';
15
15
  export { SubAccount, WalletAdapter } from '@kodiak-finance/orderly-core';
@@ -22,12 +22,13 @@ import { WS } from '@kodiak-finance/orderly-net';
22
22
  import { EIP1193Provider } from '@web3-onboard/common';
23
23
  import { SolanaWalletProvider } from '@kodiak-finance/orderly-default-solana-adapter';
24
24
  import * as swr_subscription from 'swr/subscription';
25
+ import * as use_debounce from 'use-debounce';
26
+ export * from 'use-debounce';
25
27
  import * as immer from 'immer';
26
28
  import * as zustand from 'zustand';
27
29
  import { StoreMutatorIdentifier, StateCreator } from 'zustand';
28
30
  import * as zustand_middleware from 'zustand/middleware';
29
31
  import { PersistOptions } from 'zustand/middleware';
30
- export * from 'use-debounce';
31
32
 
32
33
  declare global {
33
34
  interface Window {
@@ -131,23 +132,17 @@ declare const useMemoizedFn: <T extends noop>(fn?: T) => PickFunction<T>;
131
132
 
132
133
  interface AudioPlayerOptions {
133
134
  volume?: number;
134
- loop?: boolean;
135
- autoPlay?: boolean;
135
+ /** When true, play() will run; when false, play() no-ops. Used for on/off toggle. */
136
+ enabled?: boolean;
136
137
  }
137
- declare const useAudioPlayer: (src: string, options?: AudioPlayerOptions) => readonly [react__default.DetailedReactHTMLElement<{
138
- controls: boolean;
139
- ref: react__default.MutableRefObject<HTMLAudioElement | null>;
140
- autoPlay: boolean | undefined;
141
- src: string;
142
- style: {
143
- display: "none";
144
- };
145
- onPlay: () => void;
146
- onPlaying: () => void;
147
- onPause: () => void;
148
- onEnded: () => void;
149
- onError: () => void;
150
- }, HTMLAudioElement>, react__default.MutableRefObject<HTMLAudioElement | null>, "error" | "paused" | "idle" | "play" | "playing" | "ended"];
138
+ /**
139
+ * Single shared Audio instance. Play is explicit: pause() then set src then play().
140
+ * Use for order-filled notification sound (and any other one-shot global sound).
141
+ * Compatible with legacy single-sound + on/off: pass enabled = user's on/off and src = media or "".
142
+ */
143
+ declare const useAudioPlayer: (src: string, options?: AudioPlayerOptions) => {
144
+ play: () => void;
145
+ };
151
146
 
152
147
  declare const useCommission: (options?: {
153
148
  size?: number;
@@ -165,6 +160,8 @@ declare namespace RefferalAPI {
165
160
  referrer_rebate_rate: number;
166
161
  total_invites: number;
167
162
  total_traded: number;
163
+ total_volume: number;
164
+ total_rebate: number;
168
165
  };
169
166
  type AutoGenerateCode = {
170
167
  code: string;
@@ -230,8 +227,15 @@ declare namespace RefferalAPI {
230
227
  };
231
228
  type ReferralRebateSummary = {
232
229
  daily_traded_referral: number;
230
+ direct_traded_referral: number;
231
+ indirect_traded_referral: number;
233
232
  referral_rebate: number;
233
+ direct_rebate: number;
234
+ indirect_rebate: number;
235
+ direct_bonus_rebate: number;
234
236
  volume: number;
237
+ direct_volume: number;
238
+ indirect_volume: number;
235
239
  fee: number;
236
240
  date: string;
237
241
  };
@@ -473,6 +477,102 @@ declare function useChains<T extends NetworkId | undefined, K extends UseChainsO
473
477
  UseChainsReturnObject
474
478
  ];
475
479
 
480
+ /**
481
+ * Check if currently trading based on next_open/next_close timestamps
482
+ * @param nextOpen - Next open time timestamp
483
+ * @param nextClose - Next close time timestamp
484
+ * @param currentTime - Current time timestamp
485
+ * @returns boolean - true if currently trading
486
+ */
487
+ declare const isCurrentlyTrading: (nextClose: number, status: "open" | "close", currentTime?: number) => boolean;
488
+ declare const isCurrentlyClosed: (nextOpen: number, status: "open" | "close", currentTime?: number) => boolean;
489
+ /**
490
+ * Type alias for the return type of useSymbolsInfo hook
491
+ */
492
+ type RwaSymbolsInfo = ReturnType<typeof useRwaSymbolsInfo>;
493
+ /**
494
+ * A hook that provides access to symbol information.
495
+ *
496
+ * @returns A getter object that provides access to symbol information.
497
+ * The getter allows accessing symbol data either by symbol name directly,
498
+ * or through a two-level access pattern (symbol and property).
499
+ *
500
+ * @example
501
+ * ```typescript
502
+ * const rwaSymbolsInfo = useRwaSymbolsInfo();
503
+ *
504
+ * // Get all info for a symbol
505
+ * const ethInfo = rwaSymbolsInfo["PERP_ETH_USDC"]();
506
+ * ```
507
+ */
508
+ declare const useRwaSymbolsInfo: () => Record<string, <Key extends keyof API.RwaSymbol>(key: Key, defaultValue?: API.RwaSymbol[Key] | undefined) => API.RwaSymbol[Key]> & Record<string, () => API.RwaSymbol> & {
509
+ isNil: boolean;
510
+ };
511
+ declare const useRwaSymbolsInfoStore: () => Record<string, API.RwaSymbol> | undefined;
512
+ /**
513
+ * Return type definition for the hook
514
+ *
515
+ * - isRwa: true if the symbol is an RWA symbol
516
+ * - open: true if the symbol is open for trading
517
+ * - nextOpen: the next open time in milliseconds
518
+ * - nextClose: the next close time in milliseconds
519
+ * - closeTimeInterval: the time interval in seconds until the symbol closes (countdown format)
520
+ * - openTimeInterval: the time interval in seconds until the symbol opens (countdown format)
521
+ */
522
+ interface RwaSymbolResult {
523
+ isRwa: boolean;
524
+ open?: boolean;
525
+ nextOpen?: number;
526
+ nextClose?: number;
527
+ closeTimeInterval?: number;
528
+ openTimeInterval?: number;
529
+ }
530
+ /**
531
+ * Hook to initialize and manage the global timer
532
+ * This hook should be called once at the top level of the application to start and manage the global timer
533
+ */
534
+ declare const useInitRwaSymbolsRuntime: () => void;
535
+ /**
536
+ * Hook to get current RWA symbol information with real-time updates
537
+ * Retrieves the state of a specific symbol from the centralized store
538
+ * @param symbol - The symbol to query
539
+ * @returns RwaSymbolResult containing RWA status and countdown information
540
+ */
541
+ declare const useGetRwaSymbolInfo: (symbol: string) => RwaSymbolResult;
542
+ /**
543
+ * Simplified hook to get RWA symbol open status with real-time updates
544
+ * @param symbol - The symbol to query
545
+ * @returns Object containing isRwa and open status
546
+ */
547
+ declare const useGetRwaSymbolOpenStatus: (symbol: string) => {
548
+ isRwa: boolean;
549
+ open?: boolean;
550
+ };
551
+ /**
552
+ * Hook to get RWA symbol close time interval with filtering
553
+ * @param symbol - The symbol to query
554
+ * @param thresholdMinutes - Time threshold in minutes, defaults to 30
555
+ * @returns Close time interval in seconds, or undefined if not within threshold
556
+ */
557
+ declare const useGetRwaSymbolCloseTimeInterval: (symbol: string, thresholdMinutes?: number) => {
558
+ isRwa: boolean;
559
+ open?: boolean;
560
+ closeTimeInterval?: number;
561
+ nextClose?: number;
562
+ };
563
+ /**
564
+ * Hook to get RWA symbol open time interval with filtering
565
+ * @param symbol - The symbol to query
566
+ * @param thresholdMinutes - Time threshold in minutes, defaults to 30
567
+ * @returns Open time interval in seconds, or undefined if not within threshold
568
+ */
569
+ declare const useGetRwaSymbolOpenTimeInterval: (symbol: string, thresholdMinutes?: number) => {
570
+ isRwa: boolean;
571
+ open?: boolean;
572
+ openTimeInterval?: number;
573
+ nextOpen?: number;
574
+ };
575
+
476
576
  type FilteredChains = {
477
577
  mainnet?: {
478
578
  id: number;
@@ -482,24 +582,15 @@ type FilteredChains = {
482
582
  }[];
483
583
  };
484
584
  interface OrderlyConfigContextState {
585
+ /** @deprecated will be removed in next minor version */
485
586
  fetcher?: (url: string, init: RequestInit) => Promise<any>;
486
587
  configStore: ConfigStore;
487
588
  keyStore: OrderlyKeyStore;
488
589
  walletAdapters: WalletAdapter[];
489
590
  networkId: NetworkId;
490
- /**
491
- * @hidden
492
- */
493
- onlyTestnet?: boolean;
494
591
  filteredChains?: FilteredChains;
592
+ /** custom chains, please include all chain information, otherwise there will be problems */
495
593
  customChains?: Chains<undefined, undefined>;
496
- chainTransformer?: (params: {
497
- chains: API.Chain[];
498
- tokenChains: API.Token[];
499
- chainInfos: any[];
500
- swapChains: any[];
501
- mainnet: boolean;
502
- }) => API.Chain[];
503
594
  /** enable swap deposit, default is false */
504
595
  enableSwapDeposit?: boolean;
505
596
  /**
@@ -510,11 +601,18 @@ interface OrderlyConfigContextState {
510
601
  * Custom orderbook default symbol depths.
511
602
  */
512
603
  defaultOrderbookSymbolDepths?: Record<PropertyKey, number[]>;
604
+ /** when use this, please keep the reference stable, otherwise it will cause unnecessary renders */
513
605
  dataAdapter?: {
606
+ /**
607
+ * custom useChains return list data
608
+ */
609
+ chainsList?: (chains: API.Chain[]) => API.Chain[];
514
610
  /**
515
611
  * Custom `/v1/public/futures` response data.
516
612
  */
517
- symbolList?: (originalVal: API.MarketInfoExt[]) => any[];
613
+ symbolList?: (data: API.MarketInfoExt[], context: {
614
+ rwaSymbolsInfo: RwaSymbolsInfo;
615
+ }) => any[];
518
616
  /**
519
617
  * custom `/v2/public/announcement` response data
520
618
  */
@@ -524,11 +622,16 @@ interface OrderlyConfigContextState {
524
622
  orderFilled?: {
525
623
  /**
526
624
  * Sound to play when an order is successful.
625
+ * If `soundOptions` is provided, this field is treated as the legacy
626
+ * single-sound configuration and only used when `soundOptions` is
627
+ * absent.
527
628
  * @default undefined
528
629
  */
529
630
  media?: string;
530
631
  /**
531
632
  * Whether to open the notification by default.
633
+ * For multi-sound mode this controls whether the initial selection
634
+ * should be sound-on or muted when there is no stored preference.
532
635
  * @default false
533
636
  */
534
637
  defaultOpen?: boolean;
@@ -537,6 +640,22 @@ interface OrderlyConfigContextState {
537
640
  * @default true
538
641
  */
539
642
  displayInOrderEntry?: boolean;
643
+ /**
644
+ * Multiple sound options for order filled notification.
645
+ * When provided, the UI should render a single-choice selector
646
+ * (e.g. radio group) instead of a simple on/off toggle. One of the
647
+ * options should represent the muted/off state.
648
+ */
649
+ soundOptions?: Array<{
650
+ label: string;
651
+ value: string;
652
+ media: string;
653
+ }>;
654
+ /**
655
+ * Default selected sound option value when there is no stored
656
+ * preference. If omitted, the first item in `soundOptions` is used.
657
+ */
658
+ defaultSoundValue?: string;
540
659
  };
541
660
  };
542
661
  amplitudeConfig?: {
@@ -569,6 +688,7 @@ type BaseConfigProviderProps = {
569
688
  keyStore?: OrderlyKeyStore;
570
689
  contracts?: IContract;
571
690
  walletAdapters?: WalletAdapter[];
691
+ /** filter chains, only show chains in the filter */
572
692
  chainFilter?: ChainFilter;
573
693
  /**
574
694
  * Custom orderbook default tick sizes.
@@ -578,7 +698,7 @@ type BaseConfigProviderProps = {
578
698
  * Custom orderbook default symbol depths.
579
699
  */
580
700
  orderbookDefaultSymbolDepths?: Record<PropertyKey, number[]>;
581
- } & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer" | "dataAdapter" | "notification" | "amplitudeConfig" | "orderMetadata">;
701
+ } & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "dataAdapter" | "notification" | "amplitudeConfig" | "orderMetadata">;
582
702
  type ExclusiveConfigProviderProps = {
583
703
  brokerId: string;
584
704
  brokerName?: string;
@@ -901,6 +1021,51 @@ declare const useLeverage: () => {
901
1021
  readonly maxLeverage: number;
902
1022
  };
903
1023
 
1024
+ type SymbolLeverageMap = Record<string, number>;
1025
+ declare const useSymbolLeverageMap: () => {
1026
+ readonly leverages: SymbolLeverageMap;
1027
+ readonly getSymbolLeverage: (symbol?: string, marginMode?: MarginMode) => number | undefined;
1028
+ readonly isLoading: boolean;
1029
+ readonly error: any;
1030
+ readonly refresh: swr.KeyedMutator<API.LeverageInfo[]>;
1031
+ };
1032
+
1033
+ type SetMarginModePayload = {
1034
+ symbol_list: string[];
1035
+ default_margin_mode: MarginMode;
1036
+ };
1037
+ type SetMarginModeResult = {
1038
+ success: boolean;
1039
+ message?: string;
1040
+ };
1041
+ type MarginModesResponseItem = {
1042
+ symbol: string;
1043
+ default_margin_mode: MarginMode;
1044
+ };
1045
+ /**
1046
+ * A high-level hook to manage margin modes for all symbols.
1047
+ *
1048
+ * It encapsulates both:
1049
+ * - fetching current default margin modes for all symbols
1050
+ * - updating margin mode for one or multiple symbols
1051
+ */
1052
+ declare const useMarginModes: () => {
1053
+ marginModes: Record<string, MarginMode>;
1054
+ isLoading: boolean;
1055
+ error: any;
1056
+ refresh: swr.KeyedMutator<MarginModesResponseItem[]>;
1057
+ setMarginMode: (payload: SetMarginModePayload) => Promise<SetMarginModeResult>;
1058
+ updateMarginMode: (payload: SetMarginModePayload) => Promise<SetMarginModeResult>;
1059
+ isMutating: boolean;
1060
+ };
1061
+ declare const useMarginModeBySymbol: (symbol: string, fallback?: MarginMode | null) => {
1062
+ marginMode: MarginMode;
1063
+ isLoading: boolean;
1064
+ error: any;
1065
+ refresh: swr.KeyedMutator<MarginModesResponseItem[]>;
1066
+ update: (mode: MarginMode) => Promise<SetMarginModeResult>;
1067
+ };
1068
+
904
1069
  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>, {
905
1070
  readonly data: any;
906
1071
  readonly error: unknown;
@@ -936,7 +1101,7 @@ type FundingRates = ReturnType<typeof useFundingRates>;
936
1101
  declare const useFundingRates: () => Record<string, <Key extends keyof API.FundingRate>(key: Key, defaultValue?: API.FundingRate[Key] | undefined) => API.FundingRate[Key]> & Record<string, () => API.FundingRate> & {
937
1102
  isNil: boolean;
938
1103
  };
939
- declare const useFundingRatesStore: () => Record<string, API.FundingRate> | undefined;
1104
+ declare const useFundingRatesStore: () => Record<string, API.FundingRate>;
940
1105
 
941
1106
  type PeriodKey = "1d" | "3d" | "7d" | "14d" | "30d" | "90d";
942
1107
  declare const useFundingRateHistory: () => {
@@ -1053,12 +1218,12 @@ declare const findTPSLOrderPriceFromOrder: (order: API.AlgoOrder) => {
1053
1218
  tp_order_price: OrderType | number | undefined;
1054
1219
  sl_order_price: OrderType | number | undefined;
1055
1220
  };
1056
- declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => {
1221
+ declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string, marginMode?: MarginMode) => {
1057
1222
  fullPositionOrder?: API.AlgoOrder;
1058
1223
  partialPositionOrders?: API.AlgoOrder[];
1059
1224
  };
1060
1225
 
1061
- type CombineOrderType = AlgoOrderRootType | "ALL";
1226
+ type CombineOrderType$1 = AlgoOrderRootType | "ALL";
1062
1227
  declare const useOrderStream: (
1063
1228
  /**
1064
1229
  * Orders query params
@@ -1074,12 +1239,12 @@ params: {
1074
1239
  * Include the order type
1075
1240
  * @default ["ALL"]
1076
1241
  */
1077
- includes?: CombineOrderType[];
1242
+ includes?: CombineOrderType$1[];
1078
1243
  /**
1079
1244
  * Exclude the order type
1080
1245
  * @default []
1081
1246
  */
1082
- excludes?: CombineOrderType[];
1247
+ excludes?: CombineOrderType$1[];
1083
1248
  dateRange?: {
1084
1249
  from?: Date;
1085
1250
  to?: Date;
@@ -1109,7 +1274,11 @@ params: {
1109
1274
  readonly cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise<any>;
1110
1275
  readonly updateTPSLOrder: (orderId: number, childOrders: API.AlgoOrder["child_orders"]) => Promise<any>;
1111
1276
  readonly cancelPostionOrdersByTypes: (symbol: string, types: AlgoOrderRootType[]) => Promise<any>;
1112
- readonly meta: any;
1277
+ readonly meta: {
1278
+ total: number;
1279
+ current_page: number;
1280
+ records_per_page: number;
1281
+ } | undefined;
1113
1282
  readonly errors: {
1114
1283
  readonly cancelOrder: unknown;
1115
1284
  readonly updateOrder: unknown;
@@ -1124,6 +1293,58 @@ params: {
1124
1293
  };
1125
1294
  }];
1126
1295
 
1296
+ type CombineOrderType = AlgoOrderRootType | "ALL";
1297
+ /**
1298
+ * TODO: let useOrderStream support pass accountId, it will be better to use this hook
1299
+ */
1300
+ declare const useSubAccountAlgoOrderStream: (
1301
+ /**
1302
+ * Orders query params
1303
+ */
1304
+ params: {
1305
+ symbol?: string;
1306
+ status?: OrderStatus;
1307
+ page?: number;
1308
+ size?: number;
1309
+ side?: OrderSide;
1310
+ /**
1311
+ * Include the order type
1312
+ * @default ["ALL"]
1313
+ */
1314
+ includes?: CombineOrderType[];
1315
+ /**
1316
+ * Exclude the order type
1317
+ * @default []
1318
+ */
1319
+ excludes?: CombineOrderType[];
1320
+ dateRange?: {
1321
+ from?: Date;
1322
+ to?: Date;
1323
+ };
1324
+ }, options: {
1325
+ accountId: string;
1326
+ }) => readonly [any, {
1327
+ readonly isLoading: boolean;
1328
+ readonly refresh: use_debounce.DebouncedState<() => void>;
1329
+ readonly cancelAllOrders: () => Promise<[any, any]>;
1330
+ readonly cancelAllPendingOrders: (symbol?: string) => void;
1331
+ readonly cancelAllTPSLOrders: (symbol?: string) => Promise<any[]>;
1332
+ readonly cancelAlgoOrdersByTypes: (types: AlgoOrderRootType[], symbol?: string) => Promise<any[]>;
1333
+ readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
1334
+ readonly cancelOrder: (orderId: number, symbol?: string) => Promise<any>;
1335
+ readonly updateAlgoOrder: (orderId: string, order: OrderEntity) => Promise<any>;
1336
+ readonly cancelAlgoOrder: (orderId: number, symbol?: string) => Promise<any>;
1337
+ readonly cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise<any>;
1338
+ readonly updateTPSLOrder: (orderId: number, childOrders: API.AlgoOrder["child_orders"]) => Promise<any>;
1339
+ readonly cancelPostionOrdersByTypes: (symbol: string, types: AlgoOrderRootType[]) => Promise<any>;
1340
+ readonly submitting: {
1341
+ readonly cancelOrder: boolean;
1342
+ readonly updateOrder: boolean;
1343
+ readonly cancelAlgoOrder: boolean;
1344
+ readonly updateAlglOrder: boolean;
1345
+ };
1346
+ }];
1347
+
1127
1348
  interface MarketTradeStreamOptions {
1128
1349
  limit?: number;
1129
1350
  }
@@ -1148,6 +1369,12 @@ type CollateralOutputs = {
1148
1369
  * Calculated as: totalCollateral - margin requirements
1149
1370
  */
1150
1371
  freeCollateral: number;
1372
+ /**
1373
+ * Free collateral that can be used for new positions (USDC only)
1374
+ *
1375
+ * Calculated as: freeCollateral - SUM(non-USDC holding.holding × mark_price × discount)
1376
+ */
1377
+ freeCollateralUSDCOnly: number;
1151
1378
  /**
1152
1379
  * Total portfolio value including all positions and collateral
1153
1380
  *
@@ -1178,6 +1405,10 @@ type CollateralOutputs = {
1178
1405
  * Contains account configuration, limits and risk parameters
1179
1406
  */
1180
1407
  accountInfo?: API.AccountInfo;
1408
+ /**
1409
+ * USDC holding in the account
1410
+ */
1411
+ usdcHolding: number;
1181
1412
  };
1182
1413
  /**
1183
1414
  * Hook to get and calculate collateral-related data for an account
@@ -1200,33 +1431,55 @@ declare const useCollateral: (options?: {
1200
1431
  dp: number;
1201
1432
  }) => CollateralOutputs;
1202
1433
 
1434
+ /**
1435
+ * Options for useMaxQty hook
1436
+ */
1437
+ interface UseMaxQtyOptions {
1438
+ /**
1439
+ * Executes buy or sell orders which only reduce a current position.
1440
+ * If true, only allows orders that reduce current position
1441
+ * @default false
1442
+ */
1443
+ reduceOnly?: boolean;
1444
+ /**
1445
+ * Margin mode ("CROSS" or "ISOLATED")
1446
+ * @default MarginMode.CROSS
1447
+ */
1448
+ marginMode?: MarginMode;
1449
+ /**
1450
+ * Optional reference price for the **new order** when using isolated margin.
1451
+ *
1452
+ * If provided, this value will be used as `currentOrderReferencePrice`
1453
+ * in the isolated-margin max quantity formula instead of the mark price.
1454
+ * When omitted, the hook will fall back to `markPrice`.
1455
+ */
1456
+ currentOrderReferencePrice?: number;
1457
+ }
1203
1458
  /**
1204
1459
  * A hook that calculates the maximum tradeable quantity for a given symbol and side
1205
1460
  * @returns Maximum tradeable quantity
1206
1461
  * @example
1207
1462
  * ```tsx
1208
- * // Get max buy quantity for BTC
1463
+ * // Get max buy quantity for BTC (backward compatible)
1209
1464
  * const maxBuyQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY);
1210
1465
  *
1211
- * // Get max sell quantity with reduce only
1466
+ * // Get max sell quantity with reduce only (backward compatible)
1212
1467
  * const maxSellQty = useMaxQty("PERP_BTC_USDC", OrderSide.SELL, true);
1468
+ *
1469
+ * // New object parameter style (recommended)
1470
+ * const maxQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY, {
1471
+ * reduceOnly: false,
1472
+ * marginMode: MarginMode.ISOLATED,
1473
+ * });
1474
+ *
1475
+ * // Only specify marginMode without reduceOnly
1476
+ * const maxQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY, {
1477
+ * marginMode: MarginMode.ISOLATED,
1478
+ * });
1213
1479
  * ```
1214
1480
  */
1215
- declare const useMaxQty: (
1216
- /**
1217
- * Trading pair symbol (e.g. "PERP_BTC_USDC")
1218
- * */
1219
- symbol: string,
1220
- /**
1221
- * Order side ("BUY" or "SELL")
1222
- * */
1223
- side: OrderSide,
1224
- /**
1225
- * Executes buy or sell orders which only reduce a current position.
1226
- *
1227
- * If true, only allows orders that reduce current position
1228
- * */
1229
- reduceOnly?: boolean) => number;
1481
+ declare function useMaxQty(symbol: string, side: OrderSide, reduceOnly?: boolean, marginMode?: MarginMode): number;
1482
+ declare function useMaxQty(symbol: string, side: OrderSide, options?: UseMaxQtyOptions): number;
1230
1483
 
1231
1484
  /**
1232
1485
  * The return type of useMarginRatio hook
@@ -1292,6 +1545,7 @@ declare const useWithdraw: (options: UseWithdrawOptions) => {
1292
1545
  token: string;
1293
1546
  amount: string;
1294
1547
  allowCrossChainWithdraw: boolean;
1548
+ receiver?: string;
1295
1549
  }) => Promise<any>;
1296
1550
  maxAmount: number;
1297
1551
  unsettledPnL: number;
@@ -1308,39 +1562,38 @@ type DepositOptions = {
1308
1562
  srcToken?: string;
1309
1563
  /** output token */
1310
1564
  dstToken?: string;
1311
- swapEnable?: boolean;
1565
+ /** cross chain route address */
1312
1566
  crossChainRouteAddress?: string;
1567
+ /** swap deposit vault address */
1313
1568
  depositorAddress?: string;
1314
- /** @deprecated unused, will be removed in the future */
1315
- networkId?: NetworkId;
1316
1569
  };
1570
+ type DST = {
1571
+ symbol: string;
1572
+ address: string;
1573
+ decimals: number;
1574
+ chainId: number;
1575
+ network: string;
1576
+ };
1577
+ type UseDepositReturn = ReturnType<typeof useDeposit>;
1317
1578
  declare const useDeposit: (options: DepositOptions) => {
1318
- /** orderly support chain dst */
1319
- dst: {
1320
- symbol: string;
1321
- address: string | undefined;
1322
- decimals: number | undefined;
1323
- chainId: number;
1324
- network: string;
1325
- };
1326
- balance: string;
1579
+ balance: string | null;
1327
1580
  allowance: string;
1328
- isNativeToken: boolean;
1581
+ /** deposit fee, unit: wei */
1582
+ depositFee: bigint;
1329
1583
  balanceRevalidating: boolean;
1330
1584
  allowanceRevalidating: boolean;
1585
+ depositFeeRevalidating: boolean;
1586
+ isNativeToken: boolean;
1587
+ dst: DST;
1588
+ targetChain: API.Chain;
1331
1589
  /** input quantiy */
1332
1590
  quantity: string;
1333
- /** orderly deposit fee, unit: wei */
1334
- depositFee: bigint;
1335
- /** enquiring depositFee status on chain */
1336
- depositFeeRevalidating: boolean;
1591
+ /** set input quantity */
1592
+ setQuantity: react.Dispatch<react.SetStateAction<string>>;
1337
1593
  approve: (amount?: string) => Promise<void | undefined>;
1338
1594
  deposit: () => Promise<any>;
1339
- fetchBalance: (address: string, decimals?: number, token?: string) => Promise<string>;
1595
+ fetchBalance: (address: string, decimals?: number) => Promise<string>;
1340
1596
  fetchBalances: (tokens: API.TokenInfo[]) => Promise<Record<string, string>>;
1341
- /** set input quantity */
1342
- setQuantity: react.Dispatch<react.SetStateAction<string>>;
1343
- targetChain: API.Chain;
1344
1597
  };
1345
1598
 
1346
1599
  interface ConvertOptions {
@@ -1586,7 +1839,11 @@ declare const useMaxLeverage: (symbol: string) => number;
1586
1839
  */
1587
1840
  declare const useSymbolLeverage: (symbol?: string) => {
1588
1841
  maxLeverage: number;
1589
- update: (this: unknown, data: Record<string, any> | null, params?: Record<string, any> | undefined, options?: swr_mutation.SWRMutationConfiguration<unknown, unknown> | undefined) => Promise<any>;
1842
+ update: (data: {
1843
+ leverage: number;
1844
+ symbol: string;
1845
+ margin_mode?: MarginMode;
1846
+ }) => Promise<any>;
1590
1847
  isLoading: boolean;
1591
1848
  };
1592
1849
 
@@ -1596,14 +1853,16 @@ declare const useSymbolLeverage: (symbol?: string) => {
1596
1853
  * updates through a WebSocket subscription to keep the leverage value current.
1597
1854
  *
1598
1855
  * @param symbol - The trading symbol (e.g. "PERP_BTC_USDC")
1856
+ * @param marginMode - Optional margin mode (CROSS or ISOLATED). If not provided, defaults to CROSS.
1599
1857
  * @returns The current leverage value associated with the symbol, or undefined if not available
1600
1858
  *
1601
1859
  * @example
1602
1860
  * ```typescript
1603
1861
  * const leverage = useLeverageBySymbol("PERP_BTC_USDC");
1862
+ * const isolatedLeverage = useLeverageBySymbol("PERP_BTC_USDC", MarginMode.ISOLATED);
1604
1863
  * ```
1605
1864
  */
1606
- declare const useLeverageBySymbol: (symbol?: string) => number | undefined;
1865
+ declare const useLeverageBySymbol: (symbol?: string, marginMode?: MarginMode) => number | undefined;
1607
1866
 
1608
1867
  type AssetHistoryOptions = {
1609
1868
  /** token name you want to search */
@@ -1654,6 +1913,13 @@ declare const useStatisticsDaily: (params: QueryParams, options?: {
1654
1913
  };
1655
1914
  }];
1656
1915
 
1916
+ type UserStatistics = {
1917
+ perp_trading_volume_last_24_hours?: number;
1918
+ };
1919
+ declare const useUserStatistics: () => readonly [UserStatistics | null, {
1920
+ readonly isValidating: boolean;
1921
+ }];
1922
+
1657
1923
  type FundingSearchParams = {
1658
1924
  /**
1659
1925
  * Data range for the funding fee history
@@ -1745,6 +2011,7 @@ type PositionActions = {
1745
2011
  clearAll: () => void;
1746
2012
  closePosition: (symbol: string) => void;
1747
2013
  };
2014
+ declare const usePositions: (symbol?: string) => API.PositionTPSLExt[] | null;
1748
2015
  declare const usePositionActions: () => PositionActions;
1749
2016
 
1750
2017
  declare const useStorageLedgerAddress: () => {
@@ -1761,102 +2028,6 @@ declare const useTokensInfo: () => _kodiak_finance_orderly_types.API.Token[] | u
1761
2028
  */
1762
2029
  declare const useTokenInfo: (token: string) => _kodiak_finance_orderly_types.API.Token | undefined;
1763
2030
 
1764
- /**
1765
- * Check if currently trading based on next_open/next_close timestamps
1766
- * @param nextOpen - Next open time timestamp
1767
- * @param nextClose - Next close time timestamp
1768
- * @param currentTime - Current time timestamp
1769
- * @returns boolean - true if currently trading
1770
- */
1771
- declare const isCurrentlyTrading: (nextClose: number, status: "open" | "close", currentTime?: number) => boolean;
1772
- declare const isCurrentlyClosed: (nextOpen: number, status: "open" | "close", currentTime?: number) => boolean;
1773
- /**
1774
- * Type alias for the return type of useSymbolsInfo hook
1775
- */
1776
- type RwaSymbolsInfo = ReturnType<typeof useRwaSymbolsInfo>;
1777
- /**
1778
- * A hook that provides access to symbol information.
1779
- *
1780
- * @returns A getter object that provides access to symbol information.
1781
- * The getter allows accessing symbol data either by symbol name directly,
1782
- * or through a two-level access pattern (symbol and property).
1783
- *
1784
- * @example
1785
- * ```typescript
1786
- * const rwaSymbolsInfo = useRwaSymbolsInfo();
1787
- *
1788
- * // Get all info for a symbol
1789
- * const ethInfo = rwaSymbolsInfo["PERP_ETH_USDC"]();
1790
- * ```
1791
- */
1792
- declare const useRwaSymbolsInfo: () => Record<string, <Key extends keyof API.RwaSymbol>(key: Key, defaultValue?: API.RwaSymbol[Key] | undefined) => API.RwaSymbol[Key]> & Record<string, () => API.RwaSymbol> & {
1793
- isNil: boolean;
1794
- };
1795
- declare const useRwaSymbolsInfoStore: () => Record<string, API.RwaSymbol> | undefined;
1796
- /**
1797
- * Return type definition for the hook
1798
- *
1799
- * - isRwa: true if the symbol is an RWA symbol
1800
- * - open: true if the symbol is open for trading
1801
- * - nextOpen: the next open time in milliseconds
1802
- * - nextClose: the next close time in milliseconds
1803
- * - closeTimeInterval: the time interval in seconds until the symbol closes (countdown format)
1804
- * - openTimeInterval: the time interval in seconds until the symbol opens (countdown format)
1805
- */
1806
- interface RwaSymbolResult {
1807
- isRwa: boolean;
1808
- open?: boolean;
1809
- nextOpen?: number;
1810
- nextClose?: number;
1811
- closeTimeInterval?: number;
1812
- openTimeInterval?: number;
1813
- }
1814
- /**
1815
- * Hook to initialize and manage the global timer
1816
- * This hook should be called once at the top level of the application to start and manage the global timer
1817
- */
1818
- declare const useInitRwaSymbolsRuntime: () => void;
1819
- /**
1820
- * Hook to get current RWA symbol information with real-time updates
1821
- * Retrieves the state of a specific symbol from the centralized store
1822
- * @param symbol - The symbol to query
1823
- * @returns RwaSymbolResult containing RWA status and countdown information
1824
- */
1825
- declare const useGetRwaSymbolInfo: (symbol: string) => RwaSymbolResult;
1826
- /**
1827
- * Simplified hook to get RWA symbol open status with real-time updates
1828
- * @param symbol - The symbol to query
1829
- * @returns Object containing isRwa and open status
1830
- */
1831
- declare const useGetRwaSymbolOpenStatus: (symbol: string) => {
1832
- isRwa: boolean;
1833
- open?: boolean;
1834
- };
1835
- /**
1836
- * Hook to get RWA symbol close time interval with filtering
1837
- * @param symbol - The symbol to query
1838
- * @param thresholdMinutes - Time threshold in minutes, defaults to 30
1839
- * @returns Close time interval in seconds, or undefined if not within threshold
1840
- */
1841
- declare const useGetRwaSymbolCloseTimeInterval: (symbol: string, thresholdMinutes?: number) => {
1842
- isRwa: boolean;
1843
- open?: boolean;
1844
- closeTimeInterval?: number;
1845
- nextClose?: number;
1846
- };
1847
- /**
1848
- * Hook to get RWA symbol open time interval with filtering
1849
- * @param symbol - The symbol to query
1850
- * @param thresholdMinutes - Time threshold in minutes, defaults to 30
1851
- * @returns Open time interval in seconds, or undefined if not within threshold
1852
- */
1853
- declare const useGetRwaSymbolOpenTimeInterval: (symbol: string, thresholdMinutes?: number) => {
1854
- isRwa: boolean;
1855
- open?: boolean;
1856
- openTimeInterval?: number;
1857
- nextOpen?: number;
1858
- };
1859
-
1860
2031
  type AppStatus = {
1861
2032
  positionsLoading: boolean;
1862
2033
  ordersLoading: boolean;
@@ -1867,10 +2038,12 @@ type Portfolio$1 = {
1867
2038
  holding?: API.Holding[];
1868
2039
  totalCollateral: Decimal;
1869
2040
  freeCollateral: Decimal;
2041
+ freeCollateralUSDCOnly: Decimal;
1870
2042
  totalValue: Decimal | null;
1871
2043
  availableBalance: number;
1872
2044
  unsettledPnL: number;
1873
2045
  totalUnrealizedROI: number;
2046
+ usdcHolding: number;
1874
2047
  };
1875
2048
  type AppState = {
1876
2049
  accountInfo?: API.AccountInfo;
@@ -1937,6 +2110,7 @@ interface DataStoreActions<T> {
1937
2110
  fetchData: (baseUrl?: string, options?: {
1938
2111
  brokerId?: string;
1939
2112
  }) => Promise<T[]>;
2113
+ setHydrated: (hydrated: boolean) => void;
1940
2114
  }
1941
2115
 
1942
2116
  declare const useMainnetChainsStore: zustand.UseBoundStore<Omit<zustand.StoreApi<DataStoreState<API.Chain> & DataStoreActions<API.Chain>>, "persist"> & {
@@ -2052,8 +2226,8 @@ type OrderParams = Required<Pick<OrderEntity, "side" | "order_type" | "symbol">>
2052
2226
  * Create Order
2053
2227
  * @example
2054
2228
  * ```tsx
2055
- * import { useOrderEntry } from "@kodiak-finance/orderly-hooks";
2056
- * import {OrderSide, OrderType} from '@kodiak-finance/orderly-types';
2229
+ * import { useOrderEntry } from "@orderly.network/hooks";
2230
+ * import {OrderSide, OrderType} from '@orderly.network/types';
2057
2231
  *
2058
2232
  * const { formattedOrder, onSubmit, helper } = useOrderEntry({
2059
2233
  * symbol: "PERP_ETH_USDC",
@@ -2083,6 +2257,7 @@ type posterDataSource = {
2083
2257
  position: {
2084
2258
  symbol: string;
2085
2259
  side: "LONG" | "SHORT";
2260
+ marginMode?: "isolated" | "cross";
2086
2261
  /**
2087
2262
  * The leverage of the position
2088
2263
  */
@@ -2221,7 +2396,42 @@ data: DrawOptions, options?: {
2221
2396
 
2222
2397
  declare const DefaultLayoutConfig: PosterLayoutConfig;
2223
2398
 
2224
- type FullOrderState$1 = OrderlyOrder;
2399
+ type FullOrderState = OrderlyOrder;
2400
+ type OrderEntryStateEntity = RequireKeys<FullOrderState, "side" | "order_type" | "symbol">;
2401
+ type OrderEntryState = {
2402
+ entry: OrderEntryStateEntity;
2403
+ estLeverage: number | null;
2404
+ estLiquidationPrice: number | null;
2405
+ errors: Partial<Record<keyof FullOrderState, string>>;
2406
+ };
2407
+ type OrderEntryActions = {
2408
+ /** Initializes order state (e.g. when switching symbol). Resets computed values and errors. */
2409
+ initOrder: (symbol: string, options?: {
2410
+ side?: OrderSide;
2411
+ order_type?: OrderType;
2412
+ margin_mode?: MarginMode;
2413
+ }) => void;
2414
+ updateOrder: (order: Partial<FullOrderState>) => void;
2415
+ updateOrderByKey: <K extends keyof FullOrderState>(key: K, value: FullOrderState[K]) => void;
2416
+ restoreOrder: (order?: Partial<FullOrderState>) => void;
2417
+ updateOrderComputed: (data: {
2418
+ estLeverage: number | null;
2419
+ estLiquidationPrice: number | null;
2420
+ }) => void;
2421
+ resetOrder: (order?: Partial<FullOrderState>) => void;
2422
+ hasTP_SL: () => boolean;
2423
+ };
2424
+ declare const useOrderStore: zustand.UseBoundStore<Omit<zustand.StoreApi<OrderEntryState & {
2425
+ actions: OrderEntryActions;
2426
+ }>, "setState"> & {
2427
+ setState(nextStateOrUpdater: (OrderEntryState & {
2428
+ actions: OrderEntryActions;
2429
+ }) | Partial<OrderEntryState & {
2430
+ actions: OrderEntryActions;
2431
+ }> | ((state: immer.WritableDraft<OrderEntryState & {
2432
+ actions: OrderEntryActions;
2433
+ }>) => void), shouldReplace?: boolean | undefined): void;
2434
+ }>;
2225
2435
 
2226
2436
  declare const cleanStringStyle: (str: string | number) => string;
2227
2437
  /**
@@ -2229,7 +2439,7 @@ declare const cleanStringStyle: (str: string | number) => string;
2229
2439
  * TODO: refactor this
2230
2440
  */
2231
2441
  declare function formatNumber(qty?: string | number, dp?: number | string): string | undefined;
2232
- declare function calculate(values: Partial<FullOrderState$1>, fieldName: keyof FullOrderState$1, value: any, markPrice: number, config: API.SymbolExt): Partial<FullOrderState$1>;
2442
+ declare function calculate(values: Partial<FullOrderState>, fieldName: keyof FullOrderState, value: any, markPrice: number, config: API.SymbolExt): Partial<FullOrderState>;
2233
2443
 
2234
2444
  /**
2235
2445
  * get the min notional for the order
@@ -2552,37 +2762,6 @@ type IndexedDBPersistOptions<T, U = T> = Omit<PersistOptions<T, U>, "storage"> &
2552
2762
  */
2553
2763
  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]>;
2554
2764
 
2555
- type FullOrderState = OrderlyOrder;
2556
- type OrderEntryStateEntity = RequireKeys<FullOrderState, "side" | "order_type" | "symbol">;
2557
- type OrderEntryState = {
2558
- entry: OrderEntryStateEntity;
2559
- estLeverage: number | null;
2560
- estLiquidationPrice: number | null;
2561
- errors: Partial<Record<keyof FullOrderState, string>>;
2562
- };
2563
- type OrderEntryActions = {
2564
- updateOrder: (order: Partial<FullOrderState>) => void;
2565
- updateOrderByKey: <K extends keyof FullOrderState>(key: K, value: FullOrderState[K]) => void;
2566
- restoreOrder: (order?: Partial<FullOrderState>) => void;
2567
- updateOrderComputed: (data: {
2568
- estLeverage: number | null;
2569
- estLiquidationPrice: number | null;
2570
- }) => void;
2571
- resetOrder: (order?: Partial<FullOrderState>) => void;
2572
- hasTP_SL: () => boolean;
2573
- };
2574
- declare const useOrderStore: zustand.UseBoundStore<Omit<zustand.StoreApi<OrderEntryState & {
2575
- actions: OrderEntryActions;
2576
- }>, "setState"> & {
2577
- setState(nextStateOrUpdater: (OrderEntryState & {
2578
- actions: OrderEntryActions;
2579
- }) | Partial<OrderEntryState & {
2580
- actions: OrderEntryActions;
2581
- }> | ((state: immer.WritableDraft<OrderEntryState & {
2582
- actions: OrderEntryActions;
2583
- }>) => void), shouldReplace?: boolean | undefined): void;
2584
- }>;
2585
-
2586
2765
  declare const useOrderEntryNextInternal: (symbol: string, options?: {
2587
2766
  /**
2588
2767
  * initial order state, default is buy limit order
@@ -2822,6 +3001,7 @@ type Portfolio = {
2822
3001
  holding?: API.Holding[];
2823
3002
  totalCollateral: Decimal;
2824
3003
  freeCollateral: Decimal;
3004
+ freeCollateralUSDCOnly: Decimal;
2825
3005
  totalValue: Decimal | null;
2826
3006
  availableBalance: number;
2827
3007
  unsettledPnL: number;
@@ -2886,7 +3066,7 @@ declare const ERROR_MSG_CODES: {
2886
3066
  SL_PRICE_ERROR: number;
2887
3067
  };
2888
3068
 
2889
- declare const useEstLiqPriceBySymbol: (symbol: string) => number | undefined;
3069
+ declare const useEstLiqPriceBySymbol: (symbol: string, marginMode: MarginMode) => number | undefined;
2890
3070
 
2891
3071
  declare const useGetEstLiqPrice: (props: {
2892
3072
  estLiqPrice: number | null;
@@ -2894,4 +3074,39 @@ declare const useGetEstLiqPrice: (props: {
2894
3074
  side: OrderSide;
2895
3075
  }) => number | null;
2896
3076
 
2897
- 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 FilteredChains, 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 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, 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, 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, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, type useQueryOptions, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useRwaSymbolsInfo, useRwaSymbolsInfoStore, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSwapSupportStore, useSymbolInfo, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTestTokenStore, useTestnetChainsStore, useTickerStream, useTokenInfo, useTokensInfo, useTpslPriceChecker, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useUpdatedRef, useVaultsHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWalletTopic, useWithdraw, useWsStatus, index as utils, _default as version };
3077
+ /**
3078
+ * Feature flag keys enum
3079
+ */
3080
+ declare enum FlagKeys {
3081
+ IsolatedMargin = "isolated-margin"
3082
+ }
3083
+
3084
+ /**
3085
+ * Feature flag item from API response
3086
+ */
3087
+ interface FeatureFlagItem {
3088
+ key: string;
3089
+ description: string;
3090
+ }
3091
+ /**
3092
+ * Return type for useFeatureFlag hook
3093
+ */
3094
+ interface UseFeatureFlagReturn {
3095
+ enabled: boolean;
3096
+ data: FeatureFlagItem | undefined;
3097
+ }
3098
+ /**
3099
+ * Hook to check if a feature flag is enabled
3100
+ *
3101
+ * Logic:
3102
+ * 1. Hidden by default - returns false when loading
3103
+ * 2. In public but not in private, hidden - returns { enabled: false, data: undefined }
3104
+ * 3. In both public and private, shown - returns { enabled: true, data: FeatureFlagItem }
3105
+ * 4. Not in public, shown - returns { enabled: true, data: undefined }
3106
+ *
3107
+ * @param key - The feature flag key to check
3108
+ * @returns { enabled: boolean, data: FeatureFlagItem | undefined }
3109
+ */
3110
+ declare const useFeatureFlag: (key: FlagKeys) => UseFeatureFlagReturn;
3111
+
3112
+ 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 };