@sodax/dapp-kit 2.4.0-rc.1 → 2.4.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/index.d.ts +395 -2413
- package/dist/index.mjs +206 -31
- package/package.json +2 -2
- package/src/hooks/_apiKeyWire.test.ts +4 -29
- package/src/hooks/_mutationContract.test.ts +2 -8
- package/src/hooks/backend/index.ts +0 -13
- package/src/hooks/backend/useBackendAllMoneyMarketAssets.ts +0 -6
- package/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts +0 -10
- package/src/hooks/backend/useBackendIntentByHash.ts +0 -6
- package/src/hooks/backend/useBackendIntentByTxHash.ts +1 -10
- package/src/hooks/backend/useBackendMoneyMarketAsset.ts +0 -6
- package/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts +0 -8
- package/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts +0 -8
- package/src/hooks/backend/useBackendMoneyMarketPosition.ts +0 -6
- package/src/hooks/backend/useBackendOracleCandles.ts +1 -9
- package/src/hooks/backend/useBackendOracleMarkets.ts +1 -7
- package/src/hooks/backend/useBackendOrderbook.ts +0 -6
- package/src/hooks/backend/useBackendUserIntents.ts +0 -8
- package/src/hooks/bitcoin/resolveBtcReadAddress.test.ts +1 -3
- package/src/hooks/bitcoin/resolveBtcReadAddress.ts +2 -12
- package/src/hooks/bitcoin/useBitcoinBalance.ts +1 -7
- package/src/hooks/bitcoin/useBitcoinTradingSetup.ts +2 -4
- package/src/hooks/bitcoin/useEnsureRadfiAccessToken.ts +2 -13
- package/src/hooks/bitcoin/useFundTradingWallet.ts +0 -6
- package/src/hooks/bitcoin/useRadfiAuth.ts +1 -6
- package/src/hooks/bitcoin/useRadfiSession.ts +0 -1
- package/src/hooks/bitcoin/useRadfiWithdraw.ts +0 -6
- package/src/hooks/bitcoin/useRenewUtxos.ts +0 -5
- package/src/hooks/bitcoin/useTradingWallet.ts +1 -4
- package/src/hooks/bridge/getBridgeDetailedStatusRefetchInterval.test.ts +1 -7
- package/src/hooks/bridge/getBridgeDetailedStatusRefetchInterval.ts +7 -21
- package/src/hooks/bridge/useBridge.test.ts +1 -11
- package/src/hooks/bridge/useBridge.ts +2 -12
- package/src/hooks/bridge/useBridgeAllowance.ts +1 -2
- package/src/hooks/bridge/useBridgeApprovalStrategy.ts +2 -6
- package/src/hooks/bridge/useBridgeApprove.ts +2 -14
- package/src/hooks/bridge/useBridgeDetailedStatus.test.ts +2 -11
- package/src/hooks/bridge/useBridgeDetailedStatus.ts +3 -23
- package/src/hooks/bridge/useBridgeWithApproval.ts +2 -11
- package/src/hooks/bridgeApi/getBridgeSubmitTxStatusRefetchInterval.test.ts +2 -7
- package/src/hooks/bridgeApi/getBridgeSubmitTxStatusRefetchInterval.ts +2 -13
- package/src/hooks/bridgeApi/index.ts +11 -14
- package/src/hooks/bridgeApi/useBridgeApiAllowance.ts +1 -9
- package/src/hooks/bridgeApi/useBridgeApiApprove.ts +2 -17
- package/src/hooks/bridgeApi/useBridgeApiApproveAndBroadcast.test.ts +2 -13
- package/src/hooks/bridgeApi/useBridgeApiApproveAndBroadcast.ts +3 -20
- package/src/hooks/bridgeApi/useBridgeApiBridgeableAmount.ts +1 -12
- package/src/hooks/bridgeApi/useBridgeApiCreateBridgeIntent.ts +1 -14
- package/src/hooks/bridgeApi/useBridgeApiFee.ts +2 -11
- package/src/hooks/bridgeApi/useBridgeApiIsBridgeable.ts +1 -12
- package/src/hooks/bridgeApi/useBridgeApiSubmitTx.ts +2 -23
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.test.ts +1 -9
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.ts +1 -19
- package/src/hooks/bridgeApi/useBridgeApiTokens.ts +0 -8
- package/src/hooks/bridgeApi/useBridgeApiTokensByChain.ts +0 -7
- package/src/hooks/dex/useClaimRewards.ts +1 -12
- package/src/hooks/dex/useCreateDecreaseLiquidityParams.ts +1 -5
- package/src/hooks/dex/useCreateDepositParams.ts +1 -5
- package/src/hooks/dex/useCreateSupplyLiquidityParams.ts +1 -10
- package/src/hooks/dex/useCreateWithdrawParams.ts +1 -5
- package/src/hooks/dex/useDecreaseLiquidity.ts +2 -15
- package/src/hooks/dex/useDexAllowance.ts +1 -5
- package/src/hooks/dex/useDexApprove.ts +1 -12
- package/src/hooks/dex/useDexDeposit.ts +1 -23
- package/src/hooks/dex/useDexWithdraw.ts +1 -13
- package/src/hooks/dex/useLiquidityAmounts.ts +1 -4
- package/src/hooks/dex/usePoolBalances.ts +0 -4
- package/src/hooks/dex/usePoolData.ts +1 -4
- package/src/hooks/dex/usePools.ts +1 -4
- package/src/hooks/dex/usePositionInfo.ts +1 -4
- package/src/hooks/dex/useSupplyLiquidity.ts +3 -20
- package/src/hooks/leverageYield/useApproveLeveragePositionFunding.ts +2 -8
- package/src/hooks/leverageYield/useLeveragePositionAccount.ts +2 -13
- package/src/hooks/leverageYield/useLeveragePositionCollateral.ts +2 -14
- package/src/hooks/leverageYield/useLeveragePositionFundingAllowance.ts +2 -9
- package/src/hooks/leverageYield/useLeveragePositionInfo.ts +1 -13
- package/src/hooks/leverageYield/useLeveragePositionPayoutAddress.ts +3 -15
- package/src/hooks/leverageYield/useLeveragePositionPending.ts +2 -16
- package/src/hooks/leverageYield/useLeveragePositions.ts +1 -15
- package/src/hooks/leverageYield/useLeveragePositionsForUser.ts +1 -15
- package/src/hooks/leverageYield/useLeverageYieldApprovalStrategy.ts +1 -6
- package/src/hooks/leverageYield/useLeverageYieldDeposit.ts +1 -17
- package/src/hooks/leverageYield/useLeverageYieldDetailedStatus.test.ts +3 -14
- package/src/hooks/leverageYield/useLeverageYieldDetailedStatus.ts +2 -19
- package/src/hooks/leverageYield/useLeverageYieldEffectiveApr.ts +1 -12
- package/src/hooks/leverageYield/useLeverageYieldNotifySolver.ts +1 -11
- package/src/hooks/leverageYield/useLeverageYieldPosition.ts +1 -13
- package/src/hooks/leverageYield/useLeverageYieldPreviewRedeem.ts +1 -12
- package/src/hooks/leverageYield/useLeverageYieldQuote.test.ts +3 -13
- package/src/hooks/leverageYield/useLeverageYieldQuote.ts +5 -54
- package/src/hooks/leverageYield/useLeverageYieldShareBalances.ts +2 -29
- package/src/hooks/leverageYield/useLeverageYieldTotalAssets.ts +1 -9
- package/src/hooks/leverageYield/useLeverageYieldVaultSwap.ts +2 -25
- package/src/hooks/leverageYield/useLeverageYieldVaultSwapWithApproval.ts +1 -11
- package/src/hooks/leverageYield/useLeverageYieldWithdraw.ts +1 -17
- package/src/hooks/leverageYield/useOpenLeveragePosition.ts +5 -18
- package/src/hooks/leverageYield/useRunLeveragePositionOperation.ts +4 -20
- package/src/hooks/leverageYield/useSubmitLeveragePositionIntent.ts +3 -15
- package/src/hooks/leverageYieldApi/index.ts +0 -15
- package/src/hooks/leverageYieldApi/useLeverageYieldApiAllowance.ts +1 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiApprove.ts +3 -6
- package/src/hooks/leverageYieldApi/useLeverageYieldApiApproveAndBroadcast.test.ts +4 -14
- package/src/hooks/leverageYieldApi/useLeverageYieldApiApproveAndBroadcast.ts +4 -26
- package/src/hooks/leverageYieldApi/useLeverageYieldApiApr.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiAsset.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiCancelIntent.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiCreateDepositIntent.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiCreateWithdrawIntent.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiDeadline.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiDepositQuote.ts +1 -15
- package/src/hooks/leverageYieldApi/useLeverageYieldApiEffectiveApr.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiEstimateGas.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiFilledIntent.ts +1 -6
- package/src/hooks/leverageYieldApi/useLeverageYieldApiIntent.ts +1 -6
- package/src/hooks/leverageYieldApi/useLeverageYieldApiIntentExtraData.ts +1 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiIntentHash.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiIntentPacket.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiLsdApr.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiMaxWithdraw.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPartnerFee.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPosition.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPreviewDeposit.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPreviewRedeem.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiPreviewWithdraw.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiShareBalance.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiSolverFee.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiStatus.ts +2 -12
- package/src/hooks/leverageYieldApi/useLeverageYieldApiSubmitIntent.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiSubmitTx.ts +2 -8
- package/src/hooks/leverageYieldApi/useLeverageYieldApiSubmitTxStatus.ts +2 -17
- package/src/hooks/leverageYieldApi/useLeverageYieldApiTotalAssets.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiVault.ts +1 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiVaults.ts +0 -7
- package/src/hooks/leverageYieldApi/useLeverageYieldApiWithdrawQuote.ts +1 -15
- package/src/hooks/migrate/useMigrateBaln.ts +1 -8
- package/src/hooks/migrate/useMigrateIcxToSoda.ts +1 -12
- package/src/hooks/migrate/useMigratebnUSD.ts +1 -12
- package/src/hooks/migrate/useMigrationAllowance.ts +3 -19
- package/src/hooks/migrate/useMigrationApprove.ts +2 -20
- package/src/hooks/migrate/useRevertMigrateSodaToIcx.ts +0 -7
- package/src/hooks/mm/useAToken.ts +1 -6
- package/src/hooks/mm/useATokensBalances.ts +0 -5
- package/src/hooks/mm/useBorrow.ts +1 -13
- package/src/hooks/mm/useEModes.ts +2 -13
- package/src/hooks/mm/useMMAllowance.test.ts +55 -0
- package/src/hooks/mm/useMMAllowance.ts +6 -16
- package/src/hooks/mm/useMMApprove.ts +1 -14
- package/src/hooks/mm/useRepay.ts +1 -12
- package/src/hooks/mm/useReservesData.ts +0 -4
- package/src/hooks/mm/useReservesHumanized.ts +0 -4
- package/src/hooks/mm/useReservesList.ts +0 -4
- package/src/hooks/mm/useReservesUsdFormat.ts +0 -4
- package/src/hooks/mm/useSupply.ts +1 -24
- package/src/hooks/mm/useUserFormattedSummary.ts +0 -7
- package/src/hooks/mm/useUserReservesData.ts +0 -4
- package/src/hooks/mm/useWithdraw.ts +1 -13
- package/src/hooks/partner/useApproveToken.ts +1 -7
- package/src/hooks/partner/useFeeClaimSwap.ts +1 -7
- package/src/hooks/partner/useFeeClaimWithdraw.ts +3 -20
- package/src/hooks/partner/useFetchAssetsBalances.ts +0 -4
- package/src/hooks/partner/useGetAutoSwapPreferences.ts +0 -4
- package/src/hooks/partner/useGetIntentDetails.ts +1 -8
- package/src/hooks/partner/useGetUserIntent.ts +1 -8
- package/src/hooks/partner/useIsTokenApproved.ts +0 -4
- package/src/hooks/partner/usePartnerCancelIntent.ts +2 -9
- package/src/hooks/partner/useSetSwapPreference.ts +1 -14
- package/src/hooks/recovery/useHubAssetBalances.ts +1 -6
- package/src/hooks/recovery/useWithdrawHubAsset.ts +1 -13
- package/src/hooks/shared/index.ts +4 -0
- package/src/hooks/shared/invalidateBalances.ts +2 -10
- package/src/hooks/shared/isUserRejectedError.test.ts +0 -3
- package/src/hooks/shared/isUserRejectedError.ts +2 -23
- package/src/hooks/shared/notFoundStreak.ts +5 -22
- package/src/hooks/shared/retryUnlessAuthFailure.test.ts +1 -2
- package/src/hooks/shared/retryUnlessAuthFailure.ts +1 -12
- package/src/hooks/shared/solverStatusPolicy.test.ts +0 -5
- package/src/hooks/shared/solverStatusPolicy.ts +8 -58
- package/src/hooks/shared/types.ts +4 -55
- package/src/hooks/shared/unwrapResult.ts +1 -8
- package/src/hooks/shared/useBalances.ts +6 -39
- package/src/hooks/shared/useEstablishTrustline.test.ts +1 -5
- package/src/hooks/shared/useEstablishTrustline.ts +3 -13
- package/src/hooks/shared/useEstablishXrpTrustline.test.ts +112 -0
- package/src/hooks/shared/useEstablishXrpTrustline.ts +63 -0
- package/src/hooks/shared/useEstimateGas.ts +0 -1
- package/src/hooks/shared/useGetUserHubWalletAddress.ts +1 -18
- package/src/hooks/shared/useNearStorageCheck.ts +2 -9
- package/src/hooks/shared/useNearStorageGate.ts +5 -15
- package/src/hooks/shared/useRegisterNearStorage.ts +2 -10
- package/src/hooks/shared/useRequestTrustline.test.ts +1 -7
- package/src/hooks/shared/useRequestTrustline.ts +4 -14
- package/src/hooks/shared/useSafeMutation.test.ts +0 -3
- package/src/hooks/shared/useSafeMutation.ts +2 -26
- package/src/hooks/shared/useSodaxContext.ts +0 -6
- package/src/hooks/shared/useStellarGate.test.ts +2 -9
- package/src/hooks/shared/useStellarGate.ts +3 -9
- package/src/hooks/shared/useStellarTrustlineCheck.test.ts +0 -2
- package/src/hooks/shared/useStellarTrustlineCheck.ts +1 -4
- package/src/hooks/shared/useXBalances.ts +2 -20
- package/src/hooks/shared/useXrpDestinationCheck.ts +71 -0
- package/src/hooks/shared/useXrpGate.test.ts +116 -0
- package/src/hooks/shared/useXrpGate.ts +80 -0
- package/src/hooks/shared/useXrpTrustlineReserveCheck.ts +45 -0
- package/src/hooks/shared/waitForApiAllowance.test.ts +0 -1
- package/src/hooks/shared/waitForApiAllowance.ts +2 -6
- package/src/hooks/sponsoring/useActivateStellarAccount.test.ts +1 -2
- package/src/hooks/sponsoring/useActivateStellarAccount.ts +1 -5
- package/src/hooks/sponsoring/useActivateStellarAccount.wire.test.ts +2 -13
- package/src/hooks/sponsoring/useSponsorConfig.ts +0 -1
- package/src/hooks/sponsoring/useStellarAccountActive.ts +0 -1
- package/src/hooks/sponsoring/useStellarAccountStatus.ts +1 -4
- package/src/hooks/staking/index.ts +0 -1
- package/src/hooks/staking/useCancelUnstake.ts +1 -7
- package/src/hooks/staking/useClaim.ts +1 -7
- package/src/hooks/staking/useConvertedAssets.ts +1 -4
- package/src/hooks/staking/useInstantUnstake.ts +1 -7
- package/src/hooks/staking/useInstantUnstakeAllowance.ts +1 -5
- package/src/hooks/staking/useInstantUnstakeApprove.ts +1 -11
- package/src/hooks/staking/useInstantUnstakeRatio.ts +1 -4
- package/src/hooks/staking/useStake.ts +1 -12
- package/src/hooks/staking/useStakeAllowance.ts +1 -5
- package/src/hooks/staking/useStakeApprove.ts +1 -11
- package/src/hooks/staking/useStakeRatio.ts +1 -4
- package/src/hooks/staking/useStakingConfig.ts +1 -4
- package/src/hooks/staking/useStakingInfo.ts +1 -5
- package/src/hooks/staking/useUnstake.ts +2 -9
- package/src/hooks/staking/useUnstakeAllowance.ts +1 -5
- package/src/hooks/staking/useUnstakeApprove.ts +1 -10
- package/src/hooks/staking/useUnstakingInfo.ts +1 -4
- package/src/hooks/staking/useUnstakingInfoWithPenalty.ts +1 -4
- package/src/hooks/swap/useCancelLimitOrder.ts +1 -7
- package/src/hooks/swap/useCancelSwap.ts +1 -7
- package/src/hooks/swap/useCreateLimitOrder.ts +2 -12
- package/src/hooks/swap/useDetailedStatus.test.ts +6 -18
- package/src/hooks/swap/useDetailedStatus.ts +2 -19
- package/src/hooks/swap/useQuote.test.ts +2 -8
- package/src/hooks/swap/useQuote.ts +5 -32
- package/src/hooks/swap/useStatus.ts +2 -10
- package/src/hooks/swap/useSwap.test.ts +1 -11
- package/src/hooks/swap/useSwap.ts +2 -12
- package/src/hooks/swap/useSwapAllowance.ts +1 -2
- package/src/hooks/swap/useSwapApprovalStrategy.ts +2 -7
- package/src/hooks/swap/useSwapApprove.ts +2 -14
- package/src/hooks/swap/useSwapLifecycle.test.ts +47 -2
- package/src/hooks/swap/useSwapLifecycle.ts +36 -30
- package/src/hooks/swap/useSwapWithApproval.ts +2 -11
- package/src/hooks/swapsApi/index.ts +2 -14
- package/src/hooks/swapsApi/isTerminalSwapIntentStatus.test.ts +1 -5
- package/src/hooks/swapsApi/isTerminalSwapIntentStatus.ts +1 -7
- package/src/hooks/swapsApi/useSwapsApiAllowance.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiApprove.ts +1 -14
- package/src/hooks/swapsApi/useSwapsApiApproveAndBroadcast.test.ts +5 -20
- package/src/hooks/swapsApi/useSwapsApiApproveAndBroadcast.ts +3 -24
- package/src/hooks/swapsApi/useSwapsApiBroadcastWithApproval.test.ts +2 -8
- package/src/hooks/swapsApi/useSwapsApiBroadcastWithApproval.ts +6 -41
- package/src/hooks/swapsApi/useSwapsApiCancelIntent.ts +0 -13
- package/src/hooks/swapsApi/useSwapsApiCreateIntent.ts +0 -13
- package/src/hooks/swapsApi/useSwapsApiCreateLimitOrder.ts +1 -13
- package/src/hooks/swapsApi/useSwapsApiDeadline.ts +1 -7
- package/src/hooks/swapsApi/useSwapsApiEstimateGas.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiFilledIntent.ts +0 -8
- package/src/hooks/swapsApi/useSwapsApiIntent.ts +1 -7
- package/src/hooks/swapsApi/useSwapsApiIntentExtraData.ts +1 -8
- package/src/hooks/swapsApi/useSwapsApiIntentHash.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiIntentPacket.ts +1 -10
- package/src/hooks/swapsApi/useSwapsApiPartnerFee.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiQuote.ts +2 -24
- package/src/hooks/swapsApi/useSwapsApiSolverFee.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiStatus.ts +1 -11
- package/src/hooks/swapsApi/useSwapsApiSubmitIntent.ts +1 -15
- package/src/hooks/swapsApi/useSwapsApiSubmitTx.ts +0 -21
- package/src/hooks/swapsApi/useSwapsApiSubmitTxStatus.ts +2 -19
- package/src/hooks/swapsApi/useSwapsApiTokens.ts +0 -7
- package/src/hooks/swapsApi/useSwapsApiTokensByChain.ts +0 -7
- package/src/index.ts +1 -1
- package/src/providers/SodaxProvider.test.ts +2 -9
- package/src/providers/SodaxProvider.tsx +1 -12
- package/src/providers/createSodaxQueryClient.ts +4 -56
- package/src/utils/approvalPlan.ts +9 -32
- package/src/utils/dex-utils.ts +5 -20
- package/src/utils/index.ts +1 -0
- package/src/utils/nearStorageGate.ts +3 -14
- package/src/utils/stellarGate.ts +3 -16
- package/src/utils/swapLifecycle.test.ts +35 -0
- package/src/utils/swapLifecycle.ts +21 -28
- package/src/utils/xrpGate.test.ts +112 -0
- package/src/utils/xrpGate.ts +69 -0
|
@@ -5,19 +5,13 @@ import { unwrapResult } from '../shared/unwrapResult.js';
|
|
|
5
5
|
import type { MutationHookParams } from '../shared/types.js';
|
|
6
6
|
import { useSafeMutation, type SafeUseMutationResult } from '../shared/useSafeMutation.js';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Mutation variables for {@link useLeverageYieldApiCreateWithdrawIntent}. The per-request `apiConfig` override belongs here
|
|
10
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
11
|
-
* endpoints without re-rendering.
|
|
12
|
-
*/
|
|
8
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
13
9
|
export type UseLeverageYieldApiCreateWithdrawIntentVars = {
|
|
14
10
|
body: CreateWithdrawIntentParamsV2;
|
|
15
11
|
apiConfig?: RequestOverrideConfig;
|
|
16
12
|
};
|
|
17
13
|
|
|
18
|
-
/**
|
|
19
|
-
* React hook to build an unsigned withdraw create-intent transaction (lsoda* shares → any token) via the leverage-yield API — `sodax.api.leverageYield.createWithdrawIntent`.
|
|
20
|
-
*/
|
|
14
|
+
/** Builds an unsigned withdraw create-intent tx (lsoda* shares → any token). */
|
|
21
15
|
export const useLeverageYieldApiCreateWithdrawIntent = ({
|
|
22
16
|
mutationOptions,
|
|
23
17
|
}: MutationHookParams<CreateIntentResponseV2, UseLeverageYieldApiCreateWithdrawIntentVars> = {}): SafeUseMutationResult<
|
|
@@ -13,13 +13,7 @@ export type UseLeverageYieldApiDeadlineParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to compute a deposit/withdraw deadline (hub timestamp + `offsetSeconds`, default 300s)
|
|
18
|
-
* via the leverage-yield API — `sodax.api.leverageYield.getDeadline`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data: deadline } = useLeverageYieldApiDeadline({ params: { query: { offsetSeconds: 600 } } });
|
|
22
|
-
*/
|
|
16
|
+
/** Deadline = hub timestamp + `offsetSeconds` (default 300s). */
|
|
23
17
|
export const useLeverageYieldApiDeadline = ({
|
|
24
18
|
params,
|
|
25
19
|
queryOptions,
|
|
@@ -19,21 +19,7 @@ export type UseLeverageYieldApiDepositQuoteParams = ReadHookParams<
|
|
|
19
19
|
}
|
|
20
20
|
>;
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* React hook to quote a swap-style leverage-yield deposit (any token → lsoda* shares) via the
|
|
24
|
-
* leverage-yield API — `sodax.api.leverageYield.getDepositQuote`. Pass `query.includeTxData = true`
|
|
25
|
-
* to also build the unsigned create-intent transaction (`srcAddress` then required in the body).
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* const { data: quote } = useLeverageYieldApiDepositQuote({
|
|
29
|
-
* params: {
|
|
30
|
-
* body: {
|
|
31
|
-
* vault: '0x...', tokenSrc: '0x...', tokenSrcChainKey: '0xa4b1.arbitrum',
|
|
32
|
-
* amount: '1000000', quoteType: 'exact_input',
|
|
33
|
-
* },
|
|
34
|
-
* },
|
|
35
|
-
* });
|
|
36
|
-
*/
|
|
22
|
+
/** `query.includeTxData = true` also builds the unsigned create-intent tx and requires `srcAddress` in the body. */
|
|
37
23
|
export const useLeverageYieldApiDepositQuote = ({
|
|
38
24
|
params,
|
|
39
25
|
queryOptions,
|
|
@@ -13,13 +13,7 @@ export type UseLeverageYieldApiEffectiveAprParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to fetch the honest combined AAVE + LSD effective APR for a leverage-yield vault via the leverage-yield API —
|
|
18
|
-
* `sodax.api.leverageYield.getEffectiveApr`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiEffectiveApr({ params: { vault: '0x...' } });
|
|
22
|
-
*/
|
|
16
|
+
/** Combined AAVE + LSD effective APR. */
|
|
23
17
|
export const useLeverageYieldApiEffectiveApr = ({
|
|
24
18
|
params,
|
|
25
19
|
queryOptions,
|
|
@@ -13,13 +13,7 @@ export type UseLeverageYieldApiEstimateGasParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to estimate gas for a raw transaction on a spoke chain via the leverage-yield API —
|
|
18
|
-
* `sodax.api.leverageYield.estimateGas`. Returns `{ gas }` (chain-specific shape).
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiEstimateGas({ params: { body: { chainKey: 'sonic', tx: {...} } } });
|
|
22
|
-
*/
|
|
16
|
+
/** Returns `{ gas }` in a chain-specific shape. */
|
|
23
17
|
export const useLeverageYieldApiEstimateGas = ({
|
|
24
18
|
params,
|
|
25
19
|
queryOptions,
|
|
@@ -13,12 +13,7 @@ export type UseLeverageYieldApiFilledIntentParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* 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`.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* const { data } = useLeverageYieldApiFilledIntent({ params: { txHash: '0x123...' } });
|
|
21
|
-
*/
|
|
16
|
+
/** On-chain fill state, keyed by the intent's hub-chain tx hash. */
|
|
22
17
|
export const useLeverageYieldApiFilledIntent = ({
|
|
23
18
|
params,
|
|
24
19
|
queryOptions,
|
|
@@ -13,12 +13,7 @@ export type UseLeverageYieldApiIntentParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to look up an Intent struct by its hub-chain creation tx hash via the leverage-yield API — `sodax.api.leverageYield.getIntent`.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* const { data } = useLeverageYieldApiIntent({ params: { txHash: '0x123...' } });
|
|
21
|
-
*/
|
|
16
|
+
/** Looks up the Intent struct by its hub-chain creation tx hash. */
|
|
22
17
|
export const useLeverageYieldApiIntent = ({
|
|
23
18
|
params,
|
|
24
19
|
queryOptions,
|
|
@@ -13,14 +13,7 @@ export type UseLeverageYieldApiIntentExtraDataParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to recover the relay extra data needed by `/leverage-yield/intents/submit` via the
|
|
18
|
-
* leverage-yield API — `sodax.api.leverageYield.getIntentSubmitTxExtraData`. Provide EITHER `txHash`
|
|
19
|
-
* OR `intent` in the body.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const { data } = useLeverageYieldApiIntentExtraData({ params: { body: { txHash: '0x...' } } });
|
|
23
|
-
*/
|
|
16
|
+
/** Relay extra data for `/leverage-yield/intents/submit`; the body takes EITHER `txHash` OR `intent`. */
|
|
24
17
|
export const useLeverageYieldApiIntentExtraData = ({
|
|
25
18
|
params,
|
|
26
19
|
queryOptions,
|
|
@@ -13,13 +13,6 @@ export type UseLeverageYieldApiIntentHashParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to compute the keccak256 hash of an Intent struct via the leverage-yield API —
|
|
18
|
-
* `sodax.api.leverageYield.getIntentHash`. Returns `{ hash }`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiIntentHash({ params: { intent } });
|
|
22
|
-
*/
|
|
23
16
|
export const useLeverageYieldApiIntentHash = ({
|
|
24
17
|
params,
|
|
25
18
|
queryOptions,
|
|
@@ -13,13 +13,7 @@ export type UseLeverageYieldApiIntentPacketParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to long-poll the relayer until the fill packet lands on the destination chain via the
|
|
18
|
-
* leverage-yield API — `sodax.api.leverageYield.getSolvedIntentPacket`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiIntentPacket({ params: { body: { chainId: 'sonic', fillTxHash: '0x...' } } });
|
|
22
|
-
*/
|
|
16
|
+
/** Long-polls the relayer until the fill packet lands on the destination chain. */
|
|
23
17
|
export const useLeverageYieldApiIntentPacket = ({
|
|
24
18
|
params,
|
|
25
19
|
queryOptions,
|
|
@@ -13,13 +13,7 @@ export type UseLeverageYieldApiLsdAprParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to fetch the off-chain LSD staking-APR snapshot for a leverage-yield vault via the leverage-yield API —
|
|
18
|
-
* `sodax.api.leverageYield.getLsdApr`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiLsdApr({ params: { vault: '0x...' } });
|
|
22
|
-
*/
|
|
16
|
+
/** Off-chain LSD staking-APR snapshot. */
|
|
23
17
|
export const useLeverageYieldApiLsdApr = ({
|
|
24
18
|
params,
|
|
25
19
|
queryOptions,
|
|
@@ -14,13 +14,7 @@ export type UseLeverageYieldApiMaxWithdrawParams = ReadHookParams<
|
|
|
14
14
|
}
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* React hook to get the maximum assets an owner can withdraw (ERC-4626 maxWithdraw) via the leverage-yield API —
|
|
19
|
-
* `sodax.api.leverageYield.getMaxWithdraw`.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const { data } = useLeverageYieldApiMaxWithdraw({ params: { vault: '0x...', owner: '1000000000000000000' } });
|
|
23
|
-
*/
|
|
17
|
+
/** ERC-4626 `maxWithdraw` for `owner`. */
|
|
24
18
|
export const useLeverageYieldApiMaxWithdraw = ({
|
|
25
19
|
params,
|
|
26
20
|
queryOptions,
|
|
@@ -13,13 +13,7 @@ export type UseLeverageYieldApiPartnerFeeParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to compute the partner fee for a given input amount via the leverage-yield API — `sodax.api.leverageYield.getPartnerFee`.
|
|
18
|
-
* Returns `{ fee }` (decimal string).
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiPartnerFee({ params: { amount: '1000000' } });
|
|
22
|
-
*/
|
|
16
|
+
/** Returns `{ fee }` as a decimal string. */
|
|
23
17
|
export const useLeverageYieldApiPartnerFee = ({
|
|
24
18
|
params,
|
|
25
19
|
queryOptions,
|
|
@@ -13,13 +13,6 @@ export type UseLeverageYieldApiPositionParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to fetch a leveraged-position snapshot for a leverage-yield vault via the leverage-yield API —
|
|
18
|
-
* `sodax.api.leverageYield.getPosition`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiPosition({ params: { vault: '0x...' } });
|
|
22
|
-
*/
|
|
23
16
|
export const useLeverageYieldApiPosition = ({
|
|
24
17
|
params,
|
|
25
18
|
queryOptions,
|
|
@@ -14,13 +14,7 @@ export type UseLeverageYieldApiPreviewDepositParams = ReadHookParams<
|
|
|
14
14
|
}
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* React hook to preview the shares minted for depositing `assets` (ERC-4626 previewDeposit) via the leverage-yield API —
|
|
19
|
-
* `sodax.api.leverageYield.previewDeposit`.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const { data } = useLeverageYieldApiPreviewDeposit({ params: { vault: '0x...', assets: '1000000000000000000' } });
|
|
23
|
-
*/
|
|
17
|
+
/** ERC-4626 `previewDeposit`: shares minted for `assets`. */
|
|
24
18
|
export const useLeverageYieldApiPreviewDeposit = ({
|
|
25
19
|
params,
|
|
26
20
|
queryOptions,
|
|
@@ -14,13 +14,7 @@ export type UseLeverageYieldApiPreviewRedeemParams = ReadHookParams<
|
|
|
14
14
|
}
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* React hook to preview the assets returned for redeeming `shares` (ERC-4626 previewRedeem) via the leverage-yield API —
|
|
19
|
-
* `sodax.api.leverageYield.previewRedeem`.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const { data } = useLeverageYieldApiPreviewRedeem({ params: { vault: '0x...', shares: '1000000000000000000' } });
|
|
23
|
-
*/
|
|
17
|
+
/** ERC-4626 `previewRedeem`: assets returned for `shares`. */
|
|
24
18
|
export const useLeverageYieldApiPreviewRedeem = ({
|
|
25
19
|
params,
|
|
26
20
|
queryOptions,
|
|
@@ -14,13 +14,7 @@ export type UseLeverageYieldApiPreviewWithdrawParams = ReadHookParams<
|
|
|
14
14
|
}
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* React hook to preview the shares burned to withdraw `assets` (ERC-4626 previewWithdraw) via the leverage-yield API —
|
|
19
|
-
* `sodax.api.leverageYield.previewWithdraw`.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const { data } = useLeverageYieldApiPreviewWithdraw({ params: { vault: '0x...', assets: '1000000000000000000' } });
|
|
23
|
-
*/
|
|
17
|
+
/** ERC-4626 `previewWithdraw`: shares burned to withdraw `assets`. */
|
|
24
18
|
export const useLeverageYieldApiPreviewWithdraw = ({
|
|
25
19
|
params,
|
|
26
20
|
queryOptions,
|
|
@@ -14,13 +14,6 @@ export type UseLeverageYieldApiShareBalanceParams = ReadHookParams<
|
|
|
14
14
|
}
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* React hook to get an owner's vault share (lsoda*) balance via the leverage-yield API —
|
|
19
|
-
* `sodax.api.leverageYield.getShareBalance`.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const { data } = useLeverageYieldApiShareBalance({ params: { vault: '0x...', owner: '1000000000000000000' } });
|
|
23
|
-
*/
|
|
24
17
|
export const useLeverageYieldApiShareBalance = ({
|
|
25
18
|
params,
|
|
26
19
|
queryOptions,
|
|
@@ -13,13 +13,7 @@ export type UseLeverageYieldApiSolverFeeParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to compute the protocol (solver) fee for a given input amount via the leverage-yield API — `sodax.api.leverageYield.getSolverFee`.
|
|
18
|
-
* Returns `{ fee }` (decimal string).
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiSolverFee({ params: { amount: '1000000' } });
|
|
22
|
-
*/
|
|
16
|
+
/** Maximum solver fee for `amount`, as a decimal string `{ fee }`. */
|
|
23
17
|
export const useLeverageYieldApiSolverFee = ({
|
|
24
18
|
params,
|
|
25
19
|
queryOptions,
|
|
@@ -4,8 +4,7 @@ import { useSodaxContext } from '../shared/useSodaxContext.js';
|
|
|
4
4
|
import { retryUnlessAuthFailure } from '../shared/retryUnlessAuthFailure.js';
|
|
5
5
|
import { unwrapResult } from '../shared/unwrapResult.js';
|
|
6
6
|
import type { ReadHookParams } from '../shared/types.js';
|
|
7
|
-
// Leverage-yield intents share the solver status codes with swaps
|
|
8
|
-
// is reused rather than duplicated.
|
|
7
|
+
// Leverage-yield intents share the solver status codes with swaps.
|
|
9
8
|
import { isTerminalSwapIntentStatus } from '../swapsApi/isTerminalSwapIntentStatus.js';
|
|
10
9
|
|
|
11
10
|
export type UseLeverageYieldApiStatusParams = ReadHookParams<
|
|
@@ -16,16 +15,7 @@ export type UseLeverageYieldApiStatusParams = ReadHookParams<
|
|
|
16
15
|
}
|
|
17
16
|
>;
|
|
18
17
|
|
|
19
|
-
/**
|
|
20
|
-
* React hook for polling the solver intent status by hub-chain intent tx hash via the leverage-yield
|
|
21
|
-
* API — `sodax.api.leverageYield.getStatus`. Returns `{ status, fillTxHash? }`.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* const { data } = useLeverageYieldApiStatus({ params: { intentTxHash: '0x123...' } });
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* - Default refetch interval is 1 second; stops once `status` is `3` (SOLVED) or `4` (FAILED).
|
|
28
|
-
*/
|
|
18
|
+
/** Polls every 1s until `status` is 3 (SOLVED) or 4 (FAILED). */
|
|
29
19
|
export const useLeverageYieldApiStatus = ({
|
|
30
20
|
params,
|
|
31
21
|
queryOptions,
|
|
@@ -4,19 +4,13 @@ import { unwrapResult } from '../shared/unwrapResult.js';
|
|
|
4
4
|
import type { MutationHookParams } from '../shared/types.js';
|
|
5
5
|
import { useSafeMutation, type SafeUseMutationResult } from '../shared/useSafeMutation.js';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Mutation variables for {@link useLeverageYieldApiSubmitIntent}. The per-request `apiConfig` override belongs here
|
|
9
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
10
|
-
* endpoints without re-rendering.
|
|
11
|
-
*/
|
|
7
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
12
8
|
export type UseLeverageYieldApiSubmitIntentVars = {
|
|
13
9
|
body: SubmitIntentRequestV2;
|
|
14
10
|
apiConfig?: RequestOverrideConfig;
|
|
15
11
|
};
|
|
16
12
|
|
|
17
|
-
/**
|
|
18
|
-
* React hook to submit the broadcast intent tx to the relay via the leverage-yield API — `sodax.api.leverageYield.submitIntent`.
|
|
19
|
-
*/
|
|
13
|
+
/** Submits the already-broadcast intent tx to the relay. */
|
|
20
14
|
export const useLeverageYieldApiSubmitIntent = ({
|
|
21
15
|
mutationOptions,
|
|
22
16
|
}: MutationHookParams<SubmitIntentResponseV2, UseLeverageYieldApiSubmitIntentVars> = {}): SafeUseMutationResult<
|
|
@@ -5,19 +5,13 @@ import { unwrapResult } from '../shared/unwrapResult.js';
|
|
|
5
5
|
import type { MutationHookParams } from '../shared/types.js';
|
|
6
6
|
import { useSafeMutation, type SafeUseMutationResult } from '../shared/useSafeMutation.js';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Mutation variables for {@link useLeverageYieldApiSubmitTx}. The per-request `apiConfig` override belongs here
|
|
10
|
-
* rather than at the hook level — different calls in the same component can target different
|
|
11
|
-
* endpoints without re-rendering.
|
|
12
|
-
*/
|
|
8
|
+
/** Per-call `apiConfig` so calls in one component can target different endpoints. */
|
|
13
9
|
export type UseLeverageYieldApiSubmitTxVars = {
|
|
14
10
|
request: LeverageYieldSubmitTxRequestV2;
|
|
15
11
|
apiConfig?: RequestOverrideConfig;
|
|
16
12
|
};
|
|
17
13
|
|
|
18
|
-
/**
|
|
19
|
-
* React hook to submit a vault-swap transaction to be processed (relay, post-execution, etc.) via the leverage-yield API — `sodax.api.leverageYield.submitTx`.
|
|
20
|
-
*/
|
|
14
|
+
/** Submits a vault-swap tx for backend processing (relay, post-execution). */
|
|
21
15
|
export const useLeverageYieldApiSubmitTx = ({
|
|
22
16
|
mutationOptions,
|
|
23
17
|
}: MutationHookParams<SubmitTxResponseV2, UseLeverageYieldApiSubmitTxVars> = {}): SafeUseMutationResult<
|
|
@@ -14,21 +14,7 @@ export type UseLeverageYieldApiSubmitTxStatusParams = ReadHookParams<
|
|
|
14
14
|
}
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* React hook for polling the processing status of a submitted vault-swap transaction via the
|
|
19
|
-
* leverage-yield API — `sodax.api.leverageYield.getSubmitTxStatus`. Both `txHash` and `srcChainKey`
|
|
20
|
-
* are required for the query to run.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* const { data: status } = useLeverageYieldApiSubmitTxStatus({
|
|
24
|
-
* params: { txHash: '0x123...', srcChainKey: 'sonic' },
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* @remarks
|
|
28
|
-
* - Default refetch interval is 1 second; stops on 'solved' or 'failed' status, when the backend
|
|
29
|
-
* marks the submission abandoned (`abandonedAt`) while `status` stays non-terminal, or once the
|
|
30
|
-
* backend rejects the API key (401/403 is terminal — a retry cannot fix it).
|
|
31
|
-
*/
|
|
17
|
+
/** Polls every 1s until 'solved'/'failed', `abandonedAt` is set, or the API key is rejected (401/403 is terminal). */
|
|
32
18
|
export const useLeverageYieldApiSubmitTxStatus = ({
|
|
33
19
|
params,
|
|
34
20
|
queryOptions,
|
|
@@ -50,8 +36,7 @@ export const useLeverageYieldApiSubmitTxStatus = ({
|
|
|
50
36
|
// `retry` bounds attempts within a tick, not the interval itself — so stop it here too.
|
|
51
37
|
if (isAuthFailure(query.state.error)) return false;
|
|
52
38
|
const data = query.state.data?.data;
|
|
53
|
-
// `abandonedAt` is terminal even
|
|
54
|
-
// SDK's pollBackendSubmitTx and the swaps-api status hook.
|
|
39
|
+
// `abandonedAt` is terminal even while `status` is not (same rule as the SDK's pollBackendSubmitTx).
|
|
55
40
|
if (data?.status === 'solved' || data?.status === 'failed' || data?.abandonedAt) return false;
|
|
56
41
|
return 1000;
|
|
57
42
|
},
|
|
@@ -13,13 +13,6 @@ export type UseLeverageYieldApiTotalAssetsParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to fetch the total assets managed by the vault for a leverage-yield vault via the leverage-yield API —
|
|
18
|
-
* `sodax.api.leverageYield.getTotalAssets`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data } = useLeverageYieldApiTotalAssets({ params: { vault: '0x...' } });
|
|
22
|
-
*/
|
|
23
16
|
export const useLeverageYieldApiTotalAssets = ({
|
|
24
17
|
params,
|
|
25
18
|
queryOptions,
|
|
@@ -13,13 +13,7 @@ export type UseLeverageYieldApiVaultParams = ReadHookParams<
|
|
|
13
13
|
}
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* React hook to fetch a single vault descriptor by its lsoda* share-token name via the
|
|
18
|
-
* leverage-yield API — `sodax.api.leverageYield.getVault`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const { data: vault } = useLeverageYieldApiVault({ params: { name: 'lsodaWEETH' } });
|
|
22
|
-
*/
|
|
16
|
+
/** Looks up one vault by its lsoda* share-token name (e.g. `lsodaWEETH`). */
|
|
23
17
|
export const useLeverageYieldApiVault = ({
|
|
24
18
|
params,
|
|
25
19
|
queryOptions,
|
|
@@ -12,13 +12,6 @@ export type UseLeverageYieldApiVaultsParams = ReadHookParams<
|
|
|
12
12
|
}
|
|
13
13
|
>;
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* React hook to fetch the registry of deployed leverage-yield vaults via the leverage-yield API —
|
|
17
|
-
* `sodax.api.leverageYield.getVaults`.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* const { data: vaults } = useLeverageYieldApiVaults();
|
|
21
|
-
*/
|
|
22
15
|
export const useLeverageYieldApiVaults = ({
|
|
23
16
|
params,
|
|
24
17
|
queryOptions,
|
|
@@ -19,21 +19,7 @@ export type UseLeverageYieldApiWithdrawQuoteParams = ReadHookParams<
|
|
|
19
19
|
}
|
|
20
20
|
>;
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* React hook to quote a swap-style leverage-yield withdraw (lsoda* shares → any token) via the
|
|
24
|
-
* leverage-yield API — `sodax.api.leverageYield.getWithdrawQuote`. Pass `query.includeTxData = true`
|
|
25
|
-
* to also build the unsigned transaction (`srcAddress`/`dstAddress` then required in the body).
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* const { data: quote } = useLeverageYieldApiWithdrawQuote({
|
|
29
|
-
* params: {
|
|
30
|
-
* body: {
|
|
31
|
-
* vault: '0x...', srcChainKey: 'sonic', tokenDst: '0x...', tokenDstChainKey: '0xa4b1.arbitrum',
|
|
32
|
-
* amount: '1000000000000000000', quoteType: 'exact_input',
|
|
33
|
-
* },
|
|
34
|
-
* },
|
|
35
|
-
* });
|
|
36
|
-
*/
|
|
22
|
+
/** `query.includeTxData = true` also builds the unsigned tx and requires `srcAddress`/`dstAddress` in the body. */
|
|
37
23
|
export const useLeverageYieldApiWithdrawQuote = ({
|
|
38
24
|
params,
|
|
39
25
|
queryOptions,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// packages/dapp-kit/src/hooks/migrate/useMigrateBaln.ts
|
|
2
1
|
import type { BalnMigrateAction, TxHashPair } from '@sodax/sdk';
|
|
3
2
|
import { ChainKeys } from '@sodax/sdk';
|
|
4
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
@@ -10,13 +9,7 @@ import { unwrapResult } from '../shared/unwrapResult.js';
|
|
|
10
9
|
|
|
11
10
|
export type UseMigrateBalnVars = Omit<BalnMigrateAction<false>, 'raw'>;
|
|
12
11
|
|
|
13
|
-
/**
|
|
14
|
-
* React hook for migrating BALN → SODA on the Sonic hub. Source chain is always Icon. Supports
|
|
15
|
-
* lockup periods (0–24 months) which multiply the SODA reward (0.5x–1.5x).
|
|
16
|
-
*
|
|
17
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
18
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
19
|
-
*/
|
|
12
|
+
/** Source chain is always Icon; a 0–24 month lockup scales the SODA reward 0.5x–1.5x. */
|
|
20
13
|
export function useMigrateBaln({
|
|
21
14
|
mutationOptions,
|
|
22
15
|
}: MutationHookParams<TxHashPair, UseMigrateBalnVars> = {}): SafeUseMutationResult<
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// packages/dapp-kit/src/hooks/migrate/useMigrateIcxToSoda.ts
|
|
2
1
|
import type { IcxMigrateAction, TxHashPair } from '@sodax/sdk';
|
|
3
2
|
import { ChainKeys } from '@sodax/sdk';
|
|
4
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
@@ -8,19 +7,9 @@ import type { MutationHookParams } from '../shared/types.js';
|
|
|
8
7
|
import { useSafeMutation, type SafeUseMutationResult } from '../shared/useSafeMutation.js';
|
|
9
8
|
import { unwrapResult } from '../shared/unwrapResult.js';
|
|
10
9
|
|
|
11
|
-
/**
|
|
12
|
-
* Mutation variables for {@link useMigrateIcxToSoda}. Wraps `IcxMigrateAction<false>` with `raw`
|
|
13
|
-
* stripped — the hook always submits non-raw and unwraps the SDK Result.
|
|
14
|
-
*/
|
|
15
10
|
export type UseMigrateIcxToSodaVars = Omit<IcxMigrateAction<false>, 'raw'>;
|
|
16
11
|
|
|
17
|
-
/**
|
|
18
|
-
* React hook for migrating ICX/wICX → SODA on the Sonic hub. Forward-only direction; for the
|
|
19
|
-
* reverse (SODA → ICX) use {@link useRevertMigrateSodaToIcx}.
|
|
20
|
-
*
|
|
21
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
22
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
23
|
-
*/
|
|
12
|
+
/** Forward only; use {@link useRevertMigrateSodaToIcx} for SODA → ICX. */
|
|
24
13
|
export function useMigrateIcxToSoda({
|
|
25
14
|
mutationOptions,
|
|
26
15
|
}: MutationHookParams<TxHashPair, UseMigrateIcxToSodaVars> = {}): SafeUseMutationResult<
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// packages/dapp-kit/src/hooks/migrate/useMigratebnUSD.ts
|
|
2
1
|
import type { SpokeChainKey, TxHashPair, UnifiedBnUSDMigrateAction } from '@sodax/sdk';
|
|
3
2
|
import { useQueryClient } from '@tanstack/react-query';
|
|
4
3
|
import { useSodaxContext } from '../shared/useSodaxContext.js';
|
|
@@ -7,22 +6,12 @@ import type { MutationHookParams } from '../shared/types.js';
|
|
|
7
6
|
import { useSafeMutation, type SafeUseMutationResult } from '../shared/useSafeMutation.js';
|
|
8
7
|
import { unwrapResult } from '../shared/unwrapResult.js';
|
|
9
8
|
|
|
10
|
-
/**
|
|
11
|
-
* Mutation variables for {@link useMigratebnUSD}. Generic over `K extends SpokeChainKey` (defaults
|
|
12
|
-
* to the full union). Bidirectional — handles both legacy → new and new → legacy bnUSD migration
|
|
13
|
-
* via the same SDK call; the SDK detects direction from the token addresses.
|
|
14
|
-
*/
|
|
9
|
+
/** Bidirectional: the SDK detects legacy ↔ new direction from the token addresses. */
|
|
15
10
|
export type UseMigratebnUSDVars<K extends SpokeChainKey = SpokeChainKey> = Omit<
|
|
16
11
|
UnifiedBnUSDMigrateAction<K, false>,
|
|
17
12
|
'raw'
|
|
18
13
|
>;
|
|
19
14
|
|
|
20
|
-
/**
|
|
21
|
-
* React hook for migrating bnUSD between legacy and new formats across spoke chains via Sonic.
|
|
22
|
-
*
|
|
23
|
-
* Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
|
|
24
|
-
* `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
|
|
25
|
-
*/
|
|
26
15
|
export function useMigratebnUSD<K extends SpokeChainKey = SpokeChainKey>({
|
|
27
16
|
mutationOptions,
|
|
28
17
|
}: MutationHookParams<TxHashPair, UseMigratebnUSDVars<K>> = {}): SafeUseMutationResult<
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// packages/dapp-kit/src/hooks/migrate/useMigrationAllowance.ts
|
|
2
1
|
import type {
|
|
3
2
|
BalnMigrateParams,
|
|
4
3
|
IcxCreateRevertMigrationParams,
|
|
@@ -11,15 +10,7 @@ import { useQuery, type UseQueryResult } from '@tanstack/react-query';
|
|
|
11
10
|
import { useSodaxContext } from '../shared/useSodaxContext.js';
|
|
12
11
|
import type { ReadHookParams } from '../shared/types.js';
|
|
13
12
|
|
|
14
|
-
/**
|
|
15
|
-
* Domain inputs for {@link useMigrationAllowance}. `params` is the underlying migration params
|
|
16
|
-
* (NOT the action wrapper — no `walletProvider`/`raw`); `action` is the `'migrate' | 'revert'`
|
|
17
|
-
* discriminator the SDK uses to pick the right allowance check path.
|
|
18
|
-
*
|
|
19
|
-
* For ICX forward migration (`migrate`, params={IcxMigrateParams}) and BALN migration the SDK
|
|
20
|
-
* always returns `true` (Icon has no ERC-20-style allowance) — but the hook still works there
|
|
21
|
-
* for code-uniformity at the call site.
|
|
22
|
-
*/
|
|
13
|
+
/** `params` excludes `walletProvider`/`raw`; ICX forward and BALN always resolve `true` (Icon has no allowance). */
|
|
23
14
|
export type UseMigrationAllowanceInputs<K extends SpokeChainKey = SpokeChainKey> = {
|
|
24
15
|
params:
|
|
25
16
|
| IcxMigrateParams
|
|
@@ -37,13 +28,7 @@ export type UseMigrationAllowanceParams<K extends SpokeChainKey = SpokeChainKey>
|
|
|
37
28
|
|
|
38
29
|
const REFETCH_INTERVAL_MS = 2_000;
|
|
39
30
|
|
|
40
|
-
/**
|
|
41
|
-
* React hook to check if migration spending is approved.
|
|
42
|
-
*
|
|
43
|
-
* Returns `false` when params are missing (so the call site can disable the action button).
|
|
44
|
-
* Hook lifecycle (`enabled`, `queryKey`, `queryFn`) is owned internally; consumers can override
|
|
45
|
-
* other React Query knobs via `queryOptions`.
|
|
46
|
-
*/
|
|
31
|
+
/** Resolves `false` when params are missing. */
|
|
47
32
|
export function useMigrationAllowance<K extends SpokeChainKey = SpokeChainKey>({
|
|
48
33
|
params,
|
|
49
34
|
queryOptions,
|
|
@@ -53,8 +38,7 @@ export function useMigrationAllowance<K extends SpokeChainKey = SpokeChainKey>({
|
|
|
53
38
|
const action = params?.action;
|
|
54
39
|
|
|
55
40
|
return useQuery<boolean, Error>({
|
|
56
|
-
//
|
|
57
|
-
// raw-object keys break per Rule 4 (bigints) and churn on every render.
|
|
41
|
+
// Key on the scoping tuple: raw params hold bigints and churn every render.
|
|
58
42
|
queryKey: [
|
|
59
43
|
'migrate',
|
|
60
44
|
'allowance',
|