@sodax/dapp-kit 1.0.1-beta-rc3 → 1.0.2-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.
- package/README.md +130 -39
- package/dist/index.d.mts +541 -347
- package/dist/index.d.ts +541 -347
- package/dist/index.js +317 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -178
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/hooks/backend/README.md +148 -49
- package/src/hooks/backend/index.ts +2 -0
- package/src/hooks/backend/types.ts +4 -0
- package/src/hooks/backend/useBackendAllMoneyMarketAssets.ts +31 -20
- package/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts +25 -7
- package/src/hooks/backend/useBackendIntentByHash.ts +36 -26
- package/src/hooks/backend/useBackendIntentByTxHash.ts +41 -29
- package/src/hooks/backend/useBackendMoneyMarketAsset.ts +40 -27
- package/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts +45 -36
- package/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts +45 -36
- package/src/hooks/backend/useBackendMoneyMarketPosition.ts +34 -37
- package/src/hooks/backend/useBackendOrderbook.ts +38 -38
- package/src/hooks/backend/useBackendUserIntents.ts +81 -0
- package/src/hooks/mm/index.ts +1 -0
- package/src/hooks/mm/useAToken.ts +37 -20
- package/src/hooks/mm/useBorrow.ts +36 -36
- package/src/hooks/mm/useMMAllowance.ts +33 -24
- package/src/hooks/mm/useMMApprove.ts +43 -48
- package/src/hooks/mm/useRepay.ts +32 -36
- package/src/hooks/mm/useReservesData.ts +35 -16
- package/src/hooks/mm/useReservesHumanized.ts +15 -3
- package/src/hooks/mm/useReservesList.ts +28 -15
- package/src/hooks/mm/useReservesUsdFormat.ts +30 -21
- package/src/hooks/mm/useSupply.ts +34 -36
- package/src/hooks/mm/useUserFormattedSummary.ts +42 -20
- package/src/hooks/mm/useUserReservesData.ts +34 -19
- package/src/hooks/mm/useWithdraw.ts +33 -35
- package/src/hooks/swap/index.ts +2 -0
- package/src/hooks/swap/useCancelLimitOrder.ts +53 -0
- package/src/hooks/swap/useCreateLimitOrder.ts +72 -0
- package/src/hooks/swap/useSwapAllowance.ts +7 -7
- package/src/hooks/swap/useSwapApprove.ts +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
-
import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
|
|
1
|
+
import { Sodax, SpokeProvider, GetEstimateGasReturnType, TxReturnType, SpokeChainId, StellarSpokeProvider, EvmHubProvider, IWalletProvider, MoneyMarketBorrowParams, MoneyMarketError, RelayErrorCode, MoneyMarketRepayParams, MoneyMarketSupplyParams, MoneyMarketWithdrawParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, MoneyMarketParams, XToken, ReserveData, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteRequest, Result, SolverIntentQuoteResponse, SolverErrorResponse, SolverExecutionResponse, Intent, IntentDeliveryInfo, IntentError, IntentErrorCode, CreateIntentParams, Hex, SolverIntentStatusResponse, CreateLimitOrderParams, IntentResponse, Address as Address$1, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, CreateBridgeIntentParams, SpokeTxHash, HubTxHash, BridgeError, BridgeErrorCode, StakeParams, UnstakeParams, ClaimParams, CancelUnstakeParams, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeParams, SodaxConfig } from '@sodax/sdk';
|
|
2
|
+
import { RpcConfig, SpokeChainId as SpokeChainId$1, XToken as XToken$1 } from '@sodax/types';
|
|
3
|
+
import { UseMutationResult, UseQueryResult, UseQueryOptions } from '@tanstack/react-query';
|
|
6
4
|
import { Address } from 'viem';
|
|
7
5
|
import { ReactNode, ReactElement } from 'react';
|
|
8
6
|
|
|
@@ -156,160 +154,196 @@ interface BorrowResponse {
|
|
|
156
154
|
ok: true;
|
|
157
155
|
value: [string, string];
|
|
158
156
|
}
|
|
157
|
+
type UseBorrowParams = {
|
|
158
|
+
params: MoneyMarketBorrowParams;
|
|
159
|
+
spokeProvider: SpokeProvider;
|
|
160
|
+
};
|
|
159
161
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* This hook provides functionality to borrow tokens from the money market protocol,
|
|
163
|
-
* handling the entire borrow process including transaction creation, submission,
|
|
164
|
-
* and cross-chain communication.
|
|
162
|
+
* React hook for borrowing tokens in the Sodax money market protocol.
|
|
165
163
|
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
164
|
+
* Encapsulates the async process to initiate a borrow transaction via the money market,
|
|
165
|
+
* handling transaction creation, submission, and cross-chain logic.
|
|
168
166
|
*
|
|
169
|
-
* @returns {UseMutationResult<
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
167
|
+
* @returns {UseMutationResult<
|
|
168
|
+
* BorrowResponse,
|
|
169
|
+
* MoneyMarketError<'CREATE_BORROW_INTENT_FAILED' | 'BORROW_UNKNOWN_ERROR' | RelayErrorCode>,
|
|
170
|
+
* UseBorrowParams
|
|
171
|
+
* >} A React Query mutation result object containing:
|
|
172
|
+
* - mutateAsync: (params: UseBorrowParams) => Promise<BorrowResponse>
|
|
173
|
+
* Triggers the borrow action. Expects an object with valid borrow params and a `SpokeProvider`.
|
|
174
|
+
* - isPending: `boolean` if a borrow transaction is in progress.
|
|
175
|
+
* - error: `MoneyMarketError` if the transaction fails, or `null`.
|
|
173
176
|
*
|
|
174
177
|
* @example
|
|
175
178
|
* ```typescript
|
|
176
|
-
* const { mutateAsync: borrow, isPending, error } = useBorrow(
|
|
177
|
-
* await borrow(
|
|
179
|
+
* const { mutateAsync: borrow, isPending, error } = useBorrow();
|
|
180
|
+
* await borrow({ params: borrowParams, spokeProvider });
|
|
178
181
|
* ```
|
|
179
182
|
*
|
|
180
183
|
* @throws {Error} When:
|
|
181
|
-
* - spokeProvider is
|
|
182
|
-
* -
|
|
184
|
+
* - `spokeProvider` is missing or invalid.
|
|
185
|
+
* - The underlying borrow transaction fails.
|
|
183
186
|
*/
|
|
184
|
-
declare function useBorrow(
|
|
187
|
+
declare function useBorrow(): UseMutationResult<BorrowResponse, MoneyMarketError<'CREATE_BORROW_INTENT_FAILED' | 'BORROW_UNKNOWN_ERROR' | RelayErrorCode>, UseBorrowParams>;
|
|
185
188
|
|
|
186
189
|
interface RepayResponse {
|
|
187
190
|
ok: true;
|
|
188
191
|
value: [string, string];
|
|
189
192
|
}
|
|
193
|
+
type UseRepayParams = {
|
|
194
|
+
params: MoneyMarketRepayParams;
|
|
195
|
+
spokeProvider: SpokeProvider;
|
|
196
|
+
};
|
|
190
197
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* This hook provides functionality to repay borrowed tokens back to the money market protocol,
|
|
194
|
-
* handling the entire repayment process including transaction creation, submission,
|
|
195
|
-
* and cross-chain communication.
|
|
198
|
+
* React hook for repaying a borrow in the Sodax money market protocol.
|
|
196
199
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
200
|
+
* This hook encapsulates the process of sending a repay transaction to the money market.
|
|
201
|
+
* It manages the asynchronous operation for repayment, including sending the transaction
|
|
202
|
+
* and error handling.
|
|
199
203
|
*
|
|
200
|
-
* @returns {UseMutationResult<RepayResponse,
|
|
201
|
-
* - mutateAsync:
|
|
202
|
-
*
|
|
203
|
-
* -
|
|
204
|
+
* @returns {UseMutationResult<RepayResponse, MoneyMarketError<'CREATE_REPAY_INTENT_FAILED' | 'REPAY_UNKNOWN_ERROR' | RelayErrorCode>, UseRepayParams>} React Query mutation result object containing:
|
|
205
|
+
* - mutateAsync: (params: UseRepayParams) => Promise<RepayResponse>
|
|
206
|
+
* Initiates a repay transaction using the given MoneyMarketRepayParams and SpokeProvider.
|
|
207
|
+
* - isPending: boolean indicating if a transaction is in progress.
|
|
208
|
+
* - error: MoneyMarketError if an error occurred while repaying, otherwise undefined.
|
|
204
209
|
*
|
|
205
210
|
* @example
|
|
206
211
|
* ```typescript
|
|
207
|
-
* const { mutateAsync: repay, isPending, error } = useRepay(
|
|
208
|
-
* await repay(
|
|
212
|
+
* const { mutateAsync: repay, isPending, error } = useRepay();
|
|
213
|
+
* await repay({ params: repayParams, spokeProvider });
|
|
209
214
|
* ```
|
|
210
215
|
*
|
|
211
216
|
* @throws {Error} When:
|
|
212
|
-
* - spokeProvider is
|
|
213
|
-
* -
|
|
217
|
+
* - `spokeProvider` is missing or invalid.
|
|
218
|
+
* - The underlying repay transaction fails.
|
|
214
219
|
*/
|
|
215
|
-
declare function useRepay(
|
|
220
|
+
declare function useRepay(): UseMutationResult<RepayResponse, MoneyMarketError<'CREATE_REPAY_INTENT_FAILED' | 'REPAY_UNKNOWN_ERROR' | RelayErrorCode>, UseRepayParams>;
|
|
216
221
|
|
|
217
222
|
interface SupplyResponse {
|
|
218
223
|
ok: true;
|
|
219
224
|
value: [string, string];
|
|
220
225
|
}
|
|
226
|
+
type UseSupplyParams = {
|
|
227
|
+
params: MoneyMarketSupplyParams;
|
|
228
|
+
spokeProvider: SpokeProvider;
|
|
229
|
+
};
|
|
221
230
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* This hook provides functionality to supply tokens to the money market protocol,
|
|
225
|
-
* handling the entire supply process including transaction creation, submission,
|
|
226
|
-
* and cross-chain communication.
|
|
231
|
+
* React hook for supplying tokens to the Sodax money market protocol.
|
|
227
232
|
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
233
|
+
* Provides a mutation for performing the supply operation using React Query. Useful
|
|
234
|
+
* for UI components needing to manage the full state (pending, error, etc.) of a supply
|
|
235
|
+
* transaction. It handles transaction creation, cross-chain logic, and errors.
|
|
230
236
|
*
|
|
231
|
-
* @returns {UseMutationResult<SupplyResponse,
|
|
232
|
-
*
|
|
233
|
-
* -
|
|
234
|
-
*
|
|
237
|
+
* @returns {UseMutationResult<SupplyResponse, MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED' | 'SUPPLY_UNKNOWN_ERROR' | RelayErrorCode>, UseSupplyParams>}
|
|
238
|
+
* Mutation result object from React Query, where:
|
|
239
|
+
* - mutateAsync(params: UseSupplyParams): Promise<SupplyResponse>
|
|
240
|
+
* Initiates a supply transaction using the given MoneyMarketSupplyParams and SpokeProvider.
|
|
241
|
+
* - isPending: boolean indicating if a transaction is in progress.
|
|
242
|
+
* - error: MoneyMarketError if an error occurred while supplying, otherwise undefined.
|
|
235
243
|
*
|
|
236
244
|
* @example
|
|
237
245
|
* ```typescript
|
|
238
|
-
* const { mutateAsync: supply, isPending, error } = useSupply(
|
|
239
|
-
* await supply(
|
|
246
|
+
* const { mutateAsync: supply, isPending, error } = useSupply();
|
|
247
|
+
* await supply({ params: supplyParams, spokeProvider });
|
|
240
248
|
* ```
|
|
241
249
|
*
|
|
242
|
-
* @throws {Error} When:
|
|
243
|
-
* - spokeProvider is not
|
|
250
|
+
* @throws {Error|MoneyMarketError<...>} When:
|
|
251
|
+
* - `spokeProvider` is not provided or invalid.
|
|
252
|
+
* - The underlying supply transaction fails.
|
|
244
253
|
*/
|
|
245
|
-
declare function useSupply(
|
|
254
|
+
declare function useSupply(): UseMutationResult<SupplyResponse, MoneyMarketError<'CREATE_SUPPLY_INTENT_FAILED' | 'SUPPLY_UNKNOWN_ERROR' | RelayErrorCode>, UseSupplyParams>;
|
|
246
255
|
|
|
256
|
+
type UseWithdrawParams = {
|
|
257
|
+
params: MoneyMarketWithdrawParams;
|
|
258
|
+
spokeProvider: SpokeProvider;
|
|
259
|
+
};
|
|
247
260
|
interface WithdrawResponse {
|
|
248
261
|
ok: true;
|
|
249
262
|
value: [string, string];
|
|
250
263
|
}
|
|
251
264
|
/**
|
|
252
|
-
* Hook for
|
|
265
|
+
* Hook for performing withdrawals from the Sodax money market.
|
|
253
266
|
*
|
|
254
|
-
* This hook
|
|
255
|
-
* handling
|
|
256
|
-
* and
|
|
267
|
+
* This hook exposes a mutation that executes the complete withdrawal logic, including transaction
|
|
268
|
+
* creation and handling cross-chain communication. It leverages React Query's mutation API for
|
|
269
|
+
* easy asynchronous handling and status tracking within UI components.
|
|
257
270
|
*
|
|
258
|
-
* @
|
|
259
|
-
*
|
|
271
|
+
* @returns {UseMutationResult<WithdrawResponse, MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED' | 'WITHDRAW_UNKNOWN_ERROR' | RelayErrorCode>, UseWithdrawParams>}
|
|
272
|
+
* Mutation result object, with:
|
|
273
|
+
* - mutateAsync: (params: UseWithdrawParams) => Promise<WithdrawResponse>
|
|
274
|
+
* Initiates the withdrawal using the provided params.
|
|
275
|
+
* - isPending: boolean indicating if a transaction is in progress.
|
|
276
|
+
* - error: MoneyMarketError if an error occurred while withdrawing, otherwise undefined.
|
|
260
277
|
*
|
|
261
|
-
* @returns {UseMutationResult<WithdrawResponse, Error, string>} A mutation result object with the following properties:
|
|
262
|
-
* - mutateAsync: Function to execute the withdraw transaction
|
|
263
|
-
* - isPending: Boolean indicating if a transaction is in progress
|
|
264
278
|
* @example
|
|
265
279
|
* ```typescript
|
|
266
|
-
* const { mutateAsync: withdraw, isPending, error } = useWithdraw(
|
|
267
|
-
* await withdraw(
|
|
280
|
+
* const { mutateAsync: withdraw, isPending, error } = useWithdraw();
|
|
281
|
+
* await withdraw({ params: withdrawParams, spokeProvider });
|
|
268
282
|
* ```
|
|
269
283
|
*
|
|
270
284
|
* @throws {Error} When:
|
|
271
|
-
* - spokeProvider is not
|
|
272
|
-
* -
|
|
285
|
+
* - spokeProvider is not provided or invalid.
|
|
286
|
+
* - Underlying withdrawal logic fails.
|
|
273
287
|
*/
|
|
274
|
-
declare function useWithdraw(
|
|
288
|
+
declare function useWithdraw(): UseMutationResult<WithdrawResponse, MoneyMarketError<'CREATE_WITHDRAW_INTENT_FAILED' | 'WITHDRAW_UNKNOWN_ERROR' | RelayErrorCode>, UseWithdrawParams>;
|
|
275
289
|
|
|
290
|
+
type UseUserReservesDataParams = {
|
|
291
|
+
spokeProvider: SpokeProvider | undefined;
|
|
292
|
+
address: string | undefined;
|
|
293
|
+
queryOptions?: UseQueryOptions<readonly [readonly UserReserveData[], number], Error>;
|
|
294
|
+
};
|
|
276
295
|
/**
|
|
277
296
|
* Hook for fetching user reserves data from the Sodax money market.
|
|
278
297
|
*
|
|
279
|
-
*
|
|
280
|
-
* The data
|
|
298
|
+
* @param params (optional) - Object including:
|
|
299
|
+
* - spokeProvider: The SpokeProvider instance required for data fetching. If not provided, data fetching is disabled.
|
|
300
|
+
* - address: The user's address (string) whose reserves data will be fetched. If not provided, data fetching is disabled.
|
|
301
|
+
* - queryOptions: (optional) Custom React Query options such as `queryKey`, `enabled`, or cache policy.
|
|
281
302
|
*
|
|
282
|
-
* @
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
303
|
+
* @returns {UseQueryResult<readonly [readonly UserReserveData[], number], Error>} React Query result object containing:
|
|
304
|
+
* - data: A tuple with array of UserReserveData and associated number, or undefined if loading
|
|
305
|
+
* - isLoading: Boolean loading state
|
|
306
|
+
* - isError: Boolean error state
|
|
307
|
+
* - error: Error object, if present
|
|
286
308
|
*
|
|
287
|
-
* @
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
309
|
+
* @example
|
|
310
|
+
* const { data: userReservesData, isLoading, error } = useUserReservesData({
|
|
311
|
+
* spokeProvider,
|
|
312
|
+
* address,
|
|
313
|
+
* });
|
|
291
314
|
*/
|
|
292
|
-
declare function useUserReservesData(
|
|
315
|
+
declare function useUserReservesData(params?: UseUserReservesDataParams): UseQueryResult<readonly [readonly UserReserveData[], number], Error>;
|
|
293
316
|
|
|
317
|
+
type UseReservesDataParams = {
|
|
318
|
+
queryOptions?: UseQueryOptions<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo], Error>;
|
|
319
|
+
};
|
|
294
320
|
/**
|
|
295
|
-
*
|
|
321
|
+
* React hook for fetching the latest reserves data from the Sodax money market.
|
|
296
322
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* fetched and cached using React Query.
|
|
323
|
+
* Provides the full set of aggregated reserves and base currency information.
|
|
324
|
+
* Optionally accepts React Query options for customizing the query key, cache time, and related behaviors.
|
|
300
325
|
*
|
|
301
|
-
* @
|
|
302
|
-
*
|
|
303
|
-
* const { data: reservesData, isLoading, error } = useReservesData();
|
|
304
|
-
* ```
|
|
326
|
+
* @param params (optional) - Object including:
|
|
327
|
+
* - queryOptions: Custom React Query options
|
|
305
328
|
*
|
|
306
|
-
* @returns
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
329
|
+
* @returns {UseQueryResult<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo], Error>}
|
|
330
|
+
* React Query result object containing:
|
|
331
|
+
* - data: [aggregated reserves[], base currency info], or undefined if not loaded
|
|
332
|
+
* - isLoading: True if the request is loading
|
|
333
|
+
* - isError: True if the request failed
|
|
334
|
+
* - error: Error object, if present
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* const { data, isLoading, error } = useReservesData();
|
|
338
|
+
* const { data } = useReservesData({ queryOptions: { queryKey: ['custom', 'reservesData'] } });
|
|
310
339
|
*/
|
|
311
|
-
declare function useReservesData():
|
|
340
|
+
declare function useReservesData(params?: UseReservesDataParams): UseQueryResult<readonly [readonly AggregatedReserveData[], BaseCurrencyInfo], Error>;
|
|
312
341
|
|
|
342
|
+
type UseMMAllowanceParams = {
|
|
343
|
+
params: MoneyMarketParams | undefined;
|
|
344
|
+
spokeProvider: SpokeProvider | undefined;
|
|
345
|
+
queryOptions?: UseQueryOptions<boolean, Error>;
|
|
346
|
+
};
|
|
313
347
|
/**
|
|
314
348
|
* Hook for checking token allowance for money market operations.
|
|
315
349
|
*
|
|
@@ -331,77 +365,125 @@ declare function useReservesData(): _tanstack_react_query.UseQueryResult<readonl
|
|
|
331
365
|
* const { data: hasAllowed, isLoading } = useMMAllowance(token, "100", "repay", provider);
|
|
332
366
|
* ```
|
|
333
367
|
*/
|
|
334
|
-
declare function useMMAllowance(
|
|
368
|
+
declare function useMMAllowance({ params, spokeProvider, queryOptions, }: UseMMAllowanceParams): UseQueryResult<boolean, Error>;
|
|
335
369
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}) => Promise<boolean>;
|
|
341
|
-
isLoading: boolean;
|
|
342
|
-
error: Error | null;
|
|
343
|
-
resetError: () => void;
|
|
344
|
-
}
|
|
370
|
+
type UseMMApproveParams = {
|
|
371
|
+
params: MoneyMarketParams;
|
|
372
|
+
spokeProvider: SpokeProvider | undefined;
|
|
373
|
+
};
|
|
345
374
|
/**
|
|
346
|
-
* Hook for approving token spending for money market actions
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
375
|
+
* Hook for approving ERC20 token spending for Sodax money market actions.
|
|
376
|
+
*
|
|
377
|
+
* This hook manages the approval transaction, allowing the user
|
|
378
|
+
* to grant the protocol permission to spend their tokens for specific money market actions
|
|
379
|
+
* (such as supply, borrow, or repay). Upon successful approval, it also invalidates and
|
|
380
|
+
* refetches the associated allowance status so the UI remains up-to-date.
|
|
381
|
+
*
|
|
382
|
+
* @returns {UseMutationResult<string, Error, UseMMApproveParams>} A React Query mutation result containing:
|
|
383
|
+
* - mutateAsync: Function to trigger the approval (see below)
|
|
384
|
+
* - isPending: Boolean indicating if approval transaction is in progress
|
|
385
|
+
* - error: Error object if the last approval failed, null otherwise
|
|
386
|
+
*
|
|
350
387
|
* @example
|
|
351
388
|
* ```tsx
|
|
352
|
-
* const { approve,
|
|
353
|
-
*
|
|
354
|
-
* // Approve tokens for supply action
|
|
355
|
-
* await approve({ amount: "100", action: "supply" });
|
|
389
|
+
* const { mutateAsync: approve, isPending, error } = useMMApprove();
|
|
390
|
+
* await approve({ params: { token, amount: "100", action: "supply", ... }, spokeProvider });
|
|
356
391
|
* ```
|
|
392
|
+
*
|
|
393
|
+
* @throws {Error} When:
|
|
394
|
+
* - spokeProvider is undefined or invalid
|
|
395
|
+
* - Approval transaction fails for any reason
|
|
357
396
|
*/
|
|
358
|
-
declare function useMMApprove(
|
|
397
|
+
declare function useMMApprove(): UseMutationResult<string, Error, UseMMApproveParams>;
|
|
359
398
|
|
|
399
|
+
type UseATokenParams = {
|
|
400
|
+
aToken: string;
|
|
401
|
+
queryOptions?: UseQueryOptions<XToken, Error>;
|
|
402
|
+
};
|
|
360
403
|
/**
|
|
361
|
-
* React hook
|
|
404
|
+
* React hook to fetch and cache metadata for a given aToken address.
|
|
362
405
|
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
406
|
+
* Accepts an aToken address and React Query options to control query behavior.
|
|
407
|
+
* Returns the aToken's ERC20-style metadata from the Sodax money market, with querying/caching
|
|
408
|
+
* powered by React Query.
|
|
365
409
|
*
|
|
366
|
-
* @param {
|
|
367
|
-
*
|
|
410
|
+
* @param {UseATokenParams} params - Required params object:
|
|
411
|
+
* @property {Address} aToken - The aToken contract address to query.
|
|
412
|
+
* @property {UseQueryOptions<XToken, Error>} queryOptions - React Query options to control query (e.g., staleTime, refetch, etc.).
|
|
413
|
+
*
|
|
414
|
+
* @returns {UseQueryResult<XToken, Error>} React Query result object:
|
|
415
|
+
* - data: XToken metadata, if available
|
|
416
|
+
* - isLoading: Boolean loading state
|
|
417
|
+
* - error: Error, if API call fails
|
|
368
418
|
*
|
|
369
419
|
* @example
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
* console.log(aToken.symbol); // 'aETH'
|
|
420
|
+
* const { data: xToken, isLoading, error } = useAToken({ aToken: aTokenAddress, queryOptions: {} });
|
|
421
|
+
* if (xToken) {
|
|
422
|
+
* console.log(xToken.symbol);
|
|
374
423
|
* }
|
|
375
|
-
* ```
|
|
376
|
-
*
|
|
377
|
-
* @returns {UseQueryResult<Erc20Token, Error>} A React Query result object containing:
|
|
378
|
-
* - data: The aToken ERC20 metadata when available.
|
|
379
|
-
* - isLoading: Loading state indicator.
|
|
380
|
-
* - error: Any error that occurred during data fetching.
|
|
381
424
|
*/
|
|
382
|
-
declare function useAToken(aToken
|
|
425
|
+
declare function useAToken({ aToken, queryOptions }: UseATokenParams): UseQueryResult<XToken, Error>;
|
|
383
426
|
|
|
427
|
+
type UseReservesUsdFormatParams = {
|
|
428
|
+
queryOptions?: UseQueryOptions<(ReserveData & {
|
|
429
|
+
priceInMarketReferenceCurrency: string;
|
|
430
|
+
} & FormatReserveUSDResponse)[], Error>;
|
|
431
|
+
};
|
|
384
432
|
/**
|
|
385
|
-
* Hook for fetching formatted
|
|
386
|
-
* collateral, borrows, liquidation threshold, health factor, available borrowing power, etc..).
|
|
433
|
+
* Hook for fetching reserves data formatted with USD values in the Sodax money market.
|
|
387
434
|
*
|
|
388
|
-
* This hook
|
|
389
|
-
*
|
|
435
|
+
* This hook returns an array of reserve objects, each extended with its price in the market reference
|
|
436
|
+
* currency and formatted USD values. Data is automatically fetched and cached using React Query.
|
|
390
437
|
*
|
|
391
|
-
* @
|
|
392
|
-
*
|
|
393
|
-
* const { data: userFormattedSummary, isLoading, error } = useUserFormattedSummary();
|
|
394
|
-
* ```
|
|
438
|
+
* @param params (optional) - Object including:
|
|
439
|
+
* - queryOptions: Custom React Query options such as `queryKey`, cache behavior, or refetching policy.
|
|
395
440
|
*
|
|
396
|
-
* @returns
|
|
397
|
-
* - data:
|
|
398
|
-
* - isLoading:
|
|
399
|
-
* -
|
|
441
|
+
* @returns {UseQueryResult<(ReserveData & { priceInMarketReferenceCurrency: string } & FormatReserveUSDResponse)[], Error>} React Query result object containing:
|
|
442
|
+
* - data: Array of reserves with USD-formatted values, or undefined if loading
|
|
443
|
+
* - isLoading: Boolean loading state
|
|
444
|
+
* - isError: Boolean error state
|
|
445
|
+
* - error: Error object, if present
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* const { data: reservesUSD, isLoading, error } = useReservesUsdFormat();
|
|
400
449
|
*/
|
|
401
|
-
declare function useReservesUsdFormat(): UseQueryResult<(ReserveData & {
|
|
450
|
+
declare function useReservesUsdFormat(params?: UseReservesUsdFormatParams): UseQueryResult<(ReserveData & {
|
|
402
451
|
priceInMarketReferenceCurrency: string;
|
|
403
452
|
} & FormatReserveUSDResponse)[], Error>;
|
|
404
453
|
|
|
454
|
+
type UseUserFormattedSummaryParams = {
|
|
455
|
+
spokeProvider?: SpokeProvider;
|
|
456
|
+
address?: string;
|
|
457
|
+
queryOptions?: UseQueryOptions<FormatUserSummaryResponse<FormatReserveUSDResponse>, Error>;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* React hook to fetch a formatted summary of a user's Sodax money market portfolio.
|
|
461
|
+
*
|
|
462
|
+
* Accepts an optional params object:
|
|
463
|
+
* - `spokeProvider`: The SpokeProvider instance for the target chain
|
|
464
|
+
* - `address`: The user wallet address to get the summary for
|
|
465
|
+
* - `queryOptions`: Optional React Query options (key, caching, intervals, etc)
|
|
466
|
+
*
|
|
467
|
+
* The hook returns a React Query result object containing the formatted summary, loading and error state.
|
|
468
|
+
* The query is enabled only if both the spokeProvider and address are provided.
|
|
469
|
+
*
|
|
470
|
+
* @param params Optional parameters:
|
|
471
|
+
* - spokeProvider: SpokeProvider to query chain data (required for enabled query)
|
|
472
|
+
* - address: User account address (required for enabled query)
|
|
473
|
+
* - queryOptions: React Query options for customization (optional)
|
|
474
|
+
*
|
|
475
|
+
* @returns {UseQueryResult<FormatUserSummaryResponse<FormatReserveUSDResponse>, Error>}
|
|
476
|
+
* A result object from React Query including:
|
|
477
|
+
* - data: The user's formatted portfolio summary (or undefined if not loaded)
|
|
478
|
+
* - isLoading: Boolean loading state
|
|
479
|
+
* - isError: Boolean error state
|
|
480
|
+
* - error: Error if thrown in fetching
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* const { data, isLoading, error } = useUserFormattedSummary({ spokeProvider, address });
|
|
484
|
+
*/
|
|
485
|
+
declare function useUserFormattedSummary(params?: UseUserFormattedSummaryParams): UseQueryResult<FormatUserSummaryResponse<FormatReserveUSDResponse>, Error>;
|
|
486
|
+
|
|
405
487
|
/**
|
|
406
488
|
* Hook for fetching a quote for an intent-based swap.
|
|
407
489
|
*
|
|
@@ -495,12 +577,12 @@ declare function useSwap(spokeProvider: SpokeProvider | undefined): UseMutationR
|
|
|
495
577
|
declare const useStatus: (intent_tx_hash: Hex) => UseQueryResult<Result<SolverIntentStatusResponse, SolverErrorResponse> | undefined>;
|
|
496
578
|
|
|
497
579
|
/**
|
|
498
|
-
* Hook for checking token allowance for
|
|
580
|
+
* Hook for checking token allowance for swap operations.
|
|
499
581
|
*
|
|
500
|
-
* This hook verifies if the user has approved enough tokens for a specific
|
|
501
|
-
*
|
|
582
|
+
* This hook verifies if the user has approved enough tokens for a specific swap action.
|
|
583
|
+
* It automatically queries and tracks the allowance status.
|
|
502
584
|
*
|
|
503
|
-
* @param {CreateIntentParams} params - The parameters for the intent to check allowance for.
|
|
585
|
+
* @param {CreateIntentParams | CreateLimitOrderParams} params - The parameters for the intent to check allowance for.
|
|
504
586
|
* @param {SpokeProvider} spokeProvider - The spoke provider to use for allowance checks
|
|
505
587
|
*
|
|
506
588
|
* @returns {UseQueryResult<boolean, Error>} A React Query result containing:
|
|
@@ -510,22 +592,22 @@ declare const useStatus: (intent_tx_hash: Hex) => UseQueryResult<Result<SolverIn
|
|
|
510
592
|
*
|
|
511
593
|
* @example
|
|
512
594
|
* ```typescript
|
|
513
|
-
* const { data: hasAllowed, isLoading } =
|
|
595
|
+
* const { data: hasAllowed, isLoading } = useSwapAllowance(params, spokeProvider);
|
|
514
596
|
* ```
|
|
515
597
|
*/
|
|
516
|
-
declare function useSwapAllowance(params: CreateIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
|
|
598
|
+
declare function useSwapAllowance(params: CreateIntentParams | CreateLimitOrderParams | undefined, spokeProvider: SpokeProvider | undefined): UseQueryResult<boolean, Error>;
|
|
517
599
|
|
|
518
600
|
interface UseApproveReturn$1 {
|
|
519
601
|
approve: ({ params }: {
|
|
520
|
-
params: CreateIntentParams;
|
|
602
|
+
params: CreateIntentParams | CreateLimitOrderParams;
|
|
521
603
|
}) => Promise<boolean>;
|
|
522
604
|
isLoading: boolean;
|
|
523
605
|
error: Error | null;
|
|
524
606
|
resetError: () => void;
|
|
525
607
|
}
|
|
526
608
|
/**
|
|
527
|
-
* Hook for approving token spending for
|
|
528
|
-
* @param
|
|
609
|
+
* Hook for approving token spending for swap actions
|
|
610
|
+
* @param params The parameters for the intent to approve spending for
|
|
529
611
|
* @param spokeProvider The spoke provider instance for the chain
|
|
530
612
|
* @returns Object containing approve function, loading state, error state and reset function
|
|
531
613
|
* @example
|
|
@@ -536,7 +618,7 @@ interface UseApproveReturn$1 {
|
|
|
536
618
|
* await approve({ amount: "100", action: "supply" });
|
|
537
619
|
* ```
|
|
538
620
|
*/
|
|
539
|
-
declare function useSwapApprove(params: CreateIntentParams | undefined, spokeProvider: SpokeProvider | undefined): UseApproveReturn$1;
|
|
621
|
+
declare function useSwapApprove(params: CreateIntentParams | CreateLimitOrderParams | undefined, spokeProvider: SpokeProvider | undefined): UseApproveReturn$1;
|
|
540
622
|
|
|
541
623
|
type CancelIntentParams = {
|
|
542
624
|
intent: Intent;
|
|
@@ -564,169 +646,284 @@ type CancelIntentResult = Result<TxReturnType<SpokeProvider, boolean>>;
|
|
|
564
646
|
*/
|
|
565
647
|
declare function useCancelSwap(spokeProvider: SpokeProvider | undefined): UseMutationResult<CancelIntentResult, Error, CancelIntentParams>;
|
|
566
648
|
|
|
649
|
+
type CreateLimitOrderResult = Result<[
|
|
650
|
+
SolverExecutionResponse,
|
|
651
|
+
Intent,
|
|
652
|
+
IntentDeliveryInfo
|
|
653
|
+
], IntentError<IntentErrorCode>>;
|
|
567
654
|
/**
|
|
568
|
-
* Hook for
|
|
569
|
-
*
|
|
570
|
-
* This hook provides access to intent data associated with the transaction hash from when
|
|
571
|
-
* the intent was created on the hub chain, including intent details, events, and transaction
|
|
572
|
-
* information. The data is automatically fetched and cached using React Query.
|
|
655
|
+
* Hook for creating a limit order intent (no deadline, must be cancelled manually by user).
|
|
656
|
+
* Uses React Query's useMutation for better state management and caching.
|
|
573
657
|
*
|
|
574
|
-
*
|
|
658
|
+
* Limit orders remain active until manually cancelled by the user. Unlike swaps, limit orders
|
|
659
|
+
* do not have a deadline (deadline is automatically set to 0n).
|
|
575
660
|
*
|
|
576
|
-
* @
|
|
577
|
-
*
|
|
578
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
579
|
-
* - error: Error object if the request failed
|
|
580
|
-
* - refetch: Function to manually trigger a data refresh
|
|
661
|
+
* @param {SpokeProvider} spokeProvider - The spoke provider to use for creating the limit order
|
|
662
|
+
* @returns {UseMutationResult} Mutation result object containing mutation function and state
|
|
581
663
|
*
|
|
582
664
|
* @example
|
|
583
665
|
* ```typescript
|
|
584
|
-
* const {
|
|
666
|
+
* const { mutateAsync: createLimitOrder, isPending } = useCreateLimitOrder(spokeProvider);
|
|
667
|
+
*
|
|
668
|
+
* const handleCreateLimitOrder = async () => {
|
|
669
|
+
* const result = await createLimitOrder({
|
|
670
|
+
* inputToken: '0x...',
|
|
671
|
+
* outputToken: '0x...',
|
|
672
|
+
* inputAmount: 1000000000000000000n,
|
|
673
|
+
* minOutputAmount: 900000000000000000n,
|
|
674
|
+
* allowPartialFill: false,
|
|
675
|
+
* srcChain: '0xa4b1.arbitrum',
|
|
676
|
+
* dstChain: '0x89.polygon',
|
|
677
|
+
* srcAddress: '0x...',
|
|
678
|
+
* dstAddress: '0x...',
|
|
679
|
+
* solver: '0x0000000000000000000000000000000000000000',
|
|
680
|
+
* data: '0x'
|
|
681
|
+
* });
|
|
585
682
|
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
*
|
|
683
|
+
* if (result.ok) {
|
|
684
|
+
* const [solverExecutionResponse, intent, intentDeliveryInfo] = result.value;
|
|
685
|
+
* console.log('Limit order created:', intent);
|
|
686
|
+
* console.log('Intent hash:', solverExecutionResponse.intent_hash);
|
|
687
|
+
* }
|
|
688
|
+
* };
|
|
591
689
|
* ```
|
|
592
|
-
*
|
|
593
|
-
* @remarks
|
|
594
|
-
* - Intents are only created on the hub chain, so the transaction hash must be from the hub chain
|
|
595
|
-
* - The query is disabled when txHash is undefined or empty
|
|
596
|
-
* - Uses React Query for efficient caching and state management
|
|
597
|
-
* - Automatically handles error states and loading indicators
|
|
598
690
|
*/
|
|
599
|
-
declare
|
|
691
|
+
declare function useCreateLimitOrder(spokeProvider: SpokeProvider | undefined): UseMutationResult<CreateLimitOrderResult, Error, CreateLimitOrderParams>;
|
|
600
692
|
|
|
693
|
+
type CancelLimitOrderParams = {
|
|
694
|
+
intent: Intent;
|
|
695
|
+
spokeProvider: SpokeProvider;
|
|
696
|
+
timeout?: number;
|
|
697
|
+
};
|
|
698
|
+
type CancelLimitOrderResult = Result<[string, string], IntentError<IntentErrorCode>>;
|
|
601
699
|
/**
|
|
602
|
-
* Hook for
|
|
603
|
-
*
|
|
604
|
-
* This hook provides access to intent data using the intent hash directly,
|
|
605
|
-
* including intent details, events, and transaction information. The data is automatically
|
|
606
|
-
* fetched and cached using React Query.
|
|
700
|
+
* Hook for canceling a limit order intent and submitting it to the Relayer API.
|
|
701
|
+
* Uses React Query's useMutation for better state management and caching.
|
|
607
702
|
*
|
|
608
|
-
*
|
|
703
|
+
* This hook wraps cancelLimitOrder which cancels the intent on the spoke chain,
|
|
704
|
+
* submits it to the relayer API, and waits for execution on the destination/hub chain.
|
|
609
705
|
*
|
|
610
|
-
* @returns {
|
|
611
|
-
* - data: The intent response data when available
|
|
612
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
613
|
-
* - error: Error object if the request failed
|
|
614
|
-
* - refetch: Function to manually trigger a data refresh
|
|
706
|
+
* @returns {UseMutationResult} Mutation result object containing mutation function and state
|
|
615
707
|
*
|
|
616
708
|
* @example
|
|
617
709
|
* ```typescript
|
|
618
|
-
* const {
|
|
710
|
+
* const { mutateAsync: cancelLimitOrder, isPending } = useCancelLimitOrder();
|
|
711
|
+
*
|
|
712
|
+
* const handleCancelLimitOrder = async () => {
|
|
713
|
+
* const result = await cancelLimitOrder({
|
|
714
|
+
* intent: intentObject,
|
|
715
|
+
* spokeProvider,
|
|
716
|
+
* timeout: 60000 // optional, defaults to 60 seconds
|
|
717
|
+
* });
|
|
718
|
+
*
|
|
719
|
+
* if (result.ok) {
|
|
720
|
+
* const [cancelTxHash, dstTxHash] = result.value;
|
|
721
|
+
* console.log('Cancel transaction hash:', cancelTxHash);
|
|
722
|
+
* console.log('Destination transaction hash:', dstTxHash);
|
|
723
|
+
* }
|
|
724
|
+
* };
|
|
725
|
+
* ```
|
|
726
|
+
*/
|
|
727
|
+
declare function useCancelLimitOrder(): UseMutationResult<CancelLimitOrderResult, Error, CancelLimitOrderParams>;
|
|
728
|
+
|
|
729
|
+
type UseBackendIntentByTxHashParams = {
|
|
730
|
+
params: {
|
|
731
|
+
txHash: string | undefined;
|
|
732
|
+
};
|
|
733
|
+
queryOptions?: UseQueryOptions<IntentResponse | undefined, Error>;
|
|
734
|
+
};
|
|
735
|
+
/**
|
|
736
|
+
* React hook for fetching intent details from the backend API using a transaction hash.
|
|
737
|
+
*
|
|
738
|
+
* @param {UseBackendIntentByTxHashParams | undefined} params - Parameters for the query:
|
|
739
|
+
* - params: { txHash: string | undefined }
|
|
740
|
+
* - `txHash`: Transaction hash used to retrieve the associated intent; query is disabled if undefined or empty.
|
|
741
|
+
* - queryOptions (optional): React Query options to customize request behavior (e.g., caching, retry, refetchInterval, etc.).
|
|
742
|
+
*
|
|
743
|
+
* @returns {UseQueryResult<IntentResponse | undefined, Error>} React Query result object, including:
|
|
744
|
+
* - `data`: The intent response or undefined if unavailable,
|
|
745
|
+
* - `isLoading`: Loading state,
|
|
746
|
+
* - `error`: Error (if request failed),
|
|
747
|
+
* - `refetch`: Function to refetch the data.
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* const { data: intent, isLoading, error } = useBackendIntentByTxHash({
|
|
751
|
+
* params: { txHash: '0x123...' },
|
|
752
|
+
* });
|
|
619
753
|
*
|
|
620
754
|
* if (isLoading) return <div>Loading intent...</div>;
|
|
621
755
|
* if (error) return <div>Error: {error.message}</div>;
|
|
622
756
|
* if (intent) {
|
|
623
757
|
* console.log('Intent found:', intent.intentHash);
|
|
624
|
-
* console.log('Open status:', intent.open);
|
|
625
758
|
* }
|
|
626
|
-
* ```
|
|
627
759
|
*
|
|
628
760
|
* @remarks
|
|
629
|
-
* -
|
|
630
|
-
* -
|
|
631
|
-
* -
|
|
761
|
+
* - Intents are only created on the hub chain, so `txHash` must originate from there.
|
|
762
|
+
* - Query is disabled if `params` is undefined, or if `params.params.txHash` is undefined or an empty string.
|
|
763
|
+
* - Default refetch interval is 1 second. Uses React Query for state management, caching, and retries.
|
|
632
764
|
*/
|
|
633
|
-
declare const
|
|
765
|
+
declare const useBackendIntentByTxHash: (params: UseBackendIntentByTxHashParams | undefined) => UseQueryResult<IntentResponse | undefined, Error>;
|
|
634
766
|
|
|
767
|
+
type UseBackendIntentByHashParams = {
|
|
768
|
+
params: {
|
|
769
|
+
intentHash: string | undefined;
|
|
770
|
+
};
|
|
771
|
+
queryOptions?: UseQueryOptions<IntentResponse | undefined, Error>;
|
|
772
|
+
};
|
|
635
773
|
/**
|
|
636
|
-
*
|
|
774
|
+
* React hook to fetch intent details from the backend API using an intent hash.
|
|
637
775
|
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
776
|
+
* @param {UseBackendIntentByHashParams | undefined} params - Parameters for the query:
|
|
777
|
+
* - params: { intentHash: string | undefined }
|
|
778
|
+
* - `intentHash`: The hash identifying the intent to fetch (disables query if undefined or empty).
|
|
779
|
+
* - queryOptions (optional): Options to customize React Query (e.g., staleTime, enabled).
|
|
641
780
|
*
|
|
642
|
-
* @
|
|
643
|
-
* @param {string} params.offset - The offset for pagination (number as string)
|
|
644
|
-
* @param {string} params.limit - The limit for pagination (number as string)
|
|
645
|
-
*
|
|
646
|
-
* @returns {UseQueryResult<OrderbookResponse | undefined>} A query result object containing:
|
|
647
|
-
* - data: The orderbook response data when available
|
|
648
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
649
|
-
* - error: Error object if the request failed
|
|
650
|
-
* - refetch: Function to manually trigger a data refresh
|
|
781
|
+
* @returns {UseQueryResult<IntentResponse | undefined, Error>} React Query result containing intent response data, loading, error, and refetch states.
|
|
651
782
|
*
|
|
652
783
|
* @example
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
* offset: '0',
|
|
656
|
-
* limit: '10'
|
|
784
|
+
* const { data: intent, isLoading, error } = useBackendIntentByHash({
|
|
785
|
+
* params: { intentHash: '0xabc...' },
|
|
657
786
|
* });
|
|
658
787
|
*
|
|
659
|
-
* if (isLoading) return <div>Loading
|
|
788
|
+
* if (isLoading) return <div>Loading intent...</div>;
|
|
660
789
|
* if (error) return <div>Error: {error.message}</div>;
|
|
661
|
-
* if (
|
|
662
|
-
* console.log('
|
|
663
|
-
* console.log('Intents:', orderbook.data);
|
|
790
|
+
* if (intent) {
|
|
791
|
+
* console.log('Intent found:', intent.intentHash);
|
|
664
792
|
* }
|
|
665
|
-
* ```
|
|
666
793
|
*
|
|
667
794
|
* @remarks
|
|
668
|
-
* -
|
|
669
|
-
* -
|
|
670
|
-
* -
|
|
671
|
-
* - Stale time of 30 seconds for real-time orderbook data
|
|
672
|
-
* - Supports pagination through offset and limit parameters
|
|
795
|
+
* - Returns `undefined` data if no intentHash is provided or query is disabled.
|
|
796
|
+
* - Query is cached and managed using React Query.
|
|
797
|
+
* - Use `queryOptions` to customize caching, retry and fetch behavior.
|
|
673
798
|
*/
|
|
674
|
-
declare const
|
|
799
|
+
declare const useBackendIntentByHash: (params: UseBackendIntentByHashParams | undefined) => UseQueryResult<IntentResponse | undefined, Error>;
|
|
800
|
+
|
|
801
|
+
type BackendPaginationParams = {
|
|
675
802
|
offset: string;
|
|
676
803
|
limit: string;
|
|
677
|
-
}
|
|
804
|
+
};
|
|
678
805
|
|
|
806
|
+
type GetUserIntentsParams = {
|
|
807
|
+
userAddress: Address$1;
|
|
808
|
+
startDate?: number;
|
|
809
|
+
endDate?: number;
|
|
810
|
+
};
|
|
811
|
+
type UseBackendUserIntentsParams = {
|
|
812
|
+
params?: GetUserIntentsParams;
|
|
813
|
+
queryOptions?: UseQueryOptions<UserIntentsResponse | undefined, Error>;
|
|
814
|
+
pagination?: BackendPaginationParams;
|
|
815
|
+
};
|
|
679
816
|
/**
|
|
680
|
-
*
|
|
817
|
+
* React hook for fetching user-created intents from the backend API for a given user address,
|
|
818
|
+
* with optional support for a date filtering range.
|
|
819
|
+
*
|
|
820
|
+
* @param {UseBackendUserIntentsParams} args - Query configuration.
|
|
821
|
+
* @param {GetUserIntentsParams | undefined} args.params - User intent filter parameters.
|
|
822
|
+
* @param {Address} args.params.userAddress - The wallet address of the user (required).
|
|
823
|
+
* @param {number} [args.params.startDate] - Include intents created after this timestamp (ms).
|
|
824
|
+
* @param {number} [args.params.endDate] - Include intents created before this timestamp (ms).
|
|
825
|
+
* @param {UseQueryOptions<UserIntentsResponse | undefined, Error>} [args.queryOptions] - Optional React Query options.
|
|
826
|
+
* @param {BackendPaginationParams} [args.pagination] - (currently ignored) Pagination options.
|
|
827
|
+
*
|
|
828
|
+
* @returns {UseQueryResult<UserIntentsResponse | undefined, Error>} React Query result:
|
|
829
|
+
* - `data`: The user intent response, or undefined if unavailable.
|
|
830
|
+
* - `isLoading`: `true` if loading.
|
|
831
|
+
* - `error`: An Error instance if any occurred.
|
|
832
|
+
* - `refetch`: Function to refetch data.
|
|
681
833
|
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
684
|
-
*
|
|
834
|
+
* @example
|
|
835
|
+
* const { data: userIntents, isLoading, error } = useBackendUserIntents({
|
|
836
|
+
* params: { userAddress: "0x123..." }
|
|
837
|
+
* });
|
|
685
838
|
*
|
|
686
|
-
* @
|
|
839
|
+
* @example
|
|
840
|
+
* const { data } = useBackendUserIntents({
|
|
841
|
+
* params: {
|
|
842
|
+
* userAddress: "0xabc...",
|
|
843
|
+
* startDate: Date.now() - 1_000_000,
|
|
844
|
+
* endDate: Date.now(),
|
|
845
|
+
* },
|
|
846
|
+
* });
|
|
687
847
|
*
|
|
688
|
-
* @
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
|
|
692
|
-
|
|
848
|
+
* @remarks
|
|
849
|
+
* The query is disabled if `params` or `params.userAddress` is missing or empty. Uses React Query for
|
|
850
|
+
* cache/state management and auto-retries failed requests three times by default.
|
|
851
|
+
*/
|
|
852
|
+
declare const useBackendUserIntents: ({ params, queryOptions, }: UseBackendUserIntentsParams) => UseQueryResult<UserIntentsResponse | undefined, Error>;
|
|
853
|
+
|
|
854
|
+
type UseBackendOrderbookParams = {
|
|
855
|
+
queryOptions?: UseQueryOptions<OrderbookResponse | undefined, Error>;
|
|
856
|
+
pagination?: BackendPaginationParams;
|
|
857
|
+
};
|
|
858
|
+
/**
|
|
859
|
+
* Hook for fetching the solver orderbook from the backend API.
|
|
693
860
|
*
|
|
694
|
-
* @
|
|
695
|
-
*
|
|
696
|
-
*
|
|
861
|
+
* @param {UseBackendOrderbookParams | undefined} params - Optional parameters:
|
|
862
|
+
* - `pagination`: Pagination configuration (see `BackendPaginationParams`), including
|
|
863
|
+
* `offset` and `limit` (both required for fetch to be enabled).
|
|
864
|
+
* - `queryOptions`: Optional React Query options to override default behavior.
|
|
697
865
|
*
|
|
698
|
-
*
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
*
|
|
866
|
+
* @returns {UseQueryResult<OrderbookResponse | undefined, Error>} React Query result object:
|
|
867
|
+
* - `data`: The orderbook response, or undefined if unavailable.
|
|
868
|
+
* - `isLoading`: Loading state.
|
|
869
|
+
* - `error`: Error instance if the query failed.
|
|
870
|
+
* - `refetch`: Function to re-trigger the query.
|
|
871
|
+
*
|
|
872
|
+
* @example
|
|
873
|
+
* const { data, isLoading, error } = useBackendOrderbook({
|
|
874
|
+
* pagination: { offset: '0', limit: '10' },
|
|
875
|
+
* queryOptions: { staleTime: 60000 },
|
|
876
|
+
* });
|
|
705
877
|
*
|
|
706
878
|
* @remarks
|
|
707
|
-
* -
|
|
708
|
-
* -
|
|
709
|
-
* -
|
|
710
|
-
* - Includes user's aToken and debt token balances across all reserves
|
|
879
|
+
* - Query is disabled if `params?.pagination`, `offset`, or `limit` are missing/empty.
|
|
880
|
+
* - Caches and manages server state using React Query.
|
|
881
|
+
* - Default `staleTime` is 30 seconds to support near-real-time updates.
|
|
711
882
|
*/
|
|
712
|
-
declare const
|
|
883
|
+
declare const useBackendOrderbook: (params: UseBackendOrderbookParams | undefined) => UseQueryResult<OrderbookResponse | undefined>;
|
|
713
884
|
|
|
885
|
+
type UseBackendMoneyMarketPositionParams = {
|
|
886
|
+
userAddress: string | undefined;
|
|
887
|
+
queryOptions?: UseQueryOptions<MoneyMarketPosition | undefined, Error>;
|
|
888
|
+
};
|
|
714
889
|
/**
|
|
715
|
-
*
|
|
890
|
+
* React hook for fetching a user's money market position from the backend API.
|
|
716
891
|
*
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
892
|
+
* @param {UseBackendMoneyMarketPositionParams | undefined} params - Parameters object:
|
|
893
|
+
* - userAddress: The user's wallet address to fetch positions for. If undefined or empty, the query is disabled.
|
|
894
|
+
* - queryOptions: (Optional) React Query options to customize behavior (e.g., staleTime, enabled).
|
|
720
895
|
*
|
|
721
|
-
* @returns {UseQueryResult<
|
|
722
|
-
* - data:
|
|
723
|
-
* - isLoading:
|
|
724
|
-
* - error: Error
|
|
725
|
-
* - refetch: Function to manually trigger a
|
|
896
|
+
* @returns {UseQueryResult<MoneyMarketPosition | undefined, Error>} - React Query result object with:
|
|
897
|
+
* - data: The user's money market position data, or undefined if not available.
|
|
898
|
+
* - isLoading: Loading state.
|
|
899
|
+
* - error: An Error instance if fetching failed.
|
|
900
|
+
* - refetch: Function to manually trigger a refetch.
|
|
726
901
|
*
|
|
727
902
|
* @example
|
|
728
|
-
*
|
|
729
|
-
*
|
|
903
|
+
* const { data, isLoading, error } = useBackendMoneyMarketPosition({
|
|
904
|
+
* userAddress: '0xabc...',
|
|
905
|
+
* queryOptions: { staleTime: 60000 },
|
|
906
|
+
* });
|
|
907
|
+
*/
|
|
908
|
+
declare const useBackendMoneyMarketPosition: (params: UseBackendMoneyMarketPositionParams | undefined) => UseQueryResult<MoneyMarketPosition | undefined, Error>;
|
|
909
|
+
|
|
910
|
+
type UseBackendAllMoneyMarketAssetsParams = {
|
|
911
|
+
queryOptions?: UseQueryOptions<MoneyMarketAsset[], Error>;
|
|
912
|
+
};
|
|
913
|
+
/**
|
|
914
|
+
* React hook to fetch all money market assets from the backend API.
|
|
915
|
+
*
|
|
916
|
+
* @param {UseBackendAllMoneyMarketAssetsParams | undefined} params - Optional parameters:
|
|
917
|
+
* - `queryOptions` (optional): React Query options to override default behavior (e.g., caching, retry, etc).
|
|
918
|
+
*
|
|
919
|
+
* @returns {UseQueryResult<MoneyMarketAsset[], Error>} React Query result object:
|
|
920
|
+
* - `data`: Array of all money market asset data when available.
|
|
921
|
+
* - `isLoading`: Boolean indicating if the request is in progress.
|
|
922
|
+
* - `error`: Error object if the request failed.
|
|
923
|
+
* - `refetch`: Function to manually trigger a data refresh.
|
|
924
|
+
*
|
|
925
|
+
* @example
|
|
926
|
+
* const { data: assets, isLoading, error } = useBackendAllMoneyMarketAssets();
|
|
730
927
|
*
|
|
731
928
|
* if (isLoading) return <div>Loading assets...</div>;
|
|
732
929
|
* if (error) return <div>Error: {error.message}</div>;
|
|
@@ -736,35 +933,39 @@ declare const useBackendMoneyMarketPosition: (userAddress: string | undefined) =
|
|
|
736
933
|
* console.log(`${asset.symbol}: ${asset.liquidityRate} liquidity rate`);
|
|
737
934
|
* });
|
|
738
935
|
* }
|
|
739
|
-
* ```
|
|
740
936
|
*
|
|
741
937
|
* @remarks
|
|
742
|
-
* -
|
|
743
|
-
* -
|
|
744
|
-
* -
|
|
745
|
-
* - No parameters required - fetches all available assets
|
|
938
|
+
* - No required parameters — fetches all available money market assets from backend.
|
|
939
|
+
* - Uses React Query for caching, retries, and loading/error state management.
|
|
940
|
+
* - Supports overriding React Query config via `queryOptions`.
|
|
746
941
|
*/
|
|
747
|
-
declare const useBackendAllMoneyMarketAssets: () => UseQueryResult<MoneyMarketAsset[]>;
|
|
942
|
+
declare const useBackendAllMoneyMarketAssets: (params: UseBackendAllMoneyMarketAssetsParams | undefined) => UseQueryResult<MoneyMarketAsset[], Error>;
|
|
748
943
|
|
|
944
|
+
type UseBackendMoneyMarketAssetParams = {
|
|
945
|
+
params: {
|
|
946
|
+
reserveAddress: string | undefined;
|
|
947
|
+
};
|
|
948
|
+
queryOptions?: UseQueryOptions<MoneyMarketAsset | undefined, Error>;
|
|
949
|
+
};
|
|
749
950
|
/**
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
* This hook provides access to detailed information for a specific money market asset,
|
|
753
|
-
* including reserve information, liquidity rates, borrow rates, and market statistics.
|
|
754
|
-
* The data is automatically fetched and cached using React Query.
|
|
951
|
+
* React hook to fetch a specific money market asset from the backend API.
|
|
755
952
|
*
|
|
756
|
-
* @param
|
|
953
|
+
* @param params - The hook input parameter object (may be undefined):
|
|
954
|
+
* - `params`: An object containing:
|
|
955
|
+
* - `reserveAddress` (string | undefined): Reserve contract address to fetch asset details. Disables query if undefined or empty.
|
|
956
|
+
* - `queryOptions` (optional): React Query options for advanced configuration (e.g. caching, staleTime, retry, etc.).
|
|
757
957
|
*
|
|
758
|
-
* @returns {UseQueryResult
|
|
759
|
-
*
|
|
760
|
-
* -
|
|
761
|
-
* -
|
|
762
|
-
* -
|
|
958
|
+
* @returns A React Query result object: {@link UseQueryResult} for {@link MoneyMarketAsset} or `undefined` on error or if disabled,
|
|
959
|
+
* including:
|
|
960
|
+
* - `data`: The money market asset (when available) or `undefined`.
|
|
961
|
+
* - `isLoading`: Whether the query is running.
|
|
962
|
+
* - `error`: An error encountered by the query (if any).
|
|
963
|
+
* - `refetch`: Function to manually refetch the asset.
|
|
763
964
|
*
|
|
764
965
|
* @example
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
*
|
|
966
|
+
* const { data: asset, isLoading, error } = useBackendMoneyMarketAsset({
|
|
967
|
+
* params: { reserveAddress: '0xabc...' },
|
|
968
|
+
* });
|
|
768
969
|
* if (isLoading) return <div>Loading asset...</div>;
|
|
769
970
|
* if (error) return <div>Error: {error.message}</div>;
|
|
770
971
|
* if (asset) {
|
|
@@ -772,39 +973,40 @@ declare const useBackendAllMoneyMarketAssets: () => UseQueryResult<MoneyMarketAs
|
|
|
772
973
|
* console.log('Liquidity rate:', asset.liquidityRate);
|
|
773
974
|
* console.log('Variable borrow rate:', asset.variableBorrowRate);
|
|
774
975
|
* }
|
|
775
|
-
* ```
|
|
776
976
|
*
|
|
777
977
|
* @remarks
|
|
778
|
-
* -
|
|
779
|
-
* - Uses React Query for
|
|
780
|
-
* -
|
|
781
|
-
* - Returns comprehensive asset information for the specified reserve
|
|
978
|
+
* - Query is disabled if `params`, `params.params`, or `params.params.reserveAddress` is missing or empty.
|
|
979
|
+
* - Uses React Query for caching and background-state management.
|
|
980
|
+
* - Loading and error handling are managed automatically.
|
|
782
981
|
*/
|
|
783
|
-
declare const useBackendMoneyMarketAsset: (
|
|
982
|
+
declare const useBackendMoneyMarketAsset: (params: UseBackendMoneyMarketAssetParams | undefined) => UseQueryResult<MoneyMarketAsset | undefined, Error>;
|
|
784
983
|
|
|
984
|
+
type UseBackendMoneyMarketAssetBorrowersParams = {
|
|
985
|
+
params: {
|
|
986
|
+
reserveAddress: string | undefined;
|
|
987
|
+
};
|
|
988
|
+
pagination: BackendPaginationParams;
|
|
989
|
+
queryOptions?: UseQueryOptions<MoneyMarketAssetBorrowers | undefined, Error>;
|
|
990
|
+
};
|
|
785
991
|
/**
|
|
786
|
-
*
|
|
992
|
+
* React hook for fetching borrowers for a specific money market asset from the backend API with pagination.
|
|
787
993
|
*
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
* @param {string} params.offset - The offset for pagination (number as string)
|
|
794
|
-
* @param {string} params.limit - The limit for pagination (number as string)
|
|
994
|
+
* @param {UseBackendMoneyMarketAssetBorrowersParams | undefined} params - Query parameters:
|
|
995
|
+
* - `params`: Object containing:
|
|
996
|
+
* - `reserveAddress`: Reserve contract address for which to fetch borrowers, or `undefined` to disable query.
|
|
997
|
+
* - `pagination`: Pagination controls with `offset` and `limit` (both required as strings).
|
|
998
|
+
* - `queryOptions` (optional): React Query options to override defaults (e.g. `staleTime`, `enabled`, etc.).
|
|
795
999
|
*
|
|
796
|
-
* @returns {UseQueryResult<MoneyMarketAssetBorrowers | undefined>}
|
|
797
|
-
* - data
|
|
798
|
-
* - isLoading
|
|
799
|
-
* - error
|
|
800
|
-
* - refetch
|
|
1000
|
+
* @returns {UseQueryResult<MoneyMarketAssetBorrowers | undefined, Error>} React Query result object including:
|
|
1001
|
+
* - `data`: The money market asset borrowers data, or `undefined` if not available.
|
|
1002
|
+
* - `isLoading`: Boolean indicating whether the query is loading.
|
|
1003
|
+
* - `error`: An Error instance if the request failed.
|
|
1004
|
+
* - `refetch`: Function to manually trigger a data refresh.
|
|
801
1005
|
*
|
|
802
1006
|
* @example
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
*
|
|
806
|
-
* offset: '0',
|
|
807
|
-
* limit: '20'
|
|
1007
|
+
* const { data: borrowers, isLoading, error } = useBackendMoneyMarketAssetBorrowers({
|
|
1008
|
+
* params: { reserveAddress: '0xabc...' },
|
|
1009
|
+
* pagination: { offset: '0', limit: '20' }
|
|
808
1010
|
* });
|
|
809
1011
|
*
|
|
810
1012
|
* if (isLoading) return <div>Loading borrowers...</div>;
|
|
@@ -813,43 +1015,40 @@ declare const useBackendMoneyMarketAsset: (reserveAddress: string | undefined) =
|
|
|
813
1015
|
* console.log('Total borrowers:', borrowers.total);
|
|
814
1016
|
* console.log('Borrowers:', borrowers.borrowers);
|
|
815
1017
|
* }
|
|
816
|
-
* ```
|
|
817
1018
|
*
|
|
818
1019
|
* @remarks
|
|
819
|
-
* - The query is disabled
|
|
820
|
-
* - Uses React Query for
|
|
821
|
-
* -
|
|
822
|
-
* - Supports pagination through offset and limit parameters
|
|
1020
|
+
* - The query is disabled if `reserveAddress`, `offset`, or `limit` are not provided.
|
|
1021
|
+
* - Uses React Query for caching, retries, and auto error/loading management.
|
|
1022
|
+
* - Pagination is handled via `pagination.offset` and `pagination.limit`.
|
|
823
1023
|
*/
|
|
824
|
-
declare const useBackendMoneyMarketAssetBorrowers: (params:
|
|
825
|
-
reserveAddress: string | undefined;
|
|
826
|
-
offset: string;
|
|
827
|
-
limit: string;
|
|
828
|
-
}) => UseQueryResult<MoneyMarketAssetBorrowers | undefined>;
|
|
1024
|
+
declare const useBackendMoneyMarketAssetBorrowers: (params: UseBackendMoneyMarketAssetBorrowersParams | undefined) => UseQueryResult<MoneyMarketAssetBorrowers | undefined, Error>;
|
|
829
1025
|
|
|
1026
|
+
type UseBackendMoneyMarketAssetSuppliersParams = {
|
|
1027
|
+
params: {
|
|
1028
|
+
reserveAddress: string | undefined;
|
|
1029
|
+
};
|
|
1030
|
+
pagination: BackendPaginationParams;
|
|
1031
|
+
queryOptions?: UseQueryOptions<MoneyMarketAssetSuppliers | undefined, Error>;
|
|
1032
|
+
};
|
|
830
1033
|
/**
|
|
831
|
-
*
|
|
1034
|
+
* React hook for fetching suppliers for a specific money market asset from the backend API, with pagination support.
|
|
832
1035
|
*
|
|
833
|
-
*
|
|
834
|
-
*
|
|
1036
|
+
* @param {UseBackendMoneyMarketAssetSuppliersParams | undefined} params - Hook parameters:
|
|
1037
|
+
* - `params`: Object containing:
|
|
1038
|
+
* - `reserveAddress`: The reserve contract address to query, or undefined to disable the query.
|
|
1039
|
+
* - `pagination`: Backend pagination controls (`offset` and `limit` as strings).
|
|
1040
|
+
* - `queryOptions` (optional): React Query options to override defaults.
|
|
835
1041
|
*
|
|
836
|
-
* @
|
|
837
|
-
*
|
|
838
|
-
*
|
|
839
|
-
*
|
|
840
|
-
*
|
|
841
|
-
* @returns {UseQueryResult<MoneyMarketAssetSuppliers | undefined>} A query result object containing:
|
|
842
|
-
* - data: The asset suppliers data when available
|
|
843
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
844
|
-
* - error: Error object if the request failed
|
|
845
|
-
* - refetch: Function to manually trigger a data refresh
|
|
1042
|
+
* @returns {UseQueryResult<MoneyMarketAssetSuppliers | undefined, Error>} - Query result object with:
|
|
1043
|
+
* - `data`: The asset suppliers data when available.
|
|
1044
|
+
* - `isLoading`: Indicates if the request is in progress.
|
|
1045
|
+
* - `error`: Error object if the request failed.
|
|
1046
|
+
* - `refetch`: Function to trigger a manual data refresh.
|
|
846
1047
|
*
|
|
847
1048
|
* @example
|
|
848
|
-
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
* offset: '0',
|
|
852
|
-
* limit: '20'
|
|
1049
|
+
* const { data: suppliers, isLoading, error } = useBackendMoneyMarketAssetSuppliers({
|
|
1050
|
+
* params: { reserveAddress: '0xabc...' },
|
|
1051
|
+
* pagination: { offset: '0', limit: '20' }
|
|
853
1052
|
* });
|
|
854
1053
|
*
|
|
855
1054
|
* if (isLoading) return <div>Loading suppliers...</div>;
|
|
@@ -858,20 +1057,18 @@ declare const useBackendMoneyMarketAssetBorrowers: (params: {
|
|
|
858
1057
|
* console.log('Total suppliers:', suppliers.total);
|
|
859
1058
|
* console.log('Suppliers:', suppliers.suppliers);
|
|
860
1059
|
* }
|
|
861
|
-
* ```
|
|
862
1060
|
*
|
|
863
1061
|
* @remarks
|
|
864
|
-
* - The query is disabled
|
|
865
|
-
* - Uses React Query for efficient caching and
|
|
866
|
-
* -
|
|
867
|
-
* - Supports pagination through offset and limit parameters
|
|
1062
|
+
* - The query is disabled if `reserveAddress`, `offset`, or `limit` are not provided.
|
|
1063
|
+
* - Uses React Query for efficient caching, automatic retries, and error/loading handling.
|
|
1064
|
+
* - Pagination is handled via `pagination.offset` and `pagination.limit`.
|
|
868
1065
|
*/
|
|
869
|
-
declare const useBackendMoneyMarketAssetSuppliers: (params:
|
|
870
|
-
reserveAddress: string | undefined;
|
|
871
|
-
offset: string;
|
|
872
|
-
limit: string;
|
|
873
|
-
}) => UseQueryResult<MoneyMarketAssetSuppliers | undefined>;
|
|
1066
|
+
declare const useBackendMoneyMarketAssetSuppliers: (params: UseBackendMoneyMarketAssetSuppliersParams | undefined) => UseQueryResult<MoneyMarketAssetSuppliers | undefined, Error>;
|
|
874
1067
|
|
|
1068
|
+
type UseBackendAllMoneyMarketBorrowersParams = {
|
|
1069
|
+
pagination: BackendPaginationParams;
|
|
1070
|
+
queryOptions?: UseQueryOptions<MoneyMarketBorrowers | undefined, Error>;
|
|
1071
|
+
};
|
|
875
1072
|
/**
|
|
876
1073
|
* Hook for fetching all money market borrowers from the backend API.
|
|
877
1074
|
*
|
|
@@ -910,10 +1107,7 @@ declare const useBackendMoneyMarketAssetSuppliers: (params: {
|
|
|
910
1107
|
* - Supports pagination through offset and limit parameters
|
|
911
1108
|
* - Returns borrowers across all money market assets
|
|
912
1109
|
*/
|
|
913
|
-
declare const useBackendAllMoneyMarketBorrowers: (params:
|
|
914
|
-
offset: string;
|
|
915
|
-
limit: string;
|
|
916
|
-
} | undefined) => UseQueryResult<MoneyMarketBorrowers | undefined>;
|
|
1110
|
+
declare const useBackendAllMoneyMarketBorrowers: (params: UseBackendAllMoneyMarketBorrowersParams | undefined) => UseQueryResult<MoneyMarketBorrowers | undefined>;
|
|
917
1111
|
|
|
918
1112
|
/**
|
|
919
1113
|
* Hook for checking token allowance for bridge operations.
|
|
@@ -1015,7 +1209,7 @@ declare function useBridge(spokeProvider: SpokeProvider | undefined): UseMutatio
|
|
|
1015
1209
|
* }
|
|
1016
1210
|
* ```
|
|
1017
1211
|
*/
|
|
1018
|
-
declare function useGetBridgeableAmount(from: XToken
|
|
1212
|
+
declare function useGetBridgeableAmount(from: XToken | undefined, to: XToken | undefined): UseQueryResult<bigint, Error>;
|
|
1019
1213
|
|
|
1020
1214
|
/**
|
|
1021
1215
|
/**
|
|
@@ -1050,7 +1244,7 @@ declare function useGetBridgeableAmount(from: XToken$1 | undefined, to: XToken$1
|
|
|
1050
1244
|
* }
|
|
1051
1245
|
* ```
|
|
1052
1246
|
*/
|
|
1053
|
-
declare function useGetBridgeableTokens(from: SpokeChainId | undefined, to: SpokeChainId | undefined, token: string | undefined): UseQueryResult<XToken
|
|
1247
|
+
declare function useGetBridgeableTokens(from: SpokeChainId | undefined, to: SpokeChainId | undefined, token: string | undefined): UseQueryResult<XToken[], Error>;
|
|
1054
1248
|
|
|
1055
1249
|
/**
|
|
1056
1250
|
* Hook for executing stake transactions to stake SODA tokens and receive xSODA shares.
|
|
@@ -1474,11 +1668,11 @@ declare const MIGRATION_MODE_ICX_SODA = "icxsoda";
|
|
|
1474
1668
|
declare const MIGRATION_MODE_BNUSD = "bnusd";
|
|
1475
1669
|
type MigrationMode = typeof MIGRATION_MODE_ICX_SODA | typeof MIGRATION_MODE_BNUSD;
|
|
1476
1670
|
interface MigrationIntentParams {
|
|
1477
|
-
token: XToken | undefined;
|
|
1671
|
+
token: XToken$1 | undefined;
|
|
1478
1672
|
amount: string | undefined;
|
|
1479
1673
|
sourceAddress: string | undefined;
|
|
1480
1674
|
migrationMode?: MigrationMode;
|
|
1481
|
-
toToken?: XToken;
|
|
1675
|
+
toToken?: XToken$1;
|
|
1482
1676
|
destinationAddress?: string;
|
|
1483
1677
|
}
|
|
1484
1678
|
|
|
@@ -1562,4 +1756,4 @@ interface SodaxProviderProps {
|
|
|
1562
1756
|
}
|
|
1563
1757
|
declare const SodaxProvider: ({ children, testnet, config, rpcConfig }: SodaxProviderProps) => ReactElement;
|
|
1564
1758
|
|
|
1565
|
-
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 };
|
|
1759
|
+
export { type BackendPaginationParams, MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, type MigrationIntentParams, type MigrationMode, SodaxProvider, type UseATokenParams, type UseBorrowParams, type UseMMAllowanceParams, type UseMMApproveParams, type UseRepayParams, type UseReservesDataParams, type UseReservesUsdFormatParams, type UseSupplyParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawParams, useAToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendUserIntents, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useConvertedAssets, useCreateLimitOrder, 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, useUserFormattedSummary, useUserReservesData, useWithdraw };
|