@orderly.network/hooks 2.4.1 → 2.5.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +83 -14
- package/dist/index.d.ts +83 -14
- package/dist/index.js +775 -339
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +771 -341
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import * as swr from 'swr';
|
|
|
2
2
|
import { SWRConfiguration, SWRHook, SWRResponse } from 'swr';
|
|
3
3
|
export { swr };
|
|
4
4
|
export { KeyedMutator, Middleware, SWRConfiguration, SWRHook, SWRResponse, unstable_serialize, default as useSWR, useSWRConfig } from 'swr';
|
|
5
|
+
import * as swr_mutation from 'swr/mutation';
|
|
5
6
|
import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
|
|
6
7
|
import * as swr_infinite from 'swr/infinite';
|
|
7
8
|
import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
|
|
@@ -31,7 +32,7 @@ declare global {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
declare const _default: "2.
|
|
35
|
+
declare const _default: "2.5.0-alpha.1";
|
|
35
36
|
|
|
36
37
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
37
38
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
@@ -232,6 +233,19 @@ interface OrderlyConfigContextState {
|
|
|
232
233
|
onlyTestnet?: boolean;
|
|
233
234
|
filteredChains?: filteredChains$1 | null;
|
|
234
235
|
customChains?: Chains<undefined, undefined>;
|
|
236
|
+
chainTransformer?: (params: {
|
|
237
|
+
chains: API.Chain[];
|
|
238
|
+
tokenChains: API.Chain[];
|
|
239
|
+
chainInfos: any[];
|
|
240
|
+
swapChains: any[];
|
|
241
|
+
mainnet: boolean;
|
|
242
|
+
}) => API.Chain[];
|
|
243
|
+
/** enable swap deposit, default is true */
|
|
244
|
+
enableSwapDeposit?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Custom orderbook default tick sizes.
|
|
247
|
+
*/
|
|
248
|
+
defaultOrderbookTickSizes: Record<string, string>;
|
|
235
249
|
}
|
|
236
250
|
declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
|
|
237
251
|
declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
|
|
@@ -259,8 +273,11 @@ type BaseConfigProviderProps = {
|
|
|
259
273
|
contracts?: IContract;
|
|
260
274
|
walletAdapters?: WalletAdapter[];
|
|
261
275
|
chainFilter?: filteredChains | filterChainsFunc;
|
|
262
|
-
|
|
263
|
-
|
|
276
|
+
/**
|
|
277
|
+
* Custom orderbook default tick sizes.
|
|
278
|
+
*/
|
|
279
|
+
orderbookDefaultTickSizes?: Record<string, string>;
|
|
280
|
+
} & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer">;
|
|
264
281
|
type ExclusiveConfigProviderProps = {
|
|
265
282
|
brokerId: string;
|
|
266
283
|
brokerName?: string;
|
|
@@ -570,6 +587,19 @@ declare const useLeverage: () => {
|
|
|
570
587
|
readonly maxLeverage: number;
|
|
571
588
|
};
|
|
572
589
|
|
|
590
|
+
declare const useOdosQuote: () => readonly [(data: Record<string, any> | null, params?: Record<string, any>, options?: swr_mutation.SWRMutationConfiguration<unknown, unknown> | undefined) => Promise<any>, {
|
|
591
|
+
readonly data: any;
|
|
592
|
+
readonly error: unknown;
|
|
593
|
+
readonly reset: () => void;
|
|
594
|
+
readonly isMutating: boolean;
|
|
595
|
+
}];
|
|
596
|
+
|
|
597
|
+
interface LTVOptions {
|
|
598
|
+
input?: number;
|
|
599
|
+
token?: string;
|
|
600
|
+
}
|
|
601
|
+
declare const useComputedLTV: (options?: LTVOptions) => number;
|
|
602
|
+
|
|
573
603
|
declare const useTickerStream: (symbol: string) => API.MarketInfo & {
|
|
574
604
|
change?: number;
|
|
575
605
|
"24h_change"?: number;
|
|
@@ -830,11 +860,13 @@ declare const useChain: (token: string) => {
|
|
|
830
860
|
isLoading: boolean;
|
|
831
861
|
};
|
|
832
862
|
|
|
833
|
-
type UseWithdrawOptions = {
|
|
863
|
+
type UseWithdrawOptions$1 = {
|
|
834
864
|
srcChainId?: number;
|
|
865
|
+
token?: string;
|
|
866
|
+
/** orderly token decimals */
|
|
835
867
|
decimals?: number;
|
|
836
868
|
};
|
|
837
|
-
declare const useWithdraw: (options
|
|
869
|
+
declare const useWithdraw: (options: UseWithdrawOptions$1) => {
|
|
838
870
|
dst: {
|
|
839
871
|
symbol: string;
|
|
840
872
|
decimals: number;
|
|
@@ -850,18 +882,25 @@ declare const useWithdraw: (options?: UseWithdrawOptions) => {
|
|
|
850
882
|
}) => Promise<any>;
|
|
851
883
|
isLoading: boolean;
|
|
852
884
|
maxAmount: number;
|
|
885
|
+
unsettledPnL: number;
|
|
853
886
|
availableBalance: number;
|
|
887
|
+
/** @deprecated use maxAmount instead */
|
|
854
888
|
availableWithdraw: number;
|
|
855
|
-
unsettledPnL: number;
|
|
856
889
|
};
|
|
857
890
|
|
|
858
891
|
type DepositOptions = {
|
|
859
892
|
address?: string;
|
|
860
893
|
decimals?: number;
|
|
861
|
-
networkId?: NetworkId;
|
|
862
894
|
srcChainId?: number;
|
|
895
|
+
/** input token */
|
|
863
896
|
srcToken?: string;
|
|
864
|
-
|
|
897
|
+
/** output token */
|
|
898
|
+
dstToken?: string;
|
|
899
|
+
swapEnable?: boolean;
|
|
900
|
+
crossChainRouteAddress?: string;
|
|
901
|
+
depositorAddress?: string;
|
|
902
|
+
/** @deprecated unused, will be removed in the future */
|
|
903
|
+
networkId?: NetworkId;
|
|
865
904
|
};
|
|
866
905
|
declare const useDeposit: (options: DepositOptions) => {
|
|
867
906
|
/** orderly support chain dst */
|
|
@@ -869,8 +908,8 @@ declare const useDeposit: (options: DepositOptions) => {
|
|
|
869
908
|
symbol: string;
|
|
870
909
|
address: string | undefined;
|
|
871
910
|
decimals: number | undefined;
|
|
872
|
-
chainId: number
|
|
873
|
-
network: string
|
|
911
|
+
chainId: number;
|
|
912
|
+
network: string;
|
|
874
913
|
};
|
|
875
914
|
balance: string;
|
|
876
915
|
allowance: string;
|
|
@@ -885,12 +924,23 @@ declare const useDeposit: (options: DepositOptions) => {
|
|
|
885
924
|
depositFeeRevalidating: boolean;
|
|
886
925
|
approve: (amount?: string) => Promise<void | undefined>;
|
|
887
926
|
deposit: () => Promise<any>;
|
|
888
|
-
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
889
927
|
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
928
|
+
fetchBalances: (tokens: API.TokenInfo[]) => Promise<string[]>;
|
|
890
929
|
/** set input quantity */
|
|
891
930
|
setQuantity: react.Dispatch<react.SetStateAction<string>>;
|
|
892
931
|
};
|
|
893
932
|
|
|
933
|
+
interface UseWithdrawOptions {
|
|
934
|
+
token?: string;
|
|
935
|
+
}
|
|
936
|
+
declare const useConvert: (options: UseWithdrawOptions) => {
|
|
937
|
+
maxAmount: number;
|
|
938
|
+
convert: (inputs: {
|
|
939
|
+
amount: number;
|
|
940
|
+
slippage: number;
|
|
941
|
+
}) => Promise<any>;
|
|
942
|
+
};
|
|
943
|
+
|
|
894
944
|
type Receiver = {
|
|
895
945
|
account_id: string;
|
|
896
946
|
amount: number;
|
|
@@ -898,14 +948,13 @@ type Receiver = {
|
|
|
898
948
|
type TransferOptions = {
|
|
899
949
|
/** if not provided, use current account id */
|
|
900
950
|
fromAccountId?: string;
|
|
951
|
+
token?: string;
|
|
901
952
|
};
|
|
902
953
|
declare const useTransfer: (options?: TransferOptions) => {
|
|
903
954
|
submitting: boolean;
|
|
904
955
|
transfer: (token: string, receivers: Receiver | Receiver[]) => Promise<any>;
|
|
905
956
|
maxAmount: number;
|
|
906
957
|
unsettledPnL: number;
|
|
907
|
-
availableBalance: number;
|
|
908
|
-
availableTransfer: number;
|
|
909
958
|
holding: _orderly_network_types.API.Holding[] | undefined;
|
|
910
959
|
};
|
|
911
960
|
|
|
@@ -1191,6 +1240,15 @@ declare const useStorageLedgerAddress: () => {
|
|
|
1191
1240
|
ledgerWallet: any;
|
|
1192
1241
|
};
|
|
1193
1242
|
|
|
1243
|
+
/**
|
|
1244
|
+
* return all tokens info
|
|
1245
|
+
*/
|
|
1246
|
+
declare const useTokensInfo: () => API.Chain[];
|
|
1247
|
+
/**
|
|
1248
|
+
* return token info by specify token
|
|
1249
|
+
*/
|
|
1250
|
+
declare const useTokenInfo: (token: string) => API.Chain | undefined;
|
|
1251
|
+
|
|
1194
1252
|
type UseOrderEntryOptions = {
|
|
1195
1253
|
commify?: boolean;
|
|
1196
1254
|
watchOrderbook?: boolean;
|
|
@@ -2119,6 +2177,17 @@ type Options = {
|
|
|
2119
2177
|
};
|
|
2120
2178
|
declare const useSubAccountWS: (options: Options) => WS;
|
|
2121
2179
|
|
|
2180
|
+
/**
|
|
2181
|
+
* The max withdrawal amount for the token
|
|
2182
|
+
* if token is not provided, return the max withdrawal amount for USDC
|
|
2183
|
+
*/
|
|
2184
|
+
declare function useSubAccountMaxWithdrawal(options: {
|
|
2185
|
+
token?: string;
|
|
2186
|
+
unsettledPnL?: number;
|
|
2187
|
+
freeCollateral: number;
|
|
2188
|
+
holdings?: API.Holding[];
|
|
2189
|
+
}): number;
|
|
2190
|
+
|
|
2122
2191
|
type PositionCloseOptions = {
|
|
2123
2192
|
position: API.PositionExt;
|
|
2124
2193
|
order: {
|
|
@@ -2136,4 +2205,4 @@ declare const usePositionClose: (options: PositionCloseOptions) => {
|
|
|
2136
2205
|
calculate: typeof calculate;
|
|
2137
2206
|
};
|
|
2138
2207
|
|
|
2139
|
-
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, 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, StatusContext, type StatusContextState, type StatusInfo, 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, fetcher, 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, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, 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, usePositionClose, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountDataObserver, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTickerStream, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|
|
2208
|
+
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, 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, StatusContext, type StatusContextState, type StatusInfo, 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, fetcher, type filteredChains$1 as filteredChains, getMinNotional, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, 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, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as swr from 'swr';
|
|
|
2
2
|
import { SWRConfiguration, SWRHook, SWRResponse } from 'swr';
|
|
3
3
|
export { swr };
|
|
4
4
|
export { KeyedMutator, Middleware, SWRConfiguration, SWRHook, SWRResponse, unstable_serialize, default as useSWR, useSWRConfig } from 'swr';
|
|
5
|
+
import * as swr_mutation from 'swr/mutation';
|
|
5
6
|
import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
|
|
6
7
|
import * as swr_infinite from 'swr/infinite';
|
|
7
8
|
import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
|
|
@@ -31,7 +32,7 @@ declare global {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
declare const _default: "2.
|
|
35
|
+
declare const _default: "2.5.0-alpha.1";
|
|
35
36
|
|
|
36
37
|
declare const fetcher: (url: string, init: RequestInit | undefined, queryOptions: useQueryOptions<any>) => Promise<any>;
|
|
37
38
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
@@ -232,6 +233,19 @@ interface OrderlyConfigContextState {
|
|
|
232
233
|
onlyTestnet?: boolean;
|
|
233
234
|
filteredChains?: filteredChains$1 | null;
|
|
234
235
|
customChains?: Chains<undefined, undefined>;
|
|
236
|
+
chainTransformer?: (params: {
|
|
237
|
+
chains: API.Chain[];
|
|
238
|
+
tokenChains: API.Chain[];
|
|
239
|
+
chainInfos: any[];
|
|
240
|
+
swapChains: any[];
|
|
241
|
+
mainnet: boolean;
|
|
242
|
+
}) => API.Chain[];
|
|
243
|
+
/** enable swap deposit, default is true */
|
|
244
|
+
enableSwapDeposit?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Custom orderbook default tick sizes.
|
|
247
|
+
*/
|
|
248
|
+
defaultOrderbookTickSizes: Record<string, string>;
|
|
235
249
|
}
|
|
236
250
|
declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
|
|
237
251
|
declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
|
|
@@ -259,8 +273,11 @@ type BaseConfigProviderProps = {
|
|
|
259
273
|
contracts?: IContract;
|
|
260
274
|
walletAdapters?: WalletAdapter[];
|
|
261
275
|
chainFilter?: filteredChains | filterChainsFunc;
|
|
262
|
-
|
|
263
|
-
|
|
276
|
+
/**
|
|
277
|
+
* Custom orderbook default tick sizes.
|
|
278
|
+
*/
|
|
279
|
+
orderbookDefaultTickSizes?: Record<string, string>;
|
|
280
|
+
} & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer">;
|
|
264
281
|
type ExclusiveConfigProviderProps = {
|
|
265
282
|
brokerId: string;
|
|
266
283
|
brokerName?: string;
|
|
@@ -570,6 +587,19 @@ declare const useLeverage: () => {
|
|
|
570
587
|
readonly maxLeverage: number;
|
|
571
588
|
};
|
|
572
589
|
|
|
590
|
+
declare const useOdosQuote: () => readonly [(data: Record<string, any> | null, params?: Record<string, any>, options?: swr_mutation.SWRMutationConfiguration<unknown, unknown> | undefined) => Promise<any>, {
|
|
591
|
+
readonly data: any;
|
|
592
|
+
readonly error: unknown;
|
|
593
|
+
readonly reset: () => void;
|
|
594
|
+
readonly isMutating: boolean;
|
|
595
|
+
}];
|
|
596
|
+
|
|
597
|
+
interface LTVOptions {
|
|
598
|
+
input?: number;
|
|
599
|
+
token?: string;
|
|
600
|
+
}
|
|
601
|
+
declare const useComputedLTV: (options?: LTVOptions) => number;
|
|
602
|
+
|
|
573
603
|
declare const useTickerStream: (symbol: string) => API.MarketInfo & {
|
|
574
604
|
change?: number;
|
|
575
605
|
"24h_change"?: number;
|
|
@@ -830,11 +860,13 @@ declare const useChain: (token: string) => {
|
|
|
830
860
|
isLoading: boolean;
|
|
831
861
|
};
|
|
832
862
|
|
|
833
|
-
type UseWithdrawOptions = {
|
|
863
|
+
type UseWithdrawOptions$1 = {
|
|
834
864
|
srcChainId?: number;
|
|
865
|
+
token?: string;
|
|
866
|
+
/** orderly token decimals */
|
|
835
867
|
decimals?: number;
|
|
836
868
|
};
|
|
837
|
-
declare const useWithdraw: (options
|
|
869
|
+
declare const useWithdraw: (options: UseWithdrawOptions$1) => {
|
|
838
870
|
dst: {
|
|
839
871
|
symbol: string;
|
|
840
872
|
decimals: number;
|
|
@@ -850,18 +882,25 @@ declare const useWithdraw: (options?: UseWithdrawOptions) => {
|
|
|
850
882
|
}) => Promise<any>;
|
|
851
883
|
isLoading: boolean;
|
|
852
884
|
maxAmount: number;
|
|
885
|
+
unsettledPnL: number;
|
|
853
886
|
availableBalance: number;
|
|
887
|
+
/** @deprecated use maxAmount instead */
|
|
854
888
|
availableWithdraw: number;
|
|
855
|
-
unsettledPnL: number;
|
|
856
889
|
};
|
|
857
890
|
|
|
858
891
|
type DepositOptions = {
|
|
859
892
|
address?: string;
|
|
860
893
|
decimals?: number;
|
|
861
|
-
networkId?: NetworkId;
|
|
862
894
|
srcChainId?: number;
|
|
895
|
+
/** input token */
|
|
863
896
|
srcToken?: string;
|
|
864
|
-
|
|
897
|
+
/** output token */
|
|
898
|
+
dstToken?: string;
|
|
899
|
+
swapEnable?: boolean;
|
|
900
|
+
crossChainRouteAddress?: string;
|
|
901
|
+
depositorAddress?: string;
|
|
902
|
+
/** @deprecated unused, will be removed in the future */
|
|
903
|
+
networkId?: NetworkId;
|
|
865
904
|
};
|
|
866
905
|
declare const useDeposit: (options: DepositOptions) => {
|
|
867
906
|
/** orderly support chain dst */
|
|
@@ -869,8 +908,8 @@ declare const useDeposit: (options: DepositOptions) => {
|
|
|
869
908
|
symbol: string;
|
|
870
909
|
address: string | undefined;
|
|
871
910
|
decimals: number | undefined;
|
|
872
|
-
chainId: number
|
|
873
|
-
network: string
|
|
911
|
+
chainId: number;
|
|
912
|
+
network: string;
|
|
874
913
|
};
|
|
875
914
|
balance: string;
|
|
876
915
|
allowance: string;
|
|
@@ -885,12 +924,23 @@ declare const useDeposit: (options: DepositOptions) => {
|
|
|
885
924
|
depositFeeRevalidating: boolean;
|
|
886
925
|
approve: (amount?: string) => Promise<void | undefined>;
|
|
887
926
|
deposit: () => Promise<any>;
|
|
888
|
-
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
889
927
|
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
928
|
+
fetchBalances: (tokens: API.TokenInfo[]) => Promise<string[]>;
|
|
890
929
|
/** set input quantity */
|
|
891
930
|
setQuantity: react.Dispatch<react.SetStateAction<string>>;
|
|
892
931
|
};
|
|
893
932
|
|
|
933
|
+
interface UseWithdrawOptions {
|
|
934
|
+
token?: string;
|
|
935
|
+
}
|
|
936
|
+
declare const useConvert: (options: UseWithdrawOptions) => {
|
|
937
|
+
maxAmount: number;
|
|
938
|
+
convert: (inputs: {
|
|
939
|
+
amount: number;
|
|
940
|
+
slippage: number;
|
|
941
|
+
}) => Promise<any>;
|
|
942
|
+
};
|
|
943
|
+
|
|
894
944
|
type Receiver = {
|
|
895
945
|
account_id: string;
|
|
896
946
|
amount: number;
|
|
@@ -898,14 +948,13 @@ type Receiver = {
|
|
|
898
948
|
type TransferOptions = {
|
|
899
949
|
/** if not provided, use current account id */
|
|
900
950
|
fromAccountId?: string;
|
|
951
|
+
token?: string;
|
|
901
952
|
};
|
|
902
953
|
declare const useTransfer: (options?: TransferOptions) => {
|
|
903
954
|
submitting: boolean;
|
|
904
955
|
transfer: (token: string, receivers: Receiver | Receiver[]) => Promise<any>;
|
|
905
956
|
maxAmount: number;
|
|
906
957
|
unsettledPnL: number;
|
|
907
|
-
availableBalance: number;
|
|
908
|
-
availableTransfer: number;
|
|
909
958
|
holding: _orderly_network_types.API.Holding[] | undefined;
|
|
910
959
|
};
|
|
911
960
|
|
|
@@ -1191,6 +1240,15 @@ declare const useStorageLedgerAddress: () => {
|
|
|
1191
1240
|
ledgerWallet: any;
|
|
1192
1241
|
};
|
|
1193
1242
|
|
|
1243
|
+
/**
|
|
1244
|
+
* return all tokens info
|
|
1245
|
+
*/
|
|
1246
|
+
declare const useTokensInfo: () => API.Chain[];
|
|
1247
|
+
/**
|
|
1248
|
+
* return token info by specify token
|
|
1249
|
+
*/
|
|
1250
|
+
declare const useTokenInfo: (token: string) => API.Chain | undefined;
|
|
1251
|
+
|
|
1194
1252
|
type UseOrderEntryOptions = {
|
|
1195
1253
|
commify?: boolean;
|
|
1196
1254
|
watchOrderbook?: boolean;
|
|
@@ -2119,6 +2177,17 @@ type Options = {
|
|
|
2119
2177
|
};
|
|
2120
2178
|
declare const useSubAccountWS: (options: Options) => WS;
|
|
2121
2179
|
|
|
2180
|
+
/**
|
|
2181
|
+
* The max withdrawal amount for the token
|
|
2182
|
+
* if token is not provided, return the max withdrawal amount for USDC
|
|
2183
|
+
*/
|
|
2184
|
+
declare function useSubAccountMaxWithdrawal(options: {
|
|
2185
|
+
token?: string;
|
|
2186
|
+
unsettledPnL?: number;
|
|
2187
|
+
freeCollateral: number;
|
|
2188
|
+
holdings?: API.Holding[];
|
|
2189
|
+
}): number;
|
|
2190
|
+
|
|
2122
2191
|
type PositionCloseOptions = {
|
|
2123
2192
|
position: API.PositionExt;
|
|
2124
2193
|
order: {
|
|
@@ -2136,4 +2205,4 @@ declare const usePositionClose: (options: PositionCloseOptions) => {
|
|
|
2136
2205
|
calculate: typeof calculate;
|
|
2137
2206
|
};
|
|
2138
2207
|
|
|
2139
|
-
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, 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, StatusContext, type StatusContextState, type StatusInfo, 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, fetcher, 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, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, 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, usePositionClose, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountDataObserver, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTickerStream, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|
|
2208
|
+
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, 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, StatusContext, type StatusContextState, type StatusInfo, 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, fetcher, type filteredChains$1 as filteredChains, getMinNotional, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry, useOrderEntry$1 as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, 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, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWithdraw, useWsStatus, index as utils, _default as version };
|