@orderly.network/hooks 2.0.7 → 2.0.8-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 +92 -52
- package/dist/index.d.ts +92 -52
- package/dist/index.js +470 -395
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +467 -395
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -11
package/dist/index.d.mts
CHANGED
|
@@ -8,12 +8,11 @@ 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';
|
|
10
10
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
11
|
-
import { NetworkId, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity,
|
|
11
|
+
import { NetworkId, TrackerListenerKeyMap, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, OrderType, OrderlyOrder, AlgoOrderEntity, AlgoOrderType, RequireKeys } from '@orderly.network/types';
|
|
12
12
|
export { default as useConstant } from 'use-constant';
|
|
13
13
|
import { WS } from '@orderly.network/net';
|
|
14
14
|
import * as react from 'react';
|
|
15
15
|
import { PropsWithChildren, FC, ReactNode } from 'react';
|
|
16
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
17
16
|
import { SolanaWalletProvider } from '@orderly.network/default-solana-adapter';
|
|
18
17
|
import { EIP1193Provider } from '@web3-onboard/common';
|
|
19
18
|
import * as swr_subscription from 'swr/subscription';
|
|
@@ -29,7 +28,7 @@ declare global {
|
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
declare const _default: "2.0.
|
|
31
|
+
declare const _default: "2.0.8-alpha.0";
|
|
33
32
|
|
|
34
33
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
35
34
|
formatter?: (data: any) => T;
|
|
@@ -109,6 +108,32 @@ type CurrentChain = {
|
|
|
109
108
|
};
|
|
110
109
|
declare const useNetworkInfo: (networkId: NetworkId) => (chainId: number) => CurrentChain;
|
|
111
110
|
|
|
111
|
+
declare const useTrack: () => {
|
|
112
|
+
track: (eventName: keyof typeof TrackerListenerKeyMap, params: any) => void;
|
|
113
|
+
setTrackUserId: (userId: string) => void;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare enum ENVType$1 {
|
|
117
|
+
prod = "prod",
|
|
118
|
+
staging = "staging",
|
|
119
|
+
qa = "qa",
|
|
120
|
+
dev = "dev"
|
|
121
|
+
}
|
|
122
|
+
declare class AmplitudeTracker {
|
|
123
|
+
static instanceName: string;
|
|
124
|
+
private _userId;
|
|
125
|
+
private _sdkInfoTag;
|
|
126
|
+
private _ee;
|
|
127
|
+
constructor(env: ENVType$1, sdkInfo: any);
|
|
128
|
+
setUserId(userId: string): void;
|
|
129
|
+
setSdkInfo(sdkInfo: any): void;
|
|
130
|
+
identify(identifyEvent: any): void;
|
|
131
|
+
track(eventName: keyof typeof TrackerListenerKeyMap, properties?: any): void;
|
|
132
|
+
private _bindEvents;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare const useTrackingInstance: () => AmplitudeTracker;
|
|
136
|
+
|
|
112
137
|
declare function parseJSON<T>(value: string | null): T | undefined;
|
|
113
138
|
|
|
114
139
|
declare const useWS: () => WS;
|
|
@@ -211,8 +236,6 @@ type ExclusiveConfigProviderProps = {
|
|
|
211
236
|
type ConfigProviderProps = BaseConfigProviderProps & ExclusiveConfigProviderProps;
|
|
212
237
|
declare const OrderlyConfigProvider: FC<PropsWithChildren<ConfigProviderProps>>;
|
|
213
238
|
|
|
214
|
-
declare const OrderlyTrackerProvider: ({ children }: PropsWithChildren) => react_jsx_runtime.JSX.Element;
|
|
215
|
-
|
|
216
239
|
declare class ExtendedConfigStore extends DefaultConfigStore {
|
|
217
240
|
constructor(init: Partial<Record<ConfigKey, any>>);
|
|
218
241
|
get<T>(key: ConfigKey): T;
|
|
@@ -242,7 +265,7 @@ interface WalletConnectorContextState {
|
|
|
242
265
|
chainId: string | number;
|
|
243
266
|
}) => Promise<any>;
|
|
244
267
|
chains: any[];
|
|
245
|
-
wallet: WalletState;
|
|
268
|
+
wallet: WalletState | null;
|
|
246
269
|
connectedChain: ConnectedChain | null;
|
|
247
270
|
settingChain: boolean;
|
|
248
271
|
namespace: ChainNamespace | null;
|
|
@@ -627,6 +650,11 @@ type MarginRatioReturn = {
|
|
|
627
650
|
};
|
|
628
651
|
declare const useMarginRatio: () => MarginRatioReturn;
|
|
629
652
|
|
|
653
|
+
declare function useStorageChain(): {
|
|
654
|
+
storageChain: any;
|
|
655
|
+
setStorageChain: (chainId: number) => void;
|
|
656
|
+
};
|
|
657
|
+
|
|
630
658
|
declare const useChain: (token: string) => {
|
|
631
659
|
chains: API.Chain | null;
|
|
632
660
|
isLoading: boolean;
|
|
@@ -725,6 +753,31 @@ type PriceRange = {
|
|
|
725
753
|
*/
|
|
726
754
|
declare const useSymbolPriceRange: (symbol: string, side: "BUY" | "SELL", price?: number) => PriceRange | undefined;
|
|
727
755
|
|
|
756
|
+
type OrderValidationItem = {
|
|
757
|
+
type: "required";
|
|
758
|
+
message: string;
|
|
759
|
+
value?: never;
|
|
760
|
+
} | {
|
|
761
|
+
type: "max" | "min";
|
|
762
|
+
message: string;
|
|
763
|
+
value: number | string;
|
|
764
|
+
};
|
|
765
|
+
type OrderValidationResult = {
|
|
766
|
+
[P in keyof OrderlyOrder]?: OrderValidationItem;
|
|
767
|
+
};
|
|
768
|
+
type ValuesDepConfig = {
|
|
769
|
+
symbol: API.SymbolExt;
|
|
770
|
+
maxQty: number;
|
|
771
|
+
markPrice: number;
|
|
772
|
+
};
|
|
773
|
+
interface OrderCreator<T> {
|
|
774
|
+
create: (values: T, configs: ValuesDepConfig) => T;
|
|
775
|
+
validate: (values: T, configs: ValuesDepConfig) => Promise<{
|
|
776
|
+
[P in keyof T]?: OrderValidationItem;
|
|
777
|
+
}>;
|
|
778
|
+
get type(): OrderType;
|
|
779
|
+
}
|
|
780
|
+
|
|
728
781
|
type TPSLComputedData = {
|
|
729
782
|
/**
|
|
730
783
|
* Computed take profit
|
|
@@ -741,10 +794,7 @@ type TPSLComputedData = {
|
|
|
741
794
|
};
|
|
742
795
|
type ComputedAlgoOrder = Partial<AlgoOrderEntity<AlgoOrderRootType.TP_SL> & TPSLComputedData>;
|
|
743
796
|
type ValidateError = {
|
|
744
|
-
[P in keyof ComputedAlgoOrder]?:
|
|
745
|
-
type: string;
|
|
746
|
-
message: string;
|
|
747
|
-
};
|
|
797
|
+
[P in keyof ComputedAlgoOrder]?: OrderValidationItem;
|
|
748
798
|
};
|
|
749
799
|
/**
|
|
750
800
|
* @hidden
|
|
@@ -792,13 +842,16 @@ declare const useTPSLOrder: (position: Partial<API.PositionTPSLExt> & Pick<API.P
|
|
|
792
842
|
|
|
793
843
|
declare const useSymbolLeverage: (symbol: string) => number | "-";
|
|
794
844
|
|
|
845
|
+
/**
|
|
846
|
+
* @deprecated use @orderly.network/types AssetHistoryStatusEnum
|
|
847
|
+
*/
|
|
795
848
|
declare enum AssetHistoryStatusEnum {
|
|
796
|
-
NEW = "
|
|
797
|
-
CONFIRM = "
|
|
798
|
-
PROCESSING = "
|
|
799
|
-
COMPLETED = "
|
|
800
|
-
|
|
801
|
-
PENDING_REBALANCE = "
|
|
849
|
+
NEW = "NEW",
|
|
850
|
+
CONFIRM = "CONFIRM",
|
|
851
|
+
PROCESSING = "PROCESSING",
|
|
852
|
+
COMPLETED = "COMPLETED",
|
|
853
|
+
FAILED = "FAILED",
|
|
854
|
+
PENDING_REBALANCE = "PENDING_REBALANCE"
|
|
802
855
|
}
|
|
803
856
|
declare const useAssetsHistory: (options: {
|
|
804
857
|
side?: string;
|
|
@@ -1103,6 +1156,21 @@ declare const DefaultLayoutConfig: PosterLayoutConfig;
|
|
|
1103
1156
|
declare const cleanStringStyle: (str: string | number) => string;
|
|
1104
1157
|
declare function formatNumber(qty?: string | number, dp?: number | string): string | undefined;
|
|
1105
1158
|
|
|
1159
|
+
/**
|
|
1160
|
+
* get the min notional for the order
|
|
1161
|
+
*/
|
|
1162
|
+
declare function getMinNotional(props: {
|
|
1163
|
+
base_tick?: number;
|
|
1164
|
+
price?: string | number;
|
|
1165
|
+
qty?: string | number;
|
|
1166
|
+
min_notional?: number;
|
|
1167
|
+
quote_dp?: number;
|
|
1168
|
+
base_dp?: number;
|
|
1169
|
+
quote_tick?: number;
|
|
1170
|
+
}): string | undefined;
|
|
1171
|
+
/**
|
|
1172
|
+
* @deprecated please use getMinNotional instead
|
|
1173
|
+
*/
|
|
1106
1174
|
declare function checkNotional(props: {
|
|
1107
1175
|
base_tick: number;
|
|
1108
1176
|
price?: string | number;
|
|
@@ -1536,28 +1604,6 @@ declare const useOrderStore: zustand.UseBoundStore<Omit<zustand.StoreApi<OrderEn
|
|
|
1536
1604
|
}>) => void), shouldReplace?: boolean | undefined): void;
|
|
1537
1605
|
}>;
|
|
1538
1606
|
|
|
1539
|
-
type VerifyResult = {
|
|
1540
|
-
[P in keyof OrderlyOrder]?: {
|
|
1541
|
-
type: string;
|
|
1542
|
-
message: string;
|
|
1543
|
-
};
|
|
1544
|
-
};
|
|
1545
|
-
type ValuesDepConfig = {
|
|
1546
|
-
symbol: API.SymbolExt;
|
|
1547
|
-
maxQty: number;
|
|
1548
|
-
markPrice: number;
|
|
1549
|
-
};
|
|
1550
|
-
interface OrderCreator<T> {
|
|
1551
|
-
create: (values: T, configs: ValuesDepConfig) => T;
|
|
1552
|
-
validate: (values: T, configs: ValuesDepConfig) => Promise<{
|
|
1553
|
-
[P in keyof T]?: {
|
|
1554
|
-
type: string;
|
|
1555
|
-
message: string;
|
|
1556
|
-
};
|
|
1557
|
-
}>;
|
|
1558
|
-
get type(): OrderType;
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
1607
|
declare const useOrderEntryNextInternal: (symbol: string, options?: {
|
|
1562
1608
|
/**
|
|
1563
1609
|
* initial order state, default is buy limit order
|
|
@@ -1583,10 +1629,7 @@ declare const useOrderEntryNextInternal: (symbol: string, options?: {
|
|
|
1583
1629
|
maxQty: number;
|
|
1584
1630
|
markPrice: number;
|
|
1585
1631
|
}) => Promise<{
|
|
1586
|
-
[x: string]:
|
|
1587
|
-
type: string;
|
|
1588
|
-
message: string;
|
|
1589
|
-
} | undefined;
|
|
1632
|
+
[x: string]: OrderValidationItem | undefined;
|
|
1590
1633
|
}>;
|
|
1591
1634
|
readonly onMarkPriceChange: (markPrice: number, baseOn?: "total" | "order_quantity") => void;
|
|
1592
1635
|
};
|
|
@@ -1618,12 +1661,12 @@ type OrderEntryReturn = {
|
|
|
1618
1661
|
/**
|
|
1619
1662
|
* @deprecated Use `validate` instead.
|
|
1620
1663
|
*/
|
|
1621
|
-
validator: () => Promise<
|
|
1664
|
+
validator: () => Promise<OrderValidationResult | null>;
|
|
1622
1665
|
/**
|
|
1623
1666
|
* Function to validate the order.
|
|
1624
|
-
* @returns {Promise<
|
|
1667
|
+
* @returns {Promise<OrderValidationResult | null>} The validation result.
|
|
1625
1668
|
*/
|
|
1626
|
-
validate: () => Promise<
|
|
1669
|
+
validate: () => Promise<OrderValidationResult | null>;
|
|
1627
1670
|
};
|
|
1628
1671
|
freeCollateral: number;
|
|
1629
1672
|
/**
|
|
@@ -1646,7 +1689,7 @@ type OrderEntryReturn = {
|
|
|
1646
1689
|
};
|
|
1647
1690
|
submitted: boolean;
|
|
1648
1691
|
validated: boolean;
|
|
1649
|
-
errors:
|
|
1692
|
+
errors: OrderValidationResult | null;
|
|
1650
1693
|
};
|
|
1651
1694
|
/**
|
|
1652
1695
|
* Indicates if a mutation (order creation) is in progress.
|
|
@@ -1710,11 +1753,8 @@ declare const useOrderEntity: (order: {
|
|
|
1710
1753
|
}, options?: {
|
|
1711
1754
|
maxQty?: number;
|
|
1712
1755
|
}) => {
|
|
1713
|
-
validate: () => Promise<
|
|
1714
|
-
errors: Partial<Record<string | number,
|
|
1715
|
-
type: string;
|
|
1716
|
-
message: string;
|
|
1717
|
-
}>> | undefined;
|
|
1756
|
+
validate: () => Promise<OrderValidationResult | null>;
|
|
1757
|
+
errors: Partial<Record<string | number, OrderValidationItem>> | undefined;
|
|
1718
1758
|
markPrice: number;
|
|
1719
1759
|
symbolInfo: {
|
|
1720
1760
|
[x: string]: (key?: keyof _orderly_network_types.API.SymbolExt | undefined, defaultValue?: ValueOf<_orderly_network_types.API.SymbolExt> | undefined) => any;
|
|
@@ -1743,4 +1783,4 @@ declare const useRestrictedInfo: (options?: RestrictedInfoOptions) => {
|
|
|
1743
1783
|
}) => ReactNode);
|
|
1744
1784
|
};
|
|
1745
1785
|
|
|
1746
|
-
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, MarketsStorageKey, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider,
|
|
1786
|
+
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, MarketsStorageKey, 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, 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, getMinNotional, 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, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useTPSLOrder, useTickerStream, useTrack, useTrackingInstance, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,11 @@ 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';
|
|
10
10
|
import * as _orderly_network_types from '@orderly.network/types';
|
|
11
|
-
import { NetworkId, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity,
|
|
11
|
+
import { NetworkId, TrackerListenerKeyMap, API, Chain as Chain$1, ChainNamespace, WSMessage, OrderStatus, OrderSide, AlgoOrderRootType, OrderEntity, OrderType, OrderlyOrder, AlgoOrderEntity, AlgoOrderType, RequireKeys } from '@orderly.network/types';
|
|
12
12
|
export { default as useConstant } from 'use-constant';
|
|
13
13
|
import { WS } from '@orderly.network/net';
|
|
14
14
|
import * as react from 'react';
|
|
15
15
|
import { PropsWithChildren, FC, ReactNode } from 'react';
|
|
16
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
17
16
|
import { SolanaWalletProvider } from '@orderly.network/default-solana-adapter';
|
|
18
17
|
import { EIP1193Provider } from '@web3-onboard/common';
|
|
19
18
|
import * as swr_subscription from 'swr/subscription';
|
|
@@ -29,7 +28,7 @@ declare global {
|
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
declare const _default: "2.0.
|
|
31
|
+
declare const _default: "2.0.8-alpha.0";
|
|
33
32
|
|
|
34
33
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
35
34
|
formatter?: (data: any) => T;
|
|
@@ -109,6 +108,32 @@ type CurrentChain = {
|
|
|
109
108
|
};
|
|
110
109
|
declare const useNetworkInfo: (networkId: NetworkId) => (chainId: number) => CurrentChain;
|
|
111
110
|
|
|
111
|
+
declare const useTrack: () => {
|
|
112
|
+
track: (eventName: keyof typeof TrackerListenerKeyMap, params: any) => void;
|
|
113
|
+
setTrackUserId: (userId: string) => void;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare enum ENVType$1 {
|
|
117
|
+
prod = "prod",
|
|
118
|
+
staging = "staging",
|
|
119
|
+
qa = "qa",
|
|
120
|
+
dev = "dev"
|
|
121
|
+
}
|
|
122
|
+
declare class AmplitudeTracker {
|
|
123
|
+
static instanceName: string;
|
|
124
|
+
private _userId;
|
|
125
|
+
private _sdkInfoTag;
|
|
126
|
+
private _ee;
|
|
127
|
+
constructor(env: ENVType$1, sdkInfo: any);
|
|
128
|
+
setUserId(userId: string): void;
|
|
129
|
+
setSdkInfo(sdkInfo: any): void;
|
|
130
|
+
identify(identifyEvent: any): void;
|
|
131
|
+
track(eventName: keyof typeof TrackerListenerKeyMap, properties?: any): void;
|
|
132
|
+
private _bindEvents;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare const useTrackingInstance: () => AmplitudeTracker;
|
|
136
|
+
|
|
112
137
|
declare function parseJSON<T>(value: string | null): T | undefined;
|
|
113
138
|
|
|
114
139
|
declare const useWS: () => WS;
|
|
@@ -211,8 +236,6 @@ type ExclusiveConfigProviderProps = {
|
|
|
211
236
|
type ConfigProviderProps = BaseConfigProviderProps & ExclusiveConfigProviderProps;
|
|
212
237
|
declare const OrderlyConfigProvider: FC<PropsWithChildren<ConfigProviderProps>>;
|
|
213
238
|
|
|
214
|
-
declare const OrderlyTrackerProvider: ({ children }: PropsWithChildren) => react_jsx_runtime.JSX.Element;
|
|
215
|
-
|
|
216
239
|
declare class ExtendedConfigStore extends DefaultConfigStore {
|
|
217
240
|
constructor(init: Partial<Record<ConfigKey, any>>);
|
|
218
241
|
get<T>(key: ConfigKey): T;
|
|
@@ -242,7 +265,7 @@ interface WalletConnectorContextState {
|
|
|
242
265
|
chainId: string | number;
|
|
243
266
|
}) => Promise<any>;
|
|
244
267
|
chains: any[];
|
|
245
|
-
wallet: WalletState;
|
|
268
|
+
wallet: WalletState | null;
|
|
246
269
|
connectedChain: ConnectedChain | null;
|
|
247
270
|
settingChain: boolean;
|
|
248
271
|
namespace: ChainNamespace | null;
|
|
@@ -627,6 +650,11 @@ type MarginRatioReturn = {
|
|
|
627
650
|
};
|
|
628
651
|
declare const useMarginRatio: () => MarginRatioReturn;
|
|
629
652
|
|
|
653
|
+
declare function useStorageChain(): {
|
|
654
|
+
storageChain: any;
|
|
655
|
+
setStorageChain: (chainId: number) => void;
|
|
656
|
+
};
|
|
657
|
+
|
|
630
658
|
declare const useChain: (token: string) => {
|
|
631
659
|
chains: API.Chain | null;
|
|
632
660
|
isLoading: boolean;
|
|
@@ -725,6 +753,31 @@ type PriceRange = {
|
|
|
725
753
|
*/
|
|
726
754
|
declare const useSymbolPriceRange: (symbol: string, side: "BUY" | "SELL", price?: number) => PriceRange | undefined;
|
|
727
755
|
|
|
756
|
+
type OrderValidationItem = {
|
|
757
|
+
type: "required";
|
|
758
|
+
message: string;
|
|
759
|
+
value?: never;
|
|
760
|
+
} | {
|
|
761
|
+
type: "max" | "min";
|
|
762
|
+
message: string;
|
|
763
|
+
value: number | string;
|
|
764
|
+
};
|
|
765
|
+
type OrderValidationResult = {
|
|
766
|
+
[P in keyof OrderlyOrder]?: OrderValidationItem;
|
|
767
|
+
};
|
|
768
|
+
type ValuesDepConfig = {
|
|
769
|
+
symbol: API.SymbolExt;
|
|
770
|
+
maxQty: number;
|
|
771
|
+
markPrice: number;
|
|
772
|
+
};
|
|
773
|
+
interface OrderCreator<T> {
|
|
774
|
+
create: (values: T, configs: ValuesDepConfig) => T;
|
|
775
|
+
validate: (values: T, configs: ValuesDepConfig) => Promise<{
|
|
776
|
+
[P in keyof T]?: OrderValidationItem;
|
|
777
|
+
}>;
|
|
778
|
+
get type(): OrderType;
|
|
779
|
+
}
|
|
780
|
+
|
|
728
781
|
type TPSLComputedData = {
|
|
729
782
|
/**
|
|
730
783
|
* Computed take profit
|
|
@@ -741,10 +794,7 @@ type TPSLComputedData = {
|
|
|
741
794
|
};
|
|
742
795
|
type ComputedAlgoOrder = Partial<AlgoOrderEntity<AlgoOrderRootType.TP_SL> & TPSLComputedData>;
|
|
743
796
|
type ValidateError = {
|
|
744
|
-
[P in keyof ComputedAlgoOrder]?:
|
|
745
|
-
type: string;
|
|
746
|
-
message: string;
|
|
747
|
-
};
|
|
797
|
+
[P in keyof ComputedAlgoOrder]?: OrderValidationItem;
|
|
748
798
|
};
|
|
749
799
|
/**
|
|
750
800
|
* @hidden
|
|
@@ -792,13 +842,16 @@ declare const useTPSLOrder: (position: Partial<API.PositionTPSLExt> & Pick<API.P
|
|
|
792
842
|
|
|
793
843
|
declare const useSymbolLeverage: (symbol: string) => number | "-";
|
|
794
844
|
|
|
845
|
+
/**
|
|
846
|
+
* @deprecated use @orderly.network/types AssetHistoryStatusEnum
|
|
847
|
+
*/
|
|
795
848
|
declare enum AssetHistoryStatusEnum {
|
|
796
|
-
NEW = "
|
|
797
|
-
CONFIRM = "
|
|
798
|
-
PROCESSING = "
|
|
799
|
-
COMPLETED = "
|
|
800
|
-
|
|
801
|
-
PENDING_REBALANCE = "
|
|
849
|
+
NEW = "NEW",
|
|
850
|
+
CONFIRM = "CONFIRM",
|
|
851
|
+
PROCESSING = "PROCESSING",
|
|
852
|
+
COMPLETED = "COMPLETED",
|
|
853
|
+
FAILED = "FAILED",
|
|
854
|
+
PENDING_REBALANCE = "PENDING_REBALANCE"
|
|
802
855
|
}
|
|
803
856
|
declare const useAssetsHistory: (options: {
|
|
804
857
|
side?: string;
|
|
@@ -1103,6 +1156,21 @@ declare const DefaultLayoutConfig: PosterLayoutConfig;
|
|
|
1103
1156
|
declare const cleanStringStyle: (str: string | number) => string;
|
|
1104
1157
|
declare function formatNumber(qty?: string | number, dp?: number | string): string | undefined;
|
|
1105
1158
|
|
|
1159
|
+
/**
|
|
1160
|
+
* get the min notional for the order
|
|
1161
|
+
*/
|
|
1162
|
+
declare function getMinNotional(props: {
|
|
1163
|
+
base_tick?: number;
|
|
1164
|
+
price?: string | number;
|
|
1165
|
+
qty?: string | number;
|
|
1166
|
+
min_notional?: number;
|
|
1167
|
+
quote_dp?: number;
|
|
1168
|
+
base_dp?: number;
|
|
1169
|
+
quote_tick?: number;
|
|
1170
|
+
}): string | undefined;
|
|
1171
|
+
/**
|
|
1172
|
+
* @deprecated please use getMinNotional instead
|
|
1173
|
+
*/
|
|
1106
1174
|
declare function checkNotional(props: {
|
|
1107
1175
|
base_tick: number;
|
|
1108
1176
|
price?: string | number;
|
|
@@ -1536,28 +1604,6 @@ declare const useOrderStore: zustand.UseBoundStore<Omit<zustand.StoreApi<OrderEn
|
|
|
1536
1604
|
}>) => void), shouldReplace?: boolean | undefined): void;
|
|
1537
1605
|
}>;
|
|
1538
1606
|
|
|
1539
|
-
type VerifyResult = {
|
|
1540
|
-
[P in keyof OrderlyOrder]?: {
|
|
1541
|
-
type: string;
|
|
1542
|
-
message: string;
|
|
1543
|
-
};
|
|
1544
|
-
};
|
|
1545
|
-
type ValuesDepConfig = {
|
|
1546
|
-
symbol: API.SymbolExt;
|
|
1547
|
-
maxQty: number;
|
|
1548
|
-
markPrice: number;
|
|
1549
|
-
};
|
|
1550
|
-
interface OrderCreator<T> {
|
|
1551
|
-
create: (values: T, configs: ValuesDepConfig) => T;
|
|
1552
|
-
validate: (values: T, configs: ValuesDepConfig) => Promise<{
|
|
1553
|
-
[P in keyof T]?: {
|
|
1554
|
-
type: string;
|
|
1555
|
-
message: string;
|
|
1556
|
-
};
|
|
1557
|
-
}>;
|
|
1558
|
-
get type(): OrderType;
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
1607
|
declare const useOrderEntryNextInternal: (symbol: string, options?: {
|
|
1562
1608
|
/**
|
|
1563
1609
|
* initial order state, default is buy limit order
|
|
@@ -1583,10 +1629,7 @@ declare const useOrderEntryNextInternal: (symbol: string, options?: {
|
|
|
1583
1629
|
maxQty: number;
|
|
1584
1630
|
markPrice: number;
|
|
1585
1631
|
}) => Promise<{
|
|
1586
|
-
[x: string]:
|
|
1587
|
-
type: string;
|
|
1588
|
-
message: string;
|
|
1589
|
-
} | undefined;
|
|
1632
|
+
[x: string]: OrderValidationItem | undefined;
|
|
1590
1633
|
}>;
|
|
1591
1634
|
readonly onMarkPriceChange: (markPrice: number, baseOn?: "total" | "order_quantity") => void;
|
|
1592
1635
|
};
|
|
@@ -1618,12 +1661,12 @@ type OrderEntryReturn = {
|
|
|
1618
1661
|
/**
|
|
1619
1662
|
* @deprecated Use `validate` instead.
|
|
1620
1663
|
*/
|
|
1621
|
-
validator: () => Promise<
|
|
1664
|
+
validator: () => Promise<OrderValidationResult | null>;
|
|
1622
1665
|
/**
|
|
1623
1666
|
* Function to validate the order.
|
|
1624
|
-
* @returns {Promise<
|
|
1667
|
+
* @returns {Promise<OrderValidationResult | null>} The validation result.
|
|
1625
1668
|
*/
|
|
1626
|
-
validate: () => Promise<
|
|
1669
|
+
validate: () => Promise<OrderValidationResult | null>;
|
|
1627
1670
|
};
|
|
1628
1671
|
freeCollateral: number;
|
|
1629
1672
|
/**
|
|
@@ -1646,7 +1689,7 @@ type OrderEntryReturn = {
|
|
|
1646
1689
|
};
|
|
1647
1690
|
submitted: boolean;
|
|
1648
1691
|
validated: boolean;
|
|
1649
|
-
errors:
|
|
1692
|
+
errors: OrderValidationResult | null;
|
|
1650
1693
|
};
|
|
1651
1694
|
/**
|
|
1652
1695
|
* Indicates if a mutation (order creation) is in progress.
|
|
@@ -1710,11 +1753,8 @@ declare const useOrderEntity: (order: {
|
|
|
1710
1753
|
}, options?: {
|
|
1711
1754
|
maxQty?: number;
|
|
1712
1755
|
}) => {
|
|
1713
|
-
validate: () => Promise<
|
|
1714
|
-
errors: Partial<Record<string | number,
|
|
1715
|
-
type: string;
|
|
1716
|
-
message: string;
|
|
1717
|
-
}>> | undefined;
|
|
1756
|
+
validate: () => Promise<OrderValidationResult | null>;
|
|
1757
|
+
errors: Partial<Record<string | number, OrderValidationItem>> | undefined;
|
|
1718
1758
|
markPrice: number;
|
|
1719
1759
|
symbolInfo: {
|
|
1720
1760
|
[x: string]: (key?: keyof _orderly_network_types.API.SymbolExt | undefined, defaultValue?: ValueOf<_orderly_network_types.API.SymbolExt> | undefined) => any;
|
|
@@ -1743,4 +1783,4 @@ declare const useRestrictedInfo: (options?: RestrictedInfoOptions) => {
|
|
|
1743
1783
|
}) => ReactNode);
|
|
1744
1784
|
};
|
|
1745
1785
|
|
|
1746
|
-
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, MarketsStorageKey, MarketsType, type NewListing, type OrderBookItem, type OrderParams, type OrderbookData, type OrderbookOptions, type OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider,
|
|
1786
|
+
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, MarketsStorageKey, 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, 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, getMinNotional, 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, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useTPSLOrder, useTickerStream, useTrack, useTrackingInstance, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|