@sodax/dapp-kit 0.0.1-rc.8 → 1.0.0-beta

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 (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -60
  3. package/dist/index.d.mts +1558 -0
  4. package/dist/index.d.ts +1558 -4
  5. package/dist/index.js +1030 -135
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +988 -134
  8. package/dist/index.mjs.map +1 -1
  9. package/package.json +7 -8
  10. package/src/contexts/index.ts +3 -2
  11. package/src/hooks/backend/README.md +135 -0
  12. package/src/hooks/backend/index.ts +23 -0
  13. package/src/hooks/backend/useBackendAllMoneyMarketAssets.ts +49 -0
  14. package/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts +61 -0
  15. package/src/hooks/backend/useBackendIntentByHash.ts +53 -0
  16. package/src/hooks/backend/useBackendIntentByTxHash.ts +57 -0
  17. package/src/hooks/backend/useBackendMoneyMarketAsset.ts +57 -0
  18. package/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts +67 -0
  19. package/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts +67 -0
  20. package/src/hooks/backend/useBackendMoneyMarketPosition.ts +56 -0
  21. package/src/hooks/backend/useBackendOrderbook.ts +63 -0
  22. package/src/hooks/bridge/index.ts +5 -0
  23. package/src/hooks/bridge/useBridge.ts +57 -0
  24. package/src/hooks/bridge/useBridgeAllowance.ts +49 -0
  25. package/src/hooks/bridge/useBridgeApprove.ts +68 -0
  26. package/src/hooks/bridge/useGetBridgeableAmount.ts +50 -0
  27. package/src/hooks/bridge/useGetBridgeableTokens.ts +62 -0
  28. package/src/hooks/index.ts +4 -0
  29. package/src/hooks/migrate/index.ts +4 -0
  30. package/src/hooks/migrate/types.ts +15 -0
  31. package/src/hooks/migrate/useMigrate.tsx +110 -0
  32. package/src/hooks/migrate/useMigrationAllowance.tsx +79 -0
  33. package/src/hooks/migrate/useMigrationApprove.tsx +129 -0
  34. package/src/hooks/mm/index.ts +2 -1
  35. package/src/hooks/mm/useAToken.ts +47 -0
  36. package/src/hooks/mm/useBorrow.ts +2 -2
  37. package/src/hooks/mm/useMMAllowance.ts +2 -1
  38. package/src/hooks/mm/useMMApprove.ts +2 -1
  39. package/src/hooks/mm/useRepay.ts +2 -2
  40. package/src/hooks/mm/useReservesData.ts +1 -8
  41. package/src/hooks/mm/useReservesHumanized.ts +30 -0
  42. package/src/hooks/mm/useReservesList.ts +29 -0
  43. package/src/hooks/mm/useReservesUsdFormat.ts +38 -0
  44. package/src/hooks/mm/useSupply.ts +2 -2
  45. package/src/hooks/mm/useUserFormattedSummary.ts +54 -0
  46. package/src/hooks/mm/useUserReservesData.ts +30 -37
  47. package/src/hooks/mm/useWithdraw.ts +2 -2
  48. package/src/hooks/provider/useHubProvider.ts +3 -3
  49. package/src/hooks/provider/useSpokeProvider.ts +50 -18
  50. package/src/hooks/shared/index.ts +4 -0
  51. package/src/hooks/shared/useDeriveUserWalletAddress.ts +44 -0
  52. package/src/hooks/shared/useEstimateGas.ts +18 -0
  53. package/src/hooks/shared/useRequestTrustline.ts +103 -0
  54. package/src/hooks/shared/useStellarTrustlineCheck.ts +71 -0
  55. package/src/hooks/staking/index.ts +19 -0
  56. package/src/hooks/staking/useCancelUnstake.ts +52 -0
  57. package/src/hooks/staking/useClaim.ts +46 -0
  58. package/src/hooks/staking/useConvertedAssets.ts +47 -0
  59. package/src/hooks/staking/useInstantUnstake.ts +50 -0
  60. package/src/hooks/staking/useInstantUnstakeAllowance.ts +59 -0
  61. package/src/hooks/staking/useInstantUnstakeApprove.ts +52 -0
  62. package/src/hooks/staking/useInstantUnstakeRatio.ts +54 -0
  63. package/src/hooks/staking/useStake.ts +47 -0
  64. package/src/hooks/staking/useStakeAllowance.ts +57 -0
  65. package/src/hooks/staking/useStakeApprove.ts +50 -0
  66. package/src/hooks/staking/useStakeRatio.ts +53 -0
  67. package/src/hooks/staking/useStakingConfig.ts +40 -0
  68. package/src/hooks/staking/useStakingInfo.ts +50 -0
  69. package/src/hooks/staking/useUnstake.ts +54 -0
  70. package/src/hooks/staking/useUnstakeAllowance.ts +58 -0
  71. package/src/hooks/staking/useUnstakeApprove.ts +52 -0
  72. package/src/hooks/staking/useUnstakingInfo.ts +53 -0
  73. package/src/hooks/staking/useUnstakingInfoWithPenalty.ts +59 -0
  74. package/src/hooks/swap/index.ts +2 -1
  75. package/src/hooks/swap/useCancelSwap.ts +44 -0
  76. package/src/hooks/swap/useQuote.ts +21 -7
  77. package/src/hooks/swap/useStatus.ts +4 -4
  78. package/src/hooks/swap/{useCreateIntentOrder.ts → useSwap.ts} +19 -14
  79. package/src/hooks/swap/useSwapAllowance.ts +5 -1
  80. package/src/hooks/swap/useSwapApprove.ts +14 -14
  81. package/src/index.ts +0 -1
  82. package/src/providers/SodaxProvider.tsx +8 -20
  83. package/dist/contexts/index.d.ts +0 -8
  84. package/dist/contexts/index.d.ts.map +0 -1
  85. package/dist/core/index.d.ts +0 -4
  86. package/dist/core/index.d.ts.map +0 -1
  87. package/dist/hooks/index.d.ts +0 -5
  88. package/dist/hooks/index.d.ts.map +0 -1
  89. package/dist/hooks/mm/index.d.ts +0 -10
  90. package/dist/hooks/mm/index.d.ts.map +0 -1
  91. package/dist/hooks/mm/useBorrow.d.ts +0 -35
  92. package/dist/hooks/mm/useBorrow.d.ts.map +0 -1
  93. package/dist/hooks/mm/useHubWalletAddress.d.ts +0 -24
  94. package/dist/hooks/mm/useHubWalletAddress.d.ts.map +0 -1
  95. package/dist/hooks/mm/useMMAllowance.d.ts +0 -26
  96. package/dist/hooks/mm/useMMAllowance.d.ts.map +0 -1
  97. package/dist/hooks/mm/useMMApprove.d.ts +0 -27
  98. package/dist/hooks/mm/useMMApprove.d.ts.map +0 -1
  99. package/dist/hooks/mm/useRepay.d.ts +0 -35
  100. package/dist/hooks/mm/useRepay.d.ts.map +0 -1
  101. package/dist/hooks/mm/useReservesData.d.ts +0 -19
  102. package/dist/hooks/mm/useReservesData.d.ts.map +0 -1
  103. package/dist/hooks/mm/useSupply.d.ts +0 -34
  104. package/dist/hooks/mm/useSupply.d.ts.map +0 -1
  105. package/dist/hooks/mm/useUserReservesData.d.ts +0 -9
  106. package/dist/hooks/mm/useUserReservesData.d.ts.map +0 -1
  107. package/dist/hooks/mm/useWithdraw.d.ts +0 -33
  108. package/dist/hooks/mm/useWithdraw.d.ts.map +0 -1
  109. package/dist/hooks/provider/index.d.ts +0 -3
  110. package/dist/hooks/provider/index.d.ts.map +0 -1
  111. package/dist/hooks/provider/useHubProvider.d.ts +0 -3
  112. package/dist/hooks/provider/useHubProvider.d.ts.map +0 -1
  113. package/dist/hooks/provider/useSpokeProvider.d.ts +0 -18
  114. package/dist/hooks/provider/useSpokeProvider.d.ts.map +0 -1
  115. package/dist/hooks/shared/index.d.ts +0 -2
  116. package/dist/hooks/shared/index.d.ts.map +0 -1
  117. package/dist/hooks/shared/useSodaxContext.d.ts +0 -8
  118. package/dist/hooks/shared/useSodaxContext.d.ts.map +0 -1
  119. package/dist/hooks/swap/index.d.ts +0 -6
  120. package/dist/hooks/swap/index.d.ts.map +0 -1
  121. package/dist/hooks/swap/useCreateIntentOrder.d.ts +0 -33
  122. package/dist/hooks/swap/useCreateIntentOrder.d.ts.map +0 -1
  123. package/dist/hooks/swap/useQuote.d.ts +0 -39
  124. package/dist/hooks/swap/useQuote.d.ts.map +0 -1
  125. package/dist/hooks/swap/useStatus.d.ts +0 -31
  126. package/dist/hooks/swap/useStatus.d.ts.map +0 -1
  127. package/dist/hooks/swap/useSwapAllowance.d.ts +0 -23
  128. package/dist/hooks/swap/useSwapAllowance.d.ts.map +0 -1
  129. package/dist/hooks/swap/useSwapApprove.d.ts +0 -26
  130. package/dist/hooks/swap/useSwapApprove.d.ts.map +0 -1
  131. package/dist/index.d.ts.map +0 -1
  132. package/dist/providers/SodaxProvider.d.ts +0 -10
  133. package/dist/providers/SodaxProvider.d.ts.map +0 -1
  134. package/dist/providers/index.d.ts +0 -2
  135. package/dist/providers/index.d.ts.map +0 -1
  136. package/src/core/index.ts +0 -35
  137. package/src/hooks/mm/useHubWalletAddress.ts +0 -49
package/dist/index.d.ts CHANGED
@@ -1,4 +1,1558 @@
1
- export * from './hooks';
2
- export * from './providers';
3
- export * from './core';
4
- //# sourceMappingURL=index.d.ts.map
1
+ import * as _sodax_sdk from '@sodax/sdk';
2
+ import { Sodax, SpokeProvider, GetEstimateGasReturnType, TxReturnType, SpokeChainId, StellarSpokeProvider, EvmHubProvider, IWalletProvider, UserReserveData, MoneyMarketAction, Address as Address$1, XToken as XToken$1, ReserveData, FormatReserveUSDResponse, SolverIntentQuoteRequest, Result, SolverIntentQuoteResponse, SolverErrorResponse, SolverExecutionResponse, Intent, IntentDeliveryInfo, IntentError, IntentErrorCode, CreateIntentParams, Hex, SolverIntentStatusResponse, IntentResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, CreateBridgeIntentParams, SpokeTxHash, HubTxHash, BridgeError, BridgeErrorCode, StakeParams, UnstakeParams, ClaimParams, CancelUnstakeParams, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeParams, SodaxConfig } from '@sodax/sdk';
3
+ import { RpcConfig, SpokeChainId as SpokeChainId$1, XToken } from '@sodax/types';
4
+ import * as _tanstack_react_query from '@tanstack/react-query';
5
+ import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
6
+ import { Address } from 'viem';
7
+ import { ReactNode, ReactElement } from 'react';
8
+
9
+ interface SodaxContextType {
10
+ sodax: Sodax;
11
+ testnet: boolean;
12
+ rpcConfig: RpcConfig;
13
+ }
14
+
15
+ /**
16
+ * Hook to access the Sodax context which provides access to the Sodax SDK instance and chain configuration
17
+ * @throws {Error} If used outside of a SodaxProvider
18
+ * @returns {SodaxContextType} The Sodax context containing SDK instance and configuration
19
+ */
20
+ declare const useSodaxContext: () => SodaxContextType;
21
+
22
+ declare function useEstimateGas<T extends SpokeProvider = SpokeProvider>(spokeProvider: T | undefined): UseMutationResult<GetEstimateGasReturnType<T>, Error, TxReturnType<T, true>>;
23
+
24
+ /**
25
+ * Hook for deriving user wallet address for hub abstraction.
26
+ *
27
+ * This hook derives the user's abstracted wallet address for the hub chain.
28
+ * If the spoke chain is the same as the hub chain, it returns the original wallet address.
29
+ * Otherwise, it returns the abstracted wallet address for cross-chain operations.
30
+ *
31
+ * @param spokeProvider - The spoke provider instance for the origin chain
32
+ * @param walletAddress - Optional user wallet address on spoke chain. If not provided, will fetch from spokeProvider
33
+ * @returns A React Query result object containing:
34
+ * - data: The derived user wallet address when available
35
+ * - isLoading: Loading state indicator
36
+ * - error: Any error that occurred during derivation
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const { data: derivedAddress, isLoading, error } = useDeriveUserWalletAddress(spokeProvider, userAddress);
41
+ * ```
42
+ */
43
+ declare function useDeriveUserWalletAddress(spokeProvider: SpokeProvider | undefined, walletAddress?: string | undefined): UseQueryResult<Address, Error>;
44
+
45
+ /**
46
+ * React hook to check if a Stellar account has a sufficient trustline for a given token and amount.
47
+ *
48
+ * This hook queries the Stellar network (via the provided SpokeProvider) to determine
49
+ * whether the account has established a trustline for the specified token and if the trustline
50
+ * is sufficient for the intended amount. It is useful for gating UI actions that require
51
+ * a trustline to be present and funded.
52
+ *
53
+ * @template T - The type of SpokeProvider, defaults to SpokeProvider.
54
+ * @param {string | undefined} token - The Stellar asset code or token address to check the trustline for.
55
+ * @param {bigint | undefined} amount - The minimum amount required for the trustline.
56
+ * @param {T | undefined} spokeProvider - The provider instance for interacting with the Stellar network.
57
+ * @param {SpokeChainId | undefined} chainId - The chain ID to determine if the check should be performed (only on Stellar mainnet).
58
+ * @returns {UseQueryResult<boolean, Error>} A React Query result object containing:
59
+ * - `data`: `true` if the trustline exists and is sufficient, `false` otherwise.
60
+ * - `error`: Any error encountered during the check.
61
+ * - `isLoading`: Whether the query is in progress.
62
+ * - Other React Query state.
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * import { useStellarTrustlineCheck } from '@sodax/dapp-kit';
67
+ *
68
+ * const { data: hasTrustline, isLoading, error } = useStellarTrustlineCheck(
69
+ * 'USDC-G...TOKEN',
70
+ * 10000000n,
71
+ * stellarProvider,
72
+ * 'stellar'
73
+ * );
74
+ *
75
+ * if (isLoading) return <span>Checking trustline...</span>;
76
+ * if (error) return <span>Error: {error.message}</span>;
77
+ * if (!hasTrustline) return <span>Trustline not established or insufficient.</span>;
78
+ * return <span>Trustline is sufficient!</span>;
79
+ * ```
80
+ */
81
+ declare function useStellarTrustlineCheck<T extends SpokeProvider = SpokeProvider>(token: string | undefined, amount: bigint | undefined, spokeProvider: T | undefined, chainId: SpokeChainId | undefined): UseQueryResult<boolean, Error>;
82
+
83
+ /**
84
+ * React hook to request a Stellar trustline for a given token and amount.
85
+ *
86
+ * This hook provides a callback function for requesting a trustline on the Stellar network
87
+ * using the provided SpokeProvider. It is intended for use with StellarSpokeProvider
88
+ * and will throw if used with a non-Stellar provider. Upon success, it invalidates
89
+ * the trustline check query to ensure UI reflects the updated trustline state.
90
+ *
91
+ * @template T - The type of SpokeProvider, defaults to SpokeProvider.
92
+ * @param {string | undefined} token - The Stellar asset code or token address for which to request a trustline.
93
+ * @returns {Object} An object containing:
94
+ * - `requestTrustline`: Function to trigger the trustline request.
95
+ * - `isLoading`: Whether the request is in progress.
96
+ * - `isRequested`: Whether a trustline has been successfully requested.
97
+ * - `error`: Any error encountered during the request.
98
+ * - `data`: The transaction result if successful.
99
+ *
100
+ * @example
101
+ * ```tsx
102
+ * import { useRequestTrustline } from '@sodax/dapp-kit';
103
+ *
104
+ * const { requestTrustline, isLoading, isRequested, error, data } = useRequestTrustline('USDC-G...TOKEN');
105
+ *
106
+ * // To request a trustline:
107
+ * await requestTrustline({
108
+ * token: 'USDC-G...TOKEN',
109
+ * amount: 10000000n,
110
+ * spokeProvider: stellarProvider,
111
+ * });
112
+ *
113
+ * if (isLoading) return <span>Requesting trustline...</span>;
114
+ * if (error) return <span>Error: {error.message}</span>;
115
+ * if (isRequested) return <span>Trustline requested! Tx: {data?.txHash}</span>;
116
+ * ```
117
+ */
118
+ declare function useRequestTrustline<T extends SpokeProvider = SpokeProvider>(token: string | undefined): {
119
+ requestTrustline: (params: {
120
+ token: string;
121
+ amount: bigint;
122
+ spokeProvider: T;
123
+ }) => Promise<TxReturnType<StellarSpokeProvider, false>>;
124
+ isLoading: boolean;
125
+ isRequested: boolean;
126
+ error: Error | null;
127
+ data: TxReturnType<StellarSpokeProvider, false> | null;
128
+ };
129
+
130
+ declare function useHubProvider(): EvmHubProvider;
131
+
132
+ /**
133
+ * Hook to get the appropriate spoke provider based on the chain type.
134
+ * Supports EVM, SUI, ICON and INJECTIVE chains.
135
+ *
136
+ * @param {SpokeChainId | undefined} spokeChainId - The spoke chain ID to get the provider for
137
+ * @param {IWalletProvider | undefined} walletProvider - The wallet provider to use
138
+ * @returns {SpokeProvider | undefined} The appropriate spoke provider instance for the given chain ID, or undefined if invalid/unsupported
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * // Using a specific SpokeChainId and wallet provider
143
+ * const spokeProvider = useSpokeProvider(spokeChainId, walletProvider);
144
+ * ```
145
+ */
146
+ declare function useSpokeProvider(spokeChainId: SpokeChainId$1 | undefined, walletProvider?: IWalletProvider | undefined): SpokeProvider | undefined;
147
+
148
+ interface BorrowResponse {
149
+ ok: true;
150
+ value: [string, string];
151
+ }
152
+ /**
153
+ * Hook for borrowing tokens from the Sodax money market.
154
+ *
155
+ * This hook provides functionality to borrow tokens from the money market protocol,
156
+ * handling the entire borrow process including transaction creation, submission,
157
+ * and cross-chain communication.
158
+ *
159
+ * @param {XToken} spokeToken - The token to borrow from the spoke chain. Must be an XToken with valid address and chain information.
160
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for the borrow transaction. Must be a valid SpokeProvider instance.
161
+ *
162
+ * @returns {UseMutationResult<BorrowResponse, Error, string>} A mutation result object with the following properties:
163
+ * - mutateAsync: Function to execute the borrow transaction
164
+ * - isPending: Boolean indicating if a transaction is in progress
165
+ * - error: Error object if the last transaction failed, null otherwise
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * const { mutateAsync: borrow, isPending, error } = useBorrow(spokeToken);
170
+ * await borrow('100');
171
+ * ```
172
+ *
173
+ * @throws {Error} When:
174
+ * - spokeProvider is not available
175
+ * - Transaction execution fails
176
+ */
177
+ declare function useBorrow(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<BorrowResponse, Error, string>;
178
+
179
+ interface RepayResponse {
180
+ ok: true;
181
+ value: [string, string];
182
+ }
183
+ /**
184
+ * Hook for repaying borrowed tokens to the Sodax money market.
185
+ *
186
+ * This hook provides functionality to repay borrowed tokens back to the money market protocol,
187
+ * handling the entire repayment process including transaction creation, submission,
188
+ * and cross-chain communication.
189
+ *
190
+ * @param {XToken} spokeToken - The token to repay on the spoke chain. Must be an XToken with valid address and chain information.
191
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for the repay transaction. Must be a valid SpokeProvider instance.
192
+ *
193
+ * @returns {UseMutationResult<RepayResponse, Error, string>} A mutation result object with the following properties:
194
+ * - mutateAsync: Function to execute the repay transaction
195
+ * - isPending: Boolean indicating if a transaction is in progress
196
+ * - error: Error object if the last transaction failed, null otherwise
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * const { mutateAsync: repay, isPending, error } = useRepay(spokeToken);
201
+ * await repay('100');
202
+ * ```
203
+ *
204
+ * @throws {Error} When:
205
+ * - spokeProvider is not available
206
+ * - Transaction execution fails
207
+ */
208
+ declare function useRepay(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<RepayResponse, Error, string>;
209
+
210
+ interface SupplyResponse {
211
+ ok: true;
212
+ value: [string, string];
213
+ }
214
+ /**
215
+ * Hook for supplying tokens to the Sodax money market.
216
+ *
217
+ * This hook provides functionality to supply tokens to the money market protocol,
218
+ * handling the entire supply process including transaction creation, submission,
219
+ * and cross-chain communication.
220
+ *
221
+ * @param {XToken} spokeToken - The token to supply on the spoke chain. Must be an XToken with valid address and chain information.
222
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for the supply transaction. Must be a valid SpokeProvider instance.
223
+ *
224
+ * @returns {UseMutationResult<SupplyResponse, Error, string>} A mutation result object with the following properties:
225
+ * - mutateAsync: Function to execute the supply transaction
226
+ * - isPending: Boolean indicating if a transaction is in progress
227
+ * - error: Error object if the last transaction failed, null otherwise
228
+ *
229
+ * @example
230
+ * ```typescript
231
+ * const { mutateAsync: supply, isPending, error } = useSupply(spokeToken);
232
+ * await supply('100');
233
+ * ```
234
+ *
235
+ * @throws {Error} When:
236
+ * - spokeProvider is not available
237
+ */
238
+ declare function useSupply(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<SupplyResponse, Error, string>;
239
+
240
+ interface WithdrawResponse {
241
+ ok: true;
242
+ value: [string, string];
243
+ }
244
+ /**
245
+ * Hook for withdrawing supplied tokens from the Sodax money market.
246
+ *
247
+ * This hook provides functionality to withdraw previously supplied tokens from the money market protocol,
248
+ * handling the entire withdrawal process including transaction creation, submission,
249
+ * and cross-chain communication.
250
+ *
251
+ * @param {XToken} spokeToken - The token to withdraw from the spoke chain. Must be an XToken with valid address and chain information.
252
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for the withdraw transaction. Must be a valid SpokeProvider instance.
253
+ *
254
+ * @returns {UseMutationResult<WithdrawResponse, Error, string>} A mutation result object with the following properties:
255
+ * - mutateAsync: Function to execute the withdraw transaction
256
+ * - isPending: Boolean indicating if a transaction is in progress
257
+ * @example
258
+ * ```typescript
259
+ * const { mutateAsync: withdraw, isPending, error } = useWithdraw(spokeToken);
260
+ * await withdraw('100');
261
+ * ```
262
+ *
263
+ * @throws {Error} When:
264
+ * - spokeProvider is not available
265
+ * - Transaction execution fails
266
+ */
267
+ declare function useWithdraw(spokeToken: XToken, spokeProvider: SpokeProvider | undefined): UseMutationResult<WithdrawResponse, Error, string>;
268
+
269
+ /**
270
+ * Hook for fetching user reserves data from the Sodax money market.
271
+ *
272
+ * This hook provides access to the current state of user reserves in the money market protocol.
273
+ * The data is automatically fetched and cached using React Query.
274
+ *
275
+ * @example
276
+ * ```typescript
277
+ * const { data: userReservesData, isLoading, error } = useUserReservesData(spokeProvider, address);
278
+ * ```
279
+ *
280
+ * @returns A React Query result object containing:
281
+ * - data: The user reserves data when available
282
+ * - isLoading: Loading state indicator
283
+ * - error: Any error that occurred during data fetching
284
+ */
285
+ declare function useUserReservesData(spokeProvider: SpokeProvider | undefined, address: string | undefined, refetchInterval?: number): UseQueryResult<readonly [readonly UserReserveData[], number], Error>;
286
+
287
+ /**
288
+ * Hook for fetching reserves data from the Sodax money market.
289
+ *
290
+ * This hook provides access to the current state of all reserves in the money market protocol,
291
+ * including liquidity, interest rates, and other key metrics. The data is automatically
292
+ * fetched and cached using React Query.
293
+ *
294
+ * @example
295
+ * ```typescript
296
+ * const { data: reservesData, isLoading, error } = useReservesData();
297
+ * ```
298
+ *
299
+ * @returns A React Query result object containing:
300
+ * - data: The reserves data when available
301
+ * - isLoading: Loading state indicator
302
+ * - error: Any error that occurred during data fetching
303
+ */
304
+ declare function useReservesData(): _tanstack_react_query.UseQueryResult<readonly [readonly _sodax_sdk.AggregatedReserveData[], _sodax_sdk.BaseCurrencyInfo], Error>;
305
+
306
+ /**
307
+ * Hook for checking token allowance for money market operations.
308
+ *
309
+ * This hook verifies if the user has approved enough tokens for a specific money market action
310
+ * (borrow/repay). It automatically queries and tracks the allowance status.
311
+ *
312
+ * @param {XToken} token - The token to check allowance for. Must be an XToken with valid address and chain information.
313
+ * @param {string} amount - The amount to check allowance for, as a decimal string
314
+ * @param {MoneyMarketAction} action - The money market action to check allowance for ('borrow' or 'repay')
315
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for allowance checks
316
+ *
317
+ * @returns {UseQueryResult<boolean, Error>} A React Query result containing:
318
+ * - data: Boolean indicating if allowance is sufficient
319
+ * - isLoading: Loading state indicator
320
+ * - error: Any error that occurred during the check
321
+ *
322
+ * @example
323
+ * ```typescript
324
+ * const { data: hasAllowed, isLoading } = useMMAllowance(token, "100", "repay", provider);
325
+ * ```
326
+ */
327
+ declare function useMMAllowance(token: XToken, amount: string, action: MoneyMarketAction, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
328
+
329
+ interface UseApproveReturn$2 {
330
+ approve: ({ amount, action }: {
331
+ amount: string;
332
+ action: MoneyMarketAction;
333
+ }) => Promise<boolean>;
334
+ isLoading: boolean;
335
+ error: Error | null;
336
+ resetError: () => void;
337
+ }
338
+ /**
339
+ * Hook for approving token spending for money market actions
340
+ * @param token The token to approve spending for
341
+ * @param spokeProvider The spoke provider instance for the chain
342
+ * @returns Object containing approve function, loading state, error state and reset function
343
+ * @example
344
+ * ```tsx
345
+ * const { approve, isLoading, error } = useMMApprove(token, spokeProvider);
346
+ *
347
+ * // Approve tokens for supply action
348
+ * await approve({ amount: "100", action: "supply" });
349
+ * ```
350
+ */
351
+ declare function useMMApprove(token: XToken, spokeProvider: SpokeProvider | undefined): UseApproveReturn$2;
352
+
353
+ /**
354
+ * React hook for fetching an AToken's ERC20 metadata from the Sodax money market.
355
+ *
356
+ * Fetches and caches the metadata (name, symbol, decimals, address) for a given aToken address and chain using React Query.
357
+ * This metadata is typically required for rendering balances and labels in UI components.
358
+ *
359
+ * @param {Address | undefined} aToken - The aToken contract address to look up. Should be an EVM address.
360
+ * @param {ChainId | undefined} chainId - The EVM chain ID for the aToken.
361
+ *
362
+ * @example
363
+ * ```typescript
364
+ * const { data: aToken, isLoading, error } = useAToken(aTokenAddress, chainId);
365
+ * if (aToken) {
366
+ * console.log(aToken.symbol); // 'aETH'
367
+ * }
368
+ * ```
369
+ *
370
+ * @returns {UseQueryResult<Erc20Token, Error>} A React Query result object containing:
371
+ * - data: The aToken ERC20 metadata when available.
372
+ * - isLoading: Loading state indicator.
373
+ * - error: Any error that occurred during data fetching.
374
+ */
375
+ declare function useAToken(aToken: Address$1 | undefined): UseQueryResult<XToken$1, Error>;
376
+
377
+ /**
378
+ * Hook for fetching formatted summary of Sodax user portfolio (holdings, total liquidity,
379
+ * collateral, borrows, liquidation threshold, health factor, available borrowing power, etc..).
380
+ *
381
+ * This hook provides access to the current state of user portfolio in the money market protocol.
382
+ * The data is automatically fetched and cached using React Query.
383
+ *
384
+ * @example
385
+ * ```typescript
386
+ * const { data: userFormattedSummary, isLoading, error } = useUserFormattedSummary();
387
+ * ```
388
+ *
389
+ * @returns A React Query result object containing:
390
+ * - data: The formatted summary of Sodax user portfolio when available
391
+ * - isLoading: Loading state indicator
392
+ * - error: Any error that occurred during data fetching
393
+ */
394
+ declare function useReservesUsdFormat(): UseQueryResult<(ReserveData & {
395
+ priceInMarketReferenceCurrency: string;
396
+ } & FormatReserveUSDResponse)[], Error>;
397
+
398
+ /**
399
+ * Hook for fetching a quote for an intent-based swap.
400
+ *
401
+ * This hook provides real-time quote data for an intent-based swap.
402
+ *
403
+ * @param {SolverIntentQuoteRequest | undefined} payload - The intent quote request parameters. If undefined, the query will be disabled.
404
+ *
405
+ * @returns {UseQueryResult<Result<SolverIntentQuoteResponse, SolverErrorResponse> | undefined>} A query result object containing:
406
+ * - data: The quote result from the solver
407
+ * - isLoading: Boolean indicating if the quote is being fetched
408
+ * - error: Error object if the quote request failed
409
+ * - refetch: Function to manually trigger a quote refresh
410
+ *
411
+ * @example
412
+ * ```typescript
413
+ * const { data: quote, isLoading } = useQuote({
414
+ * token_src: '0x...',
415
+ * token_src_blockchain_id: '1',
416
+ * token_dst: '0x...',
417
+ * token_dst_blockchain_id: '2',
418
+ * amount: '1000000000000000000',
419
+ * quote_type: 'exact_input',
420
+ * });
421
+ *
422
+ * if (isLoading) return <div>Loading quote...</div>;
423
+ * if (quote) {
424
+ * console.log('Quote received:', quote);
425
+ * }
426
+ * ```
427
+ *
428
+ * @remarks
429
+ * - The quote is automatically refreshed every 3 seconds
430
+ * - The query is disabled when payload is undefined
431
+ * - Uses React Query for efficient caching and state management
432
+ */
433
+ declare const useQuote: (payload: SolverIntentQuoteRequest | undefined) => UseQueryResult<Result<SolverIntentQuoteResponse, SolverErrorResponse> | undefined>;
434
+
435
+ type CreateIntentResult = Result<[SolverExecutionResponse, Intent, IntentDeliveryInfo], IntentError<IntentErrorCode>>;
436
+ /**
437
+ * Hook for creating and submitting an swap intent order for cross-chain swaps.
438
+ * Uses React Query's useMutation for better state management and caching.
439
+ *
440
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for the swap
441
+ * @returns {UseMutationResult} Mutation result object containing mutation function and state
442
+ *
443
+ * @example
444
+ * ```typescript
445
+ * const { mutateAsync: swap, isPending } = useSwap(spokeProvider);
446
+ *
447
+ * const handleSwap = async () => {
448
+ * const result = await swap({
449
+ * token_src: '0x...',
450
+ * token_src_blockchain_id: 'arbitrum',
451
+ * token_dst: '0x...',
452
+ * token_dst_blockchain_id: 'polygon',
453
+ * amount: '1000000000000000000',
454
+ * min_output_amount: '900000000000000000'
455
+ * });
456
+ * };
457
+ * ```
458
+ */
459
+ declare function useSwap(spokeProvider: SpokeProvider | undefined): UseMutationResult<CreateIntentResult, Error, CreateIntentParams>;
460
+
461
+ /**
462
+ * Hook for monitoring the status of an intent-based swap.
463
+ *
464
+ * This hook provides real-time status updates for an intent-based swap transaction.
465
+ *
466
+ * @param {Hex} intent_tx_hash - The transaction hash of the intent order on the hub chain
467
+ *
468
+ * @returns {UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>} A query result object containing:
469
+ * - data: The status result from the solver
470
+ * - isLoading: Boolean indicating if the status is being fetched
471
+ * - error: Error object if the status request failed
472
+ * - refetch: Function to manually trigger a status refresh
473
+ *
474
+ * @example
475
+ * ```typescript
476
+ * const { data: status, isLoading } = useStatus('0x...');
477
+ *
478
+ * if (isLoading) return <div>Loading status...</div>;
479
+ * if (status?.ok) {
480
+ * console.log('Status:', status.value);
481
+ * }
482
+ * ```
483
+ *
484
+ * @remarks
485
+ * - The status is automatically refreshed every 3 seconds
486
+ * - Uses React Query for efficient caching and state management
487
+ */
488
+ declare const useStatus: (intent_tx_hash: Hex) => UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>;
489
+
490
+ /**
491
+ * Hook for checking token allowance for money market operations.
492
+ *
493
+ * This hook verifies if the user has approved enough tokens for a specific money market action
494
+ * (borrow/repay). It automatically queries and tracks the allowance status.
495
+ *
496
+ * @param {CreateIntentParams} params - The parameters for the intent to check allowance for.
497
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for allowance checks
498
+ *
499
+ * @returns {UseQueryResult<boolean, Error>} A React Query result containing:
500
+ * - data: Boolean indicating if allowance is sufficient
501
+ * - isLoading: Loading state indicator
502
+ * - error: Any error that occurred during the check
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * const { data: hasAllowed, isLoading } = useMMAllowance(params, spokeProvider);
507
+ * ```
508
+ */
509
+ declare function useSwapAllowance(params: CreateIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
510
+
511
+ interface UseApproveReturn$1 {
512
+ approve: ({ params }: {
513
+ params: CreateIntentParams;
514
+ }) => Promise<boolean>;
515
+ isLoading: boolean;
516
+ error: Error | null;
517
+ resetError: () => void;
518
+ }
519
+ /**
520
+ * Hook for approving token spending for money market actions
521
+ * @param token The token to approve spending for
522
+ * @param spokeProvider The spoke provider instance for the chain
523
+ * @returns Object containing approve function, loading state, error state and reset function
524
+ * @example
525
+ * ```tsx
526
+ * const { approve, isLoading, error } = useApprove(token, spokeProvider);
527
+ *
528
+ * // Approve tokens for supply action
529
+ * await approve({ amount: "100", action: "supply" });
530
+ * ```
531
+ */
532
+ declare function useSwapApprove(params: CreateIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseApproveReturn$1;
533
+
534
+ type CancelIntentParams = {
535
+ intent: Intent;
536
+ raw?: boolean;
537
+ };
538
+ type CancelIntentResult = Result<TxReturnType<SpokeProvider, boolean>>;
539
+ /**
540
+ * Hook for canceling a swap intent order.
541
+ * Uses React Query's useMutation for better state management and caching.
542
+ *
543
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for canceling the intent
544
+ * @returns {UseMutationResult} Mutation result object containing mutation function and state
545
+ *
546
+ * @example
547
+ * ```typescript
548
+ * const { mutateAsync: cancelSwap, isPending } = useCancelSwap(spokeProvider);
549
+ *
550
+ * const handleCancelSwap = async () => {
551
+ * const result = await cancelSwap({
552
+ * intent: intentObject,
553
+ * raw: false // optional, defaults to false
554
+ * });
555
+ * };
556
+ * ```
557
+ */
558
+ declare function useCancelSwap(spokeProvider: SpokeProvider | undefined): UseMutationResult<CancelIntentResult, Error, CancelIntentParams>;
559
+
560
+ /**
561
+ * Hook for fetching intent details by intent created transaction hash from the backend API.
562
+ *
563
+ * This hook provides access to intent data associated with the transaction hash from when
564
+ * the intent was created on the hub chain, including intent details, events, and transaction
565
+ * information. The data is automatically fetched and cached using React Query.
566
+ *
567
+ * @param {string | undefined} txHash - The intent created transaction hash from the hub chain to fetch intent for. If undefined, the query will be disabled.
568
+ *
569
+ * @returns {UseQueryResult<IntentResponse | undefined>} A query result object containing:
570
+ * - data: The intent response data when available
571
+ * - isLoading: Boolean indicating if the request is in progress
572
+ * - error: Error object if the request failed
573
+ * - refetch: Function to manually trigger a data refresh
574
+ *
575
+ * @example
576
+ * ```typescript
577
+ * const { data: intent, isLoading, error } = useIntentByTxHash('0x123...');
578
+ *
579
+ * if (isLoading) return <div>Loading intent...</div>;
580
+ * if (error) return <div>Error: {error.message}</div>;
581
+ * if (intent) {
582
+ * console.log('Intent found:', intent.intentHash);
583
+ * }
584
+ * ```
585
+ *
586
+ * @remarks
587
+ * - Intents are only created on the hub chain, so the transaction hash must be from the hub chain
588
+ * - The query is disabled when txHash is undefined or empty
589
+ * - Uses React Query for efficient caching and state management
590
+ * - Automatically handles error states and loading indicators
591
+ */
592
+ declare const useBackendIntentByTxHash: (txHash: string | undefined, refetchInterval?: number) => UseQueryResult<IntentResponse | undefined>;
593
+
594
+ /**
595
+ * Hook for fetching intent details by intent hash from the backend API.
596
+ *
597
+ * This hook provides access to intent data using the intent hash directly,
598
+ * including intent details, events, and transaction information. The data is automatically
599
+ * fetched and cached using React Query.
600
+ *
601
+ * @param {string | undefined} intentHash - The intent hash to fetch intent for. If undefined, the query will be disabled.
602
+ *
603
+ * @returns {UseQueryResult<IntentResponse | undefined>} A query result object containing:
604
+ * - data: The intent response data when available
605
+ * - isLoading: Boolean indicating if the request is in progress
606
+ * - error: Error object if the request failed
607
+ * - refetch: Function to manually trigger a data refresh
608
+ *
609
+ * @example
610
+ * ```typescript
611
+ * const { data: intent, isLoading, error } = useIntentByHash('0xabc...');
612
+ *
613
+ * if (isLoading) return <div>Loading intent...</div>;
614
+ * if (error) return <div>Error: {error.message}</div>;
615
+ * if (intent) {
616
+ * console.log('Intent found:', intent.intentHash);
617
+ * console.log('Open status:', intent.open);
618
+ * }
619
+ * ```
620
+ *
621
+ * @remarks
622
+ * - The query is disabled when intentHash is undefined or empty
623
+ * - Uses React Query for efficient caching and state management
624
+ * - Automatically handles error states and loading indicators
625
+ */
626
+ declare const useBackendIntentByHash: (intentHash: string | undefined) => UseQueryResult<IntentResponse | undefined>;
627
+
628
+ /**
629
+ * Hook for fetching the solver orderbook from the backend API.
630
+ *
631
+ * This hook provides access to the solver orderbook data, including intent states
632
+ * and intent data for all available intents. The data is automatically fetched
633
+ * and cached using React Query with pagination support.
634
+ *
635
+ * @param {Object} params - Pagination parameters for the orderbook
636
+ * @param {string} params.offset - The offset for pagination (number as string)
637
+ * @param {string} params.limit - The limit for pagination (number as string)
638
+ *
639
+ * @returns {UseQueryResult<OrderbookResponse | undefined>} A query result object containing:
640
+ * - data: The orderbook response data when available
641
+ * - isLoading: Boolean indicating if the request is in progress
642
+ * - error: Error object if the request failed
643
+ * - refetch: Function to manually trigger a data refresh
644
+ *
645
+ * @example
646
+ * ```typescript
647
+ * const { data: orderbook, isLoading, error } = useOrderbook({
648
+ * offset: '0',
649
+ * limit: '10'
650
+ * });
651
+ *
652
+ * if (isLoading) return <div>Loading orderbook...</div>;
653
+ * if (error) return <div>Error: {error.message}</div>;
654
+ * if (orderbook) {
655
+ * console.log('Total intents:', orderbook.total);
656
+ * console.log('Intents:', orderbook.data);
657
+ * }
658
+ * ```
659
+ *
660
+ * @remarks
661
+ * - The query is disabled when params are undefined or invalid
662
+ * - Uses React Query for efficient caching and state management
663
+ * - Automatically handles error states and loading indicators
664
+ * - Stale time of 30 seconds for real-time orderbook data
665
+ * - Supports pagination through offset and limit parameters
666
+ */
667
+ declare const useBackendOrderbook: (params: {
668
+ offset: string;
669
+ limit: string;
670
+ } | undefined) => UseQueryResult<OrderbookResponse | undefined>;
671
+
672
+ /**
673
+ * Hook for fetching money market position for a specific user from the backend API.
674
+ *
675
+ * This hook provides access to a user's money market positions, including their
676
+ * aToken balances, variable debt token balances, and associated reserve information.
677
+ * The data is automatically fetched and cached using React Query.
678
+ *
679
+ * @param {string | undefined} userAddress - The user's wallet address. If undefined, the query will be disabled.
680
+ *
681
+ * @returns {UseQueryResult<MoneyMarketPosition | undefined>} A query result object containing:
682
+ * - data: The money market position data when available
683
+ * - isLoading: Boolean indicating if the request is in progress
684
+ * - error: Error object if the request failed
685
+ * - refetch: Function to manually trigger a data refresh
686
+ *
687
+ * @example
688
+ * ```typescript
689
+ * const { data: position, isLoading, error } = useMoneyMarketPosition('0x123...');
690
+ *
691
+ * if (isLoading) return <div>Loading position...</div>;
692
+ * if (error) return <div>Error: {error.message}</div>;
693
+ * if (position) {
694
+ * console.log('User address:', position.userAddress);
695
+ * console.log('Positions:', position.positions);
696
+ * }
697
+ * ```
698
+ *
699
+ * @remarks
700
+ * - The query is disabled when userAddress is undefined or empty
701
+ * - Uses React Query for efficient caching and state management
702
+ * - Automatically handles error states and loading indicators
703
+ * - Includes user's aToken and debt token balances across all reserves
704
+ */
705
+ declare const useBackendMoneyMarketPosition: (userAddress: string | undefined) => UseQueryResult<MoneyMarketPosition | undefined>;
706
+
707
+ /**
708
+ * Hook for fetching all money market assets from the backend API.
709
+ *
710
+ * This hook provides access to all available money market assets, including
711
+ * their reserve information, liquidity rates, borrow rates, and market statistics.
712
+ * The data is automatically fetched and cached using React Query.
713
+ *
714
+ * @returns {UseQueryResult<MoneyMarketAsset[]>} A query result object containing:
715
+ * - data: Array of money market asset data when available
716
+ * - isLoading: Boolean indicating if the request is in progress
717
+ * - error: Error object if the request failed
718
+ * - refetch: Function to manually trigger a data refresh
719
+ *
720
+ * @example
721
+ * ```typescript
722
+ * const { data: assets, isLoading, error } = useAllMoneyMarketAssets();
723
+ *
724
+ * if (isLoading) return <div>Loading assets...</div>;
725
+ * if (error) return <div>Error: {error.message}</div>;
726
+ * if (assets) {
727
+ * console.log('Total assets:', assets.length);
728
+ * assets.forEach(asset => {
729
+ * console.log(`${asset.symbol}: ${asset.liquidityRate} liquidity rate`);
730
+ * });
731
+ * }
732
+ * ```
733
+ *
734
+ * @remarks
735
+ * - Uses React Query for efficient caching and state management
736
+ * - Automatically handles error states and loading indicators
737
+ * - Returns comprehensive asset information including rates and statistics
738
+ * - No parameters required - fetches all available assets
739
+ */
740
+ declare const useBackendAllMoneyMarketAssets: () => UseQueryResult<MoneyMarketAsset[]>;
741
+
742
+ /**
743
+ * Hook for fetching specific money market asset details from the backend API.
744
+ *
745
+ * This hook provides access to detailed information for a specific money market asset,
746
+ * including reserve information, liquidity rates, borrow rates, and market statistics.
747
+ * The data is automatically fetched and cached using React Query.
748
+ *
749
+ * @param {string | undefined} reserveAddress - The reserve contract address. If undefined, the query will be disabled.
750
+ *
751
+ * @returns {UseQueryResult<MoneyMarketAsset | undefined>} A query result object containing:
752
+ * - data: The money market asset data when available
753
+ * - isLoading: Boolean indicating if the request is in progress
754
+ * - error: Error object if the request failed
755
+ * - refetch: Function to manually trigger a data refresh
756
+ *
757
+ * @example
758
+ * ```typescript
759
+ * const { data: asset, isLoading, error } = useMoneyMarketAsset('0xabc...');
760
+ *
761
+ * if (isLoading) return <div>Loading asset...</div>;
762
+ * if (error) return <div>Error: {error.message}</div>;
763
+ * if (asset) {
764
+ * console.log('Asset symbol:', asset.symbol);
765
+ * console.log('Liquidity rate:', asset.liquidityRate);
766
+ * console.log('Variable borrow rate:', asset.variableBorrowRate);
767
+ * }
768
+ * ```
769
+ *
770
+ * @remarks
771
+ * - The query is disabled when reserveAddress is undefined or empty
772
+ * - Uses React Query for efficient caching and state management
773
+ * - Automatically handles error states and loading indicators
774
+ * - Returns comprehensive asset information for the specified reserve
775
+ */
776
+ declare const useBackendMoneyMarketAsset: (reserveAddress: string | undefined) => UseQueryResult<MoneyMarketAsset | undefined>;
777
+
778
+ /**
779
+ * Hook for fetching borrowers for a specific money market asset from the backend API.
780
+ *
781
+ * This hook provides access to the list of borrowers for a specific money market asset,
782
+ * with pagination support. The data is automatically fetched and cached using React Query.
783
+ *
784
+ * @param {Object} params - Parameters for fetching asset borrowers
785
+ * @param {string | undefined} params.reserveAddress - The reserve contract address. If undefined, the query will be disabled.
786
+ * @param {string} params.offset - The offset for pagination (number as string)
787
+ * @param {string} params.limit - The limit for pagination (number as string)
788
+ *
789
+ * @returns {UseQueryResult<MoneyMarketAssetBorrowers | undefined>} A query result object containing:
790
+ * - data: The asset borrowers data when available
791
+ * - isLoading: Boolean indicating if the request is in progress
792
+ * - error: Error object if the request failed
793
+ * - refetch: Function to manually trigger a data refresh
794
+ *
795
+ * @example
796
+ * ```typescript
797
+ * const { data: borrowers, isLoading, error } = useMoneyMarketAssetBorrowers({
798
+ * reserveAddress: '0xabc...',
799
+ * offset: '0',
800
+ * limit: '20'
801
+ * });
802
+ *
803
+ * if (isLoading) return <div>Loading borrowers...</div>;
804
+ * if (error) return <div>Error: {error.message}</div>;
805
+ * if (borrowers) {
806
+ * console.log('Total borrowers:', borrowers.total);
807
+ * console.log('Borrowers:', borrowers.borrowers);
808
+ * }
809
+ * ```
810
+ *
811
+ * @remarks
812
+ * - The query is disabled when reserveAddress is undefined or empty
813
+ * - Uses React Query for efficient caching and state management
814
+ * - Automatically handles error states and loading indicators
815
+ * - Supports pagination through offset and limit parameters
816
+ */
817
+ declare const useBackendMoneyMarketAssetBorrowers: (params: {
818
+ reserveAddress: string | undefined;
819
+ offset: string;
820
+ limit: string;
821
+ }) => UseQueryResult<MoneyMarketAssetBorrowers | undefined>;
822
+
823
+ /**
824
+ * Hook for fetching suppliers for a specific money market asset from the backend API.
825
+ *
826
+ * This hook provides access to the list of suppliers for a specific money market asset,
827
+ * with pagination support. The data is automatically fetched and cached using React Query.
828
+ *
829
+ * @param {Object} params - Parameters for fetching asset suppliers
830
+ * @param {string | undefined} params.reserveAddress - The reserve contract address. If undefined, the query will be disabled.
831
+ * @param {string} params.offset - The offset for pagination (number as string)
832
+ * @param {string} params.limit - The limit for pagination (number as string)
833
+ *
834
+ * @returns {UseQueryResult<MoneyMarketAssetSuppliers | undefined>} A query result object containing:
835
+ * - data: The asset suppliers data when available
836
+ * - isLoading: Boolean indicating if the request is in progress
837
+ * - error: Error object if the request failed
838
+ * - refetch: Function to manually trigger a data refresh
839
+ *
840
+ * @example
841
+ * ```typescript
842
+ * const { data: suppliers, isLoading, error } = useMoneyMarketAssetSuppliers({
843
+ * reserveAddress: '0xabc...',
844
+ * offset: '0',
845
+ * limit: '20'
846
+ * });
847
+ *
848
+ * if (isLoading) return <div>Loading suppliers...</div>;
849
+ * if (error) return <div>Error: {error.message}</div>;
850
+ * if (suppliers) {
851
+ * console.log('Total suppliers:', suppliers.total);
852
+ * console.log('Suppliers:', suppliers.suppliers);
853
+ * }
854
+ * ```
855
+ *
856
+ * @remarks
857
+ * - The query is disabled when reserveAddress is undefined or empty
858
+ * - Uses React Query for efficient caching and state management
859
+ * - Automatically handles error states and loading indicators
860
+ * - Supports pagination through offset and limit parameters
861
+ */
862
+ declare const useBackendMoneyMarketAssetSuppliers: (params: {
863
+ reserveAddress: string | undefined;
864
+ offset: string;
865
+ limit: string;
866
+ }) => UseQueryResult<MoneyMarketAssetSuppliers | undefined>;
867
+
868
+ /**
869
+ * Hook for fetching all money market borrowers from the backend API.
870
+ *
871
+ * This hook provides access to the list of all borrowers across all money market assets,
872
+ * with pagination support. The data is automatically fetched and cached using React Query.
873
+ *
874
+ * @param {Object} params - Pagination parameters for fetching all borrowers
875
+ * @param {string} params.offset - The offset for pagination (number as string)
876
+ * @param {string} params.limit - The limit for pagination (number as string)
877
+ *
878
+ * @returns {UseQueryResult<MoneyMarketBorrowers | undefined>} A query result object containing:
879
+ * - data: The all borrowers data when available
880
+ * - isLoading: Boolean indicating if the request is in progress
881
+ * - error: Error object if the request failed
882
+ * - refetch: Function to manually trigger a data refresh
883
+ *
884
+ * @example
885
+ * ```typescript
886
+ * const { data: borrowers, isLoading, error } = useAllMoneyMarketBorrowers({
887
+ * offset: '0',
888
+ * limit: '50'
889
+ * });
890
+ *
891
+ * if (isLoading) return <div>Loading borrowers...</div>;
892
+ * if (error) return <div>Error: {error.message}</div>;
893
+ * if (borrowers) {
894
+ * console.log('Total borrowers:', borrowers.total);
895
+ * console.log('Borrowers:', borrowers.borrowers);
896
+ * }
897
+ * ```
898
+ *
899
+ * @remarks
900
+ * - The query is disabled when params are undefined or invalid
901
+ * - Uses React Query for efficient caching and state management
902
+ * - Automatically handles error states and loading indicators
903
+ * - Supports pagination through offset and limit parameters
904
+ * - Returns borrowers across all money market assets
905
+ */
906
+ declare const useBackendAllMoneyMarketBorrowers: (params: {
907
+ offset: string;
908
+ limit: string;
909
+ } | undefined) => UseQueryResult<MoneyMarketBorrowers | undefined>;
910
+
911
+ /**
912
+ * Hook for checking token allowance for bridge operations.
913
+ *
914
+ * This hook verifies if the user has approved enough tokens for a specific bridge action.
915
+ * It automatically queries and tracks the allowance status.
916
+ *
917
+ * @param {BridgeParams} params - The parameters for the bridge to check allowance for.
918
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for allowance checks
919
+ *
920
+ * @returns {UseQueryResult<boolean, Error>} A React Query result containing:
921
+ * - data: Boolean indicating if allowance is sufficient
922
+ * - isLoading: Loading state indicator
923
+ * - error: Any error that occurred during the check
924
+ *
925
+ * @example
926
+ * ```typescript
927
+ * const { data: hasAllowed, isLoading } = useBridgeAllowance(params, spokeProvider);
928
+ * ```
929
+ */
930
+ declare function useBridgeAllowance(params: CreateBridgeIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
931
+
932
+ interface UseBridgeApproveReturn {
933
+ approve: (params: CreateBridgeIntentParams) => Promise<boolean>;
934
+ isLoading: boolean;
935
+ error: Error | null;
936
+ resetError: () => void;
937
+ }
938
+ /**
939
+ * Hook for approving token spending for bridge actions
940
+ * @param spokeProvider The spoke provider instance for the chain
941
+ * @returns Object containing approve function, loading state, error state and reset function
942
+ * @example
943
+ * ```tsx
944
+ * const { approve, isLoading, error } = useBridgeApprove(spokeProvider);
945
+ *
946
+ * // Approve tokens for bridge action
947
+ * await approve({
948
+ * srcChainId: '0x2105.base',
949
+ * srcAsset: '0x...',
950
+ * amount: 1000n,
951
+ * dstChainId: '0x89.polygon',
952
+ * dstAsset: '0x...',
953
+ * recipient: '0x...'
954
+ * });
955
+ * ```
956
+ */
957
+ declare function useBridgeApprove(spokeProvider: SpokeProvider | undefined): UseBridgeApproveReturn;
958
+
959
+ /**
960
+ * Hook for executing bridge transactions to transfer tokens between chains.
961
+ * Uses React Query's useMutation for better state management and caching.
962
+ *
963
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for the bridge
964
+ * @returns {UseMutationResult} Mutation result object containing mutation function and state
965
+ *
966
+ * @example
967
+ * ```typescript
968
+ * const { mutateAsync: bridge, isPending } = useBridge(spokeProvider);
969
+ *
970
+ * const handleBridge = async () => {
971
+ * const result = await bridge({
972
+ * srcChainId: '0x2105.base',
973
+ * srcAsset: '0x...',
974
+ * amount: 1000n,
975
+ * dstChainId: '0x89.polygon',
976
+ * dstAsset: '0x...',
977
+ * recipient: '0x...'
978
+ * });
979
+ *
980
+ * console.log('Bridge transaction hashes:', {
981
+ * spokeTxHash: result.spokeTxHash,
982
+ * hubTxHash: result.hubTxHash
983
+ * });
984
+ * };
985
+ * ```
986
+ */
987
+ declare function useBridge(spokeProvider: SpokeProvider | undefined): UseMutationResult<Result<[SpokeTxHash, HubTxHash], BridgeError<BridgeErrorCode>>, Error, CreateBridgeIntentParams>;
988
+
989
+ /**
990
+ * Hook for getting the amount available to be bridged.
991
+ *
992
+ * This hook is used to check if a target chain has enough balance to bridge when bridging.
993
+ * It automatically queries and tracks the available amount to be bridged.
994
+ *
995
+ * @param {SpokeChainId | undefined} chainId - The chain ID to get the balance for
996
+ * @param {string | undefined} token - The token address to get the balance for
997
+ *
998
+ * @returns {UseQueryResult<bigint, Error>} A React Query result containing:
999
+ * - data: The available amount to be bridged (bigint)
1000
+ * - error: Any error that occurred during the check
1001
+ *
1002
+ * @example
1003
+ * ```typescript
1004
+ * const { data: balance, isLoading } = useSpokeAssetManagerTokenBalance(chainId, tokenAddress);
1005
+ *
1006
+ * if (balance) {
1007
+ * console.log('Asset manager token balance:', balance.toString());
1008
+ * }
1009
+ * ```
1010
+ */
1011
+ declare function useGetBridgeableAmount(from: XToken$1 | undefined, to: XToken$1 | undefined): UseQueryResult<bigint, Error>;
1012
+
1013
+ /**
1014
+ /**
1015
+ * Hook for retrieving all bridgeable tokens from a source token on one chain to a destination chain.
1016
+ *
1017
+ * This hook queries and tracks the set of tokens on the destination chain that can be bridged to,
1018
+ * given a source chain, destination chain, and source token address.
1019
+ *
1020
+ * @param {SpokeChainId | undefined} from - The source chain ID
1021
+ * @param {SpokeChainId | undefined} to - The destination chain ID
1022
+ * @param {string | undefined} token - The source token address
1023
+ *
1024
+ * @returns {UseQueryResult<XToken[], Error>} A React Query result containing:
1025
+ * - data: Array of bridgeable tokens (XToken[]) on the destination chain
1026
+ * - error: Any error that occurred during the query
1027
+ *
1028
+ *
1029
+ * @example
1030
+ * ```typescript
1031
+ * const { data: bridgeableTokens, isLoading } = useGetBridgeableTokens(
1032
+ * fromChainId,
1033
+ * toChainId,
1034
+ * fromTokenAddress
1035
+ * );
1036
+ *
1037
+ * if (bridgeableTokens && bridgeableTokens.length > 0) {
1038
+ * bridgeableTokens.forEach(token => {
1039
+ * console.log(`Bridgeable token: ${token.symbol} (${token.address}) on chain ${token.xChainId}`);
1040
+ * });
1041
+ * } else {
1042
+ * console.log('No bridgeable tokens found for the selected route.');
1043
+ * }
1044
+ * ```
1045
+ */
1046
+ declare function useGetBridgeableTokens(from: SpokeChainId | undefined, to: SpokeChainId | undefined, token: string | undefined): UseQueryResult<XToken$1[], Error>;
1047
+
1048
+ /**
1049
+ * Hook for executing stake transactions to stake SODA tokens and receive xSODA shares.
1050
+ * Uses React Query's useMutation for better state management and caching.
1051
+ *
1052
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the stake
1053
+ * @returns {UseMutationResult<[SpokeTxHash, HubTxHash], Error, StakeParams>} Mutation result object containing mutation function and state
1054
+ *
1055
+ * @example
1056
+ * ```typescript
1057
+ * const { mutateAsync: stake, isPending } = useStake(spokeProvider);
1058
+ *
1059
+ * const handleStake = async () => {
1060
+ * const result = await stake({
1061
+ * amount: 1000000000000000000n, // 1 SODA
1062
+ * account: '0x...'
1063
+ * });
1064
+ *
1065
+ * console.log('Stake successful:', result);
1066
+ * };
1067
+ * ```
1068
+ */
1069
+ declare function useStake(spokeProvider: SpokeProvider | undefined): UseMutationResult<[SpokeTxHash, HubTxHash], Error, StakeParams>;
1070
+
1071
+ /**
1072
+ * Hook for approving SODA token spending for staking operations.
1073
+ * Uses React Query's useMutation for better state management and caching.
1074
+ *
1075
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the approval
1076
+ * @returns {UseMutationResult<TxReturnType<SpokeProvider, false>, Error, Omit<StakeParams, 'action'>>} Mutation result object containing mutation function and state
1077
+ *
1078
+ * @example
1079
+ * ```typescript
1080
+ * const { mutateAsync: approve, isPending } = useStakeApprove(spokeProvider);
1081
+ *
1082
+ * const handleApprove = async () => {
1083
+ * const result = await approve({
1084
+ * amount: 1000000000000000000n, // 1 SODA
1085
+ * account: '0x...'
1086
+ * });
1087
+ *
1088
+ * console.log('Approval successful:', result);
1089
+ * };
1090
+ * ```
1091
+ */
1092
+ declare function useStakeApprove(spokeProvider: SpokeProvider | undefined): UseMutationResult<TxReturnType<SpokeProvider, false>, Error, Omit<StakeParams, 'action'>>;
1093
+
1094
+ /**
1095
+ * Hook for checking SODA token allowance for staking operations.
1096
+ * Uses React Query for efficient caching and state management.
1097
+ *
1098
+ * @param {Omit<StakeParams, 'action'> | undefined} params - The staking parameters. If undefined, the query will be disabled.
1099
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the allowance check
1100
+ * @returns {UseQueryResult<boolean, Error>} Query result object containing allowance data and state
1101
+ *
1102
+ * @example
1103
+ * ```typescript
1104
+ * const { data: hasAllowed, isLoading } = useStakeAllowance(
1105
+ * {
1106
+ * amount: 1000000000000000000n, // 1 SODA
1107
+ * account: '0x...'
1108
+ * },
1109
+ * spokeProvider
1110
+ * );
1111
+ *
1112
+ * if (isLoading) return <div>Checking allowance...</div>;
1113
+ * if (hasAllowed) {
1114
+ * console.log('Sufficient allowance for staking');
1115
+ * }
1116
+ * ```
1117
+ */
1118
+ declare function useStakeAllowance(params: Omit<StakeParams, 'action'> | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
1119
+
1120
+ /**
1121
+ * Hook for executing unstake transactions to unstake xSODA shares.
1122
+ * Uses React Query's useMutation for better state management and caching.
1123
+ *
1124
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the unstake
1125
+ * @returns {UseMutationResult<[SpokeTxHash, HubTxHash], Error, Omit<UnstakeParams, 'action'>>} Mutation result object containing mutation function and state
1126
+ *
1127
+ * @example
1128
+ * ```typescript
1129
+ * const { mutateAsync: unstake, isPending } = useUnstake(spokeProvider);
1130
+ *
1131
+ * const handleUnstake = async () => {
1132
+ * const result = await unstake({
1133
+ * amount: 1000000000000000000n, // 1 xSODA
1134
+ * account: '0x...'
1135
+ * });
1136
+ *
1137
+ * console.log('Unstake successful:', result);
1138
+ * };
1139
+ * ```
1140
+ */
1141
+ declare function useUnstake(spokeProvider: SpokeProvider | undefined): UseMutationResult<[SpokeTxHash, HubTxHash], Error, Omit<UnstakeParams, 'action'>>;
1142
+
1143
+ /**
1144
+ * Hook for executing claim transactions to claim unstaked SODA tokens after the unstaking period.
1145
+ * Uses React Query's useMutation for better state management and caching.
1146
+ *
1147
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the claim
1148
+ * @returns {UseMutationResult<[SpokeTxHash, HubTxHash], Error, Omit<ClaimParams, 'action'>>} Mutation result object containing mutation function and state
1149
+ *
1150
+ * @example
1151
+ * ```typescript
1152
+ * const { mutateAsync: claim, isPending } = useClaim(spokeProvider);
1153
+ *
1154
+ * const handleClaim = async () => {
1155
+ * const result = await claim({
1156
+ * requestId: 1n
1157
+ * });
1158
+ *
1159
+ * console.log('Claim successful:', result);
1160
+ * };
1161
+ * ```
1162
+ */
1163
+ declare function useClaim(spokeProvider: SpokeProvider | undefined): UseMutationResult<[SpokeTxHash, HubTxHash], Error, Omit<ClaimParams, 'action'>>;
1164
+
1165
+ /**
1166
+ * Hook for executing cancel unstake transactions to cancel pending unstake requests.
1167
+ * Uses React Query's useMutation for better state management and caching.
1168
+ *
1169
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the cancel unstake
1170
+ * @returns {UseMutationResult<[SpokeTxHash, HubTxHash], Error, Omit<CancelUnstakeParams, 'action'>>} Mutation result object containing mutation function and state
1171
+ *
1172
+ * @example
1173
+ * ```typescript
1174
+ * const { mutateAsync: cancelUnstake, isPending } = useCancelUnstake(spokeProvider);
1175
+ *
1176
+ * const handleCancelUnstake = async () => {
1177
+ * const result = await cancelUnstake({
1178
+ * requestId: 1n
1179
+ * });
1180
+ *
1181
+ * console.log('Cancel unstake successful:', result);
1182
+ * };
1183
+ * ```
1184
+ */
1185
+ declare function useCancelUnstake(spokeProvider: SpokeProvider | undefined): UseMutationResult<[SpokeTxHash, HubTxHash], Error, Omit<CancelUnstakeParams, 'action'>>;
1186
+
1187
+ /**
1188
+ * Hook for fetching comprehensive staking information for a user.
1189
+ * Uses React Query for efficient caching and state management.
1190
+ *
1191
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the query
1192
+ * @param {number} refetchInterval - The interval in milliseconds to refetch data (default: 5000)
1193
+ * @returns {UseQueryResult<StakingInfo, Error>} Query result object containing staking info and state
1194
+ *
1195
+ * @example
1196
+ * ```typescript
1197
+ * const { data: stakingInfo, isLoading, error } = useStakingInfo(spokeProvider);
1198
+ *
1199
+ * if (isLoading) return <div>Loading staking info...</div>;
1200
+ * if (stakingInfo) {
1201
+ * console.log('Total staked:', stakingInfo.totalStaked);
1202
+ * console.log('User staked:', stakingInfo.userStaked);
1203
+ * console.log('xSODA balance:', stakingInfo.userXSodaBalance);
1204
+ * }
1205
+ * ```
1206
+ */
1207
+ declare function useStakingInfo(spokeProvider: SpokeProvider | undefined, refetchInterval?: number): UseQueryResult<StakingInfo, Error>;
1208
+
1209
+ type UnstakingInfoWithPenalty = UnstakingInfo & {
1210
+ requestsWithPenalty: UnstakeRequestWithPenalty[];
1211
+ };
1212
+ /**
1213
+ * Hook for fetching unstaking information with penalty calculations from the stakedSoda contract.
1214
+ * Uses React Query for efficient caching and state management.
1215
+ *
1216
+ * @param {string | undefined} userAddress - The user address to fetch unstaking info for
1217
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider instance
1218
+ * @param {number} refetchInterval - The interval in milliseconds to refetch data (default: 5000)
1219
+ * @returns {UseQueryResult<UnstakingInfoWithPenalty, Error>} Query result object containing unstaking info with penalties and state
1220
+ *
1221
+ * @example
1222
+ * ```typescript
1223
+ * const { data: unstakingInfo, isLoading, error } = useUnstakingInfoWithPenalty(userAddress, spokeProvider);
1224
+ *
1225
+ * if (isLoading) return <div>Loading unstaking info...</div>;
1226
+ * if (unstakingInfo) {
1227
+ * console.log('Total unstaking:', unstakingInfo.totalUnstaking);
1228
+ * unstakingInfo.requestsWithPenalty.forEach(request => {
1229
+ * console.log('Penalty:', request.penaltyPercentage + '%');
1230
+ * console.log('Claimable amount:', request.claimableAmount);
1231
+ * });
1232
+ * }
1233
+ * ```
1234
+ */
1235
+ declare function useUnstakingInfoWithPenalty(userAddress: string | undefined, spokeProvider: SpokeProvider | undefined, refetchInterval?: number): UseQueryResult<UnstakingInfoWithPenalty, Error>;
1236
+
1237
+ /**
1238
+ * Hook for fetching staking configuration from the stakedSoda contract.
1239
+ * Uses React Query for efficient caching and state management.
1240
+ *
1241
+ * @param {number} refetchInterval - The interval in milliseconds to refetch data (default: 30000)
1242
+ * @returns {UseQueryResult<StakingConfig, Error>} Query result object containing staking config and state
1243
+ *
1244
+ * @example
1245
+ * ```typescript
1246
+ * const { data: stakingConfig, isLoading, error } = useStakingConfig();
1247
+ *
1248
+ * if (isLoading) return <div>Loading staking config...</div>;
1249
+ * if (stakingConfig) {
1250
+ * console.log('Unstaking period (days):', stakingConfig.unstakingPeriod / 86400n);
1251
+ * console.log('Max penalty (%):', stakingConfig.maxPenalty);
1252
+ * }
1253
+ * ```
1254
+ */
1255
+ declare function useStakingConfig(refetchInterval?: number): UseQueryResult<StakingConfig, Error>;
1256
+
1257
+ /**
1258
+ * Hook for fetching stake ratio estimates (xSoda amount and preview deposit).
1259
+ * Uses React Query for efficient caching and state management.
1260
+ *
1261
+ * @param {bigint | undefined} amount - The amount of SODA to estimate stake for
1262
+ * @param {number} refetchInterval - The interval in milliseconds to refetch data (default: 10000)
1263
+ * @returns {UseQueryResult<[bigint, bigint], Error>} Query result object containing stake ratio estimates and state
1264
+ *
1265
+ * @example
1266
+ * ```typescript
1267
+ * const { data: stakeRatio, isLoading, error } = useStakeRatio(1000000000000000000n); // 1 SODA
1268
+ *
1269
+ * if (isLoading) return <div>Loading stake ratio...</div>;
1270
+ * if (stakeRatio) {
1271
+ * const [xSodaAmount, previewDepositAmount] = stakeRatio;
1272
+ * console.log('xSoda amount:', xSodaAmount);
1273
+ * console.log('Preview deposit:', previewDepositAmount);
1274
+ * }
1275
+ * ```
1276
+ */
1277
+ declare function useStakeRatio(amount: bigint | undefined, refetchInterval?: number): UseQueryResult<[bigint, bigint], Error>;
1278
+
1279
+ /**
1280
+ * Hook for fetching instant unstake ratio estimates.
1281
+ * Uses React Query for efficient caching and state management.
1282
+ *
1283
+ * @param {bigint | undefined} amount - The amount of xSoda to estimate instant unstake for
1284
+ * @param {number} refetchInterval - The interval in milliseconds to refetch data (default: 10000)
1285
+ * @returns {UseQueryResult<bigint, Error>} Query result object containing instant unstake ratio and state
1286
+ *
1287
+ * @example
1288
+ * ```typescript
1289
+ * const { data: instantUnstakeRatio, isLoading, error } = useInstantUnstakeRatio(1000000000000000000n); // 1 xSoda
1290
+ *
1291
+ * if (isLoading) return <div>Loading instant unstake ratio...</div>;
1292
+ * if (instantUnstakeRatio) {
1293
+ * console.log('Instant unstake ratio:', instantUnstakeRatio);
1294
+ * }
1295
+ * ```
1296
+ */
1297
+ declare function useInstantUnstakeRatio(amount: bigint | undefined, refetchInterval?: number): UseQueryResult<bigint, Error>;
1298
+
1299
+ /**
1300
+ * Hook for fetching converted assets amount for xSODA shares.
1301
+ * Uses React Query for efficient caching and state management.
1302
+ *
1303
+ * @param {bigint | undefined} amount - The amount of xSODA shares to convert
1304
+ * @param {number} refetchInterval - The interval in milliseconds to refetch data (default: 10000)
1305
+ * @returns {UseQueryResult<bigint, Error>} Query result object containing converted assets amount and state
1306
+ *
1307
+ * @example
1308
+ * ```typescript
1309
+ * const { data: convertedAssets, isLoading, error } = useConvertedAssets(1000000000000000000n); // 1 xSODA
1310
+ *
1311
+ * if (isLoading) return <div>Loading converted assets...</div>;
1312
+ * if (convertedAssets) {
1313
+ * console.log('Converted assets:', convertedAssets);
1314
+ * }
1315
+ * ```
1316
+ */
1317
+ declare function useConvertedAssets(amount: bigint | undefined, refetchInterval?: number): UseQueryResult<bigint, Error>;
1318
+
1319
+ /**
1320
+ * Hook for executing instant unstake operations.
1321
+ * Uses React Query for efficient state management and error handling.
1322
+ *
1323
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider for the transaction
1324
+ * @returns {UseMutationResult<[string, string], Error, Omit<InstantUnstakeParams, 'action'>>} Mutation result object containing instant unstake state and methods
1325
+ *
1326
+ * @example
1327
+ * ```typescript
1328
+ * const { mutateAsync: instantUnstake, isPending } = useInstantUnstake(spokeProvider);
1329
+ *
1330
+ * const handleInstantUnstake = async () => {
1331
+ * const result = await instantUnstake({
1332
+ * amount: 1000000000000000000n,
1333
+ * minAmount: 950000000000000000n,
1334
+ * account: '0x...'
1335
+ * });
1336
+ * console.log('Instant unstake successful:', result);
1337
+ * };
1338
+ * ```
1339
+ */
1340
+ declare function useInstantUnstake(spokeProvider: SpokeProvider | undefined): UseMutationResult<[string, string], Error, Omit<InstantUnstakeParams, 'action'>>;
1341
+
1342
+ /**
1343
+ * Hook for checking xSODA token allowance for unstaking operations.
1344
+ * Uses React Query for efficient caching and state management.
1345
+ *
1346
+ * @param {Omit<UnstakeParams, 'action'> | undefined} params - The unstaking parameters. If undefined, the query will be disabled.
1347
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the allowance check
1348
+ * @returns {UseQueryResult<boolean, Error>} Query result object containing allowance data and state
1349
+ *
1350
+ * @example
1351
+ * ```typescript
1352
+ * const { data: hasAllowed, isLoading } = useUnstakeAllowance(
1353
+ * {
1354
+ * amount: 1000000000000000000n, // 1 xSODA
1355
+ * account: '0x...'
1356
+ * },
1357
+ * spokeProvider
1358
+ * );
1359
+ *
1360
+ * if (isLoading) return <div>Checking allowance...</div>;
1361
+ * if (hasAllowed) {
1362
+ * console.log('Sufficient allowance for unstaking');
1363
+ * }
1364
+ * ```
1365
+ */
1366
+ declare function useUnstakeAllowance(params: Omit<UnstakeParams, 'action'> | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
1367
+
1368
+ /**
1369
+ * Hook for approving xSODA token spending for unstaking operations.
1370
+ * Uses React Query's useMutation for better state management and caching.
1371
+ *
1372
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the approval
1373
+ * @returns {UseMutationResult<TxReturnType<SpokeProvider, false>, Error, Omit<UnstakeParams, 'action'>>} Mutation result object containing mutation function and state
1374
+ *
1375
+ * @example
1376
+ * ```typescript
1377
+ * const { mutateAsync: approve, isPending } = useUnstakeApprove(spokeProvider);
1378
+ *
1379
+ * const handleApprove = async () => {
1380
+ * const result = await approve({
1381
+ * amount: 1000000000000000000n, // 1 xSODA
1382
+ * account: '0x...'
1383
+ * });
1384
+ *
1385
+ * console.log('Approval successful:', result);
1386
+ * };
1387
+ * ```
1388
+ */
1389
+ declare function useUnstakeApprove(spokeProvider: SpokeProvider | undefined): UseMutationResult<TxReturnType<SpokeProvider, false>, Error, Omit<UnstakeParams, 'action'>>;
1390
+
1391
+ /**
1392
+ * Hook for fetching unstaking information from the stakedSoda contract.
1393
+ * Uses React Query for efficient caching and state management.
1394
+ *
1395
+ * @param {string | undefined} userAddress - The user address to fetch unstaking info for
1396
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider instance
1397
+ * @param {number} refetchInterval - The interval in milliseconds to refetch data (default: 5000)
1398
+ * @returns {UseQueryResult<UnstakingInfo, Error>} Query result object containing unstaking info and state
1399
+ *
1400
+ * @example
1401
+ * ```typescript
1402
+ * const { data: unstakingInfo, isLoading, error } = useUnstakingInfo(userAddress, spokeProvider);
1403
+ *
1404
+ * if (isLoading) return <div>Loading unstaking info...</div>;
1405
+ * if (unstakingInfo) {
1406
+ * console.log('Total unstaking:', unstakingInfo.totalUnstaking);
1407
+ * unstakingInfo.userUnstakeSodaRequests.forEach(request => {
1408
+ * console.log('Request amount:', request.request.amount);
1409
+ * });
1410
+ * }
1411
+ * ```
1412
+ */
1413
+ declare function useUnstakingInfo(userAddress: string | undefined, spokeProvider: SpokeProvider | undefined, refetchInterval?: number): UseQueryResult<UnstakingInfo, Error>;
1414
+
1415
+ /**
1416
+ * Hook for approving xSODA token spending for instant unstaking operations.
1417
+ * Uses React Query's useMutation for better state management and caching.
1418
+ *
1419
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the approval
1420
+ * @returns {UseMutationResult<TxReturnType<SpokeProvider, false>, Error, Omit<InstantUnstakeParams, 'action'>>} Mutation result object containing mutation function and state
1421
+ *
1422
+ * @example
1423
+ * ```typescript
1424
+ * const { mutateAsync: approve, isPending } = useInstantUnstakeApprove(spokeProvider);
1425
+ *
1426
+ * const handleApprove = async () => {
1427
+ * const result = await approve({
1428
+ * amount: 1000000000000000000n, // 1 xSODA
1429
+ * minAmount: 950000000000000000n, // 0.95 SODA
1430
+ * account: '0x...'
1431
+ * });
1432
+ *
1433
+ * console.log('Approval successful:', result);
1434
+ * };
1435
+ * ```
1436
+ */
1437
+ declare function useInstantUnstakeApprove(spokeProvider: SpokeProvider | undefined): UseMutationResult<TxReturnType<SpokeProvider, false>, Error, Omit<InstantUnstakeParams, 'action'>>;
1438
+
1439
+ /**
1440
+ * Hook for checking xSODA token allowance for instant unstaking operations.
1441
+ * Uses React Query for efficient caching and state management.
1442
+ *
1443
+ * @param {Omit<InstantUnstakeParams, 'action'> | undefined} params - The instant unstaking parameters. If undefined, the query will be disabled.
1444
+ * @param {SpokeProvider | undefined} spokeProvider - The spoke provider to use for the allowance check
1445
+ * @returns {UseQueryResult<boolean, Error>} Query result object containing allowance data and state
1446
+ *
1447
+ * @example
1448
+ * ```typescript
1449
+ * const { data: hasAllowed, isLoading } = useInstantUnstakeAllowance(
1450
+ * {
1451
+ * amount: 1000000000000000000n, // 1 xSODA
1452
+ * minAmount: 950000000000000000n, // 0.95 SODA
1453
+ * account: '0x...'
1454
+ * },
1455
+ * spokeProvider
1456
+ * );
1457
+ *
1458
+ * if (isLoading) return <div>Checking allowance...</div>;
1459
+ * if (hasAllowed) {
1460
+ * console.log('Sufficient allowance for instant unstaking');
1461
+ * }
1462
+ * ```
1463
+ */
1464
+ declare function useInstantUnstakeAllowance(params: Omit<InstantUnstakeParams, 'action'> | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
1465
+
1466
+ declare const MIGRATION_MODE_ICX_SODA = "icxsoda";
1467
+ declare const MIGRATION_MODE_BNUSD = "bnusd";
1468
+ type MigrationMode = typeof MIGRATION_MODE_ICX_SODA | typeof MIGRATION_MODE_BNUSD;
1469
+ interface MigrationIntentParams {
1470
+ token: XToken | undefined;
1471
+ amount: string | undefined;
1472
+ sourceAddress: string | undefined;
1473
+ migrationMode?: MigrationMode;
1474
+ toToken?: XToken;
1475
+ destinationAddress?: string;
1476
+ }
1477
+
1478
+ /**
1479
+ * Hook for executing migration operations between chains.
1480
+ *
1481
+ * This hook handles ICX/SODA and bnUSD migrations by accepting a spoke provider
1482
+ * and returning a mutation function that accepts migration parameters.
1483
+ *
1484
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for the migration
1485
+ * @returns {UseMutationResult} Mutation result object containing migration function and state
1486
+ *
1487
+ * @example
1488
+ * ```typescript
1489
+ * const { mutateAsync: migrate, isPending } = useMigrate(spokeProvider);
1490
+ *
1491
+ * const result = await migrate({
1492
+ * token: { address: "0x...", decimals: 18 },
1493
+ * amount: "100",
1494
+ * migrationMode: MIGRATION_MODE_ICX_SODA,
1495
+ * toToken: { address: "0x...", decimals: 18 },
1496
+ * destinationAddress: "0x..."
1497
+ * });
1498
+ * ```
1499
+ */
1500
+ declare function useMigrate(spokeProvider: SpokeProvider | undefined): UseMutationResult<{
1501
+ spokeTxHash: string;
1502
+ hubTxHash: `0x${string}`;
1503
+ }, Error, MigrationIntentParams>;
1504
+
1505
+ /**
1506
+ * Hook for checking token allowance for migration operations.
1507
+ *
1508
+ * This hook verifies if the user has approved enough tokens for migration operations.
1509
+ * It handles both ICX/SODA and bnUSD migration allowance checks.
1510
+ *
1511
+ * @param {MigrationIntentParams} params - The parameters for the migration allowance check
1512
+ * @param {SpokeProvider} spokeProvider - The spoke provider to use for allowance checks
1513
+ *
1514
+ * @returns {UseQueryResult<boolean, Error>} A React Query result containing:
1515
+ * - data: Boolean indicating if allowance is sufficient
1516
+ * - isLoading: Loading state indicator
1517
+ * - error: Any error that occurred during the check
1518
+ *
1519
+ * @example
1520
+ * ```typescript
1521
+ * const { data: hasAllowed, isLoading } = useMigrationAllowance(params, spokeProvider);
1522
+ * ```
1523
+ */
1524
+ declare function useMigrationAllowance(params: MigrationIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
1525
+
1526
+ interface UseApproveReturn {
1527
+ approve: ({ params }: {
1528
+ params: MigrationIntentParams;
1529
+ }) => Promise<boolean>;
1530
+ isLoading: boolean;
1531
+ error: Error | null;
1532
+ resetError: () => void;
1533
+ isApproved: boolean;
1534
+ }
1535
+ /**
1536
+ * Hook for approving token spending for migration actions
1537
+ * @param params The parameters for the migration approval
1538
+ * @param spokeProvider The spoke provider instance for the chain
1539
+ * @returns Object containing approve function, loading state, error state and reset function
1540
+ * @example
1541
+ * ```tsx
1542
+ * const { approve, isLoading, error } = useMigrationApprove(params, spokeProvider);
1543
+ *
1544
+ * // Approve tokens for migration
1545
+ * await approve({ params });
1546
+ * ```
1547
+ */
1548
+ declare function useMigrationApprove(params: MigrationIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseApproveReturn;
1549
+
1550
+ interface SodaxProviderProps {
1551
+ children: ReactNode;
1552
+ testnet?: boolean;
1553
+ config?: SodaxConfig;
1554
+ rpcConfig: RpcConfig;
1555
+ }
1556
+ declare const SodaxProvider: ({ children, testnet, config, rpcConfig }: SodaxProviderProps) => ReactElement;
1557
+
1558
+ export { MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, type MigrationIntentParams, type MigrationMode, SodaxProvider, useAToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelSwap, useCancelUnstake, useClaim, useConvertedAssets, useDeriveUserWalletAddress, useEstimateGas, useGetBridgeableAmount, useGetBridgeableTokens, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useMMAllowance, useMMApprove, useMigrate, useMigrationAllowance, useMigrationApprove, useQuote, useRepay, useRequestTrustline, useReservesData, useReservesUsdFormat, useSodaxContext, useSpokeProvider, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSwap, useSwapAllowance, useSwapApprove, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserReservesData, useWithdraw };