@sodax/dapp-kit 2.4.0-rc.1 → 2.4.0-rc.3
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/README.md +11 -3
- package/dist/index.d.ts +395 -2413
- package/dist/index.mjs +206 -31
- package/package.json +2 -2
- package/src/hooks/_apiKeyWire.test.ts +4 -29
- package/src/hooks/_mutationContract.test.ts +2 -8
- package/src/hooks/backend/index.ts +0 -13
- package/src/hooks/backend/useBackendAllMoneyMarketAssets.ts +0 -6
- package/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts +0 -10
- package/src/hooks/backend/useBackendIntentByHash.ts +0 -6
- package/src/hooks/backend/useBackendIntentByTxHash.ts +1 -10
- package/src/hooks/backend/useBackendMoneyMarketAsset.ts +0 -6
- package/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts +0 -8
- package/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts +0 -8
- package/src/hooks/backend/useBackendMoneyMarketPosition.ts +0 -6
- package/src/hooks/backend/useBackendOracleCandles.ts +1 -9
- package/src/hooks/backend/useBackendOracleMarkets.ts +1 -7
- package/src/hooks/backend/useBackendOrderbook.ts +0 -6
- package/src/hooks/backend/useBackendUserIntents.ts +0 -8
- package/src/hooks/bitcoin/resolveBtcReadAddress.test.ts +1 -3
- package/src/hooks/bitcoin/resolveBtcReadAddress.ts +2 -12
- package/src/hooks/bitcoin/useBitcoinBalance.ts +1 -7
- package/src/hooks/bitcoin/useBitcoinTradingSetup.ts +2 -4
- package/src/hooks/bitcoin/useEnsureRadfiAccessToken.ts +2 -13
- package/src/hooks/bitcoin/useFundTradingWallet.ts +0 -6
- package/src/hooks/bitcoin/useRadfiAuth.ts +1 -6
- package/src/hooks/bitcoin/useRadfiSession.ts +0 -1
- package/src/hooks/bitcoin/useRadfiWithdraw.ts +0 -6
- package/src/hooks/bitcoin/useRenewUtxos.ts +0 -5
- package/src/hooks/bitcoin/useTradingWallet.ts +1 -4
- package/src/hooks/bridge/getBridgeDetailedStatusRefetchInterval.test.ts +1 -7
- package/src/hooks/bridge/getBridgeDetailedStatusRefetchInterval.ts +7 -21
- package/src/hooks/bridge/useBridge.test.ts +1 -11
- package/src/hooks/bridge/useBridge.ts +2 -12
- package/src/hooks/bridge/useBridgeAllowance.ts +1 -2
- package/src/hooks/bridge/useBridgeApprovalStrategy.ts +2 -6
- package/src/hooks/bridge/useBridgeApprove.ts +2 -14
- package/src/hooks/bridge/useBridgeDetailedStatus.test.ts +2 -11
- package/src/hooks/bridge/useBridgeDetailedStatus.ts +3 -23
- package/src/hooks/bridge/useBridgeWithApproval.ts +2 -11
- package/src/hooks/bridgeApi/getBridgeSubmitTxStatusRefetchInterval.test.ts +2 -7
- package/src/hooks/bridgeApi/getBridgeSubmitTxStatusRefetchInterval.ts +2 -13
- package/src/hooks/bridgeApi/index.ts +11 -14
- package/src/hooks/bridgeApi/useBridgeApiAllowance.ts +1 -9
- package/src/hooks/bridgeApi/useBridgeApiApprove.ts +2 -17
- package/src/hooks/bridgeApi/useBridgeApiApproveAndBroadcast.test.ts +2 -13
- package/src/hooks/bridgeApi/useBridgeApiApproveAndBroadcast.ts +3 -20
- package/src/hooks/bridgeApi/useBridgeApiBridgeableAmount.ts +1 -12
- package/src/hooks/bridgeApi/useBridgeApiCreateBridgeIntent.ts +1 -14
- package/src/hooks/bridgeApi/useBridgeApiFee.ts +2 -11
- package/src/hooks/bridgeApi/useBridgeApiIsBridgeable.ts +1 -12
- package/src/hooks/bridgeApi/useBridgeApiSubmitTx.ts +2 -23
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.test.ts +1 -9
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.ts +1 -19
- package/src/hooks/bridgeApi/useBridgeApiTokens.ts +0 -8
- package/src/hooks/bridgeApi/useBridgeApiTokensByChain.ts +0 -7
- package/src/hooks/dex/useClaimRewards.ts +1 -12
- package/src/hooks/dex/useCreateDecreaseLiquidityParams.ts +1 -5
- package/src/hooks/dex/useCreateDepositParams.ts +1 -5
- package/src/hooks/dex/useCreateSupplyLiquidityParams.ts +1 -10
- package/src/hooks/dex/useCreateWithdrawParams.ts +1 -5
- package/src/hooks/dex/useDecreaseLiquidity.ts +2 -15
- package/src/hooks/dex/useDexAllowance.ts +1 -5
- package/src/hooks/dex/useDexApprove.ts +1 -12
- package/src/hooks/dex/useDexDeposit.ts +1 -23
- package/src/hooks/dex/useDexWithdraw.ts +1 -13
- package/src/hooks/dex/useLiquidityAmounts.ts +1 -4
- package/src/hooks/dex/usePoolBalances.ts +0 -4
- package/src/hooks/dex/usePoolData.ts +1 -4
- package/src/hooks/dex/usePools.ts +1 -4
- package/src/hooks/dex/usePositionInfo.ts +1 -4
- package/src/hooks/dex/useSupplyLiquidity.ts +3 -20
- package/src/hooks/leverageYield/useApproveLeveragePositionFunding.ts +2 -8
- package/src/hooks/leverageYield/useLeveragePositionAccount.ts +2 -13
- package/src/hooks/leverageYield/useLeveragePositionCollateral.ts +2 -14
- package/src/hooks/leverageYield/useLeveragePositionFundingAllowance.ts +2 -9
- package/src/hooks/leverageYield/useLeveragePositionInfo.ts +1 -13
- package/src/hooks/leverageYield/useLeveragePositionPayoutAddress.ts +3 -15
- package/src/hooks/leverageYield/useLeveragePositionPending.ts +2 -16
- package/src/hooks/leverageYield/useLeveragePositions.ts +1 -15
- package/src/hooks/leverageYield/useLeveragePositionsForUser.ts +1 -15
- package/src/hooks/leverageYield/useLeverageYieldApprovalStrategy.ts +1 -6
- package/src/hooks/leverageYield/useLeverageYieldDeposit.ts +1 -17
- package/src/hooks/leverageYield/useLeverageYieldDetailedStatus.test.ts +3 -14
- package/src/hooks/leverageYield/useLeverageYieldDetailedStatus.ts +2 -19
- package/src/hooks/leverageYield/useLeverageYieldEffectiveApr.ts +1 -12
- package/src/hooks/leverageYield/useLeverageYieldNotifySolver.ts +1 -11
- package/src/hooks/leverageYield/useLeverageYieldPosition.ts +1 -13
- package/src/hooks/leverageYield/useLeverageYieldPreviewRedeem.ts +1 -12
- package/src/hooks/leverageYield/useLeverageYieldQuote.test.ts +3 -13
- package/src/hooks/leverageYield/useLeverageYieldQuote.ts +5 -54
- package/src/hooks/leverageYield/useLeverageYieldShareBalances.ts +2 -29
- package/src/hooks/leverageYield/useLeverageYieldTotalAssets.ts +1 -9
- package/src/hooks/leverageYield/useLeverageYieldVaultSwap.ts +2 -25
- package/src/hooks/leverageYield/useLeverageYieldVaultSwapWithApproval.ts +1 -11
- package/src/hooks/leverageYield/useLeverageYieldWithdraw.ts +1 -17
- package/src/hooks/leverageYield/useOpenLeveragePosition.ts +5 -18
- package/src/hooks/leverageYield/useRunLeveragePositionOperation.ts +4 -20
- package/src/hooks/leverageYield/useSubmitLeveragePositionIntent.ts +3 -15
- package/src/hooks/leverageYieldApi/index.ts +0 -15
- package/src/hooks/leverageYieldApi/useLeverageYieldApiAllowance.ts +1 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiApprove.ts +3 -6
- package/src/hooks/leverageYieldApi/useLeverageYieldApiApproveAndBroadcast.test.ts +4 -14
- package/src/hooks/leverageYieldApi/useLeverageYieldApiApproveAndBroadcast.ts +4 -26
- package/src/hooks/leverageYieldApi/useLeverageYieldApiApr.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiAsset.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiCancelIntent.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiCreateDepositIntent.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiCreateWithdrawIntent.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiDeadline.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiDepositQuote.ts +1 -15
- package/src/hooks/leverageYieldApi/useLeverageYieldApiEffectiveApr.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiEstimateGas.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiFilledIntent.ts +1 -6
- package/src/hooks/leverageYieldApi/useLeverageYieldApiIntent.ts +1 -6
- package/src/hooks/leverageYieldApi/useLeverageYieldApiIntentExtraData.ts +1 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiIntentHash.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiIntentPacket.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiLsdApr.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiMaxWithdraw.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPartnerFee.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPosition.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPreviewDeposit.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPreviewRedeem.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPreviewWithdraw.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiShareBalance.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiSolverFee.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiStatus.ts +2 -12
- package/src/hooks/leverageYieldApi/useLeverageYieldApiSubmitIntent.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiSubmitTx.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiSubmitTxStatus.ts +2 -17
- package/src/hooks/leverageYieldApi/useLeverageYieldApiTotalAssets.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiVault.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiVaults.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiWithdrawQuote.ts +1 -15
- package/src/hooks/migrate/useMigrateBaln.ts +1 -8
- package/src/hooks/migrate/useMigrateIcxToSoda.ts +1 -12
- package/src/hooks/migrate/useMigratebnUSD.ts +1 -12
- package/src/hooks/migrate/useMigrationAllowance.ts +3 -19
- package/src/hooks/migrate/useMigrationApprove.ts +2 -20
- package/src/hooks/migrate/useRevertMigrateSodaToIcx.ts +0 -7
- package/src/hooks/mm/useAToken.ts +1 -6
- package/src/hooks/mm/useATokensBalances.ts +0 -5
- package/src/hooks/mm/useBorrow.ts +1 -13
- package/src/hooks/mm/useEModes.ts +2 -13
- package/src/hooks/mm/useMMAllowance.test.ts +55 -0
- package/src/hooks/mm/useMMAllowance.ts +6 -16
- package/src/hooks/mm/useMMApprove.ts +1 -14
- package/src/hooks/mm/useRepay.ts +1 -12
- package/src/hooks/mm/useReservesData.ts +0 -4
- package/src/hooks/mm/useReservesHumanized.ts +0 -4
- package/src/hooks/mm/useReservesList.ts +0 -4
- package/src/hooks/mm/useReservesUsdFormat.ts +0 -4
- package/src/hooks/mm/useSupply.ts +1 -24
- package/src/hooks/mm/useUserFormattedSummary.ts +0 -7
- package/src/hooks/mm/useUserReservesData.ts +0 -4
- package/src/hooks/mm/useWithdraw.ts +1 -13
- package/src/hooks/partner/useApproveToken.ts +1 -7
- package/src/hooks/partner/useFeeClaimSwap.ts +1 -7
- package/src/hooks/partner/useFeeClaimWithdraw.ts +3 -20
- package/src/hooks/partner/useFetchAssetsBalances.ts +0 -4
- package/src/hooks/partner/useGetAutoSwapPreferences.ts +0 -4
- package/src/hooks/partner/useGetIntentDetails.ts +1 -8
- package/src/hooks/partner/useGetUserIntent.ts +1 -8
- package/src/hooks/partner/useIsTokenApproved.ts +0 -4
- package/src/hooks/partner/usePartnerCancelIntent.ts +2 -9
- package/src/hooks/partner/useSetSwapPreference.ts +1 -14
- package/src/hooks/recovery/useHubAssetBalances.ts +1 -6
- package/src/hooks/recovery/useWithdrawHubAsset.ts +1 -13
- package/src/hooks/shared/index.ts +4 -0
- package/src/hooks/shared/invalidateBalances.ts +2 -10
- package/src/hooks/shared/isUserRejectedError.test.ts +0 -3
- package/src/hooks/shared/isUserRejectedError.ts +2 -23
- package/src/hooks/shared/notFoundStreak.ts +5 -22
- package/src/hooks/shared/retryUnlessAuthFailure.test.ts +1 -2
- package/src/hooks/shared/retryUnlessAuthFailure.ts +1 -12
- package/src/hooks/shared/solverStatusPolicy.test.ts +0 -5
- package/src/hooks/shared/solverStatusPolicy.ts +8 -58
- package/src/hooks/shared/types.ts +4 -55
- package/src/hooks/shared/unwrapResult.ts +1 -8
- package/src/hooks/shared/useBalances.ts +6 -39
- package/src/hooks/shared/useEstablishTrustline.test.ts +1 -5
- package/src/hooks/shared/useEstablishTrustline.ts +3 -13
- package/src/hooks/shared/useEstablishXrpTrustline.test.ts +112 -0
- package/src/hooks/shared/useEstablishXrpTrustline.ts +63 -0
- package/src/hooks/shared/useEstimateGas.ts +0 -1
- package/src/hooks/shared/useGetUserHubWalletAddress.ts +1 -18
- package/src/hooks/shared/useNearStorageCheck.ts +2 -9
- package/src/hooks/shared/useNearStorageGate.ts +5 -15
- package/src/hooks/shared/useRegisterNearStorage.ts +2 -10
- package/src/hooks/shared/useRequestTrustline.test.ts +1 -7
- package/src/hooks/shared/useRequestTrustline.ts +4 -14
- package/src/hooks/shared/useSafeMutation.test.ts +0 -3
- package/src/hooks/shared/useSafeMutation.ts +2 -26
- package/src/hooks/shared/useSodaxContext.ts +0 -6
- package/src/hooks/shared/useStellarGate.test.ts +2 -9
- package/src/hooks/shared/useStellarGate.ts +3 -9
- package/src/hooks/shared/useStellarTrustlineCheck.test.ts +0 -2
- package/src/hooks/shared/useStellarTrustlineCheck.ts +1 -4
- package/src/hooks/shared/useXBalances.ts +2 -20
- package/src/hooks/shared/useXrpDestinationCheck.ts +71 -0
- package/src/hooks/shared/useXrpGate.test.ts +116 -0
- package/src/hooks/shared/useXrpGate.ts +80 -0
- package/src/hooks/shared/useXrpTrustlineReserveCheck.ts +45 -0
- package/src/hooks/shared/waitForApiAllowance.test.ts +0 -1
- package/src/hooks/shared/waitForApiAllowance.ts +2 -6
- package/src/hooks/sponsoring/useActivateStellarAccount.test.ts +1 -2
- package/src/hooks/sponsoring/useActivateStellarAccount.ts +1 -5
- package/src/hooks/sponsoring/useActivateStellarAccount.wire.test.ts +2 -13
- package/src/hooks/sponsoring/useSponsorConfig.ts +0 -1
- package/src/hooks/sponsoring/useStellarAccountActive.ts +0 -1
- package/src/hooks/sponsoring/useStellarAccountStatus.ts +1 -4
- package/src/hooks/staking/index.ts +0 -1
- package/src/hooks/staking/useCancelUnstake.ts +1 -7
- package/src/hooks/staking/useClaim.ts +1 -7
- package/src/hooks/staking/useConvertedAssets.ts +1 -4
- package/src/hooks/staking/useInstantUnstake.ts +1 -7
- package/src/hooks/staking/useInstantUnstakeAllowance.ts +1 -5
- package/src/hooks/staking/useInstantUnstakeApprove.ts +1 -11
- package/src/hooks/staking/useInstantUnstakeRatio.ts +1 -4
- package/src/hooks/staking/useStake.ts +1 -12
- package/src/hooks/staking/useStakeAllowance.ts +1 -5
- package/src/hooks/staking/useStakeApprove.ts +1 -11
- package/src/hooks/staking/useStakeRatio.ts +1 -4
- package/src/hooks/staking/useStakingConfig.ts +1 -4
- package/src/hooks/staking/useStakingInfo.ts +1 -5
- package/src/hooks/staking/useUnstake.ts +2 -9
- package/src/hooks/staking/useUnstakeAllowance.ts +1 -5
- package/src/hooks/staking/useUnstakeApprove.ts +1 -10
- package/src/hooks/staking/useUnstakingInfo.ts +1 -4
- package/src/hooks/staking/useUnstakingInfoWithPenalty.ts +1 -4
- package/src/hooks/swap/useCancelLimitOrder.ts +1 -7
- package/src/hooks/swap/useCancelSwap.ts +1 -7
- package/src/hooks/swap/useCreateLimitOrder.ts +2 -12
- package/src/hooks/swap/useDetailedStatus.test.ts +6 -18
- package/src/hooks/swap/useDetailedStatus.ts +2 -19
- package/src/hooks/swap/useQuote.test.ts +2 -8
- package/src/hooks/swap/useQuote.ts +5 -32
- package/src/hooks/swap/useStatus.ts +2 -10
- package/src/hooks/swap/useSwap.test.ts +1 -11
- package/src/hooks/swap/useSwap.ts +2 -12
- package/src/hooks/swap/useSwapAllowance.ts +1 -2
- package/src/hooks/swap/useSwapApprovalStrategy.ts +2 -7
- package/src/hooks/swap/useSwapApprove.ts +2 -14
- package/src/hooks/swap/useSwapLifecycle.test.ts +47 -2
- package/src/hooks/swap/useSwapLifecycle.ts +36 -30
- package/src/hooks/swap/useSwapWithApproval.ts +2 -11
- package/src/hooks/swapsApi/index.ts +2 -14
- package/src/hooks/swapsApi/isTerminalSwapIntentStatus.test.ts +1 -5
- package/src/hooks/swapsApi/isTerminalSwapIntentStatus.ts +1 -7
- package/src/hooks/swapsApi/useSwapsApiAllowance.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiApprove.ts +1 -14
- package/src/hooks/swapsApi/useSwapsApiApproveAndBroadcast.test.ts +5 -20
- package/src/hooks/swapsApi/useSwapsApiApproveAndBroadcast.ts +3 -24
- package/src/hooks/swapsApi/useSwapsApiBroadcastWithApproval.test.ts +2 -8
- package/src/hooks/swapsApi/useSwapsApiBroadcastWithApproval.ts +6 -41
- package/src/hooks/swapsApi/useSwapsApiCancelIntent.ts +0 -13
- package/src/hooks/swapsApi/useSwapsApiCreateIntent.ts +0 -13
- package/src/hooks/swapsApi/useSwapsApiCreateLimitOrder.ts +1 -13
- package/src/hooks/swapsApi/useSwapsApiDeadline.ts +1 -7
- package/src/hooks/swapsApi/useSwapsApiEstimateGas.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiFilledIntent.ts +0 -8
- package/src/hooks/swapsApi/useSwapsApiIntent.ts +1 -7
- package/src/hooks/swapsApi/useSwapsApiIntentExtraData.ts +1 -8
- package/src/hooks/swapsApi/useSwapsApiIntentHash.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiIntentPacket.ts +1 -10
- package/src/hooks/swapsApi/useSwapsApiPartnerFee.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiQuote.ts +2 -24
- package/src/hooks/swapsApi/useSwapsApiSolverFee.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiStatus.ts +1 -11
- package/src/hooks/swapsApi/useSwapsApiSubmitIntent.ts +1 -15
- package/src/hooks/swapsApi/useSwapsApiSubmitTx.ts +0 -21
- package/src/hooks/swapsApi/useSwapsApiSubmitTxStatus.ts +2 -19
- package/src/hooks/swapsApi/useSwapsApiTokens.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiTokensByChain.ts +0 -7
- package/src/index.ts +1 -1
- package/src/providers/SodaxProvider.test.ts +2 -9
- package/src/providers/SodaxProvider.tsx +1 -12
- package/src/providers/createSodaxQueryClient.ts +4 -56
- package/src/utils/approvalPlan.ts +9 -32
- package/src/utils/dex-utils.ts +5 -20
- package/src/utils/index.ts +1 -0
- package/src/utils/nearStorageGate.ts +3 -14
- package/src/utils/stellarGate.ts +3 -16
- package/src/utils/swapLifecycle.test.ts +35 -0
- package/src/utils/swapLifecycle.ts +21 -28
- package/src/utils/xrpGate.test.ts +112 -0
- package/src/utils/xrpGate.ts +69 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,166 +1,50 @@
|
|
|
1
1
|
import { UseMutationOptions, UseQueryOptions, UseMutationResult, MutateOptions, UseQueryResult, QueryClient, QueryClientConfig } from '@tanstack/react-query';
|
|
2
2
|
import * as _sodax_sdk from '@sodax/sdk';
|
|
3
|
-
import { Result, Sodax, SpokeChainKey, GetEstimateGasReturnType, EstimateGasParams, StellarChainKey, IStellarWalletProvider, INearWalletProvider, GetWalletProviderType, StellarAccountStatus, ActivateStellarAccountResult, IXServiceBase, XToken, EvmHubProvider, IBitcoinWalletProvider, RadfiWalletBalance, IWalletProvider, RadfiUtxo, MoneyMarketBorrowActionParams, OutboundSettlement, MoneyMarketRepayActionParams, TxHashPair, MoneyMarketSupplyActionParams, MoneyMarketWithdrawActionParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, ReservesDataHumanized, Address as Address$1, MoneyMarketParams, MoneyMarketApproveActionParams, TxReturnType, Erc20Token, ChainKey, ReserveDataHumanized, FormatReserveUSDResponse, FormatUserSummaryResponse, EmodeDataHumanized, SolverIntentQuoteRequest, SwapActionParams, SwapResponse, SolverIntentStatusResponse, SolverErrorResponse, Hex, DetailedSwapStatus, DetailedStatusError, CreateIntentParams, CreateLimitOrderParams, SwapApprovalStrategy, SwapWithApprovalParams, SwapWithApprovalResponse, SwapExtras, Intent, LimitOrderActionParams, IntentResponse, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, OracleMarketsResponse, OracleCandlesResponse, OracleCandleInterval, GetSwapTokensResponseV2, RequestOverrideConfig, GetSwapTokensByChainResponseV2, QuoteResponseV2, QuoteRequestV2, QuoteQueryV2, DeadlineResponseV2, DeadlineQueryV2, AllowanceCheckResponseV2, CreateIntentParamsV2, ApproveResponseV2, RawTxReturnType, Hash, ApprovalStrategy, ApprovalOptions, EvmRawTransaction, IEvmWalletProvider, CreateIntentResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, StatusResponseV2, SwapIntentStatusCodeV2, CancelIntentRequestV2, CancelIntentResponseV2, IntentHashResponseV2, IntentRequestV2, IntentPacketResponseV2, IntentPacketRequestV2, IntentExtraDataResponseV2, IntentExtraDataRequestV2, IntentStateV2, GetIntentResponseV2, CreateLimitOrderParamsV2, CreateLimitOrderResponseV2, GasEstimateResponseV2, GasEstimateRequestV2, FeeResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusResponseV2, DetailedBridgeStatus, BridgeDetailedStatusError, BridgeParams, CreateBridgeIntentParams, BridgeWithApprovalParams, BridgeWithApprovalResponse, BridgeLimit, BridgeAllowanceCheckResponseV2, CreateBridgeIntentParamsV2, BridgeApproveResponseV2, BridgeableAmountResponseV2, BridgeQuoteRequestV2, CreateBridgeIntentResponseV2, BridgeFeeResponseV2, BridgeFeeRequestV2, BridgeableCheckResponseV2, BridgeSubmitTxRequestV2, BridgeSubmitTxResponseV2, BridgeSubmitTxStatusResponseV2, GetBridgeTokensResponseV2, GetBridgeTokensByChainResponseV2, StakeAction, StakeParams, UnstakeAction, ClaimAction, CancelUnstakeAction, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeAction, UnstakeParams, InstantUnstakeParams, PartnerFeeClaimAssetBalance, AutoSwapPreferences, FeeTokenApproveParams, FeeTokenApproveAction, HubChainKey, SetSwapPreferenceAction, PartnerFeeClaimSwapAction, IntentAutoSwapResult, PartnerFeeClaimCancelAction, GetUserIntentParams, HubAssetBalance, WithdrawHubAssetAction, SendMessageReturnType, IcxMigrateAction, IcxRevertMigrationAction, UnifiedBnUSDMigrateAction, BalnMigrateAction, MigrationAction, IcxMigrateParams, IcxCreateRevertMigrationParams, UnifiedBnUSDMigrateParams, BalnMigrateParams, PoolKey, PoolData, ClPositionInfo, AssetDepositAction, AssetWithdrawAction, CreateAssetDepositParams, ClSupplyParams, ClIncreaseLiquidityParams, ClLiquidityDecreaseLiquidityAction, ClDecreaseLiquidityParams, CreateAssetWithdrawParams, PoolSpokeAssets, DestinationParamsType, ClLiquidityClaimRewardsAction, LeverageYieldQuoteParams, LeverageYieldEffectiveApr, LeverageYieldPosition, LeverageYieldSwapDepositParams, LeverageYieldSwapPayload, SolverExecutionRequest, SolverExecutionResponse, DetailedLeverageYieldStatus, LeverageYieldDetailedStatusError, VaultSwapActionParams, VaultSwapResponse, VaultSwapWithApprovalParams, VaultSwapWithApprovalResponse, LeverageYieldSwapWithdrawParams, LeveragePositionAccount, LeveragePositionCollateral, LeveragePosition, LeveragePositionPendingState, SpokeExecActionParams, OpenPositionParams, OpenPositionFromDebtTokenParams, LeveragePositionIntentResult, PositionOperationParams, PositionBatchCall, PositionDirectCall, GetLeverageVaultsResponseV2, GetLeverageVaultResponseV2, VaultAssetResponseV2, LeverageYieldPositionV2, LeverageYieldAprV2, LeverageYieldEffectiveAprV2, LeverageYieldLsdAprV2, VaultTotalAssetsResponseV2, PreviewDepositResponseV2, PreviewWithdrawResponseV2, PreviewRedeemResponseV2, ShareBalanceResponseV2, MaxWithdrawResponseV2, LeverageYieldDepositQuoteRequestV2, LeverageYieldWithdrawQuoteRequestV2, CreateDepositIntentParamsV2, CreateWithdrawIntentParamsV2, LeverageYieldSubmitTxRequestV2, ActivateStellarAccountParams, StellarSponsorConfig, SodaxOptions } from '@sodax/sdk';
|
|
3
|
+
import { Result, Sodax, SpokeChainKey, GetEstimateGasReturnType, EstimateGasParams, StellarChainKey, IStellarWalletProvider, INearWalletProvider, GetWalletProviderType, StellarAccountStatus, ActivateStellarAccountResult, XrpDestinationReadiness, IXrpWalletProvider, IXServiceBase, XToken, EvmHubProvider, IBitcoinWalletProvider, RadfiWalletBalance, IWalletProvider, RadfiUtxo, MoneyMarketBorrowActionParams, OutboundSettlement, MoneyMarketRepayActionParams, TxHashPair, MoneyMarketSupplyActionParams, MoneyMarketWithdrawActionParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, ReservesDataHumanized, Address as Address$1, MoneyMarketParams, MoneyMarketApproveActionParams, TxReturnType, Erc20Token, ChainKey, ReserveDataHumanized, FormatReserveUSDResponse, FormatUserSummaryResponse, EmodeDataHumanized, SolverIntentQuoteRequest, SwapActionParams, SwapResponse, SolverIntentStatusResponse, SolverErrorResponse, Hex, DetailedSwapStatus, DetailedStatusError, CreateIntentParams, CreateLimitOrderParams, SwapApprovalStrategy, SwapWithApprovalParams, SwapWithApprovalResponse, SwapExtras, Intent, LimitOrderActionParams, IntentResponse, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, OracleMarketsResponse, OracleCandlesResponse, OracleCandleInterval, GetSwapTokensResponseV2, RequestOverrideConfig, GetSwapTokensByChainResponseV2, QuoteResponseV2, QuoteRequestV2, QuoteQueryV2, DeadlineResponseV2, DeadlineQueryV2, AllowanceCheckResponseV2, CreateIntentParamsV2, ApproveResponseV2, RawTxReturnType, Hash, ApprovalStrategy, ApprovalOptions, EvmRawTransaction, IEvmWalletProvider, CreateIntentResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, StatusResponseV2, SwapIntentStatusCodeV2, CancelIntentRequestV2, CancelIntentResponseV2, IntentHashResponseV2, IntentRequestV2, IntentPacketResponseV2, IntentPacketRequestV2, IntentExtraDataResponseV2, IntentExtraDataRequestV2, IntentStateV2, GetIntentResponseV2, CreateLimitOrderParamsV2, CreateLimitOrderResponseV2, GasEstimateResponseV2, GasEstimateRequestV2, FeeResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusResponseV2, DetailedBridgeStatus, BridgeDetailedStatusError, BridgeParams, CreateBridgeIntentParams, BridgeWithApprovalParams, BridgeWithApprovalResponse, BridgeLimit, BridgeAllowanceCheckResponseV2, CreateBridgeIntentParamsV2, BridgeApproveResponseV2, BridgeableAmountResponseV2, BridgeQuoteRequestV2, CreateBridgeIntentResponseV2, BridgeFeeResponseV2, BridgeFeeRequestV2, BridgeableCheckResponseV2, BridgeSubmitTxRequestV2, BridgeSubmitTxResponseV2, BridgeSubmitTxStatusResponseV2, GetBridgeTokensResponseV2, GetBridgeTokensByChainResponseV2, StakeAction, StakeParams, UnstakeAction, ClaimAction, CancelUnstakeAction, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeAction, UnstakeParams, InstantUnstakeParams, PartnerFeeClaimAssetBalance, AutoSwapPreferences, FeeTokenApproveParams, FeeTokenApproveAction, HubChainKey, SetSwapPreferenceAction, PartnerFeeClaimSwapAction, IntentAutoSwapResult, PartnerFeeClaimCancelAction, GetUserIntentParams, HubAssetBalance, WithdrawHubAssetAction, SendMessageReturnType, IcxMigrateAction, IcxRevertMigrationAction, UnifiedBnUSDMigrateAction, BalnMigrateAction, MigrationAction, IcxMigrateParams, IcxCreateRevertMigrationParams, UnifiedBnUSDMigrateParams, BalnMigrateParams, PoolKey, PoolData, ClPositionInfo, AssetDepositAction, AssetWithdrawAction, CreateAssetDepositParams, ClSupplyParams, ClIncreaseLiquidityParams, ClLiquidityDecreaseLiquidityAction, ClDecreaseLiquidityParams, CreateAssetWithdrawParams, PoolSpokeAssets, DestinationParamsType, ClLiquidityClaimRewardsAction, LeverageYieldQuoteParams, LeverageYieldEffectiveApr, LeverageYieldPosition, LeverageYieldSwapDepositParams, LeverageYieldSwapPayload, SolverExecutionRequest, SolverExecutionResponse, DetailedLeverageYieldStatus, LeverageYieldDetailedStatusError, VaultSwapActionParams, VaultSwapResponse, VaultSwapWithApprovalParams, VaultSwapWithApprovalResponse, LeverageYieldSwapWithdrawParams, LeveragePositionAccount, LeveragePositionCollateral, LeveragePosition, LeveragePositionPendingState, SpokeExecActionParams, OpenPositionParams, OpenPositionFromDebtTokenParams, LeveragePositionIntentResult, PositionOperationParams, PositionBatchCall, PositionDirectCall, GetLeverageVaultsResponseV2, GetLeverageVaultResponseV2, VaultAssetResponseV2, LeverageYieldPositionV2, LeverageYieldAprV2, LeverageYieldEffectiveAprV2, LeverageYieldLsdAprV2, VaultTotalAssetsResponseV2, PreviewDepositResponseV2, PreviewWithdrawResponseV2, PreviewRedeemResponseV2, ShareBalanceResponseV2, MaxWithdrawResponseV2, LeverageYieldDepositQuoteRequestV2, LeverageYieldWithdrawQuoteRequestV2, CreateDepositIntentParamsV2, CreateWithdrawIntentParamsV2, LeverageYieldSubmitTxRequestV2, ActivateStellarAccountParams, StellarSponsorConfig, SodaxOptions } from '@sodax/sdk';
|
|
4
4
|
export * from '@sodax/sdk';
|
|
5
5
|
import { Address } from 'viem';
|
|
6
6
|
import { ReactNode, ReactElement } from 'react';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* The SDK classifies wallet rejection at the source: `intentCreationFailed` / `approveFailed`
|
|
12
|
-
* wrappers emit `SodaxError<'USER_REJECTED'>` whenever the underlying cause matches a known
|
|
13
|
-
* rejection shape (viem `4001` / `UserRejectedRequestError`, ICON Hana `CANCEL_SIGNING`,
|
|
14
|
-
* Solana / Sui / Stellar / Stacks / NEAR / Injective name + message patterns). Consumers
|
|
15
|
-
* branch on this code to render a "Cancelled" UI instead of a "Failed" toast — user
|
|
16
|
-
* cancellation is a normal flow, not a failure.
|
|
17
|
-
*
|
|
18
|
-
* Use after `mutateAsyncSafe` (or inside an `onError` / `catch`):
|
|
19
|
-
*
|
|
20
|
-
* ```ts
|
|
21
|
-
* const result = await swap.mutateAsyncSafe({ params, walletProvider });
|
|
22
|
-
* if (!result.ok) {
|
|
23
|
-
* if (isUserRejectedError(result.error)) return; // silent — user cancelled
|
|
24
|
-
* toast.error(getErrorMessage(result.error)); // real failure
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* The check trusts the SDK's classification — it does NOT re-scan message content. Errors
|
|
29
|
-
* raised outside the SDK boundary (e.g. a non-SodaxError thrown from a `queryFn`) will not
|
|
30
|
-
* match, which is intentional: only the SDK's `USER_REJECTED` is the canonical "cancelled"
|
|
31
|
-
* signal.
|
|
9
|
+
* True only for the SDK's `USER_REJECTED` (wallet prompt cancelled); does not re-scan messages, so
|
|
10
|
+
* non-SodaxError rejections intentionally do not match.
|
|
32
11
|
*/
|
|
33
12
|
declare function isUserRejectedError(error: unknown): boolean;
|
|
34
13
|
|
|
35
|
-
/**
|
|
36
|
-
* Default React Query `retry` policy for the backend API hooks (swaps, leverage-yield, bridge): replay a transport blip, never a
|
|
37
|
-
* terminal API-key rejection (see `isAuthFailure`). Retrying a rejected key only multiplies doomed
|
|
38
|
-
* requests before the consumer sees the error.
|
|
39
|
-
*
|
|
40
|
-
* Override or compose it through `queryOptions` / `mutationOptions`:
|
|
41
|
-
*
|
|
42
|
-
* ```ts
|
|
43
|
-
* useSwapsApiQuote({ params: { body }, queryOptions: { retry: 5 } });
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
14
|
+
/** Default `retry` for backend API hooks: retries transport failures, never a rejected API key. */
|
|
46
15
|
declare const retryUnlessAuthFailure: (failureCount: number, error: unknown) => boolean;
|
|
47
16
|
|
|
48
|
-
/**
|
|
49
|
-
* Subset of `UseQueryOptions` consumers may override on dapp-kit read hooks.
|
|
50
|
-
*
|
|
51
|
-
* `queryKey`, `queryFn`, and `enabled` are owned by the hook (the latter is derived
|
|
52
|
-
* from required-input presence) and are intentionally stripped here.
|
|
53
|
-
*/
|
|
17
|
+
/** `enabled` is hook-owned: derived from required-input presence. */
|
|
54
18
|
type ReadQueryOptions<TData, TError = Error> = Omit<UseQueryOptions<TData, TError>, 'queryKey' | 'queryFn' | 'enabled'>;
|
|
55
|
-
/**
|
|
56
|
-
* Canonical params shape for read-only `useQuery`-backed hooks in dapp-kit.
|
|
57
|
-
*
|
|
58
|
-
* Two top-level keys, always:
|
|
59
|
-
* - `params`: SDK-feature-domain inputs (the "what" being fetched)
|
|
60
|
-
* - `queryOptions`: React Query behavior knobs (the "how" the query behaves)
|
|
61
|
-
*
|
|
62
|
-
* For hooks with no required inputs, leave `TParams` at its default and accept the
|
|
63
|
-
* whole params object as optional at the call site.
|
|
64
|
-
*/
|
|
65
19
|
type ReadHookParams<TData, TParams = Record<string, never>, TError = Error> = {
|
|
66
20
|
params?: TParams;
|
|
67
21
|
queryOptions?: ReadQueryOptions<TData, TError>;
|
|
68
22
|
};
|
|
69
23
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* `mutationFn` is owned by the hook (it's the SDK integration point) and is
|
|
73
|
-
* intentionally stripped here. Everything else — `mutationKey`, `retry`, `gcTime`,
|
|
74
|
-
* `networkMode`, `onMutate`, `onSuccess`, `onError`, `onSettled`, `meta`, etc. —
|
|
75
|
-
* is consumer-overridable.
|
|
76
|
-
*
|
|
77
|
-
* Conventions enforced by every dapp-kit mutation hook:
|
|
78
|
-
*
|
|
79
|
-
* 1. **`mutationFn` throws on SDK failure.** The SDK returns `Result<T>`; the hook
|
|
80
|
-
* unwraps `result.value` on `ok` and throws `result.error` on `!ok`. So `TData`
|
|
81
|
-
* here is the unwrapped success type, not `Result<T>`. React Query's native
|
|
82
|
-
* error model — `isError`, `error`, `onError`, `retry`, `throwOnError`, devtools —
|
|
83
|
-
* works exactly as documented.
|
|
84
|
-
*
|
|
85
|
-
* 2. **`onSuccess` is composed.** Hook-owned invalidations always run first; then
|
|
86
|
-
* the hook awaits `mutationOptions?.onSuccess?.(data, vars, ctx)`. Per-call
|
|
87
|
-
* `mutate(vars, { onSuccess })` runs after both, per TanStack Query's native
|
|
88
|
-
* ordering. Because invalidations now live inside `onSuccess` (not `onSettled`),
|
|
89
|
-
* they only fire on confirmed success — failed mutations never trigger them.
|
|
90
|
-
*
|
|
91
|
-
* 3. **A default `mutationKey` is set per hook** (e.g. `['mm', 'supply']`,
|
|
92
|
-
* `['swap']`) so consumers can use `useIsMutating(['mm'])` and
|
|
93
|
-
* `useMutationState` without guessing the key shape. The default is set
|
|
94
|
-
* *before* `...mutationOptions` is spread, so consumers can override it.
|
|
24
|
+
* `TData` is the unwrapped success type (hooks throw on SDK failure). A consumer `onSuccess` runs after
|
|
25
|
+
* the hook's own invalidations; the default `mutationKey` is overridable.
|
|
95
26
|
*/
|
|
96
27
|
type MutationHookOptions<TData, TVars, TError = Error, TContext = unknown> = Omit<UseMutationOptions<TData, TError, TVars, TContext>, 'mutationFn'>;
|
|
97
|
-
/**
|
|
98
|
-
* Canonical params shape for `useMutation`-backed hooks in dapp-kit.
|
|
99
|
-
*
|
|
100
|
-
* One top-level key:
|
|
101
|
-
* - `mutationOptions`: React Query behavior knobs (the "how" the mutation behaves)
|
|
102
|
-
*
|
|
103
|
-
* Domain inputs (params, walletProvider, etc.) are NOT here — they belong in
|
|
104
|
-
* `TVars` and flow through `mutate(vars)` so the call site can vary them per
|
|
105
|
-
* invocation without re-rendering the hook.
|
|
106
|
-
*
|
|
107
|
-
* Always accept the whole params object as optional at the call site:
|
|
108
|
-
* `useFoo({ mutationOptions } = {})`.
|
|
109
|
-
*/
|
|
28
|
+
/** Domain inputs belong in `TVars` and flow through `mutate(vars)`, not here. */
|
|
110
29
|
type MutationHookParams<TData, TVars, TError = Error, TContext = unknown> = {
|
|
111
30
|
mutationOptions?: MutationHookOptions<TData, TVars, TError, TContext>;
|
|
112
31
|
};
|
|
113
32
|
|
|
114
|
-
/**
|
|
115
|
-
* Translates the SDK's `Result<T>` contract into the React Query contract: returns `value` on
|
|
116
|
-
* success, throws `error` on failure. Non-`Error` throwables are wrapped so consumers always get
|
|
117
|
-
* an `Error` in `mutation.error` / catch blocks.
|
|
118
|
-
*
|
|
119
|
-
* Used by every dapp-kit mutation hook so the React Query error model (`isError`, `error`,
|
|
120
|
-
* `onError`, `retry`, `throwOnError`, devtools) engages uniformly.
|
|
121
|
-
*/
|
|
33
|
+
/** Returns `value` or throws `error`; non-`Error` failures are wrapped so consumers always get an `Error`. */
|
|
122
34
|
declare function unwrapResult<T>(result: Result<T>): T;
|
|
123
35
|
|
|
124
|
-
/**
|
|
125
|
-
* Return shape of every dapp-kit mutation hook. Extends `UseMutationResult` with one extra
|
|
126
|
-
* method, `mutateAsyncSafe`, that never rejects — it returns the SDK's `Result<T>` shape so
|
|
127
|
-
* callers can branch on `.ok` without `try/catch`.
|
|
128
|
-
*
|
|
129
|
-
* The underlying `mutationFn` still throws on SDK failure, so React Query's native error model
|
|
130
|
-
* (`isError`, `error`, `onError`, `retry`, `throwOnError`, devtools) keeps working as documented.
|
|
131
|
-
*/
|
|
132
36
|
type SafeUseMutationResult<TData, TError, TVars, TContext = unknown> = UseMutationResult<TData, TError, TVars, TContext> & {
|
|
133
|
-
/**
|
|
134
|
-
* Like `mutateAsync` but never rejects. Returns `Result<TData>` so callers can branch
|
|
135
|
-
* on `.ok` without `try/catch`.
|
|
136
|
-
*
|
|
137
|
-
* Use this for imperative flows where rejection-style errors are awkward — e.g. sequential
|
|
138
|
-
* `if (!hasAllowance) await approve(...); await action(...)` chains where the user-reject
|
|
139
|
-
* case is the modal failure mode, not an exceptional one.
|
|
140
|
-
*/
|
|
37
|
+
/** Like `mutateAsync` but never rejects; resolves to `Result<TData>`. */
|
|
141
38
|
mutateAsyncSafe: (vars: TVars, options?: MutateOptions<TData, TError, TVars, TContext>) => Promise<Result<TData>>;
|
|
142
39
|
};
|
|
143
|
-
/**
|
|
144
|
-
* Wraps a `Promise<T>` (typically `mutateAsync(vars)`) into a `Promise<Result<T>>` that never
|
|
145
|
-
* rejects. Pure, side-effect-free — extracted for unit testing.
|
|
146
|
-
*/
|
|
147
40
|
declare function toResult<T>(promise: Promise<T>): Promise<Result<T>>;
|
|
148
|
-
/**
|
|
149
|
-
* Drop-in replacement for `useMutation` that augments the result with `mutateAsyncSafe`. Used
|
|
150
|
-
* by every dapp-kit mutation hook so consumers can pick rejection-style (`mutateAsync`) or
|
|
151
|
-
* Result-style (`mutateAsyncSafe`) ergonomics without the hook author having to think about it.
|
|
152
|
-
*/
|
|
41
|
+
/** `useMutation` plus `mutateAsyncSafe`; retries are suppressed once funds may have moved. */
|
|
153
42
|
declare function useSafeMutation<TData, TError, TVars, TContext = unknown>(options: UseMutationOptions<TData, TError, TVars, TContext>): SafeUseMutationResult<TData, TError, TVars, TContext>;
|
|
154
43
|
|
|
155
44
|
interface SodaxContextType {
|
|
156
45
|
sodax: Sodax;
|
|
157
46
|
}
|
|
158
47
|
|
|
159
|
-
/**
|
|
160
|
-
* Hook to access the Sodax context which provides access to the Sodax SDK instance and chain configuration
|
|
161
|
-
* @throws {Error} If used outside of a SodaxProvider
|
|
162
|
-
* @returns {SodaxContextType} The Sodax context containing SDK instance and configuration
|
|
163
|
-
*/
|
|
164
48
|
declare const useSodaxContext: () => SodaxContextType;
|
|
165
49
|
|
|
166
50
|
declare function useEstimateGas<C extends SpokeChainKey>({ mutationOptions, }?: MutationHookParams<GetEstimateGasReturnType<C>, EstimateGasParams<C>>): SafeUseMutationResult<GetEstimateGasReturnType<C>, Error, EstimateGasParams<C>>;
|
|
@@ -175,7 +59,6 @@ type UseStellarTrustlineCheckParams = ReadHookParams<boolean, {
|
|
|
175
59
|
token: string | undefined;
|
|
176
60
|
amount: bigint | undefined;
|
|
177
61
|
chainId: SpokeChainKey | undefined;
|
|
178
|
-
/** Resolved Stellar account address (e.g. `useXAccount('STELLAR').address`) — keys the cache per account. */
|
|
179
62
|
walletAddress: string | undefined;
|
|
180
63
|
}>;
|
|
181
64
|
type StellarTrustlineReader = {
|
|
@@ -202,19 +85,9 @@ type UseEstablishTrustlineVars = {
|
|
|
202
85
|
srcChainKey: StellarChainKey;
|
|
203
86
|
walletProvider: IStellarWalletProvider;
|
|
204
87
|
};
|
|
205
|
-
/**
|
|
206
|
-
* Establish a Stellar trustline. The account pays its fee and reserve; use
|
|
207
|
-
* {@link useStellarGate} to verify it can afford them.
|
|
208
|
-
*
|
|
209
|
-
* Supersedes the deprecated `useRequestTrustline`, which keeps the hand-rolled
|
|
210
|
-
* shape released in 2.0.0.
|
|
211
|
-
*/
|
|
88
|
+
/** The account pays the fee and reserve; use {@link useStellarGate} to verify it can afford them. */
|
|
212
89
|
declare function useEstablishTrustline({ mutationOptions, }?: MutationHookParams<string, UseEstablishTrustlineVars>): SafeUseMutationResult<string, Error, UseEstablishTrustlineVars>;
|
|
213
90
|
|
|
214
|
-
/**
|
|
215
|
-
* The shape released in 2.0.0. Declared explicitly so a change to it fails
|
|
216
|
-
* `checkTs` here rather than silently breaking consumers.
|
|
217
|
-
*/
|
|
218
91
|
type ReleasedRequestTrustline = {
|
|
219
92
|
requestTrustline: (params: UseEstablishTrustlineVars) => Promise<string>;
|
|
220
93
|
isLoading: boolean;
|
|
@@ -223,13 +96,7 @@ type ReleasedRequestTrustline = {
|
|
|
223
96
|
data: string | null;
|
|
224
97
|
};
|
|
225
98
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* @deprecated Use {@link useEstablishTrustline}, the canonical mutation hook, which exposes
|
|
229
|
-
* `mutate` / `mutateAsync` / `mutateAsyncSafe` and accepts `mutationOptions`. This wrapper
|
|
230
|
-
* preserves the shape released in 2.0.0 and will be removed in the next major.
|
|
231
|
-
*
|
|
232
|
-
* @param token - Ignored, as it was in 2.0.0. Accepted only so existing call sites compile.
|
|
99
|
+
* @deprecated Use {@link useEstablishTrustline}; removed in the next major. `token` is ignored, as in 2.0.0.
|
|
233
100
|
*/
|
|
234
101
|
declare function useRequestTrustline(token?: string | undefined): ReleasedRequestTrustline;
|
|
235
102
|
|
|
@@ -239,15 +106,8 @@ type UseNearStorageCheckParams = ReadHookParams<boolean, {
|
|
|
239
106
|
chainId: SpokeChainKey | undefined;
|
|
240
107
|
}>;
|
|
241
108
|
/**
|
|
242
|
-
* Whether `accountId` is NEP-141 storage-registered
|
|
243
|
-
*
|
|
244
|
-
* into NEAR, money-market borrow/withdraw to NEAR). NEAR's analogue of a Stellar trustline.
|
|
245
|
-
*
|
|
246
|
-
* Returns `true` (no gate) when `chainId` is not NEAR, mirroring how the Stellar trustline check
|
|
247
|
-
* short-circuits off-chain. Native NEAR is not a NEP-141 token, so the SDK reports it as registered.
|
|
248
|
-
*
|
|
249
|
-
* Pair with {@link useRegisterNearStorage} to perform the one-time `storage_deposit` when this
|
|
250
|
-
* resolves to `false`.
|
|
109
|
+
* Whether `accountId` is NEP-141 storage-registered to receive `token` on NEAR. Resolves `true` when
|
|
110
|
+
* `chainId` is not NEAR; native NEAR always reads as registered.
|
|
251
111
|
*/
|
|
252
112
|
declare function useNearStorageCheck({ params, queryOptions, }?: UseNearStorageCheckParams): UseQueryResult<boolean, Error>;
|
|
253
113
|
|
|
@@ -258,65 +118,38 @@ type UseRegisterNearStorageVars = {
|
|
|
258
118
|
/** Storage bond override; defaults to the SDK's `NEAR_STORAGE_DEPOSIT` (0.00125 NEAR). */
|
|
259
119
|
deposit?: bigint;
|
|
260
120
|
};
|
|
261
|
-
/**
|
|
262
|
-
* Submit a NEP-141 `storage_deposit` so `accountId` can receive `token` on NEAR. NEAR's analogue of
|
|
263
|
-
* requesting a Stellar trustline; pair with {@link useNearStorageCheck} and call this when the check
|
|
264
|
-
* resolves to `false`. The recipient's NEAR wallet signs the registration tx.
|
|
265
|
-
*
|
|
266
|
-
* Pure mutation: pass `{ token, accountId, walletProvider }` to `mutate(...)`. The hook itself only
|
|
267
|
-
* takes the structural `mutationOptions` slot. `registerStorage` throws natively (no `Result<T>`),
|
|
268
|
-
* so this hook is registered as `nativeThrow` in the mutation contract. On success it invalidates
|
|
269
|
-
* the matching {@link useNearStorageCheck} query.
|
|
270
|
-
*/
|
|
121
|
+
/** NEP-141 `storage_deposit` so `accountId` can receive `token` on NEAR; the recipient's wallet signs. */
|
|
271
122
|
declare function useRegisterNearStorage({ mutationOptions, }?: MutationHookParams<string, UseRegisterNearStorageVars>): SafeUseMutationResult<string, Error, UseRegisterNearStorageVars>;
|
|
272
123
|
|
|
273
124
|
interface UseNearStorageGateParams {
|
|
274
|
-
/**
|
|
125
|
+
/** `undefined` (not chosen yet) leaves the gate inert. */
|
|
275
126
|
dstChainKey: SpokeChainKey | undefined;
|
|
276
|
-
/** Destination token address the recipient must be registered for. */
|
|
277
127
|
token: string | undefined;
|
|
278
|
-
/** Recipient NEAR account id. */
|
|
279
128
|
accountId: string | undefined;
|
|
280
|
-
/**
|
|
129
|
+
/** Only consumed when it is the NEAR provider. */
|
|
281
130
|
walletProvider: GetWalletProviderType<SpokeChainKey> | undefined;
|
|
282
131
|
}
|
|
283
132
|
interface NearStorageGate {
|
|
284
|
-
/** Destination is NEAR. */
|
|
285
133
|
isNear: boolean;
|
|
286
|
-
/** Destination is NEAR and the recipient is not yet storage-registered for `token`. */
|
|
287
134
|
needsRegistration: boolean;
|
|
288
|
-
/**
|
|
135
|
+
/** True while the gate is unresolved or unmet. */
|
|
289
136
|
blocksAction: boolean;
|
|
290
|
-
/** The registration-status query is actively fetching. */
|
|
291
137
|
isChecking: boolean;
|
|
292
|
-
/** Destination is NEAR and the registration check failed, so whether the recipient can receive is unknown. */
|
|
293
138
|
checkFailed: boolean;
|
|
294
|
-
/** Re-run the registration check. */
|
|
295
139
|
retry: () => void;
|
|
296
|
-
/** A `storage_deposit` tx is in flight. */
|
|
297
140
|
isRegistering: boolean;
|
|
298
|
-
/**
|
|
141
|
+
/** Resolves to `undefined` if inputs are missing. */
|
|
299
142
|
registerStorage: () => Promise<Result<string> | undefined>;
|
|
300
143
|
}
|
|
301
|
-
/**
|
|
302
|
-
* NEP-141 storage-registration gate for flows that deliver a token to a user on NEAR.
|
|
303
|
-
*/
|
|
144
|
+
/** NEP-141 storage-registration gate for flows that deliver a token to a user on NEAR. */
|
|
304
145
|
declare function useNearStorageGate({ dstChainKey, token, accountId, walletProvider, }: UseNearStorageGateParams): NearStorageGate;
|
|
305
146
|
|
|
306
|
-
/**
|
|
307
|
-
* The subset of a query result the gate reads. A full `UseQueryResult<T>` satisfies it.
|
|
308
|
-
*
|
|
309
|
-
* `isLoading` is intentional: `isPending` remains true for disabled queries.
|
|
310
|
-
* Errors remain distinct from unmet prerequisites.
|
|
311
|
-
*/
|
|
147
|
+
/** Reads `isLoading` because `isPending` stays true for disabled queries; errors stay distinct from unmet prerequisites. */
|
|
312
148
|
type StellarCheckResult<T> = Pick<UseQueryResult<T>, 'isLoading' | 'isError' | 'data'>;
|
|
313
149
|
interface StellarGateState {
|
|
314
150
|
isStellar: boolean;
|
|
315
151
|
needsActivation: boolean;
|
|
316
|
-
/**
|
|
317
|
-
* The account needs a trustline but lacks spendable XLM. Never set for
|
|
318
|
-
* native XLM or an existing trustline.
|
|
319
|
-
*/
|
|
152
|
+
/** Never set for native XLM or an existing trustline. */
|
|
320
153
|
needsFunding: boolean;
|
|
321
154
|
needsTrustline: boolean;
|
|
322
155
|
/** A query failed; disabled or unresolved queries do not set this. */
|
|
@@ -331,12 +164,7 @@ interface StellarGateInputs {
|
|
|
331
164
|
/** Resolve from chain config, never by comparing token symbols. */
|
|
332
165
|
isNativeToken: boolean;
|
|
333
166
|
}
|
|
334
|
-
/**
|
|
335
|
-
* Resolve activation, trustline, and funding prerequisites in order.
|
|
336
|
-
*
|
|
337
|
-
* Check the trustline before affordability because an existing trustline needs
|
|
338
|
-
* no additional XLM. Unknown states fail closed.
|
|
339
|
-
*/
|
|
167
|
+
/** Checks the trustline before affordability because an existing trustline needs no extra XLM. Unknown states fail closed. */
|
|
340
168
|
declare function resolveStellarGate(chainKey: SpokeChainKey | undefined, inputs: StellarGateInputs): StellarGateState;
|
|
341
169
|
|
|
342
170
|
interface UseStellarGateParams {
|
|
@@ -358,40 +186,135 @@ interface StellarGate extends StellarGateState {
|
|
|
358
186
|
/** Returns `undefined` when required inputs are missing. */
|
|
359
187
|
requestTrustline: () => Promise<Result<string> | undefined>;
|
|
360
188
|
}
|
|
189
|
+
/** Gates Stellar delivery on account activation, trustline, and enough spendable XLM to create one. */
|
|
190
|
+
declare function useStellarGate({ dstChainKey, token, amount, address, walletProvider, }: UseStellarGateParams): StellarGate;
|
|
191
|
+
|
|
192
|
+
type UseXrpDestinationCheckParams = ReadHookParams<XrpDestinationReadiness, {
|
|
193
|
+
chainId: SpokeChainKey | undefined;
|
|
194
|
+
token: string | undefined;
|
|
195
|
+
address: string | undefined;
|
|
196
|
+
/** The least that arrives, in the token's decimals. */
|
|
197
|
+
amount: bigint | undefined;
|
|
198
|
+
/** The most that can arrive, which the trustline needs room for. Defaults to `amount`. */
|
|
199
|
+
maxAmount?: bigint;
|
|
200
|
+
}>;
|
|
201
|
+
type XrpDestinationReader = {
|
|
202
|
+
spoke: {
|
|
203
|
+
xrp: Pick<Sodax['spoke']['xrp'], 'checkDestination'>;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
declare function getXrpDestinationCheckQueryOptions({ sodax, chainId, token, address, amount, maxAmount, }: {
|
|
207
|
+
sodax: XrpDestinationReader;
|
|
208
|
+
chainId: SpokeChainKey | undefined;
|
|
209
|
+
token: string | undefined;
|
|
210
|
+
address: string | undefined;
|
|
211
|
+
amount: bigint | undefined;
|
|
212
|
+
maxAmount?: bigint;
|
|
213
|
+
}): {
|
|
214
|
+
queryKey: readonly ["shared", "xrpDestinationCheck", "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera" | "tron" | "robinhood" | "xrp" | "monad" | "ton" | "zcash" | "cardano" | undefined, string | undefined, string | undefined, string | undefined, string | undefined];
|
|
215
|
+
queryFn: () => Promise<XrpDestinationReadiness>;
|
|
216
|
+
enabled: boolean;
|
|
217
|
+
};
|
|
218
|
+
/** Whether an XRPL account can receive `amount` of `token` (up to `maxAmount`), and if not, why. */
|
|
219
|
+
declare function useXrpDestinationCheck({ params, queryOptions, }?: UseXrpDestinationCheckParams): UseQueryResult<XrpDestinationReadiness, Error>;
|
|
220
|
+
|
|
221
|
+
type UseXrpTrustlineReserveCheckParams = ReadHookParams<boolean, {
|
|
222
|
+
token: string | undefined;
|
|
223
|
+
address: string | undefined;
|
|
224
|
+
}>;
|
|
225
|
+
type XrpReserveReader = {
|
|
226
|
+
spoke: {
|
|
227
|
+
xrp: Pick<Sodax['spoke']['xrp'], 'canAffordTrustline'>;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
declare function getXrpTrustlineReserveCheckQueryOptions({ sodax, token, address, }: {
|
|
231
|
+
sodax: XrpReserveReader;
|
|
232
|
+
token: string | undefined;
|
|
233
|
+
address: string | undefined;
|
|
234
|
+
}): {
|
|
235
|
+
queryKey: readonly ["shared", "xrpTrustlineReserveCheck", string | undefined, string | undefined];
|
|
236
|
+
queryFn: () => Promise<boolean>;
|
|
237
|
+
enabled: boolean;
|
|
238
|
+
};
|
|
239
|
+
/** Whether an XRPL account holds the spendable XRP to set the trustline for an issued `token`. */
|
|
240
|
+
declare function useXrpTrustlineReserveCheck({ params, queryOptions, }?: UseXrpTrustlineReserveCheckParams): UseQueryResult<boolean, Error>;
|
|
241
|
+
|
|
242
|
+
type UseEstablishXrpTrustlineVars = {
|
|
243
|
+
token: string;
|
|
244
|
+
/** When set, the mutation refuses a wallet connected to another account. */
|
|
245
|
+
address?: string;
|
|
246
|
+
walletProvider: IXrpWalletProvider;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Creates or raises the XRPL trustline; resolves to the validated TrustSet hash. The account pays the fee
|
|
250
|
+
* and possibly an owner reserve: check with {@link useXrpGate} before asking the user to sign.
|
|
251
|
+
*/
|
|
252
|
+
declare function useEstablishXrpTrustline({ mutationOptions, }?: MutationHookParams<string, UseEstablishXrpTrustlineVars>): SafeUseMutationResult<string, Error, UseEstablishXrpTrustlineVars>;
|
|
253
|
+
|
|
254
|
+
/** The subset of a query result the gate reads. A full `UseQueryResult<T>` satisfies it. */
|
|
255
|
+
type XrpCheckResult<T> = Pick<UseQueryResult<T>, 'isLoading' | 'isError' | 'data'>;
|
|
256
|
+
/** A destination refusal the account's own trustline cannot fix. */
|
|
257
|
+
type XrpBlockedReason = Exclude<Extract<XrpDestinationReadiness, {
|
|
258
|
+
ready: false;
|
|
259
|
+
}>['reason'], 'no_trustline' | 'trustline_limit'>;
|
|
260
|
+
interface XrpGateState {
|
|
261
|
+
/** The destination is XRPL and the token is an issued currency, so a trustline is involved. */
|
|
262
|
+
isXrpIssuedToken: boolean;
|
|
263
|
+
/** The trustline is missing or too small, and the account can afford to set it. */
|
|
264
|
+
needsTrustline: boolean;
|
|
265
|
+
/** The trustline needs setting, but the account lacks the spendable XRP for its fee and reserve. */
|
|
266
|
+
needsFunding: boolean;
|
|
267
|
+
/** Why the destination cannot receive, when no trustline change by the user would fix it. */
|
|
268
|
+
blockedReason: XrpBlockedReason | undefined;
|
|
269
|
+
/** A query failed; disabled or unresolved queries do not set this. */
|
|
270
|
+
checkFailed: boolean;
|
|
271
|
+
/** Whether the downstream action must remain disabled. */
|
|
272
|
+
blocksAction: boolean;
|
|
273
|
+
}
|
|
274
|
+
interface XrpGateInputs {
|
|
275
|
+
/** Whether the destination can receive the payout, from the same ledger reads the SDK refuses a swap on. */
|
|
276
|
+
readinessCheck: XrpCheckResult<XrpDestinationReadiness>;
|
|
277
|
+
/** Whether the account can pay for the TrustSet. Only read once the trustline is known to need setting. */
|
|
278
|
+
reserveCheck: XrpCheckResult<boolean>;
|
|
279
|
+
/** Resolve from chain config: false for native XRP. */
|
|
280
|
+
requiresTrustline: boolean;
|
|
281
|
+
}
|
|
282
|
+
/** Native XRP and other chains pass through: the SDK still refuses an unreceivable payout before signing. Unknown states fail closed. */
|
|
283
|
+
declare function resolveXrpGate(chainKey: SpokeChainKey | undefined, inputs: XrpGateInputs): XrpGateState;
|
|
284
|
+
|
|
285
|
+
interface UseXrpGateParams {
|
|
286
|
+
dstChainKey: SpokeChainKey | undefined;
|
|
287
|
+
token: string | undefined;
|
|
288
|
+
address: string | undefined;
|
|
289
|
+
/** The least that arrives, in the token's decimals. */
|
|
290
|
+
amount: bigint | undefined;
|
|
291
|
+
/** The most that can arrive, which the trustline needs room for. Defaults to `amount`. */
|
|
292
|
+
maxAmount?: bigint;
|
|
293
|
+
/** Must control `address`: `requestTrustline` refuses, before signing, a wallet connected to another account. */
|
|
294
|
+
walletProvider: GetWalletProviderType<SpokeChainKey> | undefined;
|
|
295
|
+
}
|
|
296
|
+
interface XrpGate extends XrpGateState {
|
|
297
|
+
isChecking: boolean;
|
|
298
|
+
/** Surface when `checkFailed` is true. */
|
|
299
|
+
error: Error | undefined;
|
|
300
|
+
retry: () => void;
|
|
301
|
+
isRequestingTrustline: boolean;
|
|
302
|
+
/** Returns `undefined` when required inputs are missing. */
|
|
303
|
+
requestTrustline: () => Promise<Result<string> | undefined>;
|
|
304
|
+
}
|
|
361
305
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
306
|
+
* Gates XRPL delivery on a trustline with room for the payout and enough XRP to set one. Refusals a
|
|
307
|
+
* trustline cannot fix surface as `blockedReason`.
|
|
364
308
|
*/
|
|
365
|
-
declare function
|
|
309
|
+
declare function useXrpGate({ dstChainKey, token, address, amount, maxAmount, walletProvider, }: UseXrpGateParams): XrpGate;
|
|
366
310
|
|
|
367
311
|
type UseGetUserHubWalletAddressParams = ReadHookParams<Address, {
|
|
368
312
|
spokeChainId?: SpokeChainKey;
|
|
369
313
|
spokeAddress?: string;
|
|
370
314
|
}>;
|
|
371
|
-
/**
|
|
372
|
-
* Hook for deriving user wallet address for hub abstraction.
|
|
373
|
-
*
|
|
374
|
-
* This hook derives the user's abstracted wallet address for the hub chain based on the spoke chain ID and address.
|
|
375
|
-
* If the spoke chain is the same as the hub chain, it returns the encoded spoke address.
|
|
376
|
-
* Otherwise, it derives and returns the abstracted wallet address for cross-chain operations.
|
|
377
|
-
* NOTE: This hook is different from useDeriveUserWalletAddress because it uses wallet router address instead of CREATE3 address for Sonic (hub).
|
|
378
|
-
*
|
|
379
|
-
* The query is automatically enabled when both `spokeChainId` and `spokeAddress` are provided.
|
|
380
|
-
* This is a deterministic operation, so the result is cached and not refetched automatically.
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* ```typescript
|
|
384
|
-
* const { data: derivedAddress, isLoading, error } = useGetUserHubWalletAddress({
|
|
385
|
-
* params: { spokeChainId, spokeAddress: userAddress },
|
|
386
|
-
* });
|
|
387
|
-
* ```
|
|
388
|
-
*/
|
|
315
|
+
/** Unlike `useDeriveUserWalletAddress`, uses the wallet router address (not CREATE3) for the hub chain. */
|
|
389
316
|
declare function useGetUserHubWalletAddress({ params, queryOptions, }?: UseGetUserHubWalletAddressParams): UseQueryResult<Address, Error>;
|
|
390
317
|
|
|
391
|
-
/**
|
|
392
|
-
* Domain inputs for {@link useXBalances}. `xChainId` is optional so the hook can be mounted
|
|
393
|
-
* before a chain is selected; `enabled` gates execution on every required field being present.
|
|
394
|
-
*/
|
|
395
318
|
interface XBalancesInputs {
|
|
396
319
|
xService: IXServiceBase | undefined;
|
|
397
320
|
xChainId: SpokeChainKey | undefined;
|
|
@@ -399,35 +322,16 @@ interface XBalancesInputs {
|
|
|
399
322
|
address: string | undefined;
|
|
400
323
|
}
|
|
401
324
|
type UseXBalancesParams = ReadHookParams<Record<string, bigint>, XBalancesInputs>;
|
|
402
|
-
/**
|
|
403
|
-
* Pure builder for {@link useXBalances} query options. Exported for unit
|
|
404
|
-
* tests and for advanced callers that compose their own `useQuery` wrapper.
|
|
405
|
-
*/
|
|
406
325
|
declare function getXBalancesQueryOptions({ xService, xChainId, xTokens, address }: XBalancesInputs): {
|
|
407
326
|
queryKey: readonly ["shared", "xBalances", "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera" | "tron" | "robinhood" | "xrp" | "monad" | "ton" | "zcash" | "cardano" | undefined, (readonly [string, string])[], string | undefined];
|
|
408
327
|
queryFn: () => Promise<Record<string, bigint>>;
|
|
409
328
|
enabled: boolean;
|
|
410
329
|
refetchInterval: number;
|
|
411
330
|
};
|
|
412
|
-
/**
|
|
413
|
-
* Fetch token balances for multiple tokens on a specific chain. Returns an
|
|
414
|
-
* object mapping each token's address to its balance in smallest unit.
|
|
415
|
-
*
|
|
416
|
-
* @example
|
|
417
|
-
* ```tsx
|
|
418
|
-
* const xService = useXService({ xChainType: getXChainType(xChainId) });
|
|
419
|
-
* const { data: balances } = useXBalances({ params: { xService, xChainId, xTokens, address } });
|
|
420
|
-
* ```
|
|
421
|
-
*/
|
|
331
|
+
/** Balances keyed by token address, in smallest units. */
|
|
422
332
|
declare function useXBalances({ params, queryOptions, }?: UseXBalancesParams): UseQueryResult<Record<string, bigint>>;
|
|
423
333
|
|
|
424
|
-
/**
|
|
425
|
-
* Domain inputs for {@link useBalances}. `chainKey` is optional so the hook can be mounted before a
|
|
426
|
-
* chain is selected; `enabled` gates execution on every required field being present.
|
|
427
|
-
*
|
|
428
|
-
* The SDK reads the chain named by `chainKey` and ignores `token.chainKey`, so a token that does
|
|
429
|
-
* not live on that chain reads as `0n` rather than erroring — keep the two in step.
|
|
430
|
-
*/
|
|
334
|
+
/** The SDK ignores `token.chainKey`: a token not on `chainKey` reads as `0n` rather than erroring. */
|
|
431
335
|
interface BalancesInputs {
|
|
432
336
|
chainKey: SpokeChainKey | undefined;
|
|
433
337
|
tokens: readonly XToken[];
|
|
@@ -436,11 +340,6 @@ interface BalancesInputs {
|
|
|
436
340
|
accountAddress?: string;
|
|
437
341
|
}
|
|
438
342
|
type UseBalancesParams = ReadHookParams<Record<string, bigint>, BalancesInputs>;
|
|
439
|
-
/**
|
|
440
|
-
* Pure builder for {@link useBalances} query options. Exported for unit tests and for advanced
|
|
441
|
-
* callers that compose their own `useQuery` wrapper. Takes the SDK instance explicitly (the hook
|
|
442
|
-
* supplies it from context).
|
|
443
|
-
*/
|
|
444
343
|
declare function getBalancesQueryOptions(sodax: Sodax, { chainKey, tokens, address, accountAddress }: BalancesInputs): {
|
|
445
344
|
queryKey: readonly ["shared", "balances", "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera" | "tron" | "robinhood" | "xrp" | "monad" | "ton" | "zcash" | "cardano" | undefined, (readonly [string, string])[], string | undefined, ...string[]];
|
|
446
345
|
queryFn: () => Promise<Record<string, bigint>>;
|
|
@@ -448,42 +347,14 @@ declare function getBalancesQueryOptions(sodax: Sodax, { chainKey, tokens, addre
|
|
|
448
347
|
refetchInterval: number;
|
|
449
348
|
};
|
|
450
349
|
/**
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
* object mapping each token's address to its balance in smallest units.
|
|
454
|
-
*
|
|
455
|
-
* This is the SDK-backed successor to {@link useXBalances} (which wraps a wallet-layer `xService`).
|
|
456
|
-
* Prefer this when the app already has a `SodaxProvider`.
|
|
457
|
-
*
|
|
458
|
-
* Failure model: a token that could not be read is logged by the SDK and reported as `0n`, so a
|
|
459
|
-
* flaky RPC is indistinguishable from an empty wallet — always the conservative direction, since
|
|
460
|
-
* under-reporting blocks a spend rather than permitting one. The query only errors when the whole
|
|
461
|
-
* batch is unusable: a shared round-trip every token depends on, or a batch in which no token
|
|
462
|
-
* could be read at all.
|
|
463
|
-
*
|
|
464
|
-
* Chain-specific notes: Stellar XLM reports the *spendable* amount (total minus the minimum reserve
|
|
465
|
-
* and selling liabilities); Bitcoin returns `0n` for Rune tokens, whose amounts are not exposed by
|
|
466
|
-
* the UTXO endpoint.
|
|
467
|
-
*
|
|
468
|
-
* @example
|
|
469
|
-
* ```tsx
|
|
470
|
-
* const { data: balances } = useBalances({ params: { chainKey, address, tokens } });
|
|
471
|
-
* const usdcBalance = balances?.[usdc.address] ?? 0n;
|
|
472
|
-
* ```
|
|
350
|
+
* Balances keyed by token address. An unreadable token reports `0n`; the query errors only when the
|
|
351
|
+
* whole batch fails. Stellar XLM is the spendable amount; Bitcoin Runes read `0n`.
|
|
473
352
|
*/
|
|
474
353
|
declare function useBalances({ params, queryOptions }?: UseBalancesParams): UseQueryResult<Record<string, bigint>>;
|
|
475
354
|
|
|
476
355
|
/**
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
* Two balance hooks ship side by side — {@link useBalances} (SDK-backed, keyed under
|
|
480
|
-
* `['shared','balances', …]`) and {@link useXBalances} (wallet-layer, `['shared','xBalances', …]`) —
|
|
481
|
-
* and an app may mount either. React Query matches query keys element-wise, so one key never
|
|
482
|
-
* matches the other; a mutation hook that invalidates only one silently leaves the other stale.
|
|
483
|
-
* Route every post-transaction balance refresh through here so the two cannot drift apart again.
|
|
484
|
-
*
|
|
485
|
-
* `undefined` chain keys are skipped and duplicates collapse, so callers can pass
|
|
486
|
-
* `(src, dst)` without guarding either.
|
|
356
|
+
* Invalidates both `useBalances` and `useXBalances` keys; invalidating only one leaves the other stale.
|
|
357
|
+
* `undefined` keys are skipped and duplicates collapse.
|
|
487
358
|
*/
|
|
488
359
|
declare function invalidateBalances(queryClient: QueryClient, ...chainKeys: readonly (SpokeChainKey | undefined)[]): void;
|
|
489
360
|
|
|
@@ -506,30 +377,15 @@ type RadfiAuthResult = {
|
|
|
506
377
|
declare function saveRadfiSession(address: string, session: RadfiSession): void;
|
|
507
378
|
declare function loadRadfiSession(address: string): RadfiSession | null;
|
|
508
379
|
declare function clearRadfiSession(address: string): void;
|
|
509
|
-
/**
|
|
510
|
-
* React hook for authenticating with Bound Exchange via BIP322-signed message. Pure mutation: pass
|
|
511
|
-
* `{ walletProvider }` to `mutate({...})`. The hook itself takes no arguments other than the
|
|
512
|
-
* structural `mutationOptions` slot.
|
|
513
|
-
*/
|
|
380
|
+
/** Authenticates with Bound Exchange via a BIP322-signed message. */
|
|
514
381
|
declare function useRadfiAuth({ mutationOptions, }?: MutationHookParams<RadfiAuthResult, UseRadfiAuthVars>): SafeUseMutationResult<RadfiAuthResult, Error, UseRadfiAuthVars>;
|
|
515
382
|
|
|
516
383
|
type UseEnsureRadfiAccessTokenVars = {
|
|
517
384
|
walletProvider: IBitcoinWalletProvider;
|
|
518
385
|
};
|
|
519
386
|
/**
|
|
520
|
-
*
|
|
521
|
-
*
|
|
522
|
-
* refresh fails. Bound tokens are short-lived, so call this right before a Bitcoin-source
|
|
523
|
-
* createIntent — forward the returned token via the typed `extras.bound.accessToken` slot (SDK in-process)
|
|
524
|
-
* or the `accessToken` body field on the backend DTO — or before the client-side sign + co-sign step.
|
|
525
|
-
*
|
|
526
|
-
* @example
|
|
527
|
-
* const { mutateAsync: ensureToken } = useEnsureRadfiAccessToken();
|
|
528
|
-
* const accessToken = await ensureToken({ walletProvider });
|
|
529
|
-
* // SDK in-process (Bitcoin-gated extras):
|
|
530
|
-
* await sodax.swaps.createIntent({ params, extras: { bound: { accessToken } }, raw: true });
|
|
531
|
-
* // or backend createIntent — token in the body, not an x-bound-access-token header:
|
|
532
|
-
* await createIntent({ body: { ...body, accessToken } });
|
|
387
|
+
* Bound tokens are short-lived: call right before a Bitcoin-source createIntent and pass the token as
|
|
388
|
+
* `extras.bound.accessToken` (SDK) or the `accessToken` body field (backend). Falls back to BIP322 re-auth.
|
|
533
389
|
*/
|
|
534
390
|
declare function useEnsureRadfiAccessToken({ mutationOptions, }?: MutationHookParams<string, UseEnsureRadfiAccessTokenVars>): SafeUseMutationResult<string, Error, UseEnsureRadfiAccessTokenVars>;
|
|
535
391
|
|
|
@@ -546,33 +402,19 @@ type UseFundTradingWalletVars = {
|
|
|
546
402
|
amount: bigint;
|
|
547
403
|
walletProvider: IBitcoinWalletProvider;
|
|
548
404
|
};
|
|
549
|
-
/**
|
|
550
|
-
* React hook for funding the user's Bound Exchange trading wallet from their personal Bitcoin wallet.
|
|
551
|
-
* Pure mutation: pass `{ amount, walletProvider }` to `mutate({...})`. Returns the broadcast tx
|
|
552
|
-
* id on success.
|
|
553
|
-
*/
|
|
554
405
|
declare function useFundTradingWallet({ mutationOptions, }?: MutationHookParams<string, UseFundTradingWalletVars>): SafeUseMutationResult<string, Error, UseFundTradingWalletVars>;
|
|
555
406
|
|
|
556
407
|
type UseBitcoinBalanceParams = ReadHookParams<bigint, {
|
|
557
408
|
address: string | undefined;
|
|
558
409
|
rpcUrl?: string;
|
|
559
410
|
}>;
|
|
560
|
-
/**
|
|
561
|
-
* Hook to fetch BTC balance for any Bitcoin address.
|
|
562
|
-
* Sums all UTXOs (confirmed + unconfirmed) from mempool.space API.
|
|
563
|
-
*
|
|
564
|
-
* The UTXO set already excludes spent outputs (even from unconfirmed txs),
|
|
565
|
-
* so the total is always the correct spendable balance.
|
|
566
|
-
*/
|
|
411
|
+
/** Sums all UTXOs (confirmed + unconfirmed); the UTXO set already excludes spent outputs. */
|
|
567
412
|
declare function useBitcoinBalance({ params, queryOptions, }?: UseBitcoinBalanceParams): UseQueryResult<bigint, Error>;
|
|
568
413
|
|
|
569
414
|
type UseTradingWalletReturn = {
|
|
570
415
|
tradingAddress: string | undefined;
|
|
571
416
|
};
|
|
572
|
-
/**
|
|
573
|
-
* Returns the Bound Exchange trading wallet address from the persisted session.
|
|
574
|
-
* Trading wallet is created automatically during authentication — no API call needed.
|
|
575
|
-
*/
|
|
417
|
+
/** Reads the trading address from the persisted session (created during auth); no API call. */
|
|
576
418
|
declare function useTradingWallet(walletAddress: string | undefined): UseTradingWalletReturn;
|
|
577
419
|
|
|
578
420
|
type UseTradingWalletBalanceParams = ReadHookParams<RadfiWalletBalance, {
|
|
@@ -583,7 +425,6 @@ declare function useTradingWalletBalance({ params, queryOptions, }?: UseTradingW
|
|
|
583
425
|
|
|
584
426
|
interface UseBitcoinTradingSetupParams {
|
|
585
427
|
chainKey: SpokeChainKey;
|
|
586
|
-
/** This side's wallet provider + account, e.g. `useWalletProvider` / `useXAccount`. */
|
|
587
428
|
walletProvider: IWalletProvider | undefined;
|
|
588
429
|
address: string | undefined;
|
|
589
430
|
}
|
|
@@ -592,9 +433,8 @@ interface BitcoinTradingSetup {
|
|
|
592
433
|
tradingBalance: RadfiWalletBalance | undefined;
|
|
593
434
|
}
|
|
594
435
|
/**
|
|
595
|
-
* Bitcoin
|
|
596
|
-
*
|
|
597
|
-
* is Bitcoin. Wallet-layer inputs are passed in — this package doesn't depend on wallet-sdk-react.
|
|
436
|
+
* Bitcoin funds move through a Bound (Radfi) trading wallet; inert unless `chainKey` is Bitcoin.
|
|
437
|
+
* Wallet inputs are passed in because this package must not depend on wallet-sdk-react.
|
|
598
438
|
*/
|
|
599
439
|
declare function useBitcoinTradingSetup({ chainKey, walletProvider, address, }: UseBitcoinTradingSetupParams): BitcoinTradingSetup;
|
|
600
440
|
|
|
@@ -608,10 +448,6 @@ type UseRenewUtxosVars = {
|
|
|
608
448
|
txIdVouts: string[];
|
|
609
449
|
walletProvider: IBitcoinWalletProvider;
|
|
610
450
|
};
|
|
611
|
-
/**
|
|
612
|
-
* React hook for renewing expired UTXOs in the user's Bound Exchange trading wallet. Pure mutation: pass
|
|
613
|
-
* `{ txIdVouts, walletProvider }` to `mutate({...})`.
|
|
614
|
-
*/
|
|
615
451
|
declare function useRenewUtxos({ mutationOptions, }?: MutationHookParams<string, UseRenewUtxosVars>): SafeUseMutationResult<string, Error, UseRenewUtxosVars>;
|
|
616
452
|
|
|
617
453
|
type UseRadfiWithdrawVars = {
|
|
@@ -624,148 +460,50 @@ type WithdrawResult = {
|
|
|
624
460
|
txId: string;
|
|
625
461
|
fee: number;
|
|
626
462
|
};
|
|
627
|
-
/**
|
|
628
|
-
* React hook for withdrawing BTC from the user's Bound Exchange trading wallet back to their personal
|
|
629
|
-
* Bitcoin wallet. Pure mutation: pass all inputs (including the wallet provider) to
|
|
630
|
-
* `mutate({...})`.
|
|
631
|
-
*/
|
|
632
463
|
declare function useRadfiWithdraw({ mutationOptions, }?: MutationHookParams<WithdrawResult, UseRadfiWithdrawVars>): SafeUseMutationResult<WithdrawResult, Error, UseRadfiWithdrawVars>;
|
|
633
464
|
|
|
634
|
-
/**
|
|
635
|
-
* Mutation variables for {@link useBorrow}. Generic over `K extends SpokeChainKey` (defaults to
|
|
636
|
-
* the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
637
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
638
|
-
*/
|
|
639
465
|
type UseBorrowVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketBorrowActionParams<K, false>, 'raw'>;
|
|
640
|
-
/**
|
|
641
|
-
* React hook for borrowing tokens from the Sodax money market protocol.
|
|
642
|
-
*
|
|
643
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
644
|
-
* `onError`, `retry`). Returns the unwrapped {@link OutboundSettlement} on success: a tx pair, or
|
|
645
|
-
* from Tron the relay's `trackingId` beside the destination tx.
|
|
646
|
-
*/
|
|
466
|
+
/** Throws on SDK failure; resolves to an {@link OutboundSettlement} (tx pair, or Tron relay `trackingId` + dst tx). */
|
|
647
467
|
declare function useBorrow<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<OutboundSettlement<K>, UseBorrowVars<K>>): SafeUseMutationResult<OutboundSettlement<K>, Error, UseBorrowVars<K>>;
|
|
648
468
|
|
|
649
|
-
/**
|
|
650
|
-
* Mutation variables for {@link useRepay}. Generic over `K extends SpokeChainKey` (defaults to
|
|
651
|
-
* the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
652
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
653
|
-
*/
|
|
654
469
|
type UseRepayVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketRepayActionParams<K, false>, 'raw'>;
|
|
655
|
-
/**
|
|
656
|
-
* React hook for repaying a borrow in the Sodax money market protocol.
|
|
657
|
-
*
|
|
658
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
659
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
660
|
-
*/
|
|
470
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
661
471
|
declare function useRepay<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseRepayVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseRepayVars<K>>;
|
|
662
472
|
|
|
663
|
-
/**
|
|
664
|
-
* Mutation variables for {@link useSupply}. Generic over `K extends SpokeChainKey` (defaults to
|
|
665
|
-
* the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
666
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
667
|
-
*/
|
|
668
473
|
type UseSupplyVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketSupplyActionParams<K, false>, 'raw'>;
|
|
669
|
-
/**
|
|
670
|
-
* React hook for supplying tokens to the Sodax money market protocol.
|
|
671
|
-
*
|
|
672
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
673
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
674
|
-
*
|
|
675
|
-
* @example
|
|
676
|
-
* ```tsx
|
|
677
|
-
* const walletProvider = useWalletProvider({ xChainId: chainKey });
|
|
678
|
-
* const { mutateAsync: supply, isError, error } = useSupply();
|
|
679
|
-
* if (!walletProvider) return;
|
|
680
|
-
* try {
|
|
681
|
-
* const { spokeTxHash, hubTxHash } = await supply({ params: supplyParams, walletProvider });
|
|
682
|
-
* } catch (e) {
|
|
683
|
-
* // surfaced via mutation.error / onError
|
|
684
|
-
* }
|
|
685
|
-
* ```
|
|
686
|
-
*/
|
|
474
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
687
475
|
declare function useSupply<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseSupplyVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseSupplyVars<K>>;
|
|
688
476
|
|
|
689
|
-
/**
|
|
690
|
-
* Mutation variables for {@link useWithdraw}. Generic over `K extends SpokeChainKey` (defaults to
|
|
691
|
-
* the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
692
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
693
|
-
*/
|
|
694
477
|
type UseWithdrawVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketWithdrawActionParams<K, false>, 'raw'>;
|
|
695
|
-
/**
|
|
696
|
-
* React hook for withdrawing supplied tokens from the Sodax money market protocol.
|
|
697
|
-
*
|
|
698
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
699
|
-
* `onError`, `retry`). Returns the unwrapped {@link OutboundSettlement} on success: a tx pair, or
|
|
700
|
-
* from Tron the relay's `trackingId` beside the destination tx.
|
|
701
|
-
*/
|
|
478
|
+
/** Throws on SDK failure; resolves to an {@link OutboundSettlement} (tx pair, or Tron relay `trackingId` + dst tx). */
|
|
702
479
|
declare function useWithdraw<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<OutboundSettlement<K>, UseWithdrawVars<K>>): SafeUseMutationResult<OutboundSettlement<K>, Error, UseWithdrawVars<K>>;
|
|
703
480
|
|
|
704
481
|
type UseUserReservesDataParams = ReadHookParams<readonly [readonly UserReserveData[], number], {
|
|
705
482
|
spokeChainKey: SpokeChainKey | undefined;
|
|
706
483
|
userAddress: string | undefined;
|
|
707
484
|
}>;
|
|
708
|
-
/**
|
|
709
|
-
* React hook for fetching the raw user reserves data (positions on the hub) for a given spoke
|
|
710
|
-
* chain and user address.
|
|
711
|
-
*/
|
|
712
485
|
declare function useUserReservesData({ params, queryOptions, }?: UseUserReservesDataParams): UseQueryResult<readonly [readonly UserReserveData[], number], Error>;
|
|
713
486
|
|
|
714
487
|
type UseReservesDataParams = ReadHookParams<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>;
|
|
715
|
-
/**
|
|
716
|
-
* React hook for fetching the latest aggregated reserves data and base-currency info from the
|
|
717
|
-
* Sodax money market.
|
|
718
|
-
*/
|
|
719
488
|
declare function useReservesData({ queryOptions, }?: UseReservesDataParams): UseQueryResult<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo], Error>;
|
|
720
489
|
|
|
721
490
|
type UseReservesHumanizedParams = ReadHookParams<ReservesDataHumanized>;
|
|
722
|
-
/**
|
|
723
|
-
* React hook for fetching the human-readable (decimal-normalized, string-formatted) reserves
|
|
724
|
-
* snapshot from the Sodax money market.
|
|
725
|
-
*/
|
|
726
491
|
declare function useReservesHumanized({ queryOptions, }?: UseReservesHumanizedParams): UseQueryResult<ReservesDataHumanized, Error>;
|
|
727
492
|
|
|
728
493
|
type UseReservesListParams = ReadHookParams<readonly Address$1[]>;
|
|
729
|
-
/**
|
|
730
|
-
* React hook for fetching the list of reserve asset addresses currently registered in the
|
|
731
|
-
* Sodax money market.
|
|
732
|
-
*/
|
|
733
494
|
declare function useReservesList({ queryOptions, }?: UseReservesListParams): UseQueryResult<readonly Address$1[], Error>;
|
|
734
495
|
|
|
735
496
|
type UseMMAllowanceParams<K extends SpokeChainKey> = ReadHookParams<boolean, {
|
|
736
497
|
payload: MoneyMarketParams<K> | undefined;
|
|
737
498
|
}>;
|
|
738
499
|
/**
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
* Skips the on-chain check entirely for `borrow` and `withdraw` actions — those don't require
|
|
742
|
-
* approval, and the SDK already short-circuits to `true` for them. The early `enabled: false`
|
|
743
|
-
* here additionally avoids a render flash with `isLoading: true`.
|
|
744
|
-
*
|
|
745
|
-
* The query key matches the invalidation keys emitted by `useMMApprove` and the four mutation
|
|
746
|
-
* hooks: `['mm', 'allowance', srcChainKey, token, action]`.
|
|
747
|
-
*
|
|
748
|
-
* @example
|
|
749
|
-
* ```tsx
|
|
750
|
-
* const { data: hasAllowance } = useMMAllowance({ params: { payload: supplyParams } });
|
|
751
|
-
* ```
|
|
500
|
+
* `borrow`/`withdraw` need no approval: the query stays disabled and `data` is seeded with `true`. Query key must
|
|
501
|
+
* match the `['mm', 'allowance', srcChainKey, token, action]` invalidations from `useMMApprove` and mutations.
|
|
752
502
|
*/
|
|
753
503
|
declare function useMMAllowance<K extends SpokeChainKey>({ params, queryOptions, }?: UseMMAllowanceParams<K>): UseQueryResult<boolean, Error>;
|
|
754
504
|
|
|
755
|
-
/**
|
|
756
|
-
* Mutation variables for {@link useMMApprove}. Generic over `K extends SpokeChainKey` (defaults
|
|
757
|
-
* to the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
758
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
759
|
-
*/
|
|
760
505
|
type UseMMApproveVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketApproveActionParams<K, false>, 'raw'>;
|
|
761
|
-
/**
|
|
762
|
-
* React hook for approving ERC-20 token spending (or trustline establishment) for a Sodax money
|
|
763
|
-
* market action.
|
|
764
|
-
*
|
|
765
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
766
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success. Invalidates the matching
|
|
767
|
-
* `['mm', 'allowance', srcChainKey, token, action]` query on confirmed success.
|
|
768
|
-
*/
|
|
506
|
+
/** Throws on SDK failure; invalidates the matching `['mm', 'allowance', ...]` query on success. */
|
|
769
507
|
declare function useMMApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseMMApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseMMApproveVars<K>>;
|
|
770
508
|
|
|
771
509
|
type ATokenData = Erc20Token & {
|
|
@@ -774,12 +512,7 @@ type ATokenData = Erc20Token & {
|
|
|
774
512
|
type UseATokenParams = ReadHookParams<ATokenData, {
|
|
775
513
|
aToken: Address | string | undefined;
|
|
776
514
|
}>;
|
|
777
|
-
/**
|
|
778
|
-
* React hook to fetch ERC-20 metadata for a given aToken address on the hub chain.
|
|
779
|
-
* Returns `Erc20Token` (`name`, `symbol`, `decimals`, `address`) augmented with the hub
|
|
780
|
-
* `chainKey`. Note: the returned shape is a subset of `XToken` — `hubAsset` and `vault` fields
|
|
781
|
-
* must be resolved separately if needed.
|
|
782
|
-
*/
|
|
515
|
+
/** Returns ERC-20 metadata plus hub `chainKey` only; `hubAsset` and `vault` are not resolved. */
|
|
783
516
|
declare function useAToken({ params, queryOptions }?: UseATokenParams): UseQueryResult<ATokenData, Error>;
|
|
784
517
|
|
|
785
518
|
type UseATokensBalancesParams = ReadHookParams<Map<Address, bigint>, {
|
|
@@ -787,56 +520,26 @@ type UseATokensBalancesParams = ReadHookParams<Map<Address, bigint>, {
|
|
|
787
520
|
spokeChainKey: SpokeChainKey | undefined;
|
|
788
521
|
userAddress: string | undefined;
|
|
789
522
|
}>;
|
|
790
|
-
/**
|
|
791
|
-
* React hook to fetch aToken balances for a list of addresses in a single multicall.
|
|
792
|
-
* Derives the user's hub wallet via `EvmHubProvider.getUserHubWalletAddress` from the
|
|
793
|
-
* spoke `chainKey` + spoke wallet `userAddress`.
|
|
794
|
-
*/
|
|
795
523
|
declare function useATokensBalances({ params, queryOptions, }?: UseATokensBalancesParams): UseQueryResult<Map<Address, bigint>, Error>;
|
|
796
524
|
|
|
797
525
|
type ReserveUsdFormat = ReserveDataHumanized & FormatReserveUSDResponse;
|
|
798
526
|
type UseReservesUsdFormatParams = ReadHookParams<ReserveUsdFormat[]>;
|
|
799
|
-
/**
|
|
800
|
-
* React hook returning reserves with USD-formatted values for the Sodax money market.
|
|
801
|
-
* Chains `getReservesHumanized` → `buildReserveDataWithPrice` → `formatReservesUSD`.
|
|
802
|
-
*/
|
|
803
527
|
declare function useReservesUsdFormat({ queryOptions, }?: UseReservesUsdFormatParams): UseQueryResult<ReserveUsdFormat[], Error>;
|
|
804
528
|
|
|
805
529
|
type UseUserFormattedSummaryParams = ReadHookParams<FormatUserSummaryResponse<FormatReserveUSDResponse>, {
|
|
806
530
|
spokeChainKey: SpokeChainKey | undefined;
|
|
807
531
|
userAddress: string | undefined;
|
|
808
532
|
}>;
|
|
809
|
-
/**
|
|
810
|
-
* React hook returning the user's formatted money market portfolio summary (collateral, borrows,
|
|
811
|
-
* health factor, available borrow power, etc.) for the given spoke chain.
|
|
812
|
-
*
|
|
813
|
-
* Internally chains `getReservesHumanized` → `formatReservesUSD` → `getUserReservesHumanized`
|
|
814
|
-
* → `formatUserSummary`.
|
|
815
|
-
*/
|
|
816
533
|
declare function useUserFormattedSummary({ params, queryOptions, }?: UseUserFormattedSummaryParams): UseQueryResult<FormatUserSummaryResponse<FormatReserveUSDResponse>, Error>;
|
|
817
534
|
|
|
818
535
|
type UseEModesParams = ReadHookParams<EmodeDataHumanized[]>;
|
|
819
536
|
/**
|
|
820
|
-
*
|
|
821
|
-
*
|
|
822
|
-
*
|
|
823
|
-
* A category's LTV replaces the reserve's own when a user opts into it, so anything projecting
|
|
824
|
-
* borrowing power for an eMode position must read it from here rather than from the reserve.
|
|
825
|
-
* Categories only change by governance, so this is not polled.
|
|
826
|
-
*
|
|
827
|
-
* @example
|
|
828
|
-
* ```typescript
|
|
829
|
-
* const { data: categories } = useEModes();
|
|
830
|
-
* const cat = categories?.find(c => Number(c.id) === selected);
|
|
831
|
-
* const ltv = Number(cat?.eMode.ltv ?? 0) / 10_000;
|
|
832
|
-
* ```
|
|
537
|
+
* A category's LTV replaces the reserve's own when a user opts in, so eMode borrow-power projections
|
|
538
|
+
* must read it from here. Categories change only by governance, so this is not polled.
|
|
833
539
|
*/
|
|
834
540
|
declare function useEModes({ queryOptions }?: UseEModesParams): UseQueryResult<EmodeDataHumanized[], Error>;
|
|
835
541
|
|
|
836
|
-
/**
|
|
837
|
-
* Derived from the SDK method rather than restated, so the error union stays exact and cannot
|
|
838
|
-
* drift. `undefined` is the disabled state, before a `payload` exists.
|
|
839
|
-
*/
|
|
542
|
+
/** Derived from the SDK method so the error union cannot drift; `undefined` means disabled (no `payload`). */
|
|
840
543
|
type SwapQuote = Awaited<ReturnType<Sodax['swaps']['getQuote']>> | undefined;
|
|
841
544
|
type UseQuoteParams = ReadHookParams<SwapQuote, {
|
|
842
545
|
payload: SolverIntentQuoteRequest | undefined;
|
|
@@ -865,51 +568,22 @@ declare function getSwapQuoteQueryOptions({ sodax, payload, }: {
|
|
|
865
568
|
refetchInterval: number;
|
|
866
569
|
};
|
|
867
570
|
/**
|
|
868
|
-
*
|
|
869
|
-
*
|
|
870
|
-
* For a leverage-yield vault deposit or withdraw use `useLeverageYieldQuote` instead — this hook
|
|
871
|
-
* deducts the effective *swap* fee, which is not what a vault intent charges.
|
|
872
|
-
*
|
|
873
|
-
* @example
|
|
874
|
-
* ```typescript
|
|
875
|
-
* const { data: quote, isLoading } = useQuote({ params: { payload } });
|
|
876
|
-
* ```
|
|
877
|
-
*
|
|
878
|
-
* @remarks
|
|
879
|
-
* - The quote is automatically refreshed every 3 seconds
|
|
880
|
-
* - The query is disabled when payload is undefined
|
|
881
|
-
* - Returns the SDK `Result` as `data`; branch on `data?.ok` rather than reading `isError`
|
|
571
|
+
* Polls every 3s; `data` is the SDK `Result`, so branch on `data?.ok`, not `isError`.
|
|
572
|
+
* Deducts the swap fee: use `useLeverageYieldQuote` for leverage-yield vault intents.
|
|
882
573
|
*/
|
|
883
574
|
declare const useQuote: ({ params, queryOptions }?: UseQuoteParams) => UseQueryResult<SwapQuote>;
|
|
884
575
|
|
|
885
|
-
/**
|
|
886
|
-
* Mutation variables for {@link useSwap}. Generic over `K extends SpokeChainKey` (defaults to the
|
|
887
|
-
* full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
888
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
889
|
-
*/
|
|
576
|
+
/** Lock `K` at the call site to narrow `walletProvider` and `params.srcChainKey`. */
|
|
890
577
|
type UseSwapVars<K extends SpokeChainKey = SpokeChainKey> = Omit<SwapActionParams<K, false>, 'raw'>;
|
|
891
|
-
/**
|
|
892
|
-
* React hook for executing an intent-based cross-chain swap.
|
|
893
|
-
*
|
|
894
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
895
|
-
* `onError`, `retry`). Returns the unwrapped `SwapResponse` on success.
|
|
896
|
-
*/
|
|
578
|
+
/** Throws on SDK failure; resolves to the unwrapped `SwapResponse` and invalidates balances. */
|
|
897
579
|
declare function useSwap<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<SwapResponse, UseSwapVars<K>>): SafeUseMutationResult<SwapResponse, Error, UseSwapVars<K>>;
|
|
898
580
|
|
|
899
581
|
type UseStatusParams = ReadHookParams<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined, {
|
|
900
582
|
intentTxHash: Hex | undefined;
|
|
901
583
|
}>;
|
|
902
584
|
/**
|
|
903
|
-
*
|
|
904
|
-
*
|
|
905
|
-
* Polls every 3s while the intent is in flight. Stops on `SOLVED` (3) or `FAILED` (4). Stops after
|
|
906
|
-
* 40 consecutive successful fetches while status stays `NOT_FOUND` (~2 min) — a forgotten intent
|
|
907
|
-
* never changes. An in-flight status resets that streak. Override with `queryOptions.refetchInterval`.
|
|
908
|
-
*
|
|
909
|
-
* @example
|
|
910
|
-
* ```typescript
|
|
911
|
-
* const { data: status, isLoading } = useStatus({ params: { intentTxHash } });
|
|
912
|
-
* ```
|
|
585
|
+
* Polls every 3s; stops on `SOLVED`/`FAILED` or after 40 consecutive `NOT_FOUND` reads (~2 min).
|
|
586
|
+
* An in-flight status resets that streak.
|
|
913
587
|
*/
|
|
914
588
|
declare const useStatus: ({ params, queryOptions, }?: UseStatusParams) => UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>;
|
|
915
589
|
|
|
@@ -919,25 +593,8 @@ type UseDetailedStatusParams = ReadHookParams<UseDetailedStatusResult, {
|
|
|
919
593
|
srcTxHash: string | undefined;
|
|
920
594
|
}>;
|
|
921
595
|
/**
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
* `useStatus` needs the hub tx hash and always asks the solver; this takes `(srcChainKey,
|
|
925
|
-
* srcTxHash)` — the pair you hold after `swap()` — and routes to whichever source can answer.
|
|
926
|
-
* `data.value` is discriminated on `source`, and each variant carries that source's payload
|
|
927
|
-
* unmodified.
|
|
928
|
-
*
|
|
929
|
-
* Polls every 3s. Stops once the answering source is terminal, once the backend rejects the API
|
|
930
|
-
* key, and — like `useStatus` — after 40 consecutive *ambiguous* reads: a solver `NOT_FOUND`, or a
|
|
931
|
-
* `LOOKUP_FAILED` whose relay has no packet for the tx. Neither can distinguish "still in flight" from "never will be", so the budget
|
|
932
|
-
* is what stops a swap nothing can resolve. A dependency outage — relay unreachable, solver down —
|
|
933
|
-
* keeps polling instead, so the read recovers by itself; any real status resets the budget.
|
|
934
|
-
* Override with `queryOptions.refetchInterval`.
|
|
935
|
-
*
|
|
936
|
-
* @example
|
|
937
|
-
* ```typescript
|
|
938
|
-
* const { data } = useDetailedStatus({ params: { srcChainKey, srcTxHash } });
|
|
939
|
-
* if (data?.ok && data.value.source === 'backend') console.log(data.value.data.status);
|
|
940
|
-
* ```
|
|
596
|
+
* Status by source tx `(srcChainKey, srcTxHash)`, routed to whichever source can answer; `data.value` is discriminated on `source`.
|
|
597
|
+
* Polls every 3s until terminal, API-key rejection, or 40 consecutive ambiguous reads (solver NOT_FOUND / no relay packet); outages keep polling.
|
|
941
598
|
*/
|
|
942
599
|
declare const useDetailedStatus: ({ params, queryOptions, }?: UseDetailedStatusParams) => UseQueryResult<UseDetailedStatusResult>;
|
|
943
600
|
|
|
@@ -948,23 +605,12 @@ type UseSwapAllowanceParams<K extends SpokeChainKey> = ReadHookParams<boolean, {
|
|
|
948
605
|
}>;
|
|
949
606
|
declare function useSwapAllowance<K extends SpokeChainKey>({ params, queryOptions, }?: UseSwapAllowanceParams<K>): UseQueryResult<boolean, Error>;
|
|
950
607
|
|
|
951
|
-
/**
|
|
952
|
-
* Mutation variables for {@link useSwapApprove}. Generic over `K extends SpokeChainKey` (defaults
|
|
953
|
-
* to the full union). Sophisticated callers can lock K at the call site to narrow the
|
|
954
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
955
|
-
*/
|
|
608
|
+
/** Lock `K` at the call site to narrow `walletProvider` and `params.srcChainKey`. */
|
|
956
609
|
type UseSwapApproveVars<K extends SpokeChainKey = SpokeChainKey> = {
|
|
957
610
|
params: CreateIntentParams<K> | CreateLimitOrderParams<K>;
|
|
958
611
|
walletProvider: GetWalletProviderType<K>;
|
|
959
612
|
};
|
|
960
|
-
/**
|
|
961
|
-
* React hook for approving ERC-20 token spending (or trustline establishment) for a swap or
|
|
962
|
-
* limit-order intent.
|
|
963
|
-
*
|
|
964
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
965
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success. Invalidates all
|
|
966
|
-
* `['swap', 'allowance', ...]` queries so any pending allowance check refreshes.
|
|
967
|
-
*/
|
|
613
|
+
/** Approves spending (or sets a trustline). Throws on SDK failure; invalidates `['swap', 'allowance']` on success. */
|
|
968
614
|
declare function useSwapApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseSwapApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseSwapApproveVars<K>>;
|
|
969
615
|
|
|
970
616
|
type UseSwapApprovalStrategyParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<SwapApprovalStrategy, {
|
|
@@ -974,29 +620,15 @@ type UseSwapApprovalStrategyParams<K extends SpokeChainKey = SpokeChainKey> = Re
|
|
|
974
620
|
allowAccountUpgrade?: boolean;
|
|
975
621
|
}>;
|
|
976
622
|
/**
|
|
977
|
-
*
|
|
978
|
-
*
|
|
979
|
-
* swap). Use it to label the swap button before the user clicks. Pass the same `allowAccountUpgrade`
|
|
980
|
-
* you give the swap.
|
|
981
|
-
*
|
|
982
|
-
* Not polled: `useSwapWithApproval` invalidates it after a successful swap, and the swap itself
|
|
983
|
-
* re-reads the strategy at execution, so a stale label never picks the wrong path.
|
|
623
|
+
* Predicts the approval path {@link useSwapWithApproval} will take; pass the same `allowAccountUpgrade`.
|
|
624
|
+
* Not polled: the swap re-reads the strategy at execution, so a stale label never picks the wrong path.
|
|
984
625
|
*/
|
|
985
626
|
declare function useSwapApprovalStrategy<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseSwapApprovalStrategyParams<K>): UseQueryResult<SwapApprovalStrategy, Error>;
|
|
986
627
|
|
|
987
|
-
/**
|
|
988
|
-
* Mutation variables for {@link useSwapWithApproval}: `useSwap`'s, plus `allowAccountUpgrade`, `resumeBatchId` and
|
|
989
|
-
* `resumeBatchCallCount`.
|
|
990
|
-
*/
|
|
991
628
|
type UseSwapWithApprovalVars<K extends SpokeChainKey = SpokeChainKey> = Omit<SwapWithApprovalParams<K>, 'raw'>;
|
|
992
629
|
/**
|
|
993
|
-
* `useSwap` with
|
|
994
|
-
*
|
|
995
|
-
* batch-capable EVM wallet, otherwise approve, wait for it, then swap. `data.approvalStrategy`
|
|
996
|
-
* says which ran; {@link useSwapApprovalStrategy} predicts it.
|
|
997
|
-
*
|
|
998
|
-
* Throws on SDK failure so React Query's error model engages. On success invalidates balances and
|
|
999
|
-
* the swap allowance and approval-strategy queries.
|
|
630
|
+
* `useSwap` with approval folded in (one EIP-5792 batch where supported); `data.approvalStrategy` says which path ran.
|
|
631
|
+
* Throws on SDK failure; on success invalidates balances, allowance and approval-strategy queries.
|
|
1000
632
|
*/
|
|
1001
633
|
declare function useSwapWithApproval<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<SwapWithApprovalResponse, UseSwapWithApprovalVars<K>>): SafeUseMutationResult<SwapWithApprovalResponse, Error, UseSwapWithApprovalVars<K>>;
|
|
1002
634
|
|
|
@@ -1008,41 +640,16 @@ interface NearStorageGateState {
|
|
|
1008
640
|
isNear: boolean;
|
|
1009
641
|
/** Show the "register storage" action: the check resolved and the recipient is not registered. */
|
|
1010
642
|
needsRegistration: boolean;
|
|
1011
|
-
/**
|
|
1012
|
-
* Keep the downstream action (swap/bridge/borrow/withdraw) disabled: the NEAR gate is unresolved
|
|
1013
|
-
* (still checking) or unmet (needs registration).
|
|
1014
|
-
*/
|
|
643
|
+
/** True while the check is unresolved or registration is needed. */
|
|
1015
644
|
blocksAction: boolean;
|
|
1016
645
|
}
|
|
1017
|
-
/**
|
|
1018
|
-
*
|
|
1019
|
-
* on NEAR — NEAR's analogue of the Stellar trustline gate. Unwrapped (no hook): pass the destination
|
|
1020
|
-
* `chainKey` and the `useNearStorageCheck` result; the util owns the `=== NEAR` test and reads
|
|
1021
|
-
* `isLoading` (NOT `isPending`, which stays `true` for a disabled query and would block forever).
|
|
1022
|
-
*
|
|
1023
|
-
* `blocksAction` deliberately also covers the in-flight check window so the action can't be
|
|
1024
|
-
* triggered before registration status is known; `needsRegistration` only flips once the check has
|
|
1025
|
-
* resolved (so the "register" button isn't shown speculatively while still checking).
|
|
1026
|
-
*/
|
|
646
|
+
/** NEAR analogue of the Stellar trustline gate. Reads `isLoading`, not `isPending` (stays true for a disabled query);
|
|
647
|
+
* `blocksAction` also covers the in-flight check, while `needsRegistration` waits for it to resolve. */
|
|
1027
648
|
declare function resolveNearStorageGate(chainKey: SpokeChainKey | undefined, check: NearStorageCheckResult): NearStorageGateState;
|
|
1028
649
|
|
|
1029
650
|
/** A prerequisite the user must resolve before the swap can go out. */
|
|
1030
|
-
type SwapSetupReason = 'stellarActivation' | 'stellarFunding' | 'stellarTrustline' | 'stellarCheckFailed' | 'nearStorage' | 'nearStorageCheckFailed' | 'external';
|
|
1031
|
-
/**
|
|
1032
|
-
* Where a swap form stands, discriminated on `kind`. `useSwapLifecycle`'s `next()` acts on it.
|
|
1033
|
-
*
|
|
1034
|
-
* - `checking` — waiting before anything can be done: a gate or the approval strategy is still reading, or a
|
|
1035
|
-
* setup tx (activation, trustline, NEAR storage) is in flight or its check is refreshing.
|
|
1036
|
-
* - `submitting` — the swap call is in flight: signing, and on the default backend path settlement too.
|
|
1037
|
-
* - `pending` — the source tx status is being read, or a recovery handle is waiting for identification.
|
|
1038
|
-
* `error` is set when the swap call
|
|
1039
|
-
* failed after broadcast, or when the status read cannot recover (a rejected API key); the swap may
|
|
1040
|
-
* still complete either way. The read can also stop polling without an error (after its budget of
|
|
1041
|
-
* ambiguous reads), so keep `reset()` reachable here.
|
|
1042
|
-
* - `unconfirmed` — the wallet accepted an approve + swap batch that was not confirmed in time. It may
|
|
1043
|
-
* still land, so `next()` never sends it again: it waits for that batch and finishes the swap once it
|
|
1044
|
-
* lands. `reset()` stops tracking it.
|
|
1045
|
-
*/
|
|
651
|
+
type SwapSetupReason = 'stellarActivation' | 'stellarFunding' | 'stellarTrustline' | 'stellarCheckFailed' | 'nearStorage' | 'nearStorageCheckFailed' | 'xrpTrustline' | 'xrpFunding' | 'xrpBlocked' | 'xrpCheckFailed' | 'external';
|
|
652
|
+
/** Where a swap form stands, discriminated on `kind`; `useSwapLifecycle`'s `next()` acts on it. */
|
|
1046
653
|
type SwapLifecycleState = {
|
|
1047
654
|
kind: 'idle';
|
|
1048
655
|
} | {
|
|
@@ -1087,28 +694,20 @@ type SwapLifecycleState = {
|
|
|
1087
694
|
|
|
1088
695
|
type UseSwapLifecycleParams<K extends SpokeChainKey = SpokeChainKey> = {
|
|
1089
696
|
/**
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
* accepts any fill, so an app should not send one.
|
|
697
|
+
* Changing it starts a new lifecycle once the current swap is done; one that may still land holds until `reset()`.
|
|
698
|
+
* A `0n` `minOutputAmount` accepts any fill, so do not send one.
|
|
1093
699
|
*/
|
|
1094
700
|
intentParams: CreateIntentParams<K> | undefined;
|
|
1095
701
|
srcWalletProvider: GetWalletProviderType<K> | undefined;
|
|
1096
|
-
/**
|
|
1097
|
-
* Destination wallet, for the Stellar and NEAR setup actions. The gates check `intentParams.dstAddress`,
|
|
1098
|
-
* the account the swap pays, so this wallet must control it for those actions to clear them.
|
|
1099
|
-
*/
|
|
702
|
+
/** For the Stellar, NEAR and XRPL setup actions; must control `intentParams.dstAddress`, which the gates check. */
|
|
1100
703
|
dstWalletProvider: GetWalletProviderType<SpokeChainKey> | undefined;
|
|
1101
704
|
/** Source-chain switching, e.g. `useEvmSwitchChain` from `@sodax/wallet-sdk-react`. */
|
|
1102
705
|
chainSwitch?: {
|
|
1103
706
|
isWrongChain: boolean;
|
|
1104
707
|
switchChain: () => void | Promise<void>;
|
|
1105
708
|
};
|
|
1106
|
-
/** An app-owned prerequisite that must hold before swapping (e.g. a Bitcoin trading-wallet setup). */
|
|
1107
709
|
externalBlocked?: boolean;
|
|
1108
|
-
/**
|
|
1109
|
-
* `false` approves separately instead of asking a `'ready'` wallet to upgrade the account (e.g. after
|
|
1110
|
-
* the user declined: `USER_REJECTED` with `context.reason === ACCOUNT_UPGRADE_DECLINED`). Defaults to `true`.
|
|
1111
|
-
*/
|
|
710
|
+
/** `false` approves separately instead of asking a `'ready'` wallet to upgrade the account. Defaults to `true`. */
|
|
1112
711
|
allowAccountUpgrade?: boolean;
|
|
1113
712
|
extras?: SwapExtras<K>;
|
|
1114
713
|
timeout?: number;
|
|
@@ -1119,31 +718,23 @@ type SwapLifecycle<K extends SpokeChainKey = SpokeChainKey> = {
|
|
|
1119
718
|
/** The error behind `failed`, `unconfirmed` or a `pending` with one. Setup-action failures come back from `next()`. */
|
|
1120
719
|
error: Error | undefined;
|
|
1121
720
|
/**
|
|
1122
|
-
* Does what the current state needs
|
|
1123
|
-
*
|
|
1124
|
-
* failed swap. Does nothing while waiting or while a previous call is still running.
|
|
721
|
+
* Does what the current state needs (switch chain, setup step, swap, re-check an `unconfirmed` batch without resending, restart).
|
|
722
|
+
* No-op while waiting or while a previous call is still running.
|
|
1125
723
|
*/
|
|
1126
724
|
next: () => Promise<Result<unknown> | undefined>;
|
|
1127
|
-
/**
|
|
1128
|
-
* Stops tracking the current swap and re-reads the approval strategy. Cancels nothing on-chain; a no-op
|
|
1129
|
-
* while the swap call is still in flight.
|
|
1130
|
-
*/
|
|
725
|
+
/** Stops tracking the current swap; cancels nothing on-chain and is a no-op while the swap call is in flight. */
|
|
1131
726
|
reset: () => void;
|
|
1132
727
|
approvalStrategy: UseQueryResult<SwapApprovalStrategy, Error>;
|
|
1133
728
|
swap: SafeUseMutationResult<SwapWithApprovalResponse, Error, UseSwapWithApprovalVars<K>>;
|
|
1134
729
|
status: UseQueryResult<UseDetailedStatusResult>;
|
|
1135
730
|
stellar: StellarGate;
|
|
1136
731
|
nearStorage: NearStorageGate;
|
|
732
|
+
/** `blockedReason` names why an XRPL destination cannot receive when the state is `xrpBlocked`. */
|
|
733
|
+
xrp: XrpGate;
|
|
1137
734
|
};
|
|
1138
735
|
/**
|
|
1139
|
-
*
|
|
1140
|
-
*
|
|
1141
|
-
* signature on an EIP-5792 wallet) and its status (`useDetailedStatus`), as a single discriminated
|
|
1142
|
-
* `state` with one `next()` action. Render from `state.kind`; wire the button to `next()`.
|
|
1143
|
-
*
|
|
1144
|
-
* Headless and additive: the granular hooks are unchanged, and each one this composes is returned.
|
|
1145
|
-
* Wallet-layer concerns (chain switching, app-owned setup) are passed in, because dapp-kit does not
|
|
1146
|
-
* depend on the wallet packages.
|
|
736
|
+
* Composes approval, destination setup gates, chain switching, swap and status into one `state` plus a `next()` action.
|
|
737
|
+
* Wallet-layer concerns are passed in because dapp-kit does not depend on the wallet packages.
|
|
1147
738
|
*/
|
|
1148
739
|
declare function useSwapLifecycle<K extends SpokeChainKey = SpokeChainKey>({ intentParams, srcWalletProvider, dstWalletProvider, chainSwitch, externalBlocked, allowAccountUpgrade, extras, timeout, mutationOptions, }: UseSwapLifecycleParams<K>): SwapLifecycle<K>;
|
|
1149
740
|
|
|
@@ -1152,26 +743,12 @@ type CancelIntentParams<K extends SpokeChainKey = SpokeChainKey> = {
|
|
|
1152
743
|
walletProvider: GetWalletProviderType<K>;
|
|
1153
744
|
intent: Intent;
|
|
1154
745
|
};
|
|
1155
|
-
/**
|
|
1156
|
-
* React hook for cancelling an in-flight swap intent.
|
|
1157
|
-
*
|
|
1158
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
1159
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
1160
|
-
*/
|
|
746
|
+
/** Throws on SDK failure; resolves to the unwrapped `TxHashPair`. */
|
|
1161
747
|
declare function useCancelSwap({ mutationOptions, }?: MutationHookParams<TxHashPair, CancelIntentParams>): SafeUseMutationResult<TxHashPair, Error, CancelIntentParams>;
|
|
1162
748
|
|
|
1163
|
-
/**
|
|
1164
|
-
* Mutation variables for {@link useCreateLimitOrder}. Generic over `K extends SpokeChainKey`
|
|
1165
|
-
* (defaults to the full union). Sophisticated callers can lock K at the call site to narrow the
|
|
1166
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
1167
|
-
*/
|
|
749
|
+
/** Lock `K` at the call site to narrow `walletProvider` and `params.srcChainKey`. */
|
|
1168
750
|
type UseCreateLimitOrderVars<K extends SpokeChainKey = SpokeChainKey> = Omit<LimitOrderActionParams<K, false>, 'raw'>;
|
|
1169
|
-
/**
|
|
1170
|
-
* React hook for creating a limit-order intent (no deadline).
|
|
1171
|
-
*
|
|
1172
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
1173
|
-
* `onError`, `retry`). Returns the unwrapped `SwapResponse` on success.
|
|
1174
|
-
*/
|
|
751
|
+
/** Creates a limit order (no deadline). Throws on SDK failure; resolves to the unwrapped `SwapResponse`. */
|
|
1175
752
|
declare function useCreateLimitOrder<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<SwapResponse, UseCreateLimitOrderVars<K>>): SafeUseMutationResult<SwapResponse, Error, UseCreateLimitOrderVars<K>>;
|
|
1176
753
|
|
|
1177
754
|
type CancelLimitOrderParams<K extends SpokeChainKey = SpokeChainKey> = {
|
|
@@ -1180,38 +757,18 @@ type CancelLimitOrderParams<K extends SpokeChainKey = SpokeChainKey> = {
|
|
|
1180
757
|
intent: Intent;
|
|
1181
758
|
timeout?: number;
|
|
1182
759
|
};
|
|
1183
|
-
/**
|
|
1184
|
-
* React hook for cancelling a limit-order intent.
|
|
1185
|
-
*
|
|
1186
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
1187
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
1188
|
-
*/
|
|
760
|
+
/** Throws on SDK failure; resolves to the unwrapped `TxHashPair`. */
|
|
1189
761
|
declare function useCancelLimitOrder({ mutationOptions, }?: MutationHookParams<TxHashPair, CancelLimitOrderParams>): SafeUseMutationResult<TxHashPair, Error, CancelLimitOrderParams>;
|
|
1190
762
|
|
|
1191
763
|
type UseBackendIntentByTxHashParams = ReadHookParams<IntentResponse | undefined, {
|
|
1192
764
|
txHash: string | undefined;
|
|
1193
765
|
}>;
|
|
1194
|
-
/**
|
|
1195
|
-
* React hook for fetching intent details from the backend API using a transaction hash.
|
|
1196
|
-
*
|
|
1197
|
-
* @example
|
|
1198
|
-
* const { data: intent } = useBackendIntentByTxHash({ params: { txHash: '0x123...' } });
|
|
1199
|
-
*
|
|
1200
|
-
* @remarks
|
|
1201
|
-
* - Intents are only created on the hub chain, so `txHash` must originate from there.
|
|
1202
|
-
* - Default refetch interval is 1 second.
|
|
1203
|
-
*/
|
|
766
|
+
/** `txHash` must be a hub-chain tx: intents are only created there. */
|
|
1204
767
|
declare const useBackendIntentByTxHash: ({ params, queryOptions, }?: UseBackendIntentByTxHashParams) => UseQueryResult<IntentResponse | undefined, Error>;
|
|
1205
768
|
|
|
1206
769
|
type UseBackendIntentByHashParams = ReadHookParams<IntentResponse | undefined, {
|
|
1207
770
|
intentHash: string | undefined;
|
|
1208
771
|
}>;
|
|
1209
|
-
/**
|
|
1210
|
-
* React hook to fetch intent details from the backend API using an intent hash.
|
|
1211
|
-
*
|
|
1212
|
-
* @example
|
|
1213
|
-
* const { data: intent } = useBackendIntentByHash({ params: { intentHash: '0xabc...' } });
|
|
1214
|
-
*/
|
|
1215
772
|
declare const useBackendIntentByHash: ({ params, queryOptions, }?: UseBackendIntentByHashParams) => UseQueryResult<IntentResponse | undefined, Error>;
|
|
1216
773
|
|
|
1217
774
|
type UseBackendUserIntentsParams = ReadHookParams<UserIntentsResponse | undefined, {
|
|
@@ -1219,14 +776,6 @@ type UseBackendUserIntentsParams = ReadHookParams<UserIntentsResponse | undefine
|
|
|
1219
776
|
startDate?: number;
|
|
1220
777
|
endDate?: number;
|
|
1221
778
|
}>;
|
|
1222
|
-
/**
|
|
1223
|
-
* React hook for fetching user-created intents from the backend API for a given user address.
|
|
1224
|
-
*
|
|
1225
|
-
* @example
|
|
1226
|
-
* const { data: userIntents } = useBackendUserIntents({
|
|
1227
|
-
* params: { userAddress: '0x123...' },
|
|
1228
|
-
* });
|
|
1229
|
-
*/
|
|
1230
779
|
declare const useBackendUserIntents: ({ params, queryOptions, }?: UseBackendUserIntentsParams) => UseQueryResult<UserIntentsResponse | undefined, Error>;
|
|
1231
780
|
|
|
1232
781
|
type BackendPaginationParams = {
|
|
@@ -1237,96 +786,40 @@ type BackendPaginationParams = {
|
|
|
1237
786
|
type UseBackendOrderbookParams = ReadHookParams<OrderbookResponse, {
|
|
1238
787
|
pagination: BackendPaginationParams;
|
|
1239
788
|
}>;
|
|
1240
|
-
/**
|
|
1241
|
-
* Hook for fetching the solver orderbook from the backend API.
|
|
1242
|
-
*
|
|
1243
|
-
* @example
|
|
1244
|
-
* const { data } = useBackendOrderbook({ params: { pagination: { offset: '0', limit: '10' } } });
|
|
1245
|
-
*/
|
|
1246
789
|
declare const useBackendOrderbook: ({ params, queryOptions, }?: UseBackendOrderbookParams) => UseQueryResult<OrderbookResponse>;
|
|
1247
790
|
|
|
1248
791
|
type UseBackendMoneyMarketPositionParams = ReadHookParams<MoneyMarketPosition | undefined, {
|
|
1249
792
|
userAddress: string | undefined;
|
|
1250
793
|
}>;
|
|
1251
|
-
/**
|
|
1252
|
-
* React hook for fetching a user's money market position from the backend API.
|
|
1253
|
-
*
|
|
1254
|
-
* @example
|
|
1255
|
-
* const { data } = useBackendMoneyMarketPosition({ params: { userAddress: '0xabc...' } });
|
|
1256
|
-
*/
|
|
1257
794
|
declare const useBackendMoneyMarketPosition: ({ params, queryOptions, }?: UseBackendMoneyMarketPositionParams) => UseQueryResult<MoneyMarketPosition | undefined, Error>;
|
|
1258
795
|
|
|
1259
796
|
type UseBackendAllMoneyMarketAssetsParams = ReadHookParams<MoneyMarketAsset[]>;
|
|
1260
|
-
/**
|
|
1261
|
-
* React hook to fetch all money market assets from the backend API.
|
|
1262
|
-
*
|
|
1263
|
-
* @example
|
|
1264
|
-
* const { data: assets, isLoading, error } = useBackendAllMoneyMarketAssets();
|
|
1265
|
-
*/
|
|
1266
797
|
declare const useBackendAllMoneyMarketAssets: ({ queryOptions, }?: UseBackendAllMoneyMarketAssetsParams) => UseQueryResult<MoneyMarketAsset[], Error>;
|
|
1267
798
|
|
|
1268
799
|
type UseBackendMoneyMarketAssetParams = ReadHookParams<MoneyMarketAsset | undefined, {
|
|
1269
800
|
reserveAddress: string | undefined;
|
|
1270
801
|
}>;
|
|
1271
|
-
/**
|
|
1272
|
-
* React hook to fetch a specific money market asset from the backend API.
|
|
1273
|
-
*
|
|
1274
|
-
* @example
|
|
1275
|
-
* const { data: asset } = useBackendMoneyMarketAsset({ params: { reserveAddress: '0xabc...' } });
|
|
1276
|
-
*/
|
|
1277
802
|
declare const useBackendMoneyMarketAsset: ({ params, queryOptions, }?: UseBackendMoneyMarketAssetParams) => UseQueryResult<MoneyMarketAsset | undefined, Error>;
|
|
1278
803
|
|
|
1279
804
|
type UseBackendMoneyMarketAssetBorrowersParams = ReadHookParams<MoneyMarketAssetBorrowers | undefined, {
|
|
1280
805
|
reserveAddress: string | undefined;
|
|
1281
806
|
pagination: BackendPaginationParams;
|
|
1282
807
|
}>;
|
|
1283
|
-
/**
|
|
1284
|
-
* React hook for fetching borrowers for a specific money market asset from the backend API with pagination.
|
|
1285
|
-
*
|
|
1286
|
-
* @example
|
|
1287
|
-
* const { data: borrowers } = useBackendMoneyMarketAssetBorrowers({
|
|
1288
|
-
* params: { reserveAddress: '0xabc...', pagination: { offset: '0', limit: '20' } },
|
|
1289
|
-
* });
|
|
1290
|
-
*/
|
|
1291
808
|
declare const useBackendMoneyMarketAssetBorrowers: ({ params, queryOptions, }?: UseBackendMoneyMarketAssetBorrowersParams) => UseQueryResult<MoneyMarketAssetBorrowers | undefined, Error>;
|
|
1292
809
|
|
|
1293
810
|
type UseBackendMoneyMarketAssetSuppliersParams = ReadHookParams<MoneyMarketAssetSuppliers | undefined, {
|
|
1294
811
|
reserveAddress: string | undefined;
|
|
1295
812
|
pagination: BackendPaginationParams;
|
|
1296
813
|
}>;
|
|
1297
|
-
/**
|
|
1298
|
-
* React hook for fetching suppliers for a specific money market asset from the backend API.
|
|
1299
|
-
*
|
|
1300
|
-
* @example
|
|
1301
|
-
* const { data: suppliers } = useBackendMoneyMarketAssetSuppliers({
|
|
1302
|
-
* params: { reserveAddress: '0xabc...', pagination: { offset: '0', limit: '20' } },
|
|
1303
|
-
* });
|
|
1304
|
-
*/
|
|
1305
814
|
declare const useBackendMoneyMarketAssetSuppliers: ({ params, queryOptions, }?: UseBackendMoneyMarketAssetSuppliersParams) => UseQueryResult<MoneyMarketAssetSuppliers | undefined, Error>;
|
|
1306
815
|
|
|
1307
816
|
type UseBackendAllMoneyMarketBorrowersParams = ReadHookParams<MoneyMarketBorrowers | undefined, {
|
|
1308
817
|
pagination: BackendPaginationParams;
|
|
1309
818
|
}>;
|
|
1310
|
-
/**
|
|
1311
|
-
* Hook for fetching all money market borrowers from the backend API.
|
|
1312
|
-
*
|
|
1313
|
-
* @example
|
|
1314
|
-
* ```typescript
|
|
1315
|
-
* const { data, isLoading, error } = useBackendAllMoneyMarketBorrowers({
|
|
1316
|
-
* params: { pagination: { offset: '0', limit: '50' } },
|
|
1317
|
-
* });
|
|
1318
|
-
* ```
|
|
1319
|
-
*/
|
|
1320
819
|
declare const useBackendAllMoneyMarketBorrowers: ({ params, queryOptions, }?: UseBackendAllMoneyMarketBorrowersParams) => UseQueryResult<MoneyMarketBorrowers | undefined>;
|
|
1321
820
|
|
|
1322
821
|
type UseBackendOracleMarketsParams = ReadHookParams<OracleMarketsResponse>;
|
|
1323
|
-
/**
|
|
1324
|
-
* Hook for fetching the oracle candle store's discovery payload (quote currency,
|
|
1325
|
-
* selectable intervals, and covered symbols) from the backend API.
|
|
1326
|
-
*
|
|
1327
|
-
* @example
|
|
1328
|
-
* const { data: markets } = useBackendOracleMarkets();
|
|
1329
|
-
*/
|
|
822
|
+
/** Oracle discovery payload: quote currency, selectable intervals and covered symbols. */
|
|
1330
823
|
declare const useBackendOracleMarkets: ({ queryOptions, }?: UseBackendOracleMarketsParams) => UseQueryResult<OracleMarketsResponse, Error>;
|
|
1331
824
|
|
|
1332
825
|
type UseBackendOracleCandlesParams = ReadHookParams<OracleCandlesResponse, {
|
|
@@ -1337,40 +830,18 @@ type UseBackendOracleCandlesParams = ReadHookParams<OracleCandlesResponse, {
|
|
|
1337
830
|
/** Range end, UNIX seconds, exclusive; the range may cover at most 5000 buckets. */
|
|
1338
831
|
to: number;
|
|
1339
832
|
}>;
|
|
1340
|
-
/**
|
|
1341
|
-
* Hook for fetching USD OHLC candles for a symbol over the half-open range `[from, to)`
|
|
1342
|
-
* from the backend API. Responses are cached server-side for roughly 10 seconds.
|
|
1343
|
-
*
|
|
1344
|
-
* @example
|
|
1345
|
-
* const { data } = useBackendOracleCandles({
|
|
1346
|
-
* params: { symbol: 'ETH', interval: '1h', from: 1756000000, to: 1756360000 },
|
|
1347
|
-
* });
|
|
1348
|
-
*/
|
|
833
|
+
/** USD OHLC candles over the half-open range `[from, to)`; responses are cached server-side for ~10s. */
|
|
1349
834
|
declare const useBackendOracleCandles: ({ params, queryOptions, }?: UseBackendOracleCandlesParams) => UseQueryResult<OracleCandlesResponse, Error>;
|
|
1350
835
|
|
|
1351
836
|
type UseSwapsApiTokensParams = ReadHookParams<GetSwapTokensResponseV2, {
|
|
1352
837
|
apiConfig?: RequestOverrideConfig;
|
|
1353
838
|
}>;
|
|
1354
|
-
/**
|
|
1355
|
-
* React hook to fetch all supported swap tokens grouped by SpokeChainKey via the swaps API —
|
|
1356
|
-
* `sodax.api.swaps.getTokens`.
|
|
1357
|
-
*
|
|
1358
|
-
* @example
|
|
1359
|
-
* const { data: tokensByChain } = useSwapsApiTokens();
|
|
1360
|
-
*/
|
|
1361
839
|
declare const useSwapsApiTokens: ({ params, queryOptions, }?: UseSwapsApiTokensParams) => UseQueryResult<GetSwapTokensResponseV2, Error>;
|
|
1362
840
|
|
|
1363
841
|
type UseSwapsApiTokensByChainParams = ReadHookParams<GetSwapTokensByChainResponseV2 | undefined, {
|
|
1364
842
|
chainKey: string | undefined;
|
|
1365
843
|
apiConfig?: RequestOverrideConfig;
|
|
1366
844
|
}>;
|
|
1367
|
-
/**
|
|
1368
|
-
* React hook to fetch supported swap tokens for a single SpokeChainKey via the swaps API —
|
|
1369
|
-
* `sodax.api.swaps.getTokensByChain`.
|
|
1370
|
-
*
|
|
1371
|
-
* @example
|
|
1372
|
-
* const { data: tokens } = useSwapsApiTokensByChain({ params: { chainKey: '0xa4b1.arbitrum' } });
|
|
1373
|
-
*/
|
|
1374
845
|
declare const useSwapsApiTokensByChain: ({ params, queryOptions, }?: UseSwapsApiTokensByChainParams) => UseQueryResult<GetSwapTokensByChainResponseV2 | undefined, Error>;
|
|
1375
846
|
|
|
1376
847
|
type UseSwapsApiQuoteParams = ReadHookParams<QuoteResponseV2 | undefined, {
|
|
@@ -1378,72 +849,27 @@ type UseSwapsApiQuoteParams = ReadHookParams<QuoteResponseV2 | undefined, {
|
|
|
1378
849
|
query?: QuoteQueryV2;
|
|
1379
850
|
apiConfig?: RequestOverrideConfig;
|
|
1380
851
|
}>;
|
|
1381
|
-
/**
|
|
1382
|
-
* React hook to get a solver quote for a cross-chain swap via the swaps API —
|
|
1383
|
-
* `sodax.api.swaps.getQuote`. Pass `query.includeTxData = true` to also build an unsigned
|
|
1384
|
-
* create-intent transaction (`txData`); `srcAddress`/`dstAddress` are then required in the body.
|
|
1385
|
-
*
|
|
1386
|
-
* @example
|
|
1387
|
-
* const { data: quote } = useSwapsApiQuote({
|
|
1388
|
-
* params: {
|
|
1389
|
-
* body: {
|
|
1390
|
-
* tokenSrc: '0x...', tokenSrcChainKey: '0xa4b1.arbitrum',
|
|
1391
|
-
* tokenDst: '0x...', tokenDstChainKey: 'sonic',
|
|
1392
|
-
* amount: '1000000', quoteType: 'exact_input',
|
|
1393
|
-
* partnerFee: { address: '0xSonicFeeReceiver', percentage: 10 },
|
|
1394
|
-
* },
|
|
1395
|
-
* // Optional per-request override of the configured backend API key (`x-api-key`);
|
|
1396
|
-
* // usually set once instead via new Sodax({ apiKey }).
|
|
1397
|
-
* apiConfig: { apiKey: 'partner-api-key' },
|
|
1398
|
-
* },
|
|
1399
|
-
* });
|
|
1400
|
-
*/
|
|
852
|
+
/** `query.includeTxData` also builds the unsigned create-intent tx; `srcAddress`/`dstAddress` are then required. */
|
|
1401
853
|
declare const useSwapsApiQuote: ({ params, queryOptions, }?: UseSwapsApiQuoteParams) => UseQueryResult<QuoteResponseV2 | undefined, Error>;
|
|
1402
854
|
|
|
1403
855
|
type UseSwapsApiDeadlineParams = ReadHookParams<DeadlineResponseV2, {
|
|
1404
856
|
query?: DeadlineQueryV2;
|
|
1405
857
|
apiConfig?: RequestOverrideConfig;
|
|
1406
858
|
}>;
|
|
1407
|
-
/**
|
|
1408
|
-
* React hook to compute a swap deadline (hub timestamp + `offsetSeconds`, default 300s) via the
|
|
1409
|
-
* swaps API — `sodax.api.swaps.getDeadline`.
|
|
1410
|
-
*
|
|
1411
|
-
* @example
|
|
1412
|
-
* const { data: deadline } = useSwapsApiDeadline({ params: { query: { offsetSeconds: 600 } } });
|
|
1413
|
-
*/
|
|
859
|
+
/** Hub timestamp + `offsetSeconds` (default 300s). */
|
|
1414
860
|
declare const useSwapsApiDeadline: ({ params, queryOptions, }?: UseSwapsApiDeadlineParams) => UseQueryResult<DeadlineResponseV2, Error>;
|
|
1415
861
|
|
|
1416
862
|
type UseSwapsApiAllowanceParams = ReadHookParams<AllowanceCheckResponseV2 | undefined, {
|
|
1417
863
|
body: CreateIntentParamsV2 | undefined;
|
|
1418
864
|
apiConfig?: RequestOverrideConfig;
|
|
1419
865
|
}>;
|
|
1420
|
-
/**
|
|
1421
|
-
* React hook to check whether the source-token allowance is already sufficient for an intent via
|
|
1422
|
-
* the swaps API — `sodax.api.swaps.checkAllowance`. Returns `{ valid }`.
|
|
1423
|
-
*
|
|
1424
|
-
* @example
|
|
1425
|
-
* const { data: allowance } = useSwapsApiAllowance({ params: { body: createIntentParams } });
|
|
1426
|
-
*/
|
|
1427
866
|
declare const useSwapsApiAllowance: ({ params, queryOptions, }?: UseSwapsApiAllowanceParams) => UseQueryResult<AllowanceCheckResponseV2 | undefined, Error>;
|
|
1428
867
|
|
|
1429
|
-
/**
|
|
1430
|
-
* Mutation variables for {@link useSwapsApiApprove}. The per-request `apiConfig` override belongs
|
|
1431
|
-
* here rather than at the hook level — different calls in the same component can target different
|
|
1432
|
-
* endpoints without re-rendering.
|
|
1433
|
-
*/
|
|
1434
868
|
type UseSwapsApiApproveVars = {
|
|
1435
869
|
body: CreateIntentParamsV2;
|
|
1436
870
|
apiConfig?: RequestOverrideConfig;
|
|
1437
871
|
};
|
|
1438
|
-
/**
|
|
1439
|
-
* React hook to build an unsigned token-approval transaction for the source token via the swaps
|
|
1440
|
-
* API — `sodax.api.swaps.approve`. Returns `{ tx }` (chain-specific unsigned tx) to sign and
|
|
1441
|
-
* broadcast yourself; it does not change state, so no queries are invalidated.
|
|
1442
|
-
*
|
|
1443
|
-
* @example
|
|
1444
|
-
* const { mutateAsync: approve } = useSwapsApiApprove();
|
|
1445
|
-
* const { tx } = await approve({ body: createIntentParams });
|
|
1446
|
-
*/
|
|
872
|
+
/** Builds the unsigned approval tx(s) only; {@link useSwapsApiApproveAndBroadcast} also signs, orders and waits. */
|
|
1447
873
|
declare const useSwapsApiApprove: ({ mutationOptions, }?: MutationHookParams<ApproveResponseV2, UseSwapsApiApproveVars>) => SafeUseMutationResult<ApproveResponseV2, Error, UseSwapsApiApproveVars>;
|
|
1448
874
|
|
|
1449
875
|
/** Hashes of the transactions an approval plan broadcast, in the order they were sent. */
|
|
@@ -1472,17 +898,8 @@ type ApprovalProgress = {
|
|
|
1472
898
|
readonly error?: unknown;
|
|
1473
899
|
};
|
|
1474
900
|
type ApprovalProgressListener = (progress: ApprovalProgress) => void;
|
|
1475
|
-
/**
|
|
1476
|
-
*
|
|
1477
|
-
* approve, which is not a valid state transition until the allowance has been zeroed on-chain.
|
|
1478
|
-
*
|
|
1479
|
-
* Not a pure helper like its neighbours here — it signs and sends through the caller's wallet
|
|
1480
|
-
* provider — but it is framework-free, and shared by the swaps and bridge approve-and-broadcast
|
|
1481
|
-
* hooks so the ordering is not re-derived per feature. `hookName` prefixes the errors.
|
|
1482
|
-
*
|
|
1483
|
-
* `onProgress` reports which transaction the user is being prompted for — `isPending` alone cannot
|
|
1484
|
-
* say whether a popup is the reset or the approve.
|
|
1485
|
-
*/
|
|
901
|
+
/** Broadcasts `resetTx` and waits for it to be mined before the approve, which is invalid until the allowance is zeroed.
|
|
902
|
+
* `hookName` prefixes errors; `onProgress` says which tx the wallet is prompting for. */
|
|
1486
903
|
declare function runApprovalPlan({ plan, srcChainKey, walletProvider, hookName, onProgress, }: {
|
|
1487
904
|
plan: ApprovalPlan;
|
|
1488
905
|
srcChainKey: SpokeChainKey;
|
|
@@ -1501,30 +918,9 @@ type UseSwapsApiApproveAndBroadcastVars<K extends SpokeChainKey = SpokeChainKey>
|
|
|
1501
918
|
onProgress?: ApprovalProgressListener;
|
|
1502
919
|
};
|
|
1503
920
|
/**
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
*
|
|
1507
|
-
* Prefer this over {@link useSwapsApiApprove}, which returns the unsigned `{ tx, resetTx? }` and
|
|
1508
|
-
* leaves the rest to you. A source token of the 2017 TetherToken lineage rejects an allowance change
|
|
1509
|
-
* from one non-zero value to another, so the API can hand back a **reset** transaction that must be
|
|
1510
|
-
* mined **before** the approve is even a valid state transition. Broadcasting them out of order, or
|
|
1511
|
-
* without waiting, spends the user's gas on a transaction that is certain to revert — and that is
|
|
1512
|
-
* ordering the package should own rather than every integration re-deriving it.
|
|
1513
|
-
*
|
|
1514
|
-
* Because confirmation now happens inside the hook, it can invalidate `['swapsApi','allowance']`
|
|
1515
|
-
* itself; callers of `useSwapsApiApprove` have to refetch by hand. It first waits up to about 15 seconds
|
|
1516
|
-
* for the API to report the allowance as valid, since its RPC can trail the node that confirmed the
|
|
1517
|
-
* approve. It resolves after that wait either way, so read the allowance rather than treating success as
|
|
1518
|
-
* `valid`.
|
|
1519
|
-
*
|
|
1520
|
-
* Supports the chains the swaps API can approve on — the hub (Sonic), EVM spokes, and Stellar.
|
|
1521
|
-
* Every other chain reports its allowance as always sufficient, so approval never runs for it.
|
|
1522
|
-
*
|
|
1523
|
-
* @example
|
|
1524
|
-
* const { mutateAsyncSafe: approve } = useSwapsApiApproveAndBroadcast();
|
|
1525
|
-
* const result = await approve({ body: createIntentParams, walletProvider });
|
|
1526
|
-
* if (!result.ok) return;
|
|
1527
|
-
* const { resetTxHash, approveTxHash } = result.value; // resetTxHash only on a guarded token
|
|
921
|
+
* Signs and mines each approval tx in order: a USDT-style `resetTx` must mine before the approve.
|
|
922
|
+
* Then waits up to ~15s for the API to report the allowance valid, but resolves either way.
|
|
923
|
+
* Approval runs only on the hub, EVM spokes and Stellar; other chains report the allowance as always sufficient.
|
|
1528
924
|
*/
|
|
1529
925
|
declare const useSwapsApiApproveAndBroadcast: <K extends SpokeChainKey = "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera" | "tron" | "robinhood" | "xrp" | "monad" | "ton" | "zcash" | "cardano">({ mutationOptions, }?: MutationHookParams<SwapsApiApprovalHashes, UseSwapsApiApproveAndBroadcastVars<K>>) => SafeUseMutationResult<SwapsApiApprovalHashes, Error, UseSwapsApiApproveAndBroadcastVars<K>>;
|
|
1530
926
|
|
|
@@ -1537,18 +933,11 @@ type UseSwapsApiBroadcastWithApprovalVars = ApprovalOptions & {
|
|
|
1537
933
|
apiConfig?: RequestOverrideConfig;
|
|
1538
934
|
/** Progress of a separate approval, hashes included. A batch is one prompt and reports nothing. */
|
|
1539
935
|
onProgress?: ApprovalProgressListener;
|
|
1540
|
-
/**
|
|
1541
|
-
* Called with the batch id and its call count once the wallet accepts the batch, before the wait.
|
|
1542
|
-
* Persist both: if the batch comes back unconfirmed, `confirmApprovalBatch` with them is how to find
|
|
1543
|
-
* the deposit again instead of sending a second one.
|
|
1544
|
-
*/
|
|
936
|
+
/** Fires once the wallet accepts the batch; persist both so `confirmApprovalBatch` can resume an unconfirmed one. */
|
|
1545
937
|
onBatchSent?: (batchId: string, callCount: number) => void;
|
|
1546
938
|
/**
|
|
1547
|
-
*
|
|
1548
|
-
*
|
|
1549
|
-
* sends nothing: approve with `useSwapsApiApproveAndBroadcast`, then create the intent again and sign
|
|
1550
|
-
* that one. `true` approves and then sends this `intentTx` instead — built before the approval, so its
|
|
1551
|
-
* deadline and quote must outlast the approval's wait.
|
|
939
|
+
* On refusal or no batch support: approve, then send this `intentTx` (default: reject, send nothing).
|
|
940
|
+
* `intentTx` predates the approval, so its deadline and quote must outlast the approval wait.
|
|
1552
941
|
*/
|
|
1553
942
|
fallbackOnRefusal?: boolean;
|
|
1554
943
|
};
|
|
@@ -1560,278 +949,103 @@ type SwapsApiBroadcastWithApprovalResult = {
|
|
|
1560
949
|
approval?: ApprovalHashes;
|
|
1561
950
|
};
|
|
1562
951
|
/**
|
|
1563
|
-
*
|
|
1564
|
-
*
|
|
1565
|
-
*
|
|
1566
|
-
*
|
|
1567
|
-
* Call it when `/swaps/allowance/check` says the allowance is short and the source is an EVM chain —
|
|
1568
|
-
* it always approves, so with enough allowance sign `intentTx` directly instead. It stops at the
|
|
1569
|
-
* broadcast: persist `txHash` and then call `/swaps/submit-tx` as before.
|
|
1570
|
-
*
|
|
1571
|
-
* The batch rules match the SDK's `swapWithApproval`; the Sonic hub never batches. With no batch to
|
|
1572
|
-
* send — the wallet cannot batch, or refuses the batch before signing — it rejects with a refusal
|
|
1573
|
-
* (`isAtomicBatchRefusal`) and sends nothing: approve with `useSwapsApiApproveAndBroadcast`, create
|
|
1574
|
-
* the intent again and sign that. `fallbackOnRefusal: true` approves (via {@link runApprovalPlan}) and
|
|
1575
|
-
* sends this `intentTx` instead. A batch the user saw is never resent:
|
|
1576
|
-
* - rejected → `SodaxError` `USER_REJECTED`, with `context.reason: ACCOUNT_UPGRADE_DECLINED` when the
|
|
1577
|
-
* user declined the account upgrade — retry with `allowAccountUpgrade: false`;
|
|
1578
|
-
* - never included or fully reverted → `INTENT_CREATION_FAILED`, `context.reason: 'atomic-batch-failed'`;
|
|
1579
|
-
* - sent but not confirmed → `TX_VERIFICATION_FAILED`, `context.reason: ATOMIC_BATCH_UNCONFIRMED`. It
|
|
1580
|
-
* may still land: do not let the user swap again. Resume it with `confirmApprovalBatch` and the
|
|
1581
|
-
* batch id `onBatchSent` reported.
|
|
1582
|
-
*
|
|
1583
|
-
* With `fallbackOnRefusal: true`, errors from the separate approval or intent send are the wallet's
|
|
1584
|
-
* own, as with `useSwapsApiApproveAndBroadcast`.
|
|
1585
|
-
*
|
|
1586
|
-
* @example
|
|
1587
|
-
* const { mutateAsyncSafe: broadcast } = useSwapsApiBroadcastWithApproval();
|
|
1588
|
-
* const created = await sodax.api.swaps.createIntent(body);
|
|
1589
|
-
* const result = await broadcast({ body, intentTx: created.value.tx as EvmRawTransaction, walletProvider });
|
|
1590
|
-
* if (result.ok) await submitTx({ txHash: result.value.txHash, ... });
|
|
1591
|
-
* else if (isAtomicBatchRefusal(result.error)) {
|
|
1592
|
-
* // Nothing was sent: approve, create the intent again (fresh deadline), sign it, then submit-tx.
|
|
1593
|
-
* }
|
|
952
|
+
* Sends the approval and EVM `intentTx` as one EIP-5792 batch; a batch the user saw is never resent.
|
|
953
|
+
* Unconfirmed batch → `TX_VERIFICATION_FAILED` (may still land: resume via `confirmApprovalBatch`, never re-swap).
|
|
954
|
+
* Rejected → `USER_REJECTED` (`ACCOUNT_UPGRADE_DECLINED`: retry with `allowAccountUpgrade: false`); reverted → `INTENT_CREATION_FAILED`.
|
|
1594
955
|
*/
|
|
1595
956
|
declare const useSwapsApiBroadcastWithApproval: ({ mutationOptions, }?: MutationHookParams<SwapsApiBroadcastWithApprovalResult, UseSwapsApiBroadcastWithApprovalVars>) => SafeUseMutationResult<SwapsApiBroadcastWithApprovalResult, Error, UseSwapsApiBroadcastWithApprovalVars>;
|
|
1596
957
|
|
|
1597
|
-
/**
|
|
1598
|
-
* Mutation variables for {@link useSwapsApiCreateIntent}. The per-request `apiConfig` override
|
|
1599
|
-
* belongs here rather than at the hook level.
|
|
1600
|
-
*/
|
|
1601
958
|
type UseSwapsApiCreateIntentVars = {
|
|
1602
959
|
body: CreateIntentParamsV2;
|
|
1603
960
|
apiConfig?: RequestOverrideConfig;
|
|
1604
961
|
};
|
|
1605
|
-
/**
|
|
1606
|
-
* React hook to build an unsigned create-intent transaction via the swaps API —
|
|
1607
|
-
* `sodax.api.swaps.createIntent`. Returns `{ tx, intent, relayData }` to sign and broadcast
|
|
1608
|
-
* yourself; it does not change state, so no queries are invalidated.
|
|
1609
|
-
*
|
|
1610
|
-
* @example
|
|
1611
|
-
* const { mutateAsync: createIntent } = useSwapsApiCreateIntent();
|
|
1612
|
-
* const { tx, intent, relayData } = await createIntent({ body: createIntentParams });
|
|
1613
|
-
*/
|
|
1614
962
|
declare const useSwapsApiCreateIntent: ({ mutationOptions, }?: MutationHookParams<CreateIntentResponseV2, UseSwapsApiCreateIntentVars>) => SafeUseMutationResult<CreateIntentResponseV2, Error, UseSwapsApiCreateIntentVars>;
|
|
1615
963
|
|
|
1616
|
-
/**
|
|
1617
|
-
* Mutation variables for {@link useSwapsApiSubmitIntent}. The per-request `apiConfig` override
|
|
1618
|
-
* belongs here rather than at the hook level.
|
|
1619
|
-
*/
|
|
1620
964
|
type UseSwapsApiSubmitIntentVars = {
|
|
1621
965
|
body: SubmitIntentRequestV2;
|
|
1622
966
|
apiConfig?: RequestOverrideConfig;
|
|
1623
967
|
};
|
|
1624
|
-
/**
|
|
1625
|
-
* React hook to submit the broadcast intent tx to the relay via the swaps API —
|
|
1626
|
-
* `sodax.api.swaps.submitIntent`. Returns `{ result }` (opaque relay response).
|
|
1627
|
-
*
|
|
1628
|
-
* No auto-retry (`retry: false`): submitting is non-idempotent — a retry after a lost response
|
|
1629
|
-
* could double-submit to the relay. Override via `mutationOptions.retry` if your relay dedupes.
|
|
1630
|
-
*
|
|
1631
|
-
* @example
|
|
1632
|
-
* const { mutateAsync: submitIntent } = useSwapsApiSubmitIntent();
|
|
1633
|
-
* const { result } = await submitIntent({ body: { chainId: '146', txHash: '0x123...' } });
|
|
1634
|
-
*/
|
|
968
|
+
/** No auto-retry: submit is non-idempotent, so a retry after a lost response could double-submit. */
|
|
1635
969
|
declare const useSwapsApiSubmitIntent: ({ mutationOptions, }?: MutationHookParams<SubmitIntentResponseV2, UseSwapsApiSubmitIntentVars>) => SafeUseMutationResult<SubmitIntentResponseV2, Error, UseSwapsApiSubmitIntentVars>;
|
|
1636
970
|
|
|
1637
971
|
type UseSwapsApiStatusParams = ReadHookParams<StatusResponseV2 | undefined, {
|
|
1638
972
|
intentTxHash: string | undefined;
|
|
1639
973
|
apiConfig?: RequestOverrideConfig;
|
|
1640
974
|
}>;
|
|
1641
|
-
/**
|
|
1642
|
-
* React hook for polling the solver intent status by hub-chain intent tx hash via the swaps API —
|
|
1643
|
-
* `sodax.api.swaps.getStatus`. Returns `{ status, fillTxHash? }` (`fillTxHash` set when `status === 3`).
|
|
1644
|
-
*
|
|
1645
|
-
* @example
|
|
1646
|
-
* const { data } = useSwapsApiStatus({ params: { intentTxHash: '0x123...' } });
|
|
1647
|
-
*
|
|
1648
|
-
* @remarks
|
|
1649
|
-
* - Default refetch interval is 1 second; stops once `status` is `3` (SOLVED) or `4` (FAILED), or
|
|
1650
|
-
* once the backend rejects the API key (401/403 is terminal — a retry cannot fix it).
|
|
1651
|
-
*/
|
|
975
|
+
/** Polls every 1s until SOLVED (3), FAILED (4) or an API-key rejection (401/403). */
|
|
1652
976
|
declare const useSwapsApiStatus: ({ params, queryOptions, }?: UseSwapsApiStatusParams) => UseQueryResult<StatusResponseV2 | undefined, Error>;
|
|
1653
977
|
|
|
1654
|
-
/**
|
|
1655
|
-
* Terminal solver intent states: once reached, the intent is resolved and polling stops.
|
|
1656
|
-
* `3` = SOLVED, `4` = FAILED (per `SwapIntentStatusCodeV2`); `-1` / `1` / `2` are non-terminal.
|
|
1657
|
-
*
|
|
1658
|
-
* Kept in its own pure module (no React/context imports) so it is unit-testable in dapp-kit's
|
|
1659
|
-
* `node` test environment — importing the hook itself pulls in `useSodaxContext`.
|
|
1660
|
-
*/
|
|
978
|
+
/** SOLVED (3) / FAILED (4): polling stops. Kept React-free so it unit-tests in the `node` env. */
|
|
1661
979
|
declare const isTerminalSwapIntentStatus: (status: SwapIntentStatusCodeV2 | undefined) => boolean;
|
|
1662
980
|
|
|
1663
|
-
/**
|
|
1664
|
-
* Mutation variables for {@link useSwapsApiCancelIntent}. The per-request `apiConfig` override
|
|
1665
|
-
* belongs here rather than at the hook level.
|
|
1666
|
-
*/
|
|
1667
981
|
type UseSwapsApiCancelIntentVars = {
|
|
1668
982
|
body: CancelIntentRequestV2;
|
|
1669
983
|
apiConfig?: RequestOverrideConfig;
|
|
1670
984
|
};
|
|
1671
|
-
/**
|
|
1672
|
-
* React hook to build an unsigned cancel-intent transaction via the swaps API —
|
|
1673
|
-
* `sodax.api.swaps.cancelIntent`. The `intent` carries `bigint` numerics. Returns `{ tx }` to sign
|
|
1674
|
-
* and broadcast yourself; it does not change state, so no queries are invalidated.
|
|
1675
|
-
*
|
|
1676
|
-
* @example
|
|
1677
|
-
* const { mutateAsync: cancelIntent } = useSwapsApiCancelIntent();
|
|
1678
|
-
* const { tx } = await cancelIntent({ body: { srcChainKey: 'sonic', intent } });
|
|
1679
|
-
*/
|
|
1680
985
|
declare const useSwapsApiCancelIntent: ({ mutationOptions, }?: MutationHookParams<CancelIntentResponseV2, UseSwapsApiCancelIntentVars>) => SafeUseMutationResult<CancelIntentResponseV2, Error, UseSwapsApiCancelIntentVars>;
|
|
1681
986
|
|
|
1682
987
|
type UseSwapsApiIntentHashParams = ReadHookParams<IntentHashResponseV2 | undefined, {
|
|
1683
988
|
intent: IntentRequestV2 | undefined;
|
|
1684
989
|
apiConfig?: RequestOverrideConfig;
|
|
1685
990
|
}>;
|
|
1686
|
-
/**
|
|
1687
|
-
* React hook to compute the keccak256 hash of an Intent struct via the swaps API —
|
|
1688
|
-
* `sodax.api.swaps.getIntentHash`. The `intent` carries `bigint` numerics. Returns `{ hash }`.
|
|
1689
|
-
*
|
|
1690
|
-
* @example
|
|
1691
|
-
* const { data } = useSwapsApiIntentHash({ params: { intent } });
|
|
1692
|
-
*/
|
|
1693
991
|
declare const useSwapsApiIntentHash: ({ params, queryOptions, }?: UseSwapsApiIntentHashParams) => UseQueryResult<IntentHashResponseV2 | undefined, Error>;
|
|
1694
992
|
|
|
1695
993
|
type UseSwapsApiIntentPacketParams = ReadHookParams<IntentPacketResponseV2 | undefined, {
|
|
1696
994
|
body: IntentPacketRequestV2 | undefined;
|
|
1697
995
|
apiConfig?: RequestOverrideConfig;
|
|
1698
996
|
}>;
|
|
1699
|
-
/**
|
|
1700
|
-
* React hook to long-poll the relayer until the fill packet lands on the destination chain via the
|
|
1701
|
-
* swaps API — `sodax.api.swaps.getSolvedIntentPacket`. The request is held open server-side until
|
|
1702
|
-
* the packet arrives (or `body.timeout` ms elapses), so no client-side `refetchInterval` is set.
|
|
1703
|
-
*
|
|
1704
|
-
* @example
|
|
1705
|
-
* const { data: packet } = useSwapsApiIntentPacket({
|
|
1706
|
-
* params: { body: { chainId: '146', fillTxHash: '0x123...' } },
|
|
1707
|
-
* });
|
|
1708
|
-
*/
|
|
997
|
+
/** Long-polls server-side until the packet lands (or `body.timeout` ms), so no `refetchInterval` is set. */
|
|
1709
998
|
declare const useSwapsApiIntentPacket: ({ params, queryOptions, }?: UseSwapsApiIntentPacketParams) => UseQueryResult<IntentPacketResponseV2 | undefined, Error>;
|
|
1710
999
|
|
|
1711
1000
|
type UseSwapsApiIntentExtraDataParams = ReadHookParams<IntentExtraDataResponseV2 | undefined, {
|
|
1712
1001
|
body: IntentExtraDataRequestV2 | undefined;
|
|
1713
1002
|
apiConfig?: RequestOverrideConfig;
|
|
1714
1003
|
}>;
|
|
1715
|
-
/**
|
|
1716
|
-
* React hook to recover the relay extra data needed by `/swaps/intents/submit` via the swaps API —
|
|
1717
|
-
* `sodax.api.swaps.getIntentSubmitTxExtraData`. Provide EITHER `txHash` OR `intent` in the body
|
|
1718
|
-
* (whose `bigint` numerics are serialized by the SDK). Returns `{ address, payload }`.
|
|
1719
|
-
*
|
|
1720
|
-
* @example
|
|
1721
|
-
* const { data } = useSwapsApiIntentExtraData({ params: { body: { txHash: '0x123...' } } });
|
|
1722
|
-
*/
|
|
1004
|
+
/** Pass either `txHash` or `intent` in the body. */
|
|
1723
1005
|
declare const useSwapsApiIntentExtraData: ({ params, queryOptions, }?: UseSwapsApiIntentExtraDataParams) => UseQueryResult<IntentExtraDataResponseV2 | undefined, Error>;
|
|
1724
1006
|
|
|
1725
1007
|
type UseSwapsApiFilledIntentParams = ReadHookParams<IntentStateV2 | undefined, {
|
|
1726
1008
|
txHash: string | undefined;
|
|
1727
1009
|
apiConfig?: RequestOverrideConfig;
|
|
1728
1010
|
}>;
|
|
1729
|
-
/**
|
|
1730
|
-
* React hook to get the on-chain fill state for an intent by its hub-chain tx hash via the swaps
|
|
1731
|
-
* API — `sodax.api.swaps.getFilledIntent`. Returns
|
|
1732
|
-
* `{ exists, remainingInput, receivedOutput, pendingPayment }`.
|
|
1733
|
-
*
|
|
1734
|
-
* @example
|
|
1735
|
-
* const { data: fill } = useSwapsApiFilledIntent({ params: { txHash: '0x123...' } });
|
|
1736
|
-
*/
|
|
1737
1011
|
declare const useSwapsApiFilledIntent: ({ params, queryOptions, }?: UseSwapsApiFilledIntentParams) => UseQueryResult<IntentStateV2 | undefined, Error>;
|
|
1738
1012
|
|
|
1739
1013
|
type UseSwapsApiIntentParams = ReadHookParams<GetIntentResponseV2 | undefined, {
|
|
1740
1014
|
txHash: string | undefined;
|
|
1741
1015
|
apiConfig?: RequestOverrideConfig;
|
|
1742
1016
|
}>;
|
|
1743
|
-
/**
|
|
1744
|
-
* React hook to look up an Intent struct by its hub-chain creation tx hash via the swaps API —
|
|
1745
|
-
* `sodax.api.swaps.getIntent`. The decoded intent's bigint fields are returned as decimal strings.
|
|
1746
|
-
*
|
|
1747
|
-
* @example
|
|
1748
|
-
* const { data: intent } = useSwapsApiIntent({ params: { txHash: '0x123...' } });
|
|
1749
|
-
*/
|
|
1017
|
+
/** Bigint fields of the decoded intent come back as decimal strings. */
|
|
1750
1018
|
declare const useSwapsApiIntent: ({ params, queryOptions, }?: UseSwapsApiIntentParams) => UseQueryResult<GetIntentResponseV2 | undefined, Error>;
|
|
1751
1019
|
|
|
1752
|
-
/**
|
|
1753
|
-
* Mutation variables for {@link useSwapsApiCreateLimitOrder}. The per-request `apiConfig` override
|
|
1754
|
-
* belongs here rather than at the hook level.
|
|
1755
|
-
*/
|
|
1756
1020
|
type UseSwapsApiCreateLimitOrderVars = {
|
|
1757
1021
|
body: CreateLimitOrderParamsV2;
|
|
1758
1022
|
apiConfig?: RequestOverrideConfig;
|
|
1759
1023
|
};
|
|
1760
|
-
/**
|
|
1761
|
-
* React hook to build an unsigned create-limit-order-intent transaction via the swaps API —
|
|
1762
|
-
* `sodax.api.swaps.createLimitOrderIntent` (same as create-intent but `deadline` is optional).
|
|
1763
|
-
* Returns `{ tx, intent, relayData }`; it does not change state, so no queries are invalidated.
|
|
1764
|
-
*
|
|
1765
|
-
* @example
|
|
1766
|
-
* const { mutateAsync: createLimitOrder } = useSwapsApiCreateLimitOrder();
|
|
1767
|
-
* const { tx, intent, relayData } = await createLimitOrder({ body: createLimitOrderParams });
|
|
1768
|
-
*/
|
|
1024
|
+
/** Same as create-intent, but `deadline` is optional. */
|
|
1769
1025
|
declare const useSwapsApiCreateLimitOrder: ({ mutationOptions, }?: MutationHookParams<CreateLimitOrderResponseV2, UseSwapsApiCreateLimitOrderVars>) => SafeUseMutationResult<CreateLimitOrderResponseV2, Error, UseSwapsApiCreateLimitOrderVars>;
|
|
1770
1026
|
|
|
1771
1027
|
type UseSwapsApiEstimateGasParams = ReadHookParams<GasEstimateResponseV2 | undefined, {
|
|
1772
1028
|
body: GasEstimateRequestV2 | undefined;
|
|
1773
1029
|
apiConfig?: RequestOverrideConfig;
|
|
1774
1030
|
}>;
|
|
1775
|
-
/**
|
|
1776
|
-
* React hook to estimate gas for a raw transaction on a spoke chain via the swaps API —
|
|
1777
|
-
* `sodax.api.swaps.estimateGas`. Returns `{ gas }` (chain-specific shape).
|
|
1778
|
-
*
|
|
1779
|
-
* @example
|
|
1780
|
-
* const { data } = useSwapsApiEstimateGas({ params: { body: { chainKey: 'sonic', tx } } });
|
|
1781
|
-
*/
|
|
1782
1031
|
declare const useSwapsApiEstimateGas: ({ params, queryOptions, }?: UseSwapsApiEstimateGasParams) => UseQueryResult<GasEstimateResponseV2 | undefined, Error>;
|
|
1783
1032
|
|
|
1784
1033
|
type UseSwapsApiPartnerFeeParams = ReadHookParams<FeeResponseV2 | undefined, {
|
|
1785
1034
|
amount: string | undefined;
|
|
1786
1035
|
apiConfig?: RequestOverrideConfig;
|
|
1787
1036
|
}>;
|
|
1788
|
-
/**
|
|
1789
|
-
* React hook to compute the partner fee for a given input amount via the swaps API —
|
|
1790
|
-
* `sodax.api.swaps.getPartnerFee`. Returns `{ fee }` (decimal string).
|
|
1791
|
-
*
|
|
1792
|
-
* @example
|
|
1793
|
-
* const { data } = useSwapsApiPartnerFee({ params: { amount: '1000000' } });
|
|
1794
|
-
*/
|
|
1795
1037
|
declare const useSwapsApiPartnerFee: ({ params, queryOptions, }?: UseSwapsApiPartnerFeeParams) => UseQueryResult<FeeResponseV2 | undefined, Error>;
|
|
1796
1038
|
|
|
1797
1039
|
type UseSwapsApiSolverFeeParams = ReadHookParams<FeeResponseV2 | undefined, {
|
|
1798
1040
|
amount: string | undefined;
|
|
1799
1041
|
apiConfig?: RequestOverrideConfig;
|
|
1800
1042
|
}>;
|
|
1801
|
-
/**
|
|
1802
|
-
* React hook to compute the protocol (solver) fee for a given input amount via the swaps API —
|
|
1803
|
-
* `sodax.api.swaps.getSolverFee`. Returns `{ fee }` (decimal string).
|
|
1804
|
-
*
|
|
1805
|
-
* @example
|
|
1806
|
-
* const { data } = useSwapsApiSolverFee({ params: { amount: '1000000' } });
|
|
1807
|
-
*/
|
|
1808
1043
|
declare const useSwapsApiSolverFee: ({ params, queryOptions, }?: UseSwapsApiSolverFeeParams) => UseQueryResult<FeeResponseV2 | undefined, Error>;
|
|
1809
1044
|
|
|
1810
|
-
/**
|
|
1811
|
-
* Mutation variables for {@link useSwapsApiSubmitTx}. The per-request `apiConfig` override
|
|
1812
|
-
* (e.g. base URL) belongs here rather than at the hook level — different submissions in the same
|
|
1813
|
-
* component can target different endpoints without re-rendering.
|
|
1814
|
-
*/
|
|
1815
1045
|
type UseSwapsApiSubmitTxVars = {
|
|
1816
1046
|
request: SubmitTxRequestV2;
|
|
1817
1047
|
apiConfig?: RequestOverrideConfig;
|
|
1818
1048
|
};
|
|
1819
|
-
/**
|
|
1820
|
-
* React hook for submitting a swap transaction to be processed (relay, post execution to the
|
|
1821
|
-
* solver, etc.) via the swaps API — `sodax.api.swaps.submitTx`.
|
|
1822
|
-
*
|
|
1823
|
-
* Pure mutation: pass `{ request, apiConfig? }` to `mutate({...})`. Retries up to 3 times at the hook
|
|
1824
|
-
* level, except on a terminal API-key rejection (401/403) — see `retryUnlessAuthFailure`. Consumers
|
|
1825
|
-
* can override via `mutationOptions.retry`.
|
|
1826
|
-
*
|
|
1827
|
-
* @example
|
|
1828
|
-
* const { mutateAsync: submitSwapTx, isPending, error } = useSwapsApiSubmitTx();
|
|
1829
|
-
*
|
|
1830
|
-
* const result = await submitSwapTx({
|
|
1831
|
-
* request: { txHash: '0x123...', srcChainKey: 'sonic', walletAddress: '0xabc...', intent: { ... }, relayData: '0x...' },
|
|
1832
|
-
* apiConfig: { baseURL: 'https://...' },
|
|
1833
|
-
* });
|
|
1834
|
-
*/
|
|
1835
1049
|
declare const useSwapsApiSubmitTx: ({ mutationOptions, }?: MutationHookParams<SubmitTxResponseV2, UseSwapsApiSubmitTxVars>) => SafeUseMutationResult<SubmitTxResponseV2, Error, UseSwapsApiSubmitTxVars>;
|
|
1836
1050
|
|
|
1837
1051
|
type UseSwapsApiSubmitTxStatusParams = ReadHookParams<SubmitTxStatusResponseV2 | undefined, {
|
|
@@ -1839,63 +1053,27 @@ type UseSwapsApiSubmitTxStatusParams = ReadHookParams<SubmitTxStatusResponseV2 |
|
|
|
1839
1053
|
srcChainKey?: string;
|
|
1840
1054
|
apiConfig?: RequestOverrideConfig;
|
|
1841
1055
|
}>;
|
|
1842
|
-
/**
|
|
1843
|
-
* React hook for polling the processing status of a submitted swap transaction via the swaps API —
|
|
1844
|
-
* `sodax.api.swaps.getSubmitTxStatus`. Both `txHash` and `srcChainKey` are required for the query
|
|
1845
|
-
* to run (the swaps API status query requires the source chain key).
|
|
1846
|
-
*
|
|
1847
|
-
* @example
|
|
1848
|
-
* const { data: status } = useSwapsApiSubmitTxStatus({
|
|
1849
|
-
* params: { txHash: '0x123...', srcChainKey: 'sonic' },
|
|
1850
|
-
* });
|
|
1851
|
-
*
|
|
1852
|
-
* @remarks
|
|
1853
|
-
* - Default refetch interval is 1 second; stops on 'solved' or 'failed' status, when the
|
|
1854
|
-
* backend marks the submission abandoned (`abandonedAt`) while `status` stays non-terminal, or
|
|
1855
|
-
* once the backend rejects the API key (401/403 is terminal — a retry cannot fix it).
|
|
1856
|
-
*/
|
|
1056
|
+
/** Polls every 1s until solved/failed, `abandonedAt` is set, or an API-key rejection (401/403). */
|
|
1857
1057
|
declare const useSwapsApiSubmitTxStatus: ({ params, queryOptions, }?: UseSwapsApiSubmitTxStatusParams) => UseQueryResult<SubmitTxStatusResponseV2 | undefined, Error>;
|
|
1858
1058
|
|
|
1859
|
-
/**
|
|
1860
|
-
* Structural mirror of `useBridgeDetailedStatus`'s data type. Declared locally rather than imported
|
|
1861
|
-
* so this module does not own the hook's public contract.
|
|
1862
|
-
*/
|
|
1059
|
+
/** Mirrors `useBridgeDetailedStatus`'s data type locally so this module does not own the hook's contract. */
|
|
1863
1060
|
type DetailedBridgeStatusRead = Result<DetailedBridgeStatus, BridgeDetailedStatusError> | undefined;
|
|
1864
1061
|
/**
|
|
1865
|
-
* The read the budget counts:
|
|
1866
|
-
*
|
|
1867
|
-
* right now — the relay unreachable, a malformed response — and those keep polling, because that is
|
|
1868
|
-
* how the read recovers when the outage ends.
|
|
1062
|
+
* The only read the budget counts: no relay packet *and* the backend answered, so the miss is real.
|
|
1063
|
+
* Other `LOOKUP_FAILED`s are outages and keep polling so the read recovers.
|
|
1869
1064
|
*/
|
|
1870
1065
|
declare function isBridgeNotDelivered(data: DetailedBridgeStatusRead): boolean;
|
|
1871
1066
|
/** A read the SDK tags `context.mpcRelay`: a bridge with an MPC-relay end, which gets the longer budget. */
|
|
1872
1067
|
declare function isBridgeMpcRelayRead(data: DetailedBridgeStatusRead): boolean;
|
|
1873
1068
|
/**
|
|
1874
|
-
*
|
|
1875
|
-
*
|
|
1876
|
-
* Unlike the swap analog there is no in-flight second arm to wait on: the relay arm only ever
|
|
1877
|
-
* carries a matched `executed` packet, and the MPC-relay arm a minted deposit record, so both are
|
|
1878
|
-
* terminal on arrival. That leaves three stops — a terminal or abandoned backend record, a rejected
|
|
1879
|
-
* API key, and the ambiguous relay miss once it has run `MAX_NOT_FOUND_POLLS` times in a row, or
|
|
1880
|
-
* `MAX_MPC_RELAY_NOT_FOUND_POLLS` when the SDK tags it `context.mpcRelay`.
|
|
1881
|
-
*
|
|
1882
|
-
* Kept in its own pure module (no React/context imports) so it is unit-testable in dapp-kit's `node`
|
|
1883
|
-
* test environment — importing the hook itself pulls in `useSodaxContext`.
|
|
1069
|
+
* Relay and MPC-relay answers are terminal on arrival; stops on a terminal/abandoned backend record, a rejected key, or an exhausted miss budget.
|
|
1070
|
+
* Kept free of React imports so it is unit-testable in the `node` test environment.
|
|
1884
1071
|
*/
|
|
1885
1072
|
declare function getBridgeDetailedStatusRefetchInterval(data: DetailedBridgeStatusRead, consecutiveNotFound: number): number | false;
|
|
1886
1073
|
|
|
1887
|
-
/**
|
|
1888
|
-
* Mutation variables for {@link useBridge}. Generic over `K extends SpokeChainKey` (defaults to
|
|
1889
|
-
* the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
1890
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
1891
|
-
*/
|
|
1074
|
+
/** Lock `K` at the call site to narrow `walletProvider` and `params.srcChainKey`. */
|
|
1892
1075
|
type UseBridgeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<BridgeParams<K, false>, 'raw'>;
|
|
1893
|
-
/**
|
|
1894
|
-
* React hook for executing a cross-chain bridge transfer.
|
|
1895
|
-
*
|
|
1896
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
1897
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
1898
|
-
*/
|
|
1076
|
+
/** Throws on SDK failure; resolves to the unwrapped `TxHashPair` and invalidates balances. */
|
|
1899
1077
|
declare function useBridge<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseBridgeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseBridgeVars<K>>;
|
|
1900
1078
|
|
|
1901
1079
|
type UseBridgeDetailedStatusResult = Result<DetailedBridgeStatus, BridgeDetailedStatusError> | undefined;
|
|
@@ -1907,26 +1085,8 @@ type UseBridgeDetailedStatusParams = ReadHookParams<UseBridgeDetailedStatusResul
|
|
|
1907
1085
|
apiConfig?: RequestOverrideConfig;
|
|
1908
1086
|
}>;
|
|
1909
1087
|
/**
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1912
|
-
* `useBridgeApiSubmitTxStatus` needs the backend to still hold a usable record; this takes
|
|
1913
|
-
* `(srcChainKey, srcTxHash)` — the pair you hold after `bridge()`, plus `dstChainKey` for a bridge from Tron —
|
|
1914
|
-
* and routes to whichever source
|
|
1915
|
-
* can answer, so it also covers a bridge the client-side fallback completed. `data.value` is
|
|
1916
|
-
* discriminated on `source`, and each variant carries that source's payload unmodified.
|
|
1917
|
-
*
|
|
1918
|
-
* Polls every 3s. Stops once the answering source is terminal (a relay packet always is), once the
|
|
1919
|
-
* backend rejects the API key, and — like `useDetailedStatus` — after 40 consecutive *ambiguous*
|
|
1920
|
-
* reads, meaning a `LOOKUP_FAILED` whose relay has no packet for the tx — 100, about 5 minutes, for a bridge
|
|
1921
|
-
* with an MPC-relay end (`context.mpcRelay`), which settles more slowly. A dependency outage keeps
|
|
1922
|
-
* polling instead, so the read recovers by itself; any real answer resets the budget. Override with
|
|
1923
|
-
* `queryOptions.refetchInterval`.
|
|
1924
|
-
*
|
|
1925
|
-
* @example
|
|
1926
|
-
* ```typescript
|
|
1927
|
-
* const { data } = useBridgeDetailedStatus({ params: { srcChainKey, srcTxHash, dstChainKey } });
|
|
1928
|
-
* if (data?.ok && data.value.source === 'relay') console.log(data.value.data.dst_tx_hash);
|
|
1929
|
-
* ```
|
|
1088
|
+
* Status by source tx (plus `dstChainKey` from Tron), routed to whichever source can answer; `data.value` is discriminated on `source`.
|
|
1089
|
+
* Polls every 3s until terminal, API-key rejection, or 40 (MPC-relay: 100) consecutive no-packet misses; outages keep polling.
|
|
1930
1090
|
*/
|
|
1931
1091
|
declare const useBridgeDetailedStatus: ({ params, queryOptions, }?: UseBridgeDetailedStatusParams) => UseQueryResult<UseBridgeDetailedStatusResult>;
|
|
1932
1092
|
|
|
@@ -1936,20 +1096,9 @@ type UseBridgeAllowanceParams<K extends SpokeChainKey> = ReadHookParams<boolean,
|
|
|
1936
1096
|
}>;
|
|
1937
1097
|
declare function useBridgeAllowance<K extends SpokeChainKey>({ params, queryOptions, }?: UseBridgeAllowanceParams<K>): UseQueryResult<boolean, Error>;
|
|
1938
1098
|
|
|
1939
|
-
/**
|
|
1940
|
-
* Mutation variables for {@link useBridgeApprove}. Generic over `K extends SpokeChainKey`
|
|
1941
|
-
* (defaults to the full union). Sophisticated callers can lock K at the hook call site to narrow
|
|
1942
|
-
* the `walletProvider` and `params.srcChainKey` types.
|
|
1943
|
-
*/
|
|
1099
|
+
/** Lock `K` at the call site to narrow `walletProvider` and `params.srcChainKey`. */
|
|
1944
1100
|
type UseBridgeApproveVars<K extends SpokeChainKey = SpokeChainKey> = Omit<BridgeParams<K, false>, 'raw'>;
|
|
1945
|
-
/**
|
|
1946
|
-
* React hook for approving ERC-20 token spending (or trustline establishment) for a bridge
|
|
1947
|
-
* action.
|
|
1948
|
-
*
|
|
1949
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
1950
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success. Invalidates all
|
|
1951
|
-
* `['bridge', 'allowance', ...]` queries so any pending allowance check refreshes.
|
|
1952
|
-
*/
|
|
1101
|
+
/** Approves spending (or sets a trustline). Throws on SDK failure; invalidates `['bridge', 'allowance']` on success. */
|
|
1953
1102
|
declare function useBridgeApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseBridgeApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseBridgeApproveVars<K>>;
|
|
1954
1103
|
|
|
1955
1104
|
type UseBridgeApprovalStrategyParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<ApprovalStrategy, {
|
|
@@ -1959,28 +1108,15 @@ type UseBridgeApprovalStrategyParams<K extends SpokeChainKey = SpokeChainKey> =
|
|
|
1959
1108
|
allowAccountUpgrade?: boolean;
|
|
1960
1109
|
}>;
|
|
1961
1110
|
/**
|
|
1962
|
-
*
|
|
1963
|
-
*
|
|
1964
|
-
* bridge). Use it to label the bridge button. Pass the same `allowAccountUpgrade` you give the bridge.
|
|
1965
|
-
*
|
|
1966
|
-
* Not polled: `useBridgeWithApproval` invalidates it after a successful bridge, and the bridge
|
|
1967
|
-
* re-reads the strategy at execution, so a stale label never picks the wrong path.
|
|
1111
|
+
* Predicts the approval path {@link useBridgeWithApproval} will take; pass the same `allowAccountUpgrade`.
|
|
1112
|
+
* Not polled: the bridge re-reads the strategy at execution, so a stale label never picks the wrong path.
|
|
1968
1113
|
*/
|
|
1969
1114
|
declare function useBridgeApprovalStrategy<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseBridgeApprovalStrategyParams<K>): UseQueryResult<ApprovalStrategy, Error>;
|
|
1970
1115
|
|
|
1971
|
-
/**
|
|
1972
|
-
* Mutation variables for {@link useBridgeWithApproval}: `useBridge`'s, plus `allowAccountUpgrade`, `resumeBatchId` and
|
|
1973
|
-
* `resumeBatchCallCount`.
|
|
1974
|
-
*/
|
|
1975
1116
|
type UseBridgeWithApprovalVars<K extends SpokeChainKey = SpokeChainKey> = Omit<BridgeWithApprovalParams<K>, 'raw'>;
|
|
1976
1117
|
/**
|
|
1977
|
-
* `useBridge` with
|
|
1978
|
-
*
|
|
1979
|
-
* batch-capable EVM wallet, otherwise approve, wait for it, then bridge. `data.approvalStrategy`
|
|
1980
|
-
* says which ran; {@link useBridgeApprovalStrategy} predicts it.
|
|
1981
|
-
*
|
|
1982
|
-
* Throws on SDK failure so React Query's error model engages. On success invalidates balances and
|
|
1983
|
-
* the bridge allowance and approval-strategy queries.
|
|
1118
|
+
* `useBridge` with approval folded in (one EIP-5792 batch where supported); `data.approvalStrategy` says which path ran.
|
|
1119
|
+
* Throws on SDK failure; on success invalidates balances, allowance and approval-strategy queries.
|
|
1984
1120
|
*/
|
|
1985
1121
|
declare function useBridgeWithApproval<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<BridgeWithApprovalResponse, UseBridgeWithApprovalVars<K>>): SafeUseMutationResult<BridgeWithApprovalResponse, Error, UseBridgeWithApprovalVars<K>>;
|
|
1986
1122
|
|
|
@@ -2001,38 +1137,15 @@ type UseBridgeApiAllowanceParams = ReadHookParams<BridgeAllowanceCheckResponseV2
|
|
|
2001
1137
|
body: CreateBridgeIntentParamsV2 | undefined;
|
|
2002
1138
|
apiConfig?: RequestOverrideConfig;
|
|
2003
1139
|
}>;
|
|
2004
|
-
/**
|
|
2005
|
-
* React hook to check whether the source-token allowance is already sufficient for a bridge via
|
|
2006
|
-
* the bridge API — `sodax.api.bridge.checkAllowance`. Returns `{ valid }`.
|
|
2007
|
-
*
|
|
2008
|
-
* The `body` uses the wire DTO field names (`inputToken`/`inputAmount`).
|
|
2009
|
-
*
|
|
2010
|
-
* @example
|
|
2011
|
-
* const { data: allowance } = useBridgeApiAllowance({ params: { body: createBridgeIntentParams } });
|
|
2012
|
-
*/
|
|
1140
|
+
/** `body` uses the wire DTO field names (`inputToken`/`inputAmount`). */
|
|
2013
1141
|
declare const useBridgeApiAllowance: ({ params, queryOptions, }?: UseBridgeApiAllowanceParams) => UseQueryResult<BridgeAllowanceCheckResponseV2 | undefined, Error>;
|
|
2014
1142
|
|
|
2015
|
-
/**
|
|
2016
|
-
* Mutation variables for {@link useBridgeApiApprove}. The per-request `apiConfig` override belongs
|
|
2017
|
-
* here rather than at the hook level — different calls in the same component can target different
|
|
2018
|
-
* endpoints without re-rendering.
|
|
2019
|
-
*/
|
|
2020
1143
|
type UseBridgeApiApproveVars = {
|
|
2021
1144
|
body: CreateBridgeIntentParamsV2;
|
|
2022
1145
|
apiConfig?: RequestOverrideConfig;
|
|
2023
1146
|
};
|
|
2024
|
-
/**
|
|
2025
|
-
*
|
|
2026
|
-
* API — `sodax.api.bridge.approve`. Returns `{ tx, resetTx? }` (chain-specific unsigned txs) to sign
|
|
2027
|
-
* and broadcast yourself; it does not change state, so no queries are invalidated.
|
|
2028
|
-
*
|
|
2029
|
-
* `resetTx`, when present, must be MINED before `tx` is a valid state transition. Prefer
|
|
2030
|
-
* {@link useBridgeApiApproveAndBroadcast}, which owns that ordering and invalidates the allowance query.
|
|
2031
|
-
*
|
|
2032
|
-
* @example
|
|
2033
|
-
* const { mutateAsync: approve } = useBridgeApiApprove();
|
|
2034
|
-
* const { tx, resetTx } = await approve({ body: createBridgeIntentParams });
|
|
2035
|
-
*/
|
|
1147
|
+
/** Returns unsigned `{ tx, resetTx? }`; `resetTx` must be MINED before `tx` is valid.
|
|
1148
|
+
* Prefer {@link useBridgeApiApproveAndBroadcast}, which owns that ordering. */
|
|
2036
1149
|
declare const useBridgeApiApprove: ({ mutationOptions, }?: MutationHookParams<BridgeApproveResponseV2, UseBridgeApiApproveVars>) => SafeUseMutationResult<BridgeApproveResponseV2, Error, UseBridgeApiApproveVars>;
|
|
2037
1150
|
|
|
2038
1151
|
type BridgeApiApprovalHashes = ApprovalHashes;
|
|
@@ -2044,26 +1157,9 @@ type UseBridgeApiApproveAndBroadcastVars<K extends SpokeChainKey = SpokeChainKey
|
|
|
2044
1157
|
onProgress?: ApprovalProgressListener;
|
|
2045
1158
|
};
|
|
2046
1159
|
/**
|
|
2047
|
-
*
|
|
2048
|
-
*
|
|
2049
|
-
*
|
|
2050
|
-
* Prefer this over {@link useBridgeApiApprove}, which hands back the unsigned `{ tx, resetTx? }` and
|
|
2051
|
-
* leaves the ordering — reset mined first, then approve — to the caller. Confirmation happens inside
|
|
2052
|
-
* the hook, so it invalidates `['bridgeApi','allowance']` itself — after waiting up to about 15 seconds for
|
|
2053
|
-
* the API to report the allowance as valid, since its RPC can trail the node that confirmed the approve.
|
|
2054
|
-
* It resolves after that wait either way, so read the allowance rather than treating success as `valid`.
|
|
2055
|
-
*
|
|
2056
|
-
* Supports the chains the bridge API can approve on — the hub (Sonic), EVM spokes, and Stellar.
|
|
2057
|
-
* Every other chain reports its allowance as always sufficient, so approval never runs for it.
|
|
2058
|
-
*
|
|
2059
|
-
* `onProgress` reports each transaction as `{ step, phase, index, total }`, so the UI can name the
|
|
2060
|
-
* wallet prompt the user is looking at instead of one flat "Approving…" across two signatures.
|
|
2061
|
-
*
|
|
2062
|
-
* @example
|
|
2063
|
-
* const { mutateAsyncSafe: approve } = useBridgeApiApproveAndBroadcast();
|
|
2064
|
-
* const result = await approve({ body: createBridgeIntentParams, walletProvider, onProgress: setStep });
|
|
2065
|
-
* if (!result.ok) return;
|
|
2066
|
-
* const { resetTxHash, approveTxHash } = result.value; // resetTxHash only on a guarded token
|
|
1160
|
+
* Signs, broadcasts and waits for each approval tx (reset mined first), then waits up to ~15s for the API allowance to
|
|
1161
|
+
* report valid since its RPC can lag; resolves either way, so read the allowance rather than treating success as `valid`.
|
|
1162
|
+
* Approval runs only on the hub, EVM spokes and Stellar; other chains report the allowance as always sufficient.
|
|
2067
1163
|
*/
|
|
2068
1164
|
declare const useBridgeApiApproveAndBroadcast: <K extends SpokeChainKey = "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera" | "tron" | "robinhood" | "xrp" | "monad" | "ton" | "zcash" | "cardano">({ mutationOptions, }?: MutationHookParams<BridgeApiApprovalHashes, UseBridgeApiApproveAndBroadcastVars<K>>) => SafeUseMutationResult<BridgeApiApprovalHashes, Error, UseBridgeApiApproveAndBroadcastVars<K>>;
|
|
2069
1165
|
|
|
@@ -2071,102 +1167,37 @@ type UseBridgeApiBridgeableAmountParams = ReadHookParams<BridgeableAmountRespons
|
|
|
2071
1167
|
body: BridgeQuoteRequestV2 | undefined;
|
|
2072
1168
|
apiConfig?: RequestOverrideConfig;
|
|
2073
1169
|
}>;
|
|
2074
|
-
/**
|
|
2075
|
-
* React hook to fetch the deposit capacity / withdrawal liquidity limit for a (from, to) token pair
|
|
2076
|
-
* via the bridge API — `sodax.api.bridge.getBridgeableAmount`. Returns `{ limit }`.
|
|
2077
|
-
*
|
|
2078
|
-
* Computable client-side from config + vault reserves — prefer `sodax.bridge.getBridgeableAmount`
|
|
2079
|
-
* for a no-round-trip read; this HTTP variant mirrors the `/bridge/bridgeable-amount` endpoint.
|
|
2080
|
-
*
|
|
2081
|
-
* The `body` uses the wire DTO field names (`srcChainKey`/`dstChainKey`/`inputToken`/`outputToken`).
|
|
2082
|
-
*
|
|
2083
|
-
* @example
|
|
2084
|
-
* const { data } = useBridgeApiBridgeableAmount({ params: { body: quote } });
|
|
2085
|
-
*/
|
|
1170
|
+
/** HTTP mirror of `sodax.bridge.getBridgeableAmount` (prefer that for a no-round-trip read); `body` uses wire DTO field names. */
|
|
2086
1171
|
declare const useBridgeApiBridgeableAmount: ({ params, queryOptions, }?: UseBridgeApiBridgeableAmountParams) => UseQueryResult<BridgeableAmountResponseV2 | undefined, Error>;
|
|
2087
1172
|
|
|
2088
|
-
/**
|
|
2089
|
-
* Mutation variables for {@link useBridgeApiCreateBridgeIntent}. The per-request `apiConfig`
|
|
2090
|
-
* override belongs here rather than at the hook level.
|
|
2091
|
-
*/
|
|
2092
1173
|
type UseBridgeApiCreateBridgeIntentVars = {
|
|
2093
1174
|
body: CreateBridgeIntentParamsV2;
|
|
2094
1175
|
apiConfig?: RequestOverrideConfig;
|
|
2095
1176
|
};
|
|
2096
|
-
/**
|
|
2097
|
-
* React hook to build an unsigned spoke-deposit (create-bridge-intent) transaction via the bridge
|
|
2098
|
-
* API — `sodax.api.bridge.createBridgeIntent`. Returns `{ tx, relayData }` (no `intent` struct —
|
|
2099
|
-
* bridge is vault-backed) to sign and broadcast yourself; it does not change state, so no queries
|
|
2100
|
-
* are invalidated.
|
|
2101
|
-
*
|
|
2102
|
-
* @example
|
|
2103
|
-
* const { mutateAsync: createBridgeIntent } = useBridgeApiCreateBridgeIntent();
|
|
2104
|
-
* const { tx, relayData } = await createBridgeIntent({ body: createBridgeIntentParams });
|
|
2105
|
-
*/
|
|
1177
|
+
/** Returns the unsigned spoke-deposit `{ tx, relayData }` to sign and broadcast yourself; invalidates no queries. */
|
|
2106
1178
|
declare const useBridgeApiCreateBridgeIntent: ({ mutationOptions, }?: MutationHookParams<CreateBridgeIntentResponseV2, UseBridgeApiCreateBridgeIntentVars>) => SafeUseMutationResult<CreateBridgeIntentResponseV2, Error, UseBridgeApiCreateBridgeIntentVars>;
|
|
2107
1179
|
|
|
2108
1180
|
type UseBridgeApiFeeParams = ReadHookParams<BridgeFeeResponseV2 | undefined, {
|
|
2109
1181
|
body: BridgeFeeRequestV2 | undefined;
|
|
2110
1182
|
apiConfig?: RequestOverrideConfig;
|
|
2111
1183
|
}>;
|
|
2112
|
-
/**
|
|
2113
|
-
*
|
|
2114
|
-
* `body.partnerFee` override when supplied, else the backend-configured fee) —
|
|
2115
|
-
* `sodax.api.bridge.getFee`. Returns `{ fee }` (smallest unit, decimal string).
|
|
2116
|
-
*
|
|
2117
|
-
* The fee is computable client-side (config-driven, token-independent) — prefer `sodax.bridge.getFee`
|
|
2118
|
-
* for a no-round-trip read; this HTTP variant mirrors the `/bridge/fee` endpoint for parity.
|
|
2119
|
-
*
|
|
2120
|
-
* @example
|
|
2121
|
-
* const { data: fee } = useBridgeApiFee({ params: { body: { inputAmount } } });
|
|
2122
|
-
*/
|
|
1184
|
+
/** Uses `body.partnerFee` when supplied, else the backend-configured fee; `fee` is a smallest-unit decimal string.
|
|
1185
|
+
* Prefer `sodax.bridge.getFee` for a no-round-trip read. */
|
|
2123
1186
|
declare const useBridgeApiFee: ({ params, queryOptions, }?: UseBridgeApiFeeParams) => UseQueryResult<BridgeFeeResponseV2 | undefined, Error>;
|
|
2124
1187
|
|
|
2125
1188
|
type UseBridgeApiIsBridgeableParams = ReadHookParams<BridgeableCheckResponseV2 | undefined, {
|
|
2126
1189
|
body: BridgeQuoteRequestV2 | undefined;
|
|
2127
1190
|
apiConfig?: RequestOverrideConfig;
|
|
2128
1191
|
}>;
|
|
2129
|
-
/**
|
|
2130
|
-
* React hook to check whether a (from, to) token pair is bridgeable via the bridge API —
|
|
2131
|
-
* `sodax.api.bridge.isBridgeable`. Returns `{ bridgeable }`.
|
|
2132
|
-
*
|
|
2133
|
-
* Computable client-side from config + vault reserves — prefer `sodax.bridge.isBridgeable`
|
|
2134
|
-
* for a no-round-trip read; this HTTP variant mirrors the `/bridge/bridgeable/check` endpoint.
|
|
2135
|
-
*
|
|
2136
|
-
* The `body` uses the wire DTO field names (`srcChainKey`/`dstChainKey`/`inputToken`/`outputToken`).
|
|
2137
|
-
*
|
|
2138
|
-
* @example
|
|
2139
|
-
* const { data } = useBridgeApiIsBridgeable({ params: { body: quote } });
|
|
2140
|
-
*/
|
|
1192
|
+
/** HTTP mirror of `sodax.bridge.isBridgeable` (prefer that for a no-round-trip read); `body` uses wire DTO field names. */
|
|
2141
1193
|
declare const useBridgeApiIsBridgeable: ({ params, queryOptions, }?: UseBridgeApiIsBridgeableParams) => UseQueryResult<BridgeableCheckResponseV2 | undefined, Error>;
|
|
2142
1194
|
|
|
2143
|
-
/**
|
|
2144
|
-
* Mutation variables for {@link useBridgeApiSubmitTx}. The per-request `apiConfig` override
|
|
2145
|
-
* (e.g. base URL) belongs here rather than at the hook level — different submissions in the same
|
|
2146
|
-
* component can target different endpoints without re-rendering.
|
|
2147
|
-
*/
|
|
2148
1195
|
type UseBridgeApiSubmitTxVars = {
|
|
2149
1196
|
request: BridgeSubmitTxRequestV2;
|
|
2150
1197
|
apiConfig?: RequestOverrideConfig;
|
|
2151
1198
|
};
|
|
2152
|
-
/**
|
|
2153
|
-
*
|
|
2154
|
-
* (relayed server-side) via the bridge API — `sodax.api.bridge.submitTx`. Called AFTER signing +
|
|
2155
|
-
* broadcasting the spoke-deposit tx, handing it (with the FULL `relayData { address, payload }`
|
|
2156
|
-
* envelope) to the backend.
|
|
2157
|
-
*
|
|
2158
|
-
* Pure mutation: pass `{ request, apiConfig? }` to `mutate({...})`. Retries up to 3 times at the
|
|
2159
|
-
* hook level, except on a terminal API-key rejection (401/403) — see `retryUnlessAuthFailure`.
|
|
2160
|
-
* Consumers can override via `mutationOptions.retry`.
|
|
2161
|
-
*
|
|
2162
|
-
* @example
|
|
2163
|
-
* const { mutateAsync: submitBridgeTx, isPending, error } = useBridgeApiSubmitTx();
|
|
2164
|
-
*
|
|
2165
|
-
* const result = await submitBridgeTx({
|
|
2166
|
-
* request: { txHash: '0x123...', srcChainKey: '0xa4b1.arbitrum', walletAddress: '0xabc...', relayData: { address: '0x...', payload: '0x...' } },
|
|
2167
|
-
* apiConfig: { baseURL: 'https://...' },
|
|
2168
|
-
* });
|
|
2169
|
-
*/
|
|
1199
|
+
/** Call after broadcasting the spoke-deposit tx, passing the FULL `relayData { address, payload }` envelope.
|
|
1200
|
+
* Retries up to 3 times except on API-key rejection (401/403). */
|
|
2170
1201
|
declare const useBridgeApiSubmitTx: ({ mutationOptions, }?: MutationHookParams<BridgeSubmitTxResponseV2, UseBridgeApiSubmitTxVars>) => SafeUseMutationResult<BridgeSubmitTxResponseV2, Error, UseBridgeApiSubmitTxVars>;
|
|
2171
1202
|
|
|
2172
1203
|
type UseBridgeApiSubmitTxStatusParams = ReadHookParams<BridgeSubmitTxStatusResponseV2 | undefined, {
|
|
@@ -2174,127 +1205,54 @@ type UseBridgeApiSubmitTxStatusParams = ReadHookParams<BridgeSubmitTxStatusRespo
|
|
|
2174
1205
|
srcChainKey?: string;
|
|
2175
1206
|
apiConfig?: RequestOverrideConfig;
|
|
2176
1207
|
}>;
|
|
2177
|
-
/**
|
|
2178
|
-
* React hook for polling the processing status of a submitted bridge transaction via the bridge
|
|
2179
|
-
* API — `sodax.api.bridge.getSubmitTxStatus`. Both `txHash` and `srcChainKey` are required for the
|
|
2180
|
-
* query to run.
|
|
2181
|
-
*
|
|
2182
|
-
* @example
|
|
2183
|
-
* const { data: status } = useBridgeApiSubmitTxStatus({
|
|
2184
|
-
* params: { txHash: '0x123...', srcChainKey: '0xa4b1.arbitrum' },
|
|
2185
|
-
* });
|
|
2186
|
-
*
|
|
2187
|
-
* @remarks
|
|
2188
|
-
* - Default refetch interval is 1 second; stops on 'executed' or 'failed' status, when the
|
|
2189
|
-
* backend marks the submission abandoned (`abandonedAt`) while `status` stays non-terminal, or
|
|
2190
|
-
* once the backend rejects the API key (401/403 is terminal — a retry cannot fix it) —
|
|
2191
|
-
* mirroring the SDK's backend submit-tx poll (no solver `posting_execution` state — bridge has
|
|
2192
|
-
* no post-execution).
|
|
2193
|
-
*/
|
|
1208
|
+
/** Polls every 1s until 'executed'/'failed', `abandonedAt`, or API-key rejection (401/403). */
|
|
2194
1209
|
declare const useBridgeApiSubmitTxStatus: ({ params, queryOptions, }?: UseBridgeApiSubmitTxStatusParams) => UseQueryResult<BridgeSubmitTxStatusResponseV2 | undefined, Error>;
|
|
2195
1210
|
|
|
2196
1211
|
type UseBridgeApiTokensParams = ReadHookParams<GetBridgeTokensResponseV2, {
|
|
2197
1212
|
apiConfig?: RequestOverrideConfig;
|
|
2198
1213
|
}>;
|
|
2199
|
-
/**
|
|
2200
|
-
* React hook to fetch all supported bridge tokens grouped by SpokeChainKey via the bridge API —
|
|
2201
|
-
* `sodax.api.bridge.getTokens`. The token list is backend-served; the bridgeable-amount quote is
|
|
2202
|
-
* computable client-side via `useGetBridgeableAmount` (also mirrored by `useBridgeApiBridgeableAmount`).
|
|
2203
|
-
*
|
|
2204
|
-
* @example
|
|
2205
|
-
* const { data: tokensByChain } = useBridgeApiTokens();
|
|
2206
|
-
*/
|
|
2207
1214
|
declare const useBridgeApiTokens: ({ params, queryOptions, }?: UseBridgeApiTokensParams) => UseQueryResult<GetBridgeTokensResponseV2, Error>;
|
|
2208
1215
|
|
|
2209
1216
|
type UseBridgeApiTokensByChainParams = ReadHookParams<GetBridgeTokensByChainResponseV2 | undefined, {
|
|
2210
1217
|
chainKey: string | undefined;
|
|
2211
1218
|
apiConfig?: RequestOverrideConfig;
|
|
2212
1219
|
}>;
|
|
2213
|
-
/**
|
|
2214
|
-
* React hook to fetch supported bridge tokens for a single SpokeChainKey via the bridge API —
|
|
2215
|
-
* `sodax.api.bridge.getTokensByChain`. Use `useBridgeApiTokens` for every chain at once.
|
|
2216
|
-
*
|
|
2217
|
-
* @example
|
|
2218
|
-
* const { data: tokens } = useBridgeApiTokensByChain({ params: { chainKey: '0xa4b1.arbitrum' } });
|
|
2219
|
-
*/
|
|
2220
1220
|
declare const useBridgeApiTokensByChain: ({ params, queryOptions, }?: UseBridgeApiTokensByChainParams) => UseQueryResult<GetBridgeTokensByChainResponseV2 | undefined, Error>;
|
|
2221
1221
|
|
|
2222
|
-
/**
|
|
2223
|
-
* Mutation variables for {@link useStake}. Generic over `K extends SpokeChainKey` (defaults to
|
|
2224
|
-
* the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
2225
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
2226
|
-
*/
|
|
2227
1222
|
type UseStakeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<StakeAction<K, false>, 'raw'>;
|
|
2228
|
-
/**
|
|
2229
|
-
* React hook for staking SODA tokens.
|
|
2230
|
-
*
|
|
2231
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2232
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2233
|
-
*/
|
|
1223
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
2234
1224
|
declare function useStake<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseStakeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseStakeVars<K>>;
|
|
2235
1225
|
|
|
2236
|
-
/**
|
|
2237
|
-
* Mutation variables for {@link useStakeApprove}. The `action` literal is injected by the hook —
|
|
2238
|
-
* callers pass the stake-specific fields only.
|
|
2239
|
-
*/
|
|
2240
1226
|
type UseStakeApproveVars<K extends SpokeChainKey = SpokeChainKey> = {
|
|
2241
1227
|
params: Omit<StakeParams<K>, 'action'>;
|
|
2242
1228
|
walletProvider: GetWalletProviderType<K>;
|
|
2243
1229
|
};
|
|
2244
|
-
/**
|
|
2245
|
-
* React hook for approving SODA spending on the stake action.
|
|
2246
|
-
*
|
|
2247
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2248
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success.
|
|
2249
|
-
*/
|
|
1230
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped tx return value. */
|
|
2250
1231
|
declare function useStakeApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseStakeApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseStakeApproveVars<K>>;
|
|
2251
1232
|
|
|
2252
1233
|
type UseStakeAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, {
|
|
2253
1234
|
payload: Omit<StakeParams<K>, 'action'> | undefined;
|
|
2254
1235
|
}>;
|
|
2255
|
-
/**
|
|
2256
|
-
* React hook to check whether the user has approved sufficient SODA spending for the stake
|
|
2257
|
-
* action. Read-only — calls `staking.isAllowanceValid` with `raw: true` so no `walletProvider`
|
|
2258
|
-
* is required.
|
|
2259
|
-
*/
|
|
1236
|
+
/** Read-only (`raw: true`), so no `walletProvider` is needed. */
|
|
2260
1237
|
declare function useStakeAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseStakeAllowanceParams<K>): UseQueryResult<boolean, Error>;
|
|
2261
1238
|
|
|
2262
1239
|
type UseUnstakeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<UnstakeAction<K, false>, 'raw'>;
|
|
2263
|
-
/**
|
|
2264
|
-
* React hook for initiating an SODA unstake.
|
|
2265
|
-
*
|
|
2266
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2267
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2268
|
-
*/
|
|
1240
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
2269
1241
|
declare function useUnstake<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseUnstakeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseUnstakeVars<K>>;
|
|
2270
1242
|
|
|
2271
1243
|
type UseClaimVars<K extends SpokeChainKey = SpokeChainKey> = Omit<ClaimAction<K, false>, 'raw'>;
|
|
2272
|
-
/**
|
|
2273
|
-
* React hook for claiming an unstaked SODA request that has reached the end of its waiting period.
|
|
2274
|
-
*
|
|
2275
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2276
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2277
|
-
*/
|
|
1244
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
2278
1245
|
declare function useClaim<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseClaimVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseClaimVars<K>>;
|
|
2279
1246
|
|
|
2280
1247
|
type UseCancelUnstakeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<CancelUnstakeAction<K, false>, 'raw'>;
|
|
2281
|
-
/**
|
|
2282
|
-
* React hook for cancelling a pending unstake request.
|
|
2283
|
-
*
|
|
2284
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2285
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2286
|
-
*/
|
|
1248
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
2287
1249
|
declare function useCancelUnstake<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseCancelUnstakeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseCancelUnstakeVars<K>>;
|
|
2288
1250
|
|
|
2289
1251
|
type UseStakingInfoParams = ReadHookParams<StakingInfo, {
|
|
2290
1252
|
srcAddress: `0x${string}` | undefined;
|
|
2291
1253
|
srcChainKey: SpokeChainKey | undefined;
|
|
2292
1254
|
}>;
|
|
2293
|
-
/**
|
|
2294
|
-
* React hook to fetch the user's staking info (xSODA balance, share value, underlying SODA) by
|
|
2295
|
-
* deriving the hub wallet from the spoke `srcAddress` + `srcChainKey`. Throws on `!ok` so React
|
|
2296
|
-
* Query lands in `error` state.
|
|
2297
|
-
*/
|
|
1255
|
+
/** Throws on `!ok`. */
|
|
2298
1256
|
declare function useStakingInfo({ params, queryOptions, }?: UseStakingInfoParams): UseQueryResult<StakingInfo, Error>;
|
|
2299
1257
|
|
|
2300
1258
|
type UnstakingInfoWithPenalty = UnstakingInfo & {
|
|
@@ -2304,17 +1262,11 @@ type UseUnstakingInfoWithPenaltyParams = ReadHookParams<UnstakingInfoWithPenalty
|
|
|
2304
1262
|
srcAddress: `0x${string}` | undefined;
|
|
2305
1263
|
srcChainKey: SpokeChainKey | undefined;
|
|
2306
1264
|
}>;
|
|
2307
|
-
/**
|
|
2308
|
-
* React hook to fetch the user's pending unstake requests **with computed early-exit penalties**
|
|
2309
|
-
* by deriving the hub wallet from the spoke `srcAddress` + `srcChainKey`. Throws on `!ok`.
|
|
2310
|
-
*/
|
|
1265
|
+
/** Includes computed early-exit penalties. Throws on `!ok`. */
|
|
2311
1266
|
declare function useUnstakingInfoWithPenalty({ params, queryOptions, }?: UseUnstakingInfoWithPenaltyParams): UseQueryResult<UnstakingInfoWithPenalty, Error>;
|
|
2312
1267
|
|
|
2313
1268
|
type UseStakingConfigParams = ReadHookParams<StakingConfig>;
|
|
2314
|
-
/**
|
|
2315
|
-
* React hook to fetch the global staking config (unstaking period, min unstaking period, max
|
|
2316
|
-
* penalty). Hub-only read; no chain context required. Throws on `!ok`.
|
|
2317
|
-
*/
|
|
1269
|
+
/** Throws on `!ok`. */
|
|
2318
1270
|
declare function useStakingConfig({ queryOptions }?: UseStakingConfigParams): UseQueryResult<StakingConfig, Error>;
|
|
2319
1271
|
|
|
2320
1272
|
type UseStakeRatioParams = ReadHookParams<[
|
|
@@ -2323,204 +1275,105 @@ type UseStakeRatioParams = ReadHookParams<[
|
|
|
2323
1275
|
], {
|
|
2324
1276
|
amount: bigint | undefined;
|
|
2325
1277
|
}>;
|
|
2326
|
-
/**
|
|
2327
|
-
* React hook to estimate the SODA → xSODA stake ratio for a given amount. Hub-only read. Throws
|
|
2328
|
-
* on `!ok`.
|
|
2329
|
-
*/
|
|
1278
|
+
/** Throws on `!ok`. */
|
|
2330
1279
|
declare function useStakeRatio({ params, queryOptions, }?: UseStakeRatioParams): UseQueryResult<[bigint, bigint], Error>;
|
|
2331
1280
|
|
|
2332
1281
|
type UseInstantUnstakeRatioParams = ReadHookParams<bigint, {
|
|
2333
1282
|
amount: bigint | undefined;
|
|
2334
1283
|
}>;
|
|
2335
|
-
/**
|
|
2336
|
-
* React hook to estimate the SODA amount received from instant-unstaking a given xSODA amount
|
|
2337
|
-
* (after slippage). Hub-only read. Throws on `!ok`.
|
|
2338
|
-
*/
|
|
1284
|
+
/** SODA received for instant-unstaking the xSODA amount, after slippage. Throws on `!ok`. */
|
|
2339
1285
|
declare function useInstantUnstakeRatio({ params, queryOptions, }?: UseInstantUnstakeRatioParams): UseQueryResult<bigint, Error>;
|
|
2340
1286
|
|
|
2341
1287
|
type UseConvertedAssetsParams = ReadHookParams<bigint, {
|
|
2342
1288
|
amount: bigint | undefined;
|
|
2343
1289
|
}>;
|
|
2344
|
-
/**
|
|
2345
|
-
* React hook to convert an xSODA share amount to its underlying SODA value via the vault's
|
|
2346
|
-
* exchange rate. Hub-only read. Throws on `!ok`.
|
|
2347
|
-
*/
|
|
1290
|
+
/** Converts xSODA shares to SODA at the vault rate. Throws on `!ok`. */
|
|
2348
1291
|
declare function useConvertedAssets({ params, queryOptions, }?: UseConvertedAssetsParams): UseQueryResult<bigint, Error>;
|
|
2349
1292
|
|
|
2350
1293
|
type UseInstantUnstakeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<InstantUnstakeAction<K, false>, 'raw'>;
|
|
2351
|
-
/**
|
|
2352
|
-
* React hook for instant-unstaking SODA (bypassing the waiting period at a slippage cost).
|
|
2353
|
-
*
|
|
2354
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2355
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2356
|
-
*/
|
|
1294
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
2357
1295
|
declare function useInstantUnstake<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseInstantUnstakeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseInstantUnstakeVars<K>>;
|
|
2358
1296
|
|
|
2359
1297
|
type UseUnstakeAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, {
|
|
2360
1298
|
payload: Omit<UnstakeParams<K>, 'action'> | undefined;
|
|
2361
1299
|
}>;
|
|
2362
|
-
/**
|
|
2363
|
-
* React hook to check whether the user has approved sufficient xSODA spending for the unstake
|
|
2364
|
-
* action. Read-only — calls `staking.isAllowanceValid` with `raw: true` so no `walletProvider`
|
|
2365
|
-
* is required.
|
|
2366
|
-
*/
|
|
1300
|
+
/** Read-only (`raw: true`), so no `walletProvider` is needed. */
|
|
2367
1301
|
declare function useUnstakeAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseUnstakeAllowanceParams<K>): UseQueryResult<boolean, Error>;
|
|
2368
1302
|
|
|
2369
|
-
/**
|
|
2370
|
-
* Mutation variables for {@link useUnstakeApprove}. The `action` literal is injected by the hook.
|
|
2371
|
-
*/
|
|
2372
1303
|
type UseUnstakeApproveVars<K extends SpokeChainKey = SpokeChainKey> = {
|
|
2373
1304
|
params: Omit<UnstakeParams<K>, 'action'>;
|
|
2374
1305
|
walletProvider: GetWalletProviderType<K>;
|
|
2375
1306
|
};
|
|
2376
|
-
/**
|
|
2377
|
-
* React hook for approving xSODA spending on the unstake action.
|
|
2378
|
-
*
|
|
2379
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2380
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success.
|
|
2381
|
-
*/
|
|
1307
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped tx return value. */
|
|
2382
1308
|
declare function useUnstakeApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseUnstakeApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseUnstakeApproveVars<K>>;
|
|
2383
1309
|
|
|
2384
1310
|
type UseUnstakingInfoParams = ReadHookParams<UnstakingInfo, {
|
|
2385
1311
|
srcAddress: `0x${string}` | undefined;
|
|
2386
1312
|
srcChainKey: SpokeChainKey | undefined;
|
|
2387
1313
|
}>;
|
|
2388
|
-
/**
|
|
2389
|
-
* React hook to fetch the user's pending unstake requests by deriving the hub wallet from the
|
|
2390
|
-
* spoke `srcAddress` + `srcChainKey`. Throws on `!ok`.
|
|
2391
|
-
*/
|
|
1314
|
+
/** Throws on `!ok`. */
|
|
2392
1315
|
declare function useUnstakingInfo({ params, queryOptions, }?: UseUnstakingInfoParams): UseQueryResult<UnstakingInfo, Error>;
|
|
2393
1316
|
|
|
2394
|
-
/**
|
|
2395
|
-
* Mutation variables for {@link useInstantUnstakeApprove}. The `action` literal is injected by
|
|
2396
|
-
* the hook.
|
|
2397
|
-
*/
|
|
2398
1317
|
type UseInstantUnstakeApproveVars<K extends SpokeChainKey = SpokeChainKey> = {
|
|
2399
1318
|
params: Omit<InstantUnstakeParams<K>, 'action'>;
|
|
2400
1319
|
walletProvider: GetWalletProviderType<K>;
|
|
2401
1320
|
};
|
|
2402
|
-
/**
|
|
2403
|
-
* React hook for approving xSODA spending on the instant-unstake action.
|
|
2404
|
-
*
|
|
2405
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2406
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success.
|
|
2407
|
-
*/
|
|
1321
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped tx return value. */
|
|
2408
1322
|
declare function useInstantUnstakeApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseInstantUnstakeApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseInstantUnstakeApproveVars<K>>;
|
|
2409
1323
|
|
|
2410
1324
|
type UseInstantUnstakeAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, {
|
|
2411
1325
|
payload: Omit<InstantUnstakeParams<K>, 'action'> | undefined;
|
|
2412
1326
|
}>;
|
|
2413
|
-
/**
|
|
2414
|
-
* React hook to check whether the user has approved sufficient xSODA spending for the
|
|
2415
|
-
* instant-unstake action. Read-only — calls `staking.isAllowanceValid` with `raw: true` so no
|
|
2416
|
-
* `walletProvider` is required.
|
|
2417
|
-
*/
|
|
1327
|
+
/** Read-only (`raw: true`), so no `walletProvider` is needed. */
|
|
2418
1328
|
declare function useInstantUnstakeAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseInstantUnstakeAllowanceParams<K>): UseQueryResult<boolean, Error>;
|
|
2419
1329
|
|
|
2420
1330
|
type UseFetchAssetsBalancesParams = ReadHookParams<Map<string, PartnerFeeClaimAssetBalance>, {
|
|
2421
1331
|
queryAddress: string | undefined;
|
|
2422
1332
|
}>;
|
|
2423
|
-
/**
|
|
2424
|
-
* React hook to fetch hub-asset balances on Sonic for a given EVM address. Disabled when
|
|
2425
|
-
* `queryAddress` is missing. Throws on `!ok`.
|
|
2426
|
-
*/
|
|
2427
1333
|
declare function useFetchAssetsBalances({ params, queryOptions, }?: UseFetchAssetsBalancesParams): UseQueryResult<Map<string, PartnerFeeClaimAssetBalance>, Error>;
|
|
2428
1334
|
|
|
2429
1335
|
type UseGetAutoSwapPreferencesParams = ReadHookParams<AutoSwapPreferences, {
|
|
2430
1336
|
queryAddress: string | undefined;
|
|
2431
1337
|
}>;
|
|
2432
|
-
/**
|
|
2433
|
-
* React hook to fetch the auto-swap preferences (output token, destination chain, destination
|
|
2434
|
-
* address) for a given EVM address. Disabled when `queryAddress` is missing. Throws on `!ok`.
|
|
2435
|
-
*/
|
|
2436
1338
|
declare function useGetAutoSwapPreferences({ params, queryOptions, }?: UseGetAutoSwapPreferencesParams): UseQueryResult<AutoSwapPreferences, Error>;
|
|
2437
1339
|
|
|
2438
1340
|
type UseIsTokenApprovedParams = ReadHookParams<boolean, {
|
|
2439
1341
|
payload: FeeTokenApproveParams | undefined;
|
|
2440
1342
|
}>;
|
|
2441
|
-
/**
|
|
2442
|
-
* React hook to check whether a token is approved to the protocol-intents contract on Sonic for
|
|
2443
|
-
* a given owner. Read-only; throws on `!ok`.
|
|
2444
|
-
*/
|
|
2445
1343
|
declare function useIsTokenApproved({ params, queryOptions, }?: UseIsTokenApprovedParams): UseQueryResult<boolean, Error>;
|
|
2446
1344
|
|
|
2447
1345
|
type UseApproveTokenVars = Omit<FeeTokenApproveAction<HubChainKey, false>, 'raw'>;
|
|
2448
1346
|
type ApproveTokenData = TxReturnType<HubChainKey, false>;
|
|
2449
|
-
/**
|
|
2450
|
-
* React hook to approve a token to the protocol-intents contract on Sonic with max allowance.
|
|
2451
|
-
*
|
|
2452
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2453
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success.
|
|
2454
|
-
*/
|
|
1347
|
+
/** Approves max allowance to the protocol-intents contract on Sonic. */
|
|
2455
1348
|
declare function useApproveToken({ mutationOptions, }?: MutationHookParams<ApproveTokenData, UseApproveTokenVars>): SafeUseMutationResult<ApproveTokenData, Error, UseApproveTokenVars>;
|
|
2456
1349
|
|
|
2457
|
-
/**
|
|
2458
|
-
* Mutation variables for {@link useSetSwapPreference}. Generic over `K extends SpokeChainKey`
|
|
2459
|
-
* for compatibility with the SDK signature; at runtime the SDK enforces hub-only
|
|
2460
|
-
* (`isHubChainKeyType(srcChainKey)`).
|
|
2461
|
-
*/
|
|
1350
|
+
/** Generic only for SDK signature compatibility; the SDK enforces hub-only at runtime. */
|
|
2462
1351
|
type UseSetSwapPreferenceVars<K extends SpokeChainKey = SpokeChainKey> = Omit<SetSwapPreferenceAction<K, false>, 'raw'>;
|
|
2463
|
-
/**
|
|
2464
|
-
* React hook to set the partner's auto-swap preferences (output token + destination chain +
|
|
2465
|
-
* destination address) on the protocol-intents contract.
|
|
2466
|
-
*
|
|
2467
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2468
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success.
|
|
2469
|
-
*/
|
|
2470
1352
|
declare function useSetSwapPreference<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseSetSwapPreferenceVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseSetSwapPreferenceVars<K>>;
|
|
2471
1353
|
type UseSetSwapPreferenceVarsHub = UseSetSwapPreferenceVars<HubChainKey>;
|
|
2472
1354
|
|
|
2473
1355
|
type UseFeeClaimSwapVars = Omit<PartnerFeeClaimSwapAction<HubChainKey, false>, 'raw'>;
|
|
2474
|
-
/**
|
|
2475
|
-
* React hook to create a partner-fee auto-swap intent and wait for the solver execution.
|
|
2476
|
-
*
|
|
2477
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2478
|
-
* `onError`, `retry`). Returns the unwrapped `IntentAutoSwapResult` on success.
|
|
2479
|
-
*/
|
|
1356
|
+
/** Creates a partner-fee auto-swap intent and waits for solver execution. */
|
|
2480
1357
|
declare function useFeeClaimSwap({ mutationOptions, }?: MutationHookParams<IntentAutoSwapResult, UseFeeClaimSwapVars>): SafeUseMutationResult<IntentAutoSwapResult, Error, UseFeeClaimSwapVars>;
|
|
2481
1358
|
|
|
2482
1359
|
type UsePartnerCancelIntentVars = Omit<PartnerFeeClaimCancelAction<HubChainKey, false>, 'raw'>;
|
|
2483
1360
|
/**
|
|
2484
|
-
*
|
|
2485
|
-
*
|
|
2486
|
-
* Calls `ProtocolIntents.cancelIntent(fromToken, toToken)` — the only authorized cancel path for
|
|
2487
|
-
* partner auto-swap intents (the generic swap-cancel reverts because ProtocolIntents, not the
|
|
2488
|
-
* partner, is the intent creator). The contract cancels the intent and refunds the input amount to
|
|
2489
|
-
* the partner. Use this to recover funds from an unfillable same-token claim.
|
|
2490
|
-
*
|
|
2491
|
-
* Throws on SDK failure so React Query's native error model engages. Returns the transaction hash.
|
|
1361
|
+
* The only authorized cancel for partner auto-swap intents (ProtocolIntents is the creator, so the generic
|
|
1362
|
+
* swap cancel reverts); refunds the locked input to the partner.
|
|
2492
1363
|
*/
|
|
2493
1364
|
declare function usePartnerCancelIntent({ mutationOptions, }?: MutationHookParams<TxReturnType<HubChainKey, false>, UsePartnerCancelIntentVars>): SafeUseMutationResult<TxReturnType<HubChainKey, false>, Error, UsePartnerCancelIntentVars>;
|
|
2494
1365
|
|
|
2495
1366
|
type UseGetUserIntentParams = ReadHookParams<Hex, Partial<GetUserIntentParams>>;
|
|
2496
|
-
/**
|
|
2497
|
-
* React hook to look up the stored intent hash for a partner's `(user, fromToken, toToken)` pair.
|
|
2498
|
-
*
|
|
2499
|
-
* A non-zero hash means an open auto-swap intent exists for that token pair (e.g. an unfilled
|
|
2500
|
-
* same-token claim) and can be recovered via {@link usePartnerCancelIntent}. Disabled until all
|
|
2501
|
-
* three inputs are present. Throws on `!ok`.
|
|
2502
|
-
*/
|
|
1367
|
+
/** A non-zero hash is an open auto-swap intent, recoverable via {@link usePartnerCancelIntent}. */
|
|
2503
1368
|
declare function useGetUserIntent({ params, queryOptions }?: UseGetUserIntentParams): UseQueryResult<Hex, Error>;
|
|
2504
1369
|
|
|
2505
1370
|
type UseGetIntentDetailsParams = ReadHookParams<Intent, {
|
|
2506
1371
|
intentHash: Hex | undefined;
|
|
2507
1372
|
}>;
|
|
2508
|
-
/**
|
|
2509
|
-
* React hook to fetch the full {@link Intent} details for a ProtocolIntents intent hash.
|
|
2510
|
-
*
|
|
2511
|
-
* Pair with {@link useGetUserIntent} to display a stuck intent (e.g. its locked `inputAmount`)
|
|
2512
|
-
* before recovering it. Disabled when the hash is missing or the zero hash (no intent). Throws
|
|
2513
|
-
* on `!ok`.
|
|
2514
|
-
*/
|
|
1373
|
+
/** Disabled for a missing or zero hash; pair with {@link useGetUserIntent} to inspect a stuck intent. */
|
|
2515
1374
|
declare function useGetIntentDetails({ params, queryOptions, }?: UseGetIntentDetailsParams): UseQueryResult<Intent, Error>;
|
|
2516
1375
|
|
|
2517
|
-
/**
|
|
2518
|
-
* Mutation variables for {@link useFeeClaimWithdraw}. Maps a partner fee balance to a
|
|
2519
|
-
* Sonic-sourced bridge: `feeToken` is the wrapped hub-asset address on Sonic
|
|
2520
|
-
* (`PartnerFeeClaimAssetBalance.address`); `dstToken` is the original token address on
|
|
2521
|
-
* `dstChainKey` (`PartnerFeeClaimAssetBalance.originalAddress`, or `feeToken` for same-chain
|
|
2522
|
-
* delivery to a Sonic address).
|
|
2523
|
-
*/
|
|
1376
|
+
/** `feeToken` is the hub asset `address` on Sonic; `dstToken` is its `originalAddress` (or `feeToken` for Sonic). */
|
|
2524
1377
|
type UseFeeClaimWithdrawVars = {
|
|
2525
1378
|
params: {
|
|
2526
1379
|
srcAddress: string;
|
|
@@ -2533,153 +1386,60 @@ type UseFeeClaimWithdrawVars = {
|
|
|
2533
1386
|
walletProvider: GetWalletProviderType<HubChainKey>;
|
|
2534
1387
|
};
|
|
2535
1388
|
/**
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2538
|
-
* For fees the partner wants to keep as-is (the desired output equals the fee token, e.g. BTC→BTC),
|
|
2539
|
-
* an auto-swap is impossible — the solver rejects a same-token swap. This bridges the wrapped fee
|
|
2540
|
-
* token from Sonic to its native chain (or transfers it on Sonic when `dstChainKey` is Sonic),
|
|
2541
|
-
* bypassing the solver entirely.
|
|
2542
|
-
*
|
|
2543
|
-
* Bridging from Sonic pulls the token via the partner's hub-wallet router, which requires a prior
|
|
2544
|
-
* allowance to that spender — a different approval than the ProtocolIntents one used by the swap
|
|
2545
|
-
* claim. Use `useBridgeAllowance` / `useBridgeApprove` (with the same mapped bridge params) first.
|
|
2546
|
-
*
|
|
2547
|
-
* Throws on SDK failure so React Query's native error model engages. Returns the `TxHashPair`.
|
|
1389
|
+
* Bridges a fee token out without a swap (the solver rejects same-token swaps). Needs a prior hub-wallet
|
|
1390
|
+
* router allowance via `useBridgeAllowance` / `useBridgeApprove`, not the ProtocolIntents approval.
|
|
2548
1391
|
*/
|
|
2549
1392
|
declare function useFeeClaimWithdraw({ mutationOptions, }?: MutationHookParams<TxHashPair, UseFeeClaimWithdrawVars>): SafeUseMutationResult<TxHashPair, Error, UseFeeClaimWithdrawVars>;
|
|
2550
1393
|
|
|
2551
1394
|
type UseHubAssetBalancesParams = ReadHookParams<HubAssetBalance[], {
|
|
2552
1395
|
chainKey: SpokeChainKey | undefined;
|
|
2553
|
-
/**
|
|
1396
|
+
/** Spoke address; the SDK derives the hub wallet from it. */
|
|
2554
1397
|
srcAddress: string | undefined;
|
|
2555
1398
|
}>;
|
|
2556
|
-
/**
|
|
2557
|
-
* React hook to fetch the hub-side balances of every supported token on the given spoke chain
|
|
2558
|
-
* for the user's hub wallet (derived internally from `srcAddress` + `chainKey`). Disabled when
|
|
2559
|
-
* either input is missing. Throws on `!ok`.
|
|
2560
|
-
*/
|
|
2561
1399
|
declare function useHubAssetBalances({ params, queryOptions, }?: UseHubAssetBalancesParams): UseQueryResult<HubAssetBalance[], Error>;
|
|
2562
1400
|
|
|
2563
|
-
/**
|
|
2564
|
-
* Mutation variables for {@link useWithdrawHubAsset}. Generic over `K extends SpokeChainKey`
|
|
2565
|
-
* (defaults to the full union). Sophisticated callers can lock K at the hook call site to narrow
|
|
2566
|
-
* the `walletProvider` and `params.srcChainKey` types.
|
|
2567
|
-
*/
|
|
2568
1401
|
type UseWithdrawHubAssetVars<K extends SpokeChainKey = SpokeChainKey> = Omit<WithdrawHubAssetAction<K, false>, 'raw'>;
|
|
2569
|
-
/**
|
|
2570
|
-
* React hook for withdrawing a hub-side asset back to the user's spoke chain wallet.
|
|
2571
|
-
*
|
|
2572
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2573
|
-
* `onError`, `retry`). Returns the spoke tx hash on success, or from an MPC-relay chain (Tron) the
|
|
2574
|
-
* relay's `trackingId`, which is not a tx hash: never link it to an explorer.
|
|
2575
|
-
*/
|
|
1402
|
+
/** Resolves the spoke tx hash, or for an MPC-relay chain a relay `trackingId` that is not a tx hash: never link it to an explorer. */
|
|
2576
1403
|
declare function useWithdrawHubAsset<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<SendMessageReturnType<K, false>, UseWithdrawHubAssetVars<K>>): SafeUseMutationResult<SendMessageReturnType<K, false>, Error, UseWithdrawHubAssetVars<K>>;
|
|
2577
1404
|
|
|
2578
|
-
/**
|
|
2579
|
-
* Mutation variables for {@link useMigrateIcxToSoda}. Wraps `IcxMigrateAction<false>` with `raw`
|
|
2580
|
-
* stripped — the hook always submits non-raw and unwraps the SDK Result.
|
|
2581
|
-
*/
|
|
2582
1405
|
type UseMigrateIcxToSodaVars = Omit<IcxMigrateAction<false>, 'raw'>;
|
|
2583
|
-
/**
|
|
2584
|
-
* React hook for migrating ICX/wICX → SODA on the Sonic hub. Forward-only direction; for the
|
|
2585
|
-
* reverse (SODA → ICX) use {@link useRevertMigrateSodaToIcx}.
|
|
2586
|
-
*
|
|
2587
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2588
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2589
|
-
*/
|
|
1406
|
+
/** Forward only; use {@link useRevertMigrateSodaToIcx} for SODA → ICX. */
|
|
2590
1407
|
declare function useMigrateIcxToSoda({ mutationOptions, }?: MutationHookParams<TxHashPair, UseMigrateIcxToSodaVars>): SafeUseMutationResult<TxHashPair, Error, UseMigrateIcxToSodaVars>;
|
|
2591
1408
|
|
|
2592
1409
|
type UseRevertMigrateSodaToIcxVars = Omit<IcxRevertMigrationAction<false>, 'raw'>;
|
|
2593
|
-
/**
|
|
2594
|
-
* React hook for reverting SODA → ICX (the inverse of {@link useMigrateIcxToSoda}).
|
|
2595
|
-
*
|
|
2596
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2597
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2598
|
-
*/
|
|
2599
1410
|
declare function useRevertMigrateSodaToIcx({ mutationOptions, }?: MutationHookParams<TxHashPair, UseRevertMigrateSodaToIcxVars>): SafeUseMutationResult<TxHashPair, Error, UseRevertMigrateSodaToIcxVars>;
|
|
2600
1411
|
|
|
2601
|
-
/**
|
|
2602
|
-
* Mutation variables for {@link useMigratebnUSD}. Generic over `K extends SpokeChainKey` (defaults
|
|
2603
|
-
* to the full union). Bidirectional — handles both legacy → new and new → legacy bnUSD migration
|
|
2604
|
-
* via the same SDK call; the SDK detects direction from the token addresses.
|
|
2605
|
-
*/
|
|
1412
|
+
/** Bidirectional: the SDK detects legacy ↔ new direction from the token addresses. */
|
|
2606
1413
|
type UseMigratebnUSDVars<K extends SpokeChainKey = SpokeChainKey> = Omit<UnifiedBnUSDMigrateAction<K, false>, 'raw'>;
|
|
2607
|
-
/**
|
|
2608
|
-
* React hook for migrating bnUSD between legacy and new formats across spoke chains via Sonic.
|
|
2609
|
-
*
|
|
2610
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2611
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2612
|
-
*/
|
|
2613
1414
|
declare function useMigratebnUSD<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseMigratebnUSDVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseMigratebnUSDVars<K>>;
|
|
2614
1415
|
|
|
2615
1416
|
type UseMigrateBalnVars = Omit<BalnMigrateAction<false>, 'raw'>;
|
|
2616
|
-
/**
|
|
2617
|
-
* React hook for migrating BALN → SODA on the Sonic hub. Source chain is always Icon. Supports
|
|
2618
|
-
* lockup periods (0–24 months) which multiply the SODA reward (0.5x–1.5x).
|
|
2619
|
-
*
|
|
2620
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2621
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2622
|
-
*/
|
|
1417
|
+
/** Source chain is always Icon; a 0–24 month lockup scales the SODA reward 0.5x–1.5x. */
|
|
2623
1418
|
declare function useMigrateBaln({ mutationOptions, }?: MutationHookParams<TxHashPair, UseMigrateBalnVars>): SafeUseMutationResult<TxHashPair, Error, UseMigrateBalnVars>;
|
|
2624
1419
|
|
|
2625
|
-
/**
|
|
2626
|
-
* Mutation variables for {@link useMigrationApprove}. The SDK's `approve` accepts a union of
|
|
2627
|
-
* action wrappers (Icx-revert OR bnUSD bidirectional) plus a separate `'migrate' | 'revert'`
|
|
2628
|
-
* discriminator. Both ride along in `TVars` here so the hook stays a pure pass-through.
|
|
2629
|
-
*/
|
|
2630
1420
|
type UseMigrationApproveVars<K extends SpokeChainKey = SpokeChainKey> = (Omit<IcxRevertMigrationAction<false>, 'raw'> | Omit<UnifiedBnUSDMigrateAction<K, false>, 'raw'>) & {
|
|
2631
1421
|
action: MigrationAction;
|
|
2632
1422
|
};
|
|
2633
|
-
/**
|
|
2634
|
-
* React hook for approving token spending on a migration intent. Required before:
|
|
2635
|
-
* - SODA → ICX revert (consumes SODA on Sonic via the user's hub router)
|
|
2636
|
-
* - bnUSD migrations on EVM/Stellar source chains (consumes the source bnUSD via asset manager)
|
|
2637
|
-
*
|
|
2638
|
-
* NOT required for ICX → SODA forward migrations or BALN migrations (both originate on Icon
|
|
2639
|
-
* which doesn't use ERC-20 allowances).
|
|
2640
|
-
*
|
|
2641
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2642
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success.
|
|
2643
|
-
*/
|
|
1423
|
+
/** Required for SODA → ICX revert and EVM/Stellar bnUSD migrations; not for ICX → SODA or BALN (Icon). */
|
|
2644
1424
|
declare function useMigrationApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseMigrationApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseMigrationApproveVars<K>>;
|
|
2645
1425
|
|
|
2646
|
-
/**
|
|
2647
|
-
* Domain inputs for {@link useMigrationAllowance}. `params` is the underlying migration params
|
|
2648
|
-
* (NOT the action wrapper — no `walletProvider`/`raw`); `action` is the `'migrate' | 'revert'`
|
|
2649
|
-
* discriminator the SDK uses to pick the right allowance check path.
|
|
2650
|
-
*
|
|
2651
|
-
* For ICX forward migration (`migrate`, params={IcxMigrateParams}) and BALN migration the SDK
|
|
2652
|
-
* always returns `true` (Icon has no ERC-20-style allowance) — but the hook still works there
|
|
2653
|
-
* for code-uniformity at the call site.
|
|
2654
|
-
*/
|
|
1426
|
+
/** `params` excludes `walletProvider`/`raw`; ICX forward and BALN always resolve `true` (Icon has no allowance). */
|
|
2655
1427
|
type UseMigrationAllowanceInputs<K extends SpokeChainKey = SpokeChainKey> = {
|
|
2656
1428
|
params: IcxMigrateParams | IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams<K> | BalnMigrateParams | undefined;
|
|
2657
1429
|
action: MigrationAction | undefined;
|
|
2658
1430
|
};
|
|
2659
1431
|
type UseMigrationAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, UseMigrationAllowanceInputs<K>>;
|
|
2660
|
-
/**
|
|
2661
|
-
* React hook to check if migration spending is approved.
|
|
2662
|
-
*
|
|
2663
|
-
* Returns `false` when params are missing (so the call site can disable the action button).
|
|
2664
|
-
* Hook lifecycle (`enabled`, `queryKey`, `queryFn`) is owned internally; consumers can override
|
|
2665
|
-
* other React Query knobs via `queryOptions`.
|
|
2666
|
-
*/
|
|
1432
|
+
/** Resolves `false` when params are missing. */
|
|
2667
1433
|
declare function useMigrationAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseMigrationAllowanceParams<K>): UseQueryResult<boolean, Error>;
|
|
2668
1434
|
|
|
2669
1435
|
type UsePoolsParams = ReadHookParams<PoolKey[]>;
|
|
2670
|
-
/**
|
|
2671
|
-
* Loads the list of concentrated-liquidity pools known to the SDK config. The SDK's `getPools()`
|
|
2672
|
-
* is synchronous in v2 (no network), so this hook caches indefinitely by default.
|
|
2673
|
-
*/
|
|
1436
|
+
/** `getPools()` is synchronous (no network), so the result is cached indefinitely. */
|
|
2674
1437
|
declare function usePools({ queryOptions }?: UsePoolsParams): UseQueryResult<PoolKey[], Error>;
|
|
2675
1438
|
|
|
2676
1439
|
type UsePoolDataParams = ReadHookParams<PoolData, {
|
|
2677
1440
|
poolKey: PoolKey | null;
|
|
2678
1441
|
}>;
|
|
2679
|
-
/**
|
|
2680
|
-
* React hook to fetch on-chain pool data (sqrt price, tick, fees, token info, etc.) for a given
|
|
2681
|
-
* pool key. Reads via the hub `publicClient`. Disabled when `poolKey` is null.
|
|
2682
|
-
*/
|
|
1442
|
+
/** Disabled when `poolKey` is null. */
|
|
2683
1443
|
declare function usePoolData({ params, queryOptions }?: UsePoolDataParams): UseQueryResult<PoolData, Error>;
|
|
2684
1444
|
|
|
2685
1445
|
type UsePoolBalancesResponse = {
|
|
@@ -2692,10 +1452,6 @@ type UsePoolBalancesParams = ReadHookParams<UsePoolBalancesResponse, {
|
|
|
2692
1452
|
spokeChainKey: SpokeChainKey | undefined;
|
|
2693
1453
|
userAddress: string | undefined;
|
|
2694
1454
|
}>;
|
|
2695
|
-
/**
|
|
2696
|
-
* React hook to query the user's hub-side deposit balances for both pool tokens. Derives the hub
|
|
2697
|
-
* wallet once and reads both pool-token balances in parallel via the hub `publicClient`.
|
|
2698
|
-
*/
|
|
2699
1455
|
declare function usePoolBalances({ params, queryOptions, }?: UsePoolBalancesParams): UseQueryResult<UsePoolBalancesResponse, Error>;
|
|
2700
1456
|
|
|
2701
1457
|
type UsePositionInfoResponse = {
|
|
@@ -2706,74 +1462,25 @@ type UsePositionInfoParams = ReadHookParams<UsePositionInfoResponse, {
|
|
|
2706
1462
|
tokenId: string | null;
|
|
2707
1463
|
poolKey: PoolKey | null;
|
|
2708
1464
|
}>;
|
|
2709
|
-
/**
|
|
2710
|
-
* React hook to fetch a CL position by NFT token id and validate it against an expected pool key.
|
|
2711
|
-
* Reads via the hub `publicClient`. Disabled when `tokenId` or `poolKey` is missing.
|
|
2712
|
-
*/
|
|
1465
|
+
/** Validates the position against the expected pool key; disabled when `tokenId` or `poolKey` is missing. */
|
|
2713
1466
|
declare function usePositionInfo({ params, queryOptions, }?: UsePositionInfoParams): UseQueryResult<UsePositionInfoResponse, Error>;
|
|
2714
1467
|
|
|
2715
|
-
/**
|
|
2716
|
-
* Mutation variables for {@link useDexDeposit}. Generic over `K extends SpokeChainKey` (defaults
|
|
2717
|
-
* to the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
2718
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
2719
|
-
*/
|
|
2720
1468
|
type UseDexDepositVars<K extends SpokeChainKey = SpokeChainKey> = Omit<AssetDepositAction<K, false>, 'raw'>;
|
|
2721
|
-
/**
|
|
2722
|
-
* React hook for depositing an asset into a DEX pool.
|
|
2723
|
-
*
|
|
2724
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2725
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2726
|
-
*
|
|
2727
|
-
* @example
|
|
2728
|
-
* ```tsx
|
|
2729
|
-
* const walletProvider = useWalletProvider({ xChainId: chainKey });
|
|
2730
|
-
* const { mutateAsync: deposit } = useDexDeposit();
|
|
2731
|
-
* try {
|
|
2732
|
-
* const { spokeTxHash, hubTxHash } = await deposit({ params, walletProvider });
|
|
2733
|
-
* } catch (e) {
|
|
2734
|
-
* // surfaced via mutation.error / onError
|
|
2735
|
-
* }
|
|
2736
|
-
* ```
|
|
2737
|
-
*/
|
|
1469
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
2738
1470
|
declare function useDexDeposit<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseDexDepositVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseDexDepositVars<K>>;
|
|
2739
1471
|
|
|
2740
|
-
/**
|
|
2741
|
-
* Mutation variables for {@link useDexWithdraw}. Generic over `K extends SpokeChainKey` (defaults
|
|
2742
|
-
* to the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
2743
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
2744
|
-
*/
|
|
2745
1472
|
type UseDexWithdrawVars<K extends SpokeChainKey = SpokeChainKey> = Omit<AssetWithdrawAction<K, false>, 'raw'>;
|
|
2746
|
-
/**
|
|
2747
|
-
* React hook for withdrawing an asset from a DEX pool.
|
|
2748
|
-
*
|
|
2749
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2750
|
-
* `onError`, `retry`). Returns the unwrapped {@link OutboundSettlement} on success: a tx pair, or
|
|
2751
|
-
* from Tron the relay's `trackingId` beside the destination tx.
|
|
2752
|
-
*/
|
|
1473
|
+
/** Throws on SDK failure; resolves to an {@link OutboundSettlement} (tx pair, or Tron relay `trackingId` + dst tx). */
|
|
2753
1474
|
declare function useDexWithdraw<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<OutboundSettlement<K>, UseDexWithdrawVars<K>>): SafeUseMutationResult<OutboundSettlement<K>, Error, UseDexWithdrawVars<K>>;
|
|
2754
1475
|
|
|
2755
1476
|
type UseDexAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, {
|
|
2756
1477
|
payload: CreateAssetDepositParams<K> | undefined;
|
|
2757
1478
|
}>;
|
|
2758
|
-
/**
|
|
2759
|
-
* React hook to check whether the user has approved sufficient token allowance (or established a
|
|
2760
|
-
* trustline, on Stellar) for a DEX deposit. Read-only — calls `assetService.isAllowanceValid`
|
|
2761
|
-
* with `raw: true` so no `walletProvider` is required.
|
|
2762
|
-
*/
|
|
1479
|
+
/** Read-only (`raw: true`), so no `walletProvider` is needed; covers Stellar trustlines too. */
|
|
2763
1480
|
declare function useDexAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseDexAllowanceParams<K>): UseQueryResult<boolean, Error>;
|
|
2764
1481
|
|
|
2765
|
-
/**
|
|
2766
|
-
* Mutation variables for {@link useDexApprove}. Generic over `K extends SpokeChainKey` (defaults
|
|
2767
|
-
* to the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
2768
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
2769
|
-
*/
|
|
2770
1482
|
type UseDexApproveVars<K extends SpokeChainKey = SpokeChainKey> = Omit<AssetDepositAction<K, false>, 'raw'>;
|
|
2771
|
-
/**
|
|
2772
|
-
* React hook for approving ERC-20 token spending (or trustline establishment) for a DEX deposit.
|
|
2773
|
-
*
|
|
2774
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2775
|
-
* `onError`, `retry`). Returns the unwrapped tx return value on success.
|
|
2776
|
-
*/
|
|
1483
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped tx return value. */
|
|
2777
1484
|
declare function useDexApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseDexApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseDexApproveVars<K>>;
|
|
2778
1485
|
|
|
2779
1486
|
type UseLiquidityAmountsResult = {
|
|
@@ -2785,10 +1492,7 @@ type UseLiquidityAmountsResult = {
|
|
|
2785
1492
|
handleToken0AmountChange: (value: string) => void;
|
|
2786
1493
|
handleToken1AmountChange: (value: string) => void;
|
|
2787
1494
|
};
|
|
2788
|
-
/**
|
|
2789
|
-
* Hook for calculating concentrated-liquidity amounts based on the price range. Pure state +
|
|
2790
|
-
* math; no SDK calls beyond the static {@link ClService} helpers.
|
|
2791
|
-
*/
|
|
1495
|
+
/** Pure state + math; no SDK calls beyond the static {@link ClService} helpers. */
|
|
2792
1496
|
declare function useLiquidityAmounts(minPrice: string, maxPrice: string, poolData: PoolData | null): UseLiquidityAmountsResult;
|
|
2793
1497
|
|
|
2794
1498
|
type UseCreateSupplyLiquidityParamsProps = {
|
|
@@ -2802,29 +1506,14 @@ type UseCreateSupplyLiquidityParamsProps = {
|
|
|
2802
1506
|
positionId?: string | null;
|
|
2803
1507
|
isValidPosition?: boolean;
|
|
2804
1508
|
};
|
|
2805
|
-
/**
|
|
2806
|
-
* Subset of {@link ClSupplyParams} / {@link ClIncreaseLiquidityParams} produced by
|
|
2807
|
-
* {@link useCreateSupplyLiquidityParams}. Callers add `srcChainKey` + `srcAddress` at the mutation
|
|
2808
|
-
* call site. `tokenId` and `isValidPosition` distinguish the mint-new vs increase-existing path.
|
|
2809
|
-
*/
|
|
1509
|
+
/** `tokenId` + `isValidPosition` select increase-existing over mint-new; callers add `srcChainKey` + `srcAddress`. */
|
|
2810
1510
|
type UseCreateSupplyLiquidityParamsResult = Omit<ClSupplyParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress'> & Omit<ClIncreaseLiquidityParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress' | 'tokenId'> & {
|
|
2811
1511
|
tokenId?: string | bigint;
|
|
2812
1512
|
positionId?: string | null;
|
|
2813
1513
|
isValidPosition?: boolean;
|
|
2814
1514
|
};
|
|
2815
|
-
/**
|
|
2816
|
-
* React hook to memoize concentrated-liquidity supply parameters for a given pool. Returns the
|
|
2817
|
-
* pool/tick/liquidity/amount fields without `srcChainKey`/`srcAddress` — callers add those at the
|
|
2818
|
-
* mutation call site.
|
|
2819
|
-
*/
|
|
2820
1515
|
declare function useCreateSupplyLiquidityParams({ poolData, poolKey, minPrice, maxPrice, liquidityToken0Amount, liquidityToken1Amount, slippageTolerance, positionId, isValidPosition, }: UseCreateSupplyLiquidityParamsProps): UseCreateSupplyLiquidityParamsResult;
|
|
2821
1516
|
|
|
2822
|
-
/**
|
|
2823
|
-
* Mutation variables for {@link useSupplyLiquidity}. Generic over `K extends SpokeChainKey`
|
|
2824
|
-
* (defaults to the full union). The hook fans out internally to either
|
|
2825
|
-
* `clService.increaseLiquidity` (when `params.tokenId` + `params.isValidPosition` are present) or
|
|
2826
|
-
* `clService.supplyLiquidity` (mint a new position).
|
|
2827
|
-
*/
|
|
2828
1517
|
type UseSupplyLiquidityVars<K extends SpokeChainKey = SpokeChainKey> = {
|
|
2829
1518
|
params: UseCreateSupplyLiquidityParamsResult & {
|
|
2830
1519
|
srcChainKey: K;
|
|
@@ -2834,44 +1523,18 @@ type UseSupplyLiquidityVars<K extends SpokeChainKey = SpokeChainKey> = {
|
|
|
2834
1523
|
/** Optional relay timeout in ms (default 60_000) */
|
|
2835
1524
|
timeout?: number;
|
|
2836
1525
|
};
|
|
2837
|
-
/**
|
|
2838
|
-
* React hook for supplying liquidity to a concentrated-liquidity pool. If the input vars include a
|
|
2839
|
-
* valid `tokenId` for an existing position, the hook calls `increaseLiquidity`; otherwise it mints
|
|
2840
|
-
* a new position via `supplyLiquidity`.
|
|
2841
|
-
*
|
|
2842
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2843
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2844
|
-
*/
|
|
1526
|
+
/** Calls `increaseLiquidity` when vars carry a valid `tokenId`, else mints via `supplyLiquidity`. Throws on SDK failure. */
|
|
2845
1527
|
declare function useSupplyLiquidity<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseSupplyLiquidityVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseSupplyLiquidityVars<K>>;
|
|
2846
1528
|
|
|
2847
|
-
/**
|
|
2848
|
-
* Mutation variables for {@link useDecreaseLiquidity}. Generic over `K extends SpokeChainKey`
|
|
2849
|
-
* (defaults to the full union). Sophisticated callers can lock K at the hook call site to narrow
|
|
2850
|
-
* the `walletProvider` and `params.srcChainKey` types.
|
|
2851
|
-
*/
|
|
2852
1529
|
type UseDecreaseLiquidityVars<K extends SpokeChainKey = SpokeChainKey> = Omit<ClLiquidityDecreaseLiquidityAction<K, false>, 'raw'>;
|
|
2853
|
-
/**
|
|
2854
|
-
* React hook for decreasing liquidity in an existing concentrated-liquidity position.
|
|
2855
|
-
*
|
|
2856
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2857
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2858
|
-
*/
|
|
1530
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
2859
1531
|
declare function useDecreaseLiquidity<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseDecreaseLiquidityVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseDecreaseLiquidityVars<K>>;
|
|
2860
1532
|
|
|
2861
|
-
/**
|
|
2862
|
-
* Subset of {@link CreateAssetDepositParams} produced by {@link createDepositParamsProps}.
|
|
2863
|
-
* Callers add `srcChainKey` + `srcAddress` at the mutation call site.
|
|
2864
|
-
*/
|
|
1533
|
+
/** Callers add `srcChainKey` + `srcAddress` at the mutation call site. */
|
|
2865
1534
|
type DepositParamsCore = Omit<CreateAssetDepositParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress'>;
|
|
2866
|
-
/**
|
|
2867
|
-
* Subset of {@link CreateAssetWithdrawParams} produced by {@link createWithdrawParamsProps}.
|
|
2868
|
-
* Callers add `srcChainKey` + `srcAddress` at the mutation call site.
|
|
2869
|
-
*/
|
|
1535
|
+
/** Callers add `srcChainKey` + `srcAddress` at the mutation call site. */
|
|
2870
1536
|
type WithdrawParamsCore = Omit<CreateAssetWithdrawParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress'>;
|
|
2871
|
-
/**
|
|
2872
|
-
* Subset of {@link ClDecreaseLiquidityParams} produced by {@link createDecreaseLiquidityParamsProps}.
|
|
2873
|
-
* Callers add `srcChainKey` + `srcAddress` at the mutation call site.
|
|
2874
|
-
*/
|
|
1537
|
+
/** Callers add `srcChainKey` + `srcAddress` at the mutation call site. */
|
|
2875
1538
|
type DecreaseLiquidityParamsCore = Omit<ClDecreaseLiquidityParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress'>;
|
|
2876
1539
|
declare function createDecreaseLiquidityParamsProps({ poolKey, tokenId, percentage, positionInfo, slippageTolerance, }: UseCreateDecreaseLiquidityParamsProps): DecreaseLiquidityParamsCore;
|
|
2877
1540
|
declare function createDepositParamsProps({ tokenIndex, amount, poolData, poolSpokeAssets, }: UseCreateDepositParamsProps): DepositParamsCore;
|
|
@@ -2884,11 +1547,7 @@ type UseCreateDepositParamsProps = {
|
|
|
2884
1547
|
poolData: PoolData;
|
|
2885
1548
|
poolSpokeAssets: PoolSpokeAssets;
|
|
2886
1549
|
};
|
|
2887
|
-
/**
|
|
2888
|
-
* React hook to memoize the deposit-specific subset of {@link CreateAssetDepositParams}
|
|
2889
|
-
* (`{ asset, amount, poolToken, dst? }`). Callers add `srcChainKey` + `srcAddress` at the mutation
|
|
2890
|
-
* call site.
|
|
2891
|
-
*/
|
|
1550
|
+
/** Memoizes the deposit fields; callers add `srcChainKey` + `srcAddress` at mutation time. */
|
|
2892
1551
|
declare function useCreateDepositParams({ tokenIndex, amount, poolData, poolSpokeAssets, }: UseCreateDepositParamsProps): DepositParamsCore | undefined;
|
|
2893
1552
|
|
|
2894
1553
|
type UseCreateDecreaseLiquidityParamsProps = {
|
|
@@ -2898,11 +1557,7 @@ type UseCreateDecreaseLiquidityParamsProps = {
|
|
|
2898
1557
|
positionInfo: ClPositionInfo;
|
|
2899
1558
|
slippageTolerance: string | number;
|
|
2900
1559
|
};
|
|
2901
|
-
/**
|
|
2902
|
-
* React hook to memoize the decrease-liquidity-specific subset of {@link ClDecreaseLiquidityParams}
|
|
2903
|
-
* (`{ poolKey, tokenId, liquidity, amount0Min, amount1Min }`). Callers add `srcChainKey` +
|
|
2904
|
-
* `srcAddress` at the mutation call site.
|
|
2905
|
-
*/
|
|
1560
|
+
/** Memoizes the decrease-liquidity fields; callers add `srcChainKey` + `srcAddress` at mutation time. */
|
|
2906
1561
|
declare function useCreateDecreaseLiquidityParams({ poolKey, tokenId, percentage, positionInfo, slippageTolerance, }: UseCreateDecreaseLiquidityParamsProps): DecreaseLiquidityParamsCore;
|
|
2907
1562
|
|
|
2908
1563
|
type UseCreateWithdrawParamsProps = {
|
|
@@ -2912,32 +1567,13 @@ type UseCreateWithdrawParamsProps = {
|
|
|
2912
1567
|
poolSpokeAssets: PoolSpokeAssets;
|
|
2913
1568
|
dst?: DestinationParamsType;
|
|
2914
1569
|
};
|
|
2915
|
-
/**
|
|
2916
|
-
* React hook to memoize the withdraw-specific subset of {@link CreateAssetWithdrawParams}
|
|
2917
|
-
* (`{ asset, amount, poolToken, dst? }`). Callers add `srcChainKey` + `srcAddress` at the mutation
|
|
2918
|
-
* call site.
|
|
2919
|
-
*/
|
|
1570
|
+
/** Memoizes the withdraw fields; callers add `srcChainKey` + `srcAddress` at mutation time. */
|
|
2920
1571
|
declare function useCreateWithdrawParams({ tokenIndex, amount, poolData, poolSpokeAssets, dst, }: UseCreateWithdrawParamsProps): WithdrawParamsCore | undefined;
|
|
2921
1572
|
|
|
2922
|
-
/**
|
|
2923
|
-
* Mutation variables for {@link useClaimRewards}. Generic over `K extends SpokeChainKey` (defaults
|
|
2924
|
-
* to the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
2925
|
-
* `walletProvider` and `params.srcChainKey` types.
|
|
2926
|
-
*/
|
|
2927
1573
|
type UseClaimRewardsVars<K extends SpokeChainKey = SpokeChainKey> = Omit<ClLiquidityClaimRewardsAction<K, false>, 'raw'>;
|
|
2928
|
-
/**
|
|
2929
|
-
* React hook for claiming accrued fees on a concentrated-liquidity position.
|
|
2930
|
-
*
|
|
2931
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
2932
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
2933
|
-
*/
|
|
1574
|
+
/** Throws on SDK failure (React Query error state); resolves to the unwrapped `TxHashPair`. */
|
|
2934
1575
|
declare function useClaimRewards<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseClaimRewardsVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseClaimRewardsVars<K>>;
|
|
2935
1576
|
|
|
2936
|
-
/**
|
|
2937
|
-
* Derived from the SDK method rather than restated, so the public error union
|
|
2938
|
-
* (`SolverErrorResponse | LeverageYieldLookupError`) stays exact and cannot drift.
|
|
2939
|
-
* `undefined` is the disabled state, before a `payload` exists.
|
|
2940
|
-
*/
|
|
2941
1577
|
type LeverageYieldQuote = Awaited<ReturnType<Sodax['leverageYield']['getQuote']>> | undefined;
|
|
2942
1578
|
type UseLeverageYieldQuoteParams = ReadHookParams<LeverageYieldQuote, {
|
|
2943
1579
|
payload: LeverageYieldQuoteParams | undefined;
|
|
@@ -2967,118 +1603,41 @@ declare function getLeverageYieldQuoteQueryOptions({ sodax, payload, }: {
|
|
|
2967
1603
|
refetchInterval: number;
|
|
2968
1604
|
};
|
|
2969
1605
|
/**
|
|
2970
|
-
*
|
|
2971
|
-
*
|
|
2972
|
-
* `quoted_amount` to size `minOutputAmount`.
|
|
2973
|
-
*
|
|
2974
|
-
* Use this rather than {@link useQuote}: the swap quote deducts the effective *swap* fee, while a
|
|
2975
|
-
* vault intent charges the effective *leverage-yield* fee, so the two disagree whenever the feature
|
|
2976
|
-
* fees differ. When overriding the fee per intent, pass the same `partnerFee` here and to whichever
|
|
2977
|
-
* builder you use — `useLeverageYieldDeposit`, `useLeverageYieldWithdraw`, or
|
|
2978
|
-
* `useLeverageYieldVaultSwap` — or omit it on all of them, which resolves the same configured fee on
|
|
2979
|
-
* each side. Both directions are charged, so this applies to withdrawals as much as deposits.
|
|
2980
|
-
*
|
|
2981
|
-
* Returns the SDK `Result` as query data rather than unwrapping it, matching {@link useQuote}: a
|
|
2982
|
-
* quote failure ("no path", thin liquidity) is an expected UI branch, and keeping the `Result`
|
|
2983
|
-
* preserves the solver's `detail.code` instead of flattening it to an error message.
|
|
2984
|
-
*
|
|
2985
|
-
* @example
|
|
2986
|
-
* ```typescript
|
|
2987
|
-
* const { data: quote } = useLeverageYieldQuote({
|
|
2988
|
-
* params: {
|
|
2989
|
-
* payload: {
|
|
2990
|
-
* token_src: inputToken,
|
|
2991
|
-
* token_src_blockchain_id: ChainKeys.ARBITRUM_MAINNET,
|
|
2992
|
-
* token_dst: vault.vault,
|
|
2993
|
-
* token_dst_blockchain_id: ChainKeys.SONIC_MAINNET,
|
|
2994
|
-
* amount: parseUnits('1', 18),
|
|
2995
|
-
* quote_type: 'exact_input',
|
|
2996
|
-
* },
|
|
2997
|
-
* },
|
|
2998
|
-
* });
|
|
2999
|
-
* if (quote?.ok) setMinOutput((quote.value.quoted_amount * 9_950n) / 10_000n);
|
|
3000
|
-
* ```
|
|
3001
|
-
*
|
|
3002
|
-
* @remarks
|
|
3003
|
-
* - Refreshes every 3 seconds, like `useQuote` — solver prices go stale.
|
|
3004
|
-
* - Disabled while `payload` is undefined.
|
|
1606
|
+
* Vault deposit (vault as `token_dst`) or withdraw (as `token_src`) quote, priced on the leverage-yield fee, unlike {@link useQuote}.
|
|
1607
|
+
* Pass the same `partnerFee` here as to the builder (or omit on both). Returns the SDK `Result` as data.
|
|
3005
1608
|
*/
|
|
3006
1609
|
declare function useLeverageYieldQuote({ params, queryOptions, }?: UseLeverageYieldQuoteParams): UseQueryResult<LeverageYieldQuote, Error>;
|
|
3007
1610
|
|
|
3008
1611
|
type UseLeverageYieldEffectiveAprParams = ReadHookParams<LeverageYieldEffectiveApr, {
|
|
3009
1612
|
vault: Address$1 | undefined;
|
|
3010
1613
|
}>;
|
|
3011
|
-
/**
|
|
3012
|
-
* Reads a leverage-yield vault's effective APR — AAVE supply/borrow rates plus the LSD
|
|
3013
|
-
* staking yield, with the vault's leverage formula re-applied on the boosted supply side.
|
|
3014
|
-
*
|
|
3015
|
-
* The underlying SDK call does the on-chain reads (AAVE rates + `targetLTV`) and the
|
|
3016
|
-
* off-chain LSD fetch in parallel. Rates drift slowly, so the default refresh is 60s.
|
|
3017
|
-
*
|
|
3018
|
-
* @example
|
|
3019
|
-
* ```typescript
|
|
3020
|
-
* const { data: apr } = useLeverageYieldEffectiveApr({ params: { vault: vault.vault } });
|
|
3021
|
-
* ```
|
|
3022
|
-
*/
|
|
1614
|
+
/** Vault APR: AAVE supply/borrow rates plus LSD staking yield, with the vault's leverage applied. */
|
|
3023
1615
|
declare function useLeverageYieldEffectiveApr({ params, queryOptions, }?: UseLeverageYieldEffectiveAprParams): UseQueryResult<LeverageYieldEffectiveApr, Error>;
|
|
3024
1616
|
|
|
3025
1617
|
type UseLeverageYieldPositionParams = ReadHookParams<LeverageYieldPosition, {
|
|
3026
1618
|
vault: Address$1 | undefined;
|
|
3027
1619
|
}>;
|
|
3028
|
-
/**
|
|
3029
|
-
* Reads a leverage-yield vault's live position snapshot via the vault's `getPositionDetails`:
|
|
3030
|
-
* collateral, debt, current LTV (drift vs `targetLTV`), health factor (∞ when no debt), and
|
|
3031
|
-
* idle (not-yet-deployed) asset.
|
|
3032
|
-
*
|
|
3033
|
-
* LTV shifts with each rebalance/rate tick, so the default refresh (30s) is faster than the
|
|
3034
|
-
* APR/stats reads.
|
|
3035
|
-
*
|
|
3036
|
-
* @example
|
|
3037
|
-
* ```typescript
|
|
3038
|
-
* const { data: position } = useLeverageYieldPosition({ params: { vault: vault.vault } });
|
|
3039
|
-
* ```
|
|
3040
|
-
*/
|
|
1620
|
+
/** Vault position snapshot (`getPositionDetails`); health factor is ∞ when there is no debt. */
|
|
3041
1621
|
declare function useLeverageYieldPosition({ params, queryOptions, }?: UseLeverageYieldPositionParams): UseQueryResult<LeverageYieldPosition, Error>;
|
|
3042
1622
|
|
|
3043
1623
|
type UseLeverageYieldTotalAssetsParams = ReadHookParams<bigint, {
|
|
3044
1624
|
vault: Address$1 | undefined;
|
|
3045
1625
|
}>;
|
|
3046
|
-
/**
|
|
3047
|
-
* Reads a leverage-yield vault's total underlying assets (vault-asset units, 18 decimals) —
|
|
3048
|
-
* i.e. its TVL. Moves slowly, so the default refresh is 60s.
|
|
3049
|
-
*
|
|
3050
|
-
* @example
|
|
3051
|
-
* ```typescript
|
|
3052
|
-
* const { data: tvl } = useLeverageYieldTotalAssets({ params: { vault: vault.vault } });
|
|
3053
|
-
* ```
|
|
3054
|
-
*/
|
|
1626
|
+
/** Vault TVL in vault-asset units (18 decimals). */
|
|
3055
1627
|
declare function useLeverageYieldTotalAssets({ params, queryOptions, }?: UseLeverageYieldTotalAssetsParams): UseQueryResult<bigint, Error>;
|
|
3056
1628
|
|
|
3057
1629
|
type UseLeverageYieldPreviewRedeemParams = ReadHookParams<bigint, {
|
|
3058
1630
|
vault: Address$1 | undefined;
|
|
3059
1631
|
shares: bigint | undefined;
|
|
3060
1632
|
}>;
|
|
3061
|
-
/**
|
|
3062
|
-
* Reads the assets received for redeeming `shares` of a leverage-yield vault (ERC-4626
|
|
3063
|
-
* `previewRedeem`). Passing `10n ** 18n` (one share) yields the per-share price that creeps
|
|
3064
|
-
* up as the vault accrues interest. Moves slowly, so the default refresh is 60s.
|
|
3065
|
-
*
|
|
3066
|
-
* @example
|
|
3067
|
-
* ```typescript
|
|
3068
|
-
* const { data: sharePrice } = useLeverageYieldPreviewRedeem({
|
|
3069
|
-
* params: { vault: vault.vault, shares: 10n ** 18n },
|
|
3070
|
-
* });
|
|
3071
|
-
* ```
|
|
3072
|
-
*/
|
|
1633
|
+
/** ERC-4626 `previewRedeem`; pass `10n ** 18n` (one share) for the per-share price. */
|
|
3073
1634
|
declare function useLeverageYieldPreviewRedeem({ params, queryOptions, }?: UseLeverageYieldPreviewRedeemParams): UseQueryResult<bigint, Error>;
|
|
3074
1635
|
|
|
3075
|
-
/** A single `(chain, hub-wallet holder, share balance)` row produced by {@link useLeverageYieldShareBalances}. */
|
|
3076
1636
|
type LeverageYieldShareHolding = {
|
|
3077
1637
|
chainKey: SpokeChainKey;
|
|
3078
1638
|
holder: Address$1;
|
|
3079
1639
|
shares: bigint;
|
|
3080
1640
|
};
|
|
3081
|
-
/** A `(chainKey, EOA address)` pair the user controls — one per spoke chain they may hold shares under. */
|
|
3082
1641
|
type LeverageYieldShareHolder = {
|
|
3083
1642
|
chainKey: SpokeChainKey;
|
|
3084
1643
|
address: string;
|
|
@@ -3087,64 +1646,15 @@ type UseLeverageYieldShareBalancesParams = ReadHookParams<LeverageYieldShareHold
|
|
|
3087
1646
|
vault: Address$1 | undefined;
|
|
3088
1647
|
holders: readonly LeverageYieldShareHolder[] | undefined;
|
|
3089
1648
|
}>;
|
|
3090
|
-
/**
|
|
3091
|
-
* Reads a user's leverage-vault share (`lsoda*`) balances across every chain they may hold a
|
|
3092
|
-
* position under — one query per holder, fanned out via `useQueries`.
|
|
3093
|
-
*
|
|
3094
|
-
* For each `(chainKey, address)` the holder is resolved to the address that actually owns the
|
|
3095
|
-
* shares: the user's **derived hub wallet** on every chain, including the hub itself. Leverage
|
|
3096
|
-
* deposits always deliver `lsoda*` to `getUserHubWalletAddress(srcAddress, srcChainKey)` (the
|
|
3097
|
-
* CREATE3 user-router on Sonic for a hub-sourced deposit, the per-spoke hub wallet otherwise) —
|
|
3098
|
-
* never the bare EOA — so a hub-chain deposit's shares live in the router, not the signing EOA.
|
|
3099
|
-
* Resolving the holder the same way the deposit does is what makes a Sonic-sourced position show
|
|
3100
|
-
* up here instead of reading a stale zero off the EOA.
|
|
3101
|
-
*
|
|
3102
|
-
* Returns the raw `useQueries` result array (15s refresh per query); callers aggregate as needed
|
|
3103
|
-
* (e.g. sum `shares` for a headline total, or pick the row for the active chain).
|
|
3104
|
-
*
|
|
3105
|
-
* `useQueries` has no top-level options slot, so `queryOptions` is spread into every individual
|
|
3106
|
-
* query config (and applies uniformly to each holder's query).
|
|
3107
|
-
*
|
|
3108
|
-
* @example
|
|
3109
|
-
* ```typescript
|
|
3110
|
-
* const balances = useLeverageYieldShareBalances({ params: { vault: vault.vault, holders } });
|
|
3111
|
-
* const total = balances.reduce((acc, q) => acc + (q.data?.shares ?? 0n), 0n);
|
|
3112
|
-
* ```
|
|
3113
|
-
*/
|
|
1649
|
+
/** One `lsoda*` share-balance query per `(chainKey, EOA)` holder; `queryOptions` applies to each query. */
|
|
3114
1650
|
declare function useLeverageYieldShareBalances({ params, queryOptions, }?: UseLeverageYieldShareBalancesParams): UseQueryResult<LeverageYieldShareHolding, Error>[];
|
|
3115
1651
|
|
|
3116
|
-
/** Mutation variables for {@link useLeverageYieldDeposit} — the swap-style deposit inputs. */
|
|
3117
1652
|
type UseLeverageYieldDepositVars = LeverageYieldSwapDepositParams;
|
|
3118
|
-
/**
|
|
3119
|
-
* Builds the `LeverageYieldSwapPayload` for a leverage-yield deposit (any token → `lsoda*` shares,
|
|
3120
|
-
* delivered to the user's hub wallet). Spread the returned payload into
|
|
3121
|
-
* {@link useLeverageYieldVaultSwap}.
|
|
3122
|
-
*
|
|
3123
|
-
* This is a builder, not an executor — it derives the hub wallet and assembles the intent; the
|
|
3124
|
-
* actual swap is relayed by `useLeverageYieldVaultSwap`. Throws on SDK failure so React Query's
|
|
3125
|
-
* error model engages; returns the unwrapped `LeverageYieldSwapPayload` on success.
|
|
3126
|
-
*
|
|
3127
|
-
* @example
|
|
3128
|
-
* ```typescript
|
|
3129
|
-
* const { mutateAsyncSafe: buildDeposit } = useLeverageYieldDeposit();
|
|
3130
|
-
* const built = await buildDeposit({ vault, srcChainKey, srcAddress, inputToken, inputAmount, minOutputAmount });
|
|
3131
|
-
* if (built.ok) vaultSwap({ ...built.value, walletProvider });
|
|
3132
|
-
* ```
|
|
3133
|
-
*/
|
|
1653
|
+
/** Builds (does not execute) a deposit payload; spread it into {@link useLeverageYieldVaultSwap}. */
|
|
3134
1654
|
declare function useLeverageYieldDeposit({ mutationOptions, }?: MutationHookParams<LeverageYieldSwapPayload, UseLeverageYieldDepositVars>): SafeUseMutationResult<LeverageYieldSwapPayload, Error, UseLeverageYieldDepositVars>;
|
|
3135
1655
|
|
|
3136
|
-
/** Mutation variables for {@link useLeverageYieldNotifySolver} — the hub-side intent tx hash. */
|
|
3137
1656
|
type UseLeverageYieldNotifySolverVars = SolverExecutionRequest;
|
|
3138
|
-
/**
|
|
3139
|
-
* Notifies the solver that a leverage-yield vault intent landed on the hub, triggering the fill.
|
|
3140
|
-
* The standalone notify step for the manual create → relay → notify flow: build the intent with
|
|
3141
|
-
* `sodax.leverageYield.createVaultIntent`, relay it yourself, then call this with the hub-side
|
|
3142
|
-
* intent tx hash. The end-to-end {@link useLeverageYieldVaultSwap} already calls notifySolver
|
|
3143
|
-
* internally — only reach for this hook when driving the relay manually.
|
|
3144
|
-
*
|
|
3145
|
-
* Throws on SDK failure so React Query's error model engages; returns the unwrapped
|
|
3146
|
-
* `SolverExecutionResponse` (`{ answer: 'OK', intent_hash }`) on success.
|
|
3147
|
-
*/
|
|
1657
|
+
/** Manual-relay notify step with the hub-side intent tx hash; {@link useLeverageYieldVaultSwap} already does this. */
|
|
3148
1658
|
declare function useLeverageYieldNotifySolver({ mutationOptions, }?: MutationHookParams<SolverExecutionResponse, UseLeverageYieldNotifySolverVars>): SafeUseMutationResult<SolverExecutionResponse, Error, UseLeverageYieldNotifySolverVars>;
|
|
3149
1659
|
|
|
3150
1660
|
type UseLeverageYieldDetailedStatusResult = Result<DetailedLeverageYieldStatus, LeverageYieldDetailedStatusError> | undefined;
|
|
@@ -3154,149 +1664,53 @@ type UseLeverageYieldDetailedStatusParams = ReadHookParams<UseLeverageYieldDetai
|
|
|
3154
1664
|
apiConfig?: RequestOverrideConfig;
|
|
3155
1665
|
}>;
|
|
3156
1666
|
/**
|
|
3157
|
-
*
|
|
3158
|
-
*
|
|
3159
|
-
* `useLeverageYieldApiSubmitTxStatus` needs the backend to still hold a usable record; this takes
|
|
3160
|
-
* `(srcChainKey, srcTxHash)` — the pair you hold after `vaultSwap()` — and routes to whichever
|
|
3161
|
-
* source can answer, so it also covers a vault swap the client-side fallback completed. `data.value`
|
|
3162
|
-
* is discriminated on `source`, and each variant carries that source's payload unmodified.
|
|
3163
|
-
*
|
|
3164
|
-
* Polls every 3s. Stops once the answering source is terminal, once the backend rejects the API
|
|
3165
|
-
* key, and — like `useDetailedStatus` — after 40 consecutive *ambiguous* reads: a solver
|
|
3166
|
-
* `NOT_FOUND`, or a `LOOKUP_FAILED` whose relay has no packet for the tx. Neither can distinguish "still in flight" from "never will be", so the
|
|
3167
|
-
* budget is what stops a vault swap nothing can resolve. A dependency outage — relay unreachable,
|
|
3168
|
-
* solver down — keeps polling instead, so the read recovers by itself; any real status resets the
|
|
3169
|
-
* budget. Override with `queryOptions.refetchInterval`.
|
|
3170
|
-
*
|
|
3171
|
-
* @example
|
|
3172
|
-
* ```typescript
|
|
3173
|
-
* const { data } = useLeverageYieldDetailedStatus({ params: { srcChainKey, srcTxHash } });
|
|
3174
|
-
* if (data?.ok && data.value.source === 'backend') console.log(data.value.data.status);
|
|
3175
|
-
* ```
|
|
1667
|
+
* Vault-swap status from `(srcChainKey, srcTxHash)`, routed to whichever source can answer. Polls until terminal,
|
|
1668
|
+
* auth rejection, or 40 consecutive ambiguous reads (solver NOT_FOUND / relay not delivered); outages keep polling.
|
|
3176
1669
|
*/
|
|
3177
1670
|
declare const useLeverageYieldDetailedStatus: ({ params, queryOptions, }?: UseLeverageYieldDetailedStatusParams) => UseQueryResult<UseLeverageYieldDetailedStatusResult>;
|
|
3178
1671
|
|
|
3179
|
-
/**
|
|
3180
|
-
* Mutation variables for {@link useLeverageYieldVaultSwap}. Generic over `K extends SpokeChainKey`
|
|
3181
|
-
* (defaults to the full union). Sophisticated callers can lock K at the hook call site to narrow
|
|
3182
|
-
* the `walletProvider` and `params.srcChainKey` types.
|
|
3183
|
-
*/
|
|
3184
1672
|
type UseLeverageYieldVaultSwapVars<K extends SpokeChainKey = SpokeChainKey> = Omit<VaultSwapActionParams<K, false>, 'raw'>;
|
|
3185
1673
|
/**
|
|
3186
|
-
*
|
|
3187
|
-
*
|
|
3188
|
-
* Spread a `LeverageYieldSwapPayload` built by {@link useLeverageYieldDeposit} /
|
|
3189
|
-
* {@link useLeverageYieldWithdraw} into `mutate` alongside the wallet provider:
|
|
3190
|
-
* `vaultSwap({ ...payload, walletProvider })`. Runs `sodax.leverageYield.vaultSwap`, so vault flows
|
|
3191
|
-
* never touch the generic swap surface.
|
|
3192
|
-
*
|
|
3193
|
-
* Which transport it takes is config, not an argument. With `leverageYield.useBackendSubmitTx` on,
|
|
3194
|
-
* it creates the intent and hands the broadcast tx to the leverage-yield API, which relays and
|
|
3195
|
-
* post-executes server-side, falling back to the client-side path (verify → relay → notify solver)
|
|
3196
|
-
* on any non-success. With it off, that client-side path runs outright. Read the effective value on
|
|
3197
|
-
* `sodax.config.leverageYieldUseBackendSubmitTx` rather than assuming which way it points.
|
|
3198
|
-
* Either way the resolved value is the same `VaultSwapResponse`.
|
|
3199
|
-
*
|
|
3200
|
-
* Pass `extras.apiKey` to key the backend leg per action, overriding the instance key. Poll the
|
|
3201
|
-
* result with {@link useLeverageYieldDetailedStatus}, which reads a vault swap's status from the
|
|
3202
|
-
* source-chain tx hash whichever transport completed it.
|
|
3203
|
-
*
|
|
3204
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
3205
|
-
* `onError`, `retry`). Returns the unwrapped `VaultSwapResponse` on success.
|
|
1674
|
+
* Executes a vault swap from a {@link useLeverageYieldDeposit} / {@link useLeverageYieldWithdraw} payload; transport
|
|
1675
|
+
* (backend submit with client fallback, or client-only) follows `sodax.config.leverageYieldUseBackendSubmitTx`.
|
|
3206
1676
|
*/
|
|
3207
1677
|
declare function useLeverageYieldVaultSwap<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<VaultSwapResponse, UseLeverageYieldVaultSwapVars<K>>): SafeUseMutationResult<VaultSwapResponse, Error, UseLeverageYieldVaultSwapVars<K>>;
|
|
3208
1678
|
|
|
3209
|
-
/**
|
|
3210
|
-
* Mutation variables for {@link useLeverageYieldVaultSwapWithApproval}: `useLeverageYieldVaultSwap`'s, plus
|
|
3211
|
-
* `allowAccountUpgrade`, `resumeBatchId` and `resumeBatchCallCount`.
|
|
3212
|
-
*/
|
|
3213
1679
|
type UseLeverageYieldVaultSwapWithApprovalVars<K extends SpokeChainKey = SpokeChainKey> = Omit<VaultSwapWithApprovalParams<K>, 'raw'>;
|
|
3214
1680
|
/**
|
|
3215
|
-
* `useLeverageYieldVaultSwap` with the deposit
|
|
3216
|
-
* (`sodax.leverageYield.vaultSwapWithApproval`): approve + deposit as one EIP-5792 batch (one
|
|
3217
|
-
* signature) on a batch-capable EVM wallet, otherwise approve, wait for it, then deposit. A withdraw
|
|
3218
|
-
* (`hubWalletSwap`) needs no approval and runs as `useLeverageYieldVaultSwap` does.
|
|
1681
|
+
* `useLeverageYieldVaultSwap` with the deposit approval folded in (EIP-5792 batch when supported, else sequential).
|
|
3219
1682
|
* `data.approvalStrategy` says which path ran; {@link useLeverageYieldApprovalStrategy} predicts it.
|
|
3220
|
-
*
|
|
3221
|
-
* Throws on SDK failure so React Query's error model engages. On success invalidates balances, the
|
|
3222
|
-
* deposit allowance (read through `useSwapAllowance`) and the approval-strategy query.
|
|
3223
1683
|
*/
|
|
3224
1684
|
declare function useLeverageYieldVaultSwapWithApproval<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<VaultSwapWithApprovalResponse, UseLeverageYieldVaultSwapWithApprovalVars<K>>): SafeUseMutationResult<VaultSwapWithApprovalResponse, Error, UseLeverageYieldVaultSwapWithApprovalVars<K>>;
|
|
3225
1685
|
|
|
3226
1686
|
type UseLeverageYieldApprovalStrategyParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<ApprovalStrategy, {
|
|
3227
|
-
/** The payload `useLeverageYieldDeposit` / `useLeverageYieldWithdraw` built. */
|
|
3228
1687
|
payload: LeverageYieldSwapPayload | undefined;
|
|
3229
1688
|
walletProvider: GetWalletProviderType<K> | undefined;
|
|
3230
1689
|
/** `false` keeps a wallet that would first ask to upgrade the account (EIP-5792 `'ready'`) off the batch path. Defaults to `true`. */
|
|
3231
1690
|
allowAccountUpgrade?: boolean;
|
|
3232
1691
|
}>;
|
|
3233
1692
|
/**
|
|
3234
|
-
* Which approval path {@link useLeverageYieldVaultSwapWithApproval} would take
|
|
3235
|
-
* (always for a withdraw), `'atomic-batch'` (approve + deposit in one EIP-5792 signature) or
|
|
3236
|
-
* `'sequential'` (approve, then deposit). Use it to label the deposit button. Pass the same
|
|
3237
|
-
* `allowAccountUpgrade` you give the vault swap.
|
|
3238
|
-
*
|
|
1693
|
+
* Which approval path {@link useLeverageYieldVaultSwapWithApproval} would take; pass it the same `allowAccountUpgrade`.
|
|
3239
1694
|
* Not polled: the vault swap invalidates it on success and re-reads the strategy at execution.
|
|
3240
1695
|
*/
|
|
3241
1696
|
declare function useLeverageYieldApprovalStrategy<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseLeverageYieldApprovalStrategyParams<K>): UseQueryResult<ApprovalStrategy, Error>;
|
|
3242
1697
|
|
|
3243
|
-
/** Mutation variables for {@link useLeverageYieldWithdraw} — the swap-style withdraw inputs. */
|
|
3244
1698
|
type UseLeverageYieldWithdrawVars = LeverageYieldSwapWithdrawParams;
|
|
3245
|
-
/**
|
|
3246
|
-
* Builds the `LeverageYieldSwapPayload` for a leverage-yield withdraw (`lsoda*` shares → any token).
|
|
3247
|
-
* The returned payload carries `hubWalletSwap: true`; spread it into
|
|
3248
|
-
* {@link useLeverageYieldVaultSwap}, which authorises the hub wallet to spend the shares via a
|
|
3249
|
-
* `Connection.sendMessage`.
|
|
3250
|
-
*
|
|
3251
|
-
* This is a builder, not an executor. Throws on SDK failure so React Query's error model engages;
|
|
3252
|
-
* returns the unwrapped `LeverageYieldSwapPayload` on success.
|
|
3253
|
-
*
|
|
3254
|
-
* @example
|
|
3255
|
-
* ```typescript
|
|
3256
|
-
* const { mutateAsyncSafe: buildWithdraw } = useLeverageYieldWithdraw();
|
|
3257
|
-
* const built = await buildWithdraw({ vault, srcChainKey, srcAddress, dstChainKey, outputToken, inputAmount, minOutputAmount });
|
|
3258
|
-
* if (built.ok) vaultSwap({ ...built.value, walletProvider });
|
|
3259
|
-
* ```
|
|
3260
|
-
*/
|
|
1699
|
+
/** Builds (does not execute) a withdraw payload with `hubWalletSwap: true`; spread it into {@link useLeverageYieldVaultSwap}. */
|
|
3261
1700
|
declare function useLeverageYieldWithdraw({ mutationOptions, }?: MutationHookParams<LeverageYieldSwapPayload, UseLeverageYieldWithdrawVars>): SafeUseMutationResult<LeverageYieldSwapPayload, Error, UseLeverageYieldWithdrawVars>;
|
|
3262
1701
|
|
|
3263
1702
|
type UseLeveragePositionsParams = ReadHookParams<readonly Address$1[], {
|
|
3264
1703
|
owner: Address$1 | undefined;
|
|
3265
1704
|
}>;
|
|
3266
|
-
/**
|
|
3267
|
-
* Lists the leverage-position clones owned by `owner`, in creation order.
|
|
3268
|
-
*
|
|
3269
|
-
* Positions are the unpooled counterpart to leverage-yield vaults: each is its own AAVE
|
|
3270
|
-
* account, so one owner can hold several at different eMode categories and leverage tiers.
|
|
3271
|
-
* There is no static registry — discovery goes through the factory.
|
|
3272
|
-
*
|
|
3273
|
-
* Requires `leverageYield.positionFactory` in the `Sodax` config; without it the underlying
|
|
3274
|
-
* SDK call fails with a lookup error rather than guessing an address.
|
|
3275
|
-
*
|
|
3276
|
-
* @example
|
|
3277
|
-
* ```typescript
|
|
3278
|
-
* const { data: positions } = useLeveragePositions({ params: { owner } });
|
|
3279
|
-
* ```
|
|
3280
|
-
*/
|
|
1705
|
+
/** Position clones owned by a hub `owner`, in creation order. Requires `leverageYield.positionFactory` in the Sodax config. */
|
|
3281
1706
|
declare function useLeveragePositions({ params, queryOptions, }?: UseLeveragePositionsParams): UseQueryResult<readonly Address$1[], Error>;
|
|
3282
1707
|
|
|
3283
1708
|
type UseLeveragePositionAccountParams = ReadHookParams<LeveragePositionAccount, {
|
|
3284
1709
|
position: Address$1 | undefined;
|
|
3285
1710
|
}>;
|
|
3286
1711
|
/**
|
|
3287
|
-
*
|
|
3288
|
-
*
|
|
3289
|
-
*
|
|
3290
|
-
* The figures come from the pool's `getUserAccountData`, not from the position contract,
|
|
3291
|
-
* which keeps no accounting of its own. Health factor is WAD (1e18); below 1e18 the position
|
|
3292
|
-
* is liquidatable, and there is no keeper deleveraging on the owner's behalf, so this is the
|
|
3293
|
-
* number a UI should surface most prominently. Debt accrues continuously, hence the 30s
|
|
3294
|
-
* default refresh.
|
|
3295
|
-
*
|
|
3296
|
-
* @example
|
|
3297
|
-
* ```typescript
|
|
3298
|
-
* const { data: account } = useLeveragePositionAccount({ params: { position } });
|
|
3299
|
-
* ```
|
|
1712
|
+
* Live AAVE account snapshot (pool `getUserAccountData`). Health factor is WAD; below 1e18 the position
|
|
1713
|
+
* is liquidatable with no keeper to deleverage it. Polled every 30s since debt accrues continuously.
|
|
3300
1714
|
*/
|
|
3301
1715
|
declare function useLeveragePositionAccount({ params, queryOptions, }?: UseLeveragePositionAccountParams): UseQueryResult<LeveragePositionAccount, Error>;
|
|
3302
1716
|
|
|
@@ -3305,60 +1719,23 @@ type UseLeveragePositionCollateralParams = ReadHookParams<LeveragePositionCollat
|
|
|
3305
1719
|
collateral?: Address$1;
|
|
3306
1720
|
}>;
|
|
3307
1721
|
/**
|
|
3308
|
-
*
|
|
3309
|
-
*
|
|
3310
|
-
* Use this, not `useLeveragePositionAccount().totalCollateralBase`, whenever an amount is going into
|
|
3311
|
-
* a transaction. The account snapshot is denominated in the oracle's base currency at 8 decimals, so
|
|
3312
|
-
* dividing it back out by a price gives an amount near the balance rather than the balance — and a
|
|
3313
|
-
* decrease-leverage call for more collateral than the position holds expires as an unfillable intent
|
|
3314
|
-
* instead of failing up front.
|
|
3315
|
-
*
|
|
3316
|
-
* @example
|
|
3317
|
-
* ```typescript
|
|
3318
|
-
* const { data: collateral } = useLeveragePositionCollateral({ params: { position } });
|
|
3319
|
-
* // collateral.balance is what a full exit sells
|
|
3320
|
-
* ```
|
|
1722
|
+
* Exact aToken collateral balance; use this (not the account snapshot's oracle-priced total) for transaction
|
|
1723
|
+
* amounts, since over-asking on decrease-leverage expires as an unfillable intent instead of failing up front.
|
|
3321
1724
|
*/
|
|
3322
1725
|
declare function useLeveragePositionCollateral({ params, queryOptions, }?: UseLeveragePositionCollateralParams): UseQueryResult<LeveragePositionCollateral, Error>;
|
|
3323
1726
|
|
|
3324
1727
|
type UseLeveragePositionInfoParams = ReadHookParams<LeveragePosition, {
|
|
3325
1728
|
position: Address$1 | undefined;
|
|
3326
1729
|
}>;
|
|
3327
|
-
/**
|
|
3328
|
-
* Reads a leverage position's static descriptor — owner, collateral, borrow token, and the
|
|
3329
|
-
* eMode category it was created with.
|
|
3330
|
-
*
|
|
3331
|
-
* All four are fixed at creation, so this never goes stale for a given position and is left
|
|
3332
|
-
* on the default cache behaviour rather than polled. Pair it with
|
|
3333
|
-
* `useLeveragePositionAccount` for the values that do move.
|
|
3334
|
-
*
|
|
3335
|
-
* @example
|
|
3336
|
-
* ```typescript
|
|
3337
|
-
* const { data: info } = useLeveragePositionInfo({ params: { position } });
|
|
3338
|
-
* ```
|
|
3339
|
-
*/
|
|
1730
|
+
/** A position's static descriptor (fixed at creation, so not polled); see `useLeveragePositionAccount` for live values. */
|
|
3340
1731
|
declare function useLeveragePositionInfo({ params, queryOptions, }?: UseLeveragePositionInfoParams): UseQueryResult<LeveragePosition, Error>;
|
|
3341
1732
|
|
|
3342
1733
|
type UseLeveragePositionPendingParams = ReadHookParams<LeveragePositionPendingState, {
|
|
3343
1734
|
position: Address$1 | undefined;
|
|
3344
1735
|
}>;
|
|
3345
1736
|
/**
|
|
3346
|
-
* A position's operation slot
|
|
3347
|
-
*
|
|
3348
|
-
*
|
|
3349
|
-
* Gate leverage controls on `isLive` — a position permits one intent at a time, so offering a button
|
|
3350
|
-
* that can only revert is worse than disabling it. Offer a settle on `needsSettle`: that is the state
|
|
3351
|
-
* where the intent is gone but the position still holds the grant and any contribution, and it is
|
|
3352
|
-
* invisible from `isLive` alone.
|
|
3353
|
-
*
|
|
3354
|
-
* Polled, because both change without the user acting: a solver fills, or the intent expires. The
|
|
3355
|
-
* interval sits well inside the 5-minute intent deadline so a resolution shows up while it matters.
|
|
3356
|
-
*
|
|
3357
|
-
* @example
|
|
3358
|
-
* ```typescript
|
|
3359
|
-
* const { data: slot } = useLeveragePositionPending({ params: { position } });
|
|
3360
|
-
* if (slot?.needsSettle) offerSettle();
|
|
3361
|
-
* ```
|
|
1737
|
+
* A position's operation slot. Gate controls on `isLive` (one intent at a time); offer settle on `needsSettle`.
|
|
1738
|
+
* Polled well inside the 5-minute intent deadline since fills/expiry happen without user action.
|
|
3362
1739
|
*/
|
|
3363
1740
|
declare function useLeveragePositionPending({ params, queryOptions, }?: UseLeveragePositionPendingParams): UseQueryResult<LeveragePositionPendingState, Error>;
|
|
3364
1741
|
|
|
@@ -3366,137 +1743,65 @@ type UseLeveragePositionsForUserParams = ReadHookParams<readonly Address$1[], {
|
|
|
3366
1743
|
spokeChainKey: SpokeChainKey | undefined;
|
|
3367
1744
|
spokeAddress: string | undefined;
|
|
3368
1745
|
}>;
|
|
3369
|
-
/**
|
|
3370
|
-
* Lists a user's leverage positions from their spoke-side address and chain.
|
|
3371
|
-
*
|
|
3372
|
-
* Positions are owned by the user's hub wallet, not their EOA, so discovery resolves that address
|
|
3373
|
-
* first — the wallet router for a Sonic user, the cross-chain wallet for a spoke user, via one
|
|
3374
|
-
* call. Use this in user-facing code; {@link useLeveragePositions} takes a hub address directly
|
|
3375
|
-
* and will find nothing if handed an EOA.
|
|
3376
|
-
*
|
|
3377
|
-
* @example
|
|
3378
|
-
* ```typescript
|
|
3379
|
-
* const { data: positions } = useLeveragePositionsForUser({
|
|
3380
|
-
* params: { spokeChainKey: chain, spokeAddress: account.address },
|
|
3381
|
-
* });
|
|
3382
|
-
* ```
|
|
3383
|
-
*/
|
|
1746
|
+
/** Resolves the user's hub wallet first, since positions are owned by it; {@link useLeveragePositions} finds nothing for an EOA. */
|
|
3384
1747
|
declare function useLeveragePositionsForUser({ params, queryOptions, }?: UseLeveragePositionsForUserParams): UseQueryResult<readonly Address$1[], Error>;
|
|
3385
1748
|
|
|
3386
|
-
/**
|
|
3387
|
-
* Mutation variables for {@link useOpenLeveragePosition}.
|
|
3388
|
-
*
|
|
3389
|
-
* `side` picks which asset funds the open, and the two take different params — so the union is
|
|
3390
|
-
* discriminated rather than merged, and the wrong field set is a type error instead of a revert.
|
|
3391
|
-
*/
|
|
1749
|
+
/** Discriminated on `side` so a wrong field set is a type error rather than a revert. */
|
|
3392
1750
|
type UseOpenLeveragePositionVars<K extends SpokeChainKey = SpokeChainKey> = ({
|
|
3393
1751
|
side?: 'collateral';
|
|
3394
1752
|
} & Omit<SpokeExecActionParams<K, false, OpenPositionParams<K>>, 'raw'>) | ({
|
|
3395
1753
|
side: 'debt';
|
|
3396
1754
|
} & Omit<SpokeExecActionParams<K, false, OpenPositionFromDebtTokenParams<K>>, 'raw'>);
|
|
3397
1755
|
/**
|
|
3398
|
-
*
|
|
3399
|
-
*
|
|
3400
|
-
*
|
|
3401
|
-
* gets the same guarantee. Resolving means the intent is LIVE, not that the position is open: read
|
|
3402
|
-
* `notified` before telling the owner to wait, since a failed notification still resolves.
|
|
3403
|
-
*
|
|
3404
|
-
* Positions are owned by the hub wallet, never the signing address — pass the signer as
|
|
3405
|
-
* `params.srcAddress` and the SDK resolves the owner.
|
|
3406
|
-
*
|
|
3407
|
-
* @experimental Off-hub (spoke) origins are unverified on-chain; see the SDK method.
|
|
1756
|
+
* Resolving means the intent is live, not that the position is open; check `notified`, since a failed notification still resolves.
|
|
1757
|
+
* Pass the signer as `params.srcAddress`; the SDK resolves the owning hub wallet.
|
|
1758
|
+
* @experimental Off-hub (spoke) origins are unverified on-chain.
|
|
3408
1759
|
*/
|
|
3409
1760
|
declare function useOpenLeveragePosition<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<LeveragePositionIntentResult, UseOpenLeveragePositionVars<K>>): SafeUseMutationResult<LeveragePositionIntentResult, Error, UseOpenLeveragePositionVars<K>>;
|
|
3410
1761
|
|
|
3411
|
-
/** Mutation variables for {@link useSubmitLeveragePositionIntent} — the calls to run as the owner. */
|
|
3412
1762
|
type UseSubmitLeveragePositionIntentVars<K extends SpokeChainKey = SpokeChainKey> = Omit<SpokeExecActionParams<K, false, PositionOperationParams<K, PositionBatchCall>>, 'raw'>;
|
|
3413
1763
|
/**
|
|
3414
|
-
*
|
|
3415
|
-
*
|
|
3416
|
-
*
|
|
3417
|
-
* USE {@link useRunLeveragePositionOperation} for `withdraw`, `settle` and `cancel`. The split is the
|
|
3418
|
-
* SDK's: those three are synchronous on the hub and need no notification, while these two only post
|
|
3419
|
-
* a request a solver fills later. Sending a leverage change through the other hook leaves an intent
|
|
3420
|
-
* nothing will fill, and it expires without a word.
|
|
3421
|
-
*
|
|
3422
|
-
* A position permits one intent at a time, so poll `useLeveragePositionPending` rather than assuming
|
|
3423
|
-
* the next call may go out.
|
|
3424
|
-
*
|
|
3425
|
-
* @experimental Off-hub (spoke) origins are unverified on-chain; see the SDK method.
|
|
1764
|
+
* Intent-posting position calls (`increaseLeverage`, `decreaseLeverage`); one intent at a time, so gate on `useLeveragePositionPending`.
|
|
1765
|
+
* @experimental Off-hub (spoke) origins are unverified on-chain.
|
|
3426
1766
|
*/
|
|
3427
1767
|
declare function useSubmitLeveragePositionIntent<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<LeveragePositionIntentResult, UseSubmitLeveragePositionIntentVars<K>>): SafeUseMutationResult<LeveragePositionIntentResult, Error, UseSubmitLeveragePositionIntentVars<K>>;
|
|
3428
1768
|
|
|
3429
|
-
/** Mutation variables for {@link useRunLeveragePositionOperation} — the calls to run as the owner. */
|
|
3430
1769
|
type UseRunLeveragePositionOperationVars<K extends SpokeChainKey = SpokeChainKey> = Omit<SpokeExecActionParams<K, false, PositionOperationParams<K, PositionDirectCall>>, 'raw'>;
|
|
3431
1770
|
/**
|
|
3432
|
-
*
|
|
3433
|
-
*
|
|
3434
|
-
*
|
|
3435
|
-
* Still routed, never sent directly: the position's `onlyOwner` is the hub wallet, so a call sent
|
|
3436
|
-
* from the signer reverts `NotOwner`. Locally through the wallet router on the hub, relayed from
|
|
3437
|
-
* anywhere else.
|
|
3438
|
-
*
|
|
3439
|
-
* USE {@link useSubmitLeveragePositionIntent} FOR `increaseLeverage` AND `decreaseLeverage`. Those
|
|
3440
|
-
* only post a request a solver fills later, and this hook does not notify the solver, so sending one
|
|
3441
|
-
* through here creates an intent nothing will fill. It expires silently and the operation is lost.
|
|
3442
|
-
* The other direction is harmless by comparison: notifying about a withdraw is noise, not damage.
|
|
3443
|
-
*
|
|
3444
|
-
* Balances are invalidated for `srcChainKey` because a withdraw pays out.
|
|
3445
|
-
*
|
|
3446
|
-
* @experimental OFF-HUB (SPOKE) ORIGINS ARE UNVERIFIED ON-CHAIN, and this is the hook that carries the
|
|
3447
|
-
* worst of it: an exit or cancellation delivering the underlying back to the spoke it
|
|
3448
|
-
* came from has never run on mainnet. Bitcoin is refused outright.
|
|
1771
|
+
* Synchronous position calls (`withdraw`, `settle`, `cancel`) as the hub wallet; does not notify the solver, so
|
|
1772
|
+
* use {@link useSubmitLeveragePositionIntent} for leverage changes or the intent expires unfilled.
|
|
1773
|
+
* @experimental Off-hub (spoke) origins are unverified on-chain; Bitcoin is refused.
|
|
3449
1774
|
*/
|
|
3450
1775
|
declare function useRunLeveragePositionOperation<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseRunLeveragePositionOperationVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseRunLeveragePositionOperationVars<K>>;
|
|
3451
1776
|
|
|
3452
|
-
/** Params for {@link useLeveragePositionPayoutAddress}. */
|
|
3453
1777
|
type UseLeveragePositionPayoutAddressParams = {
|
|
3454
|
-
/** The chain the user signs on. */
|
|
3455
1778
|
chainKey: SpokeChainKey;
|
|
3456
|
-
/**
|
|
3457
|
-
* Their address on that chain. Supplied by the caller — this package does not depend on a wallet
|
|
3458
|
-
* layer, so it cannot read the connected account itself.
|
|
3459
|
-
*/
|
|
1779
|
+
/** Supplied by the caller: this package has no wallet layer to read the connected account. */
|
|
3460
1780
|
signerAddress: Address$1 | undefined;
|
|
3461
1781
|
/** The position's owner, from `useGetUserHubWalletAddress`. */
|
|
3462
1782
|
owner: Address$1 | undefined;
|
|
3463
1783
|
};
|
|
3464
1784
|
/**
|
|
3465
|
-
*
|
|
3466
|
-
*
|
|
3467
|
-
* `withdraw` is a plain pool withdrawal, so it pays out to an address ON THE HUB. For a hub-chain
|
|
3468
|
-
* user that can be their own address; for anyone else it cannot — their signing address belongs to
|
|
3469
|
-
* another chain, and for a non-EVM chain it is not an address the hub could pay at all. The hub
|
|
3470
|
-
* wallet is the one destination that is always theirs, and bridging onward is a separate operation.
|
|
3471
|
-
*
|
|
3472
|
-
* Returns `undefined` while either address is still resolving, which is the disabled state for a
|
|
3473
|
-
* withdraw button rather than a reason to fall back to the signer.
|
|
1785
|
+
* Hub address a position withdrawal can pay to: the signer on the hub chain, else the hub wallet (owner).
|
|
1786
|
+
* `undefined` while resolving means disable withdraw — do not fall back to the signer.
|
|
3474
1787
|
*/
|
|
3475
1788
|
declare function useLeveragePositionPayoutAddress({ params, }?: {
|
|
3476
1789
|
params?: UseLeveragePositionPayoutAddressParams;
|
|
3477
1790
|
}): Address$1 | undefined;
|
|
3478
1791
|
|
|
3479
|
-
/** Params for {@link useLeveragePositionFundingAllowance}. */
|
|
3480
1792
|
type UseLeveragePositionFundingAllowanceParams = ReadHookParams<boolean, {
|
|
3481
1793
|
srcChainKey: SpokeChainKey;
|
|
3482
|
-
/** The user's address on `srcChainKey`. */
|
|
3483
1794
|
srcAddress: string | undefined;
|
|
3484
1795
|
/** Funding token, from `resolvePositionFunding` — not the reserve and not the vault. */
|
|
3485
1796
|
token: string | undefined;
|
|
3486
1797
|
amount: bigint | undefined;
|
|
3487
1798
|
}>;
|
|
3488
1799
|
/**
|
|
3489
|
-
* Whether the funding token is
|
|
3490
|
-
*
|
|
3491
|
-
* THE SPENDER IS CHAIN-DEPENDENT — the hub wallet on the hub, the spoke asset manager elsewhere —
|
|
3492
|
-
* so a hand-rolled `allowance` call against a guessed spender is right half the time. The SDK
|
|
3493
|
-
* resolves it; this only supplies React Query.
|
|
3494
|
-
*
|
|
3495
|
-
* Returns the SDK's answer as data. A chain with no allowance concept answers `true` without a call.
|
|
1800
|
+
* Whether the funding token is approved for an open; the SDK resolves the chain-dependent spender.
|
|
1801
|
+
* Chains with no allowance concept answer `true`.
|
|
3496
1802
|
*/
|
|
3497
1803
|
declare function useLeveragePositionFundingAllowance({ params, queryOptions, }?: UseLeveragePositionFundingAllowanceParams): UseQueryResult<boolean, Error>;
|
|
3498
1804
|
|
|
3499
|
-
/** Mutation variables for {@link useApproveLeveragePositionFunding}. */
|
|
3500
1805
|
type UseApproveLeveragePositionFundingVars<K extends SpokeChainKey = SpokeChainKey> = {
|
|
3501
1806
|
srcChainKey: K;
|
|
3502
1807
|
srcAddress: string;
|
|
@@ -3506,117 +1811,60 @@ type UseApproveLeveragePositionFundingVars<K extends SpokeChainKey = SpokeChainK
|
|
|
3506
1811
|
walletProvider?: GetWalletProviderType<K>;
|
|
3507
1812
|
};
|
|
3508
1813
|
/**
|
|
3509
|
-
* Approves the funding token for an open
|
|
3510
|
-
*
|
|
3511
|
-
* THE SPENDER IS CHAIN-DEPENDENT — the hub wallet on the hub, the spoke asset manager elsewhere.
|
|
3512
|
-
* Nothing is ever approved to the position factory: it pulls from nobody.
|
|
3513
|
-
*
|
|
3514
|
-
* Wait for this before opening, and gate it on {@link useLeveragePositionFundingAllowance}, whose
|
|
3515
|
-
* query is invalidated here on success.
|
|
1814
|
+
* Approves the funding token for an open; the spender is chain-dependent (hub wallet on hub, spoke asset manager elsewhere).
|
|
1815
|
+
* Await before opening; invalidates {@link useLeveragePositionFundingAllowance} on success.
|
|
3516
1816
|
*/
|
|
3517
1817
|
declare function useApproveLeveragePositionFunding<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseApproveLeveragePositionFundingVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseApproveLeveragePositionFundingVars<K>>;
|
|
3518
1818
|
|
|
3519
1819
|
type UseLeverageYieldApiVaultsParams = ReadHookParams<GetLeverageVaultsResponseV2, {
|
|
3520
1820
|
apiConfig?: RequestOverrideConfig;
|
|
3521
1821
|
}>;
|
|
3522
|
-
/**
|
|
3523
|
-
* React hook to fetch the registry of deployed leverage-yield vaults via the leverage-yield API —
|
|
3524
|
-
* `sodax.api.leverageYield.getVaults`.
|
|
3525
|
-
*
|
|
3526
|
-
* @example
|
|
3527
|
-
* const { data: vaults } = useLeverageYieldApiVaults();
|
|
3528
|
-
*/
|
|
3529
1822
|
declare const useLeverageYieldApiVaults: ({ params, queryOptions, }?: UseLeverageYieldApiVaultsParams) => UseQueryResult<GetLeverageVaultsResponseV2, Error>;
|
|
3530
1823
|
|
|
3531
1824
|
type UseLeverageYieldApiVaultParams = ReadHookParams<GetLeverageVaultResponseV2 | undefined, {
|
|
3532
1825
|
name: string | undefined;
|
|
3533
1826
|
apiConfig?: RequestOverrideConfig;
|
|
3534
1827
|
}>;
|
|
3535
|
-
/**
|
|
3536
|
-
* React hook to fetch a single vault descriptor by its lsoda* share-token name via the
|
|
3537
|
-
* leverage-yield API — `sodax.api.leverageYield.getVault`.
|
|
3538
|
-
*
|
|
3539
|
-
* @example
|
|
3540
|
-
* const { data: vault } = useLeverageYieldApiVault({ params: { name: 'lsodaWEETH' } });
|
|
3541
|
-
*/
|
|
1828
|
+
/** Looks up one vault by its lsoda* share-token name (e.g. `lsodaWEETH`). */
|
|
3542
1829
|
declare const useLeverageYieldApiVault: ({ params, queryOptions, }?: UseLeverageYieldApiVaultParams) => UseQueryResult<GetLeverageVaultResponseV2 | undefined, Error>;
|
|
3543
1830
|
|
|
3544
1831
|
type UseLeverageYieldApiAssetParams = ReadHookParams<VaultAssetResponseV2 | undefined, {
|
|
3545
1832
|
vault: string | undefined;
|
|
3546
1833
|
apiConfig?: RequestOverrideConfig;
|
|
3547
1834
|
}>;
|
|
3548
|
-
/**
|
|
3549
|
-
* React hook to fetch the underlying hub asset for a leverage-yield vault via the leverage-yield API —
|
|
3550
|
-
* `sodax.api.leverageYield.getAsset`.
|
|
3551
|
-
*
|
|
3552
|
-
* @example
|
|
3553
|
-
* const { data } = useLeverageYieldApiAsset({ params: { vault: '0x...' } });
|
|
3554
|
-
*/
|
|
3555
1835
|
declare const useLeverageYieldApiAsset: ({ params, queryOptions, }?: UseLeverageYieldApiAssetParams) => UseQueryResult<VaultAssetResponseV2 | undefined, Error>;
|
|
3556
1836
|
|
|
3557
1837
|
type UseLeverageYieldApiPositionParams = ReadHookParams<LeverageYieldPositionV2 | undefined, {
|
|
3558
1838
|
vault: string | undefined;
|
|
3559
1839
|
apiConfig?: RequestOverrideConfig;
|
|
3560
1840
|
}>;
|
|
3561
|
-
/**
|
|
3562
|
-
* React hook to fetch a leveraged-position snapshot for a leverage-yield vault via the leverage-yield API —
|
|
3563
|
-
* `sodax.api.leverageYield.getPosition`.
|
|
3564
|
-
*
|
|
3565
|
-
* @example
|
|
3566
|
-
* const { data } = useLeverageYieldApiPosition({ params: { vault: '0x...' } });
|
|
3567
|
-
*/
|
|
3568
1841
|
declare const useLeverageYieldApiPosition: ({ params, queryOptions, }?: UseLeverageYieldApiPositionParams) => UseQueryResult<LeverageYieldPositionV2 | undefined, Error>;
|
|
3569
1842
|
|
|
3570
1843
|
type UseLeverageYieldApiAprParams = ReadHookParams<LeverageYieldAprV2 | undefined, {
|
|
3571
1844
|
vault: string | undefined;
|
|
3572
1845
|
apiConfig?: RequestOverrideConfig;
|
|
3573
1846
|
}>;
|
|
3574
|
-
/**
|
|
3575
|
-
* React hook to fetch the AAVE-only steady-state APR for a leverage-yield vault via the leverage-yield API —
|
|
3576
|
-
* `sodax.api.leverageYield.getApr`.
|
|
3577
|
-
*
|
|
3578
|
-
* @example
|
|
3579
|
-
* const { data } = useLeverageYieldApiApr({ params: { vault: '0x...' } });
|
|
3580
|
-
*/
|
|
1847
|
+
/** AAVE-only steady-state APR; {@link useLeverageYieldApiEffectiveApr} includes LSD yield. */
|
|
3581
1848
|
declare const useLeverageYieldApiApr: ({ params, queryOptions, }?: UseLeverageYieldApiAprParams) => UseQueryResult<LeverageYieldAprV2 | undefined, Error>;
|
|
3582
1849
|
|
|
3583
1850
|
type UseLeverageYieldApiEffectiveAprParams = ReadHookParams<LeverageYieldEffectiveAprV2 | undefined, {
|
|
3584
1851
|
vault: string | undefined;
|
|
3585
1852
|
apiConfig?: RequestOverrideConfig;
|
|
3586
1853
|
}>;
|
|
3587
|
-
/**
|
|
3588
|
-
* React hook to fetch the honest combined AAVE + LSD effective APR for a leverage-yield vault via the leverage-yield API —
|
|
3589
|
-
* `sodax.api.leverageYield.getEffectiveApr`.
|
|
3590
|
-
*
|
|
3591
|
-
* @example
|
|
3592
|
-
* const { data } = useLeverageYieldApiEffectiveApr({ params: { vault: '0x...' } });
|
|
3593
|
-
*/
|
|
1854
|
+
/** Combined AAVE + LSD effective APR. */
|
|
3594
1855
|
declare const useLeverageYieldApiEffectiveApr: ({ params, queryOptions, }?: UseLeverageYieldApiEffectiveAprParams) => UseQueryResult<LeverageYieldEffectiveAprV2 | undefined, Error>;
|
|
3595
1856
|
|
|
3596
1857
|
type UseLeverageYieldApiLsdAprParams = ReadHookParams<LeverageYieldLsdAprV2 | undefined, {
|
|
3597
1858
|
vault: string | undefined;
|
|
3598
1859
|
apiConfig?: RequestOverrideConfig;
|
|
3599
1860
|
}>;
|
|
3600
|
-
/**
|
|
3601
|
-
* React hook to fetch the off-chain LSD staking-APR snapshot for a leverage-yield vault via the leverage-yield API —
|
|
3602
|
-
* `sodax.api.leverageYield.getLsdApr`.
|
|
3603
|
-
*
|
|
3604
|
-
* @example
|
|
3605
|
-
* const { data } = useLeverageYieldApiLsdApr({ params: { vault: '0x...' } });
|
|
3606
|
-
*/
|
|
1861
|
+
/** Off-chain LSD staking-APR snapshot. */
|
|
3607
1862
|
declare const useLeverageYieldApiLsdApr: ({ params, queryOptions, }?: UseLeverageYieldApiLsdAprParams) => UseQueryResult<LeverageYieldLsdAprV2 | undefined, Error>;
|
|
3608
1863
|
|
|
3609
1864
|
type UseLeverageYieldApiTotalAssetsParams = ReadHookParams<VaultTotalAssetsResponseV2 | undefined, {
|
|
3610
1865
|
vault: string | undefined;
|
|
3611
1866
|
apiConfig?: RequestOverrideConfig;
|
|
3612
1867
|
}>;
|
|
3613
|
-
/**
|
|
3614
|
-
* React hook to fetch the total assets managed by the vault for a leverage-yield vault via the leverage-yield API —
|
|
3615
|
-
* `sodax.api.leverageYield.getTotalAssets`.
|
|
3616
|
-
*
|
|
3617
|
-
* @example
|
|
3618
|
-
* const { data } = useLeverageYieldApiTotalAssets({ params: { vault: '0x...' } });
|
|
3619
|
-
*/
|
|
3620
1868
|
declare const useLeverageYieldApiTotalAssets: ({ params, queryOptions, }?: UseLeverageYieldApiTotalAssetsParams) => UseQueryResult<VaultTotalAssetsResponseV2 | undefined, Error>;
|
|
3621
1869
|
|
|
3622
1870
|
type UseLeverageYieldApiPreviewDepositParams = ReadHookParams<PreviewDepositResponseV2 | undefined, {
|
|
@@ -3624,13 +1872,7 @@ type UseLeverageYieldApiPreviewDepositParams = ReadHookParams<PreviewDepositResp
|
|
|
3624
1872
|
assets: string | undefined;
|
|
3625
1873
|
apiConfig?: RequestOverrideConfig;
|
|
3626
1874
|
}>;
|
|
3627
|
-
/**
|
|
3628
|
-
* React hook to preview the shares minted for depositing `assets` (ERC-4626 previewDeposit) via the leverage-yield API —
|
|
3629
|
-
* `sodax.api.leverageYield.previewDeposit`.
|
|
3630
|
-
*
|
|
3631
|
-
* @example
|
|
3632
|
-
* const { data } = useLeverageYieldApiPreviewDeposit({ params: { vault: '0x...', assets: '1000000000000000000' } });
|
|
3633
|
-
*/
|
|
1875
|
+
/** ERC-4626 `previewDeposit`: shares minted for `assets`. */
|
|
3634
1876
|
declare const useLeverageYieldApiPreviewDeposit: ({ params, queryOptions, }?: UseLeverageYieldApiPreviewDepositParams) => UseQueryResult<PreviewDepositResponseV2 | undefined, Error>;
|
|
3635
1877
|
|
|
3636
1878
|
type UseLeverageYieldApiPreviewWithdrawParams = ReadHookParams<PreviewWithdrawResponseV2 | undefined, {
|
|
@@ -3638,13 +1880,7 @@ type UseLeverageYieldApiPreviewWithdrawParams = ReadHookParams<PreviewWithdrawRe
|
|
|
3638
1880
|
assets: string | undefined;
|
|
3639
1881
|
apiConfig?: RequestOverrideConfig;
|
|
3640
1882
|
}>;
|
|
3641
|
-
/**
|
|
3642
|
-
* React hook to preview the shares burned to withdraw `assets` (ERC-4626 previewWithdraw) via the leverage-yield API —
|
|
3643
|
-
* `sodax.api.leverageYield.previewWithdraw`.
|
|
3644
|
-
*
|
|
3645
|
-
* @example
|
|
3646
|
-
* const { data } = useLeverageYieldApiPreviewWithdraw({ params: { vault: '0x...', assets: '1000000000000000000' } });
|
|
3647
|
-
*/
|
|
1883
|
+
/** ERC-4626 `previewWithdraw`: shares burned to withdraw `assets`. */
|
|
3648
1884
|
declare const useLeverageYieldApiPreviewWithdraw: ({ params, queryOptions, }?: UseLeverageYieldApiPreviewWithdrawParams) => UseQueryResult<PreviewWithdrawResponseV2 | undefined, Error>;
|
|
3649
1885
|
|
|
3650
1886
|
type UseLeverageYieldApiPreviewRedeemParams = ReadHookParams<PreviewRedeemResponseV2 | undefined, {
|
|
@@ -3652,13 +1888,7 @@ type UseLeverageYieldApiPreviewRedeemParams = ReadHookParams<PreviewRedeemRespon
|
|
|
3652
1888
|
shares: string | undefined;
|
|
3653
1889
|
apiConfig?: RequestOverrideConfig;
|
|
3654
1890
|
}>;
|
|
3655
|
-
/**
|
|
3656
|
-
* React hook to preview the assets returned for redeeming `shares` (ERC-4626 previewRedeem) via the leverage-yield API —
|
|
3657
|
-
* `sodax.api.leverageYield.previewRedeem`.
|
|
3658
|
-
*
|
|
3659
|
-
* @example
|
|
3660
|
-
* const { data } = useLeverageYieldApiPreviewRedeem({ params: { vault: '0x...', shares: '1000000000000000000' } });
|
|
3661
|
-
*/
|
|
1891
|
+
/** ERC-4626 `previewRedeem`: assets returned for `shares`. */
|
|
3662
1892
|
declare const useLeverageYieldApiPreviewRedeem: ({ params, queryOptions, }?: UseLeverageYieldApiPreviewRedeemParams) => UseQueryResult<PreviewRedeemResponseV2 | undefined, Error>;
|
|
3663
1893
|
|
|
3664
1894
|
type UseLeverageYieldApiShareBalanceParams = ReadHookParams<ShareBalanceResponseV2 | undefined, {
|
|
@@ -3666,13 +1896,6 @@ type UseLeverageYieldApiShareBalanceParams = ReadHookParams<ShareBalanceResponse
|
|
|
3666
1896
|
owner: string | undefined;
|
|
3667
1897
|
apiConfig?: RequestOverrideConfig;
|
|
3668
1898
|
}>;
|
|
3669
|
-
/**
|
|
3670
|
-
* React hook to get an owner's vault share (lsoda*) balance via the leverage-yield API —
|
|
3671
|
-
* `sodax.api.leverageYield.getShareBalance`.
|
|
3672
|
-
*
|
|
3673
|
-
* @example
|
|
3674
|
-
* const { data } = useLeverageYieldApiShareBalance({ params: { vault: '0x...', owner: '1000000000000000000' } });
|
|
3675
|
-
*/
|
|
3676
1899
|
declare const useLeverageYieldApiShareBalance: ({ params, queryOptions, }?: UseLeverageYieldApiShareBalanceParams) => UseQueryResult<ShareBalanceResponseV2 | undefined, Error>;
|
|
3677
1900
|
|
|
3678
1901
|
type UseLeverageYieldApiMaxWithdrawParams = ReadHookParams<MaxWithdrawResponseV2 | undefined, {
|
|
@@ -3680,13 +1903,7 @@ type UseLeverageYieldApiMaxWithdrawParams = ReadHookParams<MaxWithdrawResponseV2
|
|
|
3680
1903
|
owner: string | undefined;
|
|
3681
1904
|
apiConfig?: RequestOverrideConfig;
|
|
3682
1905
|
}>;
|
|
3683
|
-
/**
|
|
3684
|
-
* React hook to get the maximum assets an owner can withdraw (ERC-4626 maxWithdraw) via the leverage-yield API —
|
|
3685
|
-
* `sodax.api.leverageYield.getMaxWithdraw`.
|
|
3686
|
-
*
|
|
3687
|
-
* @example
|
|
3688
|
-
* const { data } = useLeverageYieldApiMaxWithdraw({ params: { vault: '0x...', owner: '1000000000000000000' } });
|
|
3689
|
-
*/
|
|
1906
|
+
/** ERC-4626 `maxWithdraw` for `owner`. */
|
|
3690
1907
|
declare const useLeverageYieldApiMaxWithdraw: ({ params, queryOptions, }?: UseLeverageYieldApiMaxWithdrawParams) => UseQueryResult<MaxWithdrawResponseV2 | undefined, Error>;
|
|
3691
1908
|
|
|
3692
1909
|
type UseLeverageYieldApiDepositQuoteParams = ReadHookParams<QuoteResponseV2 | undefined, {
|
|
@@ -3694,21 +1911,7 @@ type UseLeverageYieldApiDepositQuoteParams = ReadHookParams<QuoteResponseV2 | un
|
|
|
3694
1911
|
query?: QuoteQueryV2;
|
|
3695
1912
|
apiConfig?: RequestOverrideConfig;
|
|
3696
1913
|
}>;
|
|
3697
|
-
/**
|
|
3698
|
-
* React hook to quote a swap-style leverage-yield deposit (any token → lsoda* shares) via the
|
|
3699
|
-
* leverage-yield API — `sodax.api.leverageYield.getDepositQuote`. Pass `query.includeTxData = true`
|
|
3700
|
-
* to also build the unsigned create-intent transaction (`srcAddress` then required in the body).
|
|
3701
|
-
*
|
|
3702
|
-
* @example
|
|
3703
|
-
* const { data: quote } = useLeverageYieldApiDepositQuote({
|
|
3704
|
-
* params: {
|
|
3705
|
-
* body: {
|
|
3706
|
-
* vault: '0x...', tokenSrc: '0x...', tokenSrcChainKey: '0xa4b1.arbitrum',
|
|
3707
|
-
* amount: '1000000', quoteType: 'exact_input',
|
|
3708
|
-
* },
|
|
3709
|
-
* },
|
|
3710
|
-
* });
|
|
3711
|
-
*/
|
|
1914
|
+
/** `query.includeTxData = true` also builds the unsigned create-intent tx and requires `srcAddress` in the body. */
|
|
3712
1915
|
declare const useLeverageYieldApiDepositQuote: ({ params, queryOptions, }?: UseLeverageYieldApiDepositQuoteParams) => UseQueryResult<QuoteResponseV2 | undefined, Error>;
|
|
3713
1916
|
|
|
3714
1917
|
type UseLeverageYieldApiWithdrawQuoteParams = ReadHookParams<QuoteResponseV2 | undefined, {
|
|
@@ -3716,61 +1919,31 @@ type UseLeverageYieldApiWithdrawQuoteParams = ReadHookParams<QuoteResponseV2 | u
|
|
|
3716
1919
|
query?: QuoteQueryV2;
|
|
3717
1920
|
apiConfig?: RequestOverrideConfig;
|
|
3718
1921
|
}>;
|
|
3719
|
-
/**
|
|
3720
|
-
* React hook to quote a swap-style leverage-yield withdraw (lsoda* shares → any token) via the
|
|
3721
|
-
* leverage-yield API — `sodax.api.leverageYield.getWithdrawQuote`. Pass `query.includeTxData = true`
|
|
3722
|
-
* to also build the unsigned transaction (`srcAddress`/`dstAddress` then required in the body).
|
|
3723
|
-
*
|
|
3724
|
-
* @example
|
|
3725
|
-
* const { data: quote } = useLeverageYieldApiWithdrawQuote({
|
|
3726
|
-
* params: {
|
|
3727
|
-
* body: {
|
|
3728
|
-
* vault: '0x...', srcChainKey: 'sonic', tokenDst: '0x...', tokenDstChainKey: '0xa4b1.arbitrum',
|
|
3729
|
-
* amount: '1000000000000000000', quoteType: 'exact_input',
|
|
3730
|
-
* },
|
|
3731
|
-
* },
|
|
3732
|
-
* });
|
|
3733
|
-
*/
|
|
1922
|
+
/** `query.includeTxData = true` also builds the unsigned tx and requires `srcAddress`/`dstAddress` in the body. */
|
|
3734
1923
|
declare const useLeverageYieldApiWithdrawQuote: ({ params, queryOptions, }?: UseLeverageYieldApiWithdrawQuoteParams) => UseQueryResult<QuoteResponseV2 | undefined, Error>;
|
|
3735
1924
|
|
|
3736
1925
|
type UseLeverageYieldApiDeadlineParams = ReadHookParams<DeadlineResponseV2, {
|
|
3737
1926
|
query?: DeadlineQueryV2;
|
|
3738
1927
|
apiConfig?: RequestOverrideConfig;
|
|
3739
1928
|
}>;
|
|
3740
|
-
/**
|
|
3741
|
-
* React hook to compute a deposit/withdraw deadline (hub timestamp + `offsetSeconds`, default 300s)
|
|
3742
|
-
* via the leverage-yield API — `sodax.api.leverageYield.getDeadline`.
|
|
3743
|
-
*
|
|
3744
|
-
* @example
|
|
3745
|
-
* const { data: deadline } = useLeverageYieldApiDeadline({ params: { query: { offsetSeconds: 600 } } });
|
|
3746
|
-
*/
|
|
1929
|
+
/** Deadline = hub timestamp + `offsetSeconds` (default 300s). */
|
|
3747
1930
|
declare const useLeverageYieldApiDeadline: ({ params, queryOptions, }?: UseLeverageYieldApiDeadlineParams) => UseQueryResult<DeadlineResponseV2, Error>;
|
|
3748
1931
|
|
|
3749
1932
|
type UseLeverageYieldApiAllowanceParams = ReadHookParams<AllowanceCheckResponseV2 | undefined, {
|
|
3750
1933
|
body: CreateDepositIntentParamsV2 | undefined;
|
|
3751
1934
|
apiConfig?: RequestOverrideConfig;
|
|
3752
1935
|
}>;
|
|
3753
|
-
/**
|
|
3754
|
-
* React hook to check whether the deposit input-token allowance is already sufficient for an intent
|
|
3755
|
-
* via the leverage-yield API — `sodax.api.leverageYield.checkAllowance`. Returns `{ valid }`.
|
|
3756
|
-
* (Withdraw needs no spoke allowance — it spends lsoda* from the hub wallet.)
|
|
3757
|
-
*
|
|
3758
|
-
* @example
|
|
3759
|
-
* const { data: allowance } = useLeverageYieldApiAllowance({ params: { body: depositIntentParams } });
|
|
3760
|
-
*/
|
|
1936
|
+
/** Deposit-only: a withdraw needs no spoke allowance (it spends lsoda* from the hub wallet). */
|
|
3761
1937
|
declare const useLeverageYieldApiAllowance: ({ params, queryOptions, }?: UseLeverageYieldApiAllowanceParams) => UseQueryResult<AllowanceCheckResponseV2 | undefined, Error>;
|
|
3762
1938
|
|
|
3763
|
-
/**
|
|
3764
|
-
* Mutation variables for {@link useLeverageYieldApiApprove}. The per-request `apiConfig` override belongs here
|
|
3765
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
3766
|
-
* endpoints without re-rendering.
|
|
3767
|
-
*/
|
|
1939
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
3768
1940
|
type UseLeverageYieldApiApproveVars = {
|
|
3769
1941
|
body: CreateDepositIntentParamsV2;
|
|
3770
1942
|
apiConfig?: RequestOverrideConfig;
|
|
3771
1943
|
};
|
|
3772
1944
|
/**
|
|
3773
|
-
*
|
|
1945
|
+
* Returns the unsigned `{ tx, resetTx? }`; the reset must be mined before the approve.
|
|
1946
|
+
* Prefer {@link useLeverageYieldApiApproveAndBroadcast}, which owns that ordering.
|
|
3774
1947
|
*/
|
|
3775
1948
|
declare const useLeverageYieldApiApprove: ({ mutationOptions, }?: MutationHookParams<ApproveResponseV2, UseLeverageYieldApiApproveVars>) => SafeUseMutationResult<ApproveResponseV2, Error, UseLeverageYieldApiApproveVars>;
|
|
3776
1949
|
|
|
@@ -3783,220 +1956,112 @@ type UseLeverageYieldApiApproveAndBroadcastVars<K extends SpokeChainKey = SpokeC
|
|
|
3783
1956
|
onProgress?: ApprovalProgressListener;
|
|
3784
1957
|
};
|
|
3785
1958
|
/**
|
|
3786
|
-
*
|
|
3787
|
-
*
|
|
3788
|
-
*
|
|
3789
|
-
*
|
|
3790
|
-
* Prefer this over {@link useLeverageYieldApiApprove}, which hands back the unsigned
|
|
3791
|
-
* `{ tx, resetTx? }` and leaves the ordering — reset mined first, then approve — to the caller. A
|
|
3792
|
-
* deposit token of the 2017 TetherToken lineage rejects an allowance change from one non-zero value
|
|
3793
|
-
* to another, so broadcasting the approve without the reset spends the user's gas on a transaction
|
|
3794
|
-
* that is certain to revert. Confirmation happens inside the hook, so it invalidates
|
|
3795
|
-
* `['leverageYieldApi','allowance']` itself — after waiting up to about 15 seconds for the API to report
|
|
3796
|
-
* the allowance as valid, since its RPC can trail the node that confirmed the approve. It resolves after
|
|
3797
|
-
* that wait either way, so read the allowance rather than treating success as `valid`.
|
|
3798
|
-
*
|
|
3799
|
-
* Supports the chains the leverage-yield API can approve on — the hub (Sonic), EVM spokes, and
|
|
3800
|
-
* Stellar. Every other chain reports its allowance as always sufficient, so approval never runs.
|
|
3801
|
-
*
|
|
3802
|
-
* `onProgress` reports each transaction as `{ step, phase, index, total }`, so the UI can name the
|
|
3803
|
-
* wallet prompt the user is looking at instead of one flat "Approving…" across two signatures.
|
|
3804
|
-
*
|
|
3805
|
-
* @example
|
|
3806
|
-
* const { mutateAsyncSafe: approve } = useLeverageYieldApiApproveAndBroadcast();
|
|
3807
|
-
* const result = await approve({ body: depositIntentParams, walletProvider, onProgress: setStep });
|
|
3808
|
-
* if (!result.ok) return;
|
|
3809
|
-
* const { resetTxHash, approveTxHash } = result.value; // resetTxHash only on a guarded token
|
|
1959
|
+
* Signs and confirms the deposit approval plan, mining the reset before the approve (USDT-lineage tokens revert).
|
|
1960
|
+
* Resolves after waiting up to ~15s for the API allowance to turn valid, valid or not: read the allowance.
|
|
1961
|
+
* Approval runs only on the hub, EVM spokes and Stellar; other chains report the allowance as always sufficient.
|
|
3810
1962
|
*/
|
|
3811
1963
|
declare const useLeverageYieldApiApproveAndBroadcast: <K extends SpokeChainKey = "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera" | "tron" | "robinhood" | "xrp" | "monad" | "ton" | "zcash" | "cardano">({ mutationOptions, }?: MutationHookParams<LeverageYieldApiApprovalHashes, UseLeverageYieldApiApproveAndBroadcastVars<K>>) => SafeUseMutationResult<LeverageYieldApiApprovalHashes, Error, UseLeverageYieldApiApproveAndBroadcastVars<K>>;
|
|
3812
1964
|
|
|
3813
|
-
/**
|
|
3814
|
-
* Mutation variables for {@link useLeverageYieldApiCreateDepositIntent}. The per-request `apiConfig` override belongs here
|
|
3815
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
3816
|
-
* endpoints without re-rendering.
|
|
3817
|
-
*/
|
|
1965
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
3818
1966
|
type UseLeverageYieldApiCreateDepositIntentVars = {
|
|
3819
1967
|
body: CreateDepositIntentParamsV2;
|
|
3820
1968
|
apiConfig?: RequestOverrideConfig;
|
|
3821
1969
|
};
|
|
3822
|
-
/**
|
|
3823
|
-
* React hook to build an unsigned deposit create-intent transaction (any token → lsoda* shares) via the leverage-yield API — `sodax.api.leverageYield.createDepositIntent`.
|
|
3824
|
-
*/
|
|
1970
|
+
/** Builds an unsigned deposit create-intent tx (any token → lsoda* shares). */
|
|
3825
1971
|
declare const useLeverageYieldApiCreateDepositIntent: ({ mutationOptions, }?: MutationHookParams<CreateIntentResponseV2, UseLeverageYieldApiCreateDepositIntentVars>) => SafeUseMutationResult<CreateIntentResponseV2, Error, UseLeverageYieldApiCreateDepositIntentVars>;
|
|
3826
1972
|
|
|
3827
|
-
/**
|
|
3828
|
-
* Mutation variables for {@link useLeverageYieldApiCreateWithdrawIntent}. The per-request `apiConfig` override belongs here
|
|
3829
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
3830
|
-
* endpoints without re-rendering.
|
|
3831
|
-
*/
|
|
1973
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
3832
1974
|
type UseLeverageYieldApiCreateWithdrawIntentVars = {
|
|
3833
1975
|
body: CreateWithdrawIntentParamsV2;
|
|
3834
1976
|
apiConfig?: RequestOverrideConfig;
|
|
3835
1977
|
};
|
|
3836
|
-
/**
|
|
3837
|
-
* React hook to build an unsigned withdraw create-intent transaction (lsoda* shares → any token) via the leverage-yield API — `sodax.api.leverageYield.createWithdrawIntent`.
|
|
3838
|
-
*/
|
|
1978
|
+
/** Builds an unsigned withdraw create-intent tx (lsoda* shares → any token). */
|
|
3839
1979
|
declare const useLeverageYieldApiCreateWithdrawIntent: ({ mutationOptions, }?: MutationHookParams<CreateIntentResponseV2, UseLeverageYieldApiCreateWithdrawIntentVars>) => SafeUseMutationResult<CreateIntentResponseV2, Error, UseLeverageYieldApiCreateWithdrawIntentVars>;
|
|
3840
1980
|
|
|
3841
|
-
/**
|
|
3842
|
-
* Mutation variables for {@link useLeverageYieldApiSubmitIntent}. The per-request `apiConfig` override belongs here
|
|
3843
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
3844
|
-
* endpoints without re-rendering.
|
|
3845
|
-
*/
|
|
1981
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
3846
1982
|
type UseLeverageYieldApiSubmitIntentVars = {
|
|
3847
1983
|
body: SubmitIntentRequestV2;
|
|
3848
1984
|
apiConfig?: RequestOverrideConfig;
|
|
3849
1985
|
};
|
|
3850
|
-
/**
|
|
3851
|
-
* React hook to submit the broadcast intent tx to the relay via the leverage-yield API — `sodax.api.leverageYield.submitIntent`.
|
|
3852
|
-
*/
|
|
1986
|
+
/** Submits the already-broadcast intent tx to the relay. */
|
|
3853
1987
|
declare const useLeverageYieldApiSubmitIntent: ({ mutationOptions, }?: MutationHookParams<SubmitIntentResponseV2, UseLeverageYieldApiSubmitIntentVars>) => SafeUseMutationResult<SubmitIntentResponseV2, Error, UseLeverageYieldApiSubmitIntentVars>;
|
|
3854
1988
|
|
|
3855
1989
|
type UseLeverageYieldApiStatusParams = ReadHookParams<StatusResponseV2 | undefined, {
|
|
3856
1990
|
intentTxHash: string | undefined;
|
|
3857
1991
|
apiConfig?: RequestOverrideConfig;
|
|
3858
1992
|
}>;
|
|
3859
|
-
/**
|
|
3860
|
-
* React hook for polling the solver intent status by hub-chain intent tx hash via the leverage-yield
|
|
3861
|
-
* API — `sodax.api.leverageYield.getStatus`. Returns `{ status, fillTxHash? }`.
|
|
3862
|
-
*
|
|
3863
|
-
* @example
|
|
3864
|
-
* const { data } = useLeverageYieldApiStatus({ params: { intentTxHash: '0x123...' } });
|
|
3865
|
-
*
|
|
3866
|
-
* @remarks
|
|
3867
|
-
* - Default refetch interval is 1 second; stops once `status` is `3` (SOLVED) or `4` (FAILED).
|
|
3868
|
-
*/
|
|
1993
|
+
/** Polls every 1s until `status` is 3 (SOLVED) or 4 (FAILED). */
|
|
3869
1994
|
declare const useLeverageYieldApiStatus: ({ params, queryOptions, }?: UseLeverageYieldApiStatusParams) => UseQueryResult<StatusResponseV2 | undefined, Error>;
|
|
3870
1995
|
|
|
3871
|
-
/**
|
|
3872
|
-
* Mutation variables for {@link useLeverageYieldApiCancelIntent}. The per-request `apiConfig` override belongs here
|
|
3873
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
3874
|
-
* endpoints without re-rendering.
|
|
3875
|
-
*/
|
|
1996
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
3876
1997
|
type UseLeverageYieldApiCancelIntentVars = {
|
|
3877
1998
|
body: CancelIntentRequestV2;
|
|
3878
1999
|
apiConfig?: RequestOverrideConfig;
|
|
3879
2000
|
};
|
|
3880
|
-
/**
|
|
3881
|
-
* React hook to build an unsigned cancel-intent transaction via the leverage-yield API — `sodax.api.leverageYield.cancelIntent`.
|
|
3882
|
-
*/
|
|
2001
|
+
/** Builds an unsigned cancel-intent tx for the caller to sign and broadcast. */
|
|
3883
2002
|
declare const useLeverageYieldApiCancelIntent: ({ mutationOptions, }?: MutationHookParams<CancelIntentResponseV2, UseLeverageYieldApiCancelIntentVars>) => SafeUseMutationResult<CancelIntentResponseV2, Error, UseLeverageYieldApiCancelIntentVars>;
|
|
3884
2003
|
|
|
3885
2004
|
type UseLeverageYieldApiIntentHashParams = ReadHookParams<IntentHashResponseV2 | undefined, {
|
|
3886
2005
|
intent: IntentRequestV2 | undefined;
|
|
3887
2006
|
apiConfig?: RequestOverrideConfig;
|
|
3888
2007
|
}>;
|
|
3889
|
-
/**
|
|
3890
|
-
* React hook to compute the keccak256 hash of an Intent struct via the leverage-yield API —
|
|
3891
|
-
* `sodax.api.leverageYield.getIntentHash`. Returns `{ hash }`.
|
|
3892
|
-
*
|
|
3893
|
-
* @example
|
|
3894
|
-
* const { data } = useLeverageYieldApiIntentHash({ params: { intent } });
|
|
3895
|
-
*/
|
|
3896
2008
|
declare const useLeverageYieldApiIntentHash: ({ params, queryOptions, }?: UseLeverageYieldApiIntentHashParams) => UseQueryResult<IntentHashResponseV2 | undefined, Error>;
|
|
3897
2009
|
|
|
3898
2010
|
type UseLeverageYieldApiIntentPacketParams = ReadHookParams<IntentPacketResponseV2 | undefined, {
|
|
3899
2011
|
body: IntentPacketRequestV2 | undefined;
|
|
3900
2012
|
apiConfig?: RequestOverrideConfig;
|
|
3901
2013
|
}>;
|
|
3902
|
-
/**
|
|
3903
|
-
* React hook to long-poll the relayer until the fill packet lands on the destination chain via the
|
|
3904
|
-
* leverage-yield API — `sodax.api.leverageYield.getSolvedIntentPacket`.
|
|
3905
|
-
*
|
|
3906
|
-
* @example
|
|
3907
|
-
* const { data } = useLeverageYieldApiIntentPacket({ params: { body: { chainId: 'sonic', fillTxHash: '0x...' } } });
|
|
3908
|
-
*/
|
|
2014
|
+
/** Long-polls the relayer until the fill packet lands on the destination chain. */
|
|
3909
2015
|
declare const useLeverageYieldApiIntentPacket: ({ params, queryOptions, }?: UseLeverageYieldApiIntentPacketParams) => UseQueryResult<IntentPacketResponseV2 | undefined, Error>;
|
|
3910
2016
|
|
|
3911
2017
|
type UseLeverageYieldApiIntentExtraDataParams = ReadHookParams<IntentExtraDataResponseV2 | undefined, {
|
|
3912
2018
|
body: IntentExtraDataRequestV2 | undefined;
|
|
3913
2019
|
apiConfig?: RequestOverrideConfig;
|
|
3914
2020
|
}>;
|
|
3915
|
-
/**
|
|
3916
|
-
* React hook to recover the relay extra data needed by `/leverage-yield/intents/submit` via the
|
|
3917
|
-
* leverage-yield API — `sodax.api.leverageYield.getIntentSubmitTxExtraData`. Provide EITHER `txHash`
|
|
3918
|
-
* OR `intent` in the body.
|
|
3919
|
-
*
|
|
3920
|
-
* @example
|
|
3921
|
-
* const { data } = useLeverageYieldApiIntentExtraData({ params: { body: { txHash: '0x...' } } });
|
|
3922
|
-
*/
|
|
2021
|
+
/** Relay extra data for `/leverage-yield/intents/submit`; the body takes EITHER `txHash` OR `intent`. */
|
|
3923
2022
|
declare const useLeverageYieldApiIntentExtraData: ({ params, queryOptions, }?: UseLeverageYieldApiIntentExtraDataParams) => UseQueryResult<IntentExtraDataResponseV2 | undefined, Error>;
|
|
3924
2023
|
|
|
3925
2024
|
type UseLeverageYieldApiFilledIntentParams = ReadHookParams<IntentStateV2 | undefined, {
|
|
3926
2025
|
txHash: string | undefined;
|
|
3927
2026
|
apiConfig?: RequestOverrideConfig;
|
|
3928
2027
|
}>;
|
|
3929
|
-
/**
|
|
3930
|
-
* React hook to get the on-chain fill state for an intent by its hub-chain tx hash via the leverage-yield API — `sodax.api.leverageYield.getFilledIntent`.
|
|
3931
|
-
*
|
|
3932
|
-
* @example
|
|
3933
|
-
* const { data } = useLeverageYieldApiFilledIntent({ params: { txHash: '0x123...' } });
|
|
3934
|
-
*/
|
|
2028
|
+
/** On-chain fill state, keyed by the intent's hub-chain tx hash. */
|
|
3935
2029
|
declare const useLeverageYieldApiFilledIntent: ({ params, queryOptions, }?: UseLeverageYieldApiFilledIntentParams) => UseQueryResult<IntentStateV2 | undefined, Error>;
|
|
3936
2030
|
|
|
3937
2031
|
type UseLeverageYieldApiIntentParams = ReadHookParams<GetIntentResponseV2 | undefined, {
|
|
3938
2032
|
txHash: string | undefined;
|
|
3939
2033
|
apiConfig?: RequestOverrideConfig;
|
|
3940
2034
|
}>;
|
|
3941
|
-
/**
|
|
3942
|
-
* React hook to look up an Intent struct by its hub-chain creation tx hash via the leverage-yield API — `sodax.api.leverageYield.getIntent`.
|
|
3943
|
-
*
|
|
3944
|
-
* @example
|
|
3945
|
-
* const { data } = useLeverageYieldApiIntent({ params: { txHash: '0x123...' } });
|
|
3946
|
-
*/
|
|
2035
|
+
/** Looks up the Intent struct by its hub-chain creation tx hash. */
|
|
3947
2036
|
declare const useLeverageYieldApiIntent: ({ params, queryOptions, }?: UseLeverageYieldApiIntentParams) => UseQueryResult<GetIntentResponseV2 | undefined, Error>;
|
|
3948
2037
|
|
|
3949
2038
|
type UseLeverageYieldApiEstimateGasParams = ReadHookParams<GasEstimateResponseV2 | undefined, {
|
|
3950
2039
|
body: GasEstimateRequestV2 | undefined;
|
|
3951
2040
|
apiConfig?: RequestOverrideConfig;
|
|
3952
2041
|
}>;
|
|
3953
|
-
/**
|
|
3954
|
-
* React hook to estimate gas for a raw transaction on a spoke chain via the leverage-yield API —
|
|
3955
|
-
* `sodax.api.leverageYield.estimateGas`. Returns `{ gas }` (chain-specific shape).
|
|
3956
|
-
*
|
|
3957
|
-
* @example
|
|
3958
|
-
* const { data } = useLeverageYieldApiEstimateGas({ params: { body: { chainKey: 'sonic', tx: {...} } } });
|
|
3959
|
-
*/
|
|
2042
|
+
/** Returns `{ gas }` in a chain-specific shape. */
|
|
3960
2043
|
declare const useLeverageYieldApiEstimateGas: ({ params, queryOptions, }?: UseLeverageYieldApiEstimateGasParams) => UseQueryResult<GasEstimateResponseV2 | undefined, Error>;
|
|
3961
2044
|
|
|
3962
2045
|
type UseLeverageYieldApiPartnerFeeParams = ReadHookParams<FeeResponseV2 | undefined, {
|
|
3963
2046
|
amount: string | undefined;
|
|
3964
2047
|
apiConfig?: RequestOverrideConfig;
|
|
3965
2048
|
}>;
|
|
3966
|
-
/**
|
|
3967
|
-
* React hook to compute the partner fee for a given input amount via the leverage-yield API — `sodax.api.leverageYield.getPartnerFee`.
|
|
3968
|
-
* Returns `{ fee }` (decimal string).
|
|
3969
|
-
*
|
|
3970
|
-
* @example
|
|
3971
|
-
* const { data } = useLeverageYieldApiPartnerFee({ params: { amount: '1000000' } });
|
|
3972
|
-
*/
|
|
2049
|
+
/** Returns `{ fee }` as a decimal string. */
|
|
3973
2050
|
declare const useLeverageYieldApiPartnerFee: ({ params, queryOptions, }?: UseLeverageYieldApiPartnerFeeParams) => UseQueryResult<FeeResponseV2 | undefined, Error>;
|
|
3974
2051
|
|
|
3975
2052
|
type UseLeverageYieldApiSolverFeeParams = ReadHookParams<FeeResponseV2 | undefined, {
|
|
3976
2053
|
amount: string | undefined;
|
|
3977
2054
|
apiConfig?: RequestOverrideConfig;
|
|
3978
2055
|
}>;
|
|
3979
|
-
/**
|
|
3980
|
-
* React hook to compute the protocol (solver) fee for a given input amount via the leverage-yield API — `sodax.api.leverageYield.getSolverFee`.
|
|
3981
|
-
* Returns `{ fee }` (decimal string).
|
|
3982
|
-
*
|
|
3983
|
-
* @example
|
|
3984
|
-
* const { data } = useLeverageYieldApiSolverFee({ params: { amount: '1000000' } });
|
|
3985
|
-
*/
|
|
2056
|
+
/** Maximum solver fee for `amount`, as a decimal string `{ fee }`. */
|
|
3986
2057
|
declare const useLeverageYieldApiSolverFee: ({ params, queryOptions, }?: UseLeverageYieldApiSolverFeeParams) => UseQueryResult<FeeResponseV2 | undefined, Error>;
|
|
3987
2058
|
|
|
3988
|
-
/**
|
|
3989
|
-
* Mutation variables for {@link useLeverageYieldApiSubmitTx}. The per-request `apiConfig` override belongs here
|
|
3990
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
3991
|
-
* endpoints without re-rendering.
|
|
3992
|
-
*/
|
|
2059
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
3993
2060
|
type UseLeverageYieldApiSubmitTxVars = {
|
|
3994
2061
|
request: LeverageYieldSubmitTxRequestV2;
|
|
3995
2062
|
apiConfig?: RequestOverrideConfig;
|
|
3996
2063
|
};
|
|
3997
|
-
/**
|
|
3998
|
-
* React hook to submit a vault-swap transaction to be processed (relay, post-execution, etc.) via the leverage-yield API — `sodax.api.leverageYield.submitTx`.
|
|
3999
|
-
*/
|
|
2064
|
+
/** Submits a vault-swap tx for backend processing (relay, post-execution). */
|
|
4000
2065
|
declare const useLeverageYieldApiSubmitTx: ({ mutationOptions, }?: MutationHookParams<SubmitTxResponseV2, UseLeverageYieldApiSubmitTxVars>) => SafeUseMutationResult<SubmitTxResponseV2, Error, UseLeverageYieldApiSubmitTxVars>;
|
|
4001
2066
|
|
|
4002
2067
|
type UseLeverageYieldApiSubmitTxStatusParams = ReadHookParams<SubmitTxStatusResponseV2 | undefined, {
|
|
@@ -4004,29 +2069,11 @@ type UseLeverageYieldApiSubmitTxStatusParams = ReadHookParams<SubmitTxStatusResp
|
|
|
4004
2069
|
srcChainKey?: string;
|
|
4005
2070
|
apiConfig?: RequestOverrideConfig;
|
|
4006
2071
|
}>;
|
|
4007
|
-
/**
|
|
4008
|
-
* React hook for polling the processing status of a submitted vault-swap transaction via the
|
|
4009
|
-
* leverage-yield API — `sodax.api.leverageYield.getSubmitTxStatus`. Both `txHash` and `srcChainKey`
|
|
4010
|
-
* are required for the query to run.
|
|
4011
|
-
*
|
|
4012
|
-
* @example
|
|
4013
|
-
* const { data: status } = useLeverageYieldApiSubmitTxStatus({
|
|
4014
|
-
* params: { txHash: '0x123...', srcChainKey: 'sonic' },
|
|
4015
|
-
* });
|
|
4016
|
-
*
|
|
4017
|
-
* @remarks
|
|
4018
|
-
* - Default refetch interval is 1 second; stops on 'solved' or 'failed' status, when the backend
|
|
4019
|
-
* marks the submission abandoned (`abandonedAt`) while `status` stays non-terminal, or once the
|
|
4020
|
-
* backend rejects the API key (401/403 is terminal — a retry cannot fix it).
|
|
4021
|
-
*/
|
|
2072
|
+
/** Polls every 1s until 'solved'/'failed', `abandonedAt` is set, or the API key is rejected (401/403 is terminal). */
|
|
4022
2073
|
declare const useLeverageYieldApiSubmitTxStatus: ({ params, queryOptions, }?: UseLeverageYieldApiSubmitTxStatusParams) => UseQueryResult<SubmitTxStatusResponseV2 | undefined, Error>;
|
|
4023
2074
|
|
|
4024
|
-
/** Keep mutation variables aligned with the SDK operation. */
|
|
4025
2075
|
type UseActivateStellarAccountVars = ActivateStellarAccountParams;
|
|
4026
|
-
/**
|
|
4027
|
-
* Activate a Stellar account through the sponsoring service. Both `submitted`
|
|
4028
|
-
* and `alreadyActive` are successful outcomes.
|
|
4029
|
-
*/
|
|
2076
|
+
/** Both `submitted` and `alreadyActive` are successful outcomes. */
|
|
4030
2077
|
declare function useActivateStellarAccount({ mutationOptions, }?: MutationHookParams<ActivateStellarAccountResult, UseActivateStellarAccountVars>): SafeUseMutationResult<ActivateStellarAccountResult, Error, UseActivateStellarAccountVars>;
|
|
4031
2078
|
|
|
4032
2079
|
type UseSponsorConfigParams = ReadHookParams<StellarSponsorConfig>;
|
|
@@ -4040,7 +2087,6 @@ declare function getSponsorConfigQueryOptions({ sodax }: {
|
|
|
4040
2087
|
queryFn: () => Promise<StellarSponsorConfig>;
|
|
4041
2088
|
staleTime: number;
|
|
4042
2089
|
};
|
|
4043
|
-
/** Read the sponsoring service's published transaction parameters. */
|
|
4044
2090
|
declare function useSponsorConfig({ queryOptions, }?: UseSponsorConfigParams): UseQueryResult<StellarSponsorConfig, Error>;
|
|
4045
2091
|
|
|
4046
2092
|
type UseStellarAccountActiveParams = ReadHookParams<boolean, {
|
|
@@ -4057,7 +2103,6 @@ declare function getStellarAccountActiveQueryOptions({ sodax, address, }: {
|
|
|
4057
2103
|
queryFn: () => Promise<boolean>;
|
|
4058
2104
|
enabled: boolean;
|
|
4059
2105
|
};
|
|
4060
|
-
/** Whether a Stellar account exists on-chain. */
|
|
4061
2106
|
declare function useStellarAccountActive({ params, queryOptions, }?: UseStellarAccountActiveParams): UseQueryResult<boolean, Error>;
|
|
4062
2107
|
|
|
4063
2108
|
type UseStellarAccountStatusParams = ReadHookParams<StellarAccountStatus, {
|
|
@@ -4074,26 +2119,12 @@ declare function getStellarAccountStatusQueryOptions({ sodax, address, }: {
|
|
|
4074
2119
|
queryFn: () => Promise<StellarAccountStatus>;
|
|
4075
2120
|
enabled: boolean;
|
|
4076
2121
|
};
|
|
4077
|
-
/**
|
|
4078
|
-
* Read account existence and trustline affordability in one Horizon request.
|
|
4079
|
-
* Prefer {@link useStellarGate} for destination gating.
|
|
4080
|
-
*/
|
|
2122
|
+
/** One Horizon request; prefer {@link useStellarGate} for destination gating. */
|
|
4081
2123
|
declare function useStellarAccountStatus({ params, queryOptions, }?: UseStellarAccountStatusParams): UseQueryResult<StellarAccountStatus, Error>;
|
|
4082
2124
|
|
|
4083
2125
|
interface SodaxProviderProps {
|
|
4084
2126
|
children: ReactNode;
|
|
4085
|
-
/**
|
|
4086
|
-
* Sodax SDK config. Tracked by **reference** - a new identity re-instantiates the
|
|
4087
|
-
* SDK. Hoist to a module constant or wrap in `useMemo`; include any value the SDK
|
|
4088
|
-
* should react to (e.g. solver env) in the deps. Inline `{...}` re-creates the SDK
|
|
4089
|
-
* every parent render and resets every `useSodaxContext` consumer.
|
|
4090
|
-
*
|
|
4091
|
-
* @example
|
|
4092
|
-
* ```tsx
|
|
4093
|
-
* const config = useMemo(() => ({ solver: solverMap[env] }), [env]);
|
|
4094
|
-
* <SodaxProvider config={config}>...</SodaxProvider>
|
|
4095
|
-
* ```
|
|
4096
|
-
*/
|
|
2127
|
+
/** Tracked by reference: a new identity re-creates the SDK and resets consumers, so memoize it. */
|
|
4097
2128
|
config?: SodaxOptions;
|
|
4098
2129
|
}
|
|
4099
2130
|
/** Root provider for `@sodax/dapp-kit`. Must be paired with `QueryClientProvider`. */
|
|
@@ -4101,62 +2132,13 @@ declare const SodaxProvider: ({ children, config }: SodaxProviderProps) => React
|
|
|
4101
2132
|
|
|
4102
2133
|
type CreateSodaxQueryClientOptions = {
|
|
4103
2134
|
/**
|
|
4104
|
-
*
|
|
4105
|
-
*
|
|
4106
|
-
*
|
|
4107
|
-
* This is **global observability** — it runs alongside any per-hook `onError` handler the
|
|
4108
|
-
* consumer set, NOT instead of them. In particular, it fires:
|
|
4109
|
-
* - whether or not `mutateAsync` was awaited inside `try/catch`
|
|
4110
|
-
* - whether or not `mutateAsyncSafe` was used (the wrapper packs into `Result<T>` AFTER React
|
|
4111
|
-
* Query has already entered the error state and dispatched its callbacks)
|
|
4112
|
-
* - whether or not the consumer's `mutationOptions.onError` already toasted/logged
|
|
4113
|
-
*
|
|
4114
|
-
* It is NOT a "did this rejection escape to the global handler?" detector — accurate
|
|
4115
|
-
* unhandled-rejection detection lives at `window.onunhandledrejection`, not here.
|
|
4116
|
-
*
|
|
4117
|
-
* To silence the default for a specific mutation that the consumer is handling locally, set
|
|
4118
|
-
* `meta: { silent: true }`:
|
|
4119
|
-
*
|
|
4120
|
-
* ```ts
|
|
4121
|
-
* useSwap({ mutationOptions: { meta: { silent: true }, onError: (e) => toast(e.message) } });
|
|
4122
|
-
* ```
|
|
4123
|
-
*
|
|
4124
|
-
* To disable the default globally (e.g. wire your own error boundary), pass a no-op:
|
|
4125
|
-
*
|
|
4126
|
-
* ```ts
|
|
4127
|
-
* createSodaxQueryClient({ onMutationError: () => {} });
|
|
4128
|
-
* ```
|
|
2135
|
+
* Fires on every mutation failure, alongside per-hook `onError`, unless the mutation sets `meta: { silent: true }`.
|
|
2136
|
+
* Defaults to `console.error`.
|
|
4129
2137
|
*/
|
|
4130
2138
|
onMutationError?: (error: unknown) => void;
|
|
4131
|
-
/** Pass-through for any other QueryClient config (default queries options, etc.) */
|
|
4132
2139
|
config?: QueryClientConfig;
|
|
4133
2140
|
};
|
|
4134
|
-
/**
|
|
4135
|
-
* Creates a `QueryClient` pre-wired with a mutation-error observability hook that gives dapp-kit
|
|
4136
|
-
* consumers a single seam for every mutation failure across the app — wire to Sentry/Datadog/console
|
|
4137
|
-
* as you like. Optional opt-in: consumers who construct their own `QueryClient` are unaffected.
|
|
4138
|
-
*
|
|
4139
|
-
* **Composition with a custom `MutationCache`.** If you pass `config.mutationCache`, we keep your
|
|
4140
|
-
* cache instance (preserving its own `onError` / `onSuccess` / etc.) and *additionally* subscribe
|
|
4141
|
-
* to its event stream to dispatch `onMutationError`. Both your handler and the dapp-kit handler
|
|
4142
|
-
* fire — neither replaces the other. If you don't pass one, we install our own.
|
|
4143
|
-
*
|
|
4144
|
-
* @example default — logs to console
|
|
4145
|
-
* const queryClient = createSodaxQueryClient();
|
|
4146
|
-
*
|
|
4147
|
-
* @example custom — Sentry
|
|
4148
|
-
* const queryClient = createSodaxQueryClient({
|
|
4149
|
-
* onMutationError: (e) => Sentry.captureException(e),
|
|
4150
|
-
* });
|
|
4151
|
-
*
|
|
4152
|
-
* @example silent — disable the default
|
|
4153
|
-
* const queryClient = createSodaxQueryClient({ onMutationError: () => {} });
|
|
4154
|
-
*
|
|
4155
|
-
* @example bring-your-own MutationCache
|
|
4156
|
-
* const myCache = new MutationCache({ onError: myOwnErrorHandler });
|
|
4157
|
-
* const queryClient = createSodaxQueryClient({ config: { mutationCache: myCache } });
|
|
4158
|
-
* // myOwnErrorHandler still runs; onMutationError ALSO runs (unless meta.silent).
|
|
4159
|
-
*/
|
|
2141
|
+
/** A custom `config.mutationCache` is kept and subscribed to, so its own handlers still fire too. */
|
|
4160
2142
|
declare function createSodaxQueryClient({ onMutationError, config, }?: CreateSodaxQueryClientOptions): QueryClient;
|
|
4161
2143
|
|
|
4162
|
-
export { type ATokenData, type ApprovalHashes, type ApprovalPlan, type ApprovalProgress, type ApprovalProgressListener, type BackendPaginationParams, type BalancesInputs, type BitcoinTradingSetup, type BridgeApiApprovalHashes, type CreateSodaxQueryClientOptions, type DecreaseLiquidityParamsCore, type DepositParamsCore, type LeverageYieldApiApprovalHashes, type LeverageYieldShareHolder, type LeverageYieldShareHolding, type MutationHookOptions, type MutationHookParams, type NearStorageCheckResult, type NearStorageGate, type NearStorageGateState, type RadfiSession, type ReadHookParams, type ReadQueryOptions, type ReserveUsdFormat, type SafeUseMutationResult, SodaxProvider, type StellarCheckResult, type StellarGate, type StellarGateInputs, type StellarGateState, type SwapLifecycle, type SwapLifecycleState, type SwapSetupReason, type SwapsApiApprovalHashes, type SwapsApiBroadcastWithApprovalResult, type UseATokenParams, type UseATokensBalancesParams, type UseActivateStellarAccountVars, type UseApproveLeveragePositionFundingVars, type UseApproveTokenVars, type UseBalancesParams, type UseBitcoinBalanceParams, type UseBitcoinTradingSetupParams, type UseBorrowVars, type UseBridgeAllowanceParams, type UseBridgeApiAllowanceParams, type UseBridgeApiApproveAndBroadcastVars, type UseBridgeApiApproveVars, type UseBridgeApiBridgeableAmountParams, type UseBridgeApiCreateBridgeIntentVars, type UseBridgeApiFeeParams, type UseBridgeApiIsBridgeableParams, type UseBridgeApiSubmitTxStatusParams, type UseBridgeApiSubmitTxVars, type UseBridgeApiTokensByChainParams, type UseBridgeApiTokensParams, type UseBridgeApprovalStrategyParams, type UseBridgeApproveVars, type UseBridgeDetailedStatusParams, type UseBridgeDetailedStatusResult, type UseBridgeVars, type UseBridgeWithApprovalVars, type UseClaimRewardsVars, type UseCreateDecreaseLiquidityParamsProps, type UseCreateDepositParamsProps, type UseCreateLimitOrderVars, type UseCreateSupplyLiquidityParamsProps, type UseCreateSupplyLiquidityParamsResult, type UseCreateWithdrawParamsProps, type UseDecreaseLiquidityVars, type UseDeriveUserWalletAddressParams, type UseDetailedStatusParams, type UseDetailedStatusResult, type UseDexAllowanceParams, type UseDexApproveVars, type UseDexDepositVars, type UseDexWithdrawVars, type UseEModesParams, type UseEnsureRadfiAccessTokenVars, type UseEstablishTrustlineVars, type UseExpiredUtxosParams, type UseFeeClaimSwapVars, type UseFeeClaimWithdrawVars, type UseFetchAssetsBalancesParams, type UseFundTradingWalletVars, type UseGetAutoSwapPreferencesParams, type UseGetBridgeableAmountParams, type UseGetBridgeableTokensParams, type UseGetIntentDetailsParams, type UseGetUserHubWalletAddressParams, type UseGetUserIntentParams, type UseHubAssetBalancesParams, type UseIsTokenApprovedParams, type UseLeveragePositionAccountParams, type UseLeveragePositionCollateralParams, type UseLeveragePositionFundingAllowanceParams, type UseLeveragePositionInfoParams, type UseLeveragePositionPayoutAddressParams, type UseLeveragePositionPendingParams, type UseLeveragePositionsForUserParams, type UseLeveragePositionsParams, type UseLeverageYieldApiAllowanceParams, type UseLeverageYieldApiApproveAndBroadcastVars, type UseLeverageYieldApiApproveVars, type UseLeverageYieldApiAprParams, type UseLeverageYieldApiAssetParams, type UseLeverageYieldApiCancelIntentVars, type UseLeverageYieldApiCreateDepositIntentVars, type UseLeverageYieldApiCreateWithdrawIntentVars, type UseLeverageYieldApiDeadlineParams, type UseLeverageYieldApiDepositQuoteParams, type UseLeverageYieldApiEffectiveAprParams, type UseLeverageYieldApiEstimateGasParams, type UseLeverageYieldApiFilledIntentParams, type UseLeverageYieldApiIntentExtraDataParams, type UseLeverageYieldApiIntentHashParams, type UseLeverageYieldApiIntentPacketParams, type UseLeverageYieldApiIntentParams, type UseLeverageYieldApiLsdAprParams, type UseLeverageYieldApiMaxWithdrawParams, type UseLeverageYieldApiPartnerFeeParams, type UseLeverageYieldApiPositionParams, type UseLeverageYieldApiPreviewDepositParams, type UseLeverageYieldApiPreviewRedeemParams, type UseLeverageYieldApiPreviewWithdrawParams, type UseLeverageYieldApiShareBalanceParams, type UseLeverageYieldApiSolverFeeParams, type UseLeverageYieldApiStatusParams, type UseLeverageYieldApiSubmitIntentVars, type UseLeverageYieldApiSubmitTxStatusParams, type UseLeverageYieldApiSubmitTxVars, type UseLeverageYieldApiTotalAssetsParams, type UseLeverageYieldApiVaultParams, type UseLeverageYieldApiVaultsParams, type UseLeverageYieldApiWithdrawQuoteParams, type UseLeverageYieldApprovalStrategyParams, type UseLeverageYieldDepositVars, type UseLeverageYieldDetailedStatusParams, type UseLeverageYieldDetailedStatusResult, type UseLeverageYieldEffectiveAprParams, type UseLeverageYieldNotifySolverVars, type UseLeverageYieldPositionParams, type UseLeverageYieldPreviewRedeemParams, type UseLeverageYieldQuoteParams, type UseLeverageYieldShareBalancesParams, type UseLeverageYieldTotalAssetsParams, type UseLeverageYieldVaultSwapVars, type UseLeverageYieldVaultSwapWithApprovalVars, type UseLeverageYieldWithdrawVars, type UseLiquidityAmountsResult, type UseMMAllowanceParams, type UseMMApproveVars, type UseMigrateBalnVars, type UseMigrateIcxToSodaVars, type UseMigratebnUSDVars, type UseMigrationAllowanceInputs, type UseMigrationAllowanceParams, type UseMigrationApproveVars, type UseNearStorageCheckParams, type UseNearStorageGateParams, type UseOpenLeveragePositionVars, type UsePartnerCancelIntentVars, type UsePoolBalancesParams, type UsePoolBalancesResponse, type UsePoolDataParams, type UsePoolsParams, type UsePositionInfoParams, type UsePositionInfoResponse, type UseQuoteParams, type UseRadfiAuthVars, type UseRadfiSessionReturn, type UseRadfiWithdrawVars, type UseRegisterNearStorageVars, type UseRenewUtxosVars, type UseRepayVars, type UseReservesDataParams, type UseReservesHumanizedParams, type UseReservesListParams, type UseReservesUsdFormatParams, type UseRevertMigrateSodaToIcxVars, type UseRunLeveragePositionOperationVars, type UseSetSwapPreferenceVars, type UseSetSwapPreferenceVarsHub, type UseSponsorConfigParams, type UseStatusParams, type UseStellarAccountActiveParams, type UseStellarAccountStatusParams, type UseStellarGateParams, type UseStellarTrustlineCheckParams, type UseSubmitLeveragePositionIntentVars, type UseSupplyLiquidityVars, type UseSupplyVars, type UseSwapAllowanceParams, type UseSwapApprovalStrategyParams, type UseSwapApproveVars, type UseSwapLifecycleParams, type UseSwapVars, type UseSwapWithApprovalVars, type UseSwapsApiAllowanceParams, type UseSwapsApiApproveAndBroadcastVars, type UseSwapsApiApproveVars, type UseSwapsApiBroadcastWithApprovalVars, type UseSwapsApiCancelIntentVars, type UseSwapsApiCreateIntentVars, type UseSwapsApiCreateLimitOrderVars, type UseSwapsApiDeadlineParams, type UseSwapsApiEstimateGasParams, type UseSwapsApiFilledIntentParams, type UseSwapsApiIntentExtraDataParams, type UseSwapsApiIntentHashParams, type UseSwapsApiIntentPacketParams, type UseSwapsApiIntentParams, type UseSwapsApiPartnerFeeParams, type UseSwapsApiQuoteParams, type UseSwapsApiSolverFeeParams, type UseSwapsApiStatusParams, type UseSwapsApiSubmitIntentVars, type UseSwapsApiSubmitTxStatusParams, type UseSwapsApiSubmitTxVars, type UseSwapsApiTokensByChainParams, type UseSwapsApiTokensParams, type UseTradingWalletBalanceParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawHubAssetVars, type UseWithdrawVars, type UseXBalancesParams, type WithdrawParamsCore, type XBalancesInputs, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getBalancesQueryOptions, getBridgeDetailedStatusRefetchInterval, getLeverageYieldQuoteQueryOptions, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getSwapQuoteQueryOptions, getXBalancesQueryOptions, invalidateBalances, isBridgeMpcRelayRead, isBridgeNotDelivered, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, retryUnlessAuthFailure, runApprovalPlan, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveLeveragePositionFunding, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOracleCandles, useBackendOracleMarkets, useBackendOrderbook, useBackendUserIntents, useBalances, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApiAllowance, useBridgeApiApprove, useBridgeApiApproveAndBroadcast, useBridgeApiBridgeableAmount, useBridgeApiCreateBridgeIntent, useBridgeApiFee, useBridgeApiIsBridgeable, useBridgeApiSubmitTx, useBridgeApiSubmitTxStatus, useBridgeApiTokens, useBridgeApiTokensByChain, useBridgeApprovalStrategy, useBridgeApprove, useBridgeDetailedStatus, useBridgeWithApproval, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDetailedStatus, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEModes, useEnsureRadfiAccessToken, useEstablishTrustline, useEstimateGas, useExpiredUtxos, useFeeClaimSwap, useFeeClaimWithdraw, useFetchAssetsBalances, useFundTradingWallet, useGetAutoSwapPreferences, useGetBridgeableAmount, useGetBridgeableTokens, useGetIntentDetails, useGetUserHubWalletAddress, useGetUserIntent, useHubAssetBalances, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useIsTokenApproved, useLeveragePositionAccount, useLeveragePositionCollateral, useLeveragePositionFundingAllowance, useLeveragePositionInfo, useLeveragePositionPayoutAddress, useLeveragePositionPending, useLeveragePositions, useLeveragePositionsForUser, useLeverageYieldApiAllowance, useLeverageYieldApiApprove, useLeverageYieldApiApproveAndBroadcast, useLeverageYieldApiApr, useLeverageYieldApiAsset, useLeverageYieldApiCancelIntent, useLeverageYieldApiCreateDepositIntent, useLeverageYieldApiCreateWithdrawIntent, useLeverageYieldApiDeadline, useLeverageYieldApiDepositQuote, useLeverageYieldApiEffectiveApr, useLeverageYieldApiEstimateGas, useLeverageYieldApiFilledIntent, useLeverageYieldApiIntent, useLeverageYieldApiIntentExtraData, useLeverageYieldApiIntentHash, useLeverageYieldApiIntentPacket, useLeverageYieldApiLsdApr, useLeverageYieldApiMaxWithdraw, useLeverageYieldApiPartnerFee, useLeverageYieldApiPosition, useLeverageYieldApiPreviewDeposit, useLeverageYieldApiPreviewRedeem, useLeverageYieldApiPreviewWithdraw, useLeverageYieldApiShareBalance, useLeverageYieldApiSolverFee, useLeverageYieldApiStatus, useLeverageYieldApiSubmitIntent, useLeverageYieldApiSubmitTx, useLeverageYieldApiSubmitTxStatus, useLeverageYieldApiTotalAssets, useLeverageYieldApiVault, useLeverageYieldApiVaults, useLeverageYieldApiWithdrawQuote, useLeverageYieldApprovalStrategy, useLeverageYieldDeposit, useLeverageYieldDetailedStatus, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, useLeverageYieldQuote, useLeverageYieldShareBalances, useLeverageYieldTotalAssets, useLeverageYieldVaultSwap, useLeverageYieldVaultSwapWithApproval, useLeverageYieldWithdraw, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrateBaln, useMigrateIcxToSoda, useMigratebnUSD, useMigrationAllowance, useMigrationApprove, useNearStorageCheck, useNearStorageGate, useOpenLeveragePosition, usePartnerCancelIntent, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRegisterNearStorage, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesHumanized, useReservesList, useReservesUsdFormat, useRevertMigrateSodaToIcx, useRunLeveragePositionOperation, useSafeMutation, useSetSwapPreference, useSodaxContext, useSponsorConfig, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarAccountActive, useStellarAccountStatus, useStellarGate, useStellarTrustlineCheck, useSubmitLeveragePositionIntent, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprovalStrategy, useSwapApprove, useSwapLifecycle, useSwapWithApproval, useSwapsApiAllowance, useSwapsApiApprove, useSwapsApiApproveAndBroadcast, useSwapsApiBroadcastWithApproval, useSwapsApiCancelIntent, useSwapsApiCreateIntent, useSwapsApiCreateLimitOrder, useSwapsApiDeadline, useSwapsApiEstimateGas, useSwapsApiFilledIntent, useSwapsApiIntent, useSwapsApiIntentExtraData, useSwapsApiIntentHash, useSwapsApiIntentPacket, useSwapsApiPartnerFee, useSwapsApiQuote, useSwapsApiSolverFee, useSwapsApiStatus, useSwapsApiSubmitIntent, useSwapsApiSubmitTx, useSwapsApiSubmitTxStatus, useSwapsApiTokens, useSwapsApiTokensByChain, useTradingWallet, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw, useWithdrawHubAsset, useXBalances };
|
|
2144
|
+
export { type ATokenData, type ApprovalHashes, type ApprovalPlan, type ApprovalProgress, type ApprovalProgressListener, type BackendPaginationParams, type BalancesInputs, type BitcoinTradingSetup, type BridgeApiApprovalHashes, type CreateSodaxQueryClientOptions, type DecreaseLiquidityParamsCore, type DepositParamsCore, type LeverageYieldApiApprovalHashes, type LeverageYieldShareHolder, type LeverageYieldShareHolding, type MutationHookOptions, type MutationHookParams, type NearStorageCheckResult, type NearStorageGate, type NearStorageGateState, type RadfiSession, type ReadHookParams, type ReadQueryOptions, type ReserveUsdFormat, type SafeUseMutationResult, SodaxProvider, type StellarCheckResult, type StellarGate, type StellarGateInputs, type StellarGateState, type SwapLifecycle, type SwapLifecycleState, type SwapSetupReason, type SwapsApiApprovalHashes, type SwapsApiBroadcastWithApprovalResult, type UseATokenParams, type UseATokensBalancesParams, type UseActivateStellarAccountVars, type UseApproveLeveragePositionFundingVars, type UseApproveTokenVars, type UseBalancesParams, type UseBitcoinBalanceParams, type UseBitcoinTradingSetupParams, type UseBorrowVars, type UseBridgeAllowanceParams, type UseBridgeApiAllowanceParams, type UseBridgeApiApproveAndBroadcastVars, type UseBridgeApiApproveVars, type UseBridgeApiBridgeableAmountParams, type UseBridgeApiCreateBridgeIntentVars, type UseBridgeApiFeeParams, type UseBridgeApiIsBridgeableParams, type UseBridgeApiSubmitTxStatusParams, type UseBridgeApiSubmitTxVars, type UseBridgeApiTokensByChainParams, type UseBridgeApiTokensParams, type UseBridgeApprovalStrategyParams, type UseBridgeApproveVars, type UseBridgeDetailedStatusParams, type UseBridgeDetailedStatusResult, type UseBridgeVars, type UseBridgeWithApprovalVars, type UseClaimRewardsVars, type UseCreateDecreaseLiquidityParamsProps, type UseCreateDepositParamsProps, type UseCreateLimitOrderVars, type UseCreateSupplyLiquidityParamsProps, type UseCreateSupplyLiquidityParamsResult, type UseCreateWithdrawParamsProps, type UseDecreaseLiquidityVars, type UseDeriveUserWalletAddressParams, type UseDetailedStatusParams, type UseDetailedStatusResult, type UseDexAllowanceParams, type UseDexApproveVars, type UseDexDepositVars, type UseDexWithdrawVars, type UseEModesParams, type UseEnsureRadfiAccessTokenVars, type UseEstablishTrustlineVars, type UseEstablishXrpTrustlineVars, type UseExpiredUtxosParams, type UseFeeClaimSwapVars, type UseFeeClaimWithdrawVars, type UseFetchAssetsBalancesParams, type UseFundTradingWalletVars, type UseGetAutoSwapPreferencesParams, type UseGetBridgeableAmountParams, type UseGetBridgeableTokensParams, type UseGetIntentDetailsParams, type UseGetUserHubWalletAddressParams, type UseGetUserIntentParams, type UseHubAssetBalancesParams, type UseIsTokenApprovedParams, type UseLeveragePositionAccountParams, type UseLeveragePositionCollateralParams, type UseLeveragePositionFundingAllowanceParams, type UseLeveragePositionInfoParams, type UseLeveragePositionPayoutAddressParams, type UseLeveragePositionPendingParams, type UseLeveragePositionsForUserParams, type UseLeveragePositionsParams, type UseLeverageYieldApiAllowanceParams, type UseLeverageYieldApiApproveAndBroadcastVars, type UseLeverageYieldApiApproveVars, type UseLeverageYieldApiAprParams, type UseLeverageYieldApiAssetParams, type UseLeverageYieldApiCancelIntentVars, type UseLeverageYieldApiCreateDepositIntentVars, type UseLeverageYieldApiCreateWithdrawIntentVars, type UseLeverageYieldApiDeadlineParams, type UseLeverageYieldApiDepositQuoteParams, type UseLeverageYieldApiEffectiveAprParams, type UseLeverageYieldApiEstimateGasParams, type UseLeverageYieldApiFilledIntentParams, type UseLeverageYieldApiIntentExtraDataParams, type UseLeverageYieldApiIntentHashParams, type UseLeverageYieldApiIntentPacketParams, type UseLeverageYieldApiIntentParams, type UseLeverageYieldApiLsdAprParams, type UseLeverageYieldApiMaxWithdrawParams, type UseLeverageYieldApiPartnerFeeParams, type UseLeverageYieldApiPositionParams, type UseLeverageYieldApiPreviewDepositParams, type UseLeverageYieldApiPreviewRedeemParams, type UseLeverageYieldApiPreviewWithdrawParams, type UseLeverageYieldApiShareBalanceParams, type UseLeverageYieldApiSolverFeeParams, type UseLeverageYieldApiStatusParams, type UseLeverageYieldApiSubmitIntentVars, type UseLeverageYieldApiSubmitTxStatusParams, type UseLeverageYieldApiSubmitTxVars, type UseLeverageYieldApiTotalAssetsParams, type UseLeverageYieldApiVaultParams, type UseLeverageYieldApiVaultsParams, type UseLeverageYieldApiWithdrawQuoteParams, type UseLeverageYieldApprovalStrategyParams, type UseLeverageYieldDepositVars, type UseLeverageYieldDetailedStatusParams, type UseLeverageYieldDetailedStatusResult, type UseLeverageYieldEffectiveAprParams, type UseLeverageYieldNotifySolverVars, type UseLeverageYieldPositionParams, type UseLeverageYieldPreviewRedeemParams, type UseLeverageYieldQuoteParams, type UseLeverageYieldShareBalancesParams, type UseLeverageYieldTotalAssetsParams, type UseLeverageYieldVaultSwapVars, type UseLeverageYieldVaultSwapWithApprovalVars, type UseLeverageYieldWithdrawVars, type UseLiquidityAmountsResult, type UseMMAllowanceParams, type UseMMApproveVars, type UseMigrateBalnVars, type UseMigrateIcxToSodaVars, type UseMigratebnUSDVars, type UseMigrationAllowanceInputs, type UseMigrationAllowanceParams, type UseMigrationApproveVars, type UseNearStorageCheckParams, type UseNearStorageGateParams, type UseOpenLeveragePositionVars, type UsePartnerCancelIntentVars, type UsePoolBalancesParams, type UsePoolBalancesResponse, type UsePoolDataParams, type UsePoolsParams, type UsePositionInfoParams, type UsePositionInfoResponse, type UseQuoteParams, type UseRadfiAuthVars, type UseRadfiSessionReturn, type UseRadfiWithdrawVars, type UseRegisterNearStorageVars, type UseRenewUtxosVars, type UseRepayVars, type UseReservesDataParams, type UseReservesHumanizedParams, type UseReservesListParams, type UseReservesUsdFormatParams, type UseRevertMigrateSodaToIcxVars, type UseRunLeveragePositionOperationVars, type UseSetSwapPreferenceVars, type UseSetSwapPreferenceVarsHub, type UseSponsorConfigParams, type UseStatusParams, type UseStellarAccountActiveParams, type UseStellarAccountStatusParams, type UseStellarGateParams, type UseStellarTrustlineCheckParams, type UseSubmitLeveragePositionIntentVars, type UseSupplyLiquidityVars, type UseSupplyVars, type UseSwapAllowanceParams, type UseSwapApprovalStrategyParams, type UseSwapApproveVars, type UseSwapLifecycleParams, type UseSwapVars, type UseSwapWithApprovalVars, type UseSwapsApiAllowanceParams, type UseSwapsApiApproveAndBroadcastVars, type UseSwapsApiApproveVars, type UseSwapsApiBroadcastWithApprovalVars, type UseSwapsApiCancelIntentVars, type UseSwapsApiCreateIntentVars, type UseSwapsApiCreateLimitOrderVars, type UseSwapsApiDeadlineParams, type UseSwapsApiEstimateGasParams, type UseSwapsApiFilledIntentParams, type UseSwapsApiIntentExtraDataParams, type UseSwapsApiIntentHashParams, type UseSwapsApiIntentPacketParams, type UseSwapsApiIntentParams, type UseSwapsApiPartnerFeeParams, type UseSwapsApiQuoteParams, type UseSwapsApiSolverFeeParams, type UseSwapsApiStatusParams, type UseSwapsApiSubmitIntentVars, type UseSwapsApiSubmitTxStatusParams, type UseSwapsApiSubmitTxVars, type UseSwapsApiTokensByChainParams, type UseSwapsApiTokensParams, type UseTradingWalletBalanceParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawHubAssetVars, type UseWithdrawVars, type UseXBalancesParams, type UseXrpDestinationCheckParams, type UseXrpGateParams, type UseXrpTrustlineReserveCheckParams, type WithdrawParamsCore, type XBalancesInputs, type XrpBlockedReason, type XrpCheckResult, type XrpGate, type XrpGateInputs, type XrpGateState, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getBalancesQueryOptions, getBridgeDetailedStatusRefetchInterval, getLeverageYieldQuoteQueryOptions, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getSwapQuoteQueryOptions, getXBalancesQueryOptions, getXrpDestinationCheckQueryOptions, getXrpTrustlineReserveCheckQueryOptions, invalidateBalances, isBridgeMpcRelayRead, isBridgeNotDelivered, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, resolveXrpGate, retryUnlessAuthFailure, runApprovalPlan, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveLeveragePositionFunding, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOracleCandles, useBackendOracleMarkets, useBackendOrderbook, useBackendUserIntents, useBalances, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApiAllowance, useBridgeApiApprove, useBridgeApiApproveAndBroadcast, useBridgeApiBridgeableAmount, useBridgeApiCreateBridgeIntent, useBridgeApiFee, useBridgeApiIsBridgeable, useBridgeApiSubmitTx, useBridgeApiSubmitTxStatus, useBridgeApiTokens, useBridgeApiTokensByChain, useBridgeApprovalStrategy, useBridgeApprove, useBridgeDetailedStatus, useBridgeWithApproval, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDetailedStatus, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEModes, useEnsureRadfiAccessToken, useEstablishTrustline, useEstablishXrpTrustline, useEstimateGas, useExpiredUtxos, useFeeClaimSwap, useFeeClaimWithdraw, useFetchAssetsBalances, useFundTradingWallet, useGetAutoSwapPreferences, useGetBridgeableAmount, useGetBridgeableTokens, useGetIntentDetails, useGetUserHubWalletAddress, useGetUserIntent, useHubAssetBalances, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useIsTokenApproved, useLeveragePositionAccount, useLeveragePositionCollateral, useLeveragePositionFundingAllowance, useLeveragePositionInfo, useLeveragePositionPayoutAddress, useLeveragePositionPending, useLeveragePositions, useLeveragePositionsForUser, useLeverageYieldApiAllowance, useLeverageYieldApiApprove, useLeverageYieldApiApproveAndBroadcast, useLeverageYieldApiApr, useLeverageYieldApiAsset, useLeverageYieldApiCancelIntent, useLeverageYieldApiCreateDepositIntent, useLeverageYieldApiCreateWithdrawIntent, useLeverageYieldApiDeadline, useLeverageYieldApiDepositQuote, useLeverageYieldApiEffectiveApr, useLeverageYieldApiEstimateGas, useLeverageYieldApiFilledIntent, useLeverageYieldApiIntent, useLeverageYieldApiIntentExtraData, useLeverageYieldApiIntentHash, useLeverageYieldApiIntentPacket, useLeverageYieldApiLsdApr, useLeverageYieldApiMaxWithdraw, useLeverageYieldApiPartnerFee, useLeverageYieldApiPosition, useLeverageYieldApiPreviewDeposit, useLeverageYieldApiPreviewRedeem, useLeverageYieldApiPreviewWithdraw, useLeverageYieldApiShareBalance, useLeverageYieldApiSolverFee, useLeverageYieldApiStatus, useLeverageYieldApiSubmitIntent, useLeverageYieldApiSubmitTx, useLeverageYieldApiSubmitTxStatus, useLeverageYieldApiTotalAssets, useLeverageYieldApiVault, useLeverageYieldApiVaults, useLeverageYieldApiWithdrawQuote, useLeverageYieldApprovalStrategy, useLeverageYieldDeposit, useLeverageYieldDetailedStatus, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, useLeverageYieldQuote, useLeverageYieldShareBalances, useLeverageYieldTotalAssets, useLeverageYieldVaultSwap, useLeverageYieldVaultSwapWithApproval, useLeverageYieldWithdraw, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrateBaln, useMigrateIcxToSoda, useMigratebnUSD, useMigrationAllowance, useMigrationApprove, useNearStorageCheck, useNearStorageGate, useOpenLeveragePosition, usePartnerCancelIntent, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRegisterNearStorage, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesHumanized, useReservesList, useReservesUsdFormat, useRevertMigrateSodaToIcx, useRunLeveragePositionOperation, useSafeMutation, useSetSwapPreference, useSodaxContext, useSponsorConfig, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarAccountActive, useStellarAccountStatus, useStellarGate, useStellarTrustlineCheck, useSubmitLeveragePositionIntent, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprovalStrategy, useSwapApprove, useSwapLifecycle, useSwapWithApproval, useSwapsApiAllowance, useSwapsApiApprove, useSwapsApiApproveAndBroadcast, useSwapsApiBroadcastWithApproval, useSwapsApiCancelIntent, useSwapsApiCreateIntent, useSwapsApiCreateLimitOrder, useSwapsApiDeadline, useSwapsApiEstimateGas, useSwapsApiFilledIntent, useSwapsApiIntent, useSwapsApiIntentExtraData, useSwapsApiIntentHash, useSwapsApiIntentPacket, useSwapsApiPartnerFee, useSwapsApiQuote, useSwapsApiSolverFee, useSwapsApiStatus, useSwapsApiSubmitIntent, useSwapsApiSubmitTx, useSwapsApiSubmitTxStatus, useSwapsApiTokens, useSwapsApiTokensByChain, useTradingWallet, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw, useWithdrawHubAsset, useXBalances, useXrpDestinationCheck, useXrpGate, useXrpTrustlineReserveCheck };
|