@sodax/dapp-kit 1.3.1-beta-rc2 → 1.3.1-beta-rc3
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 +72 -4
- package/dist/index.d.ts +72 -4
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/hooks/backend/index.ts +4 -0
- package/src/hooks/backend/useBackendSubmitSwapTx.ts +55 -0
- package/src/hooks/backend/useBackendSubmitSwapTxStatus.ts +79 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Sodax, SpokeProvider, GetEstimateGasReturnType, TxReturnType, SpokeChainId, StellarSpokeProvider, EvmHubProvider, IWalletProvider, BitcoinSpokeProvider, RadfiWalletBalance, RadfiUtxo, MoneyMarketBorrowParams, MoneyMarketError, RelayErrorCode, MoneyMarketRepayParams, MoneyMarketSupplyParams, MoneyMarketWithdrawParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, MoneyMarketParams, XToken, ReserveData, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteRequest, Result, SolverIntentQuoteResponse, SolverErrorResponse, SolverExecutionResponse, Intent, IntentDeliveryInfo, IntentError, IntentErrorCode, CreateIntentParams, Hex, SolverIntentStatusResponse, CreateLimitOrderParams, IntentResponse, Address as Address$1, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, CreateBridgeIntentParams, SpokeTxHash, HubTxHash, BridgeError, BridgeErrorCode, BridgeLimit, StakeParams, UnstakeParams, ClaimParams, CancelUnstakeParams, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeParams, SodaxConfig } from '@sodax/sdk';
|
|
2
|
-
import { RpcConfig, SpokeChainId as SpokeChainId$1, XToken as XToken$1 } from '@sodax/types';
|
|
3
|
-
import { UseMutationResult, UseQueryResult, UseQueryOptions } from '@tanstack/react-query';
|
|
1
|
+
import { Sodax, SpokeProvider, GetEstimateGasReturnType, TxReturnType, SpokeChainId, StellarSpokeProvider, EvmHubProvider, IWalletProvider, BitcoinSpokeProvider, RadfiWalletBalance, RadfiUtxo, MoneyMarketBorrowParams, MoneyMarketError, RelayErrorCode, MoneyMarketRepayParams, MoneyMarketSupplyParams, MoneyMarketWithdrawParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, MoneyMarketParams, XToken, ReserveData, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteRequest, Result, SolverIntentQuoteResponse, SolverErrorResponse, SolverExecutionResponse, Intent, IntentDeliveryInfo, IntentError, IntentErrorCode, CreateIntentParams, Hex, SolverIntentStatusResponse, CreateLimitOrderParams, IntentResponse, Address as Address$1, UserIntentsResponse, RequestOverrideConfig, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, CreateBridgeIntentParams, SpokeTxHash, HubTxHash, BridgeError, BridgeErrorCode, BridgeLimit, StakeParams, UnstakeParams, ClaimParams, CancelUnstakeParams, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeParams, SodaxConfig } from '@sodax/sdk';
|
|
2
|
+
import { RpcConfig, SpokeChainId as SpokeChainId$1, SubmitSwapTxResponse, SubmitSwapTxRequest, SubmitSwapTxStatusResponse, XToken as XToken$1 } from '@sodax/types';
|
|
3
|
+
import { UseMutationResult, UseQueryResult, UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
import { ReactNode, ReactElement } from 'react';
|
|
6
6
|
|
|
@@ -1035,6 +1035,74 @@ type UseBackendUserIntentsParams = {
|
|
|
1035
1035
|
*/
|
|
1036
1036
|
declare const useBackendUserIntents: ({ params, queryOptions, }: UseBackendUserIntentsParams) => UseQueryResult<UserIntentsResponse | undefined, Error>;
|
|
1037
1037
|
|
|
1038
|
+
type UseBackendSubmitSwapTxParams = {
|
|
1039
|
+
apiConfig?: RequestOverrideConfig;
|
|
1040
|
+
mutationOptions?: UseMutationOptions<SubmitSwapTxResponse, Error, SubmitSwapTxRequest>;
|
|
1041
|
+
};
|
|
1042
|
+
/**
|
|
1043
|
+
* React hook for submitting a swap transaction to be processed by the backend
|
|
1044
|
+
* (relay, post execution to solver, etc.).
|
|
1045
|
+
*
|
|
1046
|
+
* @param {UseBackendSubmitSwapTxParams | undefined} params - Optional parameters:
|
|
1047
|
+
* - `mutationOptions`: React Query mutation options to customize behavior (e.g., onSuccess, onError, retry).
|
|
1048
|
+
*
|
|
1049
|
+
* @returns {UseMutationResult<SubmitSwapTxResponse, Error, SubmitSwapTxRequest>} React Query mutation result:
|
|
1050
|
+
* - `mutate` / `mutateAsync`: Functions to trigger the submission.
|
|
1051
|
+
* - `data`: The submit response on success.
|
|
1052
|
+
* - `isPending`: Loading state.
|
|
1053
|
+
* - `error`: Error instance if the mutation failed.
|
|
1054
|
+
*
|
|
1055
|
+
* @example
|
|
1056
|
+
* const { mutateAsync: submitSwapTx, isPending, error } = useBackendSubmitSwapTx();
|
|
1057
|
+
*
|
|
1058
|
+
* const result = await submitSwapTx({
|
|
1059
|
+
* txHash: '0x123...',
|
|
1060
|
+
* srcChainId: '1',
|
|
1061
|
+
* walletAddress: '0xabc...',
|
|
1062
|
+
* intent: { ... },
|
|
1063
|
+
* relayData: '0x...',
|
|
1064
|
+
* });
|
|
1065
|
+
*/
|
|
1066
|
+
declare const useBackendSubmitSwapTx: (params?: UseBackendSubmitSwapTxParams) => UseMutationResult<SubmitSwapTxResponse, Error, SubmitSwapTxRequest>;
|
|
1067
|
+
|
|
1068
|
+
type UseBackendSubmitSwapTxStatusParams = {
|
|
1069
|
+
params: {
|
|
1070
|
+
txHash: string | undefined;
|
|
1071
|
+
srcChainId?: string;
|
|
1072
|
+
};
|
|
1073
|
+
apiConfig?: RequestOverrideConfig;
|
|
1074
|
+
queryOptions?: UseQueryOptions<SubmitSwapTxStatusResponse | undefined, Error>;
|
|
1075
|
+
};
|
|
1076
|
+
/**
|
|
1077
|
+
* React hook for polling the processing status of a submitted swap transaction.
|
|
1078
|
+
*
|
|
1079
|
+
* @param {UseBackendSubmitSwapTxStatusParams | undefined} params - Parameters for the query:
|
|
1080
|
+
* - `params.txHash`: The transaction hash of the submitted swap; query is disabled if undefined or empty.
|
|
1081
|
+
* - `params.srcChainId`: Optional source chain ID to narrow the status lookup.
|
|
1082
|
+
* - `queryOptions`: Optional React Query options to override default behavior (e.g., refetchInterval, retry).
|
|
1083
|
+
*
|
|
1084
|
+
* @returns {UseQueryResult<SubmitSwapTxStatusResponse | undefined, Error>} React Query result object:
|
|
1085
|
+
* - `data`: The status response or undefined if unavailable.
|
|
1086
|
+
* - `isLoading`: Loading state.
|
|
1087
|
+
* - `error`: Error instance if the query failed.
|
|
1088
|
+
* - `refetch`: Function to re-trigger the query.
|
|
1089
|
+
*
|
|
1090
|
+
* @example
|
|
1091
|
+
* const { data: status, isLoading, error } = useBackendSubmitSwapTxStatus({
|
|
1092
|
+
* params: { txHash: '0x123...', srcChainId: '1' },
|
|
1093
|
+
* });
|
|
1094
|
+
*
|
|
1095
|
+
* if (status?.data.status === 'executed') {
|
|
1096
|
+
* console.log('Swap completed!', status.data.result);
|
|
1097
|
+
* }
|
|
1098
|
+
*
|
|
1099
|
+
* @remarks
|
|
1100
|
+
* - Query is disabled if `params` is undefined or `txHash` is undefined/empty.
|
|
1101
|
+
* - Default refetch interval is 1 second for real-time status polling.
|
|
1102
|
+
* - Uses React Query for state management, caching, and retries.
|
|
1103
|
+
*/
|
|
1104
|
+
declare const useBackendSubmitSwapTxStatus: (params: UseBackendSubmitSwapTxStatusParams | undefined) => UseQueryResult<SubmitSwapTxStatusResponse | undefined, Error>;
|
|
1105
|
+
|
|
1038
1106
|
type UseBackendOrderbookParams = {
|
|
1039
1107
|
queryOptions?: UseQueryOptions<OrderbookResponse | undefined, Error>;
|
|
1040
1108
|
pagination?: BackendPaginationParams;
|
|
@@ -1940,4 +2008,4 @@ interface SodaxProviderProps {
|
|
|
1940
2008
|
}
|
|
1941
2009
|
declare const SodaxProvider: ({ children, testnet, config, rpcConfig }: SodaxProviderProps) => ReactElement;
|
|
1942
2010
|
|
|
1943
|
-
export { type BackendPaginationParams, MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, type MigrationIntentParams, type MigrationMode, type RadfiSession, SodaxProvider, type UseATokenParams, type UseATokensBalancesParams, type UseBorrowParams, type UseMMAllowanceParams, type UseMMApproveParams, type UseRadfiSessionReturn, type UseRepayParams, type UseReservesDataParams, type UseReservesUsdFormatParams, type UseSupplyParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawParams, clearRadfiSession, isAccessTokenExpired, isRefreshTokenExpired, loadRadfiSession, saveRadfiSession, useAToken, useATokensBalances, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendUserIntents, useBitcoinBalance, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useConvertedAssets, useCreateLimitOrder, useDeriveUserWalletAddress, useEstimateGas, useExpiredUtxos, useFundTradingWallet, useGetBridgeableAmount, useGetBridgeableTokens, useGetUserHubWalletAddress, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useMMAllowance, useMMApprove, useMigrate, useMigrationAllowance, useMigrationApprove, useQuote, useRadfiAuth, useRadfiSession, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesUsdFormat, useSodaxContext, useSpokeProvider, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSwap, useSwapAllowance, useSwapApprove, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw };
|
|
2011
|
+
export { type BackendPaginationParams, MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, type MigrationIntentParams, type MigrationMode, type RadfiSession, SodaxProvider, type UseATokenParams, type UseATokensBalancesParams, type UseBorrowParams, type UseMMAllowanceParams, type UseMMApproveParams, type UseRadfiSessionReturn, type UseRepayParams, type UseReservesDataParams, type UseReservesUsdFormatParams, type UseSupplyParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawParams, clearRadfiSession, isAccessTokenExpired, isRefreshTokenExpired, loadRadfiSession, saveRadfiSession, useAToken, useATokensBalances, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendSubmitSwapTx, useBackendSubmitSwapTxStatus, useBackendUserIntents, useBitcoinBalance, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useConvertedAssets, useCreateLimitOrder, useDeriveUserWalletAddress, useEstimateGas, useExpiredUtxos, useFundTradingWallet, useGetBridgeableAmount, useGetBridgeableTokens, useGetUserHubWalletAddress, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useMMAllowance, useMMApprove, useMigrate, useMigrationAllowance, useMigrationApprove, useQuote, useRadfiAuth, useRadfiSession, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesUsdFormat, useSodaxContext, useSpokeProvider, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSwap, useSwapAllowance, useSwapApprove, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Sodax, SpokeProvider, GetEstimateGasReturnType, TxReturnType, SpokeChainId, StellarSpokeProvider, EvmHubProvider, IWalletProvider, BitcoinSpokeProvider, RadfiWalletBalance, RadfiUtxo, MoneyMarketBorrowParams, MoneyMarketError, RelayErrorCode, MoneyMarketRepayParams, MoneyMarketSupplyParams, MoneyMarketWithdrawParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, MoneyMarketParams, XToken, ReserveData, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteRequest, Result, SolverIntentQuoteResponse, SolverErrorResponse, SolverExecutionResponse, Intent, IntentDeliveryInfo, IntentError, IntentErrorCode, CreateIntentParams, Hex, SolverIntentStatusResponse, CreateLimitOrderParams, IntentResponse, Address as Address$1, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, CreateBridgeIntentParams, SpokeTxHash, HubTxHash, BridgeError, BridgeErrorCode, BridgeLimit, StakeParams, UnstakeParams, ClaimParams, CancelUnstakeParams, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeParams, SodaxConfig } from '@sodax/sdk';
|
|
2
|
-
import { RpcConfig, SpokeChainId as SpokeChainId$1, XToken as XToken$1 } from '@sodax/types';
|
|
3
|
-
import { UseMutationResult, UseQueryResult, UseQueryOptions } from '@tanstack/react-query';
|
|
1
|
+
import { Sodax, SpokeProvider, GetEstimateGasReturnType, TxReturnType, SpokeChainId, StellarSpokeProvider, EvmHubProvider, IWalletProvider, BitcoinSpokeProvider, RadfiWalletBalance, RadfiUtxo, MoneyMarketBorrowParams, MoneyMarketError, RelayErrorCode, MoneyMarketRepayParams, MoneyMarketSupplyParams, MoneyMarketWithdrawParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, MoneyMarketParams, XToken, ReserveData, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteRequest, Result, SolverIntentQuoteResponse, SolverErrorResponse, SolverExecutionResponse, Intent, IntentDeliveryInfo, IntentError, IntentErrorCode, CreateIntentParams, Hex, SolverIntentStatusResponse, CreateLimitOrderParams, IntentResponse, Address as Address$1, UserIntentsResponse, RequestOverrideConfig, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, CreateBridgeIntentParams, SpokeTxHash, HubTxHash, BridgeError, BridgeErrorCode, BridgeLimit, StakeParams, UnstakeParams, ClaimParams, CancelUnstakeParams, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeParams, SodaxConfig } from '@sodax/sdk';
|
|
2
|
+
import { RpcConfig, SpokeChainId as SpokeChainId$1, SubmitSwapTxResponse, SubmitSwapTxRequest, SubmitSwapTxStatusResponse, XToken as XToken$1 } from '@sodax/types';
|
|
3
|
+
import { UseMutationResult, UseQueryResult, UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
import { ReactNode, ReactElement } from 'react';
|
|
6
6
|
|
|
@@ -1035,6 +1035,74 @@ type UseBackendUserIntentsParams = {
|
|
|
1035
1035
|
*/
|
|
1036
1036
|
declare const useBackendUserIntents: ({ params, queryOptions, }: UseBackendUserIntentsParams) => UseQueryResult<UserIntentsResponse | undefined, Error>;
|
|
1037
1037
|
|
|
1038
|
+
type UseBackendSubmitSwapTxParams = {
|
|
1039
|
+
apiConfig?: RequestOverrideConfig;
|
|
1040
|
+
mutationOptions?: UseMutationOptions<SubmitSwapTxResponse, Error, SubmitSwapTxRequest>;
|
|
1041
|
+
};
|
|
1042
|
+
/**
|
|
1043
|
+
* React hook for submitting a swap transaction to be processed by the backend
|
|
1044
|
+
* (relay, post execution to solver, etc.).
|
|
1045
|
+
*
|
|
1046
|
+
* @param {UseBackendSubmitSwapTxParams | undefined} params - Optional parameters:
|
|
1047
|
+
* - `mutationOptions`: React Query mutation options to customize behavior (e.g., onSuccess, onError, retry).
|
|
1048
|
+
*
|
|
1049
|
+
* @returns {UseMutationResult<SubmitSwapTxResponse, Error, SubmitSwapTxRequest>} React Query mutation result:
|
|
1050
|
+
* - `mutate` / `mutateAsync`: Functions to trigger the submission.
|
|
1051
|
+
* - `data`: The submit response on success.
|
|
1052
|
+
* - `isPending`: Loading state.
|
|
1053
|
+
* - `error`: Error instance if the mutation failed.
|
|
1054
|
+
*
|
|
1055
|
+
* @example
|
|
1056
|
+
* const { mutateAsync: submitSwapTx, isPending, error } = useBackendSubmitSwapTx();
|
|
1057
|
+
*
|
|
1058
|
+
* const result = await submitSwapTx({
|
|
1059
|
+
* txHash: '0x123...',
|
|
1060
|
+
* srcChainId: '1',
|
|
1061
|
+
* walletAddress: '0xabc...',
|
|
1062
|
+
* intent: { ... },
|
|
1063
|
+
* relayData: '0x...',
|
|
1064
|
+
* });
|
|
1065
|
+
*/
|
|
1066
|
+
declare const useBackendSubmitSwapTx: (params?: UseBackendSubmitSwapTxParams) => UseMutationResult<SubmitSwapTxResponse, Error, SubmitSwapTxRequest>;
|
|
1067
|
+
|
|
1068
|
+
type UseBackendSubmitSwapTxStatusParams = {
|
|
1069
|
+
params: {
|
|
1070
|
+
txHash: string | undefined;
|
|
1071
|
+
srcChainId?: string;
|
|
1072
|
+
};
|
|
1073
|
+
apiConfig?: RequestOverrideConfig;
|
|
1074
|
+
queryOptions?: UseQueryOptions<SubmitSwapTxStatusResponse | undefined, Error>;
|
|
1075
|
+
};
|
|
1076
|
+
/**
|
|
1077
|
+
* React hook for polling the processing status of a submitted swap transaction.
|
|
1078
|
+
*
|
|
1079
|
+
* @param {UseBackendSubmitSwapTxStatusParams | undefined} params - Parameters for the query:
|
|
1080
|
+
* - `params.txHash`: The transaction hash of the submitted swap; query is disabled if undefined or empty.
|
|
1081
|
+
* - `params.srcChainId`: Optional source chain ID to narrow the status lookup.
|
|
1082
|
+
* - `queryOptions`: Optional React Query options to override default behavior (e.g., refetchInterval, retry).
|
|
1083
|
+
*
|
|
1084
|
+
* @returns {UseQueryResult<SubmitSwapTxStatusResponse | undefined, Error>} React Query result object:
|
|
1085
|
+
* - `data`: The status response or undefined if unavailable.
|
|
1086
|
+
* - `isLoading`: Loading state.
|
|
1087
|
+
* - `error`: Error instance if the query failed.
|
|
1088
|
+
* - `refetch`: Function to re-trigger the query.
|
|
1089
|
+
*
|
|
1090
|
+
* @example
|
|
1091
|
+
* const { data: status, isLoading, error } = useBackendSubmitSwapTxStatus({
|
|
1092
|
+
* params: { txHash: '0x123...', srcChainId: '1' },
|
|
1093
|
+
* });
|
|
1094
|
+
*
|
|
1095
|
+
* if (status?.data.status === 'executed') {
|
|
1096
|
+
* console.log('Swap completed!', status.data.result);
|
|
1097
|
+
* }
|
|
1098
|
+
*
|
|
1099
|
+
* @remarks
|
|
1100
|
+
* - Query is disabled if `params` is undefined or `txHash` is undefined/empty.
|
|
1101
|
+
* - Default refetch interval is 1 second for real-time status polling.
|
|
1102
|
+
* - Uses React Query for state management, caching, and retries.
|
|
1103
|
+
*/
|
|
1104
|
+
declare const useBackendSubmitSwapTxStatus: (params: UseBackendSubmitSwapTxStatusParams | undefined) => UseQueryResult<SubmitSwapTxStatusResponse | undefined, Error>;
|
|
1105
|
+
|
|
1038
1106
|
type UseBackendOrderbookParams = {
|
|
1039
1107
|
queryOptions?: UseQueryOptions<OrderbookResponse | undefined, Error>;
|
|
1040
1108
|
pagination?: BackendPaginationParams;
|
|
@@ -1940,4 +2008,4 @@ interface SodaxProviderProps {
|
|
|
1940
2008
|
}
|
|
1941
2009
|
declare const SodaxProvider: ({ children, testnet, config, rpcConfig }: SodaxProviderProps) => ReactElement;
|
|
1942
2010
|
|
|
1943
|
-
export { type BackendPaginationParams, MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, type MigrationIntentParams, type MigrationMode, type RadfiSession, SodaxProvider, type UseATokenParams, type UseATokensBalancesParams, type UseBorrowParams, type UseMMAllowanceParams, type UseMMApproveParams, type UseRadfiSessionReturn, type UseRepayParams, type UseReservesDataParams, type UseReservesUsdFormatParams, type UseSupplyParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawParams, clearRadfiSession, isAccessTokenExpired, isRefreshTokenExpired, loadRadfiSession, saveRadfiSession, useAToken, useATokensBalances, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendUserIntents, useBitcoinBalance, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useConvertedAssets, useCreateLimitOrder, useDeriveUserWalletAddress, useEstimateGas, useExpiredUtxos, useFundTradingWallet, useGetBridgeableAmount, useGetBridgeableTokens, useGetUserHubWalletAddress, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useMMAllowance, useMMApprove, useMigrate, useMigrationAllowance, useMigrationApprove, useQuote, useRadfiAuth, useRadfiSession, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesUsdFormat, useSodaxContext, useSpokeProvider, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSwap, useSwapAllowance, useSwapApprove, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw };
|
|
2011
|
+
export { type BackendPaginationParams, MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, type MigrationIntentParams, type MigrationMode, type RadfiSession, SodaxProvider, type UseATokenParams, type UseATokensBalancesParams, type UseBorrowParams, type UseMMAllowanceParams, type UseMMApproveParams, type UseRadfiSessionReturn, type UseRepayParams, type UseReservesDataParams, type UseReservesUsdFormatParams, type UseSupplyParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawParams, clearRadfiSession, isAccessTokenExpired, isRefreshTokenExpired, loadRadfiSession, saveRadfiSession, useAToken, useATokensBalances, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendSubmitSwapTx, useBackendSubmitSwapTxStatus, useBackendUserIntents, useBitcoinBalance, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useConvertedAssets, useCreateLimitOrder, useDeriveUserWalletAddress, useEstimateGas, useExpiredUtxos, useFundTradingWallet, useGetBridgeableAmount, useGetBridgeableTokens, useGetUserHubWalletAddress, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useMMAllowance, useMMApprove, useMigrate, useMigrationAllowance, useMigrationApprove, useQuote, useRadfiAuth, useRadfiSession, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesUsdFormat, useSodaxContext, useSpokeProvider, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSwap, useSwapAllowance, useSwapApprove, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw };
|
package/dist/index.js
CHANGED
|
@@ -991,6 +991,54 @@ var useBackendUserIntents = ({
|
|
|
991
991
|
}
|
|
992
992
|
});
|
|
993
993
|
};
|
|
994
|
+
var useBackendSubmitSwapTx = (params) => {
|
|
995
|
+
const { sodax } = useSodaxContext();
|
|
996
|
+
const defaultMutationOptions = {
|
|
997
|
+
retry: 3
|
|
998
|
+
};
|
|
999
|
+
const mutationOptions = {
|
|
1000
|
+
...defaultMutationOptions,
|
|
1001
|
+
...params?.mutationOptions
|
|
1002
|
+
};
|
|
1003
|
+
return reactQuery.useMutation({
|
|
1004
|
+
...mutationOptions,
|
|
1005
|
+
mutationFn: async (request) => {
|
|
1006
|
+
return sodax.backendApi.submitSwapTx(request, params?.apiConfig);
|
|
1007
|
+
}
|
|
1008
|
+
});
|
|
1009
|
+
};
|
|
1010
|
+
var useBackendSubmitSwapTxStatus = (params) => {
|
|
1011
|
+
const { sodax } = useSodaxContext();
|
|
1012
|
+
const defaultQueryOptions = {
|
|
1013
|
+
queryKey: ["api", "swaps", "submit-tx", "status", params?.params?.txHash, params?.params?.srcChainId],
|
|
1014
|
+
enabled: !!params?.params?.txHash && params.params.txHash.length > 0,
|
|
1015
|
+
retry: 3,
|
|
1016
|
+
refetchInterval: (query) => {
|
|
1017
|
+
const status = query.state.data?.data?.status;
|
|
1018
|
+
if (status === "executed" || status === "failed") return false;
|
|
1019
|
+
return 1e3;
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
const queryOptions = {
|
|
1023
|
+
...defaultQueryOptions,
|
|
1024
|
+
...params?.queryOptions
|
|
1025
|
+
};
|
|
1026
|
+
return reactQuery.useQuery({
|
|
1027
|
+
...queryOptions,
|
|
1028
|
+
queryFn: async () => {
|
|
1029
|
+
if (!params?.params?.txHash) {
|
|
1030
|
+
return void 0;
|
|
1031
|
+
}
|
|
1032
|
+
return sodax.backendApi.getSubmitSwapTxStatus(
|
|
1033
|
+
{
|
|
1034
|
+
txHash: params.params.txHash,
|
|
1035
|
+
srcChainId: params.params.srcChainId
|
|
1036
|
+
},
|
|
1037
|
+
params.apiConfig
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
};
|
|
994
1042
|
var useBackendOrderbook = (params) => {
|
|
995
1043
|
const { sodax } = useSodaxContext();
|
|
996
1044
|
const defaultQueryOptions = {
|
|
@@ -1804,6 +1852,8 @@ exports.useBackendMoneyMarketAssetBorrowers = useBackendMoneyMarketAssetBorrower
|
|
|
1804
1852
|
exports.useBackendMoneyMarketAssetSuppliers = useBackendMoneyMarketAssetSuppliers;
|
|
1805
1853
|
exports.useBackendMoneyMarketPosition = useBackendMoneyMarketPosition;
|
|
1806
1854
|
exports.useBackendOrderbook = useBackendOrderbook;
|
|
1855
|
+
exports.useBackendSubmitSwapTx = useBackendSubmitSwapTx;
|
|
1856
|
+
exports.useBackendSubmitSwapTxStatus = useBackendSubmitSwapTxStatus;
|
|
1807
1857
|
exports.useBackendUserIntents = useBackendUserIntents;
|
|
1808
1858
|
exports.useBitcoinBalance = useBitcoinBalance;
|
|
1809
1859
|
exports.useBorrow = useBorrow;
|