import * as react from 'react'; import { ReactNode, FC, PropsWithChildren } from 'react'; import * as _orderly_network_types from '@orderly.network/types'; import { API, NetworkId, TrackerEventName, OrderlyOrder, ChainNamespace, WalletChainChangeResult, WSMessage, MarginMode, OrderType, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, AlgoOrderEntity, PositionType, AssetHistoryStatusEnum, RequireKeys, AlgoOrderType } from '@orderly.network/types'; import * as swr from 'swr'; import { SWRConfiguration, SWRHook, SWRResponse, Middleware } from 'swr'; export { swr }; export { KeyedMutator, Middleware, SWRConfiguration, SWRHook, SWRResponse, unstable_serialize, default as useSWR, useSWRConfig } from 'swr'; import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation'; import * as swr_infinite from 'swr/infinite'; import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite'; import * as _orderly_network_core from '@orderly.network/core'; import { AccountState, Account, EventEmitter, ConfigStore, ConfigKey, SimpleDI, OrderlyKeyStore, WalletAdapter, IContract, DefaultConfigStore } from '@orderly.network/core'; export { SubAccount, WalletAdapter } from '@orderly.network/core'; import * as lodash from 'lodash'; import * as amplitude from '@amplitude/analytics-browser'; export { default as useConstant } from 'use-constant'; import { WS } from '@orderly.network/net'; import { EIP1193Provider } from '@web3-onboard/common'; import { SolanaWalletProvider } from '@orderly.network/default-solana-adapter'; import * as swr_subscription from 'swr/subscription'; import * as _orderly_network_utils from '@orderly.network/utils'; import { Decimal } from '@orderly.network/utils'; import * as use_debounce from 'use-debounce'; export * from 'use-debounce'; import * as immer from 'immer'; import * as zustand from 'zustand'; import { StoreMutatorIdentifier, StateCreator } from 'zustand'; import * as zustand_middleware from 'zustand/middleware'; import { PersistOptions } from 'zustand/middleware'; /** * Check if currently trading based on next_open/next_close timestamps * @param nextClose - Next close time timestamp * @param status - RWA status from API * @param currentTime - Current time timestamp * @param nextOpen - Next open time timestamp * @returns boolean - true if currently trading */ declare const isCurrentlyTrading: (nextClose: number | undefined, status: "open" | "close", currentTime?: number, nextOpen?: number) => boolean; declare const isCurrentlyClosed: (nextOpen: number, status: "open" | "close", currentTime?: number, nextClose?: number) => boolean; /** * Type alias for the return type of useSymbolsInfo hook */ type RwaSymbolsInfo = ReturnType; /** * A hook that provides access to symbol information. * * @returns A getter object that provides access to symbol information. * The getter allows accessing symbol data either by symbol name directly, * or through a two-level access pattern (symbol and property). * * @example * ```typescript * const rwaSymbolsInfo = useRwaSymbolsInfo(); * * // Get all info for a symbol * const ethInfo = rwaSymbolsInfo["PERP_ETH_USDC"](); * ``` */ declare const useRwaSymbolsInfo: () => Record(key: Key, defaultValue?: API.RwaSymbol[Key] | undefined) => API.RwaSymbol[Key]> & Record API.RwaSymbol> & { isNil: boolean; }; declare const useRwaSymbolsInfoStore: () => Record | undefined; /** * Return type definition for the hook * * - isRwa: true if the symbol is an RWA symbol * - open: true if the symbol is open for trading * - nextOpen: the next open time in milliseconds * - nextClose: the next close time in milliseconds * - closeTimeInterval: the time interval in seconds until the symbol closes (countdown format) * - openTimeInterval: the time interval in seconds until the symbol opens (countdown format) */ interface RwaSymbolResult { isRwa: boolean; open?: boolean; nextOpen?: number; nextClose?: number; closeTimeInterval?: number; openTimeInterval?: number; } /** * Hook to initialize and manage the global timer * This hook should be called once at the top level of the application to start and manage the global timer */ declare const useInitRwaSymbolsRuntime: () => void; /** * Hook to get current RWA symbol information with real-time updates * Retrieves the state of a specific symbol from the centralized store * @param symbol - The symbol to query * @returns RwaSymbolResult containing RWA status and countdown information */ declare const useGetRwaSymbolInfo: (symbol: string) => RwaSymbolResult; /** * Simplified hook to get RWA symbol open status with real-time updates * @param symbol - The symbol to query * @returns Object containing isRwa and open status */ declare const useGetRwaSymbolOpenStatus: (symbol: string) => { isRwa: boolean; open?: boolean; }; /** * Hook to get RWA symbol close time interval with filtering * @param symbol - The symbol to query * @param thresholdMinutes - Time threshold in minutes, defaults to 30 * @returns Close time interval in seconds, or undefined if not within threshold */ declare const useGetRwaSymbolCloseTimeInterval: (symbol: string, thresholdMinutes?: number) => { isRwa: boolean; open?: boolean; closeTimeInterval?: number; nextClose?: number; }; /** * Hook to get RWA symbol open time interval with filtering * @param symbol - The symbol to query * @param thresholdMinutes - Time threshold in minutes, defaults to 30 * @returns Open time interval in seconds, or undefined if not within threshold */ declare const useGetRwaSymbolOpenTimeInterval: (symbol: string, thresholdMinutes?: number) => { isRwa: boolean; open?: boolean; openTimeInterval?: number; nextOpen?: number; }; /** * Type alias for the return type of useSymbolsInfo hook */ type SymbolsInfo = ReturnType; /** * A hook that provides access to symbol information. * * @returns A getter object that provides access to symbol information. * The getter allows accessing symbol data either by symbol name directly, * or through a two-level access pattern (symbol and property). * * @example * ```typescript * const symbolsInfo = useSymbolsInfo(); * * // Get all info for a symbol * const ethInfo = symbolsInfo["PERP_ETH_USDC"](); * * // Get specific property for a symbol * const baseDP = symbolsInfo["PERP_ETH_USDC"]('base_dp'); * * // Get specific property for a symbol with default value * const quoteDP = symbolsInfo["PERP_ETH_USDC"]('quote_dp', 2); * ``` */ declare const useSymbolsInfo: () => Record(key: Key, defaultValue?: _orderly_network_types.API.SymbolExt[Key] | undefined) => _orderly_network_types.API.SymbolExt[Key]> & Record _orderly_network_types.API.SymbolExt> & { isNil: boolean; }; declare const useSymbolsInfoStore: () => Record | undefined; type MarketCategoryComponentKey = "marketsSheet" | "expandMarkets" | "dropDownMarkets" | "subMenuMarkets" | "marketsDataList" | "horizontalMarkets"; type MarketBuiltInTabType = "favorites" | "community" | "all" | "crypto" | "rwa" | "preTge" | "newListing" | "recent"; type MarketTabBase = { name?: string; icon?: ReactNode | string; suffix?: ReactNode | string; isVisible?: (symbolList: API.MarketInfoExt[], ctx: { rwaSymbolsInfo?: RwaSymbolsInfo; symbolsInfo?: SymbolsInfo; }) => boolean; }; type BuiltInMarketTab = MarketTabBase & { type: MarketBuiltInTabType; }; type CustomMarketTab = MarketTabBase & { id: string; name: string; match: (market: API.MarketInfoExt) => boolean; }; type MarketTabConfig = BuiltInMarketTab | CustomMarketTab; interface MarketCategoryContext { componentKey: MarketCategoryComponentKey; builtIn: Record; } /** * Function-only config for market tabs. * * @param original - Default built-in tabs for the current component (as MarketTabConfig[]) * @param context - { componentKey, builtIn } for referencing built-in tab definitions * @returns Final tab sequence to render */ type MarketCategoryConfig = (original: MarketTabConfig[], context: MarketCategoryContext) => MarketTabConfig[]; type MarketCategoriesConfigProviderProps = { value?: MarketCategoryConfig; }; declare const MarketCategoriesConfigProvider: FC>; declare function useMarketCategoriesConfig(): MarketCategoryConfig | undefined; declare global { interface Window { __ORDERLY_VERSION__?: { [key: string]: string; }; } } declare const _default: "3.2.1"; declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions) => Promise; type useQueryOptions = SWRConfiguration & { formatter?: (data: any) => T; }; declare const noCacheConfig: SWRConfiguration; /** * useQuery * @description for public api. Injects X-Orderly-Plugin-Id when inside PluginScopeProvider. * @param query * @param options */ declare const useQuery: (query: Parameters[0], options?: useQueryOptions) => SWRResponse; /** * Fetches the auto-convert thresholds from `/v1/public/auto_convert_threshold`. * * Fields are returned raw; `ltv_threshold` is a ratio (e.g. `0.9` means 90%), * multiply by 100 at the consumer when a percentage is needed. While loading * or on request failure the fields are `undefined`. */ declare const useConvertThreshold: () => { readonly ltv_threshold: number | undefined; readonly negative_usdc_threshold: number | undefined; readonly isLoading: boolean; readonly error: any; }; type ConvertThresholdReturns = ReturnType; /** * SWR middleware that waits for __ORDERLY_timestamp_offset to be initialized * before allowing requests to proceed. */ declare const timestampWaitingMiddleware: Middleware; /** * Reset timestamp state (for testing or re-initialization) */ declare function resetTimestampOffsetState(): void; /** * useQuery * @description for public api * @param query * @param options */ declare const useLazyQuery: (query: Parameters[0], options?: SWRMutationConfiguration & { formatter?: (data: any) => R; init?: RequestInit; }) => SWRMutationResponse; type HTTP_METHOD$1 = "POST" | "PUT" | "DELETE" | "GET"; /** * This hook is used to execute API requests for data mutation, such as POST, DELETE, PUT, etc. */ declare const useMutation: ( /** * The URL to send the request to. If the URL does not start with "http", * it will be prefixed with the API base URL. */ url: string, /** * The HTTP method to use for the request. Defaults to "POST". */ method?: HTTP_METHOD$1, /** * The configuration object for the mutation. * @see [useSWRMutation](https://swr.vercel.app/docs/mutation#api) * * @link https://swr.vercel.app/docs/mutation#api */ options?: SWRMutationConfiguration) => readonly [(this: unknown, data: Record | null, params?: Record | undefined, options?: SWRMutationConfiguration | undefined) => Promise, { readonly data: any; readonly error: E | undefined; readonly reset: () => void; readonly isMutating: boolean; }]; /** * usePrivateQuery * @description for private api * @param query * @param options */ declare const usePrivateQuery: (query: Parameters[0], options?: useQueryOptions) => SWRResponse; declare const usePrivateInfiniteQuery: (getKey: SWRInfiniteKeyLoader | null, options?: SWRInfiniteConfiguration & { formatter?: (data: any) => any; }) => swr_infinite.SWRInfiniteResponse; declare const useInfiniteQuery: (getKey: SWRInfiniteKeyLoader, options?: SWRInfiniteConfiguration & { formatter?: (data: any) => any; }) => swr_infinite.SWRInfiniteResponse; declare const useBoolean: (initialValue?: boolean) => [boolean, { setTrue: () => void; setFalse: () => void; toggle: () => void; }]; type NotFunction = T extends (...args: any[]) => any ? never : T; declare const useUpdatedRef: (val: NotFunction) => react.MutableRefObject; type noop = (this: any, ...args: any[]) => any; type PickFunction = (this: ThisParameterType, ...args: Parameters) => ReturnType; declare const useMemoizedFn: (fn?: T) => PickFunction; interface AudioPlayerOptions { volume?: number; /** When true, play() will run; when false, play() no-ops. Used for on/off toggle. */ enabled?: boolean; } /** * Single shared Audio instance. Play is explicit: pause() then set src then play(). * Use for order-filled notification sound (and any other one-shot global sound). * Compatible with legacy single-sound + on/off: pass enabled = user's on/off and src = media or "". */ declare const useAudioPlayer: (src: string, options?: AudioPlayerOptions) => { play: () => void; }; declare const useCommission: (options?: { size?: number; }) => any[]; declare namespace RefferalAPI { interface ReferralInfo { referrer_info: Referrer; referee_info: Referee; } type ReferralCode = { code: string; max_rebate_rate: number; referee_rebate_rate: number; referrer_rebate_rate: number; total_invites: number; total_traded: number; total_volume: number; total_rebate: number; }; type AutoGenerateCode = { code: string; requireVolume: number; completedVolume: number; }; type Referrer = { total_invites: number; total_traded: number; total_referee_volume: number; total_referee_fee: number; referral_codes: ReferralCode[]; total_referrer_rebate: number; "1d_invites": number; "7d_invites": number; "30d_invites": number; "1d_traded": number; "7d_traded": number; "30d_traded": number; "1d_referee_volume": number; "7d_referee_volume": number; "30d_referee_volume": number; "1d_referee_fee": number; "7d_referee_fee": number; "30d_referee_fee": number; "1d_referrer_rebate": number; "7d_referrer_rebate": number; "30d_referrer_rebate": number; }; type Referee = { referer_code?: string; referee_rebate_rate?: number; "1d_referee_rebate": number; "7d_referee_rebate": number; "30d_referee_rebate": number; total_referee_rebate: number; }; type RefereeInfoItem = { account_id: string; code_binding_time: number; fee: number; referral_code: string; referral_rebate: number; register_time: number; trade_status: string; user_address: string; volume: number; }; type UserVolStats = { perp_volume_last_30_days: number; perp_volume_last_7_days: number; perp_volume_ltd: number; perp_volume_ytd: number; }; type Distribution = { amount: number; created_time: number; id: number; status: string; token: string; type: string; updated_time: number; }; type ReferralRebateSummary = { daily_traded_referral: number; direct_traded_referral: number; indirect_traded_referral: number; referral_rebate: number; direct_rebate: number; indirect_rebate: number; direct_bonus_rebate: number; volume: number; direct_volume: number; indirect_volume: number; fee: number; date: string; }; type RefereeRebateSummary = { referee_rebate: number; fee: number; date: string; }; type DayliVolume = { date: string; perp_volume: number; }; } declare const useDaily: (options?: { startDate?: Date; endDate?: Date; }) => { data?: RefferalAPI.DayliVolume[]; mutate: any; }; type Params$4 = { size?: number; startDate?: string; endDate?: string; initialSize?: number; }; declare const useDistribution: (params: Params$4) => any; type Params$3 = { size?: number; startDate?: string; endDate?: string; initialSize?: number; page?: number; }; declare const useReferralRebateSummary: (params: Params$3) => readonly [RefferalAPI.ReferralRebateSummary[] | null, { readonly total: number; readonly isLoading: boolean; readonly refresh: swr.KeyedMutator; readonly loadMore: () => void; readonly meta: { total: number; records_per_page: number; current_page: number; } | undefined; }]; type Params$2 = { size?: number; startDate?: string; endDate?: string; initialSize?: number; }; declare const useRefereeHistory: (params: Params$2) => any[]; type Params$1 = { size?: number; /** * @deprecated * YYYY-MM-dd */ startDate?: string; /** * @deprecated * YYYY-MM-dd */ endDate?: string; /** default is 1 */ initialSize?: number; sort?: "ascending_code_binding_time" | "descending_code_binding_time" | "ascending_referral_rebate" | "descending_referral_rebate" | "ascending_volume" | "descending_volume"; page?: number; }; declare const useRefereeInfo: (params: Params$1) => readonly [RefferalAPI.RefereeInfoItem[] | null, { readonly total: number; readonly isLoading: boolean; readonly refresh: swr.KeyedMutator; readonly loadMore: () => void; readonly meta: { total: number; records_per_page: number; current_page: number; } | undefined; }]; type Params = { startDate?: Date; endDate?: Date; }; declare const useRefereeRebateSummary: (params: Params) => { data?: RefferalAPI.RefereeRebateSummary[]; mutate: any; isLoading: boolean; }; declare const useCheckReferralCode: (code?: string) => { isExist: boolean | undefined; error: any; isLoading: boolean; }; declare const useGetReferralCode: (accountId?: string) => { referral_code?: string; error: any; isLoading: boolean; }; declare const useReferralInfo: () => { data?: RefferalAPI.ReferralInfo; isTrader?: boolean; isAffiliate?: boolean; error: any; isLoading: boolean; getFirstRefCode: () => RefferalAPI.ReferralCode | undefined; }; declare const REFERRAL_CODE_MIN_LENGTH = 4; declare const REFERRAL_CODE_MAX_LENGTH = 15; declare function formatReferralCodeInput(raw: string): string; declare function isReferralCodeLengthValid(code: string): boolean; declare const useAccount: () => { account: _orderly_network_core.Account; state: AccountState; isSubAccount: boolean; isMainAccount: boolean; subAccount: { refresh: () => Promise>; create: (description?: string) => Promise; update: (value: { subAccountId: string; description?: string; }) => Promise; }; switchAccount: (accountId: string) => Promise; createOrderlyKey: (remember: boolean) => Promise; createAccount: () => Promise; }; declare const useAccountInstance: () => Account; declare const usePreLoadData: () => { error: null; done: boolean; }; declare const useEventEmitter: () => EventEmitter; declare function useSessionStorage(key: string, initialValue: T): [T, (data: any) => void]; declare function parseJSON(value: string | null): T | undefined; declare function useLocalStorage(key: string, initialValue: T, options?: { parseJSON: typeof parseJSON; }): [any, (value: T) => void]; type CurrentChain = { id: number; info?: Chain; }; declare const useNetworkInfo: (networkId: NetworkId) => (chainId: number) => CurrentChain; declare const useFeeState: () => { readonly takerFee: string; readonly makerFee: string; readonly refereeRebate: number | undefined; readonly rwaTakerFee: string; readonly rwaMakerFee: string; }; declare const useTrack: () => { track: lodash.DebouncedFunc<(eventName: TrackerEventName, params?: any) => void>; tracking: (eventName: TrackerEventName, params?: any) => void; setTrackUserId: (userId: string) => void; setIdentify: (params: any) => void; }; declare enum ENVType$1 { prod = "prod", staging = "staging", qa = "qa", dev = "dev" } declare class AmplitudeTracker { static instanceName: string; private _userId; private _sdkInfoTag; private _ee; constructor(env: ENVType$1, amplitudeConfig: { amplitudeId: string; serverZone?: amplitude.Types.ServerZoneType; } | undefined, sdkInfo: any); setUserId(userId: string): void; setSdkInfo(sdkInfo: any): void; identify(properties: any): void; track(eventName: TrackerEventName, properties?: any): void; private _bindEvents; } declare const useTrackingInstance: () => AmplitudeTracker; declare const useWS: () => WS; declare function useConfig(): ConfigStore; declare function useConfig(key: ConfigKey, defaultValue?: T): T; declare const useKeyStore: () => _orderly_network_core.OrderlyKeyStore; declare const useSimpleDI: () => { get: (name: string) => T; register: typeof SimpleDI.register; }; declare const TESTNET_WHITE_LIST: number[]; declare const TESTNET_WHITE_CHAINS: { id: number; }[]; type Chain = API.Chain & { nativeToken?: API.TokenInfo; isTestnet?: boolean; }; type Chains = T extends NetworkId ? K extends keyof API.Chain ? API.Chain[K][] : API.Chain[] : K extends keyof API.Chain ? { testnet: API.Chain[K][]; mainnet: API.Chain[K][]; } : { testnet: API.Chain[]; mainnet: API.Chain[]; }; type UseChainsOptions = { filter?: (item: API.Chain) => boolean; pick?: "dexs" | "network_infos" | "token_infos"; forceAPI?: boolean; } & SWRConfiguration; type UseChainsReturnObject = { findByChainId: (chainId: number, field?: string) => Chain | undefined; isTestnetChain: (chainId?: number | string) => boolean; checkChainSupport: (chainId: number | string, networkId: NetworkId) => boolean; error: any; }; declare function useChains(networkId?: undefined, options?: undefined): [Chains, UseChainsReturnObject]; declare function useChains(networkId?: T, options?: K): [ Chains, UseChainsReturnObject ]; type FilteredChains = { mainnet?: { id: number; }[]; testnet?: { id: number; }[]; }; interface OrderlyConfigContextState { /** @deprecated will be removed in next minor version */ fetcher?: (url: string, init: RequestInit) => Promise; configStore: ConfigStore; keyStore: OrderlyKeyStore; walletAdapters: WalletAdapter[]; networkId: NetworkId; filteredChains?: FilteredChains; /** custom chains, please include all chain information, otherwise there will be problems */ customChains?: Chains; /** enable swap deposit, default is false */ enableSwapDeposit?: boolean; /** * Custom orderbook default tick sizes. */ defaultOrderbookTickSizes?: Record; /** * Custom orderbook default symbol depths. */ defaultOrderbookSymbolDepths?: Record; /** when use this, please keep the reference stable, otherwise it will cause unnecessary renders */ dataAdapter?: { /** * custom useChains return list data */ chainsList?: (chains: API.Chain[]) => API.Chain[]; /** * Custom `/v1/public/futures` response data. */ symbolList?: (data: API.MarketInfoExt[], context: { rwaSymbolsInfo: Record | undefined; }) => any[]; /** * custom `/v2/public/announcement` response data */ announcementList?: (data: any[] | ReadonlyArray) => any[]; }; notification?: { orderFilled?: { /** * Sound to play when an order is successful. * If `soundOptions` is provided, this field is treated as the legacy * single-sound configuration and only used when `soundOptions` is * absent. * @default undefined */ media?: string; /** * Whether to open the notification by default. * For multi-sound mode this controls whether the initial selection * should be sound-on or muted when there is no stored preference. * @default false */ defaultOpen?: boolean; /** * Whether to display the notification in the order entry. * @default true */ displayInOrderEntry?: boolean; /** * Multiple sound options for order filled notification. * When provided, the UI should render a single-choice selector * (e.g. radio group) instead of a simple on/off toggle. One of the * options should represent the muted/off state. */ soundOptions?: Array<{ label: string; value: string; media: string; }>; /** * Default selected sound option value when there is no stored * preference. If omitted, the first item in `soundOptions` is used. */ defaultSoundValue?: string; }; }; amplitudeConfig?: { amplitudeId: string; serverZone?: "EU" | "US"; }; orderMetadata?: OrderMetadataConfig; } type OrderMetadata = { order_tag?: string; client_order_id?: string; }; type OrderMetadataConfig = OrderMetadata | ((order: Partial) => OrderMetadata); declare const OrderlyContext: react.Context; declare const useOrderlyContext: () => OrderlyConfigContextState; declare const OrderlyProvider: react.Provider; declare const StatusProvider: React.FC; declare enum WsNetworkStatus { Connected = "connected", Unstable = "unstable", Disconnected = "disconnected" } declare function useWsStatus(): WsNetworkStatus; type ChainFilterFunc = (config: ConfigStore) => FilteredChains; type ChainFilter = FilteredChains | ChainFilterFunc; type BaseConfigProviderProps = { keyStore?: OrderlyKeyStore; contracts?: IContract; walletAdapters?: WalletAdapter[]; /** filter chains, only show chains in the filter */ chainFilter?: ChainFilter; /** * Custom orderbook default tick sizes. */ orderbookDefaultTickSizes?: Record; /** * Custom orderbook default symbol depths. */ orderbookDefaultSymbolDepths?: Record; } & Pick; type ExclusiveConfigProviderProps = { brokerId: string; brokerName?: string; networkId: NetworkId; configStore?: never; } | { brokerId?: never; brokerName?: never; networkId?: never; configStore: ConfigStore; }; type ConfigProviderProps = BaseConfigProviderProps & ExclusiveConfigProviderProps; declare const OrderlyConfigProvider: FC>; declare class ExtendedConfigStore extends DefaultConfigStore { constructor(init: Partial>); get(key: ConfigKey): T; set(key: ConfigKey, value: T): void; } type WalletProvider = (EIP1193Provider | SolanaWalletProvider) & { publicKey?: SolanaWalletProvider["publicKey"]; }; type ConnectedChain = { id: number | string; namespace: ChainNamespace; }; type WalletAccount = { address: string; }; interface WalletState { label: string; icon: string; provider: WalletProvider; accounts: WalletAccount[]; chains: ConnectedChain[]; instance?: unknown; additionalInfo?: Record; } interface WalletConnectorContextState { connect: (options?: any) => Promise; disconnect: (options: any) => Promise; connecting: boolean; setChain: (options: { chainId: string | number; }) => Promise; chains: any[]; wallet: WalletState | null; connectedChain: ConnectedChain | null; settingChain: boolean; namespace: ChainNamespace | null; } declare const WalletConnectorContext: react.Context; declare const useWalletConnector: () => WalletConnectorContextState; type OrderBookItem = number[]; type OrderbookData = { asks: OrderBookItem[]; bids: OrderBookItem[]; }; declare const getPriceKey: (rawPrice: number, depth: number, isAsks: boolean) => number; /** * Configuration for the Order Book */ type OrderbookOptions = { /** Indicates the number of data entries to return for ask/bid, default is 10 */ level?: number; /** Whether to fill in when the actual data entries are less than the level. If filled, it will add [nan, nan, nan, nan]. Default is true */ padding?: boolean; }; declare const ORDERLY_ORDERBOOK_DEPTH_KEY = "orderly_orderbook_depth_key"; /** * @description React hook that returns the current orderbook for a given market */ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({ asks: OrderBookItem[]; bids: OrderBookItem[]; markPrice: number; middlePrice: number[]; onDepthChange?: undefined; depth?: undefined; allDepths?: undefined; isLoading?: undefined; onItemClick?: undefined; } | { onDepthChange: (val: number) => void; depth: number; allDepths: number[]; isLoading: boolean; onItemClick: (item: OrderBookItem) => void; asks?: undefined; bids?: undefined; markPrice?: undefined; middlePrice?: undefined; })[]; declare const useSymbolInfo: (symbol?: string) => (((key: Key, defaultValue?: _orderly_network_types.API.SymbolExt[Key] | undefined) => _orderly_network_types.API.SymbolExt[Key]) & (() => _orderly_network_types.API.SymbolExt)) | null; declare const useAccountInfo: () => swr.SWRResponse; declare const useMarketsStream: () => { data: WSMessage.Ticker[]; }; declare enum MarketsType { FAVORITES = 0, RECENT = 1, ALL = 2, CRYPTO = 3, RWA = 4, NEW_LISTING = 5, COMMUNITY = 6, PRE_TGE = 7 } interface FavoriteTab$1 { name: string; id: number; } interface Favorite$1 { name: string; tabs: FavoriteTab$1[]; } interface Recent$1 { name: string; } interface TabSort$1 { sortKey: string; sortOrder: string; } /** @deprecated use useMarkets instead */ declare const useMarket: (type: MarketsType) => readonly [any[], { readonly favoriteTabs: { name: string; id: number; }[]; readonly favorites: Favorite$1[]; readonly recent: Recent$1[]; readonly tabSort: Record; readonly addToHistory: (symbol: API.MarketInfoExt) => void; readonly updateFavorites: (favorites: Favorite$1[]) => void; readonly updateFavoriteTabs: (tab: FavoriteTab$1 | FavoriteTab$1[], operator?: { add?: boolean; update?: boolean; delete?: boolean; }) => void; readonly updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab$1 | FavoriteTab$1[], remove?: boolean) => void; readonly pinToTop: (symbol: API.MarketInfoExt) => void; readonly getLastSelFavTab: () => FavoriteTab$1; readonly updateSelectedFavoriteTab: (tab: FavoriteTab$1) => void; readonly updateTabsSortState: (tabId: string, sortKey: string, sortOrder: "desc" | "asc") => void; }]; interface FavoriteTab { name: string; id: number; } interface Favorite { name: string; tabs: FavoriteTab[]; } interface Recent { name: string; } interface NewListing { name: string; } type TabSort = Record; type MarketsItem = { symbol: string; /** Permissionless listing: display name without broker_id suffix */ display_symbol_name?: string; /** Permissionless listing: broker id; null for non-community-listed symbols */ broker_id?: string | null; index_price: number; mark_price: number; sum_unitary_funding: number; est_funding_rate: number; last_funding_rate: number; next_funding_time: number; open_interest: number; "24h_open": number; "24h_close": number; "24h_high": number; "24h_low": number; "24h_volume": number; "24h_amount": number; "24h_volumn": number; change: number; "8h_funding": number; quote_dp: number; created_time: number; openInterest: number; isFavorite: boolean; leverage?: number; isRwa: boolean; isPreTge: boolean; market_session?: API.RwaSymbol["market_session"]; rwaNextOpen?: number; rwaNextClose?: number; rwaStatus?: "open" | "close"; }; type MarketsStore = ReturnType; declare const MarketsStorageKey = "orderly_markets"; declare const useMarketsStore: () => { favoriteTabs: FavoriteTab[]; favorites: { tabs: FavoriteTab[]; name: string; }[]; recent: Recent[]; newListing: NewListing[]; tabSort: TabSort; selectedFavoriteTab: FavoriteTab; updateFavorites: react.Dispatch>; updateFavoriteTabs: (tab: FavoriteTab | FavoriteTab[], operator?: { add?: boolean; update?: boolean; delete?: boolean; }) => void; updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab | FavoriteTab[], remove?: boolean) => void; pinToTop: (symbol: API.MarketInfoExt) => void; addToHistory: (symbol: API.MarketInfoExt) => void; updateSelectedFavoriteTab: (tab: FavoriteTab) => void; updateTabsSortState: (tabId: string, sortKey: string, sortOrder: "desc" | "asc") => void; }; /** * Hook for accessing filtered market data based on type * @param type - Type of markets to filter (defaults to ALL) * @returns Tuple containing filtered markets array and markets store */ declare const useMarkets: (type?: MarketsType) => [MarketsItem[], MarketsStore]; declare const useMarkPricesStream: () => { data: Record; }; declare const useIndexPricesStream: () => { data: Record; getIndexPrice: (this: unknown, token: string) => number; }; /** * Mark price from the in-memory store for `symbol`. * * @remarks * `data` reflects the store lookup and may be transiently unset before streams write in. * In TS strict JSX, avoid rendering `{data}` as a direct text child without narrowing * (`typeof data === "number"`) or formatting through a helper that supplies a fallback. */ declare const useMarkPrice: (symbol: string) => { data: number; }; declare const useIndexPrice: (symbol: string) => swr_subscription.SWRSubscriptionResponse; /** * A hook for managing leverage in trading. * * @remarks * This hook provides functionality to get and update the user's leverage settings. * * It fetches the current leverage from client info and available leverage options from config. * * @returns A tuple containing: * - The current maximum leverage value * - An object with: * - `update`: Function to update leverage * - `isMutating`: Boolean indicating if an update is in progress * - `config`: Array of available leverage options (e.g. [1, 2, 3, 4, 5, 10, 15, 20]) * * @example * ```typescript * const [maxLeverage, { update, isMutating, config }] = useLeverage(); * * // Get current max leverage * console.log(maxLeverage); * * // Update leverage * update({ leverage: 5 }); * * // Available leverage options * console.log(config); // e.g., [1, 2, 3, 4, 5, 10, 15, 20] * ``` */ declare const useLeverage: () => { readonly update: (data: { leverage: number; }) => Promise<{ max_leverage: string | number; } | undefined>; readonly isLoading: boolean; readonly leverageLevers: number[]; readonly curLeverage: number; readonly maxLeverage: number; }; type SymbolLeverageMap = Record; declare const useSymbolLeverageMap: () => { readonly leverages: SymbolLeverageMap; readonly getSymbolLeverage: (symbol?: string, marginMode?: MarginMode) => number | undefined; readonly isLoading: boolean; readonly error: any; readonly refresh: swr.KeyedMutator; }; type SetMarginModePayload = { symbol_list: string[]; default_margin_mode: MarginMode; }; type SetMarginModeResult = { success: boolean; message?: string; }; type MarginModesResponseItem = { symbol: string; default_margin_mode: MarginMode; }; /** * A high-level hook to manage margin modes for all symbols. * * It encapsulates both: * - fetching current default margin modes for all symbols * - updating margin mode for one or multiple symbols */ declare const useMarginModes: () => { marginModes: Record; isLoading: boolean; error: any; refresh: swr.KeyedMutator; setMarginMode: (payload: SetMarginModePayload) => Promise; updateMarginMode: (payload: SetMarginModePayload) => Promise; isMutating: boolean; }; declare const useMarginModeBySymbol: (symbol: string, fallback?: MarginMode | null) => { marginMode: MarginMode; isLoading: boolean; error: any; refresh: swr.KeyedMutator; update: (mode: MarginMode) => Promise; isPermissionlessListing: boolean; }; interface SwapQuoteRequest extends Record { fromToken: string; toToken: string; amount: number; slippage: number; } interface SwapQuoteToken { tokenAddress: string; amount?: string; value?: string; estimatedAmount?: string; estimatedValue?: string; } interface GasEstimate { gasUnits: string; gasPriceWei: string | null; nativeTokenSymbol: string; estimatedFeeAmount: string | null; estimatedFeeValue: string | null; } interface SwapQuoteData { pathId: string; traceId: string; chainId: string; fromToken: SwapQuoteToken & { amount: string; value: string; }; toToken: SwapQuoteToken; valueCurrency: string; netOutValue: string; priceImpactPercent: string | null; slippageLimitPercent: string; gasEstimate: GasEstimate; expiresAt: number; } interface SwapQuoteResponse { success: boolean; data?: SwapQuoteData; code?: number | string; message?: string; timestamp?: number; } interface SwapQuoteError extends Error { code?: number | string; timestamp?: number; } declare const isSwapQuoteData: (value: unknown) => value is SwapQuoteData; declare const useSwapQuote: () => readonly [(this: unknown, request: SwapQuoteRequest | null) => Promise, { readonly data: SwapQuoteData | undefined; readonly request: SwapQuoteRequest | undefined; readonly error: SwapQuoteError | undefined; readonly reset: (this: unknown) => void; readonly isMutating: boolean; }]; interface LTVOptions { input?: number; token?: string; } declare const useComputedLTV: (options?: LTVOptions) => number; declare const useTickerStream: (symbol: string) => API.MarketInfo & { change?: number; "24h_change"?: number; }; declare const useFundingRate: (symbol: string) => { est_funding_rate: string | null | undefined; countDown: string; symbol?: string | undefined; est_funding_rate_timestamp?: number | undefined; last_funding_rate?: number | undefined; last_funding_rate_timestamp?: number | undefined; next_funding_time?: number | undefined; sum_unitary_funding?: number | undefined; }; declare const useFundingDetails: (symbol: string) => swr.SWRResponse; type FundingRates = ReturnType; declare const useFundingRates: () => Record(key: Key, defaultValue?: API.FundingRate[Key] | undefined) => API.FundingRate[Key]> & Record API.FundingRate> & { isNil: boolean; }; declare const useFundingRatesStore: () => Record; type PeriodKey = "1d" | "3d" | "7d" | "14d" | "30d" | "90d"; declare const useFundingRateHistory: () => { data: readonly any[]; isLoading: boolean; getPositiveRates: (data: ReadonlyArray | API.FundingHistory[], period: PeriodKey) => Record; }; /** * Price mode for PnL calculations in position streams * @typedef {("markPrice" | "lastPrice")} PriceMode * - markPrice: Uses mark price for unrealized PnL calculations (default) * - lastPrice: Uses last traded price (index price) for unrealized PnL calculations */ type PriceMode = "markPrice" | "lastPrice"; /** * Real-time position stream hook with WebSocket integration * * Subscribes to position updates via WebSocket and provides real-time position data with automatic * calculations for unrealized PnL, ROI, and aggregated portfolio metrics. Integrates TP/SL orders * and supports both full portfolio view and single symbol tracking. * * **Key Features:** * - Real-time WebSocket updates for positions * - Automatic integration of TP/SL (take-profit/stop-loss) orders * - Dual price mode support (mark price vs last price) * - Optional pending order inclusion * - Calculator service integration for real-time PnL updates * - Aggregated portfolio metrics (total collateral, value, ROI) * * **Price Calculation Modes:** * - markPrice (default): Uses mark price for unrealized PnL - recommended for margin calculations * - lastPrice: Uses last traded price (index price) - useful for more conservative PnL views * * **Data Flow:** * 1. Subscribes to position store (WebSocket-driven) * 2. Fetches related TP/SL orders via useOrderStream * 3. Registers calculator for real-time price updates (single symbol only) * 4. Merges position data with TP/SL information * 5. Applies price mode transformations * 6. Filters positions based on includedPendingOrder flag * * @param {string} [symbol="all"] - Trading symbol to filter positions, or "all" for entire portfolio * - "all": Returns all positions across all symbols (calculator not registered) * - "BTC-PERP": Returns only BTC-PERP position (calculator registered for real-time updates) * * @param {Object} [options] - Configuration options extending SWR configuration * @param {PriceMode} [options.calcMode] - Price calculation mode: "markPrice" or "lastPrice" * - markPrice: Uses mark_price field for unrealized_pnl (default, matches exchange calculations) * - lastPrice: Uses unrealized_pnl_index field based on last traded price * @param {boolean} [options.includedPendingOrder=false] - Include positions with only pending orders * - false: Only returns positions with non-zero position_qty * - true: Returns positions with position_qty !== 0 OR pending_long_qty/pending_short_qty !== 0 * * @returns {readonly [PositionData, PositionInfoGetter, LoadingState]} Tuple containing: * - [0] PositionData object: * - rows: Array of position objects with TP/SL information * - aggregated: Aggregated metrics (total unrealized PnL, ROI, etc.) * - totalCollateral: Total collateral across all positions * - totalValue: Total portfolio value * - totalUnrealizedROI: Total unrealized ROI percentage * - [1] PositionInfoGetter: Memoized getter function for aggregated data access * - [2] LoadingState object: * - loading: Loading status (deprecated, use isLoading) * - isLoading: Current loading state of position data * * @example * // Get all positions with mark price calculation * const [{ rows, aggregated, totalCollateral }] = usePositionStream(); * * @example * // Get single symbol position with last price calculation * const [{ rows }] = usePositionStream("BTC-PERP", { * calcMode: "lastPrice" * }); * * @example * // Include pending orders in results * const [{ rows }, getter, { isLoading }] = usePositionStream("all", { * includedPendingOrder: true * }); * * @example * // Access specific position with TP/SL data * const [{ rows }] = usePositionStream("ETH-PERP"); * const position = rows[0]; * console.log(position.full_tp_sl.tp_trigger_price); // Full position TP price * console.log(position.partial_tp_sl.order_num); // Number of partial TP/SL orders */ declare const usePositionStream: (symbol?: string, options?: SWRConfiguration & { calcMode?: PriceMode; includedPendingOrder?: boolean; }) => readonly [{ readonly rows: API.PositionTPSLExt[]; readonly aggregated: Omit; readonly totalCollateral: _orderly_network_utils.Decimal; readonly totalValue: _orderly_network_utils.Decimal | null; readonly totalUnrealizedROI: number; }, 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", (defaultValue?: Omit[Key] | undefined) => Omit[Key]> & { isNil: boolean; }, { /** * @deprecated use `isLoading` instead */ readonly loading: boolean; readonly isLoading: boolean; }]; declare const findTPSLFromOrder: (order: API.AlgoOrder) => { tp_trigger_price?: number; sl_trigger_price?: number; }; declare const findTPSLOrderPriceFromOrder: (order: API.AlgoOrder) => { tp_order_price: OrderType | number | undefined; sl_order_price: OrderType | number | undefined; }; declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string, marginMode?: MarginMode) => { fullPositionOrder?: API.AlgoOrder; partialPositionOrders?: API.AlgoOrder[]; }; type OrderValidationItem = { type: "required"; message: string; value?: never; } | { type: "max" | "min"; message: string; value: number | string; } | { type: "range"; message: string; value?: never; min: number | string; max: number | string; } | { type: "priceErrorMin" | "priceErrorMax"; message: string; value?: never; } | { type: number; message: string; value?: never; }; type OrderValidationResult = { [P in keyof OrderlyOrder]?: OrderValidationItem; }; type ValuesDepConfig = { symbol: API.SymbolExt; maxQty: number; markPrice: number; estSlippage?: number | null; /** [ask0, bid0] */ askAndBid?: number[]; }; interface OrderCreator { create: (values: T, configs: ValuesDepConfig) => T; validate: (values: T, configs: ValuesDepConfig) => Promise<{ [P in keyof T]?: OrderValidationItem; }>; get type(): OrderType; } type AlgoOrderUpdateEntity = { trigger_price?: number; price?: number; order_id: number; quantity?: number; is_activated?: boolean; order_type?: OrderType; }; type TPSLChildInput = { algo_type: string; type: OrderType; is_activated?: boolean; trigger_price?: number | string; price?: number | string; }; /** Build minimal updates, allowing an inactive leg to change execution type. */ declare function createTPSLOrderUpdates(children: TPSLChildInput[], oldValue: API.AlgoOrder, quantity?: number | string, explicitlyDeactivatedTypes?: readonly string[]): AlgoOrderUpdateEntity[]; type TPSLChildUpdate = { order_id: number; type?: OrderType; trigger_price?: number | string; price?: number | string; quantity?: number | string; is_activated?: boolean; child_orders?: TPSLChildUpdate[]; }; type CombineOrderType$1 = AlgoOrderRootType | "ALL"; declare const useOrderStream: ( /** * Orders query params */ params: { symbol?: string; status?: OrderStatus; page?: number; size?: number; side?: OrderSide; sourceTypeAll?: boolean; /** * Include the order type * @default ["ALL"] */ includes?: CombineOrderType$1[]; /** * Exclude the order type * @default [] */ excludes?: CombineOrderType$1[]; dateRange?: { from?: Date; to?: Date; }; }, options?: { /** * Keep the state update alive */ keeplive?: boolean; /** * Stop the state update when the component unmount */ stopOnUnmount?: boolean; }) => readonly [any[] | null, { readonly total: number; readonly isLoading: boolean; readonly refresh: () => void; readonly loadMore: () => void; readonly cancelAllOrders: () => Promise<[any, any, any]>; readonly cancelAllPendingOrders: (symbol?: string) => Promise<[any, any, any]>; readonly cancelAllTPSLOrders: (symbol?: string) => Promise; readonly cancelAlgoOrdersByTypes: (types: AlgoOrderRootType[], symbol?: string) => Promise; readonly updateOrder: (orderId: string, order: OrderEntity) => Promise; readonly cancelOrder: (orderId: number, symbol?: string) => Promise; readonly updateAlgoOrder: (orderId: string, order: OrderEntity) => Promise; readonly cancelAlgoOrder: (orderId: number, symbol?: string) => Promise; readonly cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise; readonly updateTPSLOrder: (orderId: number, childOrders: TPSLChildUpdate[]) => Promise; readonly cancelPostionOrdersByTypes: (symbol: string, types: AlgoOrderRootType[]) => Promise; readonly meta: { total: number; current_page: number; records_per_page: number; } | undefined; readonly errors: { readonly cancelOrder: unknown; readonly updateOrder: unknown; readonly cancelAlgoOrder: unknown; readonly updateAlgoOrder: unknown; }; readonly submitting: { readonly cancelOrder: boolean; readonly updateOrder: boolean; readonly cancelAlgoOrder: boolean; readonly updateAlglOrder: boolean; }; }]; type CombineOrderType = AlgoOrderRootType | "ALL"; /** * TODO: let useOrderStream support pass accountId, it will be better to use this hook */ declare const useSubAccountAlgoOrderStream: ( /** * Orders query params */ params: { symbol?: string; status?: OrderStatus; page?: number; size?: number; side?: OrderSide; /** * Include the order type * @default ["ALL"] */ includes?: CombineOrderType[]; /** * Exclude the order type * @default [] */ excludes?: CombineOrderType[]; dateRange?: { from?: Date; to?: Date; }; }, options: { accountId: string; }) => readonly [any, { readonly isLoading: boolean; readonly refresh: use_debounce.DebouncedState<() => void>; readonly cancelAllOrders: () => Promise<[any, any]>; readonly cancelAllPendingOrders: (symbol?: string) => void; readonly cancelAllTPSLOrders: (symbol?: string) => Promise; readonly cancelAlgoOrdersByTypes: (types: AlgoOrderRootType[], symbol?: string) => Promise; readonly updateOrder: (orderId: string, order: OrderEntity) => Promise; readonly cancelOrder: (orderId: number, symbol?: string) => Promise; readonly updateAlgoOrder: (orderId: string, order: OrderEntity) => Promise; readonly cancelAlgoOrder: (orderId: number, symbol?: string) => Promise; readonly cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise; readonly updateTPSLOrder: (orderId: number, childOrders: TPSLChildUpdate[]) => Promise; readonly cancelPostionOrdersByTypes: (symbol: string, types: AlgoOrderRootType[]) => Promise; readonly submitting: { readonly cancelOrder: boolean; readonly updateOrder: boolean; readonly cancelAlgoOrder: boolean; readonly updateAlglOrder: boolean; }; }]; interface MarketTradeStreamOptions { limit?: number; } declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStreamOptions) => { data: API.Trade[]; isLoading: boolean; }; /** * The return type of useCollateral hook, containing account collateral information */ type CollateralOutputs = { /** * Total collateral value in the account * * This includes all assets that can be used as margin */ totalCollateral: number; /** * Available collateral that can be used for new positions * * Calculated as: totalCollateral - margin requirements */ freeCollateral: number; /** * Legacy free collateral metric backed only by USDC * * Isolated-margin trading limits use `freeCollateral` instead. This field is * retained for backward compatibility. */ freeCollateralUSDCOnly: number; /** * Total portfolio value including all positions and collateral * * Can be null if data is not available */ totalValue: number | null; /** * Current available balance that can be withdrawn * * Excludes locked collateral and pending settlements */ availableBalance: number; /** * Unrealized profit and loss across all open positions * * Positive value indicates profit, negative indicates loss */ unsettledPnL: number; /** * List of holdings in the account * * Each holding represents a specific token and its quantity */ holding?: API.Holding[]; /** * Detailed account information and settings * * Contains account configuration, limits and risk parameters */ accountInfo?: API.AccountInfo; /** * USDC holding in the account */ usdcHolding: number; }; /** * Hook to get and calculate collateral-related data for an account * @example * ```typescript * const { * totalCollateral, * freeCollateral, * totalValue, * availableBalance, * unsettledPnL, * accountInfo, * } = useCollateral({ dp: 4 }); * ``` */ declare const useCollateral: (options?: { /** * Decimal precision for numerical values (default: 6) * */ dp: number; }) => CollateralOutputs; /** * Options for useMaxQty hook */ interface UseMaxQtyOptions { /** * Executes buy or sell orders which only reduce a current position. * If true, only allows orders that reduce current position * @default false */ reduceOnly?: boolean; /** * Margin mode ("CROSS" or "ISOLATED") * @default MarginMode.CROSS */ marginMode?: MarginMode; /** * Optional reference price for the **new order** when using isolated margin. * * If provided, this value will be used as `currentOrderReferencePrice` * in the isolated-margin max quantity formula instead of the mark price. * When omitted, the hook will fall back to `markPrice`. */ currentOrderReferencePrice?: number; } /** * A hook that calculates the maximum tradeable quantity for a given symbol and side * @returns Maximum tradeable quantity * @example * ```tsx * // Get max buy quantity for BTC (backward compatible) * const maxBuyQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY); * * // Get max sell quantity with reduce only (backward compatible) * const maxSellQty = useMaxQty("PERP_BTC_USDC", OrderSide.SELL, true); * * // New object parameter style (recommended) * const maxQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY, { * reduceOnly: false, * marginMode: MarginMode.ISOLATED, * }); * * // Only specify marginMode without reduceOnly * const maxQty = useMaxQty("PERP_BTC_USDC", OrderSide.BUY, { * marginMode: MarginMode.ISOLATED, * }); * ``` */ declare function useMaxQty(symbol: string, side: OrderSide, reduceOnly?: boolean, marginMode?: MarginMode): number; declare function useMaxQty(symbol: string, side: OrderSide, options?: UseMaxQtyOptions): number; /** * The return type of useMarginRatio hook */ type MarginRatioReturn = { /** * Current leverage of the account, null if trading is not enabled */ currentLeverage: number | null; /** * Current margin ratio of the account */ marginRatio: number; /** * Maintenance margin ratio (MMR) of the account, null if user has no positions */ mmr: number | null; /** * Maintenance margin of the account */ maintenanceMargin: number | null; }; /** * Hook to calculate and monitor account's margin ratio, leverage, and maintenance margin ratio (MMR) * @example * ```typescript * const { marginRatio, currentLeverage, mmr } = useMarginRatio(); * ``` */ declare const useMarginRatio: () => MarginRatioReturn; declare function useStorageChain(): { storageChain: any; setStorageChain: (chainId: number) => void; }; /** * @param token @deprecated, use useTokenInfo instead */ declare const useChain: (token: string) => { chains: API.Chain | null; isLoading: boolean; }; declare const useChainInfo: () => swr.SWRResponse; type UseWithdrawOptions = { srcChainId?: number; token?: string; /** orderly token decimals */ decimals?: number; }; declare const useWithdraw: (options: UseWithdrawOptions) => { dst: { symbol: string; decimals: number; address: string | undefined; chainId: number; network: string; }; withdraw: (inputs: { chainId: number; token: string; amount: string; allowCrossChainWithdraw: boolean; receiver?: string; }) => Promise; maxAmount: number; unsettledPnL: number; availableBalance: number; /** @deprecated use maxAmount instead */ availableWithdraw: number; }; type DepositOptions = { address?: string; decimals?: number; srcChainId?: number; /** input token */ srcToken?: string; /** output token */ dstToken?: string; /** cross chain route address */ crossChainRouteAddress?: string; /** swap deposit vault address */ depositorAddress?: string; }; type DST = { symbol: string; address: string; decimals: number; chainId: number; network: string; }; type UseDepositReturn = ReturnType; declare const useDeposit: (options: DepositOptions) => { balance: string | null; allowance: string; /** deposit fee, unit: wei */ depositFee: bigint; balanceRevalidating: boolean; allowanceRevalidating: boolean; depositFeeRevalidating: boolean; isNativeToken: boolean; dst: DST; targetChain: API.Chain; /** input quantiy */ quantity: string; /** set input quantity */ setQuantity: react.Dispatch>; approve: (amount?: string) => Promise; deposit: () => Promise; fetchBalance: (address: string, decimals?: number) => Promise; fetchBalances: (tokens: API.TokenInfo[]) => Promise>; }; interface ConvertOptions { token?: string; } declare const useConvert: (options: ConvertOptions) => { maxAmount: number; convert: (inputs: { amount: number; slippage: number; receivedAsset?: string; }) => Promise; }; type Receiver = { account_id: string; amount: number; }; type TransferOptions = { /** if not provided, use current account id */ fromAccountId?: string; token?: string; }; declare const useTransfer: (options?: TransferOptions) => { submitting: boolean; transfer: (token: string, receivers: Receiver | Receiver[]) => Promise; maxAmount: number; unsettledPnL: number; holding: _orderly_network_types.API.Holding[] | undefined; }; type InternalTransferInputs = { token: string; amount: string; receiver: string; /** orderly token decimals */ decimals: number; }; declare const useInternalTransfer: () => { submitting: boolean; transfer: (inputs: InternalTransferInputs) => Promise; }; /** * The max withdrawal amount for the token * if token is not provided, return the max withdrawal amount for USDC */ declare const useMaxWithdrawal: (token: string) => number; declare const useHoldingStream: () => { data: API.Holding[] | undefined; usdc: API.Holding | undefined; isLoading: boolean; }; declare const useWalletSubscription: (options?: { onMessage?: (data: any) => void; }) => swr_subscription.SWRSubscriptionResponse; declare const useBalanceSubscription: (options?: { onMessage?: (data: any) => void; }) => swr_subscription.SWRSubscriptionResponse; declare const useWalletTopic: (options: { onMessage: (data: any) => void; }) => void; declare const useBalanceTopic: (options: { onMessage: (data: any) => void; }) => void; declare const useSettleSubscription: (options?: { onMessage?: (data: any) => void; }) => swr_subscription.SWRSubscriptionResponse; type getKeyFunction = (index: number, prevData: any) => string | null; declare const usePrivateDataObserver: (options: { getKeysMap: (type: string) => Map; }) => void; type PriceRange = { min: number; max: number; }; /** * Get the price range for the specified symbol with an optional price * * @param symbol - The symbol to get the price range for * @param price - Optional parameter to set the price * @returns PriceRange | undefined - Returns the PriceRange representing the price range or undefined */ declare const useSymbolPriceRange: (symbol: string, side: "BUY" | "SELL", price?: number) => PriceRange | undefined; type TPSLComputedData = { /** * Computed take profit */ tp_pnl: number; tp_offset: number; tp_offset_percentage: number; /** * Computed stop loss */ sl_pnl: number; sl_offset: number; sl_offset_percentage: number; }; type ComputedAlgoOrder = Partial & TPSLComputedData>; type ValidateError = { [P in keyof ComputedAlgoOrder]?: OrderValidationItem; }; /** * @hidden */ declare const useTaskProfitAndStopLossInternal: (position: Partial & Pick, options?: { defaultOrder?: API.AlgoOrder; /** * If the order is editing, set to true * if the isEditing is true, the defaultOrder must be provided * Conversely, even if defaultOrder is provided and isEditing is false, a new TPSL order is still created */ isEditing?: boolean; positionType?: PositionType; }) => [ /** * return the computed & formatted order */ ComputedAlgoOrder, { /** * Update the take profit and stop loss order, this will merge the new data with the old one */ setValue: (key: string, value: number | string | boolean) => void; setValues: (values: Partial) => void; /** * Submit the TP/SL order */ submit: (params?: { accountId?: string; }) => Promise; deleteOrder: (orderId: number, symbol: string) => Promise; errors: ValidateError | null; /** * */ validate: (otherErrors?: ValidateError) => Promise>; metaState: { dirty: { [K in keyof OrderlyOrder]?: boolean; }; submitted: boolean; validated: boolean; errors: ValidateError | null; }; isCreateMutating: boolean; isUpdateMutating: boolean; }]; declare const useTPSLOrder: ( /** * Position that needs to set take profit and stop loss */ position: Partial & Pick, options?: { /** * You can set the default value for the take profit and stop loss order, * it is usually used when editing order */ defaultOrder?: API.AlgoOrder; isEditing?: boolean; positionType?: PositionType; }) => ReturnType; /** * A custom hook that calculates the maximum allowed leverage for a given trading pair symbol. * * The final leverage is determined by taking the minimum value between the account's maximum * leverage and the symbol's maximum leverage. * * @param symbol - Trading pair symbol (e.g. "PERP_BTC_USDC") * @returns The maximum allowed leverage as a number, or "-" if the leverage cannot be determined * * @example * ```typescript * const leverage = useMaxLeverage("PERP_BTC_USDC"); * console.log(`Maximum leverage for PERP_BTC_USDC: ${leverage}x`); * ``` */ declare const useMaxLeverage: (symbol: string) => number; /** * A custom hook that calculates the maximum allowed leverage for a given trading pair symbol. * * The final leverage is determined by taking the minimum value between the account's maximum * leverage and the symbol's maximum leverage. * * @param symbol - Trading pair symbol (e.g. "PERP_BTC_USDC") * @returns The maximum allowed leverage as a number, or "-" if the leverage cannot be determined * * @example * ```typescript * const leverage = useMaxSymbolLeverage("PERP_BTC_USDC"); * console.log(`Maximum leverage for PERP_BTC_USDC: ${leverage}x`); * ``` */ declare const useSymbolLeverage: (symbol?: string) => { maxLeverage: number; update: (data: { leverage: number; symbol: string; margin_mode?: MarginMode; }) => Promise; isLoading: boolean; }; /** * A hook to fetch and subscribe to leverage for a given trading symbol. * It initially fetches the leverage data via a private query and then listens for real-time * updates through a WebSocket subscription to keep the leverage value current. * * @param symbol - The trading symbol (e.g. "PERP_BTC_USDC") * @param marginMode - Optional margin mode (CROSS or ISOLATED). If not provided, defaults to CROSS. * @returns The current leverage value associated with the symbol, or undefined if not available * * @example * ```typescript * const leverage = useLeverageBySymbol("PERP_BTC_USDC"); * const isolatedLeverage = useLeverageBySymbol("PERP_BTC_USDC", MarginMode.ISOLATED); * ``` */ declare const useLeverageBySymbol: (symbol?: string, marginMode?: MarginMode) => number | undefined; type AssetHistoryOptions = { /** token name you want to search */ token?: string; /** DEPOSIT、WITHDRAW, all */ side?: string; status?: AssetHistoryStatusEnum; /** start time in milliseconds */ startTime?: number; /** end time in milliseconds */ endTime?: number; page?: number; pageSize?: number; }; /** * Get asset history, including token deposits/withdrawals. * https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/private/get-asset-history#get-asset-history */ declare const useAssetsHistory: (options: AssetHistoryOptions, config?: { /** * should update when wallet changed, default is update */ shouldUpdateOnWalletChanged?: (data: any) => boolean; }) => readonly [readonly any[], { readonly meta: API.RecordsMeta | undefined; readonly isLoading: boolean; }]; type QueryParams = { startDate: string; endDate: string; page?: number; }; /** * Fetch statistics data, only support weekly/monthly/quarterly for now */ declare const useStatisticsDaily: (params: QueryParams, options?: { ignoreAggregation?: boolean; }) => readonly [readonly any[], { readonly aggregateValue: { vol: null; pnl: null; roi: null; } | { vol: number; pnl: number; roi: number; }; }]; type UserStatistics = { perp_trading_volume_last_24_hours?: number; perp_trading_volume_today?: number; }; declare const useUserStatistics: () => readonly [UserStatistics | null, { readonly isValidating: boolean; }]; type FundingSearchParams = { /** * Data range for the funding fee history * noted that the time stamp is a 13-digits timestamp * the first element is the start date and the second element is the end date * @default [Now subtract 3 months, Now] */ dataRange?: number[]; symbol?: string; page?: number; pageSize?: number; }; declare const useFundingFeeHistory: (params: FundingSearchParams, options?: SWRConfiguration) => readonly [(API.FundingFeeRow & { annual_rate: number; })[] | null, { readonly meta: API.RecordsMeta | undefined; readonly isLoading: boolean; readonly isValidating: boolean; }]; type DistributionSearchParams = { /** * Data range for the distribution history * noted that the time stamp is a 13-digits timestamp * the first element is the start date and the second element is the end date * @default [Now subtract 3 months, Now] */ dataRange?: number[]; type?: string; page: number; pageSize: number; }; declare const useDistributionHistory: (parmas: DistributionSearchParams) => readonly [(API.FundingFeeRow & { annual_rate: number; })[], { readonly meta: API.RecordsMeta | undefined; readonly isLoading: boolean; readonly isValidating: boolean; }]; interface TransferHistorySearchParams$1 { dataRange?: number[]; page: number; size: number; fromId?: string; toId?: string; side: "IN" | "OUT"; /** * If True, return only internal transfers between main account and sub-accounts. * If False, return only internal transfers between main account and other main accounts. * If empty, return all transfer history. * @default true */ main_sub_only?: boolean; } declare const useTransferHistory: (parmas: TransferHistorySearchParams$1) => readonly [API.TransferHistoryRow[], { readonly meta: API.RecordsMeta | undefined; readonly isLoading: boolean; readonly mutate: swr.KeyedMutator; }]; interface TransferHistorySearchParams { dataRange?: number[]; page: number; size: number; } declare const useVaultsHistory: (parmas: TransferHistorySearchParams) => (API.StrategyVaultHistoryRow[] | { meta: API.RecordsMeta | undefined; isLoading: boolean; mutate: swr.KeyedMutator; })[]; /** 0 for nothing, 2 for maintenance */ declare enum MaintenanceStatus { None = 0, Maintenance = 2 } declare const useMaintenanceStatus: () => { status: number; brokerName: string; startTime: number | undefined; endTime: number | undefined; }; declare const useMarkPriceBySymbol: (symbol: string) => number; type PositionActions = { setPositions: (key: string, positions: API.PositionsTPSLExt) => void; clearAll: () => void; closePosition: (symbol: string) => void; }; declare const usePositions: (symbol?: string) => API.PositionTPSLExt[] | null; declare const usePositionActions: () => PositionActions; declare const useStorageLedgerAddress: () => { setLedgerAddress: (this: unknown, address: string) => void; setManualLedgerAddress: (this: unknown, address: string, adapterName: string) => void; clearManualLedgerAddress: (this: unknown, address: string, adapterName: string) => void; syncLedgerAddress: (this: unknown, address: string, adapterName: string) => void; ledgerWallet: string[]; }; /** * return all tokens info */ declare const useTokensInfo: (networkId?: NetworkId) => _orderly_network_types.API.Token[] | null | undefined; /** * return token info by specify token */ declare const useTokenInfo: (token: string, networkId?: NetworkId) => _orderly_network_types.API.Token | undefined; type AppStatus = { positionsLoading: boolean; ordersLoading: boolean; fundingRatesLoading: boolean; ready: boolean; }; type Portfolio$1 = { holding?: API.Holding[]; totalCollateral: Decimal; freeCollateral: Decimal; freeCollateralUSDCOnly: Decimal; totalValue: Decimal | null; availableBalance: number; unsettledPnL: number; totalUnrealizedROI: number; usdcHolding: number; }; type AppState = { accountInfo?: API.AccountInfo; symbolsInfo?: Record; tokensInfo?: API.Token[]; rwaSymbolsInfo?: Record; fundingRates?: Record; portfolio: Portfolio$1; appState: AppStatus; }; type AppActions = { cleanAll: () => void; setAccountInfo: (accountInfo: API.AccountInfo) => void; setTokensInfo: (tokensInfo: API.Token[]) => void; setSymbolsInfo: (symbolsInfo: Record) => void; setRwaSymbolsInfo: (rwaSymbolsInfo: Record) => void; setFundingRates: (fundingRates: Record) => void; updateAppStatus: (key: keyof AppStatus, value: boolean) => void; updatePortfolio: (key: keyof Omit, value: number | Decimal) => void; batchUpdateForPortfolio: (data: Partial) => void; restoreHolding: (holding: API.Holding[]) => void; updateHolding: (msg: Record) => void; }; /** * @warning This store should be used with caution. It contains sensitive account and portfolio data. * Please ensure you have proper authorization and follow security best practices when using this store. * * @example * // Correct usage: * const accountInfo = useAppStore(state => state.accountInfo); * * // Avoid direct store manipulation: * const store = useAppStore.getState(); // Not recommended */ declare const useAppStore: zustand.UseBoundStore, "setState"> & { setState(nextStateOrUpdater: (AppState & { actions: AppActions; }) | Partial | ((state: immer.WritableDraft) => void), shouldReplace?: boolean | undefined): void; }>; declare const usePortfolio: () => Portfolio$1; declare const useFundingRateBySymbol: (symbol: string) => API.FundingRate | undefined; /** Static mainnet chain_info used when broker API data is unavailable. */ declare const mainnetChainFallback: API.Chain[]; /** Static testnet chain_info used when broker API data is unavailable. */ declare const testnetChainFallback: API.Chain[]; type DataOrigin = "broker" | "generic" | "fallback" | null; /** * Generic store state for data fetching */ interface DataStoreState { data: T[] | null; /** * Provenance and authority level of `data`: * - `"broker"`: fetched with broker context (broker_id, incl. default "orderly") — highest authority * - `"generic"`: fetched without broker context — cannot downgrade broker data * - `"fallback"`: static bundled fallback, never persisted * - `null`: no usable data yet * * Authority is sticky for the lifetime of the page: once broker data has * been committed, calls without a broker id reuse it instead of refetching. * Data stores have no automatic refetch — data refreshes only when a caller * invokes fetchData again. */ dataOrigin: DataOrigin; loading: boolean; error: Error | null; name: string; /** Whether the store has been hydrated from IndexedDB */ hydrated: boolean; } /** * Generic store actions for data fetching */ interface DataStoreActions { fetchData: (baseUrl?: string, options?: { brokerId?: string; }) => Promise; setHydrated: (hydrated: boolean) => void; } declare const useMainnetChainsStore: zustand.UseBoundStore & DataStoreActions>, "persist"> & { persist: { setOptions: (options: Partial & DataStoreActions, T>>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: DataStoreState & DataStoreActions) => void) => () => void; onFinishHydration: (fn: (state: DataStoreState & DataStoreActions) => void) => () => void; getOptions: () => Partial & DataStoreActions, T>>; }; }>; declare const useTestnetChainsStore: zustand.UseBoundStore & DataStoreActions>, "persist"> & { persist: { setOptions: (options: Partial & DataStoreActions, T>>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: DataStoreState & DataStoreActions) => void) => () => void; onFinishHydration: (fn: (state: DataStoreState & DataStoreActions) => void) => () => void; getOptions: () => Partial & DataStoreActions, T>>; }; }>; declare const useMainTokenStore: zustand.UseBoundStore & DataStoreActions>, "persist"> & { persist: { setOptions: (options: Partial & DataStoreActions, T>>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: DataStoreState & DataStoreActions) => void) => () => void; onFinishHydration: (fn: (state: DataStoreState & DataStoreActions) => void) => () => void; getOptions: () => Partial & DataStoreActions, T>>; }; }>; declare const useTestTokenStore: zustand.UseBoundStore & DataStoreActions>, "persist"> & { persist: { setOptions: (options: Partial & DataStoreActions, T>>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: DataStoreState & DataStoreActions) => void) => () => void; onFinishHydration: (fn: (state: DataStoreState & DataStoreActions) => void) => () => void; getOptions: () => Partial & DataStoreActions, T>>; }; }>; type SwapSupport = { data: Record | null; loading: boolean; error: Error | null; }; type SwapSupportActions = { fetchData: () => Promise | null>; }; declare const useSwapSupportStore: zustand.UseBoundStore, "persist"> & { persist: { setOptions: (options: Partial | null; }>>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: SwapSupport & SwapSupportActions) => void) => () => void; onFinishHydration: (fn: (state: SwapSupport & SwapSupportActions) => void) => () => void; getOptions: () => Partial | null; }>>; }; }>; type UseOrderEntryOptions = { commify?: boolean; watchOrderbook?: boolean; validate?: (data: OrderEntity) => { [P in keyof OrderEntity]?: string; } | null | undefined; }; type UseOrderEntryMetaState = { errors: { [P in keyof OrderEntity]?: { type: string; message: string; }; } | null | undefined; dirty: { [P in keyof OrderEntity]?: boolean; } | null | undefined; submitted: boolean; }; type UseOrderEntryReturn = { maxQty: number; freeCollateral: number; markPrice: number; estLiqPrice?: number | null; estLeverage?: number | null; onSubmit: (order: OrderEntity) => Promise; submit: () => Promise; submitting: boolean; formattedOrder: Partial; helper: { calculate: (values: Partial, field: keyof OrderEntity, value: any) => Partial; validator: (values: Partial) => any; }; metaState: UseOrderEntryMetaState; symbolConfig: API.SymbolExt; }; type OrderParams = Required> & Partial>; /** * Create Order * @example * ```tsx * import { useOrderEntry } from "@orderly.network/hooks"; * import {OrderSide, OrderType} from '@orderly.network/types'; * * const { formattedOrder, onSubmit, helper } = useOrderEntry({ * symbol: "PERP_ETH_USDC", * side: OrderSide.BUY, * order_type: OrderType.LIMIT, * order_price: 10000, * order_quantity: 1, * },{ * // **Note:** it's required * watchOrderbook: true, * }); * ``` */ declare function useOrderEntry$1(order: OrderParams, options?: UseOrderEntryOptions): UseOrderEntryReturn; /** * @deprecated */ declare function useOrderEntry$1(symbol: string, side: OrderSide, reduceOnly: boolean): UseOrderEntryReturn; declare function useMediaQuery(query: string): boolean; declare function getSymbolBase(symbol: string | undefined): string; declare function getSymbolDisplayName(symbol: string | undefined, displaySymbolName?: string | null): string; interface UseBadgeBySymbolReturn { /** Display name of the symbol. API.display_symbol_name */ displaySymbolName: string; /** Broker ID of the symbol. */ brokerId: string | undefined; /** Badge label: first segment of raw name, truncated to 7 chars with "...". */ brokerName: string | undefined; /** Raw broker name as provided by the API. */ brokerNameRaw: string | undefined; } /** * Match the given `symbol` in `symbolsInfo` and return `displaySymbolName`, * `brokerId`, and the mapped `brokerName`. * * `brokerName` comes from the `/v1/public/broker/name` broker list * (SWR shared cache). */ declare const useBadgeBySymbol: (symbol: string) => UseBadgeBySymbolReturn; /** * Same rules as {@link useSymbolWithBroker}, for use in callbacks / non-React code paths. */ declare function formatSymbolWithBroker(symbol: string, symbolsInfo: { isNil?: boolean; [key: string]: unknown; }, brokers: Record | undefined): string; /** * Short market label: `base`, or `base-{brokerNameBase}` when the symbol is broker-scoped and a broker * name is available from symbols info + broker list. * * Symbol shape: `type_base_quote` with optional trailing `_broker_id` segments (broker_id may * contain underscores, e.g. `orderly`). Otherwise falls back to a leading letter run for legacy * compact symbols. */ declare const useSymbolWithBroker: (symbol: string) => string; type posterDataSource = { /** * slogan of the poster */ message?: string; position: { symbol: string; brokerName?: string; side: "LONG" | "SHORT"; marginMode?: MarginMode; /** * The leverage of the position */ leverage: number; /** * The unrealized PnL of the position */ pnl: number; /** * The return on investment of the position */ ROI: number; /** * The informations of the position, such as open price, opened at, mark price, quantity and custom message. */ informations: { title: string; value: string; }[]; /** * The quote currency of the position */ currency: string; }; /** * The domain of the application */ domain: string; /** * The update time of the position */ updateTime: string; referral?: { code: string; slogan: string; link: string; } | null; }; type layoutInfo = { width?: number; height?: number; fontSize?: number; color?: string; textAlign?: CanvasTextAlign; textBaseline?: CanvasTextBaseline; position: Partial<{ left: number; right: number; top: number; bottom: number; }>; }; type PosterLayoutConfig = { message?: layoutInfo; domain?: layoutInfo; position?: layoutInfo; unrealizedPnl?: layoutInfo & { secondaryColor: string; secondaryFontSize: number; }; informations?: layoutInfo & { labelColor?: string; }; updateTime?: layoutInfo; }; type DrawOptions = { direction?: "ltr" | "rtl"; /** * Color of common text */ color?: string; fontFamily?: string; /** * Lose color */ lossColor?: string; /** * Profit color */ profitColor?: string; /** * The brand color of the application */ brandColor?: string; backgroundColor?: string; backgroundImg?: string; data?: posterDataSource; layout?: PosterLayoutConfig; }; /** * Generates a poster image based on position information. You can set the size, background color, font color, font size, and content position of the poster. * @example * ```tsx * const { ref, toDataURL, toBlob, download, copy } = usePoster({ * backgroundColor: "#0b8c70", * backgroundImg: "/images/poster_bg.png", * color: "rgba(255, 255, 255, 0.98)", * profitColor: "rgb(0,181,159)", * // ... * }); * ``` */ declare const usePoster: ( /** * The options to draw the poster */ data: DrawOptions, options?: { /** * The ratio of the poster */ ratio?: number; }) => { readonly error: Error | null; /** * The ref to the canvas element, you should pass this ref to the canvas element */ readonly ref: (ref: HTMLCanvasElement | null) => void; /** * Converts the poster to a data URL */ readonly toDataURL: (type?: string, encoderOptions?: number) => string; /** * Converts the poster to a blob */ readonly toBlob: (type?: string, encoderOptions?: number) => Promise; /** * Downloads the poster as an image */ readonly download: (filename: string, type?: string, encoderOptions?: number) => void; /** * Browser if supports copy image to clipboard */ readonly canCopy: boolean; readonly copy: () => Promise; }; declare const DefaultLayoutConfig: PosterLayoutConfig; type FullOrderState = OrderlyOrder; type OrderEntryStateEntity = RequireKeys; type OrderEntryState = { entry: OrderEntryStateEntity; estLeverage: number | null; estLiquidationPrice: number | null; errors: Partial>; }; type OrderEntryActions = { /** Initializes order state (e.g. when switching symbol). Resets computed values and errors. */ initOrder: (symbol: string, options?: { side?: OrderSide; order_type?: OrderType; margin_mode?: MarginMode; }) => void; updateOrder: (order: Partial) => void; updateOrderByKey: (key: K, value: FullOrderState[K]) => void; restoreOrder: (order?: Partial) => void; updateOrderComputed: (data: { estLeverage: number | null; estLiquidationPrice: number | null; }) => void; resetOrder: (order?: Partial) => void; hasTP_SL: () => boolean; }; declare const useOrderStore: zustand.UseBoundStore, "setState"> & { setState(nextStateOrUpdater: (OrderEntryState & { actions: OrderEntryActions; }) | Partial | ((state: immer.WritableDraft) => void), shouldReplace?: boolean | undefined): void; }>; declare const cleanStringStyle: (str: string | number) => string; /** * format number * TODO: refactor this */ declare function formatNumber(qty?: string | number, dp?: number | string): string | undefined; declare function calculate(values: Partial, fieldName: keyof FullOrderState, value: any, markPrice: number, config: API.SymbolExt): Partial; /** * get the min notional for the order */ declare function getMinNotional(props: { base_tick?: number; price?: string | number; qty?: string | number; min_notional?: number; quote_dp?: number; base_dp?: number; quote_tick?: number; }): string | undefined; /** * @deprecated please use getMinNotional instead, it will be removed in next major version */ declare function checkNotional(props: { base_tick: number; price?: string | number; qty?: string | number; min_notional?: number; quote_dp?: number; base_dp?: number; quote_tick?: number; }): string | undefined; declare function getPositionBySymbol(symbol: string): void; /** * TP/SL price -> pnl * @price trigger_price * @entryPrice calculate price, maybe markPrice/limitPrice/order.price */ declare function priceToPnl(inputs: { qty: number; price: number; entryPrice: number; orderSide: OrderSide; orderType: AlgoOrderType; }, options?: { symbol?: Pick; }): number; /** @deprecated use priceToROI instead */ declare function calcTPSL_ROI(inputs: { pnl: number | string; qty: number | string; price: number | string; }): string; declare const index_calcTPSL_ROI: typeof calcTPSL_ROI; declare const index_cleanStringStyle: typeof cleanStringStyle; declare const index_fetcher: typeof fetcher; declare const index_findPositionTPSLFromOrders: typeof findPositionTPSLFromOrders; declare const index_findTPSLFromOrder: typeof findTPSLFromOrder; declare const index_findTPSLOrderPriceFromOrder: typeof findTPSLOrderPriceFromOrder; declare const index_formatNumber: typeof formatNumber; declare const index_getPositionBySymbol: typeof getPositionBySymbol; declare const index_noCacheConfig: typeof noCacheConfig; declare const index_priceToPnl: typeof priceToPnl; type index_useQueryOptions = useQueryOptions; declare namespace index { export { index_calcTPSL_ROI as calcTPSL_ROI, index_cleanStringStyle as cleanStringStyle, index_fetcher as fetcher, index_findPositionTPSLFromOrders as findPositionTPSLFromOrders, index_findTPSLFromOrder as findTPSLFromOrder, index_findTPSLOrderPriceFromOrder as findTPSLOrderPriceFromOrder, index_formatNumber as formatNumber, index_getPositionBySymbol as getPositionBySymbol, index_noCacheConfig as noCacheConfig, index_priceToPnl as priceToPnl, type index_useQueryOptions as useQueryOptions }; } declare enum TWType { normal = "normal", mm = "mm" } type EpochInfoItem = { epoch_id: number; start_time: number; end_time: number; epoch_token: string; max_reward_amount: number; }; type EpochInfoType = [ data: EpochInfoItem[] | undefined, { isLoading: boolean; curEpochInfo: EpochInfoItem | undefined; isNotStared: boolean; refresh: () => void; } ]; declare const useEpochInfo: (type: TWType) => EpochInfoType; type Brokers = { [key: string]: string; }; /** get all brokers, will be callback a list */ declare const useAllBrokers: () => readonly [Brokers | undefined]; type CurrentEpochEstimateRow = { broker_id: string; est_r_account: number; broker_name: string; }; type CurrentEpochEstimate = { est_r_wallet: string; est_stake_boost?: number; est_avg_stake?: number; est_trading_volume: number; rows: CurrentEpochEstimateRow[]; }; declare const useCurEpochEstimate: (type: TWType) => readonly [CurrentEpochEstimate | undefined]; type AccountRewardsHistoryRow = { broker_id: string; wallet_epoch_avg_staked?: number; trader_score_major?: number; trader_score_alts?: number; epoch_token?: string; reward_status?: string; r_major?: number; r_alts?: number; r_account?: number; broker_name?: string; }; type AccountRewardsHistory = { epoch_id: number; broker: AccountRewardsHistoryRow[]; }; declare const useAccountRewardsHistory: (address?: string) => { data: AccountRewardsHistory[] | undefined; }; declare enum DistributionId { order = 0, esORder = 1, mmOrder = 2, mmEsOrder = 3 } declare const useGetClaimed: (id: DistributionId) => [number | undefined, { refresh: () => void; }]; type WalletRewardsItem = { epoch_id: number; wallet_epoch_avg_staked: number; epoch_token: string; max_reward_amount: number; reward_status: string; r_wallet: number; }; type WalletRewards = { wallet_lifetime_trading_rewards_order: string; wallet_lifetime_trading_rewards_escrow: string; wallet_pending_trading_rewards_order: string; wallet_pending_trading_rewards_escrow: string; rows: WalletRewardsItem[]; }; type WalletRewardsHistoryReturns = [ WalletRewards | undefined, { refresh: () => void; error?: any; } ]; declare const useWalletRewardsHistory: (type: TWType) => WalletRewardsHistoryReturns; declare enum EpochStatus { active = "Active", paused = "Paused", ended = "Ended" } type StatusInfo = { epochStatus: EpochStatus; currentEpoch: number | undefined; lastCompletedEpoch: number | undefined; }; declare function useTradingRewardsStatus(isMMRewards: boolean): { statusInfo: StatusInfo | undefined; }; declare enum ENVType { prod = "prod", staging = "staging", qa = "qa", dev = "dev" } /** * env is determined by networkId and env * | networkId | env | retrurn | * |-----------|---------|----------| * | mainnet | noset | prod | * | mainnet | prod | prod | * | mainnet | staging | prod | * | mainnet | qa | prod | * | mainnet | dev | prod | * | testnet | noset | staging | * | testnet | prod | staging | * | testnet | staging | staging | * | testnet | qa | qa | * | testnet | dev | dev | * if env is not set, return staging * * @returns {ENVType} */ declare const useGetEnv: () => ENVType; type APIKeyItem = { orderly_key: string; key_status: string; ip_restriction_list: string[]; ip_restricion_status: string; expiration: number; tag?: any; scope?: string; }; declare enum ScopeType { trade = "trade", trading = "trading", tradeAndTrading = "trade,trading" } declare const useApiKeyManager: (queryParams?: { keyInfo?: { page?: number; size?: number; key_status?: string; }; }) => readonly [APIKeyItem[] | undefined, { readonly refresh: swr.KeyedMutator; readonly error: any; readonly isLoading: boolean; readonly generateOrderlyKey: (scope?: ScopeType) => Promise<{ key: string; secretKey: string; }>; readonly setIPRestriction: (orderly_key: string, ip_restriction_list: string) => Promise; readonly removeOrderlyKey: (orderly_key: string) => Promise; readonly resetOrderlyKeyIPRestriction: (orderlyKey: string, mode: "ALLOW_ALL_IPS" | "DISALLOW_ALL_IPS") => Promise; }]; interface StoreConfig { name: string; keyPath?: string; autoIncrement?: boolean; } interface DatabaseConfig { name: string; version: number; stores: StoreConfig[]; } declare class IndexedDBManager { private static instance; private connections; private databaseConfig; /** Promise that resolves when database initialization is complete */ private initializationPromise; static getInstance(): IndexedDBManager; initializeDatabase(config: DatabaseConfig): Promise; /** * Performs the actual database initialization * Now keeps the connection open for better performance */ private _performInitialization; /** * Handles initialization errors consistently */ private _handleInitializationError; getConnection(dbName: string, storeName: string): Promise; /** * Ensures database is initialized, initializes if not already done */ private ensureInitialized; /** * Creates a new database connection */ private createConnection; /** * Checks if database and all required stores exist */ private _checkDatabaseExists; } declare const indexedDBManager: IndexedDBManager; declare const initializeAppDatabase: (config: DatabaseConfig) => Promise; /** * Configuration for IndexedDB storage */ interface IndexedDBMetadataConfig { /** * Object-store keyPath used by the reserved metadata record. The metadata * record lives in the SAME object store as the data rows under the * reserved `recordKey`: any code reading this store directly must filter * it out (see readAttributedIndexedDBState). Data-store sanitizers also * drop it as an invalid row as a safety net. */ keyPath: string; /** Reserved key that cannot collide with a real data row. */ recordKey: string; /** Field containing the metadata payload. */ metadataField: string; } interface IndexedDBStorageConfig { /** Database name */ dbName: string; /** Object store name */ storeName: string; /** Optional metadata record stored atomically with the data rows. */ metadata?: IndexedDBMetadataConfig; } /** * Configuration options for IndexedDB persistence middleware */ type IndexedDBPersistOptions = Omit, "storage"> & { /** IndexedDB configuration */ indexedDBConfig: IndexedDBStorageConfig; }; /** * Creates a Zustand store with IndexedDB persistence * * @param initializer - The state creator function * @param options - Persistence options including IndexedDB configuration * @returns A state creator with IndexedDB persistence middleware applied * * @example * ```typescript * const useStore = create( * persistIndexedDB( * (set) => ({ * items: [], * addItem: (item) => set((state) => ({ items: [...state.items, item] })), * }), * { * name: 'my-store', * indexedDBConfig: { * dbName: 'ORDERLY_STORE', * storeName: 'ITEMS_STORE', * }, * } * ) * ); * ``` */ declare const persistIndexedDB: (initializer: StateCreator, options: IndexedDBPersistOptions) => StateCreator; declare const useOrderEntryNextInternal: (symbol: string, options?: { /** * initial order state, default is buy limit order * */ initialOrder?: Omit, "symbol">; symbolInfo?: API.SymbolExt; symbolLeverage?: number; }) => { readonly formattedOrder: OrderlyOrder; readonly setValue: (key: keyof FullOrderState, value: any, additional?: { markPrice: number; }) => Partial | undefined; readonly setValues: (values: Partial, additional?: { markPrice: number; }) => Partial | undefined; readonly setValuesRaw: (values: Partial) => Partial | undefined; readonly submit: () => void; readonly reset: (order?: Partial) => void; readonly generateOrder: (creator: OrderCreator, options: { maxQty: number; markPrice: number; estSlippage?: number | null; askAndBid?: number[]; }) => any; readonly validate: (order: Partial, creator: OrderCreator, options: { maxQty: number; markPrice: number; estSlippage?: number | null; askAndBid?: number[]; }) => Promise<{ [x: string]: OrderValidationItem | undefined; }>; readonly onMarkPriceChange: (markPrice: number, baseOn?: string[]) => void; }; type OrderEntryParameters = Parameters; type Options$1 = Omit; type SubmitOrderOptions = { resetOnSuccess?: boolean; /** * Server-configured USDC borrow limit (`negative_usdc_threshold`). When * omitted or unavailable (loading/failed request), the guard falls back to * DEFAULT_USDC_BORROW_LIMIT (50,000) instead of being skipped. */ usdcBorrowLimit?: number; }; type OrderEntryReturn = { submit: (options?: SubmitOrderOptions) => Promise<{ success: boolean; data: Record; timestamp: number; }>; reset: () => void; resetErrors: () => void; resetMetaState: () => void; formattedOrder: Partial; maxQty: number; maxQtys: { maxBuy: number; maxSell: number; }; /** * The estimated liquidation price. */ estLiqPrice: number | null; /** * Current position quantity for the symbol (signed: positive=Long, negative=Short). */ currentPosition: number; /** * The estimated liquidation price distance. */ estLiqPriceDistance: number | null; /** * The estimated leverage after order creation. */ estLeverage: number | null; estSlippage: number | null; helper: { /** * @deprecated Use `validate` instead. */ validator: () => Promise; /** * Function to validate the order. * @returns {Promise} The validation result. */ validate: (otherErrors?: OrderValidationResult) => Promise; getProjectedUSDCBorrow: (order: Partial) => number | null; }; freeCollateral: number; /** * set a single value to the order data; * @param key * @param value * @returns */ setValue: (key: keyof FullOrderState, value: any, options?: { shouldUpdateLastChangedField?: boolean; }) => void; setValues: (values: Partial) => void; /** * Raw merge setter for externally computed bundles (e.g. Advanced TPSL). * * Unlike `setValues`, this intentionally skips `calculate()` to avoid overwriting computed TPSL fields. */ setValuesRaw: (values: Partial) => void; symbolInfo: API.SymbolExt; /** * Meta state including validation and submission status. */ metaState: { dirty: { [K in keyof OrderlyOrder]?: boolean; }; submitted: boolean; validated: boolean; errors: OrderValidationResult | null; }; /** * Indicates if a mutation (order creation) is in progress. */ isMutating: boolean; markPrice?: number; symbolLeverage?: number; }; /** * Custom hook for managing order entry in the Orderly application. * * @param {string} symbol - The symbol for which the order is being created. This parameter is required. * * @param {Options} options - Additional options for configuring the order entry. * * @returns {OrderEntryReturn} An object containing various actions and state related to order entry. * * @throws {Error} Throws an error if the symbol is not provided or is not a string. * * @example * ```typescript * const { * submit, * formattedOrder, // * setValue, * setValues, * symbolInfo, * metaState, * isMutating, * // maxQty, freeCollateral ... same as v1 * } = useOrderEntry('BTC_USDC_PERP', options); * * // update the order type * setValue('order_type', OrderType.LIMIT); * // update the order price * setValue('order_price', '70000'); * // update the order quantity * setValue('order_quantity', 1); * * // how to set TP/SL * setValue('tp_trigger_price', '71000'); // directly set TP trigger price * // or set the tp pnl, the TP trigger price will be calculated based on the current order price * // setValue('tp_pnl', '300'); // you can also set tp_offset or tp_offset_percentage, same as the usage of useTPSL hook; * // SL is similar to TP setting * setValue('sl_price', '69000'); * * // Submit the order data to the backend, and reset the hook state after the order is successfully created. * // Note: If the order data is invalid, an error will be thrown. * // If you want to retain the current order data after a successful order creation, * // you can pass {resetOnSuccess: false} to `submit` function to prevent the hook from automatically resetting the order status. * // Of course, you can also call `reset()` to manually reset the order status and use `resetMetaState()` to clear the error state. * await submit(); * ``` */ declare const useOrderEntry: (symbol: string, options?: Options$1) => OrderEntryReturn; declare const DEFAULT_USDC_BORROW_LIMIT = 50000; declare class USDCBorrowLimitExceededError extends Error { readonly projectedBorrow: number; readonly borrowLimit: number; constructor(projectedBorrow: number, borrowLimit: number); } /** * The backend returns `negative_usdc_threshold` as a positive number (e.g. 50000). * Missing, non-finite, or signed values fall back to a normalized positive limit * so the submission guard always compares against a concrete number. */ declare const normalizeUSDCBorrowLimit: (value: number | null | undefined) => number; declare const useOrderEntity: (order: { symbol: string; order_type: OrderType; side: OrderSide; reduce_only?: boolean; [key: string]: any; }, options?: { maxQty?: number; }) => { errors: OrderValidationResult; markPrice: number; symbolsInfo: Record(key: Key, defaultValue?: _orderly_network_types.API.SymbolExt[Key] | undefined) => _orderly_network_types.API.SymbolExt[Key]> & Record _orderly_network_types.API.SymbolExt> & { isNil: boolean; }; validate: (this: unknown) => Promise; clearErrors: () => void; }; type RestrictedInfoReturns = ReturnType; interface RestrictedInfoOptions { enableDefault?: boolean; customRestrictedIps?: string[]; customRestrictedRegions?: string[]; customUnblockRegions?: string[]; content?: ReactNode | ((data: { ip: string; brokerName: string; }) => ReactNode); } declare const useRestrictedInfo: (options?: RestrictedInfoOptions) => { ip: string; invalidRegions: string[]; restrictedOpen: boolean; content: ReactNode | ((data: { ip: string; brokerName: string; }) => ReactNode); canUnblock: boolean; accessRestricted: any; setAccessRestricted: (value: boolean | undefined) => void; }; type QueryOptions = SWRConfiguration & { formatter?: (data: any) => T; accountId?: string; }; declare function useSubAccountQuery(query: Parameters[0], options?: QueryOptions): SWRResponse; type HTTP_METHOD = "POST" | "PUT" | "DELETE" | "GET"; type SubAccountMutationOptions = SWRMutationConfiguration & { /** sub account id */ accountId?: string; }; /** * This hook is used to execute API requests for data mutation, such as POST, DELETE, PUT, etc. */ declare const useSubAccountMutation: ( /** * The URL to send the request to. If the URL does not start with "http", * it will be prefixed with the API base URL. */ url: string, /** * The HTTP method to use for the request. Defaults to "POST". */ method?: HTTP_METHOD, /** * The configuration object for the mutation. * @see [useSWRMutation](https://swr.vercel.app/docs/mutation#api) * * @link https://swr.vercel.app/docs/mutation#api */ options?: SubAccountMutationOptions) => readonly [(this: unknown, data: Record | null, params?: Record | undefined, options?: SubAccountMutationOptions | undefined) => Promise, { readonly data: any; readonly error: any; readonly reset: () => void; readonly isMutating: boolean; }]; type Portfolio = { holding?: API.Holding[]; totalCollateral: Decimal; freeCollateral: Decimal; freeCollateralUSDCOnly: Decimal; totalValue: Decimal | null; availableBalance: number; unsettledPnL: number; totalUnrealizedROI: number; }; declare const useSubAccountDataObserver: (accountId?: string) => { portfolio: Portfolio | undefined; positions: API.PositionsTPSLExt; }; type Options = { accountId?: string; }; declare const useSubAccountWS: (options: Options) => WS; /** * The max withdrawal amount for the token * if token is not provided, return the max withdrawal amount for USDC */ declare function useSubAccountMaxWithdrawal(options: { token?: string; unsettledPnL?: number; freeCollateral: Decimal; holdings?: API.Holding[]; }): number; type PositionCloseOptions = { position: API.PositionExt; order: { type: OrderType; quantity: string; price: string; }; }; declare const usePositionClose: (options: PositionCloseOptions) => { submit: () => Promise; isMutating: boolean; side: OrderSide; closeOrderData: Partial; errors: OrderValidationResult | null; calculate: typeof calculate; }; declare const useMarketList: () => API.MarketInfoExt[]; declare const useMarketMap: () => Record | null; type TpslPriceParams = { warning_threshold?: number; slPrice?: string; liqPrice: number | null; side?: OrderSide; /** * Mark price for the symbol. When set with `side`, liq values that `useGetEstLiqPrice` would * hide (invalid vs mark — e.g. long est. liq above mark) are ignored here too so SL checks do * not run against a number the UI does not show as “Est. liq. price”. */ markPrice?: number | null; /** Current position qty (signed: positive=Long, negative=Short). If missing, treated as is_reducing=true, skip liq check. */ currentPosition?: number; /** Order quantity (non-negative, sign derived from side). If missing or 0, treated as is_reducing=true, skip liq check. */ orderQuantity?: number; }; declare const useTpslPriceChecker: (params: TpslPriceParams) => OrderValidationResult | null; declare const ERROR_MSG_CODES: { SL_PRICE_WARNING: number; SL_PRICE_ERROR: number; }; declare const useEstLiqPriceBySymbol: (symbol: string, marginMode: MarginMode) => number | undefined; declare const useGetEstLiqPrice: (props: { estLiqPrice: number | null; symbol: string; side: OrderSide; }) => number | null; /** * Feature flag keys enum */ declare enum FlagKeys { IsolatedMargin = "isolated-margin" } /** * Feature flag item from API response */ interface FeatureFlagItem { key: string; description: string; } /** * Return type for useFeatureFlag hook */ interface UseFeatureFlagReturn { enabled: boolean; data: FeatureFlagItem | undefined; } /** * Hook to check if a feature flag is enabled * * Logic: * 1. Hidden by default - returns false when loading * 2. In public but not in private, hidden - returns { enabled: false, data: undefined } * 3. In both public and private, shown - returns { enabled: true, data: FeatureFlagItem } * 4. Not in public, shown - returns { enabled: true, data: undefined } * * @param key - The feature flag key to check * @returns { enabled: boolean, data: FeatureFlagItem | undefined } */ declare const useFeatureFlag: (key: FlagKeys) => UseFeatureFlagReturn; 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 ConvertThresholdReturns, type CurrentEpochEstimate, type CustomMarketTab, DEFAULT_USDC_BORROW_LIMIT, 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, type GasEstimate, 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, REFERRAL_CODE_MAX_LENGTH, REFERRAL_CODE_MIN_LENGTH, type Recent, RefferalAPI, type RestrictedInfoOptions, type RestrictedInfoReturns, type RwaSymbolResult, type RwaSymbolsInfo, ScopeType, type StatusInfo, StatusProvider, type SubmitOrderOptions, type SwapQuoteData, type SwapQuoteError, type SwapQuoteRequest, type SwapQuoteResponse, type SwapQuoteToken, type SymbolsInfo, TESTNET_WHITE_CHAINS, TESTNET_WHITE_LIST, TWType, USDCBorrowLimitExceededError, 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, createTPSLOrderUpdates, fetcher, findPositionTPSLFromOrders, findTPSLFromOrder, findTPSLOrderPriceFromOrder, formatReferralCodeInput, formatSymbolWithBroker, getMinNotional, getPriceKey, getSymbolBase, getSymbolDisplayName, indexedDBManager, initializeAppDatabase, isCurrentlyClosed, isCurrentlyTrading, isReferralCodeLengthValid, isSwapQuoteData, mainnetChainFallback, noCacheConfig, normalizeUSDCBorrowLimit, parseJSON, persistIndexedDB, resetTimestampOffsetState, testnetChainFallback, timestampWaitingMiddleware, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAppStore, useAssetsHistory, useAudioPlayer, useBadgeBySymbol, useBalanceSubscription, useBalanceTopic, useBoolean, useChain, useChainInfo, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useConvertThreshold, 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, 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, useSwapQuote, 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 };