@aave/react 4.0.0-next.45 → 4.0.0-next.47

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/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { AaveClient, CurrencyQueryOptions, TimeWindowQueryOptions, UnexpectedError, TransactionReceipt, ActivitiesRequest, PaginatedActivitiesResult } from '@aave/client';
1
+ import { AaveClient, CurrencyQueryOptions, TimeWindowQueryOptions, UnexpectedError, ActivitiesRequest, PaginatedActivitiesResult, TransactionReceipt } from '@aave/client';
2
2
  export * from '@aave/client';
3
3
  import React, { ReactNode } from 'react';
4
- import { a as UseAsyncTask, C as CancelOperation, P as PendingTransaction, S as SendTransactionError, b as PendingTransactionError, E as ExecutionPlanHandler } from './writes-CcVGQGt5.js';
5
- export { A as AsyncTaskError, c as AsyncTaskIdle, d as AsyncTaskLoading, e as AsyncTaskState, f as AsyncTaskSuccess, T as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-CcVGQGt5.js';
6
- import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, UserClaimableRewardsRequest, UserClaimableReward, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, TokenSwapQuoteRequest, SwapQuote, InsufficientLiquidityError, SwappableTokensRequest, Token, UserSwapsRequest, PaginatedUserSwapsResult, SwapStatusRequest, SwapStatus, SupplySwapQuoteRequest, BorrowSwapQuoteRequest, PositionSwapApproval, SwapTypedData, SwapReceipt, InsufficientBalanceError, RepayWithSupplyQuoteRequest, WithdrawSwapQuoteRequest, Erc20Approval, SwapTransactionRequest, TransactionRequest, PrepareSwapCancelRequest, SwapCancelledResult, PreContractActionRequired, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, UpdateUserPositionConditionsRequest, SetUserSuppliesAsCollateralRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, ClaimRewardsRequest, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
4
+ import { a as UseAsyncTask, C as CancelOperation, P as PendingTransaction, S as SendTransactionError, b as PendingTransactionError, c as cancel, E as ExecutionPlanHandler } from './writes-sBt0thuG.js';
5
+ export { A as AsyncTaskError, d as AsyncTaskIdle, e as AsyncTaskLoading, f as AsyncTaskState, g as AsyncTaskSuccess, T as TransactionHandlerOptions, U as UseSendTransactionResult } from './writes-sBt0thuG.js';
6
+ import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, HubSummaryHistoryRequest, HubSummarySample, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ProtocolHistoryRequest, ProtocolHistorySample, ReserveRequest, Reserve, ReservesRequest, BorrowApyHistoryRequest, ApySample, SupplyApyHistoryRequest, UserClaimableRewardsRequest, UserClaimableReward, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, PositionSwapApproval, SwapTypedData, SwapQuote, BorrowSwapQuoteRequest, SwapReceipt, InsufficientBalanceError, InsufficientLiquidityError, TransactionRequest, PrepareSwapCancelRequest, SwapCancelledResult, RepayWithSupplyQuoteRequest, SupplySwapQuoteRequest, SwappableTokensRequest, Token, SwapStatusRequest, SwapStatus, Erc20Approval, SwapTransactionRequest, TokenSwapQuoteRequest, UserSwapsRequest, PaginatedUserSwapsResult, WithdrawSwapQuoteRequest, PreContractActionRequired, BorrowRequest, ClaimRewardsRequest, LiquidatePositionRequest, PreviewRequest, PreviewUserPosition, RenounceSpokeUserPositionManagerRequest, RepayRequest, SetSpokeUserPositionManagerRequest, SetUserSuppliesAsCollateralRequest, SupplyRequest, UpdateUserPositionConditionsRequest, WithdrawRequest, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserRiskPremiumBreakdownRequest, UserRiskPremiumBreakdownItem, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
7
7
  import { Prettify, ResultAsync, Signature, ResultAwareError } from '@aave/types';
8
- import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult } from './misc-COaS62_P.js';
9
- export { d as UseChainArgs, f as UseChainsArgs, i as UseExchangeRateArgs, U as UseNetworkFee, l as UseNetworkFeeArgs, k as UseNetworkFeeRequestQuery, u as useChain, e as useChainAction, g as useChains, j as useExchangeRate, h as useExchangeRateAction } from './misc-COaS62_P.js';
10
- import { UnexpectedError as UnexpectedError$1, ValidationError, CancelError, SigningError, TimeoutError, TransactionError } from '@aave/core';
8
+ import { S as Suspendable, a as SuspenseResult, P as Pausable, b as PausableSuspenseResult, R as ReadResult, c as PausableReadResult } from './misc-BqyLi2XD.js';
9
+ export { d as UseChainArgs, f as UseChainsArgs, i as UseExchangeRateArgs, U as UseNetworkFee, l as UseNetworkFeeArgs, k as UseNetworkFeeRequestQuery, u as useChain, e as useChainAction, g as useChains, j as useExchangeRate, h as useExchangeRateAction } from './misc-BqyLi2XD.js';
10
+ import { CancelError, SigningError, UnexpectedError as UnexpectedError$1, ValidationError, TimeoutError, TransactionError } from '@aave/core';
11
11
  import { UserPositionQueryOptions } from '@aave/client/actions';
12
12
 
13
13
  /**
@@ -1149,40 +1149,83 @@ declare function useSpokeUserPositionManagers(args: UseSpokeUserPositionManagers
1149
1149
  */
1150
1150
  declare function useSpokeUserPositionManagers(args: Pausable<UseSpokeUserPositionManagersArgs>): PausableReadResult<PaginatedSpokeUserPositionManagerResult>;
1151
1151
 
1152
- type UseTokenSwapQuoteArgs = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
1152
+ type SwapHandlerOptions = {
1153
+ cancel: CancelOperation;
1154
+ };
1155
+ type SwapSignerError = CancelError | SigningError | UnexpectedError$1;
1156
+ type PositionSwapPlan = PositionSwapApproval | SwapTypedData;
1157
+ type PositionSwapHandler = (plan: PositionSwapPlan, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
1158
+ type PositionSwapValue = {
1159
+ quote?: SwapQuote;
1160
+ };
1161
+
1162
+ type UseBorrowSwapRequest = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
1153
1163
  /**
1154
- * Fetch a swap quote for the specified trade parameters.
1164
+ * Orchestrate the borrow swap execution plan.
1165
+ *
1166
+ * ```tsx
1167
+ * const [signTypedData] = useSignTypedData(wallet);
1168
+ *
1169
+ * const [swapBorrow, { loading, error }] = useBorrowSwap((plan) => {
1170
+ * switch (plan.__typename) {
1171
+ * case 'PositionSwapAdapterContractApproval':
1172
+ * case 'PositionSwapPositionManagerApproval':
1173
+ * return signTypedData(plan.bySignature);
1174
+ *
1175
+ * case 'SwapTypedData':
1176
+ * return signTypedData(plan);
1177
+ * }
1178
+ * });
1179
+ *
1180
+ * const result = await swapBorrow({
1181
+ * market: {
1182
+ * debtPosition: userBorrowItem.id,
1183
+ * buyReserve: targetReserve.id,
1184
+ * amount: bigDecimal('1000'),
1185
+ * user: evmAddress('0x742d35cc…'),
1186
+ * },
1187
+ * });
1188
+ *
1189
+ * if (result.isErr()) {
1190
+ * console.error(result.error);
1191
+ * return;
1192
+ * }
1193
+ *
1194
+ * // result.value: SwapReceipt
1195
+ * ```
1196
+ */
1197
+ declare function useBorrowSwap(handler: PositionSwapHandler): UseAsyncTask<BorrowSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1198
+
1199
+ type UseBorrowSwapQuoteArgs = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
1200
+ /**
1201
+ * Fetch a quote for a borrow swap operation with the specified parameters.
1155
1202
  *
1156
1203
  * This signature supports React Suspense:
1157
1204
  *
1158
1205
  * ```tsx
1159
- * const { data } = useTokenSwapQuote({
1206
+ * const { data } = useBorrowSwapQuote({
1160
1207
  * market: {
1161
- * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1162
- * sell: { erc20: evmAddress('0x6B175474E…') },
1208
+ * sellPosition: userBorrowItem.id,
1209
+ * buyReserve: reserve.id,
1163
1210
  * amount: bigDecimal('1000'),
1164
- * kind: SwapKind.Sell,
1165
1211
  * user: evmAddress('0x742d35cc…'),
1166
1212
  * },
1167
- * chainId: chainId(1),
1168
1213
  * suspense: true,
1169
1214
  * });
1170
1215
  * ```
1171
1216
  */
1172
- declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
1217
+ declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
1173
1218
  /**
1174
- * Fetch a swap quote for the specified trade parameters.
1219
+ * Fetch a quote for a borrow swap operation with the specified parameters.
1175
1220
  *
1176
1221
  * Pausable suspense mode.
1177
1222
  *
1178
1223
  * ```tsx
1179
- * const { data } = useTokenSwapQuote({
1224
+ * const { data } = useBorrowSwapQuote({
1180
1225
  * market: {
1181
- * chainId: chainId(1),
1182
- * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1183
- * sell: { erc20: evmAddress('0x6B175474E…') },
1226
+ * sellPosition: userBorrowItem.id,
1227
+ * buyReserve: reserve.id,
1184
1228
  * amount: bigDecimal('1000'),
1185
- * kind: SwapKind.Sell,
1186
1229
  * user: evmAddress('0x742d35cc…'),
1187
1230
  * },
1188
1231
  * suspense: true,
@@ -1190,240 +1233,281 @@ declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs & Suspendable): S
1190
1233
  * });
1191
1234
  * ```
1192
1235
  */
1193
- declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
1236
+ declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
1194
1237
  /**
1195
- * Fetch a swap quote for the specified trade parameters.
1238
+ * Fetch a quote for a borrow swap operation with the specified parameters.
1196
1239
  *
1197
1240
  * ```tsx
1198
- * const { data, error, loading } = useTokenSwapQuote({
1241
+ * const { data, error, loading } = useBorrowSwapQuote({
1199
1242
  * market: {
1200
- * chainId: chainId(1),
1201
- * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1202
- * sell: { erc20: evmAddress('0x6B175474E…') },
1243
+ * sellPosition: userBorrowItem.id,
1244
+ * buyReserve: reserve.id,
1203
1245
  * amount: bigDecimal('1000'),
1204
- * kind: SwapKind.Sell,
1205
1246
  * user: evmAddress('0x742d35cc…'),
1206
1247
  * },
1207
1248
  * });
1208
1249
  * ```
1209
1250
  */
1210
- declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs): ReadResult<SwapQuote>;
1251
+ declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs): ReadResult<SwapQuote>;
1211
1252
  /**
1212
- * Fetch a swap quote for the specified trade parameters.
1253
+ * Fetch a quote for a borrow swap operation with the specified parameters.
1213
1254
  *
1214
1255
  * Pausable loading state mode.
1215
1256
  *
1216
1257
  * ```tsx
1217
- * const { data, error, loading, paused } = useTokenSwapQuote({
1258
+ * const { data, error, loading, paused } = useBorrowSwapQuote({
1218
1259
  * market: {
1219
- * chainId: chainId(1),
1220
- * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1221
- * sell: { erc20: evmAddress('0x6B175474E…') },
1260
+ * sellPosition: userBorrowItem.id,
1261
+ * buyReserve: reserve.id,
1222
1262
  * amount: bigDecimal('1000'),
1223
- * kind: SwapKind.Sell,
1224
1263
  * user: evmAddress('0x742d35cc…'),
1225
1264
  * },
1226
1265
  * pause: true,
1227
1266
  * });
1228
1267
  * ```
1229
1268
  */
1230
- declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): PausableReadResult<SwapQuote>;
1269
+ declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs>): PausableReadResult<SwapQuote>;
1231
1270
  /**
1232
- * Low-level hook to execute a swap quote action directly.
1271
+ * Low-level hook to execute a borrow swap quote action directly.
1233
1272
  *
1234
1273
  * @remarks
1235
1274
  * This hook **does not** actively watch for updated data on the swap quote.
1236
- * Use this hook to retrieve quotes on demand as part of a larger workflow
1237
- * (e.g., in an event handler to get a fresh quote before executing a swap).
1275
+ * Use this hook to retrieve quotes on demand as part of a larger workflow.
1238
1276
  *
1239
1277
  * ```ts
1240
- * const [getQuote, { called, data, error, loading }] = useTokenSwapQuoteAction();
1278
+ * const [getQuote, { called, data, error, loading }] = useBorrowSwapQuoteAction();
1241
1279
  *
1242
1280
  * // …
1243
1281
  *
1244
1282
  * const result = await getQuote({
1245
- * market: {
1246
- * chainId: chainId(1),
1247
- * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1248
- * sell: { erc20: evmAddress('0x6B175474E…') },
1249
- * amount: bigDecimal('1000'),
1250
- * kind: SwapKind.Sell,
1251
- * },
1283
+ * debtPosition: userBorrowItem.id,
1284
+ * buyReserve: reserve.id,
1285
+ * amount: bigDecimal('1000'),
1286
+ * user: evmAddress('0x742d35cc…'),
1252
1287
  * });
1253
1288
  *
1254
1289
  * if (result.isOk()) {
1255
- * console.log('Swap quote:', result.value);
1290
+ * console.log('Borrow swap quote:', result.value);
1256
1291
  * } else {
1257
1292
  * console.error(result.error);
1258
1293
  * }
1259
1294
  * ```
1260
1295
  */
1261
- declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<TokenSwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
1262
- type UseSwappableTokensArgs = SwappableTokensRequest;
1296
+ declare function useBorrowSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<BorrowSwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
1297
+
1298
+ type CancelSwapHandler = (data: SwapTypedData | TransactionRequest, options: {
1299
+ cancel: typeof cancel;
1300
+ }) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
1301
+ declare class CannotCancelSwapError extends ResultAwareError {
1302
+ name: "CannotCancelSwapError";
1303
+ }
1304
+ type CancelSwapError = CancelError | CannotCancelSwapError | SigningError | TimeoutError | TransactionError | UnexpectedError$1;
1263
1305
  /**
1264
- * Fetch the list of tokens available for swapping on a specific chain.
1265
- *
1266
- * This signature supports React Suspense:
1306
+ * Executes the complete swap cancellation workflow combining preparation and execution.
1267
1307
  *
1268
1308
  * ```tsx
1269
- * const { data } = useSwappableTokens({
1270
- * query: { chainIds: [chainId(1)] },
1271
- * suspense: true,
1272
- * });
1273
- * ```
1274
- */
1275
- declare function useSwappableTokens(args: UseSwappableTokensArgs & Suspendable): SuspenseResult<Token[]>;
1276
- /**
1277
- * Fetch the list of tokens available for swapping on a specific chain.
1309
+ * const [sendTransaction] = useSendTransaction(wallet);
1310
+ * const [signTypedData] = useSignTypedData(wallet);
1278
1311
  *
1279
- * Pausable suspense mode.
1312
+ * const [cancelSwap, { loading, error }] = useCancelSwap((plan) => {
1313
+ * switch (plan.__typename) {
1314
+ * case 'TransactionRequest':
1315
+ * return sendTransaction(plan);
1280
1316
  *
1281
- * ```tsx
1282
- * const { data } = useSwappableTokens({
1283
- * query: { chainIds: [chainId(1)] },
1284
- * suspense: true,
1285
- * pause: true,
1317
+ * case 'SwapTypedData':
1318
+ * return signTypedData(plan);
1319
+ * }
1286
1320
  * });
1287
- * ```
1288
- */
1289
- declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs> & Suspendable): PausableSuspenseResult<Token[]>;
1290
- /**
1291
- * Fetch the list of tokens available for swapping on a specific chain.
1292
1321
  *
1293
- * ```tsx
1294
- * const { data, error, loading } = useSwappableTokens({
1295
- * query: { chainIds: [chainId(1)] },
1322
+ * const result = await cancelSwap({
1323
+ * id: swapId('123…'),
1296
1324
  * });
1325
+ *
1326
+ * if (result.isErr()) {
1327
+ * console.error(result.error);
1328
+ * return;
1329
+ * }
1330
+ *
1331
+ * // result.value: SwapCancelledResult
1332
+ * console.log('Swap cancelled:', result.value);
1297
1333
  * ```
1298
1334
  */
1299
- declare function useSwappableTokens(args: UseSwappableTokensArgs): ReadResult<Token[]>;
1335
+ declare function useCancelSwap(handler: CancelSwapHandler): UseAsyncTask<PrepareSwapCancelRequest, SwapCancelledResult, CancelSwapError>;
1336
+
1337
+ type UseRepayWithSupplyRequest = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
1300
1338
  /**
1301
- * Fetch the list of tokens available for swapping on a specific chain.
1302
- *
1303
- * Pausable loading state mode.
1339
+ * Orchestrate the repay with supply execution plan.
1304
1340
  *
1305
1341
  * ```tsx
1306
- * const { data, error, loading, paused } = useSwappableTokens({
1307
- * query: { chainIds: [chainId(1)] },
1308
- * pause: true,
1342
+ * const [signTypedData] = useSignTypedData(wallet);
1343
+ *
1344
+ * const [repayWithSupply, { loading, error }] = useRepayWithSupply((plan) => {
1345
+ * switch (plan.__typename) {
1346
+ * case 'PositionSwapAdapterContractApproval':
1347
+ * case 'PositionSwapPositionManagerApproval':
1348
+ * return signTypedData(plan.bySignature);
1349
+ *
1350
+ * case 'SwapTypedData':
1351
+ * return signTypedData(plan);
1352
+ * }
1353
+ * });
1354
+ *
1355
+ * const result = await repayWithSupply({
1356
+ * market: {
1357
+ * sellPosition: userSupplyItem.id,
1358
+ * buyPosition: userBorrowItem.id,
1359
+ * amount: bigDecimal('1000'),
1360
+ * user: evmAddress('0x742d35cc…'),
1361
+ * },
1309
1362
  * });
1363
+ *
1364
+ * if (result.isErr()) {
1365
+ * console.error(result.error);
1366
+ * return;
1367
+ * }
1368
+ *
1369
+ * // result.value: SwapReceipt
1310
1370
  * ```
1311
1371
  */
1312
- declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs>): PausableReadResult<Token[]>;
1313
- type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
1372
+ declare function useRepayWithSupply(handler: PositionSwapHandler): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1373
+
1374
+ type UseRepayWithSupplyQuoteArgs = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
1314
1375
  /**
1315
- * Fetch the user's swap history for a specific chain.
1376
+ * Fetch a quote for a repay with supply operation with the specified parameters.
1316
1377
  *
1317
1378
  * This signature supports React Suspense:
1318
1379
  *
1319
1380
  * ```tsx
1320
- * const { data } = useUserSwaps({
1321
- * chainId: chainId(1),
1322
- * user: evmAddress('0x742d35cc…'),
1323
- * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
1381
+ * const { data } = useRepayWithSupplyQuote({
1382
+ * market: {
1383
+ * sellPosition: userSupplyItem.id,
1384
+ * buyPosition: userBorrowItem.id,
1385
+ * amount: bigDecimal('1000'),
1386
+ * user: evmAddress('0x742d35cc…'),
1387
+ * },
1324
1388
  * suspense: true,
1325
1389
  * });
1326
1390
  * ```
1327
1391
  */
1328
- declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseResult<PaginatedUserSwapsResult>;
1392
+ declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
1329
1393
  /**
1330
- * Fetch the user's swap history for a specific chain.
1394
+ * Fetch a quote for a repay with supply operation with the specified parameters.
1331
1395
  *
1332
1396
  * Pausable suspense mode.
1333
1397
  *
1334
1398
  * ```tsx
1335
- * const { data } = useUserSwaps({
1336
- * chainId: chainId(1),
1337
- * user: evmAddress('0x742d35cc…'),
1338
- * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
1399
+ * const { data } = useRepayWithSupplyQuote({
1400
+ * market: {
1401
+ * sellPosition: userSupplyItem.id,
1402
+ * buyPosition: userBorrowItem.id,
1403
+ * amount: bigDecimal('1000'),
1404
+ * user: evmAddress('0x742d35cc…'),
1405
+ * },
1339
1406
  * suspense: true,
1340
1407
  * pause: true,
1341
1408
  * });
1342
1409
  * ```
1343
1410
  */
1344
- declare function useUserSwaps(args: Pausable<UseUserSwapsArgs> & Suspendable): PausableSuspenseResult<PaginatedUserSwapsResult>;
1411
+ declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
1345
1412
  /**
1346
- * Fetch the user's swap history for a specific chain.
1413
+ * Fetch a quote for a repay with supply operation with the specified parameters.
1347
1414
  *
1348
1415
  * ```tsx
1349
- * const { data, error, loading } = useUserSwaps({
1350
- * chainId: chainId(1),
1351
- * user: evmAddress('0x742d35cc…'),
1352
- * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
1353
- * });
1354
- * ```
1355
- */
1356
- declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserSwapsResult>;
1357
- /**
1358
- * Fetch the user's swap history for a specific chain.
1416
+ * const { data, error, loading } = useRepayWithSupplyQuote({
1417
+ * market: {
1418
+ * sellPosition: userSupplyItem.id,
1419
+ * buyPosition: userBorrowItem.id,
1420
+ * amount: bigDecimal('1000'),
1421
+ * user: evmAddress('0x742d35cc…'),
1422
+ * },
1423
+ * });
1424
+ * ```
1425
+ */
1426
+ declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs): ReadResult<SwapQuote>;
1427
+ /**
1428
+ * Fetch a quote for a repay with supply operation with the specified parameters.
1359
1429
  *
1360
1430
  * Pausable loading state mode.
1361
1431
  *
1362
1432
  * ```tsx
1363
- * const { data, error, loading, paused } = useUserSwaps({
1364
- * chainId: chainId(1),
1365
- * user: evmAddress('0x742d35cc…'),
1366
- * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
1433
+ * const { data, error, loading, paused } = useRepayWithSupplyQuote({
1434
+ * market: {
1435
+ * sellPosition: userSupplyItem.id,
1436
+ * buyPosition: userBorrowItem.id,
1437
+ * amount: bigDecimal('1000'),
1438
+ * user: evmAddress('0x742d35cc…'),
1439
+ * },
1367
1440
  * pause: true,
1368
1441
  * });
1369
1442
  * ```
1370
1443
  */
1371
- declare function useUserSwaps(args: Pausable<UseUserSwapsArgs>): PausableReadResult<PaginatedUserSwapsResult>;
1372
- type UseSwapStatusArgs = Prettify<SwapStatusRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
1444
+ declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs>): PausableReadResult<SwapQuote>;
1373
1445
  /**
1374
- * Monitor the status of a single swap operation in real-time.
1446
+ * Low-level hook to execute a repay with supply quote action directly.
1375
1447
  *
1376
- * Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
1448
+ * @remarks
1449
+ * This hook **does not** actively watch for updated data on the swap quote.
1450
+ * Use this hook to retrieve quotes on demand as part of a larger workflow.
1377
1451
  *
1378
- * This signature supports React Suspense:
1452
+ * ```ts
1453
+ * const [getQuote, { called, data, error, loading }] = useRepayWithSupplyQuoteAction();
1379
1454
  *
1380
- * ```tsx
1381
- * const { data } = useSwapStatus({
1382
- * id: swapReceipt.id,
1383
- * suspense: true,
1455
+ * // …
1456
+ *
1457
+ * const result = await getQuote({
1458
+ * repayWithReserve: reserve.id,
1459
+ * debtPosition: userBorrowItem.id,
1460
+ * amount: bigDecimal('1000'),
1461
+ * user: evmAddress('0x742d35cc…'),
1384
1462
  * });
1463
+ *
1464
+ * if (result.isOk()) {
1465
+ * console.log('Repay with supply quote:', result.value);
1466
+ * } else {
1467
+ * console.error(result.error);
1468
+ * }
1385
1469
  * ```
1386
1470
  */
1387
- declare function useSwapStatus(args: UseSwapStatusArgs & Suspendable): SuspenseResult<SwapStatus>;
1471
+ declare function useRepayWithSupplyQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
1472
+
1473
+ type UseSupplySwapRequest = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
1388
1474
  /**
1389
- * Monitor the status of a single swap operation in real-time.
1390
- *
1391
- * Pausable suspense mode.
1475
+ * Orchestrate the supply swap execution plan.
1392
1476
  *
1393
1477
  * ```tsx
1394
- * const { data } = useSwapStatus({
1395
- * id: swapReceipt.id,
1396
- * suspense: true,
1397
- * pause: shouldPause,
1398
- * });
1399
- * ```
1400
- */
1401
- declare function useSwapStatus(args: Pausable<UseSwapStatusArgs> & Suspendable): PausableSuspenseResult<SwapStatus>;
1402
- /**
1403
- * Monitor the status of a single swap operation in real-time.
1478
+ * const [signTypedData] = useSignTypedData(wallet);
1404
1479
  *
1405
- * Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
1480
+ * const [swapSupply, { loading, error }] = useSupplySwap((plan) => {
1481
+ * switch (plan.__typename) {
1482
+ * case 'PositionSwapAdapterContractApproval':
1483
+ * case 'PositionSwapPositionManagerApproval':
1484
+ * return signTypedData(plan.bySignature);
1406
1485
  *
1407
- * ```tsx
1408
- * const { data, error, loading } = useSwapStatus({
1409
- * id: swapReceipt.id,
1486
+ * case 'SwapTypedData':
1487
+ * return signTypedData(plan);
1488
+ * }
1410
1489
  * });
1411
- * ```
1412
- */
1413
- declare function useSwapStatus(args: UseSwapStatusArgs): ReadResult<SwapStatus>;
1414
- /**
1415
- * Monitor the status of a single swap operation in real-time.
1416
- *
1417
- * Pausable loading state mode.
1418
1490
  *
1419
- * ```tsx
1420
- * const { data, error, loading, paused } = useSwapStatus({
1421
- * id: swapReceipt.id,
1422
- * pause: shouldPause,
1491
+ * const result = await swapSupply({
1492
+ * market: {
1493
+ * sellPosition: supplyPosition.id,
1494
+ * buyReserve: targetReserve.id,
1495
+ * amount: bigDecimal('1000'),
1496
+ * user: evmAddress('0x742d35cc…'),
1497
+ * enableCollateral: true,
1498
+ * },
1423
1499
  * });
1500
+ *
1501
+ * if (result.isErr()) {
1502
+ * console.error(result.error);
1503
+ * return;
1504
+ * }
1505
+ *
1506
+ * // result.value: SwapReceipt
1424
1507
  * ```
1425
1508
  */
1426
- declare function useSwapStatus(args: Pausable<UseSwapStatusArgs>): PausableReadResult<SwapStatus>;
1509
+ declare function useSupplySwap(handler: PositionSwapHandler): UseAsyncTask<SupplySwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1510
+
1427
1511
  type UseSupplySwapQuoteArgs = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
1428
1512
  /**
1429
1513
  * Fetch a quote for a supply swap operation with the specified parameters.
@@ -1522,174 +1606,144 @@ declare function useSupplySwapQuote(args: Pausable<UseSupplySwapQuoteArgs>): Pau
1522
1606
  * ```
1523
1607
  */
1524
1608
  declare function useSupplySwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<SupplySwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
1525
- type UseBorrowSwapQuoteArgs = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
1609
+
1610
+ type UseSwappableTokensArgs = SwappableTokensRequest;
1526
1611
  /**
1527
- * Fetch a quote for a borrow swap operation with the specified parameters.
1612
+ * Fetch the list of tokens available for swapping on a specific chain.
1528
1613
  *
1529
1614
  * This signature supports React Suspense:
1530
1615
  *
1531
1616
  * ```tsx
1532
- * const { data } = useBorrowSwapQuote({
1533
- * market: {
1534
- * sellPosition: userBorrowItem.id,
1535
- * buyReserve: reserve.id,
1536
- * amount: bigDecimal('1000'),
1537
- * user: evmAddress('0x742d35cc…'),
1538
- * },
1617
+ * const { data } = useSwappableTokens({
1618
+ * query: { chainIds: [chainId(1)] },
1539
1619
  * suspense: true,
1540
1620
  * });
1541
1621
  * ```
1542
1622
  */
1543
- declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
1623
+ declare function useSwappableTokens(args: UseSwappableTokensArgs & Suspendable): SuspenseResult<Token[]>;
1544
1624
  /**
1545
- * Fetch a quote for a borrow swap operation with the specified parameters.
1625
+ * Fetch the list of tokens available for swapping on a specific chain.
1546
1626
  *
1547
1627
  * Pausable suspense mode.
1548
1628
  *
1549
1629
  * ```tsx
1550
- * const { data } = useBorrowSwapQuote({
1551
- * market: {
1552
- * sellPosition: userBorrowItem.id,
1553
- * buyReserve: reserve.id,
1554
- * amount: bigDecimal('1000'),
1555
- * user: evmAddress('0x742d35cc…'),
1556
- * },
1630
+ * const { data } = useSwappableTokens({
1631
+ * query: { chainIds: [chainId(1)] },
1557
1632
  * suspense: true,
1558
1633
  * pause: true,
1559
1634
  * });
1560
1635
  * ```
1561
1636
  */
1562
- declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
1637
+ declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs> & Suspendable): PausableSuspenseResult<Token[]>;
1563
1638
  /**
1564
- * Fetch a quote for a borrow swap operation with the specified parameters.
1639
+ * Fetch the list of tokens available for swapping on a specific chain.
1565
1640
  *
1566
1641
  * ```tsx
1567
- * const { data, error, loading } = useBorrowSwapQuote({
1568
- * market: {
1569
- * sellPosition: userBorrowItem.id,
1570
- * buyReserve: reserve.id,
1571
- * amount: bigDecimal('1000'),
1572
- * user: evmAddress('0x742d35cc…'),
1573
- * },
1642
+ * const { data, error, loading } = useSwappableTokens({
1643
+ * query: { chainIds: [chainId(1)] },
1574
1644
  * });
1575
1645
  * ```
1576
1646
  */
1577
- declare function useBorrowSwapQuote(args: UseBorrowSwapQuoteArgs): ReadResult<SwapQuote>;
1647
+ declare function useSwappableTokens(args: UseSwappableTokensArgs): ReadResult<Token[]>;
1578
1648
  /**
1579
- * Fetch a quote for a borrow swap operation with the specified parameters.
1649
+ * Fetch the list of tokens available for swapping on a specific chain.
1580
1650
  *
1581
1651
  * Pausable loading state mode.
1582
1652
  *
1583
1653
  * ```tsx
1584
- * const { data, error, loading, paused } = useBorrowSwapQuote({
1585
- * market: {
1586
- * sellPosition: userBorrowItem.id,
1587
- * buyReserve: reserve.id,
1588
- * amount: bigDecimal('1000'),
1589
- * user: evmAddress('0x742d35cc…'),
1590
- * },
1654
+ * const { data, error, loading, paused } = useSwappableTokens({
1655
+ * query: { chainIds: [chainId(1)] },
1591
1656
  * pause: true,
1592
1657
  * });
1593
1658
  * ```
1594
1659
  */
1595
- declare function useBorrowSwapQuote(args: Pausable<UseBorrowSwapQuoteArgs>): PausableReadResult<SwapQuote>;
1660
+ declare function useSwappableTokens(args: Pausable<UseSwappableTokensArgs>): PausableReadResult<Token[]>;
1661
+
1662
+ type UseSwapStatusArgs = Prettify<SwapStatusRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
1596
1663
  /**
1597
- * Low-level hook to execute a borrow swap quote action directly.
1598
- *
1599
- * @remarks
1600
- * This hook **does not** actively watch for updated data on the swap quote.
1601
- * Use this hook to retrieve quotes on demand as part of a larger workflow.
1664
+ * Monitor the status of a single swap operation in real-time.
1602
1665
  *
1603
- * ```ts
1604
- * const [getQuote, { called, data, error, loading }] = useBorrowSwapQuoteAction();
1666
+ * Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
1605
1667
  *
1606
- * //
1668
+ * This signature supports React Suspense:
1607
1669
  *
1608
- * const result = await getQuote({
1609
- * debtPosition: userBorrowItem.id,
1610
- * buyReserve: reserve.id,
1611
- * amount: bigDecimal('1000'),
1612
- * user: evmAddress('0x742d35cc…'),
1670
+ * ```tsx
1671
+ * const { data } = useSwapStatus({
1672
+ * id: swapReceipt.id,
1673
+ * suspense: true,
1613
1674
  * });
1614
- *
1615
- * if (result.isOk()) {
1616
- * console.log('Borrow swap quote:', result.value);
1617
- * } else {
1618
- * console.error(result.error);
1619
- * }
1620
1675
  * ```
1621
1676
  */
1622
- declare function useBorrowSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<BorrowSwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
1623
- type SwapHandlerOptions = {
1624
- cancel: CancelOperation;
1625
- };
1626
- type SwapSignerError = CancelError | SigningError | UnexpectedError$1;
1627
- type PositionSwapPlan = PositionSwapApproval | SwapTypedData;
1628
- type PositionSwapHandler = (plan: PositionSwapPlan, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
1629
- type PositionSwapValue = {
1630
- quote?: SwapQuote;
1631
- };
1632
- type UseSupplySwapRequest = Prettify<SupplySwapQuoteRequest & CurrencyQueryOptions>;
1677
+ declare function useSwapStatus(args: UseSwapStatusArgs & Suspendable): SuspenseResult<SwapStatus>;
1633
1678
  /**
1634
- * Orchestrate the supply swap execution plan.
1635
- *
1636
- * ```tsx
1637
- * const [signTypedData] = useSignTypedData(wallet);
1638
- *
1639
- * const [swapSupply, { loading, error }] = useSupplySwap((plan) => {
1640
- * switch (plan.__typename) {
1641
- * case 'PositionSwapAdapterContractApproval':
1642
- * case 'PositionSwapPositionManagerApproval':
1643
- * return signTypedData(plan.bySignature);
1679
+ * Monitor the status of a single swap operation in real-time.
1644
1680
  *
1645
- * case 'SwapTypedData':
1646
- * return signTypedData(plan);
1647
- * }
1648
- * });
1681
+ * Pausable suspense mode.
1649
1682
  *
1650
- * const result = await swapSupply({
1651
- * market: {
1652
- * sellPosition: supplyPosition.id,
1653
- * buyReserve: targetReserve.id,
1654
- * amount: bigDecimal('1000'),
1655
- * user: evmAddress('0x742d35cc…'),
1656
- * enableCollateral: true,
1657
- * },
1683
+ * ```tsx
1684
+ * const { data } = useSwapStatus({
1685
+ * id: swapReceipt.id,
1686
+ * suspense: true,
1687
+ * pause: shouldPause,
1658
1688
  * });
1659
- *
1660
- * if (result.isErr()) {
1661
- * console.error(result.error);
1662
- * return;
1663
- * }
1664
- *
1665
- * // result.value: SwapReceipt
1666
1689
  * ```
1667
1690
  */
1668
- declare function useSupplySwap(handler: PositionSwapHandler): UseAsyncTask<SupplySwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1669
- type UseBorrowSwapRequest = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptions>;
1691
+ declare function useSwapStatus(args: Pausable<UseSwapStatusArgs> & Suspendable): PausableSuspenseResult<SwapStatus>;
1670
1692
  /**
1671
- * Orchestrate the borrow swap execution plan.
1693
+ * Monitor the status of a single swap operation in real-time.
1672
1694
  *
1673
- * ```tsx
1674
- * const [signTypedData] = useSignTypedData(wallet);
1695
+ * Polls automatically until the swap reaches a terminal state (fulfilled, cancelled, or expired).
1675
1696
  *
1676
- * const [swapBorrow, { loading, error }] = useBorrowSwap((plan) => {
1677
- * switch (plan.__typename) {
1678
- * case 'PositionSwapAdapterContractApproval':
1679
- * case 'PositionSwapPositionManagerApproval':
1680
- * return signTypedData(plan.bySignature);
1697
+ * ```tsx
1698
+ * const { data, error, loading } = useSwapStatus({
1699
+ * id: swapReceipt.id,
1700
+ * });
1701
+ * ```
1702
+ */
1703
+ declare function useSwapStatus(args: UseSwapStatusArgs): ReadResult<SwapStatus>;
1704
+ /**
1705
+ * Monitor the status of a single swap operation in real-time.
1706
+ *
1707
+ * Pausable loading state mode.
1708
+ *
1709
+ * ```tsx
1710
+ * const { data, error, loading, paused } = useSwapStatus({
1711
+ * id: swapReceipt.id,
1712
+ * pause: shouldPause,
1713
+ * });
1714
+ * ```
1715
+ */
1716
+ declare function useSwapStatus(args: Pausable<UseSwapStatusArgs>): PausableReadResult<SwapStatus>;
1717
+
1718
+ type UseTokenSwapRequest = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
1719
+ type TokenSwapPlan = SwapTypedData | Erc20Approval | SwapTransactionRequest;
1720
+ type TokenSwapHandler = (plan: TokenSwapPlan, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
1721
+ /**
1722
+ * Orchestrate the token swap execution plan.
1723
+ *
1724
+ * ```tsx
1725
+ * const [sendTransaction] = useSendTransaction(wallet);
1726
+ * const [signTypedData] = useSignTypedData(wallet);
1727
+ *
1728
+ * const [swap, { loading, error }] = useTokenSwap((plan) => {
1729
+ * switch (plan.__typename) {
1730
+ * case 'Erc20Approval':
1731
+ * if (plan.bySignature) {
1732
+ * return signTypedData(plan.bySignature);
1733
+ * }
1734
+ * return sendTransaction(plan.byTransaction);
1735
+ *
1736
+ * case 'SwapTransactionRequest':
1737
+ * return sendTransaction(plan.transaction);
1681
1738
  *
1682
1739
  * case 'SwapTypedData':
1683
1740
  * return signTypedData(plan);
1684
1741
  * }
1685
1742
  * });
1686
1743
  *
1687
- * const result = await swapBorrow({
1688
- * market: {
1689
- * debtPosition: userBorrowItem.id,
1690
- * buyReserve: targetReserve.id,
1691
- * amount: bigDecimal('1000'),
1692
- * user: evmAddress('0x742d35cc…'),
1744
+ * const result = await swap({
1745
+ * fromQuote: {
1746
+ * quoteId: quote.quoteId,
1693
1747
  * },
1694
1748
  * });
1695
1749
  *
@@ -1701,37 +1755,42 @@ type UseBorrowSwapRequest = Prettify<BorrowSwapQuoteRequest & CurrencyQueryOptio
1701
1755
  * // result.value: SwapReceipt
1702
1756
  * ```
1703
1757
  */
1704
- declare function useBorrowSwap(handler: PositionSwapHandler): UseAsyncTask<BorrowSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1705
- type UseRepayWithSupplyQuoteArgs = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
1758
+ declare function useTokenSwap(handler: TokenSwapHandler): UseAsyncTask<UseTokenSwapRequest, SwapReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1759
+
1760
+ type UseTokenSwapQuoteArgs = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
1706
1761
  /**
1707
- * Fetch a quote for a repay with supply operation with the specified parameters.
1762
+ * Fetch a swap quote for the specified trade parameters.
1708
1763
  *
1709
1764
  * This signature supports React Suspense:
1710
1765
  *
1711
1766
  * ```tsx
1712
- * const { data } = useRepayWithSupplyQuote({
1767
+ * const { data } = useTokenSwapQuote({
1713
1768
  * market: {
1714
- * sellPosition: userSupplyItem.id,
1715
- * buyPosition: userBorrowItem.id,
1769
+ * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1770
+ * sell: { erc20: evmAddress('0x6B175474E…') },
1716
1771
  * amount: bigDecimal('1000'),
1772
+ * kind: SwapKind.Sell,
1717
1773
  * user: evmAddress('0x742d35cc…'),
1718
1774
  * },
1775
+ * chainId: chainId(1),
1719
1776
  * suspense: true,
1720
1777
  * });
1721
1778
  * ```
1722
1779
  */
1723
- declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
1780
+ declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs & Suspendable): SuspenseResult<SwapQuote>;
1724
1781
  /**
1725
- * Fetch a quote for a repay with supply operation with the specified parameters.
1782
+ * Fetch a swap quote for the specified trade parameters.
1726
1783
  *
1727
1784
  * Pausable suspense mode.
1728
1785
  *
1729
1786
  * ```tsx
1730
- * const { data } = useRepayWithSupplyQuote({
1787
+ * const { data } = useTokenSwapQuote({
1731
1788
  * market: {
1732
- * sellPosition: userSupplyItem.id,
1733
- * buyPosition: userBorrowItem.id,
1789
+ * chainId: chainId(1),
1790
+ * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1791
+ * sell: { erc20: evmAddress('0x6B175474E…') },
1734
1792
  * amount: bigDecimal('1000'),
1793
+ * kind: SwapKind.Sell,
1735
1794
  * user: evmAddress('0x742d35cc…'),
1736
1795
  * },
1737
1796
  * suspense: true,
@@ -1739,75 +1798,144 @@ declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs & Sus
1739
1798
  * });
1740
1799
  * ```
1741
1800
  */
1742
- declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
1801
+ declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs> & Suspendable): PausableSuspenseResult<SwapQuote>;
1743
1802
  /**
1744
- * Fetch a quote for a repay with supply operation with the specified parameters.
1803
+ * Fetch a swap quote for the specified trade parameters.
1745
1804
  *
1746
1805
  * ```tsx
1747
- * const { data, error, loading } = useRepayWithSupplyQuote({
1806
+ * const { data, error, loading } = useTokenSwapQuote({
1748
1807
  * market: {
1749
- * sellPosition: userSupplyItem.id,
1750
- * buyPosition: userBorrowItem.id,
1808
+ * chainId: chainId(1),
1809
+ * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1810
+ * sell: { erc20: evmAddress('0x6B175474E…') },
1751
1811
  * amount: bigDecimal('1000'),
1812
+ * kind: SwapKind.Sell,
1752
1813
  * user: evmAddress('0x742d35cc…'),
1753
1814
  * },
1754
1815
  * });
1755
1816
  * ```
1756
1817
  */
1757
- declare function useRepayWithSupplyQuote(args: UseRepayWithSupplyQuoteArgs): ReadResult<SwapQuote>;
1818
+ declare function useTokenSwapQuote(args: UseTokenSwapQuoteArgs): ReadResult<SwapQuote>;
1758
1819
  /**
1759
- * Fetch a quote for a repay with supply operation with the specified parameters.
1820
+ * Fetch a swap quote for the specified trade parameters.
1760
1821
  *
1761
1822
  * Pausable loading state mode.
1762
1823
  *
1763
1824
  * ```tsx
1764
- * const { data, error, loading, paused } = useRepayWithSupplyQuote({
1825
+ * const { data, error, loading, paused } = useTokenSwapQuote({
1765
1826
  * market: {
1766
- * sellPosition: userSupplyItem.id,
1767
- * buyPosition: userBorrowItem.id,
1827
+ * chainId: chainId(1),
1828
+ * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1829
+ * sell: { erc20: evmAddress('0x6B175474E…') },
1768
1830
  * amount: bigDecimal('1000'),
1831
+ * kind: SwapKind.Sell,
1769
1832
  * user: evmAddress('0x742d35cc…'),
1770
1833
  * },
1771
1834
  * pause: true,
1772
1835
  * });
1773
1836
  * ```
1774
1837
  */
1775
- declare function useRepayWithSupplyQuote(args: Pausable<UseRepayWithSupplyQuoteArgs>): PausableReadResult<SwapQuote>;
1838
+ declare function useTokenSwapQuote(args: Pausable<UseTokenSwapQuoteArgs>): PausableReadResult<SwapQuote>;
1776
1839
  /**
1777
- * Low-level hook to execute a repay with supply quote action directly.
1840
+ * Low-level hook to execute a swap quote action directly.
1778
1841
  *
1779
1842
  * @remarks
1780
1843
  * This hook **does not** actively watch for updated data on the swap quote.
1781
- * Use this hook to retrieve quotes on demand as part of a larger workflow.
1844
+ * Use this hook to retrieve quotes on demand as part of a larger workflow
1845
+ * (e.g., in an event handler to get a fresh quote before executing a swap).
1782
1846
  *
1783
1847
  * ```ts
1784
- * const [getQuote, { called, data, error, loading }] = useRepayWithSupplyQuoteAction();
1848
+ * const [getQuote, { called, data, error, loading }] = useTokenSwapQuoteAction();
1785
1849
  *
1786
1850
  * // …
1787
1851
  *
1788
1852
  * const result = await getQuote({
1789
- * repayWithReserve: reserve.id,
1790
- * debtPosition: userBorrowItem.id,
1791
- * amount: bigDecimal('1000'),
1792
- * user: evmAddress('0x742d35cc…'),
1853
+ * market: {
1854
+ * chainId: chainId(1),
1855
+ * buy: { erc20: evmAddress('0xA0b86a33E6…') },
1856
+ * sell: { erc20: evmAddress('0x6B175474E…') },
1857
+ * amount: bigDecimal('1000'),
1858
+ * kind: SwapKind.Sell,
1859
+ * },
1793
1860
  * });
1794
1861
  *
1795
1862
  * if (result.isOk()) {
1796
- * console.log('Repay with supply quote:', result.value);
1863
+ * console.log('Swap quote:', result.value);
1797
1864
  * } else {
1798
1865
  * console.error(result.error);
1799
1866
  * }
1800
1867
  * ```
1801
1868
  */
1802
- declare function useRepayWithSupplyQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
1803
- type UseRepayWithSupplyRequest = Prettify<RepayWithSupplyQuoteRequest & CurrencyQueryOptions>;
1869
+ declare function useTokenSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<TokenSwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
1870
+
1871
+ type UseUserSwapsArgs = Prettify<UserSwapsRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
1804
1872
  /**
1805
- * Orchestrate the repay with supply execution plan.
1873
+ * Fetch the user's swap history for a specific chain.
1874
+ *
1875
+ * This signature supports React Suspense:
1876
+ *
1877
+ * ```tsx
1878
+ * const { data } = useUserSwaps({
1879
+ * chainId: chainId(1),
1880
+ * user: evmAddress('0x742d35cc…'),
1881
+ * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
1882
+ * suspense: true,
1883
+ * });
1884
+ * ```
1885
+ */
1886
+ declare function useUserSwaps(args: UseUserSwapsArgs & Suspendable): SuspenseResult<PaginatedUserSwapsResult>;
1887
+ /**
1888
+ * Fetch the user's swap history for a specific chain.
1889
+ *
1890
+ * Pausable suspense mode.
1891
+ *
1892
+ * ```tsx
1893
+ * const { data } = useUserSwaps({
1894
+ * chainId: chainId(1),
1895
+ * user: evmAddress('0x742d35cc…'),
1896
+ * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
1897
+ * suspense: true,
1898
+ * pause: true,
1899
+ * });
1900
+ * ```
1901
+ */
1902
+ declare function useUserSwaps(args: Pausable<UseUserSwapsArgs> & Suspendable): PausableSuspenseResult<PaginatedUserSwapsResult>;
1903
+ /**
1904
+ * Fetch the user's swap history for a specific chain.
1905
+ *
1906
+ * ```tsx
1907
+ * const { data, error, loading } = useUserSwaps({
1908
+ * chainId: chainId(1),
1909
+ * user: evmAddress('0x742d35cc…'),
1910
+ * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
1911
+ * });
1912
+ * ```
1913
+ */
1914
+ declare function useUserSwaps(args: UseUserSwapsArgs): ReadResult<PaginatedUserSwapsResult>;
1915
+ /**
1916
+ * Fetch the user's swap history for a specific chain.
1917
+ *
1918
+ * Pausable loading state mode.
1919
+ *
1920
+ * ```tsx
1921
+ * const { data, error, loading, paused } = useUserSwaps({
1922
+ * chainId: chainId(1),
1923
+ * user: evmAddress('0x742d35cc…'),
1924
+ * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
1925
+ * pause: true,
1926
+ * });
1927
+ * ```
1928
+ */
1929
+ declare function useUserSwaps(args: Pausable<UseUserSwapsArgs>): PausableReadResult<PaginatedUserSwapsResult>;
1930
+
1931
+ type UseWithdrawSwapRequest = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
1932
+ /**
1933
+ * Orchestrate the withdraw swap execution plan.
1806
1934
  *
1807
1935
  * ```tsx
1808
1936
  * const [signTypedData] = useSignTypedData(wallet);
1809
1937
  *
1810
- * const [repayWithSupply, { loading, error }] = useRepayWithSupply((plan) => {
1938
+ * const [withdrawSwap, { loading, error }] = useWithdrawSwap((plan) => {
1811
1939
  * switch (plan.__typename) {
1812
1940
  * case 'PositionSwapAdapterContractApproval':
1813
1941
  * case 'PositionSwapPositionManagerApproval':
@@ -1818,10 +1946,10 @@ type UseRepayWithSupplyRequest = Prettify<RepayWithSupplyQuoteRequest & Currency
1818
1946
  * }
1819
1947
  * });
1820
1948
  *
1821
- * const result = await repayWithSupply({
1949
+ * const result = await withdrawSwap({
1822
1950
  * market: {
1823
- * sellPosition: userSupplyItem.id,
1824
- * buyPosition: userBorrowItem.id,
1951
+ * position: userSupplyItem.id,
1952
+ * buyToken: { erc20: evmAddress('0xA0b86a33E6…') },
1825
1953
  * amount: bigDecimal('1000'),
1826
1954
  * user: evmAddress('0x742d35cc…'),
1827
1955
  * },
@@ -1835,7 +1963,8 @@ type UseRepayWithSupplyRequest = Prettify<RepayWithSupplyQuoteRequest & Currency
1835
1963
  * // result.value: SwapReceipt
1836
1964
  * ```
1837
1965
  */
1838
- declare function useRepayWithSupply(handler: PositionSwapHandler): UseAsyncTask<RepayWithSupplyQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1966
+ declare function useWithdrawSwap(handler: PositionSwapHandler): UseAsyncTask<WithdrawSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1967
+
1839
1968
  type UseWithdrawSwapQuoteArgs = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
1840
1969
  /**
1841
1970
  * Fetch a quote for a withdraw swap operation with the specified parameters.
@@ -1934,177 +2063,91 @@ declare function useWithdrawSwapQuote(args: Pausable<UseWithdrawSwapQuoteArgs>):
1934
2063
  * ```
1935
2064
  */
1936
2065
  declare function useWithdrawSwapQuoteAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<WithdrawSwapQuoteRequest, SwapQuote, UnexpectedError$1 | ValidationError<InsufficientLiquidityError>>;
1937
- type UseWithdrawSwapRequest = Prettify<WithdrawSwapQuoteRequest & CurrencyQueryOptions>;
2066
+
2067
+ type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
1938
2068
  /**
1939
- * Orchestrate the withdraw swap execution plan.
1940
- *
1941
- * ```tsx
1942
- * const [signTypedData] = useSignTypedData(wallet);
1943
- *
1944
- * const [withdrawSwap, { loading, error }] = useWithdrawSwap((plan) => {
1945
- * switch (plan.__typename) {
1946
- * case 'PositionSwapAdapterContractApproval':
1947
- * case 'PositionSwapPositionManagerApproval':
1948
- * return signTypedData(plan.bySignature);
2069
+ * Fetch paginated list of activities.
1949
2070
  *
1950
- * case 'SwapTypedData':
1951
- * return signTypedData(plan);
1952
- * }
1953
- * });
2071
+ * This signature supports React Suspense:
1954
2072
  *
1955
- * const result = await withdrawSwap({
1956
- * market: {
1957
- * position: userSupplyItem.id,
1958
- * buyToken: { erc20: evmAddress('0xA0b86a33E6…') },
1959
- * amount: bigDecimal('1000'),
1960
- * user: evmAddress('0x742d35cc…'),
2073
+ * ```tsx
2074
+ * const { data } = useActivities({
2075
+ * query: {
2076
+ * chainId: chainId(1),
1961
2077
  * },
2078
+ * user: evmAddress('0x742d35cc…'),
2079
+ * suspense: true,
1962
2080
  * });
1963
2081
  *
1964
- * if (result.isErr()) {
1965
- * console.error(result.error);
1966
- * return;
1967
- * }
1968
- *
1969
- * // result.value: SwapReceipt
2082
+ * // data.items: ActivityItem[]
1970
2083
  * ```
1971
2084
  */
1972
- declare function useWithdrawSwap(handler: PositionSwapHandler): UseAsyncTask<WithdrawSwapQuoteRequest, SwapReceipt, SwapSignerError | SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
1973
- type UseTokenSwapRequest = Prettify<TokenSwapQuoteRequest & CurrencyQueryOptions>;
1974
- type TokenSwapPlan = SwapTypedData | Erc20Approval | SwapTransactionRequest;
1975
- type TokenSwapHandler = (plan: TokenSwapPlan, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
2085
+ declare function useActivities(args: UseActivitiesArgs & Suspendable): SuspenseResult<PaginatedActivitiesResult>;
1976
2086
  /**
1977
- * Orchestrate the token swap execution plan.
2087
+ * Fetch paginated list of activities.
1978
2088
  *
1979
- * ```tsx
1980
- * const [sendTransaction] = useSendTransaction(wallet);
1981
- * const [signTypedData] = useSignTypedData(wallet);
2089
+ * Pausable suspense mode.
1982
2090
  *
1983
- * const [swap, { loading, error }] = useTokenSwap((plan) => {
1984
- * switch (plan.__typename) {
1985
- * case 'Erc20Approval':
1986
- * if (plan.bySignature) {
1987
- * return signTypedData(plan.bySignature);
1988
- * }
1989
- * return sendTransaction(plan.byTransaction);
1990
- *
1991
- * case 'SwapTransactionRequest':
1992
- * return sendTransaction(plan.transaction);
1993
- *
1994
- * case 'SwapTypedData':
1995
- * return signTypedData(plan);
1996
- * }
1997
- * });
1998
- *
1999
- * const result = await swap({
2000
- * fromQuote: {
2001
- * quoteId: quote.quoteId,
2091
+ * ```tsx
2092
+ * const { data } = useActivities({
2093
+ * query: {
2094
+ * chainId: chainId(1),
2002
2095
  * },
2096
+ * user: evmAddress('0x742d35cc…'),
2097
+ * suspense: true,
2098
+ * pause: true,
2003
2099
  * });
2004
2100
  *
2005
- * if (result.isErr()) {
2006
- * console.error(result.error);
2007
- * return;
2008
- * }
2009
- *
2010
- * // result.value: SwapReceipt
2101
+ * // data?.items: ActivityItem[] | undefined
2011
2102
  * ```
2012
2103
  */
2013
- declare function useTokenSwap(handler: TokenSwapHandler): UseAsyncTask<UseTokenSwapRequest, SwapReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError | InsufficientLiquidityError>>;
2014
- type CancelSwapHandler = (data: SwapTypedData | TransactionRequest, options: SwapHandlerOptions) => ResultAsync<PendingTransaction | Signature, SwapSignerError>;
2015
- declare class CannotCancelSwapError extends ResultAwareError {
2016
- name: "CannotCancelSwapError";
2017
- }
2018
- type CancelSwapError = CancelError | CannotCancelSwapError | SigningError | TimeoutError | TransactionError | UnexpectedError$1;
2104
+ declare function useActivities(args: Pausable<UseActivitiesArgs> & Suspendable): PausableSuspenseResult<PaginatedActivitiesResult>;
2019
2105
  /**
2020
- * Executes the complete swap cancellation workflow combining preparation and execution.
2106
+ * Fetch paginated list of activities.
2021
2107
  *
2022
2108
  * ```tsx
2023
- * const [sendTransaction] = useSendTransaction(wallet);
2024
- * const [signTypedData] = useSignTypedData(wallet);
2025
- *
2026
- * const [cancelSwap, { loading, error }] = useCancelSwap((plan) => {
2027
- * switch (plan.__typename) {
2028
- * case 'TransactionRequest':
2029
- * return sendTransaction(plan);
2030
- *
2031
- * case 'SwapTypedData':
2032
- * return signTypedData(plan);
2033
- * }
2034
- * });
2035
- *
2036
- * const result = await cancelSwap({
2037
- * id: swapId('123…'),
2109
+ * const { data, error, loading } = useActivities({
2110
+ * query: {
2111
+ * chainId: chainId(1),
2112
+ * },
2113
+ * user: evmAddress('0x742d35cc…'),
2038
2114
  * });
2039
- *
2040
- * if (result.isErr()) {
2041
- * console.error(result.error);
2042
- * return;
2043
- * }
2044
- *
2045
- * // result.value: SwapCancelledResult
2046
- * console.log('Swap cancelled:', result.value);
2047
2115
  * ```
2048
2116
  */
2049
- declare function useCancelSwap(handler: CancelSwapHandler): UseAsyncTask<PrepareSwapCancelRequest, SwapCancelledResult, CancelSwapError>;
2050
-
2117
+ declare function useActivities(args: UseActivitiesArgs): ReadResult<PaginatedActivitiesResult>;
2051
2118
  /**
2052
- * A hook that provides a way to supply assets to an Aave reserve.
2053
- *
2054
- * ```ts
2055
- * const [sendTransaction] = useSendTransaction(wallet);
2056
- * const [supply, { loading, error }] = useSupply((plan, { cancel }) => {
2057
- * switch (plan.__typename) {
2058
- * case 'TransactionRequest':
2059
- * return sendTransaction(plan);
2119
+ * Fetch paginated list of activities.
2060
2120
  *
2061
- * case 'Erc20Approval':
2062
- * return sendTransaction(plan.byTransaction);
2121
+ * Pausable loading state mode.
2063
2122
  *
2064
- * case 'PreContractActionRequired':
2065
- * return sendTransaction(plan.transaction);
2066
- * }
2123
+ * ```tsx
2124
+ * const { data, error, loading } = useActivities({
2125
+ * query: {
2126
+ * chainId: chainId(1),
2127
+ * },
2128
+ * user: evmAddress('0x742d35cc…'),
2129
+ * pause: true,
2067
2130
  * });
2068
2131
  *
2069
- * //
2070
- *
2071
- * const result = await supply({ ... });
2072
- *
2073
- * if (result.isErr()) {
2074
- * switch (result.error.name) {
2075
- * case 'CancelError':
2076
- * // The user cancelled the operation
2077
- * return;
2078
- *
2079
- * case 'SigningError':
2080
- * console.error(`Failed to sign the transaction: ${result.error.message}`);
2081
- * break;
2082
- *
2083
- * case 'TimeoutError':
2084
- * console.error(`Transaction timed out: ${result.error.message}`);
2085
- * break;
2086
- *
2087
- * case 'TransactionError':
2088
- * console.error(`Transaction failed: ${result.error.message}`);
2089
- * break;
2090
- *
2091
- * case 'ValidationError':
2092
- * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
2093
- * break;
2094
- *
2095
- * case 'UnexpectedError':
2096
- * console.error(result.error.message);
2097
- * break;
2098
- * }
2099
- * return;
2100
- * }
2101
- *
2102
- * console.log('Transaction sent with hash:', result.value.txHash);
2132
+ * // data?.items: ActivityItem[] | undefined
2133
+ * // error: UnexpectedError | undefined
2134
+ * // loading: boolean | undefined
2103
2135
  * ```
2136
+ */
2137
+ declare function useActivities(args: Pausable<UseActivitiesArgs>): PausableReadResult<PaginatedActivitiesResult>;
2138
+ /**
2139
+ * Low-level hook to execute a {@link activities} action directly.
2104
2140
  *
2105
- * @param handler - The handler that will be used to handle the transactions.
2141
+ * @experimental This hook is experimental and may be subject to breaking changes.
2142
+ * @remarks
2143
+ * This hook does not actively watch for updates. Use it to fetch activities on demand
2144
+ * (e.g., in an event handler when paginating or refining filters).
2145
+ *
2146
+ * @param options - The query options.
2147
+ * @returns The user history.
2106
2148
  */
2107
- declare function useSupply(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, Signature | PendingTransaction>): UseAsyncTask<SupplyRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2149
+ declare function useActivitiesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ActivitiesRequest, PaginatedActivitiesResult, UnexpectedError>;
2150
+
2108
2151
  /**
2109
2152
  * A hook that provides a way to borrow assets from an Aave reserve.
2110
2153
  *
@@ -2159,27 +2202,21 @@ declare function useSupply(handler: ExecutionPlanHandler<TransactionRequest | Er
2159
2202
  * @param handler - The handler that will be used to handle the transactions.
2160
2203
  */
2161
2204
  declare function useBorrow(handler: ExecutionPlanHandler<TransactionRequest | PreContractActionRequired, PendingTransaction>): UseAsyncTask<BorrowRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2205
+
2162
2206
  /**
2163
- * A hook that provides a way to repay borrowed assets to an Aave reserve.
2207
+ * A hook that provides a way to claim rewards.
2164
2208
  *
2165
2209
  * ```ts
2166
2210
  * const [sendTransaction] = useSendTransaction(wallet);
2167
- * const [repay, { loading, error }] = useRepay((plan, { cancel }) => {
2168
- * switch (plan.__typename) {
2169
- * case 'TransactionRequest':
2170
- * return sendTransaction(plan);
2171
- *
2172
- * case 'Erc20Approval':
2173
- * return sendTransaction(plan.byTransaction);
2174
- *
2175
- * case 'PreContractActionRequired':
2176
- * return sendTransaction(plan.transaction);
2177
- * }
2211
+ * const [claim, { loading, error }] = useClaimRewards((transaction, { cancel }) => {
2212
+ * return sendTransaction(transaction);
2178
2213
  * });
2179
2214
  *
2180
2215
  * // …
2181
2216
  *
2182
- * const result = await repay({ ... });
2217
+ * const result = await claim({
2218
+ * ids: [rewardId('abc123')],
2219
+ * });
2183
2220
  *
2184
2221
  * if (result.isErr()) {
2185
2222
  * switch (result.error.name) {
@@ -2199,10 +2236,6 @@ declare function useBorrow(handler: ExecutionPlanHandler<TransactionRequest | Pr
2199
2236
  * console.error(`Transaction failed: ${result.error.message}`);
2200
2237
  * break;
2201
2238
  *
2202
- * case 'ValidationError':
2203
- * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
2204
- * break;
2205
- *
2206
2239
  * case 'UnexpectedError':
2207
2240
  * console.error(result.error.message);
2208
2241
  * break;
@@ -2213,19 +2246,23 @@ declare function useBorrow(handler: ExecutionPlanHandler<TransactionRequest | Pr
2213
2246
  * console.log('Transaction sent with hash:', result.value.txHash);
2214
2247
  * ```
2215
2248
  *
2216
- * @param handler - The handler that will be used to handle the transactions.
2249
+ * @param handler - The handler that will be used to handle the transaction.
2217
2250
  */
2218
- declare function useRepay(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, Signature | PendingTransaction>): UseAsyncTask<RepayRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2251
+ declare function useClaimRewards(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<ClaimRewardsRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2252
+
2219
2253
  /**
2220
- * A hook that provides a way to withdraw supplied assets from an Aave reserve.
2254
+ * A hook that provides a way to liquidate a user's position.
2221
2255
  *
2222
2256
  * ```ts
2223
2257
  * const [sendTransaction] = useSendTransaction(wallet);
2224
- * const [withdraw, { loading, error }] = useWithdraw((plan, { cancel }) => {
2258
+ * const [liquidatePosition, { loading, error }] = useLiquidatePosition((plan, { cancel }) => {
2225
2259
  * switch (plan.__typename) {
2226
2260
  * case 'TransactionRequest':
2227
2261
  * return sendTransaction(plan);
2228
2262
  *
2263
+ * case 'Erc20Approval':
2264
+ * return sendTransaction(plan.byTransaction);
2265
+ *
2229
2266
  * case 'PreContractActionRequired':
2230
2267
  * return sendTransaction(plan.transaction);
2231
2268
  * }
@@ -2233,7 +2270,13 @@ declare function useRepay(handler: ExecutionPlanHandler<TransactionRequest | Erc
2233
2270
  *
2234
2271
  * // …
2235
2272
  *
2236
- * const result = await withdraw({ ... });
2273
+ * const result = await liquidatePosition({
2274
+ * collateral: reserveId('SGVsbG8h'),
2275
+ * debt: reserveId('Q2lhbyE= '),
2276
+ * amount: amount,
2277
+ * liquidator: liquidator,
2278
+ * borrower: borrower,
2279
+ * });
2237
2280
  *
2238
2281
  * if (result.isErr()) {
2239
2282
  * switch (result.error.name) {
@@ -2269,114 +2312,148 @@ declare function useRepay(handler: ExecutionPlanHandler<TransactionRequest | Erc
2269
2312
  *
2270
2313
  * @param handler - The handler that will be used to handle the transactions.
2271
2314
  */
2272
- declare function useWithdraw(handler: ExecutionPlanHandler<TransactionRequest | PreContractActionRequired, PendingTransaction>): UseAsyncTask<WithdrawRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2315
+ declare function useLiquidatePosition(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, PendingTransaction | Signature>): UseAsyncTask<LiquidatePositionRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2316
+
2273
2317
  /**
2274
- * A hook that provides a way to renounce a position manager of a user for a specific spoke.
2318
+ * Preview the impact of a potential action on a user's position.
2275
2319
  *
2276
- * ```ts
2277
- * const [sendTransaction] = useSendTransaction(wallet);
2278
- * const [renounceSpokeUserPositionManager, { loading, error }] = useRenounceSpokeUserPositionManager(sendTransaction);
2320
+ * ```tsx
2321
+ * const [getPreview, previewing] = usePreviewAction();
2322
+ *
2323
+ * const loading = previewing.loading;
2324
+ * const error = previewing.error;
2279
2325
  *
2280
2326
  * // …
2281
2327
  *
2282
- * const result = await renounceSpokeUserPositionManager({ ... });
2328
+ * const result = await getPreview({
2329
+ * action: {
2330
+ * supply: {
2331
+ * reserve: reserveId('SGVsbG8h'),
2332
+ * amount: {
2333
+ * erc20: {
2334
+ * value: '1000',
2335
+ * },
2336
+ * },
2337
+ * sender: evmAddress('0x9abc…'),
2338
+ * },
2339
+ * },
2340
+ * });
2283
2341
  *
2284
2342
  * if (result.isErr()) {
2285
- * switch (result.error.name) {
2286
- * case 'CancelError':
2287
- * // The user cancelled the operation
2288
- * return;
2289
- *
2290
- * case 'SigningError':
2291
- * console.error(`Failed to sign the transaction: ${result.error.message}`);
2292
- * break;
2293
- *
2294
- * case 'TimeoutError':
2295
- * console.error(`Transaction timed out: ${result.error.message}`);
2296
- * break;
2297
- *
2298
- * case 'TransactionError':
2299
- * console.error(`Transaction failed: ${result.error.message}`);
2300
- * break;
2301
- *
2302
- * case 'UnexpectedError':
2303
- * console.error(result.error.message);
2304
- * break;
2305
- * }
2343
+ * console.error(result.error);
2306
2344
  * return;
2307
2345
  * }
2308
2346
  *
2309
- * console.log('Transaction sent with hash:', result.value.txHash);
2347
+ * console.log('Preview result:', result.value);
2310
2348
  * ```
2311
- *
2312
- * @param handler - The handler that will be used to handle the transaction.
2313
2349
  */
2314
- declare function useRenounceSpokeUserPositionManager(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<RenounceSpokeUserPositionManagerRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2350
+ declare function usePreviewAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<PreviewRequest, PreviewUserPosition, UnexpectedError>;
2351
+ type UsePreviewArgs = Prettify<PreviewRequest & CurrencyQueryOptions>;
2315
2352
  /**
2316
- * Hook for updating user position conditions (dynamic config and/or risk premium).
2317
- *
2318
- * ```ts
2319
- * const [sendTransaction] = useSendTransaction(wallet);
2320
- * const [update, { loading, error }] = useUpdateUserPositionConditions((transaction, { cancel }) => {
2321
- * return sendTransaction(transaction);
2322
- * });
2323
- *
2324
- * // …
2353
+ * Fetch a preview of the impact of a potential action on a user's position.
2325
2354
  *
2326
- * const result = await update({
2327
- * userPositionId: userPosition.id,
2328
- * update: UserPositionConditionsUpdate.AllDynamicConfig,
2329
- * });
2355
+ * This signature supports React Suspense:
2330
2356
  *
2331
- * if (result.isErr()) {
2332
- * switch (result.error.name) {
2333
- * case 'CancelError':
2334
- * // The user cancelled the operation
2335
- * return;
2357
+ * ```tsx
2358
+ * const { data } = usePreview({
2359
+ * action: {
2360
+ * supply: {
2361
+ * reserve: reserveId('SGVsbG8h'),
2362
+ * amount: {
2363
+ * erc20: {
2364
+ * currency: evmAddress('0x5678…'),
2365
+ * value: '1000',
2366
+ * },
2367
+ * },
2368
+ * supplier: evmAddress('0x9abc…'),
2369
+ * },
2370
+ * },
2371
+ * suspense: true,
2372
+ * });
2373
+ * ```
2374
+ */
2375
+ declare function usePreview(args: UsePreviewArgs & Suspendable): SuspenseResult<PreviewUserPosition>;
2376
+ /**
2377
+ * Fetch a preview of the impact of a potential action on a user's position.
2336
2378
  *
2337
- * case 'SigningError':
2338
- * console.error(`Failed to sign the transaction: ${result.error.message}`);
2339
- * break;
2379
+ * Pausable suspense mode.
2340
2380
  *
2341
- * case 'TimeoutError':
2342
- * console.error(`Transaction timed out: ${result.error.message}`);
2343
- * break;
2381
+ * ```tsx
2382
+ * const { data } = usePreview({
2383
+ * action: {
2384
+ * supply: {
2385
+ * reserve: reserveId('SGVsbG8h'),
2386
+ * amount: {
2387
+ * erc20: {
2388
+ * currency: evmAddress('0x5678…'),
2389
+ * value: '1000',
2390
+ * },
2391
+ * },
2392
+ * supplier: evmAddress('0x9abc…'),
2393
+ * },
2394
+ * },
2395
+ * suspense: true,
2396
+ * pause: true,
2397
+ * });
2398
+ * ```
2399
+ */
2400
+ declare function usePreview(args: Pausable<UsePreviewArgs> & Suspendable): PausableSuspenseResult<PreviewUserPosition>;
2401
+ /**
2402
+ * Fetch a preview of the impact of a potential action on a user's position.
2344
2403
  *
2345
- * case 'TransactionError':
2346
- * console.error(`Transaction failed: ${result.error.message}`);
2347
- * break;
2404
+ * ```tsx
2405
+ * const { data, error, loading } = usePreview({
2406
+ * action: {
2407
+ * supply: {
2408
+ * reserve: reserveId('SGVsbG8h'),
2409
+ * amount: {
2410
+ * erc20: {
2411
+ * currency: evmAddress('0x5678…'),
2412
+ * value: '1000',
2413
+ * },
2414
+ * },
2415
+ * supplier: evmAddress('0x9abc…'),
2416
+ * },
2417
+ * },
2418
+ * });
2419
+ * ```
2420
+ */
2421
+ declare function usePreview(args: UsePreviewArgs): ReadResult<PreviewUserPosition>;
2422
+ /**
2423
+ * Fetch a preview of the impact of a potential action on a user's position.
2348
2424
  *
2349
- * case 'UnexpectedError':
2350
- * console.error(result.error.message);
2351
- * break;
2352
- * }
2353
- * return;
2354
- * }
2425
+ * Pausable loading state mode.
2355
2426
  *
2356
- * console.log('Transaction sent with hash:', result.value.txHash);
2427
+ * ```tsx
2428
+ * const { data, error, loading, paused } = usePreview({
2429
+ * action: {
2430
+ * supply: {
2431
+ * reserve: reserveId('SGVsbG8h'),
2432
+ * amount: {
2433
+ * erc20: {
2434
+ * currency: evmAddress('0x5678…'),
2435
+ * value: '1000',
2436
+ * },
2437
+ * },
2438
+ * supplier: evmAddress('0x9abc…'),
2439
+ * },
2440
+ * },
2441
+ * pause: true,
2442
+ * });
2357
2443
  * ```
2358
- *
2359
- * @param handler - The handler that will be used to handle the transaction.
2360
2444
  */
2361
- declare function useUpdateUserPositionConditions(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<UpdateUserPositionConditionsRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2445
+ declare function usePreview(args: Pausable<UsePreviewArgs>): PausableReadResult<PreviewUserPosition>;
2446
+
2362
2447
  /**
2363
- * Hook for updating the collateral status of user's supplies.
2448
+ * A hook that provides a way to renounce a position manager of a user for a specific spoke.
2364
2449
  *
2365
2450
  * ```ts
2366
2451
  * const [sendTransaction] = useSendTransaction(wallet);
2367
- * const [setUserSuppliesAsCollateral, { loading, error }] = useSetUserSuppliesAsCollateral((transaction, { cancel }) => {
2368
- * return sendTransaction(transaction);
2369
- * });
2452
+ * const [renounceSpokeUserPositionManager, { loading, error }] = useRenounceSpokeUserPositionManager(sendTransaction);
2370
2453
  *
2371
- * const result = await setUserSuppliesAsCollateral({
2372
- * changes: [
2373
- * {
2374
- * reserve: reserve.id,
2375
- * enableCollateral: true
2376
- * }
2377
- * ],
2378
- * sender: evmAddress('0x456...')
2379
- * });
2454
+ * //
2455
+ *
2456
+ * const result = await renounceSpokeUserPositionManager({ ... });
2380
2457
  *
2381
2458
  * if (result.isErr()) {
2382
2459
  * switch (result.error.name) {
@@ -2408,13 +2485,14 @@ declare function useUpdateUserPositionConditions(handler: ExecutionPlanHandler<T
2408
2485
  *
2409
2486
  * @param handler - The handler that will be used to handle the transaction.
2410
2487
  */
2411
- declare function useSetUserSuppliesAsCollateral(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<SetUserSuppliesAsCollateralRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2488
+ declare function useRenounceSpokeUserPositionManager(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<RenounceSpokeUserPositionManagerRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2489
+
2412
2490
  /**
2413
- * A hook that provides a way to liquidate a user's position.
2491
+ * A hook that provides a way to repay borrowed assets to an Aave reserve.
2414
2492
  *
2415
2493
  * ```ts
2416
2494
  * const [sendTransaction] = useSendTransaction(wallet);
2417
- * const [liquidatePosition, { loading, error }] = useLiquidatePosition((plan, { cancel }) => {
2495
+ * const [repay, { loading, error }] = useRepay((plan, { cancel }) => {
2418
2496
  * switch (plan.__typename) {
2419
2497
  * case 'TransactionRequest':
2420
2498
  * return sendTransaction(plan);
@@ -2429,13 +2507,7 @@ declare function useSetUserSuppliesAsCollateral(handler: ExecutionPlanHandler<Tr
2429
2507
  *
2430
2508
  * // …
2431
2509
  *
2432
- * const result = await liquidatePosition({
2433
- * collateral: reserveId('SGVsbG8h'),
2434
- * debt: reserveId('Q2lhbyE= '),
2435
- * amount: amount,
2436
- * liquidator: liquidator,
2437
- * borrower: borrower,
2438
- * });
2510
+ * const result = await repay({ ... });
2439
2511
  *
2440
2512
  * if (result.isErr()) {
2441
2513
  * switch (result.error.name) {
@@ -2471,7 +2543,8 @@ declare function useSetUserSuppliesAsCollateral(handler: ExecutionPlanHandler<Tr
2471
2543
  *
2472
2544
  * @param handler - The handler that will be used to handle the transactions.
2473
2545
  */
2474
- declare function useLiquidatePosition(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, PendingTransaction | Signature>): UseAsyncTask<LiquidatePositionRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2546
+ declare function useRepay(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, Signature | PendingTransaction>): UseAsyncTask<RepayRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2547
+
2475
2548
  /**
2476
2549
  * A hook that provides a way to set or remove a position manager for a user on a specific spoke.
2477
2550
  *
@@ -2534,232 +2607,182 @@ declare function useLiquidatePosition(handler: ExecutionPlanHandler<TransactionR
2534
2607
  * @param handler - The handler that will be used to handle the transaction.
2535
2608
  */
2536
2609
  declare function useSetSpokeUserPositionManager(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<SetSpokeUserPositionManagerRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2610
+
2537
2611
  /**
2538
- * Preview the impact of a potential action on a user's position.
2539
- *
2540
- * ```tsx
2541
- * const [getPreview, previewing] = usePreviewAction();
2542
- *
2543
- * const loading = previewing.loading;
2544
- * const error = previewing.error;
2612
+ * Hook for updating the collateral status of user's supplies.
2545
2613
  *
2546
- * // …
2614
+ * ```ts
2615
+ * const [sendTransaction] = useSendTransaction(wallet);
2616
+ * const [setUserSuppliesAsCollateral, { loading, error }] = useSetUserSuppliesAsCollateral((transaction, { cancel }) => {
2617
+ * return sendTransaction(transaction);
2618
+ * });
2547
2619
  *
2548
- * const result = await getPreview({
2549
- * action: {
2550
- * supply: {
2551
- * reserve: reserveId('SGVsbG8h'),
2552
- * amount: {
2553
- * erc20: {
2554
- * value: '1000',
2555
- * },
2556
- * },
2557
- * sender: evmAddress('0x9abc…'),
2558
- * },
2559
- * },
2620
+ * const result = await setUserSuppliesAsCollateral({
2621
+ * changes: [
2622
+ * {
2623
+ * reserve: reserve.id,
2624
+ * enableCollateral: true
2625
+ * }
2626
+ * ],
2627
+ * sender: evmAddress('0x456...')
2560
2628
  * });
2561
2629
  *
2562
2630
  * if (result.isErr()) {
2563
- * console.error(result.error);
2631
+ * switch (result.error.name) {
2632
+ * case 'CancelError':
2633
+ * // The user cancelled the operation
2634
+ * return;
2635
+ *
2636
+ * case 'SigningError':
2637
+ * console.error(`Failed to sign the transaction: ${result.error.message}`);
2638
+ * break;
2639
+ *
2640
+ * case 'TimeoutError':
2641
+ * console.error(`Transaction timed out: ${result.error.message}`);
2642
+ * break;
2643
+ *
2644
+ * case 'TransactionError':
2645
+ * console.error(`Transaction failed: ${result.error.message}`);
2646
+ * break;
2647
+ *
2648
+ * case 'UnexpectedError':
2649
+ * console.error(result.error.message);
2650
+ * break;
2651
+ * }
2564
2652
  * return;
2565
2653
  * }
2566
2654
  *
2567
- * console.log('Preview result:', result.value);
2655
+ * console.log('Transaction sent with hash:', result.value.txHash);
2568
2656
  * ```
2569
- */
2570
- declare function usePreviewAction(options?: Required<CurrencyQueryOptions>): UseAsyncTask<PreviewRequest, PreviewUserPosition, UnexpectedError>;
2571
- type UsePreviewArgs = Prettify<PreviewRequest & CurrencyQueryOptions>;
2572
- /**
2573
- * Fetch a preview of the impact of a potential action on a user's position.
2574
2657
  *
2575
- * This signature supports React Suspense:
2576
- *
2577
- * ```tsx
2578
- * const { data } = usePreview({
2579
- * action: {
2580
- * supply: {
2581
- * reserve: reserveId('SGVsbG8h'),
2582
- * amount: {
2583
- * erc20: {
2584
- * currency: evmAddress('0x5678…'),
2585
- * value: '1000',
2586
- * },
2587
- * },
2588
- * supplier: evmAddress('0x9abc…'),
2589
- * },
2590
- * },
2591
- * suspense: true,
2592
- * });
2593
- * ```
2658
+ * @param handler - The handler that will be used to handle the transaction.
2594
2659
  */
2595
- declare function usePreview(args: UsePreviewArgs & Suspendable): SuspenseResult<PreviewUserPosition>;
2660
+ declare function useSetUserSuppliesAsCollateral(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<SetUserSuppliesAsCollateralRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2661
+
2596
2662
  /**
2597
- * Fetch a preview of the impact of a potential action on a user's position.
2663
+ * A hook that provides a way to supply assets to an Aave reserve.
2598
2664
  *
2599
- * Pausable suspense mode.
2665
+ * ```ts
2666
+ * const [sendTransaction] = useSendTransaction(wallet);
2667
+ * const [supply, { loading, error }] = useSupply((plan, { cancel }) => {
2668
+ * switch (plan.__typename) {
2669
+ * case 'TransactionRequest':
2670
+ * return sendTransaction(plan);
2600
2671
  *
2601
- * ```tsx
2602
- * const { data } = usePreview({
2603
- * action: {
2604
- * supply: {
2605
- * reserve: reserveId('SGVsbG8h'),
2606
- * amount: {
2607
- * erc20: {
2608
- * currency: evmAddress('0x5678…'),
2609
- * value: '1000',
2610
- * },
2611
- * },
2612
- * supplier: evmAddress('0x9abc…'),
2613
- * },
2614
- * },
2615
- * suspense: true,
2616
- * pause: true,
2617
- * });
2618
- * ```
2619
- */
2620
- declare function usePreview(args: Pausable<UsePreviewArgs> & Suspendable): PausableSuspenseResult<PreviewUserPosition>;
2621
- /**
2622
- * Fetch a preview of the impact of a potential action on a user's position.
2672
+ * case 'Erc20Approval':
2673
+ * return sendTransaction(plan.byTransaction);
2623
2674
  *
2624
- * ```tsx
2625
- * const { data, error, loading } = usePreview({
2626
- * action: {
2627
- * supply: {
2628
- * reserve: reserveId('SGVsbG8h'),
2629
- * amount: {
2630
- * erc20: {
2631
- * currency: evmAddress('0x5678…'),
2632
- * value: '1000',
2633
- * },
2634
- * },
2635
- * supplier: evmAddress('0x9abc…'),
2636
- * },
2637
- * },
2675
+ * case 'PreContractActionRequired':
2676
+ * return sendTransaction(plan.transaction);
2677
+ * }
2638
2678
  * });
2639
- * ```
2640
- */
2641
- declare function usePreview(args: UsePreviewArgs): ReadResult<PreviewUserPosition>;
2642
- /**
2643
- * Fetch a preview of the impact of a potential action on a user's position.
2644
2679
  *
2645
- * Pausable loading state mode.
2680
+ * //
2646
2681
  *
2647
- * ```tsx
2648
- * const { data, error, loading, paused } = usePreview({
2649
- * action: {
2650
- * supply: {
2651
- * reserve: reserveId('SGVsbG8h'),
2652
- * amount: {
2653
- * erc20: {
2654
- * currency: evmAddress('0x5678…'),
2655
- * value: '1000',
2656
- * },
2657
- * },
2658
- * supplier: evmAddress('0x9abc…'),
2659
- * },
2660
- * },
2661
- * pause: true,
2662
- * });
2663
- * ```
2664
- */
2665
- declare function usePreview(args: Pausable<UsePreviewArgs>): PausableReadResult<PreviewUserPosition>;
2666
- type UseActivitiesArgs = Prettify<ActivitiesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
2667
- /**
2668
- * Fetch paginated list of activities.
2682
+ * const result = await supply({ ... });
2669
2683
  *
2670
- * This signature supports React Suspense:
2684
+ * if (result.isErr()) {
2685
+ * switch (result.error.name) {
2686
+ * case 'CancelError':
2687
+ * // The user cancelled the operation
2688
+ * return;
2671
2689
  *
2672
- * ```tsx
2673
- * const { data } = useActivities({
2674
- * query: {
2675
- * chainId: chainId(1),
2676
- * },
2677
- * user: evmAddress('0x742d35cc…'),
2678
- * suspense: true,
2679
- * });
2690
+ * case 'SigningError':
2691
+ * console.error(`Failed to sign the transaction: ${result.error.message}`);
2692
+ * break;
2680
2693
  *
2681
- * // data.items: ActivityItem[]
2682
- * ```
2683
- */
2684
- declare function useActivities(args: UseActivitiesArgs & Suspendable): SuspenseResult<PaginatedActivitiesResult>;
2685
- /**
2686
- * Fetch paginated list of activities.
2694
+ * case 'TimeoutError':
2695
+ * console.error(`Transaction timed out: ${result.error.message}`);
2696
+ * break;
2687
2697
  *
2688
- * Pausable suspense mode.
2698
+ * case 'TransactionError':
2699
+ * console.error(`Transaction failed: ${result.error.message}`);
2700
+ * break;
2689
2701
  *
2690
- * ```tsx
2691
- * const { data } = useActivities({
2692
- * query: {
2693
- * chainId: chainId(1),
2694
- * },
2695
- * user: evmAddress('0x742d35cc…'),
2696
- * suspense: true,
2697
- * pause: true,
2698
- * });
2702
+ * case 'ValidationError':
2703
+ * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
2704
+ * break;
2699
2705
  *
2700
- * // data?.items: ActivityItem[] | undefined
2706
+ * case 'UnexpectedError':
2707
+ * console.error(result.error.message);
2708
+ * break;
2709
+ * }
2710
+ * return;
2711
+ * }
2712
+ *
2713
+ * console.log('Transaction sent with hash:', result.value.txHash);
2701
2714
  * ```
2715
+ *
2716
+ * @param handler - The handler that will be used to handle the transactions.
2702
2717
  */
2703
- declare function useActivities(args: Pausable<UseActivitiesArgs> & Suspendable): PausableSuspenseResult<PaginatedActivitiesResult>;
2718
+ declare function useSupply(handler: ExecutionPlanHandler<TransactionRequest | Erc20Approval | PreContractActionRequired, Signature | PendingTransaction>): UseAsyncTask<SupplyRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2719
+
2704
2720
  /**
2705
- * Fetch paginated list of activities.
2721
+ * Hook for updating user position conditions (dynamic config and/or risk premium).
2706
2722
  *
2707
- * ```tsx
2708
- * const { data, error, loading } = useActivities({
2709
- * query: {
2710
- * chainId: chainId(1),
2711
- * },
2712
- * user: evmAddress('0x742d35cc…'),
2723
+ * ```ts
2724
+ * const [sendTransaction] = useSendTransaction(wallet);
2725
+ * const [update, { loading, error }] = useUpdateUserPositionConditions((transaction, { cancel }) => {
2726
+ * return sendTransaction(transaction);
2713
2727
  * });
2714
- * ```
2715
- */
2716
- declare function useActivities(args: UseActivitiesArgs): ReadResult<PaginatedActivitiesResult>;
2717
- /**
2718
- * Fetch paginated list of activities.
2719
2728
  *
2720
- * Pausable loading state mode.
2729
+ * //
2721
2730
  *
2722
- * ```tsx
2723
- * const { data, error, loading } = useActivities({
2724
- * query: {
2725
- * chainId: chainId(1),
2726
- * },
2727
- * user: evmAddress('0x742d35cc…'),
2728
- * pause: true,
2731
+ * const result = await update({
2732
+ * userPositionId: userPosition.id,
2733
+ * update: UserPositionConditionsUpdate.AllDynamicConfig,
2729
2734
  * });
2730
2735
  *
2731
- * // data?.items: ActivityItem[] | undefined
2732
- * // error: UnexpectedError | undefined
2733
- * // loading: boolean | undefined
2734
- * ```
2735
- */
2736
- declare function useActivities(args: Pausable<UseActivitiesArgs>): PausableReadResult<PaginatedActivitiesResult>;
2737
- /**
2738
- * Low-level hook to execute a {@link activities} action directly.
2736
+ * if (result.isErr()) {
2737
+ * switch (result.error.name) {
2738
+ * case 'CancelError':
2739
+ * // The user cancelled the operation
2740
+ * return;
2739
2741
  *
2740
- * @experimental This hook is experimental and may be subject to breaking changes.
2741
- * @remarks
2742
- * This hook does not actively watch for updates. Use it to fetch activities on demand
2743
- * (e.g., in an event handler when paginating or refining filters).
2742
+ * case 'SigningError':
2743
+ * console.error(`Failed to sign the transaction: ${result.error.message}`);
2744
+ * break;
2744
2745
  *
2745
- * @param options - The query options.
2746
- * @returns The user history.
2746
+ * case 'TimeoutError':
2747
+ * console.error(`Transaction timed out: ${result.error.message}`);
2748
+ * break;
2749
+ *
2750
+ * case 'TransactionError':
2751
+ * console.error(`Transaction failed: ${result.error.message}`);
2752
+ * break;
2753
+ *
2754
+ * case 'UnexpectedError':
2755
+ * console.error(result.error.message);
2756
+ * break;
2757
+ * }
2758
+ * return;
2759
+ * }
2760
+ *
2761
+ * console.log('Transaction sent with hash:', result.value.txHash);
2762
+ * ```
2763
+ *
2764
+ * @param handler - The handler that will be used to handle the transaction.
2747
2765
  */
2748
- declare function useActivitiesAction(options?: CurrencyQueryOptions & TimeWindowQueryOptions): UseAsyncTask<ActivitiesRequest, PaginatedActivitiesResult, UnexpectedError>;
2766
+ declare function useUpdateUserPositionConditions(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<UpdateUserPositionConditionsRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2767
+
2749
2768
  /**
2750
- * A hook that provides a way to claim rewards.
2769
+ * A hook that provides a way to withdraw supplied assets from an Aave reserve.
2751
2770
  *
2752
2771
  * ```ts
2753
2772
  * const [sendTransaction] = useSendTransaction(wallet);
2754
- * const [claim, { loading, error }] = useClaimRewards((transaction, { cancel }) => {
2755
- * return sendTransaction(transaction);
2773
+ * const [withdraw, { loading, error }] = useWithdraw((plan, { cancel }) => {
2774
+ * switch (plan.__typename) {
2775
+ * case 'TransactionRequest':
2776
+ * return sendTransaction(plan);
2777
+ *
2778
+ * case 'PreContractActionRequired':
2779
+ * return sendTransaction(plan.transaction);
2780
+ * }
2756
2781
  * });
2757
2782
  *
2758
2783
  * // …
2759
2784
  *
2760
- * const result = await claim({
2761
- * ids: [rewardId('abc123')],
2762
- * });
2785
+ * const result = await withdraw({ ... });
2763
2786
  *
2764
2787
  * if (result.isErr()) {
2765
2788
  * switch (result.error.name) {
@@ -2779,6 +2802,10 @@ declare function useActivitiesAction(options?: CurrencyQueryOptions & TimeWindow
2779
2802
  * console.error(`Transaction failed: ${result.error.message}`);
2780
2803
  * break;
2781
2804
  *
2805
+ * case 'ValidationError':
2806
+ * console.error(`Insufficient balance: ${result.error.cause.required.value} required.`);
2807
+ * break;
2808
+ *
2782
2809
  * case 'UnexpectedError':
2783
2810
  * console.error(result.error.message);
2784
2811
  * break;
@@ -2789,9 +2816,9 @@ declare function useActivitiesAction(options?: CurrencyQueryOptions & TimeWindow
2789
2816
  * console.log('Transaction sent with hash:', result.value.txHash);
2790
2817
  * ```
2791
2818
  *
2792
- * @param handler - The handler that will be used to handle the transaction.
2819
+ * @param handler - The handler that will be used to handle the transactions.
2793
2820
  */
2794
- declare function useClaimRewards(handler: ExecutionPlanHandler<TransactionRequest, PendingTransaction>): UseAsyncTask<ClaimRewardsRequest, TransactionReceipt, SendTransactionError | PendingTransactionError>;
2821
+ declare function useWithdraw(handler: ExecutionPlanHandler<TransactionRequest | PreContractActionRequired, PendingTransaction>): UseAsyncTask<WithdrawRequest, TransactionReceipt, SendTransactionError | PendingTransactionError | ValidationError<InsufficientBalanceError>>;
2795
2822
 
2796
2823
  type UseUserSuppliesArgs = Prettify<UserSuppliesRequest & CurrencyQueryOptions & TimeWindowQueryOptions>;
2797
2824
  /**