@orderly.network/hooks 2.0.3 → 2.0.4
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 +74 -44
- package/dist/index.d.ts +74 -44
- package/dist/index.js +45 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import swr__default, { SWRConfiguration, SWRResponse } from 'swr';
|
|
2
3
|
export { SWRConfiguration, unstable_serialize, default as useSWR, useSWRConfig } from 'swr';
|
|
3
4
|
import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
|
|
4
5
|
import * as swr_infinite from 'swr/infinite';
|
|
5
6
|
import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
|
|
6
|
-
import * as swr__internal from 'swr/_internal';
|
|
7
7
|
import * as _orderly_network_core from '@orderly.network/core';
|
|
8
8
|
import { AccountState, Account, EventEmitter, ConfigStore, ConfigKey, SimpleDI, OrderlyKeyStore, WalletAdapter, IContract, DefaultConfigStore } from '@orderly.network/core';
|
|
9
9
|
export { WalletAdapter } from '@orderly.network/core';
|
|
@@ -28,7 +28,7 @@ declare global {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
declare const _default: "2.0.
|
|
31
|
+
declare const _default: "2.0.4";
|
|
32
32
|
|
|
33
33
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
34
34
|
formatter?: (data: any) => T;
|
|
@@ -40,7 +40,7 @@ type useQueryOptions<T> = SWRConfiguration & {
|
|
|
40
40
|
* @param query
|
|
41
41
|
* @param options
|
|
42
42
|
*/
|
|
43
|
-
declare const useQuery: <T>(query: Parameters<typeof
|
|
43
|
+
declare const useQuery: <T>(query: Parameters<typeof swr__default>["0"], options?: useQueryOptions<T>) => SWRResponse<T>;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* useQuery
|
|
@@ -48,16 +48,16 @@ declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: use
|
|
|
48
48
|
* @param query
|
|
49
49
|
* @param options
|
|
50
50
|
*/
|
|
51
|
-
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof
|
|
52
|
-
formatter?: (
|
|
53
|
-
init?: RequestInit
|
|
54
|
-
})
|
|
51
|
+
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof swr__default>["0"], options?: SWRMutationConfiguration<any, any> & {
|
|
52
|
+
formatter?: (data: any) => R;
|
|
53
|
+
init?: RequestInit;
|
|
54
|
+
}) => SWRMutationResponse;
|
|
55
55
|
|
|
56
56
|
type HTTP_METHOD = "POST" | "PUT" | "DELETE" | "GET";
|
|
57
57
|
/**
|
|
58
58
|
* This hook is used to execute API requests for data mutation, such as POST, DELETE, PUT, etc.
|
|
59
59
|
*/
|
|
60
|
-
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E>
|
|
60
|
+
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E>) => readonly [(data: Record<string, any> | null, params?: Record<string, any>, options?: SWRMutationConfiguration<T, E>) => Promise<any>, {
|
|
61
61
|
readonly data: any;
|
|
62
62
|
readonly error: E | undefined;
|
|
63
63
|
readonly reset: () => void;
|
|
@@ -70,11 +70,11 @@ declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: S
|
|
|
70
70
|
* @param query
|
|
71
71
|
* @param options
|
|
72
72
|
*/
|
|
73
|
-
declare const usePrivateQuery: <T>(query: string, options?: useQueryOptions<T>
|
|
73
|
+
declare const usePrivateQuery: <T>(query: string, options?: useQueryOptions<T>) => SWRResponse<T>;
|
|
74
74
|
|
|
75
|
-
declare const usePrivateInfiniteQuery: <T>(getKey: SWRInfiniteKeyLoader, options?:
|
|
76
|
-
formatter?: (
|
|
77
|
-
})
|
|
75
|
+
declare const usePrivateInfiniteQuery: <T>(getKey: SWRInfiniteKeyLoader, options?: SWRInfiniteConfiguration & {
|
|
76
|
+
formatter?: (data: any) => any;
|
|
77
|
+
}) => swr_infinite.SWRInfiniteResponse<T, any>;
|
|
78
78
|
|
|
79
79
|
declare const useBoolean: (initialValue?: boolean) => [boolean, {
|
|
80
80
|
setTrue: () => void;
|
|
@@ -298,7 +298,7 @@ declare const useSymbolsInfo: () => {
|
|
|
298
298
|
isNil: boolean;
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
-
declare const useAccountInfo: () =>
|
|
301
|
+
declare const useAccountInfo: () => swr.SWRResponse<API.AccountInfo, any, any>;
|
|
302
302
|
|
|
303
303
|
declare const useMarketsStream: () => {
|
|
304
304
|
data: WSMessage.Ticker[] | null;
|
|
@@ -461,8 +461,8 @@ declare const useIndexPrice: (symbol: string) => swr_subscription.SWRSubscriptio
|
|
|
461
461
|
declare const useLeverage: () => any;
|
|
462
462
|
|
|
463
463
|
declare const useTickerStream: (symbol: string) => API.MarketInfo & {
|
|
464
|
-
change?: number
|
|
465
|
-
"24h_change"?: number
|
|
464
|
+
change?: number;
|
|
465
|
+
"24h_change"?: number;
|
|
466
466
|
};
|
|
467
467
|
|
|
468
468
|
declare const useFundingRate: (symbol: string) => {
|
|
@@ -564,7 +564,7 @@ declare const useOrderStream: (params: {
|
|
|
564
564
|
}) => readonly [any[] | null, {
|
|
565
565
|
readonly total: number;
|
|
566
566
|
readonly isLoading: boolean;
|
|
567
|
-
readonly refresh:
|
|
567
|
+
readonly refresh: swr.KeyedMutator<unknown[]>;
|
|
568
568
|
readonly loadMore: () => void;
|
|
569
569
|
readonly cancelAllOrders: () => Promise<[any, any]>;
|
|
570
570
|
readonly cancelAllTPSLOrders: () => Promise<any[]>;
|
|
@@ -698,12 +698,12 @@ declare const useHoldingStream: () => {
|
|
|
698
698
|
};
|
|
699
699
|
|
|
700
700
|
declare const useWalletSubscription: (options?: {
|
|
701
|
-
onMessage?: (
|
|
702
|
-
}
|
|
701
|
+
onMessage?: (data: any) => void;
|
|
702
|
+
}) => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
703
703
|
|
|
704
704
|
declare const useSettleSubscription: (options?: {
|
|
705
|
-
onMessage?: (
|
|
706
|
-
}
|
|
705
|
+
onMessage?: (data: any) => void;
|
|
706
|
+
}) => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
707
707
|
|
|
708
708
|
type getKeyFunction = (index: number, prevData: any) => string | null;
|
|
709
709
|
|
|
@@ -745,25 +745,50 @@ type ValidateError = {
|
|
|
745
745
|
message: string;
|
|
746
746
|
};
|
|
747
747
|
};
|
|
748
|
-
|
|
749
|
-
|
|
748
|
+
/**
|
|
749
|
+
* @hidden
|
|
750
|
+
*/
|
|
751
|
+
declare const useTaskProfitAndStopLossInternal: (position: Partial<API.PositionTPSLExt> & Pick<API.PositionTPSLExt, "symbol" | "average_open_price" | "position_qty">, options?: {
|
|
752
|
+
defaultOrder?: API.AlgoOrder;
|
|
750
753
|
/**
|
|
751
|
-
*
|
|
752
|
-
*
|
|
754
|
+
* If the order is editing, set to true
|
|
755
|
+
* if the isEditing is true, the defaultOrder must be provided
|
|
756
|
+
* Conversely, even if defaultOrder is provided and isEditing is false, a new TPSL order is still created
|
|
753
757
|
*/
|
|
754
|
-
defaultOrder?: API.AlgoOrder;
|
|
755
758
|
isEditing?: boolean;
|
|
756
|
-
}) => [
|
|
757
|
-
|
|
758
|
-
|
|
759
|
+
}) => [
|
|
760
|
+
/**
|
|
761
|
+
* return the computed & formatted order
|
|
762
|
+
*/
|
|
763
|
+
ComputedAlgoOrder, {
|
|
764
|
+
/**
|
|
765
|
+
* Update the take profit and stop loss order, this will merge the new data with the old one
|
|
766
|
+
*/
|
|
767
|
+
setValue: (key: string, value: number | string) => void;
|
|
768
|
+
setValues: (values: Partial<ComputedAlgoOrder>) => void;
|
|
769
|
+
/**
|
|
770
|
+
* Submit the TP/SL order
|
|
771
|
+
*/
|
|
759
772
|
submit: () => Promise<any>;
|
|
760
773
|
deleteOrder: (orderId: number, symbol: string) => Promise<any>;
|
|
761
774
|
errors: ValidateError | null;
|
|
762
|
-
|
|
775
|
+
/**
|
|
776
|
+
*
|
|
777
|
+
*/
|
|
778
|
+
validate: () => Promise<AlgoOrderEntity<AlgoOrderRootType.POSITIONAL_TP_SL | AlgoOrderRootType.TP_SL>>;
|
|
763
779
|
isCreateMutating: boolean;
|
|
764
780
|
isUpdateMutating: boolean;
|
|
765
781
|
}];
|
|
766
782
|
|
|
783
|
+
declare const useTPSLOrder: (position: Partial<API.PositionTPSLExt> & Pick<API.PositionTPSLExt, "symbol" | "average_open_price" | "position_qty">, options?: {
|
|
784
|
+
/**
|
|
785
|
+
* You can set the default value for the take profit and stop loss order,
|
|
786
|
+
* it is usually used when editing order
|
|
787
|
+
*/
|
|
788
|
+
defaultOrder?: API.AlgoOrder;
|
|
789
|
+
isEditing?: boolean;
|
|
790
|
+
}) => ReturnType<typeof useTaskProfitAndStopLossInternal>;
|
|
791
|
+
|
|
767
792
|
declare const useSymbolLeverage: (symbol: string) => number | "-";
|
|
768
793
|
|
|
769
794
|
declare enum AssetHistoryStatusEnum {
|
|
@@ -863,6 +888,11 @@ type PositionActions = {
|
|
|
863
888
|
};
|
|
864
889
|
declare const usePositionActions: () => PositionActions;
|
|
865
890
|
|
|
891
|
+
declare const useStorageLedgerAddress: () => {
|
|
892
|
+
setLedgerAddress: (address: string) => void;
|
|
893
|
+
ledgerWallet: any;
|
|
894
|
+
};
|
|
895
|
+
|
|
866
896
|
type UseOrderEntryOptions = {
|
|
867
897
|
commify?: boolean;
|
|
868
898
|
watchOrderbook?: boolean;
|
|
@@ -1084,8 +1114,8 @@ declare function checkNotional(props: {
|
|
|
1084
1114
|
|
|
1085
1115
|
declare const findTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => Partial<AlgoOrderEntity> | undefined;
|
|
1086
1116
|
declare const findTPSLFromOrder: (order: API.AlgoOrder) => {
|
|
1087
|
-
tp_trigger_price?: number
|
|
1088
|
-
sl_trigger_price?: number
|
|
1117
|
+
tp_trigger_price?: number;
|
|
1118
|
+
sl_trigger_price?: number;
|
|
1089
1119
|
};
|
|
1090
1120
|
declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => API.AlgoOrder | undefined;
|
|
1091
1121
|
|
|
@@ -1220,7 +1250,7 @@ declare const useDaily: (options?: {
|
|
|
1220
1250
|
startDate?: Date;
|
|
1221
1251
|
endDate?: Date;
|
|
1222
1252
|
}) => {
|
|
1223
|
-
data?: RefferalAPI.DayliVolume[]
|
|
1253
|
+
data?: RefferalAPI.DayliVolume[];
|
|
1224
1254
|
mutate: any;
|
|
1225
1255
|
};
|
|
1226
1256
|
|
|
@@ -1242,7 +1272,7 @@ type Params$3 = {
|
|
|
1242
1272
|
declare const useReferralRebateSummary: (params: Params$3) => readonly [RefferalAPI.ReferralRebateSummary[] | null, {
|
|
1243
1273
|
readonly total: number;
|
|
1244
1274
|
readonly isLoading: boolean;
|
|
1245
|
-
readonly refresh:
|
|
1275
|
+
readonly refresh: swr.KeyedMutator<any[]>;
|
|
1246
1276
|
readonly loadMore: () => void;
|
|
1247
1277
|
readonly meta: {
|
|
1248
1278
|
total: number;
|
|
@@ -1277,7 +1307,7 @@ type Params$1 = {
|
|
|
1277
1307
|
declare const useRefereeInfo: (params: Params$1) => readonly [RefferalAPI.RefereeInfoItem[] | null, {
|
|
1278
1308
|
readonly total: number;
|
|
1279
1309
|
readonly isLoading: boolean;
|
|
1280
|
-
readonly refresh:
|
|
1310
|
+
readonly refresh: swr.KeyedMutator<any[]>;
|
|
1281
1311
|
readonly loadMore: () => void;
|
|
1282
1312
|
readonly meta: {
|
|
1283
1313
|
total: number;
|
|
@@ -1291,7 +1321,7 @@ type Params = {
|
|
|
1291
1321
|
endDate?: Date;
|
|
1292
1322
|
};
|
|
1293
1323
|
declare const useRefereeRebateSummary: (params: Params) => {
|
|
1294
|
-
data?: RefferalAPI.RefereeRebateSummary[]
|
|
1324
|
+
data?: RefferalAPI.RefereeRebateSummary[];
|
|
1295
1325
|
mutate: any;
|
|
1296
1326
|
isLoading: boolean;
|
|
1297
1327
|
};
|
|
@@ -1304,15 +1334,15 @@ type CheckReferralCodeReturns = {
|
|
|
1304
1334
|
declare const useCheckReferralCode: (code?: string) => CheckReferralCodeReturns;
|
|
1305
1335
|
|
|
1306
1336
|
declare const useGetReferralCode: (accountId?: string) => {
|
|
1307
|
-
referral_code?: string
|
|
1337
|
+
referral_code?: string;
|
|
1308
1338
|
error: any;
|
|
1309
1339
|
isLoading: boolean;
|
|
1310
1340
|
};
|
|
1311
1341
|
|
|
1312
1342
|
declare const useReferralInfo: () => {
|
|
1313
|
-
data?: RefferalAPI.ReferralInfo
|
|
1314
|
-
isTrader?: boolean
|
|
1315
|
-
isAffiliate?: boolean
|
|
1343
|
+
data?: RefferalAPI.ReferralInfo;
|
|
1344
|
+
isTrader?: boolean;
|
|
1345
|
+
isAffiliate?: boolean;
|
|
1316
1346
|
error: any;
|
|
1317
1347
|
isLoading: boolean;
|
|
1318
1348
|
getFirstRefCode: () => RefferalAPI.ReferralCode | undefined;
|
|
@@ -1444,7 +1474,7 @@ declare const useApiKeyManager: (queryParams?: {
|
|
|
1444
1474
|
key_status?: string;
|
|
1445
1475
|
};
|
|
1446
1476
|
}) => readonly [APIKeyItem[] | undefined, {
|
|
1447
|
-
readonly refresh:
|
|
1477
|
+
readonly refresh: swr.KeyedMutator<APIKeyItem[]>;
|
|
1448
1478
|
readonly error: any;
|
|
1449
1479
|
readonly isLoading: boolean;
|
|
1450
1480
|
readonly generateOrderlyKey: (scope?: ScopeType) => Promise<{
|
|
@@ -1654,10 +1684,10 @@ type OrderEntryReturn = {
|
|
|
1654
1684
|
declare const useOrderEntry: (symbol: string, options?: Options) => OrderEntryReturn;
|
|
1655
1685
|
|
|
1656
1686
|
declare const useOrderEntity: (order: {
|
|
1657
|
-
[key: string]: any;
|
|
1658
1687
|
symbol: string;
|
|
1659
1688
|
side: OrderSide;
|
|
1660
|
-
reduce_only?: boolean
|
|
1689
|
+
reduce_only?: boolean;
|
|
1690
|
+
[key: string]: any;
|
|
1661
1691
|
}, options?: {
|
|
1662
1692
|
maxQty?: number;
|
|
1663
1693
|
}) => {
|
|
@@ -1694,4 +1724,4 @@ interface IRestrictedAreasParams {
|
|
|
1694
1724
|
}
|
|
1695
1725
|
declare const useRestrictedAreas: (params: IRestrictedAreasParams) => RestrictedAreasReturns;
|
|
1696
1726
|
|
|
1697
|
-
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, AssetHistoryStatusEnum, 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, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, type IRestrictedAreasParams, MarketsStorageKey, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, OrderlyTrackerProvider, type PosterLayoutConfig, type PriceMode, type Recent, RefferalAPI, type RestrictedAreasReturns, ScopeType, StatusContext, type StatusContextState, StatusProvider, type SymbolInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseOrderEntryMetaState, WalletConnectorContext, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, type chainFilter, type chainFilterFunc, checkNotional, cleanStringStyle, type filteredChains$1 as filteredChains, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useConfig, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, usePositionActions, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedAreas, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useTPSLOrder, useTickerStream, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|
|
1727
|
+
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, AssetHistoryStatusEnum, 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, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, type IRestrictedAreasParams, MarketsStorageKey, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, OrderlyTrackerProvider, type PosterLayoutConfig, type PriceMode, type Recent, RefferalAPI, type RestrictedAreasReturns, ScopeType, StatusContext, type StatusContextState, StatusProvider, type SymbolInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseOrderEntryMetaState, WalletConnectorContext, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, type chainFilter, type chainFilterFunc, checkNotional, cleanStringStyle, type filteredChains$1 as filteredChains, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useConfig, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, usePositionActions, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedAreas, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageLedgerAddress, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useTPSLOrder, useTickerStream, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import swr__default, { SWRConfiguration, SWRResponse } from 'swr';
|
|
2
3
|
export { SWRConfiguration, unstable_serialize, default as useSWR, useSWRConfig } from 'swr';
|
|
3
4
|
import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
|
|
4
5
|
import * as swr_infinite from 'swr/infinite';
|
|
5
6
|
import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
|
|
6
|
-
import * as swr__internal from 'swr/_internal';
|
|
7
7
|
import * as _orderly_network_core from '@orderly.network/core';
|
|
8
8
|
import { AccountState, Account, EventEmitter, ConfigStore, ConfigKey, SimpleDI, OrderlyKeyStore, WalletAdapter, IContract, DefaultConfigStore } from '@orderly.network/core';
|
|
9
9
|
export { WalletAdapter } from '@orderly.network/core';
|
|
@@ -28,7 +28,7 @@ declare global {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
declare const _default: "2.0.
|
|
31
|
+
declare const _default: "2.0.4";
|
|
32
32
|
|
|
33
33
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
34
34
|
formatter?: (data: any) => T;
|
|
@@ -40,7 +40,7 @@ type useQueryOptions<T> = SWRConfiguration & {
|
|
|
40
40
|
* @param query
|
|
41
41
|
* @param options
|
|
42
42
|
*/
|
|
43
|
-
declare const useQuery: <T>(query: Parameters<typeof
|
|
43
|
+
declare const useQuery: <T>(query: Parameters<typeof swr__default>["0"], options?: useQueryOptions<T>) => SWRResponse<T>;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* useQuery
|
|
@@ -48,16 +48,16 @@ declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: use
|
|
|
48
48
|
* @param query
|
|
49
49
|
* @param options
|
|
50
50
|
*/
|
|
51
|
-
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof
|
|
52
|
-
formatter?: (
|
|
53
|
-
init?: RequestInit
|
|
54
|
-
})
|
|
51
|
+
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof swr__default>["0"], options?: SWRMutationConfiguration<any, any> & {
|
|
52
|
+
formatter?: (data: any) => R;
|
|
53
|
+
init?: RequestInit;
|
|
54
|
+
}) => SWRMutationResponse;
|
|
55
55
|
|
|
56
56
|
type HTTP_METHOD = "POST" | "PUT" | "DELETE" | "GET";
|
|
57
57
|
/**
|
|
58
58
|
* This hook is used to execute API requests for data mutation, such as POST, DELETE, PUT, etc.
|
|
59
59
|
*/
|
|
60
|
-
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E>
|
|
60
|
+
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E>) => readonly [(data: Record<string, any> | null, params?: Record<string, any>, options?: SWRMutationConfiguration<T, E>) => Promise<any>, {
|
|
61
61
|
readonly data: any;
|
|
62
62
|
readonly error: E | undefined;
|
|
63
63
|
readonly reset: () => void;
|
|
@@ -70,11 +70,11 @@ declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: S
|
|
|
70
70
|
* @param query
|
|
71
71
|
* @param options
|
|
72
72
|
*/
|
|
73
|
-
declare const usePrivateQuery: <T>(query: string, options?: useQueryOptions<T>
|
|
73
|
+
declare const usePrivateQuery: <T>(query: string, options?: useQueryOptions<T>) => SWRResponse<T>;
|
|
74
74
|
|
|
75
|
-
declare const usePrivateInfiniteQuery: <T>(getKey: SWRInfiniteKeyLoader, options?:
|
|
76
|
-
formatter?: (
|
|
77
|
-
})
|
|
75
|
+
declare const usePrivateInfiniteQuery: <T>(getKey: SWRInfiniteKeyLoader, options?: SWRInfiniteConfiguration & {
|
|
76
|
+
formatter?: (data: any) => any;
|
|
77
|
+
}) => swr_infinite.SWRInfiniteResponse<T, any>;
|
|
78
78
|
|
|
79
79
|
declare const useBoolean: (initialValue?: boolean) => [boolean, {
|
|
80
80
|
setTrue: () => void;
|
|
@@ -298,7 +298,7 @@ declare const useSymbolsInfo: () => {
|
|
|
298
298
|
isNil: boolean;
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
-
declare const useAccountInfo: () =>
|
|
301
|
+
declare const useAccountInfo: () => swr.SWRResponse<API.AccountInfo, any, any>;
|
|
302
302
|
|
|
303
303
|
declare const useMarketsStream: () => {
|
|
304
304
|
data: WSMessage.Ticker[] | null;
|
|
@@ -461,8 +461,8 @@ declare const useIndexPrice: (symbol: string) => swr_subscription.SWRSubscriptio
|
|
|
461
461
|
declare const useLeverage: () => any;
|
|
462
462
|
|
|
463
463
|
declare const useTickerStream: (symbol: string) => API.MarketInfo & {
|
|
464
|
-
change?: number
|
|
465
|
-
"24h_change"?: number
|
|
464
|
+
change?: number;
|
|
465
|
+
"24h_change"?: number;
|
|
466
466
|
};
|
|
467
467
|
|
|
468
468
|
declare const useFundingRate: (symbol: string) => {
|
|
@@ -564,7 +564,7 @@ declare const useOrderStream: (params: {
|
|
|
564
564
|
}) => readonly [any[] | null, {
|
|
565
565
|
readonly total: number;
|
|
566
566
|
readonly isLoading: boolean;
|
|
567
|
-
readonly refresh:
|
|
567
|
+
readonly refresh: swr.KeyedMutator<unknown[]>;
|
|
568
568
|
readonly loadMore: () => void;
|
|
569
569
|
readonly cancelAllOrders: () => Promise<[any, any]>;
|
|
570
570
|
readonly cancelAllTPSLOrders: () => Promise<any[]>;
|
|
@@ -698,12 +698,12 @@ declare const useHoldingStream: () => {
|
|
|
698
698
|
};
|
|
699
699
|
|
|
700
700
|
declare const useWalletSubscription: (options?: {
|
|
701
|
-
onMessage?: (
|
|
702
|
-
}
|
|
701
|
+
onMessage?: (data: any) => void;
|
|
702
|
+
}) => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
703
703
|
|
|
704
704
|
declare const useSettleSubscription: (options?: {
|
|
705
|
-
onMessage?: (
|
|
706
|
-
}
|
|
705
|
+
onMessage?: (data: any) => void;
|
|
706
|
+
}) => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
707
707
|
|
|
708
708
|
type getKeyFunction = (index: number, prevData: any) => string | null;
|
|
709
709
|
|
|
@@ -745,25 +745,50 @@ type ValidateError = {
|
|
|
745
745
|
message: string;
|
|
746
746
|
};
|
|
747
747
|
};
|
|
748
|
-
|
|
749
|
-
|
|
748
|
+
/**
|
|
749
|
+
* @hidden
|
|
750
|
+
*/
|
|
751
|
+
declare const useTaskProfitAndStopLossInternal: (position: Partial<API.PositionTPSLExt> & Pick<API.PositionTPSLExt, "symbol" | "average_open_price" | "position_qty">, options?: {
|
|
752
|
+
defaultOrder?: API.AlgoOrder;
|
|
750
753
|
/**
|
|
751
|
-
*
|
|
752
|
-
*
|
|
754
|
+
* If the order is editing, set to true
|
|
755
|
+
* if the isEditing is true, the defaultOrder must be provided
|
|
756
|
+
* Conversely, even if defaultOrder is provided and isEditing is false, a new TPSL order is still created
|
|
753
757
|
*/
|
|
754
|
-
defaultOrder?: API.AlgoOrder;
|
|
755
758
|
isEditing?: boolean;
|
|
756
|
-
}) => [
|
|
757
|
-
|
|
758
|
-
|
|
759
|
+
}) => [
|
|
760
|
+
/**
|
|
761
|
+
* return the computed & formatted order
|
|
762
|
+
*/
|
|
763
|
+
ComputedAlgoOrder, {
|
|
764
|
+
/**
|
|
765
|
+
* Update the take profit and stop loss order, this will merge the new data with the old one
|
|
766
|
+
*/
|
|
767
|
+
setValue: (key: string, value: number | string) => void;
|
|
768
|
+
setValues: (values: Partial<ComputedAlgoOrder>) => void;
|
|
769
|
+
/**
|
|
770
|
+
* Submit the TP/SL order
|
|
771
|
+
*/
|
|
759
772
|
submit: () => Promise<any>;
|
|
760
773
|
deleteOrder: (orderId: number, symbol: string) => Promise<any>;
|
|
761
774
|
errors: ValidateError | null;
|
|
762
|
-
|
|
775
|
+
/**
|
|
776
|
+
*
|
|
777
|
+
*/
|
|
778
|
+
validate: () => Promise<AlgoOrderEntity<AlgoOrderRootType.POSITIONAL_TP_SL | AlgoOrderRootType.TP_SL>>;
|
|
763
779
|
isCreateMutating: boolean;
|
|
764
780
|
isUpdateMutating: boolean;
|
|
765
781
|
}];
|
|
766
782
|
|
|
783
|
+
declare const useTPSLOrder: (position: Partial<API.PositionTPSLExt> & Pick<API.PositionTPSLExt, "symbol" | "average_open_price" | "position_qty">, options?: {
|
|
784
|
+
/**
|
|
785
|
+
* You can set the default value for the take profit and stop loss order,
|
|
786
|
+
* it is usually used when editing order
|
|
787
|
+
*/
|
|
788
|
+
defaultOrder?: API.AlgoOrder;
|
|
789
|
+
isEditing?: boolean;
|
|
790
|
+
}) => ReturnType<typeof useTaskProfitAndStopLossInternal>;
|
|
791
|
+
|
|
767
792
|
declare const useSymbolLeverage: (symbol: string) => number | "-";
|
|
768
793
|
|
|
769
794
|
declare enum AssetHistoryStatusEnum {
|
|
@@ -863,6 +888,11 @@ type PositionActions = {
|
|
|
863
888
|
};
|
|
864
889
|
declare const usePositionActions: () => PositionActions;
|
|
865
890
|
|
|
891
|
+
declare const useStorageLedgerAddress: () => {
|
|
892
|
+
setLedgerAddress: (address: string) => void;
|
|
893
|
+
ledgerWallet: any;
|
|
894
|
+
};
|
|
895
|
+
|
|
866
896
|
type UseOrderEntryOptions = {
|
|
867
897
|
commify?: boolean;
|
|
868
898
|
watchOrderbook?: boolean;
|
|
@@ -1084,8 +1114,8 @@ declare function checkNotional(props: {
|
|
|
1084
1114
|
|
|
1085
1115
|
declare const findTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => Partial<AlgoOrderEntity> | undefined;
|
|
1086
1116
|
declare const findTPSLFromOrder: (order: API.AlgoOrder) => {
|
|
1087
|
-
tp_trigger_price?: number
|
|
1088
|
-
sl_trigger_price?: number
|
|
1117
|
+
tp_trigger_price?: number;
|
|
1118
|
+
sl_trigger_price?: number;
|
|
1089
1119
|
};
|
|
1090
1120
|
declare const findPositionTPSLFromOrders: (orders: API.AlgoOrder[], symbol: string) => API.AlgoOrder | undefined;
|
|
1091
1121
|
|
|
@@ -1220,7 +1250,7 @@ declare const useDaily: (options?: {
|
|
|
1220
1250
|
startDate?: Date;
|
|
1221
1251
|
endDate?: Date;
|
|
1222
1252
|
}) => {
|
|
1223
|
-
data?: RefferalAPI.DayliVolume[]
|
|
1253
|
+
data?: RefferalAPI.DayliVolume[];
|
|
1224
1254
|
mutate: any;
|
|
1225
1255
|
};
|
|
1226
1256
|
|
|
@@ -1242,7 +1272,7 @@ type Params$3 = {
|
|
|
1242
1272
|
declare const useReferralRebateSummary: (params: Params$3) => readonly [RefferalAPI.ReferralRebateSummary[] | null, {
|
|
1243
1273
|
readonly total: number;
|
|
1244
1274
|
readonly isLoading: boolean;
|
|
1245
|
-
readonly refresh:
|
|
1275
|
+
readonly refresh: swr.KeyedMutator<any[]>;
|
|
1246
1276
|
readonly loadMore: () => void;
|
|
1247
1277
|
readonly meta: {
|
|
1248
1278
|
total: number;
|
|
@@ -1277,7 +1307,7 @@ type Params$1 = {
|
|
|
1277
1307
|
declare const useRefereeInfo: (params: Params$1) => readonly [RefferalAPI.RefereeInfoItem[] | null, {
|
|
1278
1308
|
readonly total: number;
|
|
1279
1309
|
readonly isLoading: boolean;
|
|
1280
|
-
readonly refresh:
|
|
1310
|
+
readonly refresh: swr.KeyedMutator<any[]>;
|
|
1281
1311
|
readonly loadMore: () => void;
|
|
1282
1312
|
readonly meta: {
|
|
1283
1313
|
total: number;
|
|
@@ -1291,7 +1321,7 @@ type Params = {
|
|
|
1291
1321
|
endDate?: Date;
|
|
1292
1322
|
};
|
|
1293
1323
|
declare const useRefereeRebateSummary: (params: Params) => {
|
|
1294
|
-
data?: RefferalAPI.RefereeRebateSummary[]
|
|
1324
|
+
data?: RefferalAPI.RefereeRebateSummary[];
|
|
1295
1325
|
mutate: any;
|
|
1296
1326
|
isLoading: boolean;
|
|
1297
1327
|
};
|
|
@@ -1304,15 +1334,15 @@ type CheckReferralCodeReturns = {
|
|
|
1304
1334
|
declare const useCheckReferralCode: (code?: string) => CheckReferralCodeReturns;
|
|
1305
1335
|
|
|
1306
1336
|
declare const useGetReferralCode: (accountId?: string) => {
|
|
1307
|
-
referral_code?: string
|
|
1337
|
+
referral_code?: string;
|
|
1308
1338
|
error: any;
|
|
1309
1339
|
isLoading: boolean;
|
|
1310
1340
|
};
|
|
1311
1341
|
|
|
1312
1342
|
declare const useReferralInfo: () => {
|
|
1313
|
-
data?: RefferalAPI.ReferralInfo
|
|
1314
|
-
isTrader?: boolean
|
|
1315
|
-
isAffiliate?: boolean
|
|
1343
|
+
data?: RefferalAPI.ReferralInfo;
|
|
1344
|
+
isTrader?: boolean;
|
|
1345
|
+
isAffiliate?: boolean;
|
|
1316
1346
|
error: any;
|
|
1317
1347
|
isLoading: boolean;
|
|
1318
1348
|
getFirstRefCode: () => RefferalAPI.ReferralCode | undefined;
|
|
@@ -1444,7 +1474,7 @@ declare const useApiKeyManager: (queryParams?: {
|
|
|
1444
1474
|
key_status?: string;
|
|
1445
1475
|
};
|
|
1446
1476
|
}) => readonly [APIKeyItem[] | undefined, {
|
|
1447
|
-
readonly refresh:
|
|
1477
|
+
readonly refresh: swr.KeyedMutator<APIKeyItem[]>;
|
|
1448
1478
|
readonly error: any;
|
|
1449
1479
|
readonly isLoading: boolean;
|
|
1450
1480
|
readonly generateOrderlyKey: (scope?: ScopeType) => Promise<{
|
|
@@ -1654,10 +1684,10 @@ type OrderEntryReturn = {
|
|
|
1654
1684
|
declare const useOrderEntry: (symbol: string, options?: Options) => OrderEntryReturn;
|
|
1655
1685
|
|
|
1656
1686
|
declare const useOrderEntity: (order: {
|
|
1657
|
-
[key: string]: any;
|
|
1658
1687
|
symbol: string;
|
|
1659
1688
|
side: OrderSide;
|
|
1660
|
-
reduce_only?: boolean
|
|
1689
|
+
reduce_only?: boolean;
|
|
1690
|
+
[key: string]: any;
|
|
1661
1691
|
}, options?: {
|
|
1662
1692
|
maxQty?: number;
|
|
1663
1693
|
}) => {
|
|
@@ -1694,4 +1724,4 @@ interface IRestrictedAreasParams {
|
|
|
1694
1724
|
}
|
|
1695
1725
|
declare const useRestrictedAreas: (params: IRestrictedAreasParams) => RestrictedAreasReturns;
|
|
1696
1726
|
|
|
1697
|
-
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, AssetHistoryStatusEnum, 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, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, type IRestrictedAreasParams, MarketsStorageKey, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, OrderlyTrackerProvider, type PosterLayoutConfig, type PriceMode, type Recent, RefferalAPI, type RestrictedAreasReturns, ScopeType, StatusContext, type StatusContextState, StatusProvider, type SymbolInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseOrderEntryMetaState, WalletConnectorContext, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, type chainFilter, type chainFilterFunc, checkNotional, cleanStringStyle, type filteredChains$1 as filteredChains, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useConfig, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, usePositionActions, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedAreas, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useTPSLOrder, useTickerStream, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|
|
1727
|
+
export { type APIKeyItem, type AccountRewardsHistory, type AccountRewardsHistoryRow, AssetHistoryStatusEnum, 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, type ExclusiveConfigProviderProps, ExtendedConfigStore, type Favorite, type FavoriteTab, type IRestrictedAreasParams, MarketsStorageKey, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, OrderlyTrackerProvider, type PosterLayoutConfig, type PriceMode, type Recent, RefferalAPI, type RestrictedAreasReturns, ScopeType, StatusContext, type StatusContextState, StatusProvider, type SymbolInfo, TWType, type UseChainsOptions, type UseChainsReturnObject, type UseOrderEntryMetaState, WalletConnectorContext, type WalletRewards, type WalletRewardsHistoryReturns, type WalletRewardsItem, type WalletState, WsNetworkStatus, type chainFilter, type chainFilterFunc, checkNotional, cleanStringStyle, type filteredChains$1 as filteredChains, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useConfig, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, usePositionActions, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedAreas, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageLedgerAddress, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useTPSLOrder, useTickerStream, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|