@kodiak-finance/orderly-hooks 2.9.0 → 2.9.1-alpha.1
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 +202 -109
- package/dist/index.d.ts +202 -109
- package/dist/index.js +615 -191
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +611 -192
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
3
|
+
import * as _kodiak_finance_orderly_types from '@kodiak-finance/orderly-types';
|
|
4
|
+
import { API, NetworkId, TrackerEventName, OrderlyOrder, ChainNamespace, WSMessage, MarginMode, OrderType, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, PositionType, AlgoOrderEntity, AssetHistoryStatusEnum, RequireKeys, AlgoOrderType } from '@kodiak-finance/orderly-types';
|
|
1
5
|
import * as swr from 'swr';
|
|
2
6
|
import { SWRConfiguration, SWRHook, SWRResponse, Middleware } from 'swr';
|
|
3
7
|
export { swr };
|
|
@@ -6,10 +10,6 @@ import * as swr_mutation from 'swr/mutation';
|
|
|
6
10
|
import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
|
|
7
11
|
import * as swr_infinite from 'swr/infinite';
|
|
8
12
|
import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
|
|
9
|
-
import * as react from 'react';
|
|
10
|
-
import { PropsWithChildren, FC, ReactNode } from 'react';
|
|
11
|
-
import * as _kodiak_finance_orderly_types 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';
|
|
@@ -30,6 +30,139 @@ import { StoreMutatorIdentifier, StateCreator } from 'zustand';
|
|
|
30
30
|
import * as zustand_middleware from 'zustand/middleware';
|
|
31
31
|
import { PersistOptions } from 'zustand/middleware';
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Check if currently trading based on next_open/next_close timestamps
|
|
35
|
+
* @param nextOpen - Next open time timestamp
|
|
36
|
+
* @param nextClose - Next close time timestamp
|
|
37
|
+
* @param currentTime - Current time timestamp
|
|
38
|
+
* @returns boolean - true if currently trading
|
|
39
|
+
*/
|
|
40
|
+
declare const isCurrentlyTrading: (nextClose: number, status: "open" | "close", currentTime?: number) => boolean;
|
|
41
|
+
declare const isCurrentlyClosed: (nextOpen: number, status: "open" | "close", currentTime?: number) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Type alias for the return type of useSymbolsInfo hook
|
|
44
|
+
*/
|
|
45
|
+
type RwaSymbolsInfo = ReturnType<typeof useRwaSymbolsInfo>;
|
|
46
|
+
/**
|
|
47
|
+
* A hook that provides access to symbol information.
|
|
48
|
+
*
|
|
49
|
+
* @returns A getter object that provides access to symbol information.
|
|
50
|
+
* The getter allows accessing symbol data either by symbol name directly,
|
|
51
|
+
* or through a two-level access pattern (symbol and property).
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const rwaSymbolsInfo = useRwaSymbolsInfo();
|
|
56
|
+
*
|
|
57
|
+
* // Get all info for a symbol
|
|
58
|
+
* const ethInfo = rwaSymbolsInfo["PERP_ETH_USDC"]();
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare const useRwaSymbolsInfo: () => Record<string, <Key extends keyof API.RwaSymbol>(key: Key, defaultValue?: API.RwaSymbol[Key] | undefined) => API.RwaSymbol[Key]> & Record<string, () => API.RwaSymbol> & {
|
|
62
|
+
isNil: boolean;
|
|
63
|
+
};
|
|
64
|
+
declare const useRwaSymbolsInfoStore: () => Record<string, API.RwaSymbol> | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Return type definition for the hook
|
|
67
|
+
*
|
|
68
|
+
* - isRwa: true if the symbol is an RWA symbol
|
|
69
|
+
* - open: true if the symbol is open for trading
|
|
70
|
+
* - nextOpen: the next open time in milliseconds
|
|
71
|
+
* - nextClose: the next close time in milliseconds
|
|
72
|
+
* - closeTimeInterval: the time interval in seconds until the symbol closes (countdown format)
|
|
73
|
+
* - openTimeInterval: the time interval in seconds until the symbol opens (countdown format)
|
|
74
|
+
*/
|
|
75
|
+
interface RwaSymbolResult {
|
|
76
|
+
isRwa: boolean;
|
|
77
|
+
open?: boolean;
|
|
78
|
+
nextOpen?: number;
|
|
79
|
+
nextClose?: number;
|
|
80
|
+
closeTimeInterval?: number;
|
|
81
|
+
openTimeInterval?: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Hook to initialize and manage the global timer
|
|
85
|
+
* This hook should be called once at the top level of the application to start and manage the global timer
|
|
86
|
+
*/
|
|
87
|
+
declare const useInitRwaSymbolsRuntime: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* Hook to get current RWA symbol information with real-time updates
|
|
90
|
+
* Retrieves the state of a specific symbol from the centralized store
|
|
91
|
+
* @param symbol - The symbol to query
|
|
92
|
+
* @returns RwaSymbolResult containing RWA status and countdown information
|
|
93
|
+
*/
|
|
94
|
+
declare const useGetRwaSymbolInfo: (symbol: string) => RwaSymbolResult;
|
|
95
|
+
/**
|
|
96
|
+
* Simplified hook to get RWA symbol open status with real-time updates
|
|
97
|
+
* @param symbol - The symbol to query
|
|
98
|
+
* @returns Object containing isRwa and open status
|
|
99
|
+
*/
|
|
100
|
+
declare const useGetRwaSymbolOpenStatus: (symbol: string) => {
|
|
101
|
+
isRwa: boolean;
|
|
102
|
+
open?: boolean;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Hook to get RWA symbol close time interval with filtering
|
|
106
|
+
* @param symbol - The symbol to query
|
|
107
|
+
* @param thresholdMinutes - Time threshold in minutes, defaults to 30
|
|
108
|
+
* @returns Close time interval in seconds, or undefined if not within threshold
|
|
109
|
+
*/
|
|
110
|
+
declare const useGetRwaSymbolCloseTimeInterval: (symbol: string, thresholdMinutes?: number) => {
|
|
111
|
+
isRwa: boolean;
|
|
112
|
+
open?: boolean;
|
|
113
|
+
closeTimeInterval?: number;
|
|
114
|
+
nextClose?: number;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Hook to get RWA symbol open time interval with filtering
|
|
118
|
+
* @param symbol - The symbol to query
|
|
119
|
+
* @param thresholdMinutes - Time threshold in minutes, defaults to 30
|
|
120
|
+
* @returns Open time interval in seconds, or undefined if not within threshold
|
|
121
|
+
*/
|
|
122
|
+
declare const useGetRwaSymbolOpenTimeInterval: (symbol: string, thresholdMinutes?: number) => {
|
|
123
|
+
isRwa: boolean;
|
|
124
|
+
open?: boolean;
|
|
125
|
+
openTimeInterval?: number;
|
|
126
|
+
nextOpen?: number;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
type MarketCategoryComponentKey = "marketsSheet" | "expandMarkets" | "dropDownMarkets" | "subMenuMarkets" | "marketsDataList" | "horizontalMarkets";
|
|
130
|
+
type MarketBuiltInTabType = "favorites" | "community" | "all" | "rwa" | "newListing" | "recent";
|
|
131
|
+
type MarketTabBase = {
|
|
132
|
+
name?: string;
|
|
133
|
+
icon?: ReactNode | string;
|
|
134
|
+
suffix?: ReactNode | string;
|
|
135
|
+
isVisible?: (symbolList: API.MarketInfoExt[], ctx: {
|
|
136
|
+
rwaSymbolsInfo?: RwaSymbolsInfo;
|
|
137
|
+
}) => boolean;
|
|
138
|
+
};
|
|
139
|
+
type BuiltInMarketTab = MarketTabBase & {
|
|
140
|
+
type: MarketBuiltInTabType;
|
|
141
|
+
};
|
|
142
|
+
type CustomMarketTab = MarketTabBase & {
|
|
143
|
+
id: string;
|
|
144
|
+
name: string;
|
|
145
|
+
match: (market: API.MarketInfoExt) => boolean;
|
|
146
|
+
};
|
|
147
|
+
type MarketTabConfig = BuiltInMarketTab | CustomMarketTab;
|
|
148
|
+
interface MarketCategoryContext {
|
|
149
|
+
componentKey: MarketCategoryComponentKey;
|
|
150
|
+
builtIn: Record<MarketBuiltInTabType, BuiltInMarketTab>;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Function-only config for market tabs.
|
|
154
|
+
*
|
|
155
|
+
* @param original - Default built-in tabs for the current component (as MarketTabConfig[])
|
|
156
|
+
* @param context - { componentKey, builtIn } for referencing built-in tab definitions
|
|
157
|
+
* @returns Final tab sequence to render
|
|
158
|
+
*/
|
|
159
|
+
type MarketCategoryConfig = (original: MarketTabConfig[], context: MarketCategoryContext) => MarketTabConfig[];
|
|
160
|
+
type MarketCategoriesConfigProviderProps = {
|
|
161
|
+
value?: MarketCategoryConfig;
|
|
162
|
+
};
|
|
163
|
+
declare const MarketCategoriesConfigProvider: FC<PropsWithChildren<MarketCategoriesConfigProviderProps>>;
|
|
164
|
+
declare function useMarketCategoriesConfig(): MarketCategoryConfig | undefined;
|
|
165
|
+
|
|
33
166
|
declare global {
|
|
34
167
|
interface Window {
|
|
35
168
|
__ORDERLY_VERSION__?: {
|
|
@@ -330,12 +463,11 @@ declare const useRefereeRebateSummary: (params: Params) => {
|
|
|
330
463
|
isLoading: boolean;
|
|
331
464
|
};
|
|
332
465
|
|
|
333
|
-
|
|
334
|
-
isExist
|
|
466
|
+
declare const useCheckReferralCode: (code?: string) => {
|
|
467
|
+
isExist: boolean | undefined;
|
|
335
468
|
error: any;
|
|
336
469
|
isLoading: boolean;
|
|
337
470
|
};
|
|
338
|
-
declare const useCheckReferralCode: (code?: string) => CheckReferralCodeReturns;
|
|
339
471
|
|
|
340
472
|
declare const useGetReferralCode: (accountId?: string) => {
|
|
341
473
|
referral_code?: string;
|
|
@@ -477,102 +609,6 @@ declare function useChains<T extends NetworkId | undefined, K extends UseChainsO
|
|
|
477
609
|
UseChainsReturnObject
|
|
478
610
|
];
|
|
479
611
|
|
|
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
|
-
|
|
576
612
|
type FilteredChains = {
|
|
577
613
|
mainnet?: {
|
|
578
614
|
id: number;
|
|
@@ -837,7 +873,8 @@ declare enum MarketsType$1 {
|
|
|
837
873
|
FAVORITES = 0,
|
|
838
874
|
RECENT = 1,
|
|
839
875
|
ALL = 2,
|
|
840
|
-
NEW_LISTING = 3
|
|
876
|
+
NEW_LISTING = 3,
|
|
877
|
+
COMMUNITY = 4
|
|
841
878
|
}
|
|
842
879
|
interface FavoriteTab$1 {
|
|
843
880
|
name: string;
|
|
@@ -882,7 +919,8 @@ declare enum MarketsType {
|
|
|
882
919
|
RECENT = 1,
|
|
883
920
|
ALL = 2,
|
|
884
921
|
RWA = 3,
|
|
885
|
-
NEW_LISTING = 4
|
|
922
|
+
NEW_LISTING = 4,
|
|
923
|
+
COMMUNITY = 5
|
|
886
924
|
}
|
|
887
925
|
interface FavoriteTab {
|
|
888
926
|
name: string;
|
|
@@ -905,6 +943,10 @@ type TabSort = Record<string, {
|
|
|
905
943
|
type MarketsItem = {
|
|
906
944
|
symbol: string;
|
|
907
945
|
displayName?: string;
|
|
946
|
+
/** Permissionless listing: display name without broker_id suffix */
|
|
947
|
+
display_symbol_name?: string;
|
|
948
|
+
/** Permissionless listing: broker id; null for non-community-listed symbols */
|
|
949
|
+
broker_id?: string | null;
|
|
908
950
|
index_price: number;
|
|
909
951
|
mark_price: number;
|
|
910
952
|
sum_unitary_funding: number;
|
|
@@ -1064,6 +1106,7 @@ declare const useMarginModeBySymbol: (symbol: string, fallback?: MarginMode | nu
|
|
|
1064
1106
|
error: any;
|
|
1065
1107
|
refresh: swr.KeyedMutator<MarginModesResponseItem[]>;
|
|
1066
1108
|
update: (mode: MarginMode) => Promise<SetMarginModeResult>;
|
|
1109
|
+
isPermissionlessListing: boolean;
|
|
1067
1110
|
};
|
|
1068
1111
|
|
|
1069
1112
|
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>, {
|
|
@@ -1200,7 +1243,7 @@ declare const usePositionStream: (symbol?: string, options?: SWRConfiguration &
|
|
|
1200
1243
|
readonly totalCollateral: _kodiak_finance_orderly_utils.Decimal;
|
|
1201
1244
|
readonly totalValue: _kodiak_finance_orderly_utils.Decimal | null;
|
|
1202
1245
|
readonly totalUnrealizedROI: number;
|
|
1203
|
-
}, 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]> & {
|
|
1246
|
+
}, 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" | "total_unsettled_cross_pnl" | "total_unsettled_isolated_pnl", <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" | "total_unsettled_cross_pnl" | "total_unsettled_isolated_pnl">(defaultValue?: Omit<API.PositionInfo, "rows">[Key] | undefined) => Omit<API.PositionInfo, "rows">[Key]> & {
|
|
1204
1247
|
isNil: boolean;
|
|
1205
1248
|
}, {
|
|
1206
1249
|
/**
|
|
@@ -1915,6 +1958,7 @@ declare const useStatisticsDaily: (params: QueryParams, options?: {
|
|
|
1915
1958
|
|
|
1916
1959
|
type UserStatistics = {
|
|
1917
1960
|
perp_trading_volume_last_24_hours?: number;
|
|
1961
|
+
perp_trading_volume_today?: number;
|
|
1918
1962
|
};
|
|
1919
1963
|
declare const useUserStatistics: () => readonly [UserStatistics | null, {
|
|
1920
1964
|
readonly isValidating: boolean;
|
|
@@ -2249,6 +2293,41 @@ declare function useOrderEntry$1(symbol: string, side: OrderSide, reduceOnly: bo
|
|
|
2249
2293
|
|
|
2250
2294
|
declare function useMediaQuery(query: string): boolean;
|
|
2251
2295
|
|
|
2296
|
+
interface UseBadgeBySymbolReturn {
|
|
2297
|
+
/** Display name of the symbol. API.display_symbol_name */
|
|
2298
|
+
displayName: string;
|
|
2299
|
+
/** Broker ID of the symbol. */
|
|
2300
|
+
brokerId: string | undefined;
|
|
2301
|
+
/** Badge label: first segment of raw name, truncated to 7 chars with "...". */
|
|
2302
|
+
brokerName: string | undefined;
|
|
2303
|
+
/** Raw broker name as provided by the API. */
|
|
2304
|
+
brokerNameRaw: string | undefined;
|
|
2305
|
+
}
|
|
2306
|
+
/**
|
|
2307
|
+
* Match the given `symbol` in `symbolsInfo` and return `displayName`, `brokerId`,
|
|
2308
|
+
* and the mapped `brokerName`.
|
|
2309
|
+
*
|
|
2310
|
+
* `brokerName` comes from the `/v1/public/broker/name` broker list
|
|
2311
|
+
* (SWR shared cache).
|
|
2312
|
+
*/
|
|
2313
|
+
declare const useBadgeBySymbol: (symbol: string) => UseBadgeBySymbolReturn;
|
|
2314
|
+
/**
|
|
2315
|
+
* Same rules as {@link useSymbolWithBroker}, for use in callbacks / non-React code paths.
|
|
2316
|
+
*/
|
|
2317
|
+
declare function formatSymbolWithBroker(symbol: string, symbolsInfo: {
|
|
2318
|
+
isNil?: boolean;
|
|
2319
|
+
[key: string]: unknown;
|
|
2320
|
+
}, brokers: Record<string, string> | undefined): string;
|
|
2321
|
+
/**
|
|
2322
|
+
* Short market label: `base`, or `base-{brokerNameBase}` when the symbol is broker-scoped and a broker
|
|
2323
|
+
* name is available from symbols info + broker list.
|
|
2324
|
+
*
|
|
2325
|
+
* Symbol shape: `type_base_quote` with optional trailing `_broker_id` segments (broker_id may
|
|
2326
|
+
* contain underscores, e.g. `orderly`). Otherwise falls back to a leading letter run for legacy
|
|
2327
|
+
* compact symbols.
|
|
2328
|
+
*/
|
|
2329
|
+
declare const useSymbolWithBroker: (symbol: string) => string;
|
|
2330
|
+
|
|
2252
2331
|
type posterDataSource = {
|
|
2253
2332
|
/**
|
|
2254
2333
|
* slogan of the poster
|
|
@@ -2256,8 +2335,9 @@ type posterDataSource = {
|
|
|
2256
2335
|
message?: string;
|
|
2257
2336
|
position: {
|
|
2258
2337
|
symbol: string;
|
|
2338
|
+
brokerName?: string;
|
|
2259
2339
|
side: "LONG" | "SHORT";
|
|
2260
|
-
marginMode?:
|
|
2340
|
+
marginMode?: MarginMode;
|
|
2261
2341
|
/**
|
|
2262
2342
|
* The leverage of the position
|
|
2263
2343
|
*/
|
|
@@ -2771,13 +2851,14 @@ declare const useOrderEntryNextInternal: (symbol: string, options?: {
|
|
|
2771
2851
|
symbolInfo?: API.SymbolExt;
|
|
2772
2852
|
symbolLeverage?: number;
|
|
2773
2853
|
}) => {
|
|
2774
|
-
readonly formattedOrder:
|
|
2854
|
+
readonly formattedOrder: OrderlyOrder;
|
|
2775
2855
|
readonly setValue: (key: keyof FullOrderState, value: any, additional?: {
|
|
2776
2856
|
markPrice: number;
|
|
2777
2857
|
}) => Partial<OrderlyOrder> | undefined;
|
|
2778
2858
|
readonly setValues: (values: Partial<FullOrderState>, additional?: {
|
|
2779
2859
|
markPrice: number;
|
|
2780
2860
|
}) => Partial<OrderlyOrder> | undefined;
|
|
2861
|
+
readonly setValuesRaw: (values: Partial<FullOrderState>) => Partial<OrderlyOrder> | undefined;
|
|
2781
2862
|
readonly submit: () => void;
|
|
2782
2863
|
readonly reset: (order?: Partial<OrderlyOrder>) => void;
|
|
2783
2864
|
readonly generateOrder: (creator: OrderCreator<any>, options: {
|
|
@@ -2851,6 +2932,12 @@ type OrderEntryReturn = {
|
|
|
2851
2932
|
shouldUpdateLastChangedField?: boolean;
|
|
2852
2933
|
}) => void;
|
|
2853
2934
|
setValues: (values: Partial<FullOrderState>) => void;
|
|
2935
|
+
/**
|
|
2936
|
+
* Raw merge setter for externally computed bundles (e.g. Advanced TPSL).
|
|
2937
|
+
*
|
|
2938
|
+
* Unlike `setValues`, this intentionally skips `calculate()` to avoid overwriting computed TPSL fields.
|
|
2939
|
+
*/
|
|
2940
|
+
setValuesRaw: (values: Partial<FullOrderState>) => void;
|
|
2854
2941
|
symbolInfo: API.SymbolExt;
|
|
2855
2942
|
/**
|
|
2856
2943
|
* Meta state including validation and submission status.
|
|
@@ -3054,6 +3141,12 @@ type TpslPriceParams = {
|
|
|
3054
3141
|
slPrice?: string;
|
|
3055
3142
|
liqPrice: number | null;
|
|
3056
3143
|
side?: OrderSide;
|
|
3144
|
+
/**
|
|
3145
|
+
* Mark price for the symbol. When set with `side`, liq values that `useGetEstLiqPrice` would
|
|
3146
|
+
* hide (invalid vs mark — e.g. long est. liq above mark) are ignored here too so SL checks do
|
|
3147
|
+
* not run against a number the UI does not show as “Est. liq. price”.
|
|
3148
|
+
*/
|
|
3149
|
+
markPrice?: number | null;
|
|
3057
3150
|
/** Current position qty (signed: positive=Long, negative=Short). If missing, treated as is_reducing=true, skip liq check. */
|
|
3058
3151
|
currentPosition?: number;
|
|
3059
3152
|
/** Order quantity (non-negative, sign derived from side). If missing or 0, treated as is_reducing=true, skip liq check. */
|
|
@@ -3109,4 +3202,4 @@ interface UseFeatureFlagReturn {
|
|
|
3109
3202
|
*/
|
|
3110
3203
|
declare const useFeatureFlag: (key: FlagKeys) => UseFeatureFlagReturn;
|
|
3111
3204
|
|
|
3112
|
-
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, type Brokers, type
|
|
3205
|
+
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, type Brokers, type BuiltInMarketTab, type Chain, type ChainFilter, type Chains, type CollateralOutputs, type ComputedAlgoOrder, type ConfigProviderProps, type ConnectedChain, type CurrentEpochEstimate, type CustomMarketTab, 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 MarketBuiltInTabType, MarketCategoriesConfigProvider, type MarketCategoriesConfigProviderProps, type MarketCategoryComponentKey, type MarketCategoryConfig, type MarketCategoryContext, type MarketTabConfig, 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 UseBadgeBySymbolReturn, 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, formatSymbolWithBroker, getMinNotional, getPriceKey, indexedDBManager, initializeAppDatabase, isCurrentlyClosed, isCurrentlyTrading, noCacheConfig, parseJSON, persistIndexedDB, resetTimestampOffsetState, timestampWaitingMiddleware, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAppStore, useAssetsHistory, useAudioPlayer, useBadgeBySymbol, 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, useMarketCategoriesConfig, 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, useSymbolWithBroker, 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 };
|