@orderly.network/hooks 2.5.3 → 2.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +82 -28
- package/dist/index.d.ts +82 -28
- package/dist/index.js +2179 -1560
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1888 -1275
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -7,9 +7,9 @@ import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
|
|
|
7
7
|
import * as swr_infinite from 'swr/infinite';
|
|
8
8
|
import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
|
|
9
9
|
import * as react from 'react';
|
|
10
|
-
import { PropsWithChildren, FC, ReactNode } from 'react';
|
|
10
|
+
import react__default, { PropsWithChildren, FC, ReactNode } from 'react';
|
|
11
11
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
12
|
-
import { NetworkId, TrackerEventName, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, OrderlyOrder,
|
|
12
|
+
import { NetworkId, TrackerEventName, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderType, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, OrderlyOrder, PositionType, AlgoOrderEntity, AssetHistoryStatusEnum, AlgoOrderType, RequireKeys } from '@orderly.network/types';
|
|
13
13
|
import * as _orderly_network_core from '@orderly.network/core';
|
|
14
14
|
import { AccountState, Account, EventEmitter, ConfigStore, ConfigKey, SimpleDI, OrderlyKeyStore, WalletAdapter, IContract, DefaultConfigStore } from '@orderly.network/core';
|
|
15
15
|
export { SubAccount, WalletAdapter } from '@orderly.network/core';
|
|
@@ -32,7 +32,7 @@ declare global {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
declare const _default: "2.
|
|
35
|
+
declare const _default: "2.6.0-alpha.0";
|
|
36
36
|
|
|
37
37
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
38
38
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
@@ -78,7 +78,7 @@ method?: HTTP_METHOD$1,
|
|
|
78
78
|
*
|
|
79
79
|
* @link https://swr.vercel.app/docs/mutation#api
|
|
80
80
|
*/
|
|
81
|
-
options?: SWRMutationConfiguration<T, E>) => readonly [(data: Record<string, any> | null, params?: Record<string, any
|
|
81
|
+
options?: SWRMutationConfiguration<T, E>) => readonly [(this: unknown, data: Record<string, any> | null, params?: Record<string, any> | undefined, options?: SWRMutationConfiguration<T, E> | undefined) => Promise<any>, {
|
|
82
82
|
readonly data: any;
|
|
83
83
|
readonly error: E | undefined;
|
|
84
84
|
readonly reset: () => void;
|
|
@@ -114,6 +114,26 @@ type noop = (this: any, ...args: any[]) => any;
|
|
|
114
114
|
type PickFunction<T extends noop> = (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T>;
|
|
115
115
|
declare const useMemoizedFn: <T extends noop>(fn: T) => PickFunction<T>;
|
|
116
116
|
|
|
117
|
+
interface AudioPlayerOptions {
|
|
118
|
+
volume?: number;
|
|
119
|
+
loop?: boolean;
|
|
120
|
+
autoPlay?: boolean;
|
|
121
|
+
}
|
|
122
|
+
declare const useAudioPlayer: (src: string, options?: AudioPlayerOptions) => readonly [react__default.DetailedReactHTMLElement<{
|
|
123
|
+
controls: boolean;
|
|
124
|
+
ref: react__default.MutableRefObject<HTMLAudioElement | null>;
|
|
125
|
+
autoPlay: boolean | undefined;
|
|
126
|
+
src: string;
|
|
127
|
+
style: {
|
|
128
|
+
display: "none";
|
|
129
|
+
};
|
|
130
|
+
onPlay: () => void;
|
|
131
|
+
onPlaying: () => void;
|
|
132
|
+
onPause: () => void;
|
|
133
|
+
onEnded: () => void;
|
|
134
|
+
onError: () => void;
|
|
135
|
+
}, HTMLAudioElement>, react__default.MutableRefObject<HTMLAudioElement | null>, "error" | "paused" | "idle" | "play" | "playing" | "ended"];
|
|
136
|
+
|
|
117
137
|
declare const useAccount: () => {
|
|
118
138
|
account: _orderly_network_core.Account;
|
|
119
139
|
state: AccountState;
|
|
@@ -258,11 +278,27 @@ interface OrderlyConfigContextState {
|
|
|
258
278
|
* Custom `/v1/public/futures` response data.
|
|
259
279
|
*/
|
|
260
280
|
symbolList?: (originalVal: API.MarketInfoExt[]) => any[];
|
|
281
|
+
/**
|
|
282
|
+
* custom `/v2/public/announcement` response data
|
|
283
|
+
*/
|
|
284
|
+
announcementList?: (data: any[]) => any[];
|
|
285
|
+
};
|
|
286
|
+
notification?: {
|
|
287
|
+
orderFilled?: {
|
|
288
|
+
/**
|
|
289
|
+
* Sound to play when an order is successful.
|
|
290
|
+
* @default ""
|
|
291
|
+
*/
|
|
292
|
+
media?: string;
|
|
293
|
+
};
|
|
261
294
|
};
|
|
262
295
|
}
|
|
263
296
|
declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
|
|
297
|
+
declare const useOrderlyContext: () => OrderlyConfigContextState;
|
|
264
298
|
declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
|
|
265
299
|
|
|
300
|
+
declare const StatusProvider: React.FC<PropsWithChildren>;
|
|
301
|
+
|
|
266
302
|
declare enum WsNetworkStatus {
|
|
267
303
|
Connected = "connected",
|
|
268
304
|
Unstable = "unstable",
|
|
@@ -270,12 +306,6 @@ declare enum WsNetworkStatus {
|
|
|
270
306
|
}
|
|
271
307
|
declare function useWsStatus(): WsNetworkStatus;
|
|
272
308
|
|
|
273
|
-
interface StatusContextState {
|
|
274
|
-
ws?: WsNetworkStatus;
|
|
275
|
-
}
|
|
276
|
-
declare const StatusContext: react.Context<StatusContextState>;
|
|
277
|
-
declare const StatusProvider: React.FC<PropsWithChildren>;
|
|
278
|
-
|
|
279
309
|
type filteredChains = {
|
|
280
310
|
mainnet?: Chain$1[];
|
|
281
311
|
testnet?: Chain$1[];
|
|
@@ -290,7 +320,7 @@ type BaseConfigProviderProps = {
|
|
|
290
320
|
* Custom orderbook default tick sizes.
|
|
291
321
|
*/
|
|
292
322
|
orderbookDefaultTickSizes?: Record<string, string>;
|
|
293
|
-
} & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer" | "dataAdapter">;
|
|
323
|
+
} & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer" | "dataAdapter" | "notification">;
|
|
294
324
|
type ExclusiveConfigProviderProps = {
|
|
295
325
|
brokerId: string;
|
|
296
326
|
brokerName?: string;
|
|
@@ -601,7 +631,7 @@ declare const useLeverage: () => {
|
|
|
601
631
|
readonly maxLeverage: number;
|
|
602
632
|
};
|
|
603
633
|
|
|
604
|
-
declare const useOdosQuote: () => readonly [(data: Record<string, any> | null, params?: Record<string, any
|
|
634
|
+
declare const useOdosQuote: () => readonly [(this: unknown, data: Record<string, any> | null, params?: Record<string, any> | undefined, options?: swr_mutation.SWRMutationConfiguration<unknown, unknown> | undefined) => Promise<any>, {
|
|
605
635
|
readonly data: any;
|
|
606
636
|
readonly error: unknown;
|
|
607
637
|
readonly reset: () => void;
|
|
@@ -640,9 +670,9 @@ declare const useFundingRatesStore: () => Record<string, API.FundingRate> | unde
|
|
|
640
670
|
|
|
641
671
|
type PeriodKey = "1d" | "3d" | "7d" | "14d" | "30d" | "90d";
|
|
642
672
|
declare const useFundingRateHistory: () => {
|
|
643
|
-
data:
|
|
673
|
+
data: readonly any[];
|
|
644
674
|
isLoading: boolean;
|
|
645
|
-
getPositiveRates: (data: API.FundingHistory[], period: PeriodKey) => Record<string, number>;
|
|
675
|
+
getPositiveRates: (data: ReadonlyArray<API.FundingHistory> | API.FundingHistory[], period: PeriodKey) => Record<string, number>;
|
|
646
676
|
};
|
|
647
677
|
|
|
648
678
|
type PriceMode = "markPrice" | "lastPrice";
|
|
@@ -672,6 +702,19 @@ symbol?: string, options?: SWRConfiguration & {
|
|
|
672
702
|
readonly isLoading: boolean;
|
|
673
703
|
}];
|
|
674
704
|
|
|
705
|
+
declare const findTPSLFromOrder: (order: API.AlgoOrder) => {
|
|
706
|
+
tp_trigger_price?: number;
|
|
707
|
+
sl_trigger_price?: number;
|
|
708
|
+
};
|
|
709
|
+
declare const findTPSLOrderPriceFromOrder: (order: API.AlgoOrder) => {
|
|
710
|
+
tp_order_price: OrderType | number | undefined;
|
|
711
|
+
sl_order_price: OrderType | number | undefined;
|
|
712
|
+
};
|
|
713
|
+
declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => {
|
|
714
|
+
fullPositionOrder?: API.AlgoOrder;
|
|
715
|
+
partialPositionOrders?: API.AlgoOrder[];
|
|
716
|
+
};
|
|
717
|
+
|
|
675
718
|
type CombineOrderType = AlgoOrderRootType | "ALL";
|
|
676
719
|
declare const useOrderStream: (
|
|
677
720
|
/**
|
|
@@ -721,6 +764,7 @@ params: {
|
|
|
721
764
|
readonly cancelAlgoOrder: (orderId: number, symbol?: string) => Promise<any>;
|
|
722
765
|
readonly cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise<any>;
|
|
723
766
|
readonly updateTPSLOrder: (orderId: number, childOrders: API.AlgoOrder["child_orders"]) => Promise<any>;
|
|
767
|
+
readonly cancelPostionOrdersByTypes: (symbol: string, types: AlgoOrderRootType[]) => Promise<any>;
|
|
724
768
|
readonly meta: any;
|
|
725
769
|
readonly errors: {
|
|
726
770
|
readonly cancelOrder: unknown;
|
|
@@ -1032,6 +1076,10 @@ type OrderValidationItem = {
|
|
|
1032
1076
|
value?: never;
|
|
1033
1077
|
min: number | string;
|
|
1034
1078
|
max: number | string;
|
|
1079
|
+
} | {
|
|
1080
|
+
type: "priceErrorMin" | "priceErrorMax";
|
|
1081
|
+
message: string;
|
|
1082
|
+
value?: never;
|
|
1035
1083
|
};
|
|
1036
1084
|
type OrderValidationResult = {
|
|
1037
1085
|
[P in keyof OrderlyOrder]?: OrderValidationItem;
|
|
@@ -1081,6 +1129,11 @@ declare const useTaskProfitAndStopLossInternal: (position: Partial<API.PositionT
|
|
|
1081
1129
|
* Conversely, even if defaultOrder is provided and isEditing is false, a new TPSL order is still created
|
|
1082
1130
|
*/
|
|
1083
1131
|
isEditing?: boolean;
|
|
1132
|
+
tpslEnable?: {
|
|
1133
|
+
tp_enable?: boolean;
|
|
1134
|
+
sl_enable?: boolean;
|
|
1135
|
+
};
|
|
1136
|
+
positionType?: PositionType;
|
|
1084
1137
|
}) => [
|
|
1085
1138
|
/**
|
|
1086
1139
|
* return the computed & formatted order
|
|
@@ -1089,7 +1142,7 @@ ComputedAlgoOrder, {
|
|
|
1089
1142
|
/**
|
|
1090
1143
|
* Update the take profit and stop loss order, this will merge the new data with the old one
|
|
1091
1144
|
*/
|
|
1092
|
-
setValue: (key: string, value: number | string) => void;
|
|
1145
|
+
setValue: (key: string, value: number | string | boolean) => void;
|
|
1093
1146
|
setValues: (values: Partial<ComputedAlgoOrder>) => void;
|
|
1094
1147
|
/**
|
|
1095
1148
|
* Submit the TP/SL order
|
|
@@ -1117,7 +1170,12 @@ position: Partial<API.PositionTPSLExt> & Pick<API.PositionTPSLExt, "symbol" | "a
|
|
|
1117
1170
|
* it is usually used when editing order
|
|
1118
1171
|
*/
|
|
1119
1172
|
defaultOrder?: API.AlgoOrder;
|
|
1173
|
+
tpslEnable?: {
|
|
1174
|
+
tp_enable?: boolean;
|
|
1175
|
+
sl_enable?: boolean;
|
|
1176
|
+
};
|
|
1120
1177
|
isEditing?: boolean;
|
|
1178
|
+
positionType?: PositionType;
|
|
1121
1179
|
}) => ReturnType<typeof useTaskProfitAndStopLossInternal>;
|
|
1122
1180
|
|
|
1123
1181
|
/**
|
|
@@ -1159,7 +1217,7 @@ declare const useAssetsHistory: (options: AssetHistoryOptions, config?: {
|
|
|
1159
1217
|
* should update when wallet changed, default is update
|
|
1160
1218
|
*/
|
|
1161
1219
|
shouldUpdateOnWalletChanged?: (data: any) => boolean;
|
|
1162
|
-
}) => readonly [any[], {
|
|
1220
|
+
}) => readonly [readonly any[], {
|
|
1163
1221
|
readonly meta: API.RecordsMeta | undefined;
|
|
1164
1222
|
readonly isLoading: boolean;
|
|
1165
1223
|
}];
|
|
@@ -1174,7 +1232,7 @@ type QueryParams = {
|
|
|
1174
1232
|
*/
|
|
1175
1233
|
declare const useStatisticsDaily: (params: QueryParams, options?: {
|
|
1176
1234
|
ignoreAggregation?: boolean;
|
|
1177
|
-
}) => readonly [
|
|
1235
|
+
}) => readonly [readonly any[], {
|
|
1178
1236
|
readonly aggregateValue: {
|
|
1179
1237
|
vol: null;
|
|
1180
1238
|
pnl: null;
|
|
@@ -1527,13 +1585,6 @@ declare function checkNotional(props: {
|
|
|
1527
1585
|
quote_tick?: number;
|
|
1528
1586
|
}): string | undefined;
|
|
1529
1587
|
|
|
1530
|
-
declare const findTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => Partial<AlgoOrderEntity> | undefined;
|
|
1531
|
-
declare const findTPSLFromOrder: (order: API.AlgoOrder) => {
|
|
1532
|
-
tp_trigger_price?: number;
|
|
1533
|
-
sl_trigger_price?: number;
|
|
1534
|
-
};
|
|
1535
|
-
declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => API.AlgoOrder | undefined;
|
|
1536
|
-
|
|
1537
1588
|
declare function getPositionBySymbol(symbol: string): void;
|
|
1538
1589
|
|
|
1539
1590
|
/**
|
|
@@ -1561,12 +1612,12 @@ declare const index_cleanStringStyle: typeof cleanStringStyle;
|
|
|
1561
1612
|
declare const index_fetcher: typeof fetcher;
|
|
1562
1613
|
declare const index_findPositionTPSLFromOrders: typeof findPositionTPSLFromOrders;
|
|
1563
1614
|
declare const index_findTPSLFromOrder: typeof findTPSLFromOrder;
|
|
1564
|
-
declare const
|
|
1615
|
+
declare const index_findTPSLOrderPriceFromOrder: typeof findTPSLOrderPriceFromOrder;
|
|
1565
1616
|
declare const index_formatNumber: typeof formatNumber;
|
|
1566
1617
|
declare const index_getPositionBySymbol: typeof getPositionBySymbol;
|
|
1567
1618
|
declare const index_priceToPnl: typeof priceToPnl;
|
|
1568
1619
|
declare namespace index {
|
|
1569
|
-
export { index_calcTPSL_ROI as calcTPSL_ROI, index_cleanStringStyle as cleanStringStyle, index_fetcher as fetcher, index_findPositionTPSLFromOrders as findPositionTPSLFromOrders, index_findTPSLFromOrder as findTPSLFromOrder,
|
|
1620
|
+
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_priceToPnl as priceToPnl };
|
|
1570
1621
|
}
|
|
1571
1622
|
|
|
1572
1623
|
declare const useCommission: (options?: {
|
|
@@ -2185,7 +2236,7 @@ method?: HTTP_METHOD,
|
|
|
2185
2236
|
*
|
|
2186
2237
|
* @link https://swr.vercel.app/docs/mutation#api
|
|
2187
2238
|
*/
|
|
2188
|
-
options?: SubAccountMutationOptions<T, E>) => readonly [(data: Record<string, any> | null, params?: Record<string, any
|
|
2239
|
+
options?: SubAccountMutationOptions<T, E>) => readonly [(this: unknown, data: Record<string, any> | null, params?: Record<string, any> | undefined, options?: SubAccountMutationOptions<T, E> | undefined) => Promise<any>, {
|
|
2189
2240
|
readonly data: any;
|
|
2190
2241
|
readonly error: any;
|
|
2191
2242
|
readonly reset: () => void;
|
|
@@ -2240,4 +2291,7 @@ declare const usePositionClose: (options: PositionCloseOptions) => {
|
|
|
2240
2291
|
calculate: typeof calculate;
|
|
2241
2292
|
};
|
|
2242
2293
|
|
|
2243
|
-
|
|
2294
|
+
declare const useMarketList: () => API.MarketInfoExt[];
|
|
2295
|
+
declare const useMarketMap: () => Record<string, API.MarketInfoExt> | null;
|
|
2296
|
+
|
|
2297
|
+
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, type Brokers, type Chain, type Chains, type CheckReferralCodeReturns, type CollateralOutputs, type ComputedAlgoOrder, type ConfigProviderProps, type ConnectedChain, type CurrentEpochEstimate, DefaultLayoutConfig, DistributionId, type DrawOptions, ENVType, type EpochInfoItem, type EpochInfoType, EpochStatus, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, type FundingRates, MaintenanceStatus, type MarginRatioReturn, type MarketsItem, MarketsStorageKey, type MarketsStore, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderValidationItem, type OrderValidationResult, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, type PosterLayoutConfig, type PriceMode, type Recent, RefferalAPI, type RestrictedInfoOptions, type RestrictedInfoReturns, ScopeType, type StatusInfo, StatusProvider, type SymbolInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseOrderEntryMetaState, WalletConnectorContext, type WalletConnectorContextState, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, type chainFilter, type chainFilterFunc, checkNotional, cleanStringStyle, fetcher, type filteredChains$1 as filteredChains, findPositionTPSLFromOrders, findTPSLFromOrder, findTPSLOrderPriceFromOrder, getMinNotional, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useAudioPlayer, useBalanceSubscription, useBalanceTopic, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingDetails, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketList, useMarketMap, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMemoizedFn, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, useOrderlyContext, usePositionActions, usePositionClose, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTickerStream, useTokenInfo, useTokensInfo, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useUpdatedRef, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWalletTopic, useWithdraw, useWsStatus, index as utils, _default as version };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
|
|
|
7
7
|
import * as swr_infinite from 'swr/infinite';
|
|
8
8
|
import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
|
|
9
9
|
import * as react from 'react';
|
|
10
|
-
import { PropsWithChildren, FC, ReactNode } from 'react';
|
|
10
|
+
import react__default, { PropsWithChildren, FC, ReactNode } from 'react';
|
|
11
11
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
12
|
-
import { NetworkId, TrackerEventName, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, OrderlyOrder,
|
|
12
|
+
import { NetworkId, TrackerEventName, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderType, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, OrderlyOrder, PositionType, AlgoOrderEntity, AssetHistoryStatusEnum, AlgoOrderType, RequireKeys } from '@orderly.network/types';
|
|
13
13
|
import * as _orderly_network_core from '@orderly.network/core';
|
|
14
14
|
import { AccountState, Account, EventEmitter, ConfigStore, ConfigKey, SimpleDI, OrderlyKeyStore, WalletAdapter, IContract, DefaultConfigStore } from '@orderly.network/core';
|
|
15
15
|
export { SubAccount, WalletAdapter } from '@orderly.network/core';
|
|
@@ -32,7 +32,7 @@ declare global {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
declare const _default: "2.
|
|
35
|
+
declare const _default: "2.6.0-alpha.0";
|
|
36
36
|
|
|
37
37
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
38
38
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
@@ -78,7 +78,7 @@ method?: HTTP_METHOD$1,
|
|
|
78
78
|
*
|
|
79
79
|
* @link https://swr.vercel.app/docs/mutation#api
|
|
80
80
|
*/
|
|
81
|
-
options?: SWRMutationConfiguration<T, E>) => readonly [(data: Record<string, any> | null, params?: Record<string, any
|
|
81
|
+
options?: SWRMutationConfiguration<T, E>) => readonly [(this: unknown, data: Record<string, any> | null, params?: Record<string, any> | undefined, options?: SWRMutationConfiguration<T, E> | undefined) => Promise<any>, {
|
|
82
82
|
readonly data: any;
|
|
83
83
|
readonly error: E | undefined;
|
|
84
84
|
readonly reset: () => void;
|
|
@@ -114,6 +114,26 @@ type noop = (this: any, ...args: any[]) => any;
|
|
|
114
114
|
type PickFunction<T extends noop> = (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T>;
|
|
115
115
|
declare const useMemoizedFn: <T extends noop>(fn: T) => PickFunction<T>;
|
|
116
116
|
|
|
117
|
+
interface AudioPlayerOptions {
|
|
118
|
+
volume?: number;
|
|
119
|
+
loop?: boolean;
|
|
120
|
+
autoPlay?: boolean;
|
|
121
|
+
}
|
|
122
|
+
declare const useAudioPlayer: (src: string, options?: AudioPlayerOptions) => readonly [react__default.DetailedReactHTMLElement<{
|
|
123
|
+
controls: boolean;
|
|
124
|
+
ref: react__default.MutableRefObject<HTMLAudioElement | null>;
|
|
125
|
+
autoPlay: boolean | undefined;
|
|
126
|
+
src: string;
|
|
127
|
+
style: {
|
|
128
|
+
display: "none";
|
|
129
|
+
};
|
|
130
|
+
onPlay: () => void;
|
|
131
|
+
onPlaying: () => void;
|
|
132
|
+
onPause: () => void;
|
|
133
|
+
onEnded: () => void;
|
|
134
|
+
onError: () => void;
|
|
135
|
+
}, HTMLAudioElement>, react__default.MutableRefObject<HTMLAudioElement | null>, "error" | "paused" | "idle" | "play" | "playing" | "ended"];
|
|
136
|
+
|
|
117
137
|
declare const useAccount: () => {
|
|
118
138
|
account: _orderly_network_core.Account;
|
|
119
139
|
state: AccountState;
|
|
@@ -258,11 +278,27 @@ interface OrderlyConfigContextState {
|
|
|
258
278
|
* Custom `/v1/public/futures` response data.
|
|
259
279
|
*/
|
|
260
280
|
symbolList?: (originalVal: API.MarketInfoExt[]) => any[];
|
|
281
|
+
/**
|
|
282
|
+
* custom `/v2/public/announcement` response data
|
|
283
|
+
*/
|
|
284
|
+
announcementList?: (data: any[]) => any[];
|
|
285
|
+
};
|
|
286
|
+
notification?: {
|
|
287
|
+
orderFilled?: {
|
|
288
|
+
/**
|
|
289
|
+
* Sound to play when an order is successful.
|
|
290
|
+
* @default ""
|
|
291
|
+
*/
|
|
292
|
+
media?: string;
|
|
293
|
+
};
|
|
261
294
|
};
|
|
262
295
|
}
|
|
263
296
|
declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
|
|
297
|
+
declare const useOrderlyContext: () => OrderlyConfigContextState;
|
|
264
298
|
declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
|
|
265
299
|
|
|
300
|
+
declare const StatusProvider: React.FC<PropsWithChildren>;
|
|
301
|
+
|
|
266
302
|
declare enum WsNetworkStatus {
|
|
267
303
|
Connected = "connected",
|
|
268
304
|
Unstable = "unstable",
|
|
@@ -270,12 +306,6 @@ declare enum WsNetworkStatus {
|
|
|
270
306
|
}
|
|
271
307
|
declare function useWsStatus(): WsNetworkStatus;
|
|
272
308
|
|
|
273
|
-
interface StatusContextState {
|
|
274
|
-
ws?: WsNetworkStatus;
|
|
275
|
-
}
|
|
276
|
-
declare const StatusContext: react.Context<StatusContextState>;
|
|
277
|
-
declare const StatusProvider: React.FC<PropsWithChildren>;
|
|
278
|
-
|
|
279
309
|
type filteredChains = {
|
|
280
310
|
mainnet?: Chain$1[];
|
|
281
311
|
testnet?: Chain$1[];
|
|
@@ -290,7 +320,7 @@ type BaseConfigProviderProps = {
|
|
|
290
320
|
* Custom orderbook default tick sizes.
|
|
291
321
|
*/
|
|
292
322
|
orderbookDefaultTickSizes?: Record<string, string>;
|
|
293
|
-
} & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer" | "dataAdapter">;
|
|
323
|
+
} & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer" | "dataAdapter" | "notification">;
|
|
294
324
|
type ExclusiveConfigProviderProps = {
|
|
295
325
|
brokerId: string;
|
|
296
326
|
brokerName?: string;
|
|
@@ -601,7 +631,7 @@ declare const useLeverage: () => {
|
|
|
601
631
|
readonly maxLeverage: number;
|
|
602
632
|
};
|
|
603
633
|
|
|
604
|
-
declare const useOdosQuote: () => readonly [(data: Record<string, any> | null, params?: Record<string, any
|
|
634
|
+
declare const useOdosQuote: () => readonly [(this: unknown, data: Record<string, any> | null, params?: Record<string, any> | undefined, options?: swr_mutation.SWRMutationConfiguration<unknown, unknown> | undefined) => Promise<any>, {
|
|
605
635
|
readonly data: any;
|
|
606
636
|
readonly error: unknown;
|
|
607
637
|
readonly reset: () => void;
|
|
@@ -640,9 +670,9 @@ declare const useFundingRatesStore: () => Record<string, API.FundingRate> | unde
|
|
|
640
670
|
|
|
641
671
|
type PeriodKey = "1d" | "3d" | "7d" | "14d" | "30d" | "90d";
|
|
642
672
|
declare const useFundingRateHistory: () => {
|
|
643
|
-
data:
|
|
673
|
+
data: readonly any[];
|
|
644
674
|
isLoading: boolean;
|
|
645
|
-
getPositiveRates: (data: API.FundingHistory[], period: PeriodKey) => Record<string, number>;
|
|
675
|
+
getPositiveRates: (data: ReadonlyArray<API.FundingHistory> | API.FundingHistory[], period: PeriodKey) => Record<string, number>;
|
|
646
676
|
};
|
|
647
677
|
|
|
648
678
|
type PriceMode = "markPrice" | "lastPrice";
|
|
@@ -672,6 +702,19 @@ symbol?: string, options?: SWRConfiguration & {
|
|
|
672
702
|
readonly isLoading: boolean;
|
|
673
703
|
}];
|
|
674
704
|
|
|
705
|
+
declare const findTPSLFromOrder: (order: API.AlgoOrder) => {
|
|
706
|
+
tp_trigger_price?: number;
|
|
707
|
+
sl_trigger_price?: number;
|
|
708
|
+
};
|
|
709
|
+
declare const findTPSLOrderPriceFromOrder: (order: API.AlgoOrder) => {
|
|
710
|
+
tp_order_price: OrderType | number | undefined;
|
|
711
|
+
sl_order_price: OrderType | number | undefined;
|
|
712
|
+
};
|
|
713
|
+
declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => {
|
|
714
|
+
fullPositionOrder?: API.AlgoOrder;
|
|
715
|
+
partialPositionOrders?: API.AlgoOrder[];
|
|
716
|
+
};
|
|
717
|
+
|
|
675
718
|
type CombineOrderType = AlgoOrderRootType | "ALL";
|
|
676
719
|
declare const useOrderStream: (
|
|
677
720
|
/**
|
|
@@ -721,6 +764,7 @@ params: {
|
|
|
721
764
|
readonly cancelAlgoOrder: (orderId: number, symbol?: string) => Promise<any>;
|
|
722
765
|
readonly cancelTPSLChildOrder: (orderId: number, rootAlgoOrderId: number) => Promise<any>;
|
|
723
766
|
readonly updateTPSLOrder: (orderId: number, childOrders: API.AlgoOrder["child_orders"]) => Promise<any>;
|
|
767
|
+
readonly cancelPostionOrdersByTypes: (symbol: string, types: AlgoOrderRootType[]) => Promise<any>;
|
|
724
768
|
readonly meta: any;
|
|
725
769
|
readonly errors: {
|
|
726
770
|
readonly cancelOrder: unknown;
|
|
@@ -1032,6 +1076,10 @@ type OrderValidationItem = {
|
|
|
1032
1076
|
value?: never;
|
|
1033
1077
|
min: number | string;
|
|
1034
1078
|
max: number | string;
|
|
1079
|
+
} | {
|
|
1080
|
+
type: "priceErrorMin" | "priceErrorMax";
|
|
1081
|
+
message: string;
|
|
1082
|
+
value?: never;
|
|
1035
1083
|
};
|
|
1036
1084
|
type OrderValidationResult = {
|
|
1037
1085
|
[P in keyof OrderlyOrder]?: OrderValidationItem;
|
|
@@ -1081,6 +1129,11 @@ declare const useTaskProfitAndStopLossInternal: (position: Partial<API.PositionT
|
|
|
1081
1129
|
* Conversely, even if defaultOrder is provided and isEditing is false, a new TPSL order is still created
|
|
1082
1130
|
*/
|
|
1083
1131
|
isEditing?: boolean;
|
|
1132
|
+
tpslEnable?: {
|
|
1133
|
+
tp_enable?: boolean;
|
|
1134
|
+
sl_enable?: boolean;
|
|
1135
|
+
};
|
|
1136
|
+
positionType?: PositionType;
|
|
1084
1137
|
}) => [
|
|
1085
1138
|
/**
|
|
1086
1139
|
* return the computed & formatted order
|
|
@@ -1089,7 +1142,7 @@ ComputedAlgoOrder, {
|
|
|
1089
1142
|
/**
|
|
1090
1143
|
* Update the take profit and stop loss order, this will merge the new data with the old one
|
|
1091
1144
|
*/
|
|
1092
|
-
setValue: (key: string, value: number | string) => void;
|
|
1145
|
+
setValue: (key: string, value: number | string | boolean) => void;
|
|
1093
1146
|
setValues: (values: Partial<ComputedAlgoOrder>) => void;
|
|
1094
1147
|
/**
|
|
1095
1148
|
* Submit the TP/SL order
|
|
@@ -1117,7 +1170,12 @@ position: Partial<API.PositionTPSLExt> & Pick<API.PositionTPSLExt, "symbol" | "a
|
|
|
1117
1170
|
* it is usually used when editing order
|
|
1118
1171
|
*/
|
|
1119
1172
|
defaultOrder?: API.AlgoOrder;
|
|
1173
|
+
tpslEnable?: {
|
|
1174
|
+
tp_enable?: boolean;
|
|
1175
|
+
sl_enable?: boolean;
|
|
1176
|
+
};
|
|
1120
1177
|
isEditing?: boolean;
|
|
1178
|
+
positionType?: PositionType;
|
|
1121
1179
|
}) => ReturnType<typeof useTaskProfitAndStopLossInternal>;
|
|
1122
1180
|
|
|
1123
1181
|
/**
|
|
@@ -1159,7 +1217,7 @@ declare const useAssetsHistory: (options: AssetHistoryOptions, config?: {
|
|
|
1159
1217
|
* should update when wallet changed, default is update
|
|
1160
1218
|
*/
|
|
1161
1219
|
shouldUpdateOnWalletChanged?: (data: any) => boolean;
|
|
1162
|
-
}) => readonly [any[], {
|
|
1220
|
+
}) => readonly [readonly any[], {
|
|
1163
1221
|
readonly meta: API.RecordsMeta | undefined;
|
|
1164
1222
|
readonly isLoading: boolean;
|
|
1165
1223
|
}];
|
|
@@ -1174,7 +1232,7 @@ type QueryParams = {
|
|
|
1174
1232
|
*/
|
|
1175
1233
|
declare const useStatisticsDaily: (params: QueryParams, options?: {
|
|
1176
1234
|
ignoreAggregation?: boolean;
|
|
1177
|
-
}) => readonly [
|
|
1235
|
+
}) => readonly [readonly any[], {
|
|
1178
1236
|
readonly aggregateValue: {
|
|
1179
1237
|
vol: null;
|
|
1180
1238
|
pnl: null;
|
|
@@ -1527,13 +1585,6 @@ declare function checkNotional(props: {
|
|
|
1527
1585
|
quote_tick?: number;
|
|
1528
1586
|
}): string | undefined;
|
|
1529
1587
|
|
|
1530
|
-
declare const findTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => Partial<AlgoOrderEntity> | undefined;
|
|
1531
|
-
declare const findTPSLFromOrder: (order: API.AlgoOrder) => {
|
|
1532
|
-
tp_trigger_price?: number;
|
|
1533
|
-
sl_trigger_price?: number;
|
|
1534
|
-
};
|
|
1535
|
-
declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => API.AlgoOrder | undefined;
|
|
1536
|
-
|
|
1537
1588
|
declare function getPositionBySymbol(symbol: string): void;
|
|
1538
1589
|
|
|
1539
1590
|
/**
|
|
@@ -1561,12 +1612,12 @@ declare const index_cleanStringStyle: typeof cleanStringStyle;
|
|
|
1561
1612
|
declare const index_fetcher: typeof fetcher;
|
|
1562
1613
|
declare const index_findPositionTPSLFromOrders: typeof findPositionTPSLFromOrders;
|
|
1563
1614
|
declare const index_findTPSLFromOrder: typeof findTPSLFromOrder;
|
|
1564
|
-
declare const
|
|
1615
|
+
declare const index_findTPSLOrderPriceFromOrder: typeof findTPSLOrderPriceFromOrder;
|
|
1565
1616
|
declare const index_formatNumber: typeof formatNumber;
|
|
1566
1617
|
declare const index_getPositionBySymbol: typeof getPositionBySymbol;
|
|
1567
1618
|
declare const index_priceToPnl: typeof priceToPnl;
|
|
1568
1619
|
declare namespace index {
|
|
1569
|
-
export { index_calcTPSL_ROI as calcTPSL_ROI, index_cleanStringStyle as cleanStringStyle, index_fetcher as fetcher, index_findPositionTPSLFromOrders as findPositionTPSLFromOrders, index_findTPSLFromOrder as findTPSLFromOrder,
|
|
1620
|
+
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_priceToPnl as priceToPnl };
|
|
1570
1621
|
}
|
|
1571
1622
|
|
|
1572
1623
|
declare const useCommission: (options?: {
|
|
@@ -2185,7 +2236,7 @@ method?: HTTP_METHOD,
|
|
|
2185
2236
|
*
|
|
2186
2237
|
* @link https://swr.vercel.app/docs/mutation#api
|
|
2187
2238
|
*/
|
|
2188
|
-
options?: SubAccountMutationOptions<T, E>) => readonly [(data: Record<string, any> | null, params?: Record<string, any
|
|
2239
|
+
options?: SubAccountMutationOptions<T, E>) => readonly [(this: unknown, data: Record<string, any> | null, params?: Record<string, any> | undefined, options?: SubAccountMutationOptions<T, E> | undefined) => Promise<any>, {
|
|
2189
2240
|
readonly data: any;
|
|
2190
2241
|
readonly error: any;
|
|
2191
2242
|
readonly reset: () => void;
|
|
@@ -2240,4 +2291,7 @@ declare const usePositionClose: (options: PositionCloseOptions) => {
|
|
|
2240
2291
|
calculate: typeof calculate;
|
|
2241
2292
|
};
|
|
2242
2293
|
|
|
2243
|
-
|
|
2294
|
+
declare const useMarketList: () => API.MarketInfoExt[];
|
|
2295
|
+
declare const useMarketMap: () => Record<string, API.MarketInfoExt> | null;
|
|
2296
|
+
|
|
2297
|
+
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, type Brokers, type Chain, type Chains, type CheckReferralCodeReturns, type CollateralOutputs, type ComputedAlgoOrder, type ConfigProviderProps, type ConnectedChain, type CurrentEpochEstimate, DefaultLayoutConfig, DistributionId, type DrawOptions, ENVType, type EpochInfoItem, type EpochInfoType, EpochStatus, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, type FundingRates, MaintenanceStatus, type MarginRatioReturn, type MarketsItem, MarketsStorageKey, type MarketsStore, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderValidationItem, type OrderValidationResult, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, type PosterLayoutConfig, type PriceMode, type Recent, RefferalAPI, type RestrictedInfoOptions, type RestrictedInfoReturns, ScopeType, type StatusInfo, StatusProvider, type SymbolInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseOrderEntryMetaState, WalletConnectorContext, type WalletConnectorContextState, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, type chainFilter, type chainFilterFunc, checkNotional, cleanStringStyle, fetcher, type filteredChains$1 as filteredChains, findPositionTPSLFromOrders, findTPSLFromOrder, findTPSLOrderPriceFromOrder, getMinNotional, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useAudioPlayer, useBalanceSubscription, useBalanceTopic, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingDetails, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketList, useMarketMap, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMemoizedFn, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, useOrderlyContext, usePositionActions, usePositionClose, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTickerStream, useTokenInfo, useTokensInfo, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useUpdatedRef, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWalletTopic, useWithdraw, useWsStatus, index as utils, _default as version };
|