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

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 (63) hide show
  1. package/README.md +9 -63
  2. package/dist/index.d.ts +11 -4
  3. package/dist/index.mjs +3 -6
  4. package/package.json +31 -19
  5. package/src/providers/SodaxProvider.tsx +15 -11
  6. package/ai-exported/AGENTS.md +0 -134
  7. package/ai-exported/integration/README.md +0 -49
  8. package/ai-exported/integration/ai-rules.md +0 -79
  9. package/ai-exported/integration/architecture.md +0 -274
  10. package/ai-exported/integration/features/README.md +0 -29
  11. package/ai-exported/integration/features/auxiliary-services.md +0 -169
  12. package/ai-exported/integration/features/bitcoin.md +0 -87
  13. package/ai-exported/integration/features/bridge.md +0 -91
  14. package/ai-exported/integration/features/dex.md +0 -152
  15. package/ai-exported/integration/features/migration.md +0 -118
  16. package/ai-exported/integration/features/money-market.md +0 -116
  17. package/ai-exported/integration/features/staking.md +0 -123
  18. package/ai-exported/integration/features/swap.md +0 -101
  19. package/ai-exported/integration/quickstart.md +0 -187
  20. package/ai-exported/integration/recipes/README.md +0 -136
  21. package/ai-exported/integration/recipes/backend-queries.md +0 -157
  22. package/ai-exported/integration/recipes/bitcoin.md +0 -193
  23. package/ai-exported/integration/recipes/bridge.md +0 -174
  24. package/ai-exported/integration/recipes/dex.md +0 -204
  25. package/ai-exported/integration/recipes/invalidations.md +0 -115
  26. package/ai-exported/integration/recipes/migration.md +0 -212
  27. package/ai-exported/integration/recipes/money-market.md +0 -206
  28. package/ai-exported/integration/recipes/mutation-error-handling.md +0 -118
  29. package/ai-exported/integration/recipes/observability.md +0 -93
  30. package/ai-exported/integration/recipes/setup.md +0 -144
  31. package/ai-exported/integration/recipes/staking.md +0 -202
  32. package/ai-exported/integration/recipes/swap.md +0 -272
  33. package/ai-exported/integration/recipes/wallet-connectivity.md +0 -101
  34. package/ai-exported/integration/reference/README.md +0 -12
  35. package/ai-exported/integration/reference/glossary.md +0 -188
  36. package/ai-exported/integration/reference/hooks-index.md +0 -190
  37. package/ai-exported/integration/reference/public-api.md +0 -110
  38. package/ai-exported/integration/reference/querykey-conventions.md +0 -179
  39. package/ai-exported/migration/README.md +0 -60
  40. package/ai-exported/migration/ai-rules.md +0 -81
  41. package/ai-exported/migration/breaking-changes/hook-signatures.md +0 -233
  42. package/ai-exported/migration/breaking-changes/querykey-conventions.md +0 -108
  43. package/ai-exported/migration/breaking-changes/result-handling.md +0 -211
  44. package/ai-exported/migration/breaking-changes/sdk-leakage.md +0 -165
  45. package/ai-exported/migration/checklist.md +0 -89
  46. package/ai-exported/migration/features/README.md +0 -34
  47. package/ai-exported/migration/features/auxiliary-services.md +0 -114
  48. package/ai-exported/migration/features/bitcoin.md +0 -88
  49. package/ai-exported/migration/features/bridge.md +0 -123
  50. package/ai-exported/migration/features/dex.md +0 -101
  51. package/ai-exported/migration/features/migration.md +0 -120
  52. package/ai-exported/migration/features/money-market.md +0 -97
  53. package/ai-exported/migration/features/staking.md +0 -109
  54. package/ai-exported/migration/features/swap.md +0 -118
  55. package/ai-exported/migration/recipes.md +0 -188
  56. package/ai-exported/migration/reference/README.md +0 -15
  57. package/ai-exported/migration/reference/deleted-hooks.md +0 -110
  58. package/ai-exported/migration/reference/error-shape-crosswalk.md +0 -144
  59. package/ai-exported/migration/reference/renamed-hooks.md +0 -66
  60. package/dist/index.cjs +0 -2642
  61. package/dist/index.cjs.map +0 -1
  62. package/dist/index.d.cts +0 -1550
  63. package/dist/index.mjs.map +0 -1
package/dist/index.d.cts DELETED
@@ -1,1550 +0,0 @@
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';
3
- export * from '@sodax/sdk';
4
- import { Address } from 'viem';
5
- import { ReactNode, ReactElement } from 'react';
6
-
7
- /**
8
- * Subset of `UseQueryOptions` consumers may override on dapp-kit read hooks.
9
- *
10
- * `queryKey`, `queryFn`, and `enabled` are owned by the hook (the latter is derived
11
- * from required-input presence) and are intentionally stripped here.
12
- */
13
- type ReadQueryOptions<TData, TError = Error> = Omit<UseQueryOptions<TData, TError>, 'queryKey' | 'queryFn' | 'enabled'>;
14
- /**
15
- * Canonical params shape for read-only `useQuery`-backed hooks in dapp-kit.
16
- *
17
- * Two top-level keys, always:
18
- * - `params`: SDK-feature-domain inputs (the "what" being fetched)
19
- * - `queryOptions`: React Query behavior knobs (the "how" the query behaves)
20
- *
21
- * For hooks with no required inputs, leave `TParams` at its default and accept the
22
- * whole params object as optional at the call site.
23
- */
24
- type ReadHookParams<TData, TParams = Record<string, never>, TError = Error> = {
25
- params?: TParams;
26
- queryOptions?: ReadQueryOptions<TData, TError>;
27
- };
28
- /**
29
- * Subset of `UseMutationOptions` consumers may override on dapp-kit mutation hooks.
30
- *
31
- * `mutationFn` is owned by the hook (it's the SDK integration point) and is
32
- * intentionally stripped here. Everything else — `mutationKey`, `retry`, `gcTime`,
33
- * `networkMode`, `onMutate`, `onSuccess`, `onError`, `onSettled`, `meta`, etc. —
34
- * is consumer-overridable.
35
- *
36
- * Conventions enforced by every dapp-kit mutation hook:
37
- *
38
- * 1. **`mutationFn` throws on SDK failure.** The SDK returns `Result<T>`; the hook
39
- * unwraps `result.value` on `ok` and throws `result.error` on `!ok`. So `TData`
40
- * here is the unwrapped success type, not `Result<T>`. React Query's native
41
- * error model — `isError`, `error`, `onError`, `retry`, `throwOnError`, devtools —
42
- * works exactly as documented.
43
- *
44
- * 2. **`onSuccess` is composed.** Hook-owned invalidations always run first; then
45
- * the hook awaits `mutationOptions?.onSuccess?.(data, vars, ctx)`. Per-call
46
- * `mutate(vars, { onSuccess })` runs after both, per TanStack Query's native
47
- * ordering. Because invalidations now live inside `onSuccess` (not `onSettled`),
48
- * they only fire on confirmed success — failed mutations never trigger them.
49
- *
50
- * 3. **A default `mutationKey` is set per hook** (e.g. `['mm', 'supply']`,
51
- * `['swap']`) so consumers can use `useIsMutating(['mm'])` and
52
- * `useMutationState` without guessing the key shape. The default is set
53
- * *before* `...mutationOptions` is spread, so consumers can override it.
54
- */
55
- type MutationHookOptions<TData, TVars, TError = Error, TContext = unknown> = Omit<UseMutationOptions<TData, TError, TVars, TContext>, 'mutationFn'>;
56
- /**
57
- * Canonical params shape for `useMutation`-backed hooks in dapp-kit.
58
- *
59
- * One top-level key:
60
- * - `mutationOptions`: React Query behavior knobs (the "how" the mutation behaves)
61
- *
62
- * Domain inputs (params, walletProvider, etc.) are NOT here — they belong in
63
- * `TVars` and flow through `mutate(vars)` so the call site can vary them per
64
- * invocation without re-rendering the hook.
65
- *
66
- * Always accept the whole params object as optional at the call site:
67
- * `useFoo({ mutationOptions } = {})`.
68
- */
69
- type MutationHookParams<TData, TVars, TError = Error, TContext = unknown> = {
70
- mutationOptions?: MutationHookOptions<TData, TVars, TError, TContext>;
71
- };
72
-
73
- /**
74
- * Translates the SDK's `Result<T>` contract into the React Query contract: returns `value` on
75
- * success, throws `error` on failure. Non-`Error` throwables are wrapped so consumers always get
76
- * an `Error` in `mutation.error` / catch blocks.
77
- *
78
- * Used by every dapp-kit mutation hook so the React Query error model (`isError`, `error`,
79
- * `onError`, `retry`, `throwOnError`, devtools) engages uniformly.
80
- */
81
- declare function unwrapResult<T>(result: Result<T>): T;
82
-
83
- /**
84
- * Return shape of every dapp-kit mutation hook. Extends `UseMutationResult` with one extra
85
- * method, `mutateAsyncSafe`, that never rejects — it returns the SDK's `Result<T>` shape so
86
- * callers can branch on `.ok` without `try/catch`.
87
- *
88
- * The underlying `mutationFn` still throws on SDK failure, so React Query's native error model
89
- * (`isError`, `error`, `onError`, `retry`, `throwOnError`, devtools) keeps working as documented.
90
- */
91
- type SafeUseMutationResult<TData, TError, TVars, TContext = unknown> = UseMutationResult<TData, TError, TVars, TContext> & {
92
- /**
93
- * Like `mutateAsync` but never rejects. Returns `Result<TData>` so callers can branch
94
- * on `.ok` without `try/catch`.
95
- *
96
- * Use this for imperative flows where rejection-style errors are awkward — e.g. sequential
97
- * `if (!hasAllowance) await approve(...); await action(...)` chains where the user-reject
98
- * case is the modal failure mode, not an exceptional one.
99
- */
100
- mutateAsyncSafe: (vars: TVars, options?: MutateOptions<TData, TError, TVars, TContext>) => Promise<Result<TData>>;
101
- };
102
- /**
103
- * Wraps a `Promise<T>` (typically `mutateAsync(vars)`) into a `Promise<Result<T>>` that never
104
- * rejects. Pure, side-effect-free — extracted for unit testing.
105
- */
106
- declare function toResult<T>(promise: Promise<T>): Promise<Result<T>>;
107
- /**
108
- * Drop-in replacement for `useMutation` that augments the result with `mutateAsyncSafe`. Used
109
- * by every dapp-kit mutation hook so consumers can pick rejection-style (`mutateAsync`) or
110
- * Result-style (`mutateAsyncSafe`) ergonomics without the hook author having to think about it.
111
- */
112
- declare function useSafeMutation<TData, TError, TVars, TContext = unknown>(options: UseMutationOptions<TData, TError, TVars, TContext>): SafeUseMutationResult<TData, TError, TVars, TContext>;
113
-
114
- interface SodaxContextType {
115
- sodax: Sodax;
116
- }
117
-
118
- /**
119
- * Hook to access the Sodax context which provides access to the Sodax SDK instance and chain configuration
120
- * @throws {Error} If used outside of a SodaxProvider
121
- * @returns {SodaxContextType} The Sodax context containing SDK instance and configuration
122
- */
123
- declare const useSodaxContext: () => SodaxContextType;
124
-
125
- declare function useEstimateGas<C extends SpokeChainKey>({ mutationOptions, }?: MutationHookParams<GetEstimateGasReturnType<C>, EstimateGasParams<C>>): SafeUseMutationResult<GetEstimateGasReturnType<C>, Error, EstimateGasParams<C>>;
126
-
127
- type UseDeriveUserWalletAddressParams = ReadHookParams<Address, {
128
- spokeChainId?: SpokeChainKey;
129
- spokeAddress?: string;
130
- }>;
131
- declare function useDeriveUserWalletAddress({ params, queryOptions, }?: UseDeriveUserWalletAddressParams): UseQueryResult<Address, Error>;
132
-
133
- type UseStellarTrustlineCheckParams = ReadHookParams<boolean, {
134
- token: string | undefined;
135
- amount: bigint | undefined;
136
- chainId: SpokeChainKey | undefined;
137
- walletProvider: IStellarWalletProvider | undefined;
138
- }>;
139
- declare function useStellarTrustlineCheck({ params, queryOptions, }?: UseStellarTrustlineCheckParams): UseQueryResult<boolean, Error>;
140
-
141
- declare function useRequestTrustline(token: string | undefined): {
142
- requestTrustline: (params: {
143
- token: string;
144
- amount: bigint;
145
- srcChainKey: StellarChainKey;
146
- walletProvider: IStellarWalletProvider;
147
- }) => Promise<string>;
148
- isLoading: boolean;
149
- isRequested: boolean;
150
- error: Error | null;
151
- data: string | null;
152
- };
153
-
154
- type UseGetUserHubWalletAddressParams = ReadHookParams<Address, {
155
- spokeChainId?: SpokeChainKey;
156
- spokeAddress?: string;
157
- }>;
158
- /**
159
- * Hook for deriving user wallet address for hub abstraction.
160
- *
161
- * This hook derives the user's abstracted wallet address for the hub chain based on the spoke chain ID and address.
162
- * If the spoke chain is the same as the hub chain, it returns the encoded spoke address.
163
- * Otherwise, it derives and returns the abstracted wallet address for cross-chain operations.
164
- * NOTE: This hook is different from useDeriveUserWalletAddress because it uses wallet router address instead of CREATE3 address for Sonic (hub).
165
- *
166
- * The query is automatically enabled when both `spokeChainId` and `spokeAddress` are provided.
167
- * This is a deterministic operation, so the result is cached and not refetched automatically.
168
- *
169
- * @example
170
- * ```typescript
171
- * const { data: derivedAddress, isLoading, error } = useGetUserHubWalletAddress({
172
- * params: { spokeChainId, spokeAddress: userAddress },
173
- * });
174
- * ```
175
- */
176
- declare function useGetUserHubWalletAddress({ params, queryOptions, }?: UseGetUserHubWalletAddressParams): UseQueryResult<Address, Error>;
177
-
178
- /**
179
- * Domain inputs for {@link useXBalances}. `xChainId` is optional so the hook can be mounted
180
- * before a chain is selected; `enabled` gates execution on every required field being present.
181
- */
182
- interface XBalancesInputs {
183
- xService: IXServiceBase | undefined;
184
- xChainId: SpokeChainKey | undefined;
185
- xTokens: readonly XToken[];
186
- address: string | undefined;
187
- }
188
- type UseXBalancesParams = ReadHookParams<Record<string, bigint>, XBalancesInputs>;
189
- /**
190
- * Pure builder for {@link useXBalances} query options. Exported for unit
191
- * tests and for advanced callers that compose their own `useQuery` wrapper.
192
- */
193
- 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];
195
- queryFn: () => Promise<Record<string, bigint>>;
196
- enabled: boolean;
197
- refetchInterval: number;
198
- };
199
- /**
200
- * Fetch token balances for multiple tokens on a specific chain. Returns an
201
- * object mapping each token's address to its balance in smallest unit.
202
- *
203
- * @example
204
- * ```tsx
205
- * const xService = useXService({ xChainType: getXChainType(xChainId) });
206
- * const { data: balances } = useXBalances({ params: { xService, xChainId, xTokens, address } });
207
- * ```
208
- */
209
- declare function useXBalances({ params, queryOptions, }?: UseXBalancesParams): UseQueryResult<Record<string, bigint>>;
210
-
211
- declare function useHubProvider(): EvmHubProvider;
212
-
213
- type RadfiSession = {
214
- accessToken: string;
215
- refreshToken: string;
216
- tradingAddress: string;
217
- publicKey: string;
218
- };
219
- type UseRadfiAuthVars = {
220
- walletProvider: IBitcoinWalletProvider;
221
- };
222
- type RadfiAuthResult = {
223
- accessToken: string;
224
- refreshToken: string;
225
- tradingAddress: string;
226
- };
227
- declare function saveRadfiSession(address: string, session: RadfiSession): void;
228
- declare function loadRadfiSession(address: string): RadfiSession | null;
229
- declare function clearRadfiSession(address: string): void;
230
- /**
231
- * React hook for authenticating with Radfi via BIP322-signed message. Pure mutation: pass
232
- * `{ walletProvider }` to `mutate({...})`. The hook itself takes no arguments other than the
233
- * structural `mutationOptions` slot.
234
- */
235
- declare function useRadfiAuth({ mutationOptions, }?: MutationHookParams<RadfiAuthResult, UseRadfiAuthVars>): SafeUseMutationResult<RadfiAuthResult, Error, UseRadfiAuthVars>;
236
-
237
- type UseRadfiSessionReturn = {
238
- walletAddress: string | undefined;
239
- isAuthed: boolean;
240
- tradingAddress: string | undefined;
241
- login: () => Promise<void>;
242
- isLoginPending: boolean;
243
- };
244
- declare function useRadfiSession(walletProvider: IBitcoinWalletProvider | undefined): UseRadfiSessionReturn;
245
-
246
- type UseFundTradingWalletVars = {
247
- amount: bigint;
248
- walletProvider: IBitcoinWalletProvider;
249
- };
250
- /**
251
- * React hook for funding the user's Radfi trading wallet from their personal Bitcoin wallet.
252
- * Pure mutation: pass `{ amount, walletProvider }` to `mutate({...})`. Returns the broadcast tx
253
- * id on success.
254
- */
255
- declare function useFundTradingWallet({ mutationOptions, }?: MutationHookParams<string, UseFundTradingWalletVars>): SafeUseMutationResult<string, Error, UseFundTradingWalletVars>;
256
-
257
- type UseBitcoinBalanceParams = ReadHookParams<bigint, {
258
- address: string | undefined;
259
- rpcUrl?: string;
260
- }>;
261
- /**
262
- * Hook to fetch BTC balance for any Bitcoin address.
263
- * Sums all UTXOs (confirmed + unconfirmed) from mempool.space API.
264
- *
265
- * The UTXO set already excludes spent outputs (even from unconfirmed txs),
266
- * so the total is always the correct spendable balance.
267
- */
268
- declare function useBitcoinBalance({ params, queryOptions, }?: UseBitcoinBalanceParams): UseQueryResult<bigint, Error>;
269
-
270
- type UseTradingWalletReturn = {
271
- tradingAddress: string | undefined;
272
- };
273
- /**
274
- * Returns the Radfi trading wallet address from the persisted session.
275
- * Trading wallet is created automatically during authentication — no API call needed.
276
- */
277
- declare function useTradingWallet(walletAddress: string | undefined): UseTradingWalletReturn;
278
-
279
- type UseTradingWalletBalanceParams = ReadHookParams<RadfiWalletBalance, {
280
- walletProvider: IBitcoinWalletProvider | undefined;
281
- tradingAddress: string | undefined;
282
- }>;
283
- declare function useTradingWalletBalance({ params, queryOptions, }?: UseTradingWalletBalanceParams): UseQueryResult<RadfiWalletBalance, Error>;
284
-
285
- type UseExpiredUtxosParams = ReadHookParams<RadfiUtxo[], {
286
- walletProvider: IBitcoinWalletProvider | undefined;
287
- tradingAddress: string | undefined;
288
- }>;
289
- declare function useExpiredUtxos({ params, queryOptions, }?: UseExpiredUtxosParams): UseQueryResult<RadfiUtxo[], Error>;
290
-
291
- type UseRenewUtxosVars = {
292
- txIdVouts: string[];
293
- walletProvider: IBitcoinWalletProvider;
294
- };
295
- /**
296
- * React hook for renewing expired UTXOs in the user's Radfi trading wallet. Pure mutation: pass
297
- * `{ txIdVouts, walletProvider }` to `mutate({...})`.
298
- */
299
- declare function useRenewUtxos({ mutationOptions, }?: MutationHookParams<string, UseRenewUtxosVars>): SafeUseMutationResult<string, Error, UseRenewUtxosVars>;
300
-
301
- type UseRadfiWithdrawVars = {
302
- amount: string;
303
- tokenId: string;
304
- withdrawTo: string;
305
- walletProvider: IBitcoinWalletProvider;
306
- };
307
- type WithdrawResult = {
308
- txId: string;
309
- fee: number;
310
- };
311
- /**
312
- * React hook for withdrawing BTC from the user's Radfi trading wallet back to their personal
313
- * Bitcoin wallet. Pure mutation: pass all inputs (including the wallet provider) to
314
- * `mutate({...})`.
315
- */
316
- declare function useRadfiWithdraw({ mutationOptions, }?: MutationHookParams<WithdrawResult, UseRadfiWithdrawVars>): SafeUseMutationResult<WithdrawResult, Error, UseRadfiWithdrawVars>;
317
-
318
- /**
319
- * Mutation variables for {@link useBorrow}. Generic over `K extends SpokeChainKey` (defaults to
320
- * the full union). Sophisticated callers can lock K at the hook call site to narrow the
321
- * `walletProvider` and `params.srcChainKey` types.
322
- */
323
- type UseBorrowVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketBorrowActionParams<K, false>, 'raw'>;
324
- /**
325
- * React hook for borrowing tokens from the Sodax money market protocol.
326
- *
327
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
328
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
329
- */
330
- declare function useBorrow<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseBorrowVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseBorrowVars<K>>;
331
-
332
- /**
333
- * Mutation variables for {@link useRepay}. Generic over `K extends SpokeChainKey` (defaults to
334
- * the full union). Sophisticated callers can lock K at the hook call site to narrow the
335
- * `walletProvider` and `params.srcChainKey` types.
336
- */
337
- type UseRepayVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketRepayActionParams<K, false>, 'raw'>;
338
- /**
339
- * React hook for repaying a borrow in the Sodax money market protocol.
340
- *
341
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
342
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
343
- */
344
- declare function useRepay<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseRepayVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseRepayVars<K>>;
345
-
346
- /**
347
- * Mutation variables for {@link useSupply}. Generic over `K extends SpokeChainKey` (defaults to
348
- * the full union). Sophisticated callers can lock K at the hook call site to narrow the
349
- * `walletProvider` and `params.srcChainKey` types.
350
- */
351
- type UseSupplyVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketSupplyActionParams<K, false>, 'raw'>;
352
- /**
353
- * React hook for supplying tokens to the Sodax money market protocol.
354
- *
355
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
356
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
357
- *
358
- * @example
359
- * ```tsx
360
- * const walletProvider = useWalletProvider({ xChainId: chainKey });
361
- * const { mutateAsync: supply, isError, error } = useSupply();
362
- * if (!walletProvider) return;
363
- * try {
364
- * const { spokeTxHash, hubTxHash } = await supply({ params: supplyParams, walletProvider });
365
- * } catch (e) {
366
- * // surfaced via mutation.error / onError
367
- * }
368
- * ```
369
- */
370
- declare function useSupply<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseSupplyVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseSupplyVars<K>>;
371
-
372
- /**
373
- * Mutation variables for {@link useWithdraw}. Generic over `K extends SpokeChainKey` (defaults to
374
- * the full union). Sophisticated callers can lock K at the hook call site to narrow the
375
- * `walletProvider` and `params.srcChainKey` types.
376
- */
377
- type UseWithdrawVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketWithdrawActionParams<K, false>, 'raw'>;
378
- /**
379
- * React hook for withdrawing supplied tokens from the Sodax money market protocol.
380
- *
381
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
382
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
383
- */
384
- declare function useWithdraw<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseWithdrawVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseWithdrawVars<K>>;
385
-
386
- type UseUserReservesDataParams = ReadHookParams<readonly [readonly UserReserveData[], number], {
387
- spokeChainKey: SpokeChainKey | undefined;
388
- userAddress: string | undefined;
389
- }>;
390
- /**
391
- * React hook for fetching the raw user reserves data (positions on the hub) for a given spoke
392
- * chain and user address.
393
- */
394
- declare function useUserReservesData({ params, queryOptions, }?: UseUserReservesDataParams): UseQueryResult<readonly [readonly UserReserveData[], number], Error>;
395
-
396
- type UseReservesDataParams = ReadHookParams<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo]>;
397
- /**
398
- * React hook for fetching the latest aggregated reserves data and base-currency info from the
399
- * Sodax money market.
400
- */
401
- declare function useReservesData({ queryOptions, }?: UseReservesDataParams): UseQueryResult<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo], Error>;
402
-
403
- type UseReservesHumanizedParams = ReadHookParams<ReservesDataHumanized>;
404
- /**
405
- * React hook for fetching the human-readable (decimal-normalized, string-formatted) reserves
406
- * snapshot from the Sodax money market.
407
- */
408
- declare function useReservesHumanized({ queryOptions, }?: UseReservesHumanizedParams): UseQueryResult<ReservesDataHumanized, Error>;
409
-
410
- type UseReservesListParams = ReadHookParams<readonly Address$1[]>;
411
- /**
412
- * React hook for fetching the list of reserve asset addresses currently registered in the
413
- * Sodax money market.
414
- */
415
- declare function useReservesList({ queryOptions, }?: UseReservesListParams): UseQueryResult<readonly Address$1[], Error>;
416
-
417
- type UseMMAllowanceParams<K extends SpokeChainKey> = ReadHookParams<boolean, {
418
- payload: MoneyMarketParams<K> | undefined;
419
- }>;
420
- /**
421
- * Hook for checking token allowance / trustline sufficiency for money market operations.
422
- *
423
- * Skips the on-chain check entirely for `borrow` and `withdraw` actions — those don't require
424
- * approval, and the SDK already short-circuits to `true` for them. The early `enabled: false`
425
- * here additionally avoids a render flash with `isLoading: true`.
426
- *
427
- * The query key matches the invalidation keys emitted by `useMMApprove` and the four mutation
428
- * hooks: `['mm', 'allowance', srcChainKey, token, action]`.
429
- *
430
- * @example
431
- * ```tsx
432
- * const { data: hasAllowance } = useMMAllowance({ params: { payload: supplyParams } });
433
- * ```
434
- */
435
- declare function useMMAllowance<K extends SpokeChainKey>({ params, queryOptions, }?: UseMMAllowanceParams<K>): UseQueryResult<boolean, Error>;
436
-
437
- /**
438
- * Mutation variables for {@link useMMApprove}. Generic over `K extends SpokeChainKey` (defaults
439
- * to the full union). Sophisticated callers can lock K at the hook call site to narrow the
440
- * `walletProvider` and `params.srcChainKey` types.
441
- */
442
- type UseMMApproveVars<K extends SpokeChainKey = SpokeChainKey> = Omit<MoneyMarketApproveActionParams<K, false>, 'raw'>;
443
- /**
444
- * React hook for approving ERC-20 token spending (or trustline establishment) for a Sodax money
445
- * market action.
446
- *
447
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
448
- * `onError`, `retry`). Returns the unwrapped tx return value on success. Invalidates the matching
449
- * `['mm', 'allowance', srcChainKey, token, action]` query on confirmed success.
450
- */
451
- declare function useMMApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseMMApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseMMApproveVars<K>>;
452
-
453
- type ATokenData = Erc20Token & {
454
- chainKey: ChainKey;
455
- };
456
- type UseATokenParams = ReadHookParams<ATokenData, {
457
- aToken: Address | string | undefined;
458
- }>;
459
- /**
460
- * React hook to fetch ERC-20 metadata for a given aToken address on the hub chain.
461
- * Returns `Erc20Token` (`name`, `symbol`, `decimals`, `address`) augmented with the hub
462
- * `chainKey`. Note: the returned shape is a subset of `XToken` — `hubAsset` and `vault` fields
463
- * must be resolved separately if needed.
464
- */
465
- declare function useAToken({ params, queryOptions }?: UseATokenParams): UseQueryResult<ATokenData, Error>;
466
-
467
- type UseATokensBalancesParams = ReadHookParams<Map<Address, bigint>, {
468
- aTokens: readonly Address[];
469
- spokeChainKey: SpokeChainKey | undefined;
470
- userAddress: string | undefined;
471
- }>;
472
- /**
473
- * React hook to fetch aToken balances for a list of addresses in a single multicall.
474
- * Derives the user's hub wallet via `EvmHubProvider.getUserHubWalletAddress` from the
475
- * spoke `chainKey` + spoke wallet `userAddress`.
476
- */
477
- declare function useATokensBalances({ params, queryOptions, }?: UseATokensBalancesParams): UseQueryResult<Map<Address, bigint>, Error>;
478
-
479
- type ReserveUsdFormat = ReserveDataHumanized & FormatReserveUSDResponse;
480
- type UseReservesUsdFormatParams = ReadHookParams<ReserveUsdFormat[]>;
481
- /**
482
- * React hook returning reserves with USD-formatted values for the Sodax money market.
483
- * Chains `getReservesHumanized` → `buildReserveDataWithPrice` → `formatReservesUSD`.
484
- */
485
- declare function useReservesUsdFormat({ queryOptions, }?: UseReservesUsdFormatParams): UseQueryResult<ReserveUsdFormat[], Error>;
486
-
487
- type UseUserFormattedSummaryParams = ReadHookParams<FormatUserSummaryResponse<FormatReserveUSDResponse>, {
488
- spokeChainKey: SpokeChainKey | undefined;
489
- userAddress: string | undefined;
490
- }>;
491
- /**
492
- * React hook returning the user's formatted money market portfolio summary (collateral, borrows,
493
- * health factor, available borrow power, etc.) for the given spoke chain.
494
- *
495
- * Internally chains `getReservesHumanized` → `formatReservesUSD` → `getUserReservesHumanized`
496
- * → `formatUserSummary`.
497
- */
498
- declare function useUserFormattedSummary({ params, queryOptions, }?: UseUserFormattedSummaryParams): UseQueryResult<FormatUserSummaryResponse<FormatReserveUSDResponse>, Error>;
499
-
500
- type UseQuoteParams = ReadHookParams<Result<SolverIntentQuoteResponse, SolverErrorResponse> | undefined, {
501
- payload: SolverIntentQuoteRequest | undefined;
502
- }>;
503
- /**
504
- * Hook for fetching a quote for an intent-based swap.
505
- *
506
- * @example
507
- * ```typescript
508
- * const { data: quote, isLoading } = useQuote({ params: { payload } });
509
- * ```
510
- *
511
- * @remarks
512
- * - The quote is automatically refreshed every 3 seconds
513
- * - The query is disabled when payload is undefined
514
- */
515
- declare const useQuote: ({ params, queryOptions, }?: UseQuoteParams) => UseQueryResult<Result<SolverIntentQuoteResponse, SolverErrorResponse> | undefined>;
516
-
517
- /**
518
- * Mutation variables for {@link useSwap}. Generic over `K extends SpokeChainKey` (defaults to the
519
- * full union). Sophisticated callers can lock K at the hook call site to narrow the
520
- * `walletProvider` and `params.srcChainKey` types.
521
- */
522
- type UseSwapVars<K extends SpokeChainKey = SpokeChainKey> = Omit<SwapActionParams<K, false>, 'raw'>;
523
- /**
524
- * React hook for executing an intent-based cross-chain swap.
525
- *
526
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
527
- * `onError`, `retry`). Returns the unwrapped `SwapResponse` on success.
528
- */
529
- declare function useSwap<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<SwapResponse, UseSwapVars<K>>): SafeUseMutationResult<SwapResponse, Error, UseSwapVars<K>>;
530
-
531
- type UseStatusParams = ReadHookParams<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined, {
532
- intentTxHash: Hex | undefined;
533
- }>;
534
- /**
535
- * Hook for monitoring the status of an intent-based swap.
536
- *
537
- * @example
538
- * ```typescript
539
- * const { data: status, isLoading } = useStatus({ params: { intentTxHash } });
540
- * ```
541
- */
542
- declare const useStatus: ({ params, queryOptions, }?: UseStatusParams) => UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>;
543
-
544
- type UseSwapAllowanceParams<K extends SpokeChainKey> = ReadHookParams<boolean, {
545
- payload: CreateIntentParams | CreateLimitOrderParams | undefined;
546
- srcChainKey: K | undefined;
547
- walletProvider: GetWalletProviderType<K> | undefined;
548
- }>;
549
- declare function useSwapAllowance<K extends SpokeChainKey>({ params, queryOptions, }?: UseSwapAllowanceParams<K>): UseQueryResult<boolean, Error>;
550
-
551
- /**
552
- * Mutation variables for {@link useSwapApprove}. Generic over `K extends SpokeChainKey` (defaults
553
- * to the full union). Sophisticated callers can lock K at the call site to narrow the
554
- * `walletProvider` and `params.srcChainKey` types.
555
- */
556
- type UseSwapApproveVars<K extends SpokeChainKey = SpokeChainKey> = {
557
- params: CreateIntentParams<K> | CreateLimitOrderParams<K>;
558
- walletProvider: GetWalletProviderType<K>;
559
- };
560
- /**
561
- * React hook for approving ERC-20 token spending (or trustline establishment) for a swap or
562
- * limit-order intent.
563
- *
564
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
565
- * `onError`, `retry`). Returns the unwrapped tx return value on success. Invalidates all
566
- * `['swap', 'allowance', ...]` queries so any pending allowance check refreshes.
567
- */
568
- declare function useSwapApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseSwapApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseSwapApproveVars<K>>;
569
-
570
- type CancelIntentParams<K extends SpokeChainKey = SpokeChainKey> = {
571
- srcChainKey: K;
572
- walletProvider: GetWalletProviderType<K>;
573
- intent: Intent;
574
- };
575
- /**
576
- * React hook for cancelling an in-flight swap intent.
577
- *
578
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
579
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
580
- */
581
- declare function useCancelSwap({ mutationOptions, }?: MutationHookParams<TxHashPair, CancelIntentParams>): SafeUseMutationResult<TxHashPair, Error, CancelIntentParams>;
582
-
583
- /**
584
- * Mutation variables for {@link useCreateLimitOrder}. Generic over `K extends SpokeChainKey`
585
- * (defaults to the full union). Sophisticated callers can lock K at the call site to narrow the
586
- * `walletProvider` and `params.srcChainKey` types.
587
- */
588
- type UseCreateLimitOrderVars<K extends SpokeChainKey = SpokeChainKey> = Omit<LimitOrderActionParams<K, false>, 'raw'>;
589
- /**
590
- * React hook for creating a limit-order intent (no deadline).
591
- *
592
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
593
- * `onError`, `retry`). Returns the unwrapped `SwapResponse` on success.
594
- */
595
- declare function useCreateLimitOrder<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<SwapResponse, UseCreateLimitOrderVars<K>>): SafeUseMutationResult<SwapResponse, Error, UseCreateLimitOrderVars<K>>;
596
-
597
- type CancelLimitOrderParams<K extends SpokeChainKey = SpokeChainKey> = {
598
- srcChainKey: K;
599
- walletProvider: GetWalletProviderType<K>;
600
- intent: Intent;
601
- timeout?: number;
602
- };
603
- /**
604
- * React hook for cancelling a limit-order intent.
605
- *
606
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
607
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
608
- */
609
- declare function useCancelLimitOrder({ mutationOptions, }?: MutationHookParams<TxHashPair, CancelLimitOrderParams>): SafeUseMutationResult<TxHashPair, Error, CancelLimitOrderParams>;
610
-
611
- type UseBackendIntentByTxHashParams = ReadHookParams<IntentResponse | undefined, {
612
- txHash: string | undefined;
613
- }>;
614
- /**
615
- * React hook for fetching intent details from the backend API using a transaction hash.
616
- *
617
- * @example
618
- * const { data: intent } = useBackendIntentByTxHash({ params: { txHash: '0x123...' } });
619
- *
620
- * @remarks
621
- * - Intents are only created on the hub chain, so `txHash` must originate from there.
622
- * - Default refetch interval is 1 second.
623
- */
624
- declare const useBackendIntentByTxHash: ({ params, queryOptions, }?: UseBackendIntentByTxHashParams) => UseQueryResult<IntentResponse | undefined, Error>;
625
-
626
- type UseBackendIntentByHashParams = ReadHookParams<IntentResponse | undefined, {
627
- intentHash: string | undefined;
628
- }>;
629
- /**
630
- * React hook to fetch intent details from the backend API using an intent hash.
631
- *
632
- * @example
633
- * const { data: intent } = useBackendIntentByHash({ params: { intentHash: '0xabc...' } });
634
- */
635
- declare const useBackendIntentByHash: ({ params, queryOptions, }?: UseBackendIntentByHashParams) => UseQueryResult<IntentResponse | undefined, Error>;
636
-
637
- type UseBackendUserIntentsParams = ReadHookParams<UserIntentsResponse | undefined, {
638
- userAddress: Address$1 | undefined;
639
- startDate?: number;
640
- endDate?: number;
641
- }>;
642
- /**
643
- * React hook for fetching user-created intents from the backend API for a given user address.
644
- *
645
- * @example
646
- * const { data: userIntents } = useBackendUserIntents({
647
- * params: { userAddress: '0x123...' },
648
- * });
649
- */
650
- declare const useBackendUserIntents: ({ params, queryOptions, }?: UseBackendUserIntentsParams) => UseQueryResult<UserIntentsResponse | undefined, Error>;
651
-
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
- type BackendPaginationParams = {
697
- offset: string;
698
- limit: string;
699
- };
700
-
701
- type UseBackendOrderbookParams = ReadHookParams<OrderbookResponse, {
702
- pagination: BackendPaginationParams;
703
- }>;
704
- /**
705
- * Hook for fetching the solver orderbook from the backend API.
706
- *
707
- * @example
708
- * const { data } = useBackendOrderbook({ params: { pagination: { offset: '0', limit: '10' } } });
709
- */
710
- declare const useBackendOrderbook: ({ params, queryOptions, }?: UseBackendOrderbookParams) => UseQueryResult<OrderbookResponse>;
711
-
712
- type UseBackendMoneyMarketPositionParams = ReadHookParams<MoneyMarketPosition | undefined, {
713
- userAddress: string | undefined;
714
- }>;
715
- /**
716
- * React hook for fetching a user's money market position from the backend API.
717
- *
718
- * @example
719
- * const { data } = useBackendMoneyMarketPosition({ params: { userAddress: '0xabc...' } });
720
- */
721
- declare const useBackendMoneyMarketPosition: ({ params, queryOptions, }?: UseBackendMoneyMarketPositionParams) => UseQueryResult<MoneyMarketPosition | undefined, Error>;
722
-
723
- type UseBackendAllMoneyMarketAssetsParams = ReadHookParams<MoneyMarketAsset[]>;
724
- /**
725
- * React hook to fetch all money market assets from the backend API.
726
- *
727
- * @example
728
- * const { data: assets, isLoading, error } = useBackendAllMoneyMarketAssets();
729
- */
730
- declare const useBackendAllMoneyMarketAssets: ({ queryOptions, }?: UseBackendAllMoneyMarketAssetsParams) => UseQueryResult<MoneyMarketAsset[], Error>;
731
-
732
- type UseBackendMoneyMarketAssetParams = ReadHookParams<MoneyMarketAsset | undefined, {
733
- reserveAddress: string | undefined;
734
- }>;
735
- /**
736
- * React hook to fetch a specific money market asset from the backend API.
737
- *
738
- * @example
739
- * const { data: asset } = useBackendMoneyMarketAsset({ params: { reserveAddress: '0xabc...' } });
740
- */
741
- declare const useBackendMoneyMarketAsset: ({ params, queryOptions, }?: UseBackendMoneyMarketAssetParams) => UseQueryResult<MoneyMarketAsset | undefined, Error>;
742
-
743
- type UseBackendMoneyMarketAssetBorrowersParams = ReadHookParams<MoneyMarketAssetBorrowers | undefined, {
744
- reserveAddress: string | undefined;
745
- pagination: BackendPaginationParams;
746
- }>;
747
- /**
748
- * React hook for fetching borrowers for a specific money market asset from the backend API with pagination.
749
- *
750
- * @example
751
- * const { data: borrowers } = useBackendMoneyMarketAssetBorrowers({
752
- * params: { reserveAddress: '0xabc...', pagination: { offset: '0', limit: '20' } },
753
- * });
754
- */
755
- declare const useBackendMoneyMarketAssetBorrowers: ({ params, queryOptions, }?: UseBackendMoneyMarketAssetBorrowersParams) => UseQueryResult<MoneyMarketAssetBorrowers | undefined, Error>;
756
-
757
- type UseBackendMoneyMarketAssetSuppliersParams = ReadHookParams<MoneyMarketAssetSuppliers | undefined, {
758
- reserveAddress: string | undefined;
759
- pagination: BackendPaginationParams;
760
- }>;
761
- /**
762
- * React hook for fetching suppliers for a specific money market asset from the backend API.
763
- *
764
- * @example
765
- * const { data: suppliers } = useBackendMoneyMarketAssetSuppliers({
766
- * params: { reserveAddress: '0xabc...', pagination: { offset: '0', limit: '20' } },
767
- * });
768
- */
769
- declare const useBackendMoneyMarketAssetSuppliers: ({ params, queryOptions, }?: UseBackendMoneyMarketAssetSuppliersParams) => UseQueryResult<MoneyMarketAssetSuppliers | undefined, Error>;
770
-
771
- type UseBackendAllMoneyMarketBorrowersParams = ReadHookParams<MoneyMarketBorrowers | undefined, {
772
- pagination: BackendPaginationParams;
773
- }>;
774
- /**
775
- * Hook for fetching all money market borrowers from the backend API.
776
- *
777
- * @example
778
- * ```typescript
779
- * const { data, isLoading, error } = useBackendAllMoneyMarketBorrowers({
780
- * params: { pagination: { offset: '0', limit: '50' } },
781
- * });
782
- * ```
783
- */
784
- declare const useBackendAllMoneyMarketBorrowers: ({ params, queryOptions, }?: UseBackendAllMoneyMarketBorrowersParams) => UseQueryResult<MoneyMarketBorrowers | undefined>;
785
-
786
- /**
787
- * Mutation variables for {@link useBridge}. Generic over `K extends SpokeChainKey` (defaults to
788
- * the full union). Sophisticated callers can lock K at the hook call site to narrow the
789
- * `walletProvider` and `params.srcChainKey` types.
790
- */
791
- type UseBridgeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<BridgeParams<K, false>, 'raw'>;
792
- /**
793
- * React hook for executing a cross-chain bridge transfer.
794
- *
795
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
796
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
797
- */
798
- declare function useBridge<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseBridgeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseBridgeVars<K>>;
799
-
800
- type UseBridgeAllowanceParams<K extends SpokeChainKey> = ReadHookParams<boolean, {
801
- payload: CreateBridgeIntentParams<K> | undefined;
802
- walletProvider: GetWalletProviderType<K> | undefined;
803
- }>;
804
- declare function useBridgeAllowance<K extends SpokeChainKey>({ params, queryOptions, }?: UseBridgeAllowanceParams<K>): UseQueryResult<boolean, Error>;
805
-
806
- /**
807
- * Mutation variables for {@link useBridgeApprove}. Generic over `K extends SpokeChainKey`
808
- * (defaults to the full union). Sophisticated callers can lock K at the hook call site to narrow
809
- * the `walletProvider` and `params.srcChainKey` types.
810
- */
811
- type UseBridgeApproveVars<K extends SpokeChainKey = SpokeChainKey> = Omit<BridgeParams<K, false>, 'raw'>;
812
- /**
813
- * React hook for approving ERC-20 token spending (or trustline establishment) for a bridge
814
- * action.
815
- *
816
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
817
- * `onError`, `retry`). Returns the unwrapped tx return value on success. Invalidates all
818
- * `['bridge', 'allowance', ...]` queries so any pending allowance check refreshes.
819
- */
820
- declare function useBridgeApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseBridgeApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseBridgeApproveVars<K>>;
821
-
822
- type UseGetBridgeableAmountParams = ReadHookParams<BridgeLimit, {
823
- from: XToken | undefined;
824
- to: XToken | undefined;
825
- }>;
826
- declare function useGetBridgeableAmount({ params, queryOptions, }?: UseGetBridgeableAmountParams): UseQueryResult<BridgeLimit, Error>;
827
-
828
- type UseGetBridgeableTokensParams = ReadHookParams<XToken[], {
829
- from: SpokeChainKey | undefined;
830
- to: SpokeChainKey | undefined;
831
- token: string | undefined;
832
- }>;
833
- declare function useGetBridgeableTokens({ params, queryOptions, }?: UseGetBridgeableTokensParams): UseQueryResult<XToken[], Error>;
834
-
835
- /**
836
- * Mutation variables for {@link useStake}. Generic over `K extends SpokeChainKey` (defaults to
837
- * the full union). Sophisticated callers can lock K at the hook call site to narrow the
838
- * `walletProvider` and `params.srcChainKey` types.
839
- */
840
- type UseStakeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<StakeAction<K, false>, 'raw'>;
841
- /**
842
- * React hook for staking SODA tokens.
843
- *
844
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
845
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
846
- */
847
- declare function useStake<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseStakeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseStakeVars<K>>;
848
-
849
- /**
850
- * Mutation variables for {@link useStakeApprove}. The `action` literal is injected by the hook —
851
- * callers pass the stake-specific fields only.
852
- */
853
- type UseStakeApproveVars<K extends SpokeChainKey = SpokeChainKey> = {
854
- params: Omit<StakeParams<K>, 'action'>;
855
- walletProvider: GetWalletProviderType<K>;
856
- };
857
- /**
858
- * React hook for approving SODA spending on the stake action.
859
- *
860
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
861
- * `onError`, `retry`). Returns the unwrapped tx return value on success.
862
- */
863
- declare function useStakeApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseStakeApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseStakeApproveVars<K>>;
864
-
865
- type UseStakeAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, {
866
- payload: Omit<StakeParams<K>, 'action'> | undefined;
867
- }>;
868
- /**
869
- * React hook to check whether the user has approved sufficient SODA spending for the stake
870
- * action. Read-only — calls `staking.isAllowanceValid` with `raw: true` so no `walletProvider`
871
- * is required.
872
- */
873
- declare function useStakeAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseStakeAllowanceParams<K>): UseQueryResult<boolean, Error>;
874
-
875
- type UseUnstakeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<UnstakeAction<K, false>, 'raw'>;
876
- /**
877
- * React hook for initiating an SODA unstake.
878
- *
879
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
880
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
881
- */
882
- declare function useUnstake<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseUnstakeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseUnstakeVars<K>>;
883
-
884
- type UseClaimVars<K extends SpokeChainKey = SpokeChainKey> = Omit<ClaimAction<K, false>, 'raw'>;
885
- /**
886
- * React hook for claiming an unstaked SODA request that has reached the end of its waiting period.
887
- *
888
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
889
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
890
- */
891
- declare function useClaim<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseClaimVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseClaimVars<K>>;
892
-
893
- type UseCancelUnstakeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<CancelUnstakeAction<K, false>, 'raw'>;
894
- /**
895
- * React hook for cancelling a pending unstake request.
896
- *
897
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
898
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
899
- */
900
- declare function useCancelUnstake<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseCancelUnstakeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseCancelUnstakeVars<K>>;
901
-
902
- type UseStakingInfoParams = ReadHookParams<StakingInfo, {
903
- srcAddress: `0x${string}` | undefined;
904
- srcChainKey: SpokeChainKey | undefined;
905
- }>;
906
- /**
907
- * React hook to fetch the user's staking info (xSODA balance, share value, underlying SODA) by
908
- * deriving the hub wallet from the spoke `srcAddress` + `srcChainKey`. Throws on `!ok` so React
909
- * Query lands in `error` state.
910
- */
911
- declare function useStakingInfo({ params, queryOptions }?: UseStakingInfoParams): UseQueryResult<StakingInfo, Error>;
912
-
913
- type UnstakingInfoWithPenalty = UnstakingInfo & {
914
- requestsWithPenalty: UnstakeRequestWithPenalty[];
915
- };
916
- type UseUnstakingInfoWithPenaltyParams = ReadHookParams<UnstakingInfoWithPenalty, {
917
- srcAddress: `0x${string}` | undefined;
918
- srcChainKey: SpokeChainKey | undefined;
919
- }>;
920
- /**
921
- * React hook to fetch the user's pending unstake requests **with computed early-exit penalties**
922
- * by deriving the hub wallet from the spoke `srcAddress` + `srcChainKey`. Throws on `!ok`.
923
- */
924
- declare function useUnstakingInfoWithPenalty({ params, queryOptions, }?: UseUnstakingInfoWithPenaltyParams): UseQueryResult<UnstakingInfoWithPenalty, Error>;
925
-
926
- type UseStakingConfigParams = ReadHookParams<StakingConfig>;
927
- /**
928
- * React hook to fetch the global staking config (unstaking period, min unstaking period, max
929
- * penalty). Hub-only read; no chain context required. Throws on `!ok`.
930
- */
931
- declare function useStakingConfig({ queryOptions, }?: UseStakingConfigParams): UseQueryResult<StakingConfig, Error>;
932
-
933
- type UseStakeRatioParams = ReadHookParams<[
934
- bigint,
935
- bigint
936
- ], {
937
- amount: bigint | undefined;
938
- }>;
939
- /**
940
- * React hook to estimate the SODA → xSODA stake ratio for a given amount. Hub-only read. Throws
941
- * on `!ok`.
942
- */
943
- declare function useStakeRatio({ params, queryOptions, }?: UseStakeRatioParams): UseQueryResult<[bigint, bigint], Error>;
944
-
945
- type UseInstantUnstakeRatioParams = ReadHookParams<bigint, {
946
- amount: bigint | undefined;
947
- }>;
948
- /**
949
- * React hook to estimate the SODA amount received from instant-unstaking a given xSODA amount
950
- * (after slippage). Hub-only read. Throws on `!ok`.
951
- */
952
- declare function useInstantUnstakeRatio({ params, queryOptions, }?: UseInstantUnstakeRatioParams): UseQueryResult<bigint, Error>;
953
-
954
- type UseConvertedAssetsParams = ReadHookParams<bigint, {
955
- amount: bigint | undefined;
956
- }>;
957
- /**
958
- * React hook to convert an xSODA share amount to its underlying SODA value via the vault's
959
- * exchange rate. Hub-only read. Throws on `!ok`.
960
- */
961
- declare function useConvertedAssets({ params, queryOptions, }?: UseConvertedAssetsParams): UseQueryResult<bigint, Error>;
962
-
963
- type UseInstantUnstakeVars<K extends SpokeChainKey = SpokeChainKey> = Omit<InstantUnstakeAction<K, false>, 'raw'>;
964
- /**
965
- * React hook for instant-unstaking SODA (bypassing the waiting period at a slippage cost).
966
- *
967
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
968
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
969
- */
970
- declare function useInstantUnstake<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseInstantUnstakeVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseInstantUnstakeVars<K>>;
971
-
972
- type UseUnstakeAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, {
973
- payload: Omit<UnstakeParams<K>, 'action'> | undefined;
974
- }>;
975
- /**
976
- * React hook to check whether the user has approved sufficient xSODA spending for the unstake
977
- * action. Read-only — calls `staking.isAllowanceValid` with `raw: true` so no `walletProvider`
978
- * is required.
979
- */
980
- declare function useUnstakeAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseUnstakeAllowanceParams<K>): UseQueryResult<boolean, Error>;
981
-
982
- /**
983
- * Mutation variables for {@link useUnstakeApprove}. The `action` literal is injected by the hook.
984
- */
985
- type UseUnstakeApproveVars<K extends SpokeChainKey = SpokeChainKey> = {
986
- params: Omit<UnstakeParams<K>, 'action'>;
987
- walletProvider: GetWalletProviderType<K>;
988
- };
989
- /**
990
- * React hook for approving xSODA spending on the unstake action.
991
- *
992
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
993
- * `onError`, `retry`). Returns the unwrapped tx return value on success.
994
- */
995
- declare function useUnstakeApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseUnstakeApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseUnstakeApproveVars<K>>;
996
-
997
- type UseUnstakingInfoParams = ReadHookParams<UnstakingInfo, {
998
- srcAddress: `0x${string}` | undefined;
999
- srcChainKey: SpokeChainKey | undefined;
1000
- }>;
1001
- /**
1002
- * React hook to fetch the user's pending unstake requests by deriving the hub wallet from the
1003
- * spoke `srcAddress` + `srcChainKey`. Throws on `!ok`.
1004
- */
1005
- declare function useUnstakingInfo({ params, queryOptions, }?: UseUnstakingInfoParams): UseQueryResult<UnstakingInfo, Error>;
1006
-
1007
- /**
1008
- * Mutation variables for {@link useInstantUnstakeApprove}. The `action` literal is injected by
1009
- * the hook.
1010
- */
1011
- type UseInstantUnstakeApproveVars<K extends SpokeChainKey = SpokeChainKey> = {
1012
- params: Omit<InstantUnstakeParams<K>, 'action'>;
1013
- walletProvider: GetWalletProviderType<K>;
1014
- };
1015
- /**
1016
- * React hook for approving xSODA spending on the instant-unstake action.
1017
- *
1018
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1019
- * `onError`, `retry`). Returns the unwrapped tx return value on success.
1020
- */
1021
- declare function useInstantUnstakeApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseInstantUnstakeApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseInstantUnstakeApproveVars<K>>;
1022
-
1023
- type UseInstantUnstakeAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, {
1024
- payload: Omit<InstantUnstakeParams<K>, 'action'> | undefined;
1025
- }>;
1026
- /**
1027
- * React hook to check whether the user has approved sufficient xSODA spending for the
1028
- * instant-unstake action. Read-only — calls `staking.isAllowanceValid` with `raw: true` so no
1029
- * `walletProvider` is required.
1030
- */
1031
- declare function useInstantUnstakeAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseInstantUnstakeAllowanceParams<K>): UseQueryResult<boolean, Error>;
1032
-
1033
- type UseFetchAssetsBalancesParams = ReadHookParams<Map<string, PartnerFeeClaimAssetBalance>, {
1034
- queryAddress: string | undefined;
1035
- }>;
1036
- /**
1037
- * React hook to fetch hub-asset balances on Sonic for a given EVM address. Disabled when
1038
- * `queryAddress` is missing. Throws on `!ok`.
1039
- */
1040
- declare function useFetchAssetsBalances({ params, queryOptions, }?: UseFetchAssetsBalancesParams): UseQueryResult<Map<string, PartnerFeeClaimAssetBalance>, Error>;
1041
-
1042
- type UseGetAutoSwapPreferencesParams = ReadHookParams<AutoSwapPreferences, {
1043
- queryAddress: string | undefined;
1044
- }>;
1045
- /**
1046
- * React hook to fetch the auto-swap preferences (output token, destination chain, destination
1047
- * address) for a given EVM address. Disabled when `queryAddress` is missing. Throws on `!ok`.
1048
- */
1049
- declare function useGetAutoSwapPreferences({ params, queryOptions, }?: UseGetAutoSwapPreferencesParams): UseQueryResult<AutoSwapPreferences, Error>;
1050
-
1051
- type UseIsTokenApprovedParams = ReadHookParams<boolean, {
1052
- payload: FeeTokenApproveParams | undefined;
1053
- }>;
1054
- /**
1055
- * React hook to check whether a token is approved to the protocol-intents contract on Sonic for
1056
- * a given owner. Read-only; throws on `!ok`.
1057
- */
1058
- declare function useIsTokenApproved({ params, queryOptions, }?: UseIsTokenApprovedParams): UseQueryResult<boolean, Error>;
1059
-
1060
- type UseApproveTokenVars = Omit<FeeTokenApproveAction<HubChainKey, false>, 'raw'>;
1061
- type ApproveTokenData = TxReturnType<HubChainKey, false>;
1062
- /**
1063
- * React hook to approve a token to the protocol-intents contract on Sonic with max allowance.
1064
- *
1065
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1066
- * `onError`, `retry`). Returns the unwrapped tx return value on success.
1067
- */
1068
- declare function useApproveToken({ mutationOptions, }?: MutationHookParams<ApproveTokenData, UseApproveTokenVars>): SafeUseMutationResult<ApproveTokenData, Error, UseApproveTokenVars>;
1069
-
1070
- /**
1071
- * Mutation variables for {@link useSetSwapPreference}. Generic over `K extends SpokeChainKey`
1072
- * for compatibility with the SDK signature; at runtime the SDK enforces hub-only
1073
- * (`isHubChainKeyType(srcChainKey)`).
1074
- */
1075
- type UseSetSwapPreferenceVars<K extends SpokeChainKey = SpokeChainKey> = Omit<SetSwapPreferenceAction<K, false>, 'raw'>;
1076
- /**
1077
- * React hook to set the partner's auto-swap preferences (output token + destination chain +
1078
- * destination address) on the protocol-intents contract.
1079
- *
1080
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1081
- * `onError`, `retry`). Returns the unwrapped tx return value on success.
1082
- */
1083
- declare function useSetSwapPreference<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseSetSwapPreferenceVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseSetSwapPreferenceVars<K>>;
1084
- type UseSetSwapPreferenceVarsHub = UseSetSwapPreferenceVars<HubChainKey>;
1085
-
1086
- type UseFeeClaimSwapVars = Omit<PartnerFeeClaimSwapAction<HubChainKey, false>, 'raw'>;
1087
- /**
1088
- * React hook to create a partner-fee auto-swap intent and wait for the solver execution.
1089
- *
1090
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1091
- * `onError`, `retry`). Returns the unwrapped `IntentAutoSwapResult` on success.
1092
- */
1093
- declare function useFeeClaimSwap({ mutationOptions, }?: MutationHookParams<IntentAutoSwapResult, UseFeeClaimSwapVars>): SafeUseMutationResult<IntentAutoSwapResult, Error, UseFeeClaimSwapVars>;
1094
-
1095
- type UseHubAssetBalancesParams = ReadHookParams<HubAssetBalance[], {
1096
- chainKey: SpokeChainKey | undefined;
1097
- /** The user's address on the spoke chain. The SDK derives the hub wallet abstraction internally. */
1098
- srcAddress: string | undefined;
1099
- }>;
1100
- /**
1101
- * React hook to fetch the hub-side balances of every supported token on the given spoke chain
1102
- * for the user's hub wallet (derived internally from `srcAddress` + `chainKey`). Disabled when
1103
- * either input is missing. Throws on `!ok`.
1104
- */
1105
- declare function useHubAssetBalances({ params, queryOptions, }?: UseHubAssetBalancesParams): UseQueryResult<HubAssetBalance[], Error>;
1106
-
1107
- /**
1108
- * Mutation variables for {@link useWithdrawHubAsset}. Generic over `K extends SpokeChainKey`
1109
- * (defaults to the full union). Sophisticated callers can lock K at the hook call site to narrow
1110
- * the `walletProvider` and `params.srcChainKey` types.
1111
- */
1112
- type UseWithdrawHubAssetVars<K extends SpokeChainKey = SpokeChainKey> = Omit<WithdrawHubAssetAction<K, false>, 'raw'>;
1113
- /**
1114
- * React hook for withdrawing a hub-side asset back to the user's spoke chain wallet.
1115
- *
1116
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1117
- * `onError`, `retry`). Returns the unwrapped tx return value on success.
1118
- */
1119
- declare function useWithdrawHubAsset<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseWithdrawHubAssetVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseWithdrawHubAssetVars<K>>;
1120
-
1121
- /**
1122
- * Mutation variables for {@link useMigrateIcxToSoda}. Wraps `IcxMigrateAction<false>` with `raw`
1123
- * stripped — the hook always submits non-raw and unwraps the SDK Result.
1124
- */
1125
- type UseMigrateIcxToSodaVars = Omit<IcxMigrateAction<false>, 'raw'>;
1126
- /**
1127
- * React hook for migrating ICX/wICX → SODA on the Sonic hub. Forward-only direction; for the
1128
- * reverse (SODA → ICX) use {@link useRevertMigrateSodaToIcx}.
1129
- *
1130
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1131
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1132
- */
1133
- declare function useMigrateIcxToSoda({ mutationOptions, }?: MutationHookParams<TxHashPair, UseMigrateIcxToSodaVars>): SafeUseMutationResult<TxHashPair, Error, UseMigrateIcxToSodaVars>;
1134
-
1135
- type UseRevertMigrateSodaToIcxVars = Omit<IcxRevertMigrationAction<false>, 'raw'>;
1136
- /**
1137
- * React hook for reverting SODA → ICX (the inverse of {@link useMigrateIcxToSoda}).
1138
- *
1139
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1140
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1141
- */
1142
- declare function useRevertMigrateSodaToIcx({ mutationOptions, }?: MutationHookParams<TxHashPair, UseRevertMigrateSodaToIcxVars>): SafeUseMutationResult<TxHashPair, Error, UseRevertMigrateSodaToIcxVars>;
1143
-
1144
- /**
1145
- * Mutation variables for {@link useMigratebnUSD}. Generic over `K extends SpokeChainKey` (defaults
1146
- * to the full union). Bidirectional — handles both legacy → new and new → legacy bnUSD migration
1147
- * via the same SDK call; the SDK detects direction from the token addresses.
1148
- */
1149
- type UseMigratebnUSDVars<K extends SpokeChainKey = SpokeChainKey> = Omit<UnifiedBnUSDMigrateAction<K, false>, 'raw'>;
1150
- /**
1151
- * React hook for migrating bnUSD between legacy and new formats across spoke chains via Sonic.
1152
- *
1153
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1154
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1155
- */
1156
- declare function useMigratebnUSD<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseMigratebnUSDVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseMigratebnUSDVars<K>>;
1157
-
1158
- type UseMigrateBalnVars = Omit<BalnMigrateAction<false>, 'raw'>;
1159
- /**
1160
- * React hook for migrating BALN → SODA on the Sonic hub. Source chain is always Icon. Supports
1161
- * lockup periods (0–24 months) which multiply the SODA reward (0.5x–1.5x).
1162
- *
1163
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1164
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1165
- */
1166
- declare function useMigrateBaln({ mutationOptions, }?: MutationHookParams<TxHashPair, UseMigrateBalnVars>): SafeUseMutationResult<TxHashPair, Error, UseMigrateBalnVars>;
1167
-
1168
- /**
1169
- * Mutation variables for {@link useMigrationApprove}. The SDK's `approve` accepts a union of
1170
- * action wrappers (Icx-revert OR bnUSD bidirectional) plus a separate `'migrate' | 'revert'`
1171
- * discriminator. Both ride along in `TVars` here so the hook stays a pure pass-through.
1172
- */
1173
- type UseMigrationApproveVars<K extends SpokeChainKey = SpokeChainKey> = (Omit<IcxRevertMigrationAction<false>, 'raw'> | Omit<UnifiedBnUSDMigrateAction<K, false>, 'raw'>) & {
1174
- action: MigrationAction;
1175
- };
1176
- /**
1177
- * React hook for approving token spending on a migration intent. Required before:
1178
- * - SODA → ICX revert (consumes SODA on Sonic via the user's hub router)
1179
- * - bnUSD migrations on EVM/Stellar source chains (consumes the source bnUSD via asset manager)
1180
- *
1181
- * NOT required for ICX → SODA forward migrations or BALN migrations (both originate on Icon
1182
- * which doesn't use ERC-20 allowances).
1183
- *
1184
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1185
- * `onError`, `retry`). Returns the unwrapped tx return value on success.
1186
- */
1187
- declare function useMigrationApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseMigrationApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseMigrationApproveVars<K>>;
1188
-
1189
- /**
1190
- * Domain inputs for {@link useMigrationAllowance}. `params` is the underlying migration params
1191
- * (NOT the action wrapper — no `walletProvider`/`raw`); `action` is the `'migrate' | 'revert'`
1192
- * discriminator the SDK uses to pick the right allowance check path.
1193
- *
1194
- * For ICX forward migration (`migrate`, params={IcxMigrateParams}) and BALN migration the SDK
1195
- * always returns `true` (Icon has no ERC-20-style allowance) — but the hook still works there
1196
- * for code-uniformity at the call site.
1197
- */
1198
- type UseMigrationAllowanceInputs<K extends SpokeChainKey = SpokeChainKey> = {
1199
- params: IcxMigrateParams | IcxCreateRevertMigrationParams | UnifiedBnUSDMigrateParams<K> | BalnMigrateParams | undefined;
1200
- action: MigrationAction | undefined;
1201
- };
1202
- type UseMigrationAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, UseMigrationAllowanceInputs<K>>;
1203
- /**
1204
- * React hook to check if migration spending is approved.
1205
- *
1206
- * Returns `false` when params are missing (so the call site can disable the action button).
1207
- * Hook lifecycle (`enabled`, `queryKey`, `queryFn`) is owned internally; consumers can override
1208
- * other React Query knobs via `queryOptions`.
1209
- */
1210
- declare function useMigrationAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseMigrationAllowanceParams<K>): UseQueryResult<boolean, Error>;
1211
-
1212
- type UsePoolsParams = ReadHookParams<PoolKey[]>;
1213
- /**
1214
- * Loads the list of concentrated-liquidity pools known to the SDK config. The SDK's `getPools()`
1215
- * is synchronous in v2 (no network), so this hook caches indefinitely by default.
1216
- */
1217
- declare function usePools({ queryOptions }?: UsePoolsParams): UseQueryResult<PoolKey[], Error>;
1218
-
1219
- type UsePoolDataParams = ReadHookParams<PoolData, {
1220
- poolKey: PoolKey | null;
1221
- }>;
1222
- /**
1223
- * React hook to fetch on-chain pool data (sqrt price, tick, fees, token info, etc.) for a given
1224
- * pool key. Reads via the hub `publicClient`. Disabled when `poolKey` is null.
1225
- */
1226
- declare function usePoolData({ params, queryOptions }?: UsePoolDataParams): UseQueryResult<PoolData, Error>;
1227
-
1228
- type UsePoolBalancesResponse = {
1229
- token0Balance: bigint;
1230
- token1Balance: bigint;
1231
- };
1232
- type UsePoolBalancesParams = ReadHookParams<UsePoolBalancesResponse, {
1233
- poolData: PoolData | null;
1234
- poolKey: PoolKey | null;
1235
- spokeChainKey: SpokeChainKey | undefined;
1236
- userAddress: string | undefined;
1237
- }>;
1238
- /**
1239
- * React hook to query the user's hub-side deposit balances for both pool tokens. Derives the hub
1240
- * wallet once and reads both pool-token balances in parallel via the hub `publicClient`.
1241
- */
1242
- declare function usePoolBalances({ params, queryOptions, }?: UsePoolBalancesParams): UseQueryResult<UsePoolBalancesResponse, Error>;
1243
-
1244
- type UsePositionInfoResponse = {
1245
- positionInfo: ClPositionInfo;
1246
- isValid: boolean;
1247
- };
1248
- type UsePositionInfoParams = ReadHookParams<UsePositionInfoResponse, {
1249
- tokenId: string | null;
1250
- poolKey: PoolKey | null;
1251
- }>;
1252
- /**
1253
- * React hook to fetch a CL position by NFT token id and validate it against an expected pool key.
1254
- * Reads via the hub `publicClient`. Disabled when `tokenId` or `poolKey` is missing.
1255
- */
1256
- declare function usePositionInfo({ params, queryOptions, }?: UsePositionInfoParams): UseQueryResult<UsePositionInfoResponse, Error>;
1257
-
1258
- /**
1259
- * Mutation variables for {@link useDexDeposit}. Generic over `K extends SpokeChainKey` (defaults
1260
- * to the full union). Sophisticated callers can lock K at the hook call site to narrow the
1261
- * `walletProvider` and `params.srcChainKey` types.
1262
- */
1263
- type UseDexDepositVars<K extends SpokeChainKey = SpokeChainKey> = Omit<AssetDepositAction<K, false>, 'raw'>;
1264
- /**
1265
- * React hook for depositing an asset into a DEX pool.
1266
- *
1267
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1268
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1269
- *
1270
- * @example
1271
- * ```tsx
1272
- * const walletProvider = useWalletProvider({ xChainId: chainKey });
1273
- * const { mutateAsync: deposit } = useDexDeposit();
1274
- * try {
1275
- * const { spokeTxHash, hubTxHash } = await deposit({ params, walletProvider });
1276
- * } catch (e) {
1277
- * // surfaced via mutation.error / onError
1278
- * }
1279
- * ```
1280
- */
1281
- declare function useDexDeposit<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseDexDepositVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseDexDepositVars<K>>;
1282
-
1283
- /**
1284
- * Mutation variables for {@link useDexWithdraw}. Generic over `K extends SpokeChainKey` (defaults
1285
- * to the full union). Sophisticated callers can lock K at the hook call site to narrow the
1286
- * `walletProvider` and `params.srcChainKey` types.
1287
- */
1288
- type UseDexWithdrawVars<K extends SpokeChainKey = SpokeChainKey> = Omit<AssetWithdrawAction<K, false>, 'raw'>;
1289
- /**
1290
- * React hook for withdrawing an asset from a DEX pool.
1291
- *
1292
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1293
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1294
- */
1295
- declare function useDexWithdraw<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseDexWithdrawVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseDexWithdrawVars<K>>;
1296
-
1297
- type UseDexAllowanceParams<K extends SpokeChainKey = SpokeChainKey> = ReadHookParams<boolean, {
1298
- payload: CreateAssetDepositParams<K> | undefined;
1299
- }>;
1300
- /**
1301
- * React hook to check whether the user has approved sufficient token allowance (or established a
1302
- * trustline, on Stellar) for a DEX deposit. Read-only — calls `assetService.isAllowanceValid`
1303
- * with `raw: true` so no `walletProvider` is required.
1304
- */
1305
- declare function useDexAllowance<K extends SpokeChainKey = SpokeChainKey>({ params, queryOptions, }?: UseDexAllowanceParams<K>): UseQueryResult<boolean, Error>;
1306
-
1307
- /**
1308
- * Mutation variables for {@link useDexApprove}. Generic over `K extends SpokeChainKey` (defaults
1309
- * to the full union). Sophisticated callers can lock K at the hook call site to narrow the
1310
- * `walletProvider` and `params.srcChainKey` types.
1311
- */
1312
- type UseDexApproveVars<K extends SpokeChainKey = SpokeChainKey> = Omit<AssetDepositAction<K, false>, 'raw'>;
1313
- /**
1314
- * React hook for approving ERC-20 token spending (or trustline establishment) for a DEX deposit.
1315
- *
1316
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1317
- * `onError`, `retry`). Returns the unwrapped tx return value on success.
1318
- */
1319
- declare function useDexApprove<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxReturnType<K, false>, UseDexApproveVars<K>>): SafeUseMutationResult<TxReturnType<K, false>, Error, UseDexApproveVars<K>>;
1320
-
1321
- type UseLiquidityAmountsResult = {
1322
- liquidityToken0Amount: string;
1323
- liquidityToken1Amount: string;
1324
- lastEditedToken: 'token0' | 'token1' | null;
1325
- setLiquidityToken0Amount: (value: string) => void;
1326
- setLiquidityToken1Amount: (value: string) => void;
1327
- handleToken0AmountChange: (value: string) => void;
1328
- handleToken1AmountChange: (value: string) => void;
1329
- };
1330
- /**
1331
- * Hook for calculating concentrated-liquidity amounts based on the price range. Pure state +
1332
- * math; no SDK calls beyond the static {@link ClService} helpers.
1333
- */
1334
- declare function useLiquidityAmounts(minPrice: string, maxPrice: string, poolData: PoolData | null): UseLiquidityAmountsResult;
1335
-
1336
- type UseCreateSupplyLiquidityParamsProps = {
1337
- poolData: PoolData;
1338
- poolKey: PoolKey;
1339
- minPrice: string;
1340
- maxPrice: string;
1341
- liquidityToken0Amount: string;
1342
- liquidityToken1Amount: string;
1343
- slippageTolerance: string | number;
1344
- positionId?: string | null;
1345
- isValidPosition?: boolean;
1346
- };
1347
- /**
1348
- * Subset of {@link ClSupplyParams} / {@link ClIncreaseLiquidityParams} produced by
1349
- * {@link useCreateSupplyLiquidityParams}. Callers add `srcChainKey` + `srcAddress` at the mutation
1350
- * call site. `tokenId` and `isValidPosition` distinguish the mint-new vs increase-existing path.
1351
- */
1352
- type UseCreateSupplyLiquidityParamsResult = Omit<ClSupplyParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress'> & Omit<ClIncreaseLiquidityParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress' | 'tokenId'> & {
1353
- tokenId?: string | bigint;
1354
- positionId?: string | null;
1355
- isValidPosition?: boolean;
1356
- };
1357
- /**
1358
- * React hook to memoize concentrated-liquidity supply parameters for a given pool. Returns the
1359
- * pool/tick/liquidity/amount fields without `srcChainKey`/`srcAddress` — callers add those at the
1360
- * mutation call site.
1361
- */
1362
- declare function useCreateSupplyLiquidityParams({ poolData, poolKey, minPrice, maxPrice, liquidityToken0Amount, liquidityToken1Amount, slippageTolerance, positionId, isValidPosition, }: UseCreateSupplyLiquidityParamsProps): UseCreateSupplyLiquidityParamsResult;
1363
-
1364
- /**
1365
- * Mutation variables for {@link useSupplyLiquidity}. Generic over `K extends SpokeChainKey`
1366
- * (defaults to the full union). The hook fans out internally to either
1367
- * `clService.increaseLiquidity` (when `params.tokenId` + `params.isValidPosition` are present) or
1368
- * `clService.supplyLiquidity` (mint a new position).
1369
- */
1370
- type UseSupplyLiquidityVars<K extends SpokeChainKey = SpokeChainKey> = {
1371
- params: UseCreateSupplyLiquidityParamsResult & {
1372
- srcChainKey: K;
1373
- srcAddress: string;
1374
- };
1375
- walletProvider: GetWalletProviderType<K>;
1376
- /** Optional relay timeout in ms (default 60_000) */
1377
- timeout?: number;
1378
- };
1379
- /**
1380
- * React hook for supplying liquidity to a concentrated-liquidity pool. If the input vars include a
1381
- * valid `tokenId` for an existing position, the hook calls `increaseLiquidity`; otherwise it mints
1382
- * a new position via `supplyLiquidity`.
1383
- *
1384
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1385
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1386
- */
1387
- declare function useSupplyLiquidity<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseSupplyLiquidityVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseSupplyLiquidityVars<K>>;
1388
-
1389
- /**
1390
- * Mutation variables for {@link useDecreaseLiquidity}. Generic over `K extends SpokeChainKey`
1391
- * (defaults to the full union). Sophisticated callers can lock K at the hook call site to narrow
1392
- * the `walletProvider` and `params.srcChainKey` types.
1393
- */
1394
- type UseDecreaseLiquidityVars<K extends SpokeChainKey = SpokeChainKey> = Omit<ClLiquidityDecreaseLiquidityAction<K, false>, 'raw'>;
1395
- /**
1396
- * React hook for decreasing liquidity in an existing concentrated-liquidity position.
1397
- *
1398
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1399
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1400
- */
1401
- declare function useDecreaseLiquidity<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseDecreaseLiquidityVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseDecreaseLiquidityVars<K>>;
1402
-
1403
- /**
1404
- * Subset of {@link CreateAssetDepositParams} produced by {@link createDepositParamsProps}.
1405
- * Callers add `srcChainKey` + `srcAddress` at the mutation call site.
1406
- */
1407
- type DepositParamsCore = Omit<CreateAssetDepositParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress'>;
1408
- /**
1409
- * Subset of {@link CreateAssetWithdrawParams} produced by {@link createWithdrawParamsProps}.
1410
- * Callers add `srcChainKey` + `srcAddress` at the mutation call site.
1411
- */
1412
- type WithdrawParamsCore = Omit<CreateAssetWithdrawParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress'>;
1413
- /**
1414
- * Subset of {@link ClDecreaseLiquidityParams} produced by {@link createDecreaseLiquidityParamsProps}.
1415
- * Callers add `srcChainKey` + `srcAddress` at the mutation call site.
1416
- */
1417
- type DecreaseLiquidityParamsCore = Omit<ClDecreaseLiquidityParams<SpokeChainKey>, 'srcChainKey' | 'srcAddress'>;
1418
- declare function createDecreaseLiquidityParamsProps({ poolKey, tokenId, percentage, positionInfo, slippageTolerance, }: UseCreateDecreaseLiquidityParamsProps): DecreaseLiquidityParamsCore;
1419
- declare function createDepositParamsProps({ tokenIndex, amount, poolData, poolSpokeAssets, }: UseCreateDepositParamsProps): DepositParamsCore;
1420
- declare function createSupplyLiquidityParamsProps({ poolData, poolKey, minPrice, maxPrice, liquidityToken0Amount, liquidityToken1Amount, slippageTolerance, positionId, isValidPosition, }: UseCreateSupplyLiquidityParamsProps): UseCreateSupplyLiquidityParamsResult;
1421
- declare function createWithdrawParamsProps({ tokenIndex, amount, poolData, poolSpokeAssets, dst, }: UseCreateWithdrawParamsProps): WithdrawParamsCore;
1422
-
1423
- type UseCreateDepositParamsProps = {
1424
- tokenIndex: 0 | 1;
1425
- amount: string | number;
1426
- poolData: PoolData;
1427
- poolSpokeAssets: PoolSpokeAssets;
1428
- };
1429
- /**
1430
- * React hook to memoize the deposit-specific subset of {@link CreateAssetDepositParams}
1431
- * (`{ asset, amount, poolToken, dst? }`). Callers add `srcChainKey` + `srcAddress` at the mutation
1432
- * call site.
1433
- */
1434
- declare function useCreateDepositParams({ tokenIndex, amount, poolData, poolSpokeAssets, }: UseCreateDepositParamsProps): DepositParamsCore | undefined;
1435
-
1436
- type UseCreateDecreaseLiquidityParamsProps = {
1437
- poolKey: PoolKey;
1438
- tokenId: string | bigint;
1439
- percentage: string | number;
1440
- positionInfo: ClPositionInfo;
1441
- slippageTolerance: string | number;
1442
- };
1443
- /**
1444
- * React hook to memoize the decrease-liquidity-specific subset of {@link ClDecreaseLiquidityParams}
1445
- * (`{ poolKey, tokenId, liquidity, amount0Min, amount1Min }`). Callers add `srcChainKey` +
1446
- * `srcAddress` at the mutation call site.
1447
- */
1448
- declare function useCreateDecreaseLiquidityParams({ poolKey, tokenId, percentage, positionInfo, slippageTolerance, }: UseCreateDecreaseLiquidityParamsProps): DecreaseLiquidityParamsCore;
1449
-
1450
- type UseCreateWithdrawParamsProps = {
1451
- tokenIndex: 0 | 1;
1452
- amount: string | number;
1453
- poolData: PoolData;
1454
- poolSpokeAssets: PoolSpokeAssets;
1455
- dst?: DestinationParamsType;
1456
- };
1457
- /**
1458
- * React hook to memoize the withdraw-specific subset of {@link CreateAssetWithdrawParams}
1459
- * (`{ asset, amount, poolToken, dst? }`). Callers add `srcChainKey` + `srcAddress` at the mutation
1460
- * call site.
1461
- */
1462
- declare function useCreateWithdrawParams({ tokenIndex, amount, poolData, poolSpokeAssets, dst, }: UseCreateWithdrawParamsProps): WithdrawParamsCore | undefined;
1463
-
1464
- /**
1465
- * Mutation variables for {@link useClaimRewards}. Generic over `K extends SpokeChainKey` (defaults
1466
- * to the full union). Sophisticated callers can lock K at the hook call site to narrow the
1467
- * `walletProvider` and `params.srcChainKey` types.
1468
- */
1469
- type UseClaimRewardsVars<K extends SpokeChainKey = SpokeChainKey> = Omit<ClLiquidityClaimRewardsAction<K, false>, 'raw'>;
1470
- /**
1471
- * React hook for claiming accrued fees on a concentrated-liquidity position.
1472
- *
1473
- * Throws on SDK failure so React Query's native error model engages (`isError`, `error`,
1474
- * `onError`, `retry`). Returns the unwrapped `TxHashPair` on success.
1475
- */
1476
- declare function useClaimRewards<K extends SpokeChainKey = SpokeChainKey>({ mutationOptions, }?: MutationHookParams<TxHashPair, UseClaimRewardsVars<K>>): SafeUseMutationResult<TxHashPair, Error, UseClaimRewardsVars<K>>;
1477
-
1478
- interface SodaxProviderProps {
1479
- children: ReactNode;
1480
- /**
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.
1485
- */
1486
- config?: DeepPartial<SodaxConfig>;
1487
- }
1488
- declare const SodaxProvider: ({ children, config }: SodaxProviderProps) => ReactElement;
1489
-
1490
- type CreateSodaxQueryClientOptions = {
1491
- /**
1492
- * Called for every mutation failure (i.e. every time `mutationFn` throws) that does NOT opt out
1493
- * via `meta: { silent: true }` on the mutation. Defaults to `console.error`.
1494
- *
1495
- * This is **global observability** — it runs alongside any per-hook `onError` handler the
1496
- * consumer set, NOT instead of them. In particular, it fires:
1497
- * - whether or not `mutateAsync` was awaited inside `try/catch`
1498
- * - whether or not `mutateAsyncSafe` was used (the wrapper packs into `Result<T>` AFTER React
1499
- * Query has already entered the error state and dispatched its callbacks)
1500
- * - whether or not the consumer's `mutationOptions.onError` already toasted/logged
1501
- *
1502
- * It is NOT a "did this rejection escape to the global handler?" detector — accurate
1503
- * unhandled-rejection detection lives at `window.onunhandledrejection`, not here.
1504
- *
1505
- * To silence the default for a specific mutation that the consumer is handling locally, set
1506
- * `meta: { silent: true }`:
1507
- *
1508
- * ```ts
1509
- * useSwap({ mutationOptions: { meta: { silent: true }, onError: (e) => toast(e.message) } });
1510
- * ```
1511
- *
1512
- * To disable the default globally (e.g. wire your own error boundary), pass a no-op:
1513
- *
1514
- * ```ts
1515
- * createSodaxQueryClient({ onMutationError: () => {} });
1516
- * ```
1517
- */
1518
- onMutationError?: (error: unknown) => void;
1519
- /** Pass-through for any other QueryClient config (default queries options, etc.) */
1520
- config?: QueryClientConfig;
1521
- };
1522
- /**
1523
- * Creates a `QueryClient` pre-wired with a mutation-error observability hook that gives dapp-kit
1524
- * consumers a single seam for every mutation failure across the app — wire to Sentry/Datadog/console
1525
- * as you like. Optional opt-in: consumers who construct their own `QueryClient` are unaffected.
1526
- *
1527
- * **Composition with a custom `MutationCache`.** If you pass `config.mutationCache`, we keep your
1528
- * cache instance (preserving its own `onError` / `onSuccess` / etc.) and *additionally* subscribe
1529
- * to its event stream to dispatch `onMutationError`. Both your handler and the dapp-kit handler
1530
- * fire — neither replaces the other. If you don't pass one, we install our own.
1531
- *
1532
- * @example default — logs to console
1533
- * const queryClient = createSodaxQueryClient();
1534
- *
1535
- * @example custom — Sentry
1536
- * const queryClient = createSodaxQueryClient({
1537
- * onMutationError: (e) => Sentry.captureException(e),
1538
- * });
1539
- *
1540
- * @example silent — disable the default
1541
- * const queryClient = createSodaxQueryClient({ onMutationError: () => {} });
1542
- *
1543
- * @example bring-your-own MutationCache
1544
- * const myCache = new MutationCache({ onError: myOwnErrorHandler });
1545
- * const queryClient = createSodaxQueryClient({ config: { mutationCache: myCache } });
1546
- * // myOwnErrorHandler still runs; onMutationError ALSO runs (unless meta.silent).
1547
- */
1548
- declare function createSodaxQueryClient({ onMutationError, config, }?: CreateSodaxQueryClientOptions): QueryClient;
1549
-
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 };