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