@sodax/dapp-kit 2.0.0-rc.2 → 2.0.0-rc.20

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.
Files changed (129) hide show
  1. package/README.md +29 -74
  2. package/dist/index.d.ts +780 -58
  3. package/dist/index.mjs +841 -143
  4. package/package.json +31 -19
  5. package/src/hooks/_mutationContract.test.ts +15 -2
  6. package/src/hooks/backend/index.ts +1 -5
  7. package/src/hooks/bitcoin/index.ts +2 -0
  8. package/src/hooks/bitcoin/resolveBtcReadAddress.test.ts +54 -0
  9. package/src/hooks/bitcoin/resolveBtcReadAddress.ts +21 -0
  10. package/src/hooks/bitcoin/useBitcoinTradingSetup.ts +45 -0
  11. package/src/hooks/bitcoin/useEnsureRadfiAccessToken.ts +57 -0
  12. package/src/hooks/bitcoin/useFundTradingWallet.ts +1 -1
  13. package/src/hooks/bitcoin/useRadfiAuth.ts +2 -2
  14. package/src/hooks/bitcoin/useRadfiWithdraw.ts +2 -2
  15. package/src/hooks/bitcoin/useRenewUtxos.ts +2 -2
  16. package/src/hooks/bitcoin/useTradingWallet.ts +1 -1
  17. package/src/hooks/index.ts +2 -0
  18. package/src/hooks/leverageYield/index.ts +9 -0
  19. package/src/hooks/leverageYield/useLeverageYieldDeposit.ts +40 -0
  20. package/src/hooks/leverageYield/useLeverageYieldEffectiveApr.ts +42 -0
  21. package/src/hooks/leverageYield/useLeverageYieldNotifySolver.ts +34 -0
  22. package/src/hooks/leverageYield/useLeverageYieldPosition.ts +40 -0
  23. package/src/hooks/leverageYield/useLeverageYieldPreviewRedeem.ts +43 -0
  24. package/src/hooks/leverageYield/useLeverageYieldShareBalances.ts +74 -0
  25. package/src/hooks/leverageYield/useLeverageYieldTotalAssets.ts +36 -0
  26. package/src/hooks/leverageYield/useLeverageYieldVaultSwap.ts +50 -0
  27. package/src/hooks/leverageYield/useLeverageYieldWithdraw.ts +40 -0
  28. package/src/hooks/mm/useATokensBalances.ts +7 -1
  29. package/src/hooks/mm/useUserFormattedSummary.ts +5 -1
  30. package/src/hooks/mm/useUserReservesData.ts +5 -1
  31. package/src/hooks/partner/index.ts +4 -0
  32. package/src/hooks/partner/useFeeClaimWithdraw.ts +88 -0
  33. package/src/hooks/partner/useGetIntentDetails.ts +39 -0
  34. package/src/hooks/partner/useGetUserIntent.ts +35 -0
  35. package/src/hooks/partner/usePartnerCancelIntent.ts +52 -0
  36. package/src/hooks/shared/index.ts +4 -0
  37. package/src/hooks/shared/isUserRejectedError.test.ts +42 -0
  38. package/src/hooks/shared/isUserRejectedError.ts +30 -0
  39. package/src/hooks/shared/useGetUserHubWalletAddress.ts +5 -1
  40. package/src/hooks/shared/useNearStorageCheck.ts +45 -0
  41. package/src/hooks/shared/useNearStorageGate.ts +60 -0
  42. package/src/hooks/shared/useRegisterNearStorage.ts +46 -0
  43. package/src/hooks/swapsApi/index.ts +41 -0
  44. package/src/hooks/swapsApi/isTerminalSwapIntentStatus.test.ts +24 -0
  45. package/src/hooks/swapsApi/isTerminalSwapIntentStatus.ts +11 -0
  46. package/src/hooks/swapsApi/useSwapsApiAllowance.ts +40 -0
  47. package/src/hooks/swapsApi/useSwapsApiApprove.ts +42 -0
  48. package/src/hooks/swapsApi/useSwapsApiCancelIntent.ts +41 -0
  49. package/src/hooks/swapsApi/useSwapsApiCreateIntent.ts +41 -0
  50. package/src/hooks/swapsApi/useSwapsApiCreateLimitOrder.ts +41 -0
  51. package/src/hooks/swapsApi/useSwapsApiDeadline.ts +36 -0
  52. package/src/hooks/swapsApi/useSwapsApiEstimateGas.ts +40 -0
  53. package/src/hooks/swapsApi/useSwapsApiFilledIntent.ts +41 -0
  54. package/src/hooks/swapsApi/useSwapsApiIntent.ts +40 -0
  55. package/src/hooks/swapsApi/useSwapsApiIntentExtraData.ts +41 -0
  56. package/src/hooks/swapsApi/useSwapsApiIntentHash.ts +40 -0
  57. package/src/hooks/swapsApi/useSwapsApiIntentPacket.ts +43 -0
  58. package/src/hooks/swapsApi/useSwapsApiPartnerFee.ts +40 -0
  59. package/src/hooks/swapsApi/useSwapsApiQuote.ts +55 -0
  60. package/src/hooks/swapsApi/useSwapsApiSolverFee.ts +40 -0
  61. package/src/hooks/swapsApi/useSwapsApiStatus.ts +45 -0
  62. package/src/hooks/swapsApi/useSwapsApiSubmitIntent.ts +43 -0
  63. package/src/hooks/{backend/useBackendSubmitSwapTx.ts → swapsApi/useSwapsApiSubmitTx.ts} +16 -17
  64. package/src/hooks/swapsApi/useSwapsApiSubmitTxStatus.ts +55 -0
  65. package/src/hooks/swapsApi/useSwapsApiTokens.ts +34 -0
  66. package/src/hooks/swapsApi/useSwapsApiTokensByChain.ts +40 -0
  67. package/src/providers/SodaxProvider.tsx +17 -14
  68. package/src/utils/index.ts +1 -0
  69. package/src/utils/nearStorageGate.test.ts +46 -0
  70. package/src/utils/nearStorageGate.ts +39 -0
  71. package/ai-exported/AGENTS.md +0 -134
  72. package/ai-exported/integration/README.md +0 -49
  73. package/ai-exported/integration/ai-rules.md +0 -79
  74. package/ai-exported/integration/architecture.md +0 -274
  75. package/ai-exported/integration/features/README.md +0 -29
  76. package/ai-exported/integration/features/auxiliary-services.md +0 -169
  77. package/ai-exported/integration/features/bitcoin.md +0 -87
  78. package/ai-exported/integration/features/bridge.md +0 -91
  79. package/ai-exported/integration/features/dex.md +0 -152
  80. package/ai-exported/integration/features/migration.md +0 -118
  81. package/ai-exported/integration/features/money-market.md +0 -116
  82. package/ai-exported/integration/features/staking.md +0 -123
  83. package/ai-exported/integration/features/swap.md +0 -101
  84. package/ai-exported/integration/quickstart.md +0 -187
  85. package/ai-exported/integration/recipes/README.md +0 -136
  86. package/ai-exported/integration/recipes/backend-queries.md +0 -157
  87. package/ai-exported/integration/recipes/bitcoin.md +0 -193
  88. package/ai-exported/integration/recipes/bridge.md +0 -174
  89. package/ai-exported/integration/recipes/dex.md +0 -204
  90. package/ai-exported/integration/recipes/invalidations.md +0 -115
  91. package/ai-exported/integration/recipes/migration.md +0 -212
  92. package/ai-exported/integration/recipes/money-market.md +0 -206
  93. package/ai-exported/integration/recipes/mutation-error-handling.md +0 -118
  94. package/ai-exported/integration/recipes/observability.md +0 -93
  95. package/ai-exported/integration/recipes/setup.md +0 -144
  96. package/ai-exported/integration/recipes/staking.md +0 -202
  97. package/ai-exported/integration/recipes/swap.md +0 -272
  98. package/ai-exported/integration/recipes/wallet-connectivity.md +0 -101
  99. package/ai-exported/integration/reference/README.md +0 -12
  100. package/ai-exported/integration/reference/glossary.md +0 -188
  101. package/ai-exported/integration/reference/hooks-index.md +0 -190
  102. package/ai-exported/integration/reference/public-api.md +0 -110
  103. package/ai-exported/integration/reference/querykey-conventions.md +0 -179
  104. package/ai-exported/migration/README.md +0 -60
  105. package/ai-exported/migration/ai-rules.md +0 -81
  106. package/ai-exported/migration/breaking-changes/hook-signatures.md +0 -233
  107. package/ai-exported/migration/breaking-changes/querykey-conventions.md +0 -108
  108. package/ai-exported/migration/breaking-changes/result-handling.md +0 -211
  109. package/ai-exported/migration/breaking-changes/sdk-leakage.md +0 -165
  110. package/ai-exported/migration/checklist.md +0 -89
  111. package/ai-exported/migration/features/README.md +0 -34
  112. package/ai-exported/migration/features/auxiliary-services.md +0 -114
  113. package/ai-exported/migration/features/bitcoin.md +0 -88
  114. package/ai-exported/migration/features/bridge.md +0 -123
  115. package/ai-exported/migration/features/dex.md +0 -101
  116. package/ai-exported/migration/features/migration.md +0 -120
  117. package/ai-exported/migration/features/money-market.md +0 -97
  118. package/ai-exported/migration/features/staking.md +0 -109
  119. package/ai-exported/migration/features/swap.md +0 -118
  120. package/ai-exported/migration/recipes.md +0 -188
  121. package/ai-exported/migration/reference/README.md +0 -15
  122. package/ai-exported/migration/reference/deleted-hooks.md +0 -110
  123. package/ai-exported/migration/reference/error-shape-crosswalk.md +0 -144
  124. package/ai-exported/migration/reference/renamed-hooks.md +0 -66
  125. package/dist/index.cjs +0 -2642
  126. package/dist/index.cjs.map +0 -1
  127. package/dist/index.d.cts +0 -1550
  128. package/dist/index.mjs.map +0 -1
  129. package/src/hooks/backend/useBackendSubmitSwapTxStatus.ts +0 -59
package/dist/index.d.ts CHANGED
@@ -1,9 +1,36 @@
1
- import { UseQueryOptions, UseMutationOptions, UseMutationResult, MutateOptions, UseQueryResult, QueryClientConfig, QueryClient } from '@tanstack/react-query';
2
- import { Result, Sodax, SpokeChainKey, GetEstimateGasReturnType, EstimateGasParams, IStellarWalletProvider, StellarChainKey, IXServiceBase, XToken, EvmHubProvider, IBitcoinWalletProvider, RadfiWalletBalance, RadfiUtxo, MoneyMarketBorrowActionParams, TxHashPair, MoneyMarketRepayActionParams, MoneyMarketSupplyActionParams, MoneyMarketWithdrawActionParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, ReservesDataHumanized, Address as Address$1, MoneyMarketParams, MoneyMarketApproveActionParams, TxReturnType, Erc20Token, ChainKey, ReserveDataHumanized, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentQuoteRequest, SwapActionParams, SwapResponse, SolverIntentStatusResponse, Hex, CreateIntentParams, CreateLimitOrderParams, GetWalletProviderType, Intent, LimitOrderActionParams, IntentResponse, UserIntentsResponse, SubmitSwapTxResponse, SubmitSwapTxRequest, RequestOverrideConfig, SubmitSwapTxStatusResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, BridgeParams, CreateBridgeIntentParams, BridgeLimit, StakeAction, StakeParams, UnstakeAction, ClaimAction, CancelUnstakeAction, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeAction, UnstakeParams, InstantUnstakeParams, PartnerFeeClaimAssetBalance, AutoSwapPreferences, FeeTokenApproveParams, FeeTokenApproveAction, HubChainKey, SetSwapPreferenceAction, PartnerFeeClaimSwapAction, IntentAutoSwapResult, HubAssetBalance, WithdrawHubAssetAction, IcxMigrateAction, IcxRevertMigrationAction, UnifiedBnUSDMigrateAction, BalnMigrateAction, MigrationAction, IcxMigrateParams, IcxCreateRevertMigrationParams, UnifiedBnUSDMigrateParams, BalnMigrateParams, PoolKey, PoolData, ClPositionInfo, AssetDepositAction, AssetWithdrawAction, CreateAssetDepositParams, ClSupplyParams, ClIncreaseLiquidityParams, ClLiquidityDecreaseLiquidityAction, ClDecreaseLiquidityParams, CreateAssetWithdrawParams, PoolSpokeAssets, DestinationParamsType, ClLiquidityClaimRewardsAction, DeepPartial, SodaxConfig } from '@sodax/sdk';
1
+ import { UseMutationOptions, UseQueryOptions, UseMutationResult, MutateOptions, UseQueryResult, QueryClientConfig, QueryClient } from '@tanstack/react-query';
2
+ import { Result, Sodax, SpokeChainKey, GetEstimateGasReturnType, EstimateGasParams, IStellarWalletProvider, StellarChainKey, INearWalletProvider, GetWalletProviderType, IXServiceBase, XToken, EvmHubProvider, IBitcoinWalletProvider, RadfiWalletBalance, IWalletProvider, RadfiUtxo, MoneyMarketBorrowActionParams, TxHashPair, MoneyMarketRepayActionParams, MoneyMarketSupplyActionParams, MoneyMarketWithdrawActionParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, ReservesDataHumanized, Address as Address$1, MoneyMarketParams, MoneyMarketApproveActionParams, TxReturnType, Erc20Token, ChainKey, ReserveDataHumanized, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentQuoteRequest, SwapActionParams, SwapResponse, SolverIntentStatusResponse, Hex, CreateIntentParams, CreateLimitOrderParams, Intent, LimitOrderActionParams, IntentResponse, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, GetSwapTokensResponseV2, RequestOverrideConfig, GetSwapTokensByChainResponseV2, QuoteResponseV2, QuoteRequestV2, QuoteQueryV2, DeadlineResponseV2, DeadlineQueryV2, AllowanceCheckResponseV2, CreateIntentParamsV2, ApproveResponseV2, CreateIntentResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, StatusResponseV2, SwapIntentStatusCodeV2, CancelIntentRequestV2, CancelIntentResponseV2, IntentHashResponseV2, IntentRequestV2, IntentPacketResponseV2, IntentPacketRequestV2, IntentExtraDataResponseV2, IntentExtraDataRequestV2, IntentStateV2, GetIntentResponseV2, CreateLimitOrderParamsV2, CreateLimitOrderResponseV2, GasEstimateResponseV2, GasEstimateRequestV2, FeeResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusResponseV2, BridgeParams, CreateBridgeIntentParams, BridgeLimit, StakeAction, StakeParams, UnstakeAction, ClaimAction, CancelUnstakeAction, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeAction, UnstakeParams, InstantUnstakeParams, PartnerFeeClaimAssetBalance, AutoSwapPreferences, FeeTokenApproveParams, FeeTokenApproveAction, HubChainKey, SetSwapPreferenceAction, PartnerFeeClaimSwapAction, IntentAutoSwapResult, PartnerFeeClaimCancelAction, GetUserIntentParams, HubAssetBalance, WithdrawHubAssetAction, IcxMigrateAction, IcxRevertMigrationAction, UnifiedBnUSDMigrateAction, BalnMigrateAction, MigrationAction, IcxMigrateParams, IcxCreateRevertMigrationParams, UnifiedBnUSDMigrateParams, BalnMigrateParams, PoolKey, PoolData, ClPositionInfo, AssetDepositAction, AssetWithdrawAction, CreateAssetDepositParams, ClSupplyParams, ClIncreaseLiquidityParams, ClLiquidityDecreaseLiquidityAction, ClDecreaseLiquidityParams, CreateAssetWithdrawParams, PoolSpokeAssets, DestinationParamsType, ClLiquidityClaimRewardsAction, LeverageYieldEffectiveApr, LeverageYieldPosition, LeverageYieldSwapDepositParams, LeverageYieldSwapPayload, SolverExecutionRequest, SolverExecutionResponse, VaultSwapActionParams, VaultSwapResponse, LeverageYieldSwapWithdrawParams, SodaxOptions } from '@sodax/sdk';
3
3
  export * from '@sodax/sdk';
4
4
  import { Address } from 'viem';
5
5
  import { ReactNode, ReactElement } from 'react';
6
6
 
7
+ /**
8
+ * Predicate for the canonical "user cancelled the wallet prompt" outcome.
9
+ *
10
+ * The SDK classifies wallet rejection at the source: `intentCreationFailed` / `approveFailed`
11
+ * wrappers emit `SodaxError<'USER_REJECTED'>` whenever the underlying cause matches a known
12
+ * rejection shape (viem `4001` / `UserRejectedRequestError`, ICON Hana `CANCEL_SIGNING`,
13
+ * Solana / Sui / Stellar / Stacks / NEAR / Injective name + message patterns). Consumers
14
+ * branch on this code to render a "Cancelled" UI instead of a "Failed" toast — user
15
+ * cancellation is a normal flow, not a failure.
16
+ *
17
+ * Use after `mutateAsyncSafe` (or inside an `onError` / `catch`):
18
+ *
19
+ * ```ts
20
+ * const result = await swap.mutateAsyncSafe({ params, walletProvider });
21
+ * if (!result.ok) {
22
+ * if (isUserRejectedError(result.error)) return; // silent — user cancelled
23
+ * toast.error(getErrorMessage(result.error)); // real failure
24
+ * }
25
+ * ```
26
+ *
27
+ * The check trusts the SDK's classification — it does NOT re-scan message content. Errors
28
+ * raised outside the SDK boundary (e.g. a non-SodaxError thrown from a `queryFn`) will not
29
+ * match, which is intentional: only the SDK's `USER_REJECTED` is the canonical "cancelled"
30
+ * signal.
31
+ */
32
+ declare function isUserRejectedError(error: unknown): boolean;
33
+
7
34
  /**
8
35
  * Subset of `UseQueryOptions` consumers may override on dapp-kit read hooks.
9
36
  *
@@ -151,6 +178,72 @@ declare function useRequestTrustline(token: string | undefined): {
151
178
  data: string | null;
152
179
  };
153
180
 
181
+ type UseNearStorageCheckParams = ReadHookParams<boolean, {
182
+ token: string | undefined;
183
+ accountId: string | undefined;
184
+ chainId: SpokeChainKey | undefined;
185
+ }>;
186
+ /**
187
+ * Whether `accountId` is NEP-141 storage-registered for `token` on NEAR — the receive-side
188
+ * prerequisite for any leg that delivers a token to the user on NEAR (swap output on NEAR, bridge
189
+ * into NEAR, money-market borrow/withdraw to NEAR). NEAR's analogue of a Stellar trustline.
190
+ *
191
+ * Returns `true` (no gate) when `chainId` is not NEAR, mirroring how the Stellar trustline check
192
+ * short-circuits off-chain. Native NEAR is not a NEP-141 token, so the SDK reports it as registered.
193
+ *
194
+ * Pair with {@link useRegisterNearStorage} to perform the one-time `storage_deposit` when this
195
+ * resolves to `false`.
196
+ */
197
+ declare function useNearStorageCheck({ params, queryOptions, }?: UseNearStorageCheckParams): UseQueryResult<boolean, Error>;
198
+
199
+ type UseRegisterNearStorageVars = {
200
+ token: string;
201
+ accountId: string;
202
+ walletProvider: INearWalletProvider;
203
+ /** Storage bond override; defaults to the SDK's `NEAR_STORAGE_DEPOSIT` (0.00125 NEAR). */
204
+ deposit?: bigint;
205
+ };
206
+ /**
207
+ * Submit a NEP-141 `storage_deposit` so `accountId` can receive `token` on NEAR. NEAR's analogue of
208
+ * requesting a Stellar trustline; pair with {@link useNearStorageCheck} and call this when the check
209
+ * resolves to `false`. The recipient's NEAR wallet signs the registration tx.
210
+ *
211
+ * Pure mutation: pass `{ token, accountId, walletProvider }` to `mutate(...)`. The hook itself only
212
+ * takes the structural `mutationOptions` slot. `registerStorage` throws natively (no `Result<T>`),
213
+ * so this hook is registered as `nativeThrow` in the mutation contract. On success it invalidates
214
+ * the matching {@link useNearStorageCheck} query.
215
+ */
216
+ declare function useRegisterNearStorage({ mutationOptions, }?: MutationHookParams<string, UseRegisterNearStorageVars>): SafeUseMutationResult<string, Error, UseRegisterNearStorageVars>;
217
+
218
+ interface UseNearStorageGateParams {
219
+ /** Destination chain the token is delivered on. */
220
+ dstChainKey: SpokeChainKey;
221
+ /** Destination token address the recipient must be registered for. */
222
+ token: string | undefined;
223
+ /** Recipient NEAR account id. */
224
+ accountId: string | undefined;
225
+ /** Destination wallet provider; only consumed when it is the NEAR provider. */
226
+ walletProvider: GetWalletProviderType<SpokeChainKey> | undefined;
227
+ }
228
+ interface NearStorageGate {
229
+ /** Destination is NEAR. */
230
+ isNear: boolean;
231
+ /** Destination is NEAR and the recipient is not yet storage-registered for `token`. */
232
+ needsRegistration: boolean;
233
+ /** The downstream action must stay disabled while the gate is unresolved or unmet. */
234
+ blocksAction: boolean;
235
+ /** The registration-status query is actively fetching. */
236
+ isChecking: boolean;
237
+ /** A `storage_deposit` tx is in flight. */
238
+ isRegistering: boolean;
239
+ /** Submit the `storage_deposit`; resolves to the SDK `Result` or `undefined` if inputs are missing. */
240
+ registerStorage: () => Promise<Result<string> | undefined>;
241
+ }
242
+ /**
243
+ * NEP-141 storage-registration gate for flows that deliver a token to a user on NEAR.
244
+ */
245
+ declare function useNearStorageGate({ dstChainKey, token, accountId, walletProvider, }: UseNearStorageGateParams): NearStorageGate;
246
+
154
247
  type UseGetUserHubWalletAddressParams = ReadHookParams<Address, {
155
248
  spokeChainId?: SpokeChainKey;
156
249
  spokeAddress?: string;
@@ -191,7 +284,7 @@ type UseXBalancesParams = ReadHookParams<Record<string, bigint>, XBalancesInputs
191
284
  * tests and for advanced callers that compose their own `useQuery` wrapper.
192
285
  */
193
286
  declare function getXBalancesQueryOptions({ xService, xChainId, xTokens, address }: XBalancesInputs): {
194
- queryKey: readonly ["shared", "xBalances", "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | undefined, (readonly [string, string])[], string | undefined];
287
+ queryKey: readonly ["shared", "xBalances", "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera" | undefined, (readonly [string, string])[], string | undefined];
195
288
  queryFn: () => Promise<Record<string, bigint>>;
196
289
  enabled: boolean;
197
290
  refetchInterval: number;
@@ -228,12 +321,32 @@ declare function saveRadfiSession(address: string, session: RadfiSession): void;
228
321
  declare function loadRadfiSession(address: string): RadfiSession | null;
229
322
  declare function clearRadfiSession(address: string): void;
230
323
  /**
231
- * React hook for authenticating with Radfi via BIP322-signed message. Pure mutation: pass
324
+ * React hook for authenticating with Bound Exchange via BIP322-signed message. Pure mutation: pass
232
325
  * `{ walletProvider }` to `mutate({...})`. The hook itself takes no arguments other than the
233
326
  * structural `mutationOptions` slot.
234
327
  */
235
328
  declare function useRadfiAuth({ mutationOptions, }?: MutationHookParams<RadfiAuthResult, UseRadfiAuthVars>): SafeUseMutationResult<RadfiAuthResult, Error, UseRadfiAuthVars>;
236
329
 
330
+ type UseEnsureRadfiAccessTokenVars = {
331
+ walletProvider: IBitcoinWalletProvider;
332
+ };
333
+ /**
334
+ * Ensure a valid Bound Exchange access token and return it. Refreshes the existing token (no
335
+ * signature prompt) when a refresh token is available, falling back to a full BIP322 re-auth only if
336
+ * refresh fails. Bound tokens are short-lived, so call this right before a Bitcoin-source
337
+ * createIntent — forward the returned token via the typed `extras.bound.accessToken` slot (SDK in-process)
338
+ * or the `accessToken` body field on the backend DTO — or before the client-side sign + co-sign step.
339
+ *
340
+ * @example
341
+ * const { mutateAsync: ensureToken } = useEnsureRadfiAccessToken();
342
+ * const accessToken = await ensureToken({ walletProvider });
343
+ * // SDK in-process (Bitcoin-gated extras):
344
+ * await sodax.swaps.createIntent({ params, extras: { bound: { accessToken } }, raw: true });
345
+ * // or backend createIntent — token in the body, not an x-bound-access-token header:
346
+ * await createIntent({ body: { ...body, accessToken } });
347
+ */
348
+ declare function useEnsureRadfiAccessToken({ mutationOptions, }?: MutationHookParams<string, UseEnsureRadfiAccessTokenVars>): SafeUseMutationResult<string, Error, UseEnsureRadfiAccessTokenVars>;
349
+
237
350
  type UseRadfiSessionReturn = {
238
351
  walletAddress: string | undefined;
239
352
  isAuthed: boolean;
@@ -248,7 +361,7 @@ type UseFundTradingWalletVars = {
248
361
  walletProvider: IBitcoinWalletProvider;
249
362
  };
250
363
  /**
251
- * React hook for funding the user's Radfi trading wallet from their personal Bitcoin wallet.
364
+ * React hook for funding the user's Bound Exchange trading wallet from their personal Bitcoin wallet.
252
365
  * Pure mutation: pass `{ amount, walletProvider }` to `mutate({...})`. Returns the broadcast tx
253
366
  * id on success.
254
367
  */
@@ -271,7 +384,7 @@ type UseTradingWalletReturn = {
271
384
  tradingAddress: string | undefined;
272
385
  };
273
386
  /**
274
- * Returns the Radfi trading wallet address from the persisted session.
387
+ * Returns the Bound Exchange trading wallet address from the persisted session.
275
388
  * Trading wallet is created automatically during authentication — no API call needed.
276
389
  */
277
390
  declare function useTradingWallet(walletAddress: string | undefined): UseTradingWalletReturn;
@@ -282,6 +395,23 @@ type UseTradingWalletBalanceParams = ReadHookParams<RadfiWalletBalance, {
282
395
  }>;
283
396
  declare function useTradingWalletBalance({ params, queryOptions, }?: UseTradingWalletBalanceParams): UseQueryResult<RadfiWalletBalance, Error>;
284
397
 
398
+ interface UseBitcoinTradingSetupParams {
399
+ chainKey: SpokeChainKey;
400
+ /** This side's wallet provider + account, e.g. `useWalletProvider` / `useXAccount`. */
401
+ walletProvider: IWalletProvider | undefined;
402
+ address: string | undefined;
403
+ }
404
+ interface BitcoinTradingSetup {
405
+ wallet: IBitcoinWalletProvider | undefined;
406
+ tradingBalance: RadfiWalletBalance | undefined;
407
+ }
408
+ /**
409
+ * Bitcoin trading-wallet setup for one side of a cross-chain flow: Bitcoin funds move through a
410
+ * Bound Exchange (Radfi) trading wallet, not the personal wallet. Inert (no work) unless `chainKey`
411
+ * is Bitcoin. Wallet-layer inputs are passed in — this package doesn't depend on wallet-sdk-react.
412
+ */
413
+ declare function useBitcoinTradingSetup({ chainKey, walletProvider, address, }: UseBitcoinTradingSetupParams): BitcoinTradingSetup;
414
+
285
415
  type UseExpiredUtxosParams = ReadHookParams<RadfiUtxo[], {
286
416
  walletProvider: IBitcoinWalletProvider | undefined;
287
417
  tradingAddress: string | undefined;
@@ -293,7 +423,7 @@ type UseRenewUtxosVars = {
293
423
  walletProvider: IBitcoinWalletProvider;
294
424
  };
295
425
  /**
296
- * React hook for renewing expired UTXOs in the user's Radfi trading wallet. Pure mutation: pass
426
+ * React hook for renewing expired UTXOs in the user's Bound Exchange trading wallet. Pure mutation: pass
297
427
  * `{ txIdVouts, walletProvider }` to `mutate({...})`.
298
428
  */
299
429
  declare function useRenewUtxos({ mutationOptions, }?: MutationHookParams<string, UseRenewUtxosVars>): SafeUseMutationResult<string, Error, UseRenewUtxosVars>;
@@ -309,7 +439,7 @@ type WithdrawResult = {
309
439
  fee: number;
310
440
  };
311
441
  /**
312
- * React hook for withdrawing BTC from the user's Radfi trading wallet back to their personal
442
+ * React hook for withdrawing BTC from the user's Bound Exchange trading wallet back to their personal
313
443
  * Bitcoin wallet. Pure mutation: pass all inputs (including the wallet provider) to
314
444
  * `mutate({...})`.
315
445
  */
@@ -649,50 +779,6 @@ type UseBackendUserIntentsParams = ReadHookParams<UserIntentsResponse | undefine
649
779
  */
650
780
  declare const useBackendUserIntents: ({ params, queryOptions, }?: UseBackendUserIntentsParams) => UseQueryResult<UserIntentsResponse | undefined, Error>;
651
781
 
652
- /**
653
- * Mutation variables for {@link useBackendSubmitSwapTx}. The per-request `apiConfig` override
654
- * (e.g. base URL) belongs here rather than at the hook level — different submissions in the same
655
- * component can target different endpoints without re-rendering.
656
- */
657
- type UseBackendSubmitSwapTxVars = {
658
- request: SubmitSwapTxRequest;
659
- apiConfig?: RequestOverrideConfig;
660
- };
661
- /**
662
- * React hook for submitting a swap transaction to be processed by the backend (relay, post
663
- * execution to solver, etc.).
664
- *
665
- * Pure mutation: pass `{ request, apiConfig? }` to `mutate({...})`. Default `retry: 3` is applied
666
- * at the hook level — consumers can override via `mutationOptions.retry`.
667
- *
668
- * @example
669
- * const { mutateAsync: submitSwapTx, isPending, error } = useBackendSubmitSwapTx();
670
- *
671
- * const result = await submitSwapTx({
672
- * request: { txHash: '0x123...', srcChainKey: 'sonic', walletAddress: '0xabc...', intent: { ... }, relayData: '0x...' },
673
- * apiConfig: { baseURL: 'https://...' },
674
- * });
675
- */
676
- declare const useBackendSubmitSwapTx: ({ mutationOptions, }?: MutationHookParams<SubmitSwapTxResponse, UseBackendSubmitSwapTxVars>) => SafeUseMutationResult<SubmitSwapTxResponse, Error, UseBackendSubmitSwapTxVars>;
677
-
678
- type UseBackendSubmitSwapTxStatusParams = ReadHookParams<SubmitSwapTxStatusResponse | undefined, {
679
- txHash: string | undefined;
680
- srcChainKey?: string;
681
- apiConfig?: RequestOverrideConfig;
682
- }>;
683
- /**
684
- * React hook for polling the processing status of a submitted swap transaction.
685
- *
686
- * @example
687
- * const { data: status } = useBackendSubmitSwapTxStatus({
688
- * params: { txHash: '0x123...', srcChainKey: 'sonic' },
689
- * });
690
- *
691
- * @remarks
692
- * - Default refetch interval is 1 second; stops on 'executed' or 'failed' status.
693
- */
694
- declare const useBackendSubmitSwapTxStatus: ({ params, queryOptions, }?: UseBackendSubmitSwapTxStatusParams) => UseQueryResult<SubmitSwapTxStatusResponse | undefined, Error>;
695
-
696
782
  type BackendPaginationParams = {
697
783
  offset: string;
698
784
  limit: string;
@@ -783,6 +869,358 @@ type UseBackendAllMoneyMarketBorrowersParams = ReadHookParams<MoneyMarketBorrowe
783
869
  */
784
870
  declare const useBackendAllMoneyMarketBorrowers: ({ params, queryOptions, }?: UseBackendAllMoneyMarketBorrowersParams) => UseQueryResult<MoneyMarketBorrowers | undefined>;
785
871
 
872
+ type UseSwapsApiTokensParams = ReadHookParams<GetSwapTokensResponseV2, {
873
+ apiConfig?: RequestOverrideConfig;
874
+ }>;
875
+ /**
876
+ * React hook to fetch all supported swap tokens grouped by SpokeChainKey via the swaps API —
877
+ * `sodax.api.swaps.getTokens`.
878
+ *
879
+ * @example
880
+ * const { data: tokensByChain } = useSwapsApiTokens();
881
+ */
882
+ declare const useSwapsApiTokens: ({ params, queryOptions, }?: UseSwapsApiTokensParams) => UseQueryResult<GetSwapTokensResponseV2, Error>;
883
+
884
+ type UseSwapsApiTokensByChainParams = ReadHookParams<GetSwapTokensByChainResponseV2 | undefined, {
885
+ chainKey: string | undefined;
886
+ apiConfig?: RequestOverrideConfig;
887
+ }>;
888
+ /**
889
+ * React hook to fetch supported swap tokens for a single SpokeChainKey via the swaps API —
890
+ * `sodax.api.swaps.getTokensByChain`.
891
+ *
892
+ * @example
893
+ * const { data: tokens } = useSwapsApiTokensByChain({ params: { chainKey: '0xa4b1.arbitrum' } });
894
+ */
895
+ declare const useSwapsApiTokensByChain: ({ params, queryOptions, }?: UseSwapsApiTokensByChainParams) => UseQueryResult<GetSwapTokensByChainResponseV2 | undefined, Error>;
896
+
897
+ type UseSwapsApiQuoteParams = ReadHookParams<QuoteResponseV2 | undefined, {
898
+ body: QuoteRequestV2 | undefined;
899
+ query?: QuoteQueryV2;
900
+ apiConfig?: RequestOverrideConfig;
901
+ }>;
902
+ /**
903
+ * React hook to get a solver quote for a cross-chain swap via the swaps API —
904
+ * `sodax.api.swaps.getQuote`. Pass `query.includeTxData = true` to also build an unsigned
905
+ * create-intent transaction (`txData`); `srcAddress`/`dstAddress` are then required in the body.
906
+ *
907
+ * @example
908
+ * const { data: quote } = useSwapsApiQuote({
909
+ * params: {
910
+ * body: {
911
+ * tokenSrc: '0x...', tokenSrcChainKey: '0xa4b1.arbitrum',
912
+ * tokenDst: '0x...', tokenDstChainKey: 'sonic',
913
+ * amount: '1000000', quoteType: 'exact_input',
914
+ * },
915
+ * },
916
+ * });
917
+ */
918
+ declare const useSwapsApiQuote: ({ params, queryOptions, }?: UseSwapsApiQuoteParams) => UseQueryResult<QuoteResponseV2 | undefined, Error>;
919
+
920
+ type UseSwapsApiDeadlineParams = ReadHookParams<DeadlineResponseV2, {
921
+ query?: DeadlineQueryV2;
922
+ apiConfig?: RequestOverrideConfig;
923
+ }>;
924
+ /**
925
+ * React hook to compute a swap deadline (hub timestamp + `offsetSeconds`, default 300s) via the
926
+ * swaps API — `sodax.api.swaps.getDeadline`.
927
+ *
928
+ * @example
929
+ * const { data: deadline } = useSwapsApiDeadline({ params: { query: { offsetSeconds: 600 } } });
930
+ */
931
+ declare const useSwapsApiDeadline: ({ params, queryOptions, }?: UseSwapsApiDeadlineParams) => UseQueryResult<DeadlineResponseV2, Error>;
932
+
933
+ type UseSwapsApiAllowanceParams = ReadHookParams<AllowanceCheckResponseV2 | undefined, {
934
+ body: CreateIntentParamsV2 | undefined;
935
+ apiConfig?: RequestOverrideConfig;
936
+ }>;
937
+ /**
938
+ * React hook to check whether the source-token allowance is already sufficient for an intent via
939
+ * the swaps API — `sodax.api.swaps.checkAllowance`. Returns `{ valid }`.
940
+ *
941
+ * @example
942
+ * const { data: allowance } = useSwapsApiAllowance({ params: { body: createIntentParams } });
943
+ */
944
+ declare const useSwapsApiAllowance: ({ params, queryOptions, }?: UseSwapsApiAllowanceParams) => UseQueryResult<AllowanceCheckResponseV2 | undefined, Error>;
945
+
946
+ /**
947
+ * Mutation variables for {@link useSwapsApiApprove}. The per-request `apiConfig` override belongs
948
+ * here rather than at the hook level — different calls in the same component can target different
949
+ * endpoints without re-rendering.
950
+ */
951
+ type UseSwapsApiApproveVars = {
952
+ body: CreateIntentParamsV2;
953
+ apiConfig?: RequestOverrideConfig;
954
+ };
955
+ /**
956
+ * React hook to build an unsigned token-approval transaction for the source token via the swaps
957
+ * API — `sodax.api.swaps.approve`. Returns `{ tx }` (chain-specific unsigned tx) to sign and
958
+ * broadcast yourself; it does not change state, so no queries are invalidated.
959
+ *
960
+ * @example
961
+ * const { mutateAsync: approve } = useSwapsApiApprove();
962
+ * const { tx } = await approve({ body: createIntentParams });
963
+ */
964
+ declare const useSwapsApiApprove: ({ mutationOptions, }?: MutationHookParams<ApproveResponseV2, UseSwapsApiApproveVars>) => SafeUseMutationResult<ApproveResponseV2, Error, UseSwapsApiApproveVars>;
965
+
966
+ /**
967
+ * Mutation variables for {@link useSwapsApiCreateIntent}. The per-request `apiConfig` override
968
+ * belongs here rather than at the hook level.
969
+ */
970
+ type UseSwapsApiCreateIntentVars = {
971
+ body: CreateIntentParamsV2;
972
+ apiConfig?: RequestOverrideConfig;
973
+ };
974
+ /**
975
+ * React hook to build an unsigned create-intent transaction via the swaps API —
976
+ * `sodax.api.swaps.createIntent`. Returns `{ tx, intent, relayData }` to sign and broadcast
977
+ * yourself; it does not change state, so no queries are invalidated.
978
+ *
979
+ * @example
980
+ * const { mutateAsync: createIntent } = useSwapsApiCreateIntent();
981
+ * const { tx, intent, relayData } = await createIntent({ body: createIntentParams });
982
+ */
983
+ declare const useSwapsApiCreateIntent: ({ mutationOptions, }?: MutationHookParams<CreateIntentResponseV2, UseSwapsApiCreateIntentVars>) => SafeUseMutationResult<CreateIntentResponseV2, Error, UseSwapsApiCreateIntentVars>;
984
+
985
+ /**
986
+ * Mutation variables for {@link useSwapsApiSubmitIntent}. The per-request `apiConfig` override
987
+ * belongs here rather than at the hook level.
988
+ */
989
+ type UseSwapsApiSubmitIntentVars = {
990
+ body: SubmitIntentRequestV2;
991
+ apiConfig?: RequestOverrideConfig;
992
+ };
993
+ /**
994
+ * React hook to submit the broadcast intent tx to the relay via the swaps API —
995
+ * `sodax.api.swaps.submitIntent`. Returns `{ result }` (opaque relay response).
996
+ *
997
+ * No auto-retry (`retry: false`): submitting is non-idempotent — a retry after a lost response
998
+ * could double-submit to the relay. Override via `mutationOptions.retry` if your relay dedupes.
999
+ *
1000
+ * @example
1001
+ * const { mutateAsync: submitIntent } = useSwapsApiSubmitIntent();
1002
+ * const { result } = await submitIntent({ body: { chainId: '146', txHash: '0x123...' } });
1003
+ */
1004
+ declare const useSwapsApiSubmitIntent: ({ mutationOptions, }?: MutationHookParams<SubmitIntentResponseV2, UseSwapsApiSubmitIntentVars>) => SafeUseMutationResult<SubmitIntentResponseV2, Error, UseSwapsApiSubmitIntentVars>;
1005
+
1006
+ type UseSwapsApiStatusParams = ReadHookParams<StatusResponseV2 | undefined, {
1007
+ intentTxHash: string | undefined;
1008
+ apiConfig?: RequestOverrideConfig;
1009
+ }>;
1010
+ /**
1011
+ * React hook for polling the solver intent status by hub-chain intent tx hash via the swaps API —
1012
+ * `sodax.api.swaps.getStatus`. Returns `{ status, fillTxHash? }` (`fillTxHash` set when `status === 3`).
1013
+ *
1014
+ * @example
1015
+ * const { data } = useSwapsApiStatus({ params: { intentTxHash: '0x123...' } });
1016
+ *
1017
+ * @remarks
1018
+ * - Default refetch interval is 1 second; stops once `status` is `3` (SOLVED) or `4` (FAILED).
1019
+ */
1020
+ declare const useSwapsApiStatus: ({ params, queryOptions, }?: UseSwapsApiStatusParams) => UseQueryResult<StatusResponseV2 | undefined, Error>;
1021
+
1022
+ /**
1023
+ * Terminal solver intent states: once reached, the intent is resolved and polling stops.
1024
+ * `3` = SOLVED, `4` = FAILED (per `SwapIntentStatusCodeV2`); `-1` / `1` / `2` are non-terminal.
1025
+ *
1026
+ * Kept in its own pure module (no React/context imports) so it is unit-testable in dapp-kit's
1027
+ * `node` test environment — importing the hook itself pulls in `useSodaxContext`.
1028
+ */
1029
+ declare const isTerminalSwapIntentStatus: (status: SwapIntentStatusCodeV2 | undefined) => boolean;
1030
+
1031
+ /**
1032
+ * Mutation variables for {@link useSwapsApiCancelIntent}. The per-request `apiConfig` override
1033
+ * belongs here rather than at the hook level.
1034
+ */
1035
+ type UseSwapsApiCancelIntentVars = {
1036
+ body: CancelIntentRequestV2;
1037
+ apiConfig?: RequestOverrideConfig;
1038
+ };
1039
+ /**
1040
+ * React hook to build an unsigned cancel-intent transaction via the swaps API —
1041
+ * `sodax.api.swaps.cancelIntent`. The `intent` carries `bigint` numerics. Returns `{ tx }` to sign
1042
+ * and broadcast yourself; it does not change state, so no queries are invalidated.
1043
+ *
1044
+ * @example
1045
+ * const { mutateAsync: cancelIntent } = useSwapsApiCancelIntent();
1046
+ * const { tx } = await cancelIntent({ body: { srcChainKey: 'sonic', intent } });
1047
+ */
1048
+ declare const useSwapsApiCancelIntent: ({ mutationOptions, }?: MutationHookParams<CancelIntentResponseV2, UseSwapsApiCancelIntentVars>) => SafeUseMutationResult<CancelIntentResponseV2, Error, UseSwapsApiCancelIntentVars>;
1049
+
1050
+ type UseSwapsApiIntentHashParams = ReadHookParams<IntentHashResponseV2 | undefined, {
1051
+ intent: IntentRequestV2 | undefined;
1052
+ apiConfig?: RequestOverrideConfig;
1053
+ }>;
1054
+ /**
1055
+ * React hook to compute the keccak256 hash of an Intent struct via the swaps API —
1056
+ * `sodax.api.swaps.getIntentHash`. The `intent` carries `bigint` numerics. Returns `{ hash }`.
1057
+ *
1058
+ * @example
1059
+ * const { data } = useSwapsApiIntentHash({ params: { intent } });
1060
+ */
1061
+ declare const useSwapsApiIntentHash: ({ params, queryOptions, }?: UseSwapsApiIntentHashParams) => UseQueryResult<IntentHashResponseV2 | undefined, Error>;
1062
+
1063
+ type UseSwapsApiIntentPacketParams = ReadHookParams<IntentPacketResponseV2 | undefined, {
1064
+ body: IntentPacketRequestV2 | undefined;
1065
+ apiConfig?: RequestOverrideConfig;
1066
+ }>;
1067
+ /**
1068
+ * React hook to long-poll the relayer until the fill packet lands on the destination chain via the
1069
+ * swaps API — `sodax.api.swaps.getSolvedIntentPacket`. The request is held open server-side until
1070
+ * the packet arrives (or `body.timeout` ms elapses), so no client-side `refetchInterval` is set.
1071
+ *
1072
+ * @example
1073
+ * const { data: packet } = useSwapsApiIntentPacket({
1074
+ * params: { body: { chainId: '146', fillTxHash: '0x123...' } },
1075
+ * });
1076
+ */
1077
+ declare const useSwapsApiIntentPacket: ({ params, queryOptions, }?: UseSwapsApiIntentPacketParams) => UseQueryResult<IntentPacketResponseV2 | undefined, Error>;
1078
+
1079
+ type UseSwapsApiIntentExtraDataParams = ReadHookParams<IntentExtraDataResponseV2 | undefined, {
1080
+ body: IntentExtraDataRequestV2 | undefined;
1081
+ apiConfig?: RequestOverrideConfig;
1082
+ }>;
1083
+ /**
1084
+ * React hook to recover the relay extra data needed by `/swaps/intents/submit` via the swaps API —
1085
+ * `sodax.api.swaps.getIntentSubmitTxExtraData`. Provide EITHER `txHash` OR `intent` in the body
1086
+ * (whose `bigint` numerics are serialized by the SDK). Returns `{ address, payload }`.
1087
+ *
1088
+ * @example
1089
+ * const { data } = useSwapsApiIntentExtraData({ params: { body: { txHash: '0x123...' } } });
1090
+ */
1091
+ declare const useSwapsApiIntentExtraData: ({ params, queryOptions, }?: UseSwapsApiIntentExtraDataParams) => UseQueryResult<IntentExtraDataResponseV2 | undefined, Error>;
1092
+
1093
+ type UseSwapsApiFilledIntentParams = ReadHookParams<IntentStateV2 | undefined, {
1094
+ txHash: string | undefined;
1095
+ apiConfig?: RequestOverrideConfig;
1096
+ }>;
1097
+ /**
1098
+ * React hook to get the on-chain fill state for an intent by its hub-chain tx hash via the swaps
1099
+ * API — `sodax.api.swaps.getFilledIntent`. Returns
1100
+ * `{ exists, remainingInput, receivedOutput, pendingPayment }`.
1101
+ *
1102
+ * @example
1103
+ * const { data: fill } = useSwapsApiFilledIntent({ params: { txHash: '0x123...' } });
1104
+ */
1105
+ declare const useSwapsApiFilledIntent: ({ params, queryOptions, }?: UseSwapsApiFilledIntentParams) => UseQueryResult<IntentStateV2 | undefined, Error>;
1106
+
1107
+ type UseSwapsApiIntentParams = ReadHookParams<GetIntentResponseV2 | undefined, {
1108
+ txHash: string | undefined;
1109
+ apiConfig?: RequestOverrideConfig;
1110
+ }>;
1111
+ /**
1112
+ * React hook to look up an Intent struct by its hub-chain creation tx hash via the swaps API —
1113
+ * `sodax.api.swaps.getIntent`. The decoded intent's bigint fields are returned as decimal strings.
1114
+ *
1115
+ * @example
1116
+ * const { data: intent } = useSwapsApiIntent({ params: { txHash: '0x123...' } });
1117
+ */
1118
+ declare const useSwapsApiIntent: ({ params, queryOptions, }?: UseSwapsApiIntentParams) => UseQueryResult<GetIntentResponseV2 | undefined, Error>;
1119
+
1120
+ /**
1121
+ * Mutation variables for {@link useSwapsApiCreateLimitOrder}. The per-request `apiConfig` override
1122
+ * belongs here rather than at the hook level.
1123
+ */
1124
+ type UseSwapsApiCreateLimitOrderVars = {
1125
+ body: CreateLimitOrderParamsV2;
1126
+ apiConfig?: RequestOverrideConfig;
1127
+ };
1128
+ /**
1129
+ * React hook to build an unsigned create-limit-order-intent transaction via the swaps API —
1130
+ * `sodax.api.swaps.createLimitOrderIntent` (same as create-intent but `deadline` is optional).
1131
+ * Returns `{ tx, intent, relayData }`; it does not change state, so no queries are invalidated.
1132
+ *
1133
+ * @example
1134
+ * const { mutateAsync: createLimitOrder } = useSwapsApiCreateLimitOrder();
1135
+ * const { tx, intent, relayData } = await createLimitOrder({ body: createLimitOrderParams });
1136
+ */
1137
+ declare const useSwapsApiCreateLimitOrder: ({ mutationOptions, }?: MutationHookParams<CreateLimitOrderResponseV2, UseSwapsApiCreateLimitOrderVars>) => SafeUseMutationResult<CreateLimitOrderResponseV2, Error, UseSwapsApiCreateLimitOrderVars>;
1138
+
1139
+ type UseSwapsApiEstimateGasParams = ReadHookParams<GasEstimateResponseV2 | undefined, {
1140
+ body: GasEstimateRequestV2 | undefined;
1141
+ apiConfig?: RequestOverrideConfig;
1142
+ }>;
1143
+ /**
1144
+ * React hook to estimate gas for a raw transaction on a spoke chain via the swaps API —
1145
+ * `sodax.api.swaps.estimateGas`. Returns `{ gas }` (chain-specific shape).
1146
+ *
1147
+ * @example
1148
+ * const { data } = useSwapsApiEstimateGas({ params: { body: { chainKey: 'sonic', tx } } });
1149
+ */
1150
+ declare const useSwapsApiEstimateGas: ({ params, queryOptions, }?: UseSwapsApiEstimateGasParams) => UseQueryResult<GasEstimateResponseV2 | undefined, Error>;
1151
+
1152
+ type UseSwapsApiPartnerFeeParams = ReadHookParams<FeeResponseV2 | undefined, {
1153
+ amount: string | undefined;
1154
+ apiConfig?: RequestOverrideConfig;
1155
+ }>;
1156
+ /**
1157
+ * React hook to compute the partner fee for a given input amount via the swaps API —
1158
+ * `sodax.api.swaps.getPartnerFee`. Returns `{ fee }` (decimal string).
1159
+ *
1160
+ * @example
1161
+ * const { data } = useSwapsApiPartnerFee({ params: { amount: '1000000' } });
1162
+ */
1163
+ declare const useSwapsApiPartnerFee: ({ params, queryOptions, }?: UseSwapsApiPartnerFeeParams) => UseQueryResult<FeeResponseV2 | undefined, Error>;
1164
+
1165
+ type UseSwapsApiSolverFeeParams = ReadHookParams<FeeResponseV2 | undefined, {
1166
+ amount: string | undefined;
1167
+ apiConfig?: RequestOverrideConfig;
1168
+ }>;
1169
+ /**
1170
+ * React hook to compute the protocol (solver) fee for a given input amount via the swaps API —
1171
+ * `sodax.api.swaps.getSolverFee`. Returns `{ fee }` (decimal string).
1172
+ *
1173
+ * @example
1174
+ * const { data } = useSwapsApiSolverFee({ params: { amount: '1000000' } });
1175
+ */
1176
+ declare const useSwapsApiSolverFee: ({ params, queryOptions, }?: UseSwapsApiSolverFeeParams) => UseQueryResult<FeeResponseV2 | undefined, Error>;
1177
+
1178
+ /**
1179
+ * Mutation variables for {@link useSwapsApiSubmitTx}. The per-request `apiConfig` override
1180
+ * (e.g. base URL) belongs here rather than at the hook level — different submissions in the same
1181
+ * component can target different endpoints without re-rendering.
1182
+ */
1183
+ type UseSwapsApiSubmitTxVars = {
1184
+ request: SubmitTxRequestV2;
1185
+ apiConfig?: RequestOverrideConfig;
1186
+ };
1187
+ /**
1188
+ * React hook for submitting a swap transaction to be processed (relay, post execution to the
1189
+ * solver, etc.) via the swaps API — `sodax.api.swaps.submitTx`.
1190
+ *
1191
+ * Pure mutation: pass `{ request, apiConfig? }` to `mutate({...})`. Default `retry: 3` is applied
1192
+ * at the hook level — consumers can override via `mutationOptions.retry`.
1193
+ *
1194
+ * @example
1195
+ * const { mutateAsync: submitSwapTx, isPending, error } = useSwapsApiSubmitTx();
1196
+ *
1197
+ * const result = await submitSwapTx({
1198
+ * request: { txHash: '0x123...', srcChainKey: 'sonic', walletAddress: '0xabc...', intent: { ... }, relayData: '0x...' },
1199
+ * apiConfig: { baseURL: 'https://...' },
1200
+ * });
1201
+ */
1202
+ declare const useSwapsApiSubmitTx: ({ mutationOptions, }?: MutationHookParams<SubmitTxResponseV2, UseSwapsApiSubmitTxVars>) => SafeUseMutationResult<SubmitTxResponseV2, Error, UseSwapsApiSubmitTxVars>;
1203
+
1204
+ type UseSwapsApiSubmitTxStatusParams = ReadHookParams<SubmitTxStatusResponseV2 | undefined, {
1205
+ txHash: string | undefined;
1206
+ srcChainKey?: string;
1207
+ apiConfig?: RequestOverrideConfig;
1208
+ }>;
1209
+ /**
1210
+ * React hook for polling the processing status of a submitted swap transaction via the swaps API —
1211
+ * `sodax.api.swaps.getSubmitTxStatus`. Both `txHash` and `srcChainKey` are required for the query
1212
+ * to run (the swaps API v2 status query requires the source chain key).
1213
+ *
1214
+ * @example
1215
+ * const { data: status } = useSwapsApiSubmitTxStatus({
1216
+ * params: { txHash: '0x123...', srcChainKey: 'sonic' },
1217
+ * });
1218
+ *
1219
+ * @remarks
1220
+ * - Default refetch interval is 1 second; stops on 'solved' or 'failed' status.
1221
+ */
1222
+ declare const useSwapsApiSubmitTxStatus: ({ params, queryOptions, }?: UseSwapsApiSubmitTxStatusParams) => UseQueryResult<SubmitTxStatusResponseV2 | undefined, Error>;
1223
+
786
1224
  /**
787
1225
  * Mutation variables for {@link useBridge}. Generic over `K extends SpokeChainKey` (defaults to
788
1226
  * the full union). Sophisticated callers can lock K at the hook call site to narrow the
@@ -1092,6 +1530,75 @@ type UseFeeClaimSwapVars = Omit<PartnerFeeClaimSwapAction<HubChainKey, false>, '
1092
1530
  */
1093
1531
  declare function useFeeClaimSwap({ mutationOptions, }?: MutationHookParams<IntentAutoSwapResult, UseFeeClaimSwapVars>): SafeUseMutationResult<IntentAutoSwapResult, Error, UseFeeClaimSwapVars>;
1094
1532
 
1533
+ type UsePartnerCancelIntentVars = Omit<PartnerFeeClaimCancelAction<HubChainKey, false>, 'raw'>;
1534
+ /**
1535
+ * React hook to cancel a stuck partner fee-claim auto-swap intent and recover the locked tokens.
1536
+ *
1537
+ * Calls `ProtocolIntents.cancelIntent(fromToken, toToken)` — the only authorized cancel path for
1538
+ * partner auto-swap intents (the generic swap-cancel reverts because ProtocolIntents, not the
1539
+ * partner, is the intent creator). The contract cancels the intent and refunds the input amount to
1540
+ * the partner. Use this to recover funds from an unfillable same-token claim.
1541
+ *
1542
+ * Throws on SDK failure so React Query's native error model engages. Returns the transaction hash.
1543
+ */
1544
+ declare function usePartnerCancelIntent({ mutationOptions, }?: MutationHookParams<TxReturnType<HubChainKey, false>, UsePartnerCancelIntentVars>): SafeUseMutationResult<TxReturnType<HubChainKey, false>, Error, UsePartnerCancelIntentVars>;
1545
+
1546
+ type UseGetUserIntentParams = ReadHookParams<Hex, Partial<GetUserIntentParams>>;
1547
+ /**
1548
+ * React hook to look up the stored intent hash for a partner's `(user, fromToken, toToken)` pair.
1549
+ *
1550
+ * A non-zero hash means an open auto-swap intent exists for that token pair (e.g. an unfilled
1551
+ * same-token claim) and can be recovered via {@link usePartnerCancelIntent}. Disabled until all
1552
+ * three inputs are present. Throws on `!ok`.
1553
+ */
1554
+ declare function useGetUserIntent({ params, queryOptions }?: UseGetUserIntentParams): UseQueryResult<Hex, Error>;
1555
+
1556
+ type UseGetIntentDetailsParams = ReadHookParams<Intent, {
1557
+ intentHash: Hex | undefined;
1558
+ }>;
1559
+ /**
1560
+ * React hook to fetch the full {@link Intent} details for a ProtocolIntents intent hash.
1561
+ *
1562
+ * Pair with {@link useGetUserIntent} to display a stuck intent (e.g. its locked `inputAmount`)
1563
+ * before recovering it. Disabled when the hash is missing or the zero hash (no intent). Throws
1564
+ * on `!ok`.
1565
+ */
1566
+ declare function useGetIntentDetails({ params, queryOptions, }?: UseGetIntentDetailsParams): UseQueryResult<Intent, Error>;
1567
+
1568
+ /**
1569
+ * Mutation variables for {@link useFeeClaimWithdraw}. Maps a partner fee balance to a
1570
+ * Sonic-sourced bridge: `feeToken` is the wrapped hub-asset address on Sonic
1571
+ * (`PartnerFeeClaimAssetBalance.address`); `dstToken` is the original token address on
1572
+ * `dstChainKey` (`PartnerFeeClaimAssetBalance.originalAddress`, or `feeToken` for same-chain
1573
+ * delivery to a Sonic address).
1574
+ */
1575
+ type UseFeeClaimWithdrawVars = {
1576
+ params: {
1577
+ srcAddress: string;
1578
+ feeToken: Address$1;
1579
+ amount: bigint;
1580
+ dstChainKey: SpokeChainKey;
1581
+ dstToken: string;
1582
+ recipient: string;
1583
+ };
1584
+ walletProvider: GetWalletProviderType<HubChainKey>;
1585
+ };
1586
+ /**
1587
+ * React hook to withdraw a partner fee token directly to the partner's wallet **without a swap**.
1588
+ *
1589
+ * For fees the partner wants to keep as-is (the desired output equals the fee token, e.g. BTC→BTC),
1590
+ * an auto-swap is impossible — the solver rejects a same-token swap. This bridges the wrapped fee
1591
+ * token from Sonic to its native chain (or transfers it on Sonic when `dstChainKey` is Sonic),
1592
+ * bypassing the solver entirely.
1593
+ *
1594
+ * Bridging from Sonic pulls the token via the partner's hub-wallet router, which requires a prior
1595
+ * allowance to that spender — a different approval than the ProtocolIntents one used by the swap
1596
+ * claim. Use `useBridgeAllowance` / `useBridgeApprove` (with the same mapped bridge params) first.
1597
+ *
1598
+ * Throws on SDK failure so React Query's native error model engages. Returns the `TxHashPair`.
1599
+ */
1600
+ declare function useFeeClaimWithdraw({ mutationOptions, }?: MutationHookParams<TxHashPair, UseFeeClaimWithdrawVars>): SafeUseMutationResult<TxHashPair, Error, UseFeeClaimWithdrawVars>;
1601
+
1095
1602
  type UseHubAssetBalancesParams = ReadHookParams<HubAssetBalance[], {
1096
1603
  chainKey: SpokeChainKey | undefined;
1097
1604
  /** The user's address on the spoke chain. The SDK derives the hub wallet abstraction internally. */
@@ -1475,16 +1982,205 @@ type UseClaimRewardsVars<K extends SpokeChainKey = SpokeChainKey> = Omit<ClLiqui
1475
1982
  */
1476
1983
  declare function useClaimRewards<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseClaimRewardsVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseClaimRewardsVars<K>>;
1477
1984
 
1985
+ type UseLeverageYieldEffectiveAprParams = ReadHookParams<LeverageYieldEffectiveApr, {
1986
+ vault: Address$1 | undefined;
1987
+ }>;
1988
+ /**
1989
+ * Reads a leverage-yield vault's effective APR — AAVE supply/borrow rates plus the LSD
1990
+ * staking yield, with the vault's leverage formula re-applied on the boosted supply side.
1991
+ *
1992
+ * The underlying SDK call does the on-chain reads (AAVE rates + `targetLTV`) and the
1993
+ * off-chain LSD fetch in parallel. Rates drift slowly, so the default refresh is 60s.
1994
+ *
1995
+ * @example
1996
+ * ```typescript
1997
+ * const { data: apr } = useLeverageYieldEffectiveApr({ params: { vault: vault.vault } });
1998
+ * ```
1999
+ */
2000
+ declare function useLeverageYieldEffectiveApr({ params, queryOptions, }?: UseLeverageYieldEffectiveAprParams): UseQueryResult<LeverageYieldEffectiveApr, Error>;
2001
+
2002
+ type UseLeverageYieldPositionParams = ReadHookParams<LeverageYieldPosition, {
2003
+ vault: Address$1 | undefined;
2004
+ }>;
2005
+ /**
2006
+ * Reads a leverage-yield vault's live position snapshot via the vault's `getPositionDetails`:
2007
+ * collateral, debt, current LTV (drift vs `targetLTV`), health factor (∞ when no debt), and
2008
+ * idle (not-yet-deployed) asset.
2009
+ *
2010
+ * LTV shifts with each rebalance/rate tick, so the default refresh (30s) is faster than the
2011
+ * APR/stats reads.
2012
+ *
2013
+ * @example
2014
+ * ```typescript
2015
+ * const { data: position } = useLeverageYieldPosition({ params: { vault: vault.vault } });
2016
+ * ```
2017
+ */
2018
+ declare function useLeverageYieldPosition({ params, queryOptions, }?: UseLeverageYieldPositionParams): UseQueryResult<LeverageYieldPosition, Error>;
2019
+
2020
+ type UseLeverageYieldTotalAssetsParams = ReadHookParams<bigint, {
2021
+ vault: Address$1 | undefined;
2022
+ }>;
2023
+ /**
2024
+ * Reads a leverage-yield vault's total underlying assets (vault-asset units, 18 decimals) —
2025
+ * i.e. its TVL. Moves slowly, so the default refresh is 60s.
2026
+ *
2027
+ * @example
2028
+ * ```typescript
2029
+ * const { data: tvl } = useLeverageYieldTotalAssets({ params: { vault: vault.vault } });
2030
+ * ```
2031
+ */
2032
+ declare function useLeverageYieldTotalAssets({ params, queryOptions, }?: UseLeverageYieldTotalAssetsParams): UseQueryResult<bigint, Error>;
2033
+
2034
+ type UseLeverageYieldPreviewRedeemParams = ReadHookParams<bigint, {
2035
+ vault: Address$1 | undefined;
2036
+ shares: bigint | undefined;
2037
+ }>;
2038
+ /**
2039
+ * Reads the assets received for redeeming `shares` of a leverage-yield vault (ERC-4626
2040
+ * `previewRedeem`). Passing `10n ** 18n` (one share) yields the per-share price that creeps
2041
+ * up as the vault accrues interest. Moves slowly, so the default refresh is 60s.
2042
+ *
2043
+ * @example
2044
+ * ```typescript
2045
+ * const { data: sharePrice } = useLeverageYieldPreviewRedeem({
2046
+ * params: { vault: vault.vault, shares: 10n ** 18n },
2047
+ * });
2048
+ * ```
2049
+ */
2050
+ declare function useLeverageYieldPreviewRedeem({ params, queryOptions, }?: UseLeverageYieldPreviewRedeemParams): UseQueryResult<bigint, Error>;
2051
+
2052
+ /** A single `(chain, hub-wallet holder, share balance)` row produced by {@link useLeverageYieldShareBalances}. */
2053
+ type LeverageYieldShareHolding = {
2054
+ chainKey: SpokeChainKey;
2055
+ holder: Address$1;
2056
+ shares: bigint;
2057
+ };
2058
+ /** A `(chainKey, EOA address)` pair the user controls — one per spoke chain they may hold shares under. */
2059
+ type LeverageYieldShareHolder = {
2060
+ chainKey: SpokeChainKey;
2061
+ address: string;
2062
+ };
2063
+ type UseLeverageYieldShareBalancesParams = ReadHookParams<LeverageYieldShareHolding, {
2064
+ vault: Address$1 | undefined;
2065
+ holders: readonly LeverageYieldShareHolder[] | undefined;
2066
+ }>;
2067
+ /**
2068
+ * Reads a user's leverage-vault share (`lsoda*`) balances across every chain they may hold a
2069
+ * position under — one query per holder, fanned out via `useQueries`.
2070
+ *
2071
+ * For each `(chainKey, address)` the holder is resolved to the address that actually owns the
2072
+ * shares: the user's **derived hub wallet** on every chain, including the hub itself. Leverage
2073
+ * deposits always deliver `lsoda*` to `getUserHubWalletAddress(srcAddress, srcChainKey)` (the
2074
+ * CREATE3 user-router on Sonic for a hub-sourced deposit, the per-spoke hub wallet otherwise) —
2075
+ * never the bare EOA — so a hub-chain deposit's shares live in the router, not the signing EOA.
2076
+ * Resolving the holder the same way the deposit does is what makes a Sonic-sourced position show
2077
+ * up here instead of reading a stale zero off the EOA.
2078
+ *
2079
+ * Returns the raw `useQueries` result array (15s refresh per query); callers aggregate as needed
2080
+ * (e.g. sum `shares` for a headline total, or pick the row for the active chain).
2081
+ *
2082
+ * `useQueries` has no top-level options slot, so `queryOptions` is spread into every individual
2083
+ * query config (and applies uniformly to each holder's query).
2084
+ *
2085
+ * @example
2086
+ * ```typescript
2087
+ * const balances = useLeverageYieldShareBalances({ params: { vault: vault.vault, holders } });
2088
+ * const total = balances.reduce((acc, q) => acc + (q.data?.shares ?? 0n), 0n);
2089
+ * ```
2090
+ */
2091
+ declare function useLeverageYieldShareBalances({ params, queryOptions, }?: UseLeverageYieldShareBalancesParams): UseQueryResult<LeverageYieldShareHolding, Error>[];
2092
+
2093
+ /** Mutation variables for {@link useLeverageYieldDeposit} — the swap-style deposit inputs. */
2094
+ type UseLeverageYieldDepositVars = LeverageYieldSwapDepositParams;
2095
+ /**
2096
+ * Builds the `LeverageYieldSwapPayload` for a leverage-yield deposit (any token → `lsoda*` shares,
2097
+ * delivered to the user's hub wallet). Spread the returned payload into
2098
+ * {@link useLeverageYieldVaultSwap}.
2099
+ *
2100
+ * This is a builder, not an executor — it derives the hub wallet and assembles the intent; the
2101
+ * actual swap is relayed by `useLeverageYieldVaultSwap`. Throws on SDK failure so React Query's
2102
+ * error model engages; returns the unwrapped `LeverageYieldSwapPayload` on success.
2103
+ *
2104
+ * @example
2105
+ * ```typescript
2106
+ * const { mutateAsyncSafe: buildDeposit } = useLeverageYieldDeposit();
2107
+ * const built = await buildDeposit({ vault, srcChainKey, srcAddress, inputToken, inputAmount, minOutputAmount });
2108
+ * if (built.ok) vaultSwap({ ...built.value, walletProvider });
2109
+ * ```
2110
+ */
2111
+ declare function useLeverageYieldDeposit({ mutationOptions, }?: MutationHookParams<LeverageYieldSwapPayload, UseLeverageYieldDepositVars>): SafeUseMutationResult<LeverageYieldSwapPayload, Error, UseLeverageYieldDepositVars>;
2112
+
2113
+ /** Mutation variables for {@link useLeverageYieldNotifySolver} — the hub-side intent tx hash. */
2114
+ type UseLeverageYieldNotifySolverVars = SolverExecutionRequest;
2115
+ /**
2116
+ * Notifies the solver that a leverage-yield vault intent landed on the hub, triggering the fill.
2117
+ * The standalone notify step for the manual create → relay → notify flow: build the intent with
2118
+ * `sodax.leverageYield.createVaultIntent`, relay it yourself, then call this with the hub-side
2119
+ * intent tx hash. The end-to-end {@link useLeverageYieldVaultSwap} already calls notifySolver
2120
+ * internally — only reach for this hook when driving the relay manually.
2121
+ *
2122
+ * Throws on SDK failure so React Query's error model engages; returns the unwrapped
2123
+ * `SolverExecutionResponse` (`{ answer: 'OK', intent_hash }`) on success.
2124
+ */
2125
+ declare function useLeverageYieldNotifySolver({ mutationOptions, }?: MutationHookParams<SolverExecutionResponse, UseLeverageYieldNotifySolverVars>): SafeUseMutationResult<SolverExecutionResponse, Error, UseLeverageYieldNotifySolverVars>;
2126
+
2127
+ /**
2128
+ * Mutation variables for {@link useLeverageYieldVaultSwap}. Generic over `K extends SpokeChainKey`
2129
+ * (defaults to the full union). Sophisticated callers can lock K at the hook call site to narrow
2130
+ * the `walletProvider` and `params.srcChainKey` types.
2131
+ */
2132
+ type UseLeverageYieldVaultSwapVars<K extends SpokeChainKey = SpokeChainKey> = Omit<VaultSwapActionParams<K, false>, 'raw'>;
2133
+ /**
2134
+ * React hook for executing an end-to-end leverage-yield vault swap (deposit or withdraw).
2135
+ *
2136
+ * Spread a `LeverageYieldSwapPayload` built by {@link useLeverageYieldDeposit} /
2137
+ * {@link useLeverageYieldWithdraw} into `mutate` alongside the wallet provider:
2138
+ * `vaultSwap({ ...payload, walletProvider })`. Runs `sodax.leverageYield.vaultSwap` —
2139
+ * create intent → verify → relay → notify solver — so vault flows never touch the
2140
+ * generic swap surface.
2141
+ *
2142
+ * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
2143
+ * `onError`, `retry`). Returns the unwrapped `VaultSwapResponse` on success.
2144
+ */
2145
+ declare function useLeverageYieldVaultSwap<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<VaultSwapResponse, UseLeverageYieldVaultSwapVars<K>>): SafeUseMutationResult<VaultSwapResponse, Error, UseLeverageYieldVaultSwapVars<K>>;
2146
+
2147
+ /** Mutation variables for {@link useLeverageYieldWithdraw} — the swap-style withdraw inputs. */
2148
+ type UseLeverageYieldWithdrawVars = LeverageYieldSwapWithdrawParams;
2149
+ /**
2150
+ * Builds the `LeverageYieldSwapPayload` for a leverage-yield withdraw (`lsoda*` shares → any token).
2151
+ * The returned payload carries `hubWalletSwap: true`; spread it into
2152
+ * {@link useLeverageYieldVaultSwap}, which authorises the hub wallet to spend the shares via a
2153
+ * `Connection.sendMessage`.
2154
+ *
2155
+ * This is a builder, not an executor. Throws on SDK failure so React Query's error model engages;
2156
+ * returns the unwrapped `LeverageYieldSwapPayload` on success.
2157
+ *
2158
+ * @example
2159
+ * ```typescript
2160
+ * const { mutateAsyncSafe: buildWithdraw } = useLeverageYieldWithdraw();
2161
+ * const built = await buildWithdraw({ vault, srcChainKey, srcAddress, dstChainKey, outputToken, inputAmount, minOutputAmount });
2162
+ * if (built.ok) vaultSwap({ ...built.value, walletProvider });
2163
+ * ```
2164
+ */
2165
+ declare function useLeverageYieldWithdraw({ mutationOptions, }?: MutationHookParams<LeverageYieldSwapPayload, UseLeverageYieldWithdrawVars>): SafeUseMutationResult<LeverageYieldSwapPayload, Error, UseLeverageYieldWithdrawVars>;
2166
+
1478
2167
  interface SodaxProviderProps {
1479
2168
  children: ReactNode;
1480
2169
  /**
1481
- * Sodax config (overrides defaults including rpcUrls). **Read-once at mount**
1482
- * changes after first render are ignored to prevent re-instantiating the SDK
1483
- * from unstable parent references. To switch config (e.g. testnet mainnet),
1484
- * unmount/remount the provider.
2170
+ * Sodax SDK config. Tracked by **reference** - a new identity re-instantiates the
2171
+ * SDK. Hoist to a module constant or wrap in `useMemo`; include any value the SDK
2172
+ * should react to (e.g. solver env) in the deps. Inline `{...}` re-creates the SDK
2173
+ * every parent render and resets every `useSodaxContext` consumer.
2174
+ *
2175
+ * @example
2176
+ * ```tsx
2177
+ * const config = useMemo(() => ({ solver: solverMap[env] }), [env]);
2178
+ * <SodaxProvider config={config}>...</SodaxProvider>
2179
+ * ```
1485
2180
  */
1486
- config?: DeepPartial<SodaxConfig>;
2181
+ config?: SodaxOptions;
1487
2182
  }
2183
+ /** Root provider for `@sodax/dapp-kit`. Must be paired with `QueryClientProvider`. */
1488
2184
  declare const SodaxProvider: ({ children, config }: SodaxProviderProps) => ReactElement;
1489
2185
 
1490
2186
  type CreateSodaxQueryClientOptions = {
@@ -1547,4 +2243,30 @@ type CreateSodaxQueryClientOptions = {
1547
2243
  */
1548
2244
  declare function createSodaxQueryClient({ onMutationError, config, }?: CreateSodaxQueryClientOptions): QueryClient;
1549
2245
 
1550
- export { type ATokenData, type BackendPaginationParams, type CreateSodaxQueryClientOptions, type DecreaseLiquidityParamsCore, type DepositParamsCore, type MutationHookOptions, type MutationHookParams, type RadfiSession, type ReadHookParams, type ReadQueryOptions, type ReserveUsdFormat, type SafeUseMutationResult, SodaxProvider, type UseATokenParams, type UseATokensBalancesParams, type UseApproveTokenVars, type UseBitcoinBalanceParams, type UseBorrowVars, type UseBridgeAllowanceParams, type UseBridgeApproveVars, type UseBridgeVars, type UseClaimRewardsVars, type UseCreateDecreaseLiquidityParamsProps, type UseCreateDepositParamsProps, type UseCreateLimitOrderVars, type UseCreateSupplyLiquidityParamsProps, type UseCreateSupplyLiquidityParamsResult, type UseCreateWithdrawParamsProps, type UseDecreaseLiquidityVars, type UseDeriveUserWalletAddressParams, type UseDexAllowanceParams, type UseDexApproveVars, type UseDexDepositVars, type UseDexWithdrawVars, type UseExpiredUtxosParams, type UseFeeClaimSwapVars, type UseFetchAssetsBalancesParams, type UseFundTradingWalletVars, type UseGetAutoSwapPreferencesParams, type UseGetBridgeableAmountParams, type UseGetBridgeableTokensParams, type UseGetUserHubWalletAddressParams, type UseHubAssetBalancesParams, type UseIsTokenApprovedParams, type UseLiquidityAmountsResult, type UseMMAllowanceParams, type UseMMApproveVars, type UseMigrateBalnVars, type UseMigrateIcxToSodaVars, type UseMigratebnUSDVars, type UseMigrationAllowanceInputs, type UseMigrationAllowanceParams, type UseMigrationApproveVars, type UsePoolBalancesParams, type UsePoolBalancesResponse, type UsePoolDataParams, type UsePoolsParams, type UsePositionInfoParams, type UsePositionInfoResponse, type UseQuoteParams, type UseRadfiAuthVars, type UseRadfiSessionReturn, type UseRadfiWithdrawVars, type UseRenewUtxosVars, type UseRepayVars, type UseReservesDataParams, type UseReservesHumanizedParams, type UseReservesListParams, type UseReservesUsdFormatParams, type UseRevertMigrateSodaToIcxVars, type UseSetSwapPreferenceVars, type UseSetSwapPreferenceVarsHub, type UseStatusParams, type UseStellarTrustlineCheckParams, type UseSupplyLiquidityVars, type UseSupplyVars, type UseSwapAllowanceParams, type UseSwapApproveVars, type UseSwapVars, type UseTradingWalletBalanceParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawHubAssetVars, type UseWithdrawVars, type UseXBalancesParams, type WithdrawParamsCore, type XBalancesInputs, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getXBalancesQueryOptions, loadRadfiSession, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendSubmitSwapTx, useBackendSubmitSwapTxStatus, useBackendUserIntents, useBitcoinBalance, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEstimateGas, useExpiredUtxos, useFeeClaimSwap, useFetchAssetsBalances, useFundTradingWallet, useGetAutoSwapPreferences, useGetBridgeableAmount, useGetBridgeableTokens, useGetUserHubWalletAddress, useHubAssetBalances, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useIsTokenApproved, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrateBaln, useMigrateIcxToSoda, useMigratebnUSD, useMigrationAllowance, useMigrationApprove, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesHumanized, useReservesList, useReservesUsdFormat, useRevertMigrateSodaToIcx, useSafeMutation, useSetSwapPreference, useSodaxContext, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprove, useTradingWallet, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw, useWithdrawHubAsset, useXBalances };
2246
+ /** The subset of a `useNearStorageCheck` result the gate reads. A full `UseQueryResult<boolean>` satisfies it. */
2247
+ type NearStorageCheckResult = Pick<UseQueryResult<boolean>, 'isLoading' | 'data'>;
2248
+ /** UI gate state for NEP-141 storage registration on NEAR. */
2249
+ interface NearStorageGateState {
2250
+ /** Destination is NEAR — the only chain with a NEP-141 storage-registration prerequisite. */
2251
+ isNear: boolean;
2252
+ /** Show the "register storage" action: the check resolved and the recipient is not registered. */
2253
+ needsRegistration: boolean;
2254
+ /**
2255
+ * Keep the downstream action (swap/bridge/borrow/withdraw) disabled: the NEAR gate is unresolved
2256
+ * (still checking) or unmet (needs registration).
2257
+ */
2258
+ blocksAction: boolean;
2259
+ }
2260
+ /**
2261
+ * Derives the NEP-141 storage-registration UI gate state for a flow that delivers a token to a user
2262
+ * on NEAR — NEAR's analogue of the Stellar trustline gate. Unwrapped (no hook): pass the destination
2263
+ * `chainKey` and the `useNearStorageCheck` result; the util owns the `=== NEAR` test and reads
2264
+ * `isLoading` (NOT `isPending`, which stays `true` for a disabled query and would block forever).
2265
+ *
2266
+ * `blocksAction` deliberately also covers the in-flight check window so the action can't be
2267
+ * triggered before registration status is known; `needsRegistration` only flips once the check has
2268
+ * resolved (so the "register" button isn't shown speculatively while still checking).
2269
+ */
2270
+ declare function resolveNearStorageGate(chainKey: SpokeChainKey, check: NearStorageCheckResult): NearStorageGateState;
2271
+
2272
+ export { type ATokenData, type BackendPaginationParams, type BitcoinTradingSetup, type CreateSodaxQueryClientOptions, type DecreaseLiquidityParamsCore, type DepositParamsCore, type LeverageYieldShareHolder, type LeverageYieldShareHolding, type MutationHookOptions, type MutationHookParams, type NearStorageCheckResult, type NearStorageGateState, type RadfiSession, type ReadHookParams, type ReadQueryOptions, type ReserveUsdFormat, type SafeUseMutationResult, SodaxProvider, type UseATokenParams, type UseATokensBalancesParams, type UseApproveTokenVars, type UseBitcoinBalanceParams, type UseBitcoinTradingSetupParams, type UseBorrowVars, type UseBridgeAllowanceParams, type UseBridgeApproveVars, type UseBridgeVars, type UseClaimRewardsVars, type UseCreateDecreaseLiquidityParamsProps, type UseCreateDepositParamsProps, type UseCreateLimitOrderVars, type UseCreateSupplyLiquidityParamsProps, type UseCreateSupplyLiquidityParamsResult, type UseCreateWithdrawParamsProps, type UseDecreaseLiquidityVars, type UseDeriveUserWalletAddressParams, type UseDexAllowanceParams, type UseDexApproveVars, type UseDexDepositVars, type UseDexWithdrawVars, type UseEnsureRadfiAccessTokenVars, 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 UseLeverageYieldDepositVars, type UseLeverageYieldEffectiveAprParams, type UseLeverageYieldNotifySolverVars, type UseLeverageYieldPositionParams, type UseLeverageYieldPreviewRedeemParams, type UseLeverageYieldShareBalancesParams, type UseLeverageYieldTotalAssetsParams, type UseLeverageYieldVaultSwapVars, type UseLeverageYieldWithdrawVars, type UseLiquidityAmountsResult, type UseMMAllowanceParams, type UseMMApproveVars, type UseMigrateBalnVars, type UseMigrateIcxToSodaVars, type UseMigratebnUSDVars, type UseMigrationAllowanceInputs, type UseMigrationAllowanceParams, type UseMigrationApproveVars, type UseNearStorageCheckParams, 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 UseSetSwapPreferenceVars, type UseSetSwapPreferenceVarsHub, type UseStatusParams, type UseStellarTrustlineCheckParams, type UseSupplyLiquidityVars, type UseSupplyVars, type UseSwapAllowanceParams, type UseSwapApproveVars, type UseSwapVars, type UseSwapsApiAllowanceParams, type UseSwapsApiApproveVars, 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, getXBalancesQueryOptions, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendUserIntents, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEnsureRadfiAccessToken, useEstimateGas, useExpiredUtxos, useFeeClaimSwap, useFeeClaimWithdraw, useFetchAssetsBalances, useFundTradingWallet, useGetAutoSwapPreferences, useGetBridgeableAmount, useGetBridgeableTokens, useGetIntentDetails, useGetUserHubWalletAddress, useGetUserIntent, useHubAssetBalances, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useIsTokenApproved, useLeverageYieldDeposit, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, useLeverageYieldShareBalances, useLeverageYieldTotalAssets, useLeverageYieldVaultSwap, useLeverageYieldWithdraw, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrateBaln, useMigrateIcxToSoda, useMigratebnUSD, useMigrationAllowance, useMigrationApprove, useNearStorageCheck, useNearStorageGate, usePartnerCancelIntent, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRegisterNearStorage, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesHumanized, useReservesList, useReservesUsdFormat, useRevertMigrateSodaToIcx, useSafeMutation, useSetSwapPreference, useSodaxContext, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprove, useSwapsApiAllowance, useSwapsApiApprove, 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 };