@orderly.network/hooks 2.4.2-alpha.0 → 2.5.0-alpha.2

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 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.4.2-alpha.0";
35
+ declare const _default: "2.5.0-alpha.2";
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,18 @@ 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
+ */
235
248
  defaultOrderbookTickSizes: Record<string, string>;
236
249
  }
237
250
  declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
@@ -260,12 +273,11 @@ type BaseConfigProviderProps = {
260
273
  contracts?: IContract;
261
274
  walletAdapters?: WalletAdapter[];
262
275
  chainFilter?: filteredChains | filterChainsFunc;
263
- customChains?: Chains<undefined, undefined>;
264
276
  /**
265
277
  * Custom orderbook default tick sizes.
266
278
  */
267
279
  orderbookDefaultTickSizes?: Record<string, string>;
268
- };
280
+ } & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer">;
269
281
  type ExclusiveConfigProviderProps = {
270
282
  brokerId: string;
271
283
  brokerName?: string;
@@ -575,6 +587,19 @@ declare const useLeverage: () => {
575
587
  readonly maxLeverage: number;
576
588
  };
577
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
+
578
603
  declare const useTickerStream: (symbol: string) => API.MarketInfo & {
579
604
  change?: number;
580
605
  "24h_change"?: number;
@@ -835,11 +860,13 @@ declare const useChain: (token: string) => {
835
860
  isLoading: boolean;
836
861
  };
837
862
 
838
- type UseWithdrawOptions = {
863
+ type UseWithdrawOptions$1 = {
839
864
  srcChainId?: number;
865
+ token?: string;
866
+ /** orderly token decimals */
840
867
  decimals?: number;
841
868
  };
842
- declare const useWithdraw: (options?: UseWithdrawOptions) => {
869
+ declare const useWithdraw: (options: UseWithdrawOptions$1) => {
843
870
  dst: {
844
871
  symbol: string;
845
872
  decimals: number;
@@ -855,18 +882,25 @@ declare const useWithdraw: (options?: UseWithdrawOptions) => {
855
882
  }) => Promise<any>;
856
883
  isLoading: boolean;
857
884
  maxAmount: number;
885
+ unsettledPnL: number;
858
886
  availableBalance: number;
887
+ /** @deprecated use maxAmount instead */
859
888
  availableWithdraw: number;
860
- unsettledPnL: number;
861
889
  };
862
890
 
863
891
  type DepositOptions = {
864
892
  address?: string;
865
893
  decimals?: number;
866
- networkId?: NetworkId;
867
894
  srcChainId?: number;
895
+ /** input token */
868
896
  srcToken?: string;
869
- quantity?: string;
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;
870
904
  };
871
905
  declare const useDeposit: (options: DepositOptions) => {
872
906
  /** orderly support chain dst */
@@ -874,8 +908,8 @@ declare const useDeposit: (options: DepositOptions) => {
874
908
  symbol: string;
875
909
  address: string | undefined;
876
910
  decimals: number | undefined;
877
- chainId: number | undefined;
878
- network: string | undefined;
911
+ chainId: number;
912
+ network: string;
879
913
  };
880
914
  balance: string;
881
915
  allowance: string;
@@ -890,12 +924,23 @@ declare const useDeposit: (options: DepositOptions) => {
890
924
  depositFeeRevalidating: boolean;
891
925
  approve: (amount?: string) => Promise<void | undefined>;
892
926
  deposit: () => Promise<any>;
893
- fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
894
927
  fetchBalance: (address: string, decimals?: number) => Promise<string>;
928
+ fetchBalances: (tokens: API.TokenInfo[]) => Promise<string[]>;
895
929
  /** set input quantity */
896
930
  setQuantity: react.Dispatch<react.SetStateAction<string>>;
897
931
  };
898
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
+
899
944
  type Receiver = {
900
945
  account_id: string;
901
946
  amount: number;
@@ -903,14 +948,13 @@ type Receiver = {
903
948
  type TransferOptions = {
904
949
  /** if not provided, use current account id */
905
950
  fromAccountId?: string;
951
+ token?: string;
906
952
  };
907
953
  declare const useTransfer: (options?: TransferOptions) => {
908
954
  submitting: boolean;
909
955
  transfer: (token: string, receivers: Receiver | Receiver[]) => Promise<any>;
910
956
  maxAmount: number;
911
957
  unsettledPnL: number;
912
- availableBalance: number;
913
- availableTransfer: number;
914
958
  holding: _orderly_network_types.API.Holding[] | undefined;
915
959
  };
916
960
 
@@ -1196,6 +1240,15 @@ declare const useStorageLedgerAddress: () => {
1196
1240
  ledgerWallet: any;
1197
1241
  };
1198
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
+
1199
1252
  type UseOrderEntryOptions = {
1200
1253
  commify?: boolean;
1201
1254
  watchOrderbook?: boolean;
@@ -2124,6 +2177,17 @@ type Options = {
2124
2177
  };
2125
2178
  declare const useSubAccountWS: (options: Options) => WS;
2126
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
+
2127
2191
  type PositionCloseOptions = {
2128
2192
  position: API.PositionExt;
2129
2193
  order: {
@@ -2141,4 +2205,4 @@ declare const usePositionClose: (options: PositionCloseOptions) => {
2141
2205
  calculate: typeof calculate;
2142
2206
  };
2143
2207
 
2144
- 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.4.2-alpha.0";
35
+ declare const _default: "2.5.0-alpha.2";
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,18 @@ 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
+ */
235
248
  defaultOrderbookTickSizes: Record<string, string>;
236
249
  }
237
250
  declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
@@ -260,12 +273,11 @@ type BaseConfigProviderProps = {
260
273
  contracts?: IContract;
261
274
  walletAdapters?: WalletAdapter[];
262
275
  chainFilter?: filteredChains | filterChainsFunc;
263
- customChains?: Chains<undefined, undefined>;
264
276
  /**
265
277
  * Custom orderbook default tick sizes.
266
278
  */
267
279
  orderbookDefaultTickSizes?: Record<string, string>;
268
- };
280
+ } & Pick<OrderlyConfigContextState, "enableSwapDeposit" | "customChains" | "chainTransformer">;
269
281
  type ExclusiveConfigProviderProps = {
270
282
  brokerId: string;
271
283
  brokerName?: string;
@@ -575,6 +587,19 @@ declare const useLeverage: () => {
575
587
  readonly maxLeverage: number;
576
588
  };
577
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
+
578
603
  declare const useTickerStream: (symbol: string) => API.MarketInfo & {
579
604
  change?: number;
580
605
  "24h_change"?: number;
@@ -835,11 +860,13 @@ declare const useChain: (token: string) => {
835
860
  isLoading: boolean;
836
861
  };
837
862
 
838
- type UseWithdrawOptions = {
863
+ type UseWithdrawOptions$1 = {
839
864
  srcChainId?: number;
865
+ token?: string;
866
+ /** orderly token decimals */
840
867
  decimals?: number;
841
868
  };
842
- declare const useWithdraw: (options?: UseWithdrawOptions) => {
869
+ declare const useWithdraw: (options: UseWithdrawOptions$1) => {
843
870
  dst: {
844
871
  symbol: string;
845
872
  decimals: number;
@@ -855,18 +882,25 @@ declare const useWithdraw: (options?: UseWithdrawOptions) => {
855
882
  }) => Promise<any>;
856
883
  isLoading: boolean;
857
884
  maxAmount: number;
885
+ unsettledPnL: number;
858
886
  availableBalance: number;
887
+ /** @deprecated use maxAmount instead */
859
888
  availableWithdraw: number;
860
- unsettledPnL: number;
861
889
  };
862
890
 
863
891
  type DepositOptions = {
864
892
  address?: string;
865
893
  decimals?: number;
866
- networkId?: NetworkId;
867
894
  srcChainId?: number;
895
+ /** input token */
868
896
  srcToken?: string;
869
- quantity?: string;
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;
870
904
  };
871
905
  declare const useDeposit: (options: DepositOptions) => {
872
906
  /** orderly support chain dst */
@@ -874,8 +908,8 @@ declare const useDeposit: (options: DepositOptions) => {
874
908
  symbol: string;
875
909
  address: string | undefined;
876
910
  decimals: number | undefined;
877
- chainId: number | undefined;
878
- network: string | undefined;
911
+ chainId: number;
912
+ network: string;
879
913
  };
880
914
  balance: string;
881
915
  allowance: string;
@@ -890,12 +924,23 @@ declare const useDeposit: (options: DepositOptions) => {
890
924
  depositFeeRevalidating: boolean;
891
925
  approve: (amount?: string) => Promise<void | undefined>;
892
926
  deposit: () => Promise<any>;
893
- fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
894
927
  fetchBalance: (address: string, decimals?: number) => Promise<string>;
928
+ fetchBalances: (tokens: API.TokenInfo[]) => Promise<string[]>;
895
929
  /** set input quantity */
896
930
  setQuantity: react.Dispatch<react.SetStateAction<string>>;
897
931
  };
898
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
+
899
944
  type Receiver = {
900
945
  account_id: string;
901
946
  amount: number;
@@ -903,14 +948,13 @@ type Receiver = {
903
948
  type TransferOptions = {
904
949
  /** if not provided, use current account id */
905
950
  fromAccountId?: string;
951
+ token?: string;
906
952
  };
907
953
  declare const useTransfer: (options?: TransferOptions) => {
908
954
  submitting: boolean;
909
955
  transfer: (token: string, receivers: Receiver | Receiver[]) => Promise<any>;
910
956
  maxAmount: number;
911
957
  unsettledPnL: number;
912
- availableBalance: number;
913
- availableTransfer: number;
914
958
  holding: _orderly_network_types.API.Holding[] | undefined;
915
959
  };
916
960
 
@@ -1196,6 +1240,15 @@ declare const useStorageLedgerAddress: () => {
1196
1240
  ledgerWallet: any;
1197
1241
  };
1198
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
+
1199
1252
  type UseOrderEntryOptions = {
1200
1253
  commify?: boolean;
1201
1254
  watchOrderbook?: boolean;
@@ -2124,6 +2177,17 @@ type Options = {
2124
2177
  };
2125
2178
  declare const useSubAccountWS: (options: Options) => WS;
2126
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
+
2127
2191
  type PositionCloseOptions = {
2128
2192
  position: API.PositionExt;
2129
2193
  order: {
@@ -2141,4 +2205,4 @@ declare const usePositionClose: (options: PositionCloseOptions) => {
2141
2205
  calculate: typeof calculate;
2142
2206
  };
2143
2207
 
2144
- 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 };