@sodax/dapp-kit 2.4.0-rc.1 → 2.4.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/index.d.ts +136 -5
- package/dist/index.mjs +191 -7
- package/package.json +2 -2
- package/src/hooks/_mutationContract.test.ts +1 -0
- package/src/hooks/shared/index.ts +4 -0
- package/src/hooks/shared/useEstablishXrpTrustline.test.ts +113 -0
- package/src/hooks/shared/useEstablishXrpTrustline.ts +65 -0
- package/src/hooks/shared/useXrpDestinationCheck.ts +75 -0
- package/src/hooks/shared/useXrpGate.test.ts +118 -0
- package/src/hooks/shared/useXrpGate.ts +81 -0
- package/src/hooks/shared/useXrpTrustlineReserveCheck.ts +45 -0
- package/src/hooks/swap/useSwapLifecycle.test.ts +46 -0
- package/src/hooks/swap/useSwapLifecycle.ts +29 -5
- package/src/utils/index.ts +1 -0
- package/src/utils/swapLifecycle.test.ts +35 -0
- package/src/utils/swapLifecycle.ts +15 -3
- package/src/utils/xrpGate.test.ts +112 -0
- package/src/utils/xrpGate.ts +72 -0
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ High-level React hooks library for dApp developers. Wraps `@sodax/sdk` with Reac
|
|
|
15
15
|
- **Partner** — `useFetchAssetsBalances`, `useGetAutoSwapPreferences`, `useIsTokenApproved`, `useApproveToken`, `useSetSwapPreference`, `useFeeClaimSwap`, `useFeeClaimWithdraw`, `usePartnerCancelIntent`, `useGetUserIntent`, `useGetIntentDetails`
|
|
16
16
|
- **Recovery** — `useHubAssetBalances`, `useWithdrawHubAsset`
|
|
17
17
|
- **Backend Queries** — Intent tracking, swap-tx submission + status, orderbook, money market position queries
|
|
18
|
-
- **Shared** — `useBalances`, `useXBalances`, `useDeriveUserWalletAddress`, `useGetUserHubWalletAddress`, `useStellarTrustlineCheck`, `useEstablishTrustline`, `useStellarGate`, `useNearStorageCheck`, `useRegisterNearStorage`, `useNearStorageGate`, `useEstimateGas`
|
|
18
|
+
- **Shared** — `useBalances`, `useXBalances`, `useDeriveUserWalletAddress`, `useGetUserHubWalletAddress`, `useStellarTrustlineCheck`, `useEstablishTrustline`, `useStellarGate`, `useNearStorageCheck`, `useRegisterNearStorage`, `useNearStorageGate`, `useXrpDestinationCheck`, `useXrpTrustlineReserveCheck`, `useEstablishXrpTrustline`, `useXrpGate`, `useEstimateGas`
|
|
19
19
|
- **Sponsoring** — `useStellarAccountActive`, `useStellarAccountStatus`, `useSponsorConfig`, `useActivateStellarAccount`
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
@@ -140,7 +140,7 @@ function SwapButton({ intentParams }: { intentParams: CreateIntentParams }) {
|
|
|
140
140
|
- [`useSwap()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwap.ts) — Submit a cross-chain swap intent
|
|
141
141
|
- [`useSwapAllowance()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapAllowance.ts) — Check token approval
|
|
142
142
|
- [`useSwapApprove()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapApprove.ts) — Approve token spending
|
|
143
|
-
- [`useSwapLifecycle()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapLifecycle.ts) — A whole swap form as one discriminated `state` and one `next()` action: approval strategy, Stellar/NEAR destination gates, source-chain switch (passed in), the swap and its status. A swap that fails after broadcast stays `pending` with its `error`; a batch that was sent but not confirmed is `unconfirmed`, and `next()` waits for it again (never re-sends it) and finishes the swap once it lands. The hooks it composes are returned as escape hatches
|
|
143
|
+
- [`useSwapLifecycle()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapLifecycle.ts) — A whole swap form as one discriminated `state` and one `next()` action: approval strategy, Stellar/NEAR/XRPL destination gates, source-chain switch (passed in), the swap and its status. A swap that fails after broadcast stays `pending` with its `error`; a batch that was sent but not confirmed is `unconfirmed`, and `next()` waits for it again (never re-sends it) and finishes the swap once it lands. The hooks it composes are returned as escape hatches
|
|
144
144
|
- [`useSwapWithApproval()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapWithApproval.ts) — `useSwap` with the approval folded in: approve + swap as one EIP-5792 batch (one signature) on a wallet that can batch, otherwise approve then swap. `allowAccountUpgrade: false` skips the smart-account upgrade prompt a `'ready'` wallet would show and approves separately
|
|
145
145
|
- [`useSwapApprovalStrategy()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useSwapApprovalStrategy.ts) — Which path `useSwapWithApproval` will take (`'not-required'` / `'atomic-batch'` / `'sequential'`), to label the button
|
|
146
146
|
- [`useDetailedStatus()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/swap/useDetailedStatus.ts) — Poll a swap's status from its **source** tx (`{ srcChainKey, srcTxHash }`), whichever completion path ran — the default status read. Collapse `data.value` with `summarizeSwapStatus` from `@sodax/sdk`
|
|
@@ -311,6 +311,10 @@ expires unfilled, so those go through `useSubmitLeveragePositionIntent()`, which
|
|
|
311
311
|
- [`useEstablishTrustline()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useEstablishTrustline.ts) — Request Stellar trustline
|
|
312
312
|
- [`useRequestTrustline()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useRequestTrustline.ts) — **Deprecated**, use `useEstablishTrustline()`
|
|
313
313
|
- [`useStellarGate()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useStellarGate.ts) — Sequences the Stellar destination prerequisites (activation → funding → trustline)
|
|
314
|
+
- [`useXrpDestinationCheck()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useXrpDestinationCheck.ts) — Whether an XRPL account can receive an amount of a token, and why not
|
|
315
|
+
- [`useXrpTrustlineReserveCheck()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useXrpTrustlineReserveCheck.ts) — Whether an XRPL account holds the spendable XRP to set a trustline
|
|
316
|
+
- [`useEstablishXrpTrustline()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useEstablishXrpTrustline.ts) — Create an XRPL trustline, or raise its limit, with one TrustSet
|
|
317
|
+
- [`useXrpGate()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useXrpGate.ts) — Sequences the XRPL issued-token destination prerequisites (trustline → funding), with `blockedReason` for refusals no trustline fixes
|
|
314
318
|
- [`useNearStorageCheck()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useNearStorageCheck.ts) — Check NEP-141 storage registration for a token on NEAR (NEAR's analogue of a Stellar trustline)
|
|
315
319
|
- [`useRegisterNearStorage()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useRegisterNearStorage.ts) — Submit a NEP-141 `storage_deposit` so a NEAR account can receive a token
|
|
316
320
|
- [`useNearStorageGate()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/hooks/shared/useNearStorageGate.ts) — Derive the NEP-141 storage-registration UI gate state for a NEAR delivery
|
|
@@ -380,6 +384,10 @@ DEX param builders:
|
|
|
380
384
|
- [`createSupplyLiquidityParamsProps()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build concentrated liquidity supply params
|
|
381
385
|
- [`createDecreaseLiquidityParamsProps()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/dex-utils.ts) — Build decrease liquidity params
|
|
382
386
|
|
|
387
|
+
XRPL trustline gate:
|
|
388
|
+
|
|
389
|
+
- [`resolveXrpGate()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/xrpGate.ts) — Derive the XRPL issued-token destination gate state (hook-free counterpart of `useXrpGate`)
|
|
390
|
+
|
|
383
391
|
NEAR storage gate:
|
|
384
392
|
|
|
385
393
|
- [`resolveNearStorageGate()`](https://github.com/gosodax/sodax-sdks/blob/main/packages/dapp-kit/src/utils/nearStorageGate.ts) — Derive the NEP-141 storage-registration UI gate state (hook-free counterpart of `useNearStorageGate`)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UseMutationOptions, UseQueryOptions, UseMutationResult, MutateOptions, UseQueryResult, QueryClient, QueryClientConfig } from '@tanstack/react-query';
|
|
2
2
|
import * as _sodax_sdk from '@sodax/sdk';
|
|
3
|
-
import { Result, Sodax, SpokeChainKey, GetEstimateGasReturnType, EstimateGasParams, StellarChainKey, IStellarWalletProvider, INearWalletProvider, GetWalletProviderType, StellarAccountStatus, ActivateStellarAccountResult, IXServiceBase, XToken, EvmHubProvider, IBitcoinWalletProvider, RadfiWalletBalance, IWalletProvider, RadfiUtxo, MoneyMarketBorrowActionParams, OutboundSettlement, MoneyMarketRepayActionParams, TxHashPair, MoneyMarketSupplyActionParams, MoneyMarketWithdrawActionParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, ReservesDataHumanized, Address as Address$1, MoneyMarketParams, MoneyMarketApproveActionParams, TxReturnType, Erc20Token, ChainKey, ReserveDataHumanized, FormatReserveUSDResponse, FormatUserSummaryResponse, EmodeDataHumanized, SolverIntentQuoteRequest, SwapActionParams, SwapResponse, SolverIntentStatusResponse, SolverErrorResponse, Hex, DetailedSwapStatus, DetailedStatusError, CreateIntentParams, CreateLimitOrderParams, SwapApprovalStrategy, SwapWithApprovalParams, SwapWithApprovalResponse, SwapExtras, Intent, LimitOrderActionParams, IntentResponse, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, OracleMarketsResponse, OracleCandlesResponse, OracleCandleInterval, GetSwapTokensResponseV2, RequestOverrideConfig, GetSwapTokensByChainResponseV2, QuoteResponseV2, QuoteRequestV2, QuoteQueryV2, DeadlineResponseV2, DeadlineQueryV2, AllowanceCheckResponseV2, CreateIntentParamsV2, ApproveResponseV2, RawTxReturnType, Hash, ApprovalStrategy, ApprovalOptions, EvmRawTransaction, IEvmWalletProvider, CreateIntentResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, StatusResponseV2, SwapIntentStatusCodeV2, CancelIntentRequestV2, CancelIntentResponseV2, IntentHashResponseV2, IntentRequestV2, IntentPacketResponseV2, IntentPacketRequestV2, IntentExtraDataResponseV2, IntentExtraDataRequestV2, IntentStateV2, GetIntentResponseV2, CreateLimitOrderParamsV2, CreateLimitOrderResponseV2, GasEstimateResponseV2, GasEstimateRequestV2, FeeResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusResponseV2, DetailedBridgeStatus, BridgeDetailedStatusError, BridgeParams, CreateBridgeIntentParams, BridgeWithApprovalParams, BridgeWithApprovalResponse, BridgeLimit, BridgeAllowanceCheckResponseV2, CreateBridgeIntentParamsV2, BridgeApproveResponseV2, BridgeableAmountResponseV2, BridgeQuoteRequestV2, CreateBridgeIntentResponseV2, BridgeFeeResponseV2, BridgeFeeRequestV2, BridgeableCheckResponseV2, BridgeSubmitTxRequestV2, BridgeSubmitTxResponseV2, BridgeSubmitTxStatusResponseV2, GetBridgeTokensResponseV2, GetBridgeTokensByChainResponseV2, StakeAction, StakeParams, UnstakeAction, ClaimAction, CancelUnstakeAction, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeAction, UnstakeParams, InstantUnstakeParams, PartnerFeeClaimAssetBalance, AutoSwapPreferences, FeeTokenApproveParams, FeeTokenApproveAction, HubChainKey, SetSwapPreferenceAction, PartnerFeeClaimSwapAction, IntentAutoSwapResult, PartnerFeeClaimCancelAction, GetUserIntentParams, HubAssetBalance, WithdrawHubAssetAction, SendMessageReturnType, IcxMigrateAction, IcxRevertMigrationAction, UnifiedBnUSDMigrateAction, BalnMigrateAction, MigrationAction, IcxMigrateParams, IcxCreateRevertMigrationParams, UnifiedBnUSDMigrateParams, BalnMigrateParams, PoolKey, PoolData, ClPositionInfo, AssetDepositAction, AssetWithdrawAction, CreateAssetDepositParams, ClSupplyParams, ClIncreaseLiquidityParams, ClLiquidityDecreaseLiquidityAction, ClDecreaseLiquidityParams, CreateAssetWithdrawParams, PoolSpokeAssets, DestinationParamsType, ClLiquidityClaimRewardsAction, LeverageYieldQuoteParams, LeverageYieldEffectiveApr, LeverageYieldPosition, LeverageYieldSwapDepositParams, LeverageYieldSwapPayload, SolverExecutionRequest, SolverExecutionResponse, DetailedLeverageYieldStatus, LeverageYieldDetailedStatusError, VaultSwapActionParams, VaultSwapResponse, VaultSwapWithApprovalParams, VaultSwapWithApprovalResponse, LeverageYieldSwapWithdrawParams, LeveragePositionAccount, LeveragePositionCollateral, LeveragePosition, LeveragePositionPendingState, SpokeExecActionParams, OpenPositionParams, OpenPositionFromDebtTokenParams, LeveragePositionIntentResult, PositionOperationParams, PositionBatchCall, PositionDirectCall, GetLeverageVaultsResponseV2, GetLeverageVaultResponseV2, VaultAssetResponseV2, LeverageYieldPositionV2, LeverageYieldAprV2, LeverageYieldEffectiveAprV2, LeverageYieldLsdAprV2, VaultTotalAssetsResponseV2, PreviewDepositResponseV2, PreviewWithdrawResponseV2, PreviewRedeemResponseV2, ShareBalanceResponseV2, MaxWithdrawResponseV2, LeverageYieldDepositQuoteRequestV2, LeverageYieldWithdrawQuoteRequestV2, CreateDepositIntentParamsV2, CreateWithdrawIntentParamsV2, LeverageYieldSubmitTxRequestV2, ActivateStellarAccountParams, StellarSponsorConfig, SodaxOptions } from '@sodax/sdk';
|
|
3
|
+
import { Result, Sodax, SpokeChainKey, GetEstimateGasReturnType, EstimateGasParams, StellarChainKey, IStellarWalletProvider, INearWalletProvider, GetWalletProviderType, StellarAccountStatus, ActivateStellarAccountResult, XrpDestinationReadiness, IXrpWalletProvider, IXServiceBase, XToken, EvmHubProvider, IBitcoinWalletProvider, RadfiWalletBalance, IWalletProvider, RadfiUtxo, MoneyMarketBorrowActionParams, OutboundSettlement, MoneyMarketRepayActionParams, TxHashPair, MoneyMarketSupplyActionParams, MoneyMarketWithdrawActionParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, ReservesDataHumanized, Address as Address$1, MoneyMarketParams, MoneyMarketApproveActionParams, TxReturnType, Erc20Token, ChainKey, ReserveDataHumanized, FormatReserveUSDResponse, FormatUserSummaryResponse, EmodeDataHumanized, SolverIntentQuoteRequest, SwapActionParams, SwapResponse, SolverIntentStatusResponse, SolverErrorResponse, Hex, DetailedSwapStatus, DetailedStatusError, CreateIntentParams, CreateLimitOrderParams, SwapApprovalStrategy, SwapWithApprovalParams, SwapWithApprovalResponse, SwapExtras, Intent, LimitOrderActionParams, IntentResponse, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, OracleMarketsResponse, OracleCandlesResponse, OracleCandleInterval, GetSwapTokensResponseV2, RequestOverrideConfig, GetSwapTokensByChainResponseV2, QuoteResponseV2, QuoteRequestV2, QuoteQueryV2, DeadlineResponseV2, DeadlineQueryV2, AllowanceCheckResponseV2, CreateIntentParamsV2, ApproveResponseV2, RawTxReturnType, Hash, ApprovalStrategy, ApprovalOptions, EvmRawTransaction, IEvmWalletProvider, CreateIntentResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, StatusResponseV2, SwapIntentStatusCodeV2, CancelIntentRequestV2, CancelIntentResponseV2, IntentHashResponseV2, IntentRequestV2, IntentPacketResponseV2, IntentPacketRequestV2, IntentExtraDataResponseV2, IntentExtraDataRequestV2, IntentStateV2, GetIntentResponseV2, CreateLimitOrderParamsV2, CreateLimitOrderResponseV2, GasEstimateResponseV2, GasEstimateRequestV2, FeeResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusResponseV2, DetailedBridgeStatus, BridgeDetailedStatusError, BridgeParams, CreateBridgeIntentParams, BridgeWithApprovalParams, BridgeWithApprovalResponse, BridgeLimit, BridgeAllowanceCheckResponseV2, CreateBridgeIntentParamsV2, BridgeApproveResponseV2, BridgeableAmountResponseV2, BridgeQuoteRequestV2, CreateBridgeIntentResponseV2, BridgeFeeResponseV2, BridgeFeeRequestV2, BridgeableCheckResponseV2, BridgeSubmitTxRequestV2, BridgeSubmitTxResponseV2, BridgeSubmitTxStatusResponseV2, GetBridgeTokensResponseV2, GetBridgeTokensByChainResponseV2, StakeAction, StakeParams, UnstakeAction, ClaimAction, CancelUnstakeAction, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeAction, UnstakeParams, InstantUnstakeParams, PartnerFeeClaimAssetBalance, AutoSwapPreferences, FeeTokenApproveParams, FeeTokenApproveAction, HubChainKey, SetSwapPreferenceAction, PartnerFeeClaimSwapAction, IntentAutoSwapResult, PartnerFeeClaimCancelAction, GetUserIntentParams, HubAssetBalance, WithdrawHubAssetAction, SendMessageReturnType, IcxMigrateAction, IcxRevertMigrationAction, UnifiedBnUSDMigrateAction, BalnMigrateAction, MigrationAction, IcxMigrateParams, IcxCreateRevertMigrationParams, UnifiedBnUSDMigrateParams, BalnMigrateParams, PoolKey, PoolData, ClPositionInfo, AssetDepositAction, AssetWithdrawAction, CreateAssetDepositParams, ClSupplyParams, ClIncreaseLiquidityParams, ClLiquidityDecreaseLiquidityAction, ClDecreaseLiquidityParams, CreateAssetWithdrawParams, PoolSpokeAssets, DestinationParamsType, ClLiquidityClaimRewardsAction, LeverageYieldQuoteParams, LeverageYieldEffectiveApr, LeverageYieldPosition, LeverageYieldSwapDepositParams, LeverageYieldSwapPayload, SolverExecutionRequest, SolverExecutionResponse, DetailedLeverageYieldStatus, LeverageYieldDetailedStatusError, VaultSwapActionParams, VaultSwapResponse, VaultSwapWithApprovalParams, VaultSwapWithApprovalResponse, LeverageYieldSwapWithdrawParams, LeveragePositionAccount, LeveragePositionCollateral, LeveragePosition, LeveragePositionPendingState, SpokeExecActionParams, OpenPositionParams, OpenPositionFromDebtTokenParams, LeveragePositionIntentResult, PositionOperationParams, PositionBatchCall, PositionDirectCall, GetLeverageVaultsResponseV2, GetLeverageVaultResponseV2, VaultAssetResponseV2, LeverageYieldPositionV2, LeverageYieldAprV2, LeverageYieldEffectiveAprV2, LeverageYieldLsdAprV2, VaultTotalAssetsResponseV2, PreviewDepositResponseV2, PreviewWithdrawResponseV2, PreviewRedeemResponseV2, ShareBalanceResponseV2, MaxWithdrawResponseV2, LeverageYieldDepositQuoteRequestV2, LeverageYieldWithdrawQuoteRequestV2, CreateDepositIntentParamsV2, CreateWithdrawIntentParamsV2, LeverageYieldSubmitTxRequestV2, ActivateStellarAccountParams, StellarSponsorConfig, SodaxOptions } from '@sodax/sdk';
|
|
4
4
|
export * from '@sodax/sdk';
|
|
5
5
|
import { Address } from 'viem';
|
|
6
6
|
import { ReactNode, ReactElement } from 'react';
|
|
@@ -364,6 +364,135 @@ interface StellarGate extends StellarGateState {
|
|
|
364
364
|
*/
|
|
365
365
|
declare function useStellarGate({ dstChainKey, token, amount, address, walletProvider, }: UseStellarGateParams): StellarGate;
|
|
366
366
|
|
|
367
|
+
type UseXrpDestinationCheckParams = ReadHookParams<XrpDestinationReadiness, {
|
|
368
|
+
chainId: SpokeChainKey | undefined;
|
|
369
|
+
token: string | undefined;
|
|
370
|
+
/** The XRPL account that receives the payout. */
|
|
371
|
+
address: string | undefined;
|
|
372
|
+
/** The least that arrives, in the token's decimals. */
|
|
373
|
+
amount: bigint | undefined;
|
|
374
|
+
/** The most that can arrive, which the trustline needs room for. Defaults to `amount`. */
|
|
375
|
+
maxAmount?: bigint;
|
|
376
|
+
}>;
|
|
377
|
+
type XrpDestinationReader = {
|
|
378
|
+
spoke: {
|
|
379
|
+
xrp: Pick<Sodax['spoke']['xrp'], 'checkDestination'>;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
declare function getXrpDestinationCheckQueryOptions({ sodax, chainId, token, address, amount, maxAmount, }: {
|
|
383
|
+
sodax: XrpDestinationReader;
|
|
384
|
+
chainId: SpokeChainKey | undefined;
|
|
385
|
+
token: string | undefined;
|
|
386
|
+
address: string | undefined;
|
|
387
|
+
amount: bigint | undefined;
|
|
388
|
+
maxAmount?: bigint;
|
|
389
|
+
}): {
|
|
390
|
+
queryKey: readonly ["shared", "xrpDestinationCheck", "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera" | "tron" | "robinhood" | "xrp" | "monad" | "ton" | "zcash" | "cardano" | undefined, string | undefined, string | undefined, string | undefined, string | undefined];
|
|
391
|
+
queryFn: () => Promise<XrpDestinationReadiness>;
|
|
392
|
+
enabled: boolean;
|
|
393
|
+
};
|
|
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
|
+
*/
|
|
398
|
+
declare function useXrpDestinationCheck({ params, queryOptions, }?: UseXrpDestinationCheckParams): UseQueryResult<XrpDestinationReadiness, Error>;
|
|
399
|
+
|
|
400
|
+
type UseXrpTrustlineReserveCheckParams = ReadHookParams<boolean, {
|
|
401
|
+
token: string | undefined;
|
|
402
|
+
address: string | undefined;
|
|
403
|
+
}>;
|
|
404
|
+
type XrpReserveReader = {
|
|
405
|
+
spoke: {
|
|
406
|
+
xrp: Pick<Sodax['spoke']['xrp'], 'canAffordTrustline'>;
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
declare function getXrpTrustlineReserveCheckQueryOptions({ sodax, token, address, }: {
|
|
410
|
+
sodax: XrpReserveReader;
|
|
411
|
+
token: string | undefined;
|
|
412
|
+
address: string | undefined;
|
|
413
|
+
}): {
|
|
414
|
+
queryKey: readonly ["shared", "xrpTrustlineReserveCheck", string | undefined, string | undefined];
|
|
415
|
+
queryFn: () => Promise<boolean>;
|
|
416
|
+
enabled: boolean;
|
|
417
|
+
};
|
|
418
|
+
/** Whether an XRPL account holds the spendable XRP to set the trustline for an issued `token`. */
|
|
419
|
+
declare function useXrpTrustlineReserveCheck({ params, queryOptions, }?: UseXrpTrustlineReserveCheckParams): UseQueryResult<boolean, Error>;
|
|
420
|
+
|
|
421
|
+
type UseEstablishXrpTrustlineVars = {
|
|
422
|
+
/** The XRPL issued token to hold. */
|
|
423
|
+
token: string;
|
|
424
|
+
/** The account that needs the trustline. When set, the mutation refuses a wallet connected to another account. */
|
|
425
|
+
address?: string;
|
|
426
|
+
walletProvider: IXrpWalletProvider;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* Create the XRPL trustline the connected account needs to hold `token`, or raise its limit. Resolves to the
|
|
430
|
+
* TrustSet hash once it validates. The account pays its fee and, unless the ledger waives it, an owner reserve: check with
|
|
431
|
+
* {@link useXrpTrustlineReserveCheck}, or use {@link useXrpGate}, before asking the user to sign.
|
|
432
|
+
*/
|
|
433
|
+
declare function useEstablishXrpTrustline({ mutationOptions, }?: MutationHookParams<string, UseEstablishXrpTrustlineVars>): SafeUseMutationResult<string, Error, UseEstablishXrpTrustlineVars>;
|
|
434
|
+
|
|
435
|
+
/** The subset of a query result the gate reads. A full `UseQueryResult<T>` satisfies it. */
|
|
436
|
+
type XrpCheckResult<T> = Pick<UseQueryResult<T>, 'isLoading' | 'isError' | 'data'>;
|
|
437
|
+
/** A destination refusal the account's own trustline cannot fix. */
|
|
438
|
+
type XrpBlockedReason = Exclude<Extract<XrpDestinationReadiness, {
|
|
439
|
+
ready: false;
|
|
440
|
+
}>['reason'], 'no_trustline' | 'trustline_limit'>;
|
|
441
|
+
interface XrpGateState {
|
|
442
|
+
/** The destination is XRPL and the token is an issued currency, so a trustline is involved. */
|
|
443
|
+
isXrpIssuedToken: boolean;
|
|
444
|
+
/** The trustline is missing or too small, and the account can afford to set it. */
|
|
445
|
+
needsTrustline: boolean;
|
|
446
|
+
/** The trustline needs setting, but the account lacks the spendable XRP for its fee and reserve. */
|
|
447
|
+
needsFunding: boolean;
|
|
448
|
+
/** Why the destination cannot receive, when no trustline change by the user would fix it. */
|
|
449
|
+
blockedReason: XrpBlockedReason | undefined;
|
|
450
|
+
/** A query failed; disabled or unresolved queries do not set this. */
|
|
451
|
+
checkFailed: boolean;
|
|
452
|
+
/** Whether the downstream action must remain disabled. */
|
|
453
|
+
blocksAction: boolean;
|
|
454
|
+
}
|
|
455
|
+
interface XrpGateInputs {
|
|
456
|
+
/** Whether the destination can receive the payout, from the same ledger reads the SDK refuses a swap on. */
|
|
457
|
+
readinessCheck: XrpCheckResult<XrpDestinationReadiness>;
|
|
458
|
+
/** Whether the account can pay for the TrustSet. Only read once the trustline is known to need setting. */
|
|
459
|
+
reserveCheck: XrpCheckResult<boolean>;
|
|
460
|
+
/** Resolve from chain config: false for native XRP. */
|
|
461
|
+
requiresTrustline: boolean;
|
|
462
|
+
}
|
|
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
|
+
*/
|
|
467
|
+
declare function resolveXrpGate(chainKey: SpokeChainKey | undefined, inputs: XrpGateInputs): XrpGateState;
|
|
468
|
+
|
|
469
|
+
interface UseXrpGateParams {
|
|
470
|
+
dstChainKey: SpokeChainKey | undefined;
|
|
471
|
+
token: string | undefined;
|
|
472
|
+
/** The XRPL account that receives the payout. */
|
|
473
|
+
address: string | undefined;
|
|
474
|
+
/** The least that arrives, in the token's decimals. */
|
|
475
|
+
amount: bigint | undefined;
|
|
476
|
+
/** The most that can arrive, which the trustline needs room for. Defaults to `amount`. */
|
|
477
|
+
maxAmount?: bigint;
|
|
478
|
+
/** Must control `address`: `requestTrustline` refuses, before signing, a wallet connected to another account. */
|
|
479
|
+
walletProvider: GetWalletProviderType<SpokeChainKey> | undefined;
|
|
480
|
+
}
|
|
481
|
+
interface XrpGate extends XrpGateState {
|
|
482
|
+
isChecking: boolean;
|
|
483
|
+
/** Surface when `checkFailed` is true. */
|
|
484
|
+
error: Error | undefined;
|
|
485
|
+
retry: () => void;
|
|
486
|
+
isRequestingTrustline: boolean;
|
|
487
|
+
/** Returns `undefined` when required inputs are missing. */
|
|
488
|
+
requestTrustline: () => Promise<Result<string> | undefined>;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Gate XRPL delivery of an issued token on a trustline with room for the payout, and on enough spendable XRP
|
|
492
|
+
* to set one. Refusals the user's trustline cannot fix surface as `blockedReason`.
|
|
493
|
+
*/
|
|
494
|
+
declare function useXrpGate({ dstChainKey, token, address, amount, maxAmount, walletProvider, }: UseXrpGateParams): XrpGate;
|
|
495
|
+
|
|
367
496
|
type UseGetUserHubWalletAddressParams = ReadHookParams<Address, {
|
|
368
497
|
spokeChainId?: SpokeChainKey;
|
|
369
498
|
spokeAddress?: string;
|
|
@@ -1027,7 +1156,7 @@ interface NearStorageGateState {
|
|
|
1027
1156
|
declare function resolveNearStorageGate(chainKey: SpokeChainKey | undefined, check: NearStorageCheckResult): NearStorageGateState;
|
|
1028
1157
|
|
|
1029
1158
|
/** A prerequisite the user must resolve before the swap can go out. */
|
|
1030
|
-
type SwapSetupReason = 'stellarActivation' | 'stellarFunding' | 'stellarTrustline' | 'stellarCheckFailed' | 'nearStorage' | 'nearStorageCheckFailed' | 'external';
|
|
1159
|
+
type SwapSetupReason = 'stellarActivation' | 'stellarFunding' | 'stellarTrustline' | 'stellarCheckFailed' | 'nearStorage' | 'nearStorageCheckFailed' | 'xrpTrustline' | 'xrpFunding' | 'xrpBlocked' | 'xrpCheckFailed' | 'external';
|
|
1031
1160
|
/**
|
|
1032
1161
|
* Where a swap form stands, discriminated on `kind`. `useSwapLifecycle`'s `next()` acts on it.
|
|
1033
1162
|
*
|
|
@@ -1094,7 +1223,7 @@ type UseSwapLifecycleParams<K extends SpokeChainKey = SpokeChainKey> = {
|
|
|
1094
1223
|
intentParams: CreateIntentParams<K> | undefined;
|
|
1095
1224
|
srcWalletProvider: GetWalletProviderType<K> | undefined;
|
|
1096
1225
|
/**
|
|
1097
|
-
* Destination wallet, for the Stellar and
|
|
1226
|
+
* Destination wallet, for the Stellar, NEAR and XRPL setup actions. The gates check `intentParams.dstAddress`,
|
|
1098
1227
|
* the account the swap pays, so this wallet must control it for those actions to clear them.
|
|
1099
1228
|
*/
|
|
1100
1229
|
dstWalletProvider: GetWalletProviderType<SpokeChainKey> | undefined;
|
|
@@ -1134,10 +1263,12 @@ type SwapLifecycle<K extends SpokeChainKey = SpokeChainKey> = {
|
|
|
1134
1263
|
status: UseQueryResult<UseDetailedStatusResult>;
|
|
1135
1264
|
stellar: StellarGate;
|
|
1136
1265
|
nearStorage: NearStorageGate;
|
|
1266
|
+
/** `blockedReason` names why an XRPL destination cannot receive when the state is `xrpBlocked`. */
|
|
1267
|
+
xrp: XrpGate;
|
|
1137
1268
|
};
|
|
1138
1269
|
/**
|
|
1139
1270
|
* One hook for a swap form: approval strategy, destination prerequisites (Stellar account and
|
|
1140
|
-
* trustline, NEAR storage), source-chain switching, the swap itself (`useSwapWithApproval` — one
|
|
1271
|
+
* trustline, NEAR storage, XRPL trustline), source-chain switching, the swap itself (`useSwapWithApproval` — one
|
|
1141
1272
|
* signature on an EIP-5792 wallet) and its status (`useDetailedStatus`), as a single discriminated
|
|
1142
1273
|
* `state` with one `next()` action. Render from `state.kind`; wire the button to `next()`.
|
|
1143
1274
|
*
|
|
@@ -4159,4 +4290,4 @@ type CreateSodaxQueryClientOptions = {
|
|
|
4159
4290
|
*/
|
|
4160
4291
|
declare function createSodaxQueryClient({ onMutationError, config, }?: CreateSodaxQueryClientOptions): QueryClient;
|
|
4161
4292
|
|
|
4162
|
-
export { type ATokenData, type ApprovalHashes, type ApprovalPlan, type ApprovalProgress, type ApprovalProgressListener, type BackendPaginationParams, type BalancesInputs, type BitcoinTradingSetup, type BridgeApiApprovalHashes, type CreateSodaxQueryClientOptions, type DecreaseLiquidityParamsCore, type DepositParamsCore, type LeverageYieldApiApprovalHashes, type LeverageYieldShareHolder, type LeverageYieldShareHolding, type MutationHookOptions, type MutationHookParams, type NearStorageCheckResult, type NearStorageGate, type NearStorageGateState, type RadfiSession, type ReadHookParams, type ReadQueryOptions, type ReserveUsdFormat, type SafeUseMutationResult, SodaxProvider, type StellarCheckResult, type StellarGate, type StellarGateInputs, type StellarGateState, type SwapLifecycle, type SwapLifecycleState, type SwapSetupReason, type SwapsApiApprovalHashes, type SwapsApiBroadcastWithApprovalResult, type UseATokenParams, type UseATokensBalancesParams, type UseActivateStellarAccountVars, type UseApproveLeveragePositionFundingVars, type UseApproveTokenVars, type UseBalancesParams, type UseBitcoinBalanceParams, type UseBitcoinTradingSetupParams, type UseBorrowVars, type UseBridgeAllowanceParams, type UseBridgeApiAllowanceParams, type UseBridgeApiApproveAndBroadcastVars, type UseBridgeApiApproveVars, type UseBridgeApiBridgeableAmountParams, type UseBridgeApiCreateBridgeIntentVars, type UseBridgeApiFeeParams, type UseBridgeApiIsBridgeableParams, type UseBridgeApiSubmitTxStatusParams, type UseBridgeApiSubmitTxVars, type UseBridgeApiTokensByChainParams, type UseBridgeApiTokensParams, type UseBridgeApprovalStrategyParams, type UseBridgeApproveVars, type UseBridgeDetailedStatusParams, type UseBridgeDetailedStatusResult, type UseBridgeVars, type UseBridgeWithApprovalVars, type UseClaimRewardsVars, type UseCreateDecreaseLiquidityParamsProps, type UseCreateDepositParamsProps, type UseCreateLimitOrderVars, type UseCreateSupplyLiquidityParamsProps, type UseCreateSupplyLiquidityParamsResult, type UseCreateWithdrawParamsProps, type UseDecreaseLiquidityVars, type UseDeriveUserWalletAddressParams, type UseDetailedStatusParams, type UseDetailedStatusResult, type UseDexAllowanceParams, type UseDexApproveVars, type UseDexDepositVars, type UseDexWithdrawVars, type UseEModesParams, type UseEnsureRadfiAccessTokenVars, type UseEstablishTrustlineVars, type UseExpiredUtxosParams, type UseFeeClaimSwapVars, type UseFeeClaimWithdrawVars, type UseFetchAssetsBalancesParams, type UseFundTradingWalletVars, type UseGetAutoSwapPreferencesParams, type UseGetBridgeableAmountParams, type UseGetBridgeableTokensParams, type UseGetIntentDetailsParams, type UseGetUserHubWalletAddressParams, type UseGetUserIntentParams, type UseHubAssetBalancesParams, type UseIsTokenApprovedParams, type UseLeveragePositionAccountParams, type UseLeveragePositionCollateralParams, type UseLeveragePositionFundingAllowanceParams, type UseLeveragePositionInfoParams, type UseLeveragePositionPayoutAddressParams, type UseLeveragePositionPendingParams, type UseLeveragePositionsForUserParams, type UseLeveragePositionsParams, type UseLeverageYieldApiAllowanceParams, type UseLeverageYieldApiApproveAndBroadcastVars, type UseLeverageYieldApiApproveVars, type UseLeverageYieldApiAprParams, type UseLeverageYieldApiAssetParams, type UseLeverageYieldApiCancelIntentVars, type UseLeverageYieldApiCreateDepositIntentVars, type UseLeverageYieldApiCreateWithdrawIntentVars, type UseLeverageYieldApiDeadlineParams, type UseLeverageYieldApiDepositQuoteParams, type UseLeverageYieldApiEffectiveAprParams, type UseLeverageYieldApiEstimateGasParams, type UseLeverageYieldApiFilledIntentParams, type UseLeverageYieldApiIntentExtraDataParams, type UseLeverageYieldApiIntentHashParams, type UseLeverageYieldApiIntentPacketParams, type UseLeverageYieldApiIntentParams, type UseLeverageYieldApiLsdAprParams, type UseLeverageYieldApiMaxWithdrawParams, type UseLeverageYieldApiPartnerFeeParams, type UseLeverageYieldApiPositionParams, type UseLeverageYieldApiPreviewDepositParams, type UseLeverageYieldApiPreviewRedeemParams, type UseLeverageYieldApiPreviewWithdrawParams, type UseLeverageYieldApiShareBalanceParams, type UseLeverageYieldApiSolverFeeParams, type UseLeverageYieldApiStatusParams, type UseLeverageYieldApiSubmitIntentVars, type UseLeverageYieldApiSubmitTxStatusParams, type UseLeverageYieldApiSubmitTxVars, type UseLeverageYieldApiTotalAssetsParams, type UseLeverageYieldApiVaultParams, type UseLeverageYieldApiVaultsParams, type UseLeverageYieldApiWithdrawQuoteParams, type UseLeverageYieldApprovalStrategyParams, type UseLeverageYieldDepositVars, type UseLeverageYieldDetailedStatusParams, type UseLeverageYieldDetailedStatusResult, type UseLeverageYieldEffectiveAprParams, type UseLeverageYieldNotifySolverVars, type UseLeverageYieldPositionParams, type UseLeverageYieldPreviewRedeemParams, type UseLeverageYieldQuoteParams, type UseLeverageYieldShareBalancesParams, type UseLeverageYieldTotalAssetsParams, type UseLeverageYieldVaultSwapVars, type UseLeverageYieldVaultSwapWithApprovalVars, type UseLeverageYieldWithdrawVars, type UseLiquidityAmountsResult, type UseMMAllowanceParams, type UseMMApproveVars, type UseMigrateBalnVars, type UseMigrateIcxToSodaVars, type UseMigratebnUSDVars, type UseMigrationAllowanceInputs, type UseMigrationAllowanceParams, type UseMigrationApproveVars, type UseNearStorageCheckParams, type UseNearStorageGateParams, type UseOpenLeveragePositionVars, type UsePartnerCancelIntentVars, type UsePoolBalancesParams, type UsePoolBalancesResponse, type UsePoolDataParams, type UsePoolsParams, type UsePositionInfoParams, type UsePositionInfoResponse, type UseQuoteParams, type UseRadfiAuthVars, type UseRadfiSessionReturn, type UseRadfiWithdrawVars, type UseRegisterNearStorageVars, type UseRenewUtxosVars, type UseRepayVars, type UseReservesDataParams, type UseReservesHumanizedParams, type UseReservesListParams, type UseReservesUsdFormatParams, type UseRevertMigrateSodaToIcxVars, type UseRunLeveragePositionOperationVars, type UseSetSwapPreferenceVars, type UseSetSwapPreferenceVarsHub, type UseSponsorConfigParams, type UseStatusParams, type UseStellarAccountActiveParams, type UseStellarAccountStatusParams, type UseStellarGateParams, type UseStellarTrustlineCheckParams, type UseSubmitLeveragePositionIntentVars, type UseSupplyLiquidityVars, type UseSupplyVars, type UseSwapAllowanceParams, type UseSwapApprovalStrategyParams, type UseSwapApproveVars, type UseSwapLifecycleParams, type UseSwapVars, type UseSwapWithApprovalVars, type UseSwapsApiAllowanceParams, type UseSwapsApiApproveAndBroadcastVars, type UseSwapsApiApproveVars, type UseSwapsApiBroadcastWithApprovalVars, type UseSwapsApiCancelIntentVars, type UseSwapsApiCreateIntentVars, type UseSwapsApiCreateLimitOrderVars, type UseSwapsApiDeadlineParams, type UseSwapsApiEstimateGasParams, type UseSwapsApiFilledIntentParams, type UseSwapsApiIntentExtraDataParams, type UseSwapsApiIntentHashParams, type UseSwapsApiIntentPacketParams, type UseSwapsApiIntentParams, type UseSwapsApiPartnerFeeParams, type UseSwapsApiQuoteParams, type UseSwapsApiSolverFeeParams, type UseSwapsApiStatusParams, type UseSwapsApiSubmitIntentVars, type UseSwapsApiSubmitTxStatusParams, type UseSwapsApiSubmitTxVars, type UseSwapsApiTokensByChainParams, type UseSwapsApiTokensParams, type UseTradingWalletBalanceParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawHubAssetVars, type UseWithdrawVars, type UseXBalancesParams, type WithdrawParamsCore, type XBalancesInputs, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getBalancesQueryOptions, getBridgeDetailedStatusRefetchInterval, getLeverageYieldQuoteQueryOptions, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getSwapQuoteQueryOptions, getXBalancesQueryOptions, invalidateBalances, isBridgeMpcRelayRead, isBridgeNotDelivered, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, retryUnlessAuthFailure, runApprovalPlan, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveLeveragePositionFunding, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOracleCandles, useBackendOracleMarkets, useBackendOrderbook, useBackendUserIntents, useBalances, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApiAllowance, useBridgeApiApprove, useBridgeApiApproveAndBroadcast, useBridgeApiBridgeableAmount, useBridgeApiCreateBridgeIntent, useBridgeApiFee, useBridgeApiIsBridgeable, useBridgeApiSubmitTx, useBridgeApiSubmitTxStatus, useBridgeApiTokens, useBridgeApiTokensByChain, useBridgeApprovalStrategy, useBridgeApprove, useBridgeDetailedStatus, useBridgeWithApproval, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDetailedStatus, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEModes, useEnsureRadfiAccessToken, useEstablishTrustline, useEstimateGas, useExpiredUtxos, useFeeClaimSwap, useFeeClaimWithdraw, useFetchAssetsBalances, useFundTradingWallet, useGetAutoSwapPreferences, useGetBridgeableAmount, useGetBridgeableTokens, useGetIntentDetails, useGetUserHubWalletAddress, useGetUserIntent, useHubAssetBalances, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useIsTokenApproved, useLeveragePositionAccount, useLeveragePositionCollateral, useLeveragePositionFundingAllowance, useLeveragePositionInfo, useLeveragePositionPayoutAddress, useLeveragePositionPending, useLeveragePositions, useLeveragePositionsForUser, useLeverageYieldApiAllowance, useLeverageYieldApiApprove, useLeverageYieldApiApproveAndBroadcast, useLeverageYieldApiApr, useLeverageYieldApiAsset, useLeverageYieldApiCancelIntent, useLeverageYieldApiCreateDepositIntent, useLeverageYieldApiCreateWithdrawIntent, useLeverageYieldApiDeadline, useLeverageYieldApiDepositQuote, useLeverageYieldApiEffectiveApr, useLeverageYieldApiEstimateGas, useLeverageYieldApiFilledIntent, useLeverageYieldApiIntent, useLeverageYieldApiIntentExtraData, useLeverageYieldApiIntentHash, useLeverageYieldApiIntentPacket, useLeverageYieldApiLsdApr, useLeverageYieldApiMaxWithdraw, useLeverageYieldApiPartnerFee, useLeverageYieldApiPosition, useLeverageYieldApiPreviewDeposit, useLeverageYieldApiPreviewRedeem, useLeverageYieldApiPreviewWithdraw, useLeverageYieldApiShareBalance, useLeverageYieldApiSolverFee, useLeverageYieldApiStatus, useLeverageYieldApiSubmitIntent, useLeverageYieldApiSubmitTx, useLeverageYieldApiSubmitTxStatus, useLeverageYieldApiTotalAssets, useLeverageYieldApiVault, useLeverageYieldApiVaults, useLeverageYieldApiWithdrawQuote, useLeverageYieldApprovalStrategy, useLeverageYieldDeposit, useLeverageYieldDetailedStatus, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, useLeverageYieldQuote, useLeverageYieldShareBalances, useLeverageYieldTotalAssets, useLeverageYieldVaultSwap, useLeverageYieldVaultSwapWithApproval, useLeverageYieldWithdraw, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrateBaln, useMigrateIcxToSoda, useMigratebnUSD, useMigrationAllowance, useMigrationApprove, useNearStorageCheck, useNearStorageGate, useOpenLeveragePosition, usePartnerCancelIntent, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRegisterNearStorage, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesHumanized, useReservesList, useReservesUsdFormat, useRevertMigrateSodaToIcx, useRunLeveragePositionOperation, useSafeMutation, useSetSwapPreference, useSodaxContext, useSponsorConfig, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarAccountActive, useStellarAccountStatus, useStellarGate, useStellarTrustlineCheck, useSubmitLeveragePositionIntent, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprovalStrategy, useSwapApprove, useSwapLifecycle, useSwapWithApproval, useSwapsApiAllowance, useSwapsApiApprove, useSwapsApiApproveAndBroadcast, useSwapsApiBroadcastWithApproval, useSwapsApiCancelIntent, useSwapsApiCreateIntent, useSwapsApiCreateLimitOrder, useSwapsApiDeadline, useSwapsApiEstimateGas, useSwapsApiFilledIntent, useSwapsApiIntent, useSwapsApiIntentExtraData, useSwapsApiIntentHash, useSwapsApiIntentPacket, useSwapsApiPartnerFee, useSwapsApiQuote, useSwapsApiSolverFee, useSwapsApiStatus, useSwapsApiSubmitIntent, useSwapsApiSubmitTx, useSwapsApiSubmitTxStatus, useSwapsApiTokens, useSwapsApiTokensByChain, useTradingWallet, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw, useWithdrawHubAsset, useXBalances };
|
|
4293
|
+
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSodaxError, isAuthFailure, ChainKeys, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, RadfiApiError, normalizePsbtToBase64, summarizeSwapStatus, isEvmChainKeyType, resolveApprovalStrategy, isEvmSpokeOnlyChainKeyType, sendApprovalBatch, DEFAULT_RELAY_TX_TIMEOUT, isAtomicBatchRefusal, SodaxError, ATOMIC_BATCH_REFUSED, getEvmViemChain, DETAILED_STATUS_NOT_DELIVERED, ClService, SPONSOR_CONFIG_TTL_MS, Sodax, isIndeterminateOutcomeError, ATOMIC_BATCH_UNCONFIRMED, SolverIntentStatusCode, isApprovalSupportedChainKeyType, isHubChainKeyType, isStellarChainKeyType } from '@sodax/sdk';
|
|
1
|
+
import { isSodaxError, isAuthFailure, ChainKeys, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, RadfiApiError, normalizePsbtToBase64, SOLVED_PAYOUT_HEADROOM_FACTOR, summarizeSwapStatus, isEvmChainKeyType, resolveApprovalStrategy, isEvmSpokeOnlyChainKeyType, sendApprovalBatch, DEFAULT_RELAY_TX_TIMEOUT, isAtomicBatchRefusal, SodaxError, ATOMIC_BATCH_REFUSED, getEvmViemChain, DETAILED_STATUS_NOT_DELIVERED, ClService, SPONSOR_CONFIG_TTL_MS, Sodax, isIndeterminateOutcomeError, ATOMIC_BATCH_UNCONFIRMED, SolverIntentStatusCode, isApprovalSupportedChainKeyType, isHubChainKeyType, isStellarChainKeyType } from '@sodax/sdk';
|
|
2
2
|
export * from '@sodax/sdk';
|
|
3
3
|
import { useQueryClient, useMutation, useQuery, useIsFetching, useQueries, QueryClient, MutationCache } from '@tanstack/react-query';
|
|
4
4
|
import { createContext, useCallback, useContext, useRef, useState, useEffect, useMemo } from 'react';
|
|
@@ -411,6 +411,171 @@ function useStellarGate({
|
|
|
411
411
|
requestTrustline
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
|
+
function getXrpDestinationCheckQueryOptions({
|
|
415
|
+
sodax,
|
|
416
|
+
chainId,
|
|
417
|
+
token,
|
|
418
|
+
address,
|
|
419
|
+
amount,
|
|
420
|
+
maxAmount
|
|
421
|
+
}) {
|
|
422
|
+
return {
|
|
423
|
+
queryKey: [
|
|
424
|
+
"shared",
|
|
425
|
+
"xrpDestinationCheck",
|
|
426
|
+
chainId,
|
|
427
|
+
token,
|
|
428
|
+
address,
|
|
429
|
+
amount?.toString(),
|
|
430
|
+
maxAmount?.toString()
|
|
431
|
+
],
|
|
432
|
+
queryFn: async () => {
|
|
433
|
+
if (!address || !token || amount === void 0) throw new Error("address, token and amount are required");
|
|
434
|
+
return sodax.spoke.xrp.checkDestination({ address, token, amount, maxAmount });
|
|
435
|
+
},
|
|
436
|
+
enabled: chainId === ChainKeys.XRP_MAINNET && !!address && !!token && amount !== void 0
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function useXrpDestinationCheck({
|
|
440
|
+
params,
|
|
441
|
+
queryOptions
|
|
442
|
+
} = {}) {
|
|
443
|
+
const { sodax } = useSodaxContext();
|
|
444
|
+
return useQuery({
|
|
445
|
+
...getXrpDestinationCheckQueryOptions({
|
|
446
|
+
sodax,
|
|
447
|
+
chainId: params?.chainId,
|
|
448
|
+
token: params?.token,
|
|
449
|
+
address: params?.address,
|
|
450
|
+
amount: params?.amount,
|
|
451
|
+
maxAmount: params?.maxAmount
|
|
452
|
+
}),
|
|
453
|
+
...queryOptions
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function getXrpTrustlineReserveCheckQueryOptions({
|
|
457
|
+
sodax,
|
|
458
|
+
token,
|
|
459
|
+
address
|
|
460
|
+
}) {
|
|
461
|
+
return {
|
|
462
|
+
queryKey: ["shared", "xrpTrustlineReserveCheck", token, address],
|
|
463
|
+
queryFn: async () => {
|
|
464
|
+
if (!address || !token) throw new Error("address and token are required");
|
|
465
|
+
return sodax.spoke.xrp.canAffordTrustline({ address, token });
|
|
466
|
+
},
|
|
467
|
+
enabled: !!address && !!token
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function useXrpTrustlineReserveCheck({
|
|
471
|
+
params,
|
|
472
|
+
queryOptions
|
|
473
|
+
} = {}) {
|
|
474
|
+
const { sodax } = useSodaxContext();
|
|
475
|
+
return useQuery({
|
|
476
|
+
...getXrpTrustlineReserveCheckQueryOptions({ sodax, token: params?.token, address: params?.address }),
|
|
477
|
+
...queryOptions
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
function useEstablishXrpTrustline({
|
|
481
|
+
mutationOptions
|
|
482
|
+
} = {}) {
|
|
483
|
+
const { sodax } = useSodaxContext();
|
|
484
|
+
const queryClient = useQueryClient();
|
|
485
|
+
return useSafeMutation({
|
|
486
|
+
mutationKey: ["shared", "establishXrpTrustline"],
|
|
487
|
+
...mutationOptions,
|
|
488
|
+
// Each TrustSet costs a fee, so one that may have been sent is never signed again automatically.
|
|
489
|
+
retry: retryBeforeSubmission(
|
|
490
|
+
mutationOptions?.retry ?? queryClient.getMutationDefaults?.(mutationOptions?.mutationKey ?? ["shared", "establishXrpTrustline"])?.retry ?? queryClient.getDefaultOptions?.().mutations?.retry
|
|
491
|
+
),
|
|
492
|
+
mutationFn: async ({ token, address, walletProvider }) => {
|
|
493
|
+
const srcAddress = await walletProvider.getWalletAddress();
|
|
494
|
+
if (address !== void 0 && address !== srcAddress) {
|
|
495
|
+
throw new Error(
|
|
496
|
+
`The connected XRPL account ${srcAddress} is not ${address}, which needs the trustline \u2014 connect ${address} to add it`
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
return unwrapResult(await sodax.spoke.xrp.requestTrustline({ srcAddress, token, walletProvider }));
|
|
500
|
+
},
|
|
501
|
+
onSuccess: async (data, vars, ctx) => {
|
|
502
|
+
const address = vars.address ?? await vars.walletProvider.getWalletAddress().catch(() => void 0);
|
|
503
|
+
queryClient.invalidateQueries({
|
|
504
|
+
queryKey: address ? ["shared", "xrpDestinationCheck", ChainKeys.XRP_MAINNET, vars.token, address] : ["shared", "xrpDestinationCheck"]
|
|
505
|
+
});
|
|
506
|
+
queryClient.invalidateQueries({ queryKey: ["shared", "xrpTrustlineReserveCheck"] });
|
|
507
|
+
invalidateBalances(queryClient, ChainKeys.XRP_MAINNET);
|
|
508
|
+
await mutationOptions?.onSuccess?.(data, vars, ctx);
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
var NOT_XRP_ISSUED_TOKEN = {
|
|
513
|
+
isXrpIssuedToken: false,
|
|
514
|
+
needsTrustline: false,
|
|
515
|
+
needsFunding: false,
|
|
516
|
+
blockedReason: void 0,
|
|
517
|
+
checkFailed: false,
|
|
518
|
+
blocksAction: false
|
|
519
|
+
};
|
|
520
|
+
function unresolved2(check) {
|
|
521
|
+
return check.isLoading || check.data === void 0;
|
|
522
|
+
}
|
|
523
|
+
function resolveXrpGate(chainKey, inputs) {
|
|
524
|
+
const { readinessCheck, reserveCheck, requiresTrustline } = inputs;
|
|
525
|
+
if (chainKey !== ChainKeys.XRP_MAINNET || !requiresTrustline) return NOT_XRP_ISSUED_TOKEN;
|
|
526
|
+
const base = { ...NOT_XRP_ISSUED_TOKEN, isXrpIssuedToken: true };
|
|
527
|
+
if (readinessCheck.isError) return { ...base, checkFailed: true, blocksAction: true };
|
|
528
|
+
const readiness = readinessCheck.data;
|
|
529
|
+
if (readinessCheck.isLoading || readiness === void 0) return { ...base, blocksAction: true };
|
|
530
|
+
if (readiness.ready) return base;
|
|
531
|
+
if (readiness.reason !== "no_trustline" && readiness.reason !== "trustline_limit") {
|
|
532
|
+
return { ...base, blockedReason: readiness.reason, blocksAction: true };
|
|
533
|
+
}
|
|
534
|
+
if (reserveCheck.isError) return { ...base, checkFailed: true, blocksAction: true };
|
|
535
|
+
if (unresolved2(reserveCheck)) return { ...base, blocksAction: true };
|
|
536
|
+
if (reserveCheck.data !== true) return { ...base, needsFunding: true, blocksAction: true };
|
|
537
|
+
return { ...base, needsTrustline: true, blocksAction: true };
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// src/hooks/shared/useXrpGate.ts
|
|
541
|
+
function useXrpGate({
|
|
542
|
+
dstChainKey,
|
|
543
|
+
token,
|
|
544
|
+
address,
|
|
545
|
+
amount,
|
|
546
|
+
maxAmount,
|
|
547
|
+
walletProvider
|
|
548
|
+
}) {
|
|
549
|
+
const { sodax } = useSodaxContext();
|
|
550
|
+
const isXrpDestination = dstChainKey === ChainKeys.XRP_MAINNET;
|
|
551
|
+
const requiresTrustline = isXrpDestination && !!token && sodax.spoke.xrp.requiresTrustline(token);
|
|
552
|
+
const xrpWalletProvider = walletProvider?.chainType === "XRP" ? walletProvider : void 0;
|
|
553
|
+
const readinessCheck = useXrpDestinationCheck({
|
|
554
|
+
params: { chainId: requiresTrustline ? dstChainKey : void 0, token, address, amount, maxAmount }
|
|
555
|
+
});
|
|
556
|
+
const trustlineReason = readinessCheck.data?.ready === false && (readinessCheck.data.reason === "no_trustline" || readinessCheck.data.reason === "trustline_limit");
|
|
557
|
+
const reserveCheck = useXrpTrustlineReserveCheck({
|
|
558
|
+
params: { token: trustlineReason ? token : void 0, address: trustlineReason ? address : void 0 }
|
|
559
|
+
});
|
|
560
|
+
const state = resolveXrpGate(dstChainKey, { readinessCheck, reserveCheck, requiresTrustline });
|
|
561
|
+
const { mutateAsyncSafe: establishTrustline, isPending: isRequestingTrustline } = useEstablishXrpTrustline();
|
|
562
|
+
const requestTrustline = async () => {
|
|
563
|
+
if (!xrpWalletProvider || !token || !address) return void 0;
|
|
564
|
+
return establishTrustline({ token, address, walletProvider: xrpWalletProvider });
|
|
565
|
+
};
|
|
566
|
+
const retry = () => {
|
|
567
|
+
void readinessCheck.refetch();
|
|
568
|
+
if (trustlineReason) void reserveCheck.refetch();
|
|
569
|
+
};
|
|
570
|
+
return {
|
|
571
|
+
...state,
|
|
572
|
+
isChecking: readinessCheck.isLoading || reserveCheck.isLoading,
|
|
573
|
+
error: readinessCheck.error ?? reserveCheck.error ?? void 0,
|
|
574
|
+
retry,
|
|
575
|
+
isRequestingTrustline,
|
|
576
|
+
requestTrustline
|
|
577
|
+
};
|
|
578
|
+
}
|
|
414
579
|
var SESSION_KEY = (address) => `radfi_session_${address}`;
|
|
415
580
|
function saveRadfiSession(address, session) {
|
|
416
581
|
try {
|
|
@@ -1466,19 +1631,25 @@ function resolveSwapLifecycle(inputs) {
|
|
|
1466
1631
|
if (!inputs.hasInputs) return { kind: "idle" };
|
|
1467
1632
|
const reason = setupReason(inputs);
|
|
1468
1633
|
if (reason) return inputs.setupBusy ? { kind: "checking" } : { kind: "needsSetup", reason };
|
|
1469
|
-
if (inputs.stellar.blocksAction || inputs.nearStorage.blocksAction)
|
|
1634
|
+
if (inputs.stellar.blocksAction || inputs.nearStorage.blocksAction || inputs.xrp.blocksAction) {
|
|
1635
|
+
return { kind: "checking" };
|
|
1636
|
+
}
|
|
1470
1637
|
if (inputs.isWrongChain) return { kind: "needsChainSwitch" };
|
|
1471
1638
|
if (inputs.strategy.error && !inputs.strategy.data) return { kind: "failed", error: inputs.strategy.error };
|
|
1472
1639
|
if (!inputs.strategy.data) return { kind: "checking" };
|
|
1473
1640
|
return { kind: "ready", approvalStrategy: inputs.strategy.data };
|
|
1474
1641
|
}
|
|
1475
|
-
function setupReason({ stellar, nearStorage, externalBlocked }) {
|
|
1642
|
+
function setupReason({ stellar, nearStorage, xrp, externalBlocked }) {
|
|
1476
1643
|
if (stellar.needsActivation) return "stellarActivation";
|
|
1477
1644
|
if (stellar.needsFunding) return "stellarFunding";
|
|
1478
1645
|
if (stellar.needsTrustline) return "stellarTrustline";
|
|
1479
1646
|
if (stellar.checkFailed) return "stellarCheckFailed";
|
|
1480
1647
|
if (nearStorage.needsRegistration) return "nearStorage";
|
|
1481
1648
|
if (nearStorage.checkFailed) return "nearStorageCheckFailed";
|
|
1649
|
+
if (xrp.blockedReason) return "xrpBlocked";
|
|
1650
|
+
if (xrp.needsFunding) return "xrpFunding";
|
|
1651
|
+
if (xrp.needsTrustline) return "xrpTrustline";
|
|
1652
|
+
if (xrp.checkFailed) return "xrpCheckFailed";
|
|
1482
1653
|
if (externalBlocked) return "external";
|
|
1483
1654
|
return void 0;
|
|
1484
1655
|
}
|
|
@@ -1513,7 +1684,16 @@ function useSwapLifecycle({
|
|
|
1513
1684
|
accountId: intentParams?.dstAddress,
|
|
1514
1685
|
walletProvider: dstWalletProvider
|
|
1515
1686
|
});
|
|
1516
|
-
const
|
|
1687
|
+
const xrp = useXrpGate({
|
|
1688
|
+
dstChainKey: intentParams?.dstChainKey,
|
|
1689
|
+
token: intentParams?.outputToken,
|
|
1690
|
+
address: intentParams?.dstAddress,
|
|
1691
|
+
// Sized as the SDK's check before signing sizes it, so the gate never passes a swap the SDK then refuses.
|
|
1692
|
+
amount: intentParams?.minOutputAmount,
|
|
1693
|
+
maxAmount: intentParams && intentParams.minOutputAmount * SOLVED_PAYOUT_HEADROOM_FACTOR,
|
|
1694
|
+
walletProvider: dstWalletProvider
|
|
1695
|
+
});
|
|
1696
|
+
const fetchingSetupChecks = useIsFetching({ queryKey: ["sponsoring", "stellarAccountStatus"] }) + useIsFetching({ queryKey: ["shared", "stellarTrustlineCheck"] }) + useIsFetching({ queryKey: ["shared", "nearStorageCheck"] }) + useIsFetching({ queryKey: ["shared", "xrpDestinationCheck"] }) + useIsFetching({ queryKey: ["shared", "xrpTrustlineReserveCheck"] });
|
|
1517
1697
|
const attempt = toSwapAttempt(swap, intentParams);
|
|
1518
1698
|
const broadcast = attempt.phase === "broadcast" ? attempt : void 0;
|
|
1519
1699
|
const status = useDetailedStatus({
|
|
@@ -1526,8 +1706,9 @@ function useSwapLifecycle({
|
|
|
1526
1706
|
hasInputs: !!intentParams && !!srcWalletProvider,
|
|
1527
1707
|
stellar,
|
|
1528
1708
|
nearStorage,
|
|
1709
|
+
xrp,
|
|
1529
1710
|
externalBlocked,
|
|
1530
|
-
setupBusy: stellar.isActivating || stellar.isRequestingTrustline || nearStorage.isRegistering || fetchingSetupChecks > 0,
|
|
1711
|
+
setupBusy: stellar.isActivating || stellar.isRequestingTrustline || nearStorage.isRegistering || xrp.isRequestingTrustline || fetchingSetupChecks > 0,
|
|
1531
1712
|
isWrongChain: chainSwitch?.isWrongChain ?? false,
|
|
1532
1713
|
strategy: { data: approvalStrategy.data, error: approvalStrategy.error }
|
|
1533
1714
|
});
|
|
@@ -1547,6 +1728,8 @@ function useSwapLifecycle({
|
|
|
1547
1728
|
if (state.reason === "nearStorage") return nearStorage.registerStorage();
|
|
1548
1729
|
if (state.reason === "stellarCheckFailed") stellar.retry();
|
|
1549
1730
|
if (state.reason === "nearStorageCheckFailed") nearStorage.retry();
|
|
1731
|
+
if (state.reason === "xrpTrustline") return xrp.requestTrustline();
|
|
1732
|
+
if (state.reason === "xrpCheckFailed") xrp.retry();
|
|
1550
1733
|
return void 0;
|
|
1551
1734
|
case "ready":
|
|
1552
1735
|
if (!intentParams || !srcWalletProvider) return void 0;
|
|
@@ -1592,7 +1775,8 @@ function useSwapLifecycle({
|
|
|
1592
1775
|
swap,
|
|
1593
1776
|
status,
|
|
1594
1777
|
stellar,
|
|
1595
|
-
nearStorage
|
|
1778
|
+
nearStorage,
|
|
1779
|
+
xrp
|
|
1596
1780
|
};
|
|
1597
1781
|
}
|
|
1598
1782
|
|
|
@@ -5337,4 +5521,4 @@ function createSodaxQueryClient({
|
|
|
5337
5521
|
});
|
|
5338
5522
|
}
|
|
5339
5523
|
|
|
5340
|
-
export { SodaxProvider, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getBalancesQueryOptions, getBridgeDetailedStatusRefetchInterval, getLeverageYieldQuoteQueryOptions, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getSwapQuoteQueryOptions, getXBalancesQueryOptions, invalidateBalances, isBridgeMpcRelayRead, isBridgeNotDelivered, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, retryUnlessAuthFailure, runApprovalPlan, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveLeveragePositionFunding, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOracleCandles, useBackendOracleMarkets, useBackendOrderbook, useBackendUserIntents, useBalances, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApiAllowance, useBridgeApiApprove, useBridgeApiApproveAndBroadcast, useBridgeApiBridgeableAmount, useBridgeApiCreateBridgeIntent, useBridgeApiFee, useBridgeApiIsBridgeable, useBridgeApiSubmitTx, useBridgeApiSubmitTxStatus, useBridgeApiTokens, useBridgeApiTokensByChain, useBridgeApprovalStrategy, useBridgeApprove, useBridgeDetailedStatus, useBridgeWithApproval, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDetailedStatus, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEModes, useEnsureRadfiAccessToken, useEstablishTrustline, useEstimateGas, useExpiredUtxos, useFeeClaimSwap, useFeeClaimWithdraw, useFetchAssetsBalances, useFundTradingWallet, useGetAutoSwapPreferences, useGetBridgeableAmount, useGetBridgeableTokens, useGetIntentDetails, useGetUserHubWalletAddress, useGetUserIntent, useHubAssetBalances, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useIsTokenApproved, useLeveragePositionAccount, useLeveragePositionCollateral, useLeveragePositionFundingAllowance, useLeveragePositionInfo, useLeveragePositionPayoutAddress, useLeveragePositionPending, useLeveragePositions, useLeveragePositionsForUser, useLeverageYieldApiAllowance, useLeverageYieldApiApprove, useLeverageYieldApiApproveAndBroadcast, useLeverageYieldApiApr, useLeverageYieldApiAsset, useLeverageYieldApiCancelIntent, useLeverageYieldApiCreateDepositIntent, useLeverageYieldApiCreateWithdrawIntent, useLeverageYieldApiDeadline, useLeverageYieldApiDepositQuote, useLeverageYieldApiEffectiveApr, useLeverageYieldApiEstimateGas, useLeverageYieldApiFilledIntent, useLeverageYieldApiIntent, useLeverageYieldApiIntentExtraData, useLeverageYieldApiIntentHash, useLeverageYieldApiIntentPacket, useLeverageYieldApiLsdApr, useLeverageYieldApiMaxWithdraw, useLeverageYieldApiPartnerFee, useLeverageYieldApiPosition, useLeverageYieldApiPreviewDeposit, useLeverageYieldApiPreviewRedeem, useLeverageYieldApiPreviewWithdraw, useLeverageYieldApiShareBalance, useLeverageYieldApiSolverFee, useLeverageYieldApiStatus, useLeverageYieldApiSubmitIntent, useLeverageYieldApiSubmitTx, useLeverageYieldApiSubmitTxStatus, useLeverageYieldApiTotalAssets, useLeverageYieldApiVault, useLeverageYieldApiVaults, useLeverageYieldApiWithdrawQuote, useLeverageYieldApprovalStrategy, useLeverageYieldDeposit, useLeverageYieldDetailedStatus, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, useLeverageYieldQuote, useLeverageYieldShareBalances, useLeverageYieldTotalAssets, useLeverageYieldVaultSwap, useLeverageYieldVaultSwapWithApproval, useLeverageYieldWithdraw, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrateBaln, useMigrateIcxToSoda, useMigratebnUSD, useMigrationAllowance, useMigrationApprove, useNearStorageCheck, useNearStorageGate, useOpenLeveragePosition, usePartnerCancelIntent, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRegisterNearStorage, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesHumanized, useReservesList, useReservesUsdFormat, useRevertMigrateSodaToIcx, useRunLeveragePositionOperation, useSafeMutation, useSetSwapPreference, useSodaxContext, useSponsorConfig, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarAccountActive, useStellarAccountStatus, useStellarGate, useStellarTrustlineCheck, useSubmitLeveragePositionIntent, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprovalStrategy, useSwapApprove, useSwapLifecycle, useSwapWithApproval, useSwapsApiAllowance, useSwapsApiApprove, useSwapsApiApproveAndBroadcast, useSwapsApiBroadcastWithApproval, useSwapsApiCancelIntent, useSwapsApiCreateIntent, useSwapsApiCreateLimitOrder, useSwapsApiDeadline, useSwapsApiEstimateGas, useSwapsApiFilledIntent, useSwapsApiIntent, useSwapsApiIntentExtraData, useSwapsApiIntentHash, useSwapsApiIntentPacket, useSwapsApiPartnerFee, useSwapsApiQuote, useSwapsApiSolverFee, useSwapsApiStatus, useSwapsApiSubmitIntent, useSwapsApiSubmitTx, useSwapsApiSubmitTxStatus, useSwapsApiTokens, useSwapsApiTokensByChain, useTradingWallet, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw, useWithdrawHubAsset, useXBalances };
|
|
5524
|
+
export { SodaxProvider, 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 };
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "2.4.0-rc.
|
|
8
|
+
"version": "2.4.0-rc.2",
|
|
9
9
|
"description": "React hooks for building dApps on the SODAX cross-chain DeFi platform",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"sodax",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"viem": "2.29.2",
|
|
42
|
-
"@sodax/sdk": "2.4.0-rc.
|
|
42
|
+
"@sodax/sdk": "2.4.0-rc.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@arethetypeswrong/cli": "0.17.4",
|
|
@@ -60,6 +60,7 @@ const HOOKS: Array<{ path: string; nativeThrow?: true }> = [
|
|
|
60
60
|
{ path: 'partner/useSetSwapPreference.ts' },
|
|
61
61
|
{ path: 'recovery/useWithdrawHubAsset.ts' },
|
|
62
62
|
{ path: 'shared/useEstablishTrustline.ts', nativeThrow: true },
|
|
63
|
+
{ path: 'shared/useEstablishXrpTrustline.ts' },
|
|
63
64
|
{ path: 'shared/useEstimateGas.ts' },
|
|
64
65
|
{ path: 'shared/useRegisterNearStorage.ts', nativeThrow: true },
|
|
65
66
|
{ path: 'sponsoring/useActivateStellarAccount.ts' },
|
|
@@ -13,6 +13,10 @@ export * from './useNearStorageCheck.js';
|
|
|
13
13
|
export * from './useRegisterNearStorage.js';
|
|
14
14
|
export * from './useNearStorageGate.js';
|
|
15
15
|
export * from './useStellarGate.js';
|
|
16
|
+
export * from './useXrpDestinationCheck.js';
|
|
17
|
+
export * from './useXrpTrustlineReserveCheck.js';
|
|
18
|
+
export * from './useEstablishXrpTrustline.js';
|
|
19
|
+
export * from './useXrpGate.js';
|
|
16
20
|
export * from './useGetUserHubWalletAddress.js';
|
|
17
21
|
export * from './useXBalances.js';
|
|
18
22
|
export * from './useBalances.js';
|