@aave/client 0.7.0 → 4.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +35 -27
  2. package/dist/{AaveClient-C-OkXfVz.d.ts → AaveClient-CgHY2iS9.d.ts} +12 -15
  3. package/dist/{AaveClient-PHUEzt7l.d.cts → AaveClient-L3v8kWvn.d.cts} +12 -15
  4. package/dist/actions/index.cjs +1 -1
  5. package/dist/actions/index.cjs.map +1 -1
  6. package/dist/actions/index.d.cts +626 -710
  7. package/dist/actions/index.d.ts +626 -710
  8. package/dist/actions/index.js +1 -1
  9. package/dist/chunk-2TNQ52OQ.js +3 -0
  10. package/dist/chunk-2TNQ52OQ.js.map +1 -0
  11. package/dist/chunk-BQFM5RT3.js +2 -0
  12. package/dist/chunk-BQFM5RT3.js.map +1 -0
  13. package/dist/chunk-BQNVAUS6.js +3 -0
  14. package/dist/chunk-BQNVAUS6.js.map +1 -0
  15. package/dist/ethers.cjs +1 -1
  16. package/dist/ethers.cjs.map +1 -1
  17. package/dist/ethers.d.cts +28 -12
  18. package/dist/ethers.d.ts +28 -12
  19. package/dist/ethers.js +1 -1
  20. package/dist/ethers.js.map +1 -1
  21. package/dist/index.cjs +2 -2
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +3 -2
  24. package/dist/index.d.ts +3 -2
  25. package/dist/index.js +1 -1
  26. package/dist/options-vB2peXdE.d.cts +35 -0
  27. package/dist/options-vB2peXdE.d.ts +35 -0
  28. package/dist/privy.cjs +2 -2
  29. package/dist/privy.cjs.map +1 -1
  30. package/dist/privy.d.cts +21 -9
  31. package/dist/privy.d.ts +21 -9
  32. package/dist/privy.js +1 -1
  33. package/dist/privy.js.map +1 -1
  34. package/dist/test-utils.cjs +2 -449
  35. package/dist/test-utils.cjs.map +1 -1
  36. package/dist/test-utils.d.cts +28 -20
  37. package/dist/test-utils.d.ts +28 -20
  38. package/dist/test-utils.js +2 -437
  39. package/dist/test-utils.js.map +1 -1
  40. package/dist/thirdweb.cjs +2 -2
  41. package/dist/thirdweb.cjs.map +1 -1
  42. package/dist/thirdweb.d.cts +21 -9
  43. package/dist/thirdweb.d.ts +21 -9
  44. package/dist/thirdweb.js +2 -2
  45. package/dist/thirdweb.js.map +1 -1
  46. package/dist/types-Bu63z0x6.d.cts +21 -0
  47. package/dist/types-Bu63z0x6.d.ts +21 -0
  48. package/dist/utils/index.cjs +2 -0
  49. package/dist/utils/index.cjs.map +1 -0
  50. package/dist/utils/index.d.cts +18 -0
  51. package/dist/utils/index.d.ts +18 -0
  52. package/dist/utils/index.js +2 -0
  53. package/dist/utils/index.js.map +1 -0
  54. package/dist/viem.cjs +2 -2
  55. package/dist/viem.cjs.map +1 -1
  56. package/dist/viem.d.cts +32 -12
  57. package/dist/viem.d.ts +32 -12
  58. package/dist/viem.js +1 -1
  59. package/package.json +32 -8
  60. package/dist/chunk-BLZHGYNH.js +0 -2
  61. package/dist/chunk-BLZHGYNH.js.map +0 -1
  62. package/dist/chunk-FW4363Y4.js +0 -2
  63. package/dist/chunk-FW4363Y4.js.map +0 -1
  64. package/dist/chunk-QQSK6HIZ.js +0 -3
  65. package/dist/chunk-QQSK6HIZ.js.map +0 -1
  66. package/dist/chunk-V4DWF6LT.js +0 -3
  67. package/dist/chunk-V4DWF6LT.js.map +0 -1
  68. package/dist/magic-string.es-PTUXR566.js +0 -14
  69. package/dist/magic-string.es-PTUXR566.js.map +0 -1
  70. package/dist/types-ieyj0UmJ.d.cts +0 -16
  71. package/dist/types-ieyj0UmJ.d.ts +0 -16
@@ -1,412 +1,576 @@
1
- import * as _aave_core from '@aave/core';
2
- import { UnexpectedError } from '@aave/core';
3
- import * as _aave_graphql from '@aave/graphql';
4
- import { SavingsGhoBalanceRequest, TokenAmount, SavingsGhoWithdrawRequest, ExecutionPlan, SavingsGhoDepositRequest, UserMeritRewardsRequest, MarketReservesRequestOrderBy, Market, UserMarketStateRequest, MarketUserState, ChainsFilter, Chain, UsdExchangeRatesRequest, UsdExchangeRate, HasProcessedKnownTransactionRequest, HealthFactorPreviewRequest, HealthFactorPreviewResponse, PermitTypedDataRequest, PermitTypedDataResponse, ReserveRequest, Reserve, BorrowAPYHistoryRequest, APYSample, SupplyAPYHistoryRequest, BorrowRequest, SupplyRequest, RepayRequest, WithdrawRequest, UserSetEmodeRequest, TransactionRequest, VaultDepositRequest, VaultRedeemSharesRequest, VaultDeployRequest, VaultSetFeeRequest, VaultWithdrawFeesRequest, VaultWithdrawRequest, VaultMintSharesRequest, CollateralToggleRequest, LiquidateRequest, ApproveBorrowCreditDelegatorRequest, CreditDelegateeAmountRequest, UserSuppliesRequest, MarketUserReserveSupplyPosition, UserBorrowsRequest, MarketUserReserveBorrowPosition, UserTransactionHistoryRequest, PaginatedUserTransactionHistoryResult, VaultRequest, Vault, VaultsRequest, PaginatedVaultsResult, UserVaultsRequest, VaultPreviewDepositRequest, VaultPreviewMintRequest, VaultPreviewWithdrawRequest, VaultPreviewRedeemRequest, VaultUserTransactionHistoryRequest, PaginatedVaultUserTransactionHistoryResult, VaultUserActivityRequest, VaultUserActivityResult, VaultTransferOwnershipRequest, VaultCreateRecipientsConfigurationRequest, VaultRecipientConfigurationRequest, VaultFeesRecipientsConfiguration, VaultSetRecipientsConfigurationRequest } from '@aave/graphql';
5
- import * as _aave_types from '@aave/types';
6
- import { ResultAsync, ChainId, EvmAddress } from '@aave/types';
7
- import { A as AaveClient } from '../AaveClient-C-OkXfVz.js';
1
+ import { UnexpectedError, TimeoutError } from '@aave/core';
2
+ import { HubRequest, Hub, HubsRequest, HubAssetsRequest, HubAsset, ChainRequest, Chain, ChainsFilter, HasProcessedKnownTransactionRequest, ExchangeRateRequest, FiatAmount, PermitRequest, PermitTypedDataResponse, AssetRequest, Asset, AssetPriceHistoryRequest, AssetPriceSample, AssetSupplyHistoryRequest, AssetSupplySample, AssetBorrowHistoryRequest, AssetBorrowSample, ReserveRequest, Reserve, ReservesRequest, BorrowAPYHistoryRequest, APYSample, SupplyAPYHistoryRequest, SpokeRequest, Spoke, SpokesRequest, SpokePositionManagersRequest, PaginatedSpokePositionManagerResult, SpokeUserPositionManagersRequest, PaginatedSpokeUserPositionManagerResult, SwapQuoteRequest, SwapQuote, SwappableTokensRequest, Token, PrepareSwapRequest, PrepareSwapResult, SwapStatusRequest, SwapStatus, SwapCancelled, SwapExpired, SwapFulfilled, SwapReceipt, SwapRequest, SwapExecutionPlan, PrepareSwapCancelRequest, PrepareSwapCancelResult, CancelSwapRequest, CancelSwapExecutionPlan, UserSwapsRequest, PaginatedUserSwapsResult, BorrowRequest, ExecutionPlan, SupplyRequest, RepayRequest, WithdrawRequest, RenounceSpokeUserPositionManagerRequest, TransactionRequest, UpdateUserDynamicConfigRequest, UpdateUserRiskPremiumRequest, LiquidatePositionRequest, SetSpokeUserPositionManagerRequest, PreviewRequest, PreviewUserPosition, SetUserSupplyAsCollateralRequest, ActivitiesRequest, PaginatedActivitiesResult, UserSuppliesRequest, UserSupplyItem, UserBorrowsRequest, UserBorrowItem, UserSummaryRequest, UserSummary, UserPositionsRequest, UserPosition, UserPositionRequest, UserBalancesRequest, UserBalance, UserSummaryHistoryRequest, UserSummaryHistoryItem } from '@aave/graphql';
3
+ import { ResultAsync, Prettify } from '@aave/types';
4
+ import { A as AaveClient } from '../AaveClient-CgHY2iS9.js';
5
+ import { C as CurrencyQueryOptions, R as RequestPolicyOptions, T as TimeWindowQueryOptions } from '../options-vB2peXdE.js';
8
6
  import '@urql/core';
9
- import '../types-ieyj0UmJ.js';
7
+ import '../types-Bu63z0x6.js';
10
8
 
11
9
  /**
12
- * Fetches the current sGHO balance for a user.
10
+ * Fetches a specific hub by ID or by address and chain ID.
13
11
  *
14
12
  * ```ts
15
- * const result = await savingsGhoBalance(client, {
16
- * user: evmAddress('0x742d35cc…'),
13
+ * const result = await hub(client, {
14
+ * query: { hubId: hubId('SGVsbG8h') }
17
15
  * });
18
16
  * ```
19
17
  *
20
18
  * @param client - Aave client.
21
- * @param request - The sGHO balance request parameters.
22
- * @returns The user's sGHO balance.
19
+ * @param request - The hub request parameters.
20
+ * @param options - The query options.
21
+ * @returns The hub data, or null if not found.
23
22
  */
24
- declare function savingsGhoBalance(client: AaveClient, request: SavingsGhoBalanceRequest): ResultAsync<TokenAmount, UnexpectedError>;
23
+ declare function hub(client: AaveClient, request: HubRequest, options?: CurrencyQueryOptions & RequestPolicyOptions): ResultAsync<Hub | null, UnexpectedError>;
25
24
  /**
26
- * Creates a transaction to withdraw sGHO.
25
+ * Fetches multiple hubs based on specified criteria.
27
26
  *
28
27
  * ```ts
29
- * const result = await savingsGhoWithdraw(client, {
30
- * amount: {
31
- * exact: '1000',
32
- * },
33
- * sharesOwner: evmAddress('0x9abc…'),
34
- * }).andThen(sendWith(wallet))
28
+ * const result = await hubs(client, {
29
+ * query: {
30
+ * chainIds: [chainId(1)]
31
+ * }
32
+ * });
33
+ * ```
35
34
  *
36
- * if (result.isErr()) {
37
- * // Handle error, e.g. signing error, etc.
38
- * return;
39
- * }
35
+ * @param client - Aave client.
36
+ * @param request - The hubs request parameters (either tokens or chainIds).
37
+ * @param options - The query options.
38
+ * @returns Array of hub data.
39
+ */
40
+ declare function hubs(client: AaveClient, request: HubsRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<Hub[], UnexpectedError>;
41
+ /**
42
+ * Fetches hub assets for a specific hub by ID or by address and chain ID.
40
43
  *
41
- * // result.value: TxHash
44
+ * ```ts
45
+ * const result = await hubAssets(client, {
46
+ * query: { hubId: hubId('SGVsbG8h') },
47
+ * });
42
48
  * ```
43
49
  *
44
50
  * @param client - Aave client.
45
- * @param request - The sGHO withdraw request parameters.
46
- * @returns The transaction request data to withdraw sGHO.
51
+ * @param request - The hub assets request parameters.
52
+ * @param options - The query options.
53
+ * @returns The hub assets array.
47
54
  */
48
- declare function savingsGhoWithdraw(client: AaveClient, request: SavingsGhoWithdrawRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
55
+ declare function hubAssets(client: AaveClient, request: HubAssetsRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<HubAsset[], UnexpectedError>;
56
+
49
57
  /**
50
- * Creates a transaction to deposit GHO into sGHO.
58
+ * Fetches a specific chain by chain ID.
51
59
  *
52
60
  * ```ts
53
- * const result = await savingsGhoDeposit(client, {
54
- * amount: {
55
- * value: '1000',
56
- * },
57
- * depositor: evmAddress('0x9abc…'),
58
- * }).andThen(sendWith(wallet))
61
+ * const result = await chain(client, {
62
+ * chainId: chainId(1),
63
+ * });
64
+ * ```
59
65
  *
60
- * if (result.isErr()) {
61
- * // Handle error, e.g. insufficient balance, signing error, etc.
62
- * return;
63
- * }
66
+ * @param client - Aave client.
67
+ * @param request - The chain request parameters.
68
+ * @returns The chain data, or null if not found.
69
+ */
70
+ declare function chain(client: AaveClient, request: ChainRequest): ResultAsync<Chain | null, UnexpectedError>;
71
+ /**
72
+ * Fetches the list of supported chains.
64
73
  *
65
- * // result.value: TxHash
74
+ * ```ts
75
+ * const chains = await chains(client, { filter: ChainsFilter.ALL });
66
76
  * ```
67
77
  *
68
78
  * @param client - Aave client.
69
- * @param request - The sGHO deposit request parameters.
70
- * @returns The transaction data, approval requirements, or insufficient balance error.
79
+ * @param filter - The filter for chains.
80
+ * @returns Array of supported chains.
81
+ */
82
+ declare function chains(client: AaveClient, filter?: ChainsFilter): ResultAsync<Chain[], UnexpectedError>;
83
+ /**
84
+ * Check if a transaction has been processed by the Aave API.
85
+ *
86
+ * @param client - Aave client.
87
+ * @param request - The request containing transaction hash and operations to check.
88
+ * @returns True if the transaction has been processed, false otherwise.
89
+ */
90
+ declare function hasProcessedKnownTransaction(client: AaveClient, request: HasProcessedKnownTransactionRequest): ResultAsync<boolean, UnexpectedError>;
91
+ /**
92
+ * Fetches the exchange rate between tokens and fiat currencies.
93
+ *
94
+ * ```ts
95
+ * const result = await exchangeRate(client, {
96
+ * from: { erc20: { chainId: chainId(1), address: evmAddress('0xA0b86a33E6...') } },
97
+ * to: Currency.Usd,
98
+ * });
99
+ * ```
100
+ *
101
+ * @param client - Aave client.
102
+ * @param request - The exchange rate request parameters.
103
+ * @returns The exchange rate information as a fiat amount.
71
104
  */
72
- declare function savingsGhoDeposit(client: AaveClient, request: SavingsGhoDepositRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
105
+ declare function exchangeRate(client: AaveClient, request: ExchangeRateRequest): ResultAsync<FiatAmount, UnexpectedError>;
73
106
 
74
107
  /**
75
- * Fetches Merit rewards for a user with the transaction request to claim them.
108
+ * Generates EIP-712 typed data for permit signatures.
76
109
  *
77
110
  * ```ts
78
- * const result = await userMeritRewards(client, {
79
- * user: evmAddress('0x742d35cc…'),
80
- * chainId: chainId(1),
111
+ * const result = await permitTypedData(client, {
112
+ * spender: evmAddress('0x87870bca…'),
113
+ * currency: evmAddress('0xa0b86991c431c924b2047c7094daf21b77e…'),
114
+ * amount: '1000.5',
81
115
  * });
116
+ *
117
+ * if (result.isOk()) {
118
+ * // Use the typed data to create a signature
119
+ * const signature = await wallet.signTypedData(result.value);
120
+ * }
82
121
  * ```
83
122
  *
84
123
  * @param client - Aave client.
85
- * @param request - The merit claim rewards request parameters.
86
- * @returns The rewards with the transaction request.
124
+ * @param request - The permit request parameters.
125
+ * @returns The EIP-712 typed data for permit signature.
87
126
  */
88
- declare function userMeritRewards(client: AaveClient, request: UserMeritRewardsRequest): _aave_types.ResultAsync<{
89
- __typename: "UserMeritRewards";
90
- chain: _aave_types.ChainId;
91
- claimable: {
92
- __typename: "ClaimableMeritReward";
93
- amount: {
94
- __typename: "TokenAmount";
95
- usdPerToken: _aave_types.BigDecimal;
96
- amount: {
97
- __typename: "DecimalValue";
98
- raw: _aave_types.BigIntString;
99
- decimals: number;
100
- value: _aave_types.BigDecimal;
101
- };
102
- usd: _aave_types.BigDecimal;
103
- };
104
- currency: {
105
- __typename: "Currency";
106
- address: _aave_types.EvmAddress;
107
- imageUrl: string;
108
- name: string;
109
- symbol: string;
110
- decimals: number;
111
- chainId: _aave_types.ChainId;
112
- };
113
- }[];
114
- transaction: {
115
- __typename: "TransactionRequest";
116
- to: _aave_types.EvmAddress;
117
- from: _aave_types.EvmAddress;
118
- data: _aave_types.BlockchainData;
119
- value: _aave_types.BigIntString;
120
- chainId: _aave_types.ChainId;
121
- operation: _aave_graphql.OperationType | null;
122
- };
123
- } | null, _aave_core.UnexpectedError>;
127
+ declare function permitTypedData(client: AaveClient, request: PermitRequest): ResultAsync<PermitTypedDataResponse, UnexpectedError>;
124
128
 
125
- declare const defaultMarketReservesRequestOrderBy: MarketReservesRequestOrderBy;
126
- type MarketsRequest = {
127
- /**
128
- * The markets you want to see based on the chain ids.
129
- */
130
- chainIds: ChainId[];
131
- /**
132
- * The user viewing the market (e.g., the connected wallet).
133
- *
134
- * If not provided, user fields will not be included.
135
- */
136
- user?: EvmAddress;
137
- /**
138
- * The order by clause for the borrow reserves in the market.
139
- *
140
- * @defaultValue { tokenName: OrderDirection.Asc }
141
- */
142
- borrowsOrderBy?: MarketReservesRequestOrderBy;
143
- /**
144
- * The order by clause for the supply reserves in the market.
145
- *
146
- * @defaultValue { tokenName: OrderDirection.Asc }
147
- */
148
- suppliesOrderBy?: MarketReservesRequestOrderBy;
149
- };
150
129
  /**
151
- * Fetches all markets for the specified chain IDs.
130
+ * Fetches information about a specific asset (ERC20 token) in the protocol by ID or by token.
152
131
  *
153
132
  * ```ts
154
- * const result = await markets(client, {
155
- * chainIds: [chainId(1), chainId(8453)],
133
+ * const result = await asset(client, {
134
+ * query: { assetId: assetId('SGVsbG8h') }
156
135
  * });
157
136
  * ```
158
137
  *
159
138
  * @param client - Aave client.
160
- * @param request - The markets request parameters.
161
- * @returns The list of markets.
139
+ * @param request - The asset request parameters.
140
+ * @param options - The query options including currency and time window.
141
+ * @returns The asset data, or null if not found.
162
142
  */
163
- declare function markets(client: AaveClient, { chainIds, borrowsOrderBy, suppliesOrderBy, user, }: MarketsRequest): ResultAsync<Market[], UnexpectedError>;
164
- type MarketRequest = {
165
- /**
166
- * The pool address for the market.
167
- */
168
- address: EvmAddress;
169
- /**
170
- * The chain id the market pool address is deployed on.
171
- */
172
- chainId: ChainId;
173
- /**
174
- * The user viewing the market (e.g., the connected wallet).
175
- *
176
- * If not provided, user fields will not be included.
177
- */
178
- user?: EvmAddress;
179
- /**
180
- * The order by clause for the borrow reserves in the market.
181
- *
182
- * @defaultValue { tokenName: OrderDirection.Asc }
183
- */
184
- borrowsOrderBy?: MarketReservesRequestOrderBy;
185
- /**
186
- * The order by clause for the supply reserves in the market.
187
- *
188
- * @defaultValue { tokenName: OrderDirection.Asc }
189
- */
190
- suppliesOrderBy?: MarketReservesRequestOrderBy;
191
- };
143
+ declare function asset(client: AaveClient, request: AssetRequest, options?: CurrencyQueryOptions & TimeWindowQueryOptions & RequestPolicyOptions): ResultAsync<Asset | null, UnexpectedError>;
192
144
  /**
193
- * Fetches a specific market by address and chain ID.
145
+ * Fetches historical price data for a specific asset.
194
146
  *
195
147
  * ```ts
196
- * const result = await market(client, {
197
- * address: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
198
- * chainId: chainId(1),
148
+ * const result = await assetPriceHistory(client, {
149
+ * token: { chainId: chainId(1), address: evmAddress('0x123…') },
150
+ * currency: Currency.Usd,
151
+ * window: TimeWindow.LastWeek,
199
152
  * });
200
153
  * ```
201
154
  *
202
155
  * @param client - Aave client.
203
- * @param request - The market request parameters.
204
- * @returns The market data, or null if not found.
156
+ * @param request - The asset price history request parameters.
157
+ * @param options - The query options.
158
+ * @returns Array of asset price samples over time.
205
159
  */
206
- declare function market(client: AaveClient, { address, chainId, user, borrowsOrderBy, suppliesOrderBy, }: MarketRequest): ResultAsync<Market | null, UnexpectedError>;
160
+ declare function assetPriceHistory(client: AaveClient, request: AssetPriceHistoryRequest, options?: Required<RequestPolicyOptions>): ResultAsync<AssetPriceSample[], UnexpectedError>;
207
161
  /**
208
- * Fetches user account market data across all reserves.
162
+ * Fetches historical supply data for a specific asset.
209
163
  *
210
164
  * ```ts
211
- * const result = await userMarketState(client, {
212
- * market: evmAddress('0x1234…'),
213
- * user: evmAddress('0x5678…'),
214
- * chainId: chainId(1)
165
+ * const result = await assetSupplyHistory(client, {
166
+ * token: { chainId: chainId(1), address: evmAddress('0x123…') },
167
+ * window: TimeWindow.LastWeek,
215
168
  * });
216
169
  * ```
217
170
  *
218
171
  * @param client - Aave client.
219
- * @param request - The user market state request parameters.
220
- * @returns The user's market state.
172
+ * @param request - The asset supply history request parameters.
173
+ * @param options - The query options.
174
+ * @returns Array of asset supply samples over time.
221
175
  */
222
- declare function userMarketState(client: AaveClient, request: UserMarketStateRequest): ResultAsync<MarketUserState, UnexpectedError>;
176
+ declare function assetSupplyHistory(client: AaveClient, request: AssetSupplyHistoryRequest, options?: Required<RequestPolicyOptions>): ResultAsync<AssetSupplySample[], UnexpectedError>;
177
+ /**
178
+ * Fetches historical borrow data for a specific asset.
179
+ *
180
+ * ```ts
181
+ * const result = await assetBorrowHistory(client, {
182
+ * token: { chainId: chainId(1), address: evmAddress('0x123…') },
183
+ * window: TimeWindow.LastWeek,
184
+ * });
185
+ * ```
186
+ *
187
+ * @param client - Aave client.
188
+ * @param request - The asset borrow history request parameters.
189
+ * @param options - The query options.
190
+ * @returns Array of asset borrow samples over time.
191
+ */
192
+ declare function assetBorrowHistory(client: AaveClient, request: AssetBorrowHistoryRequest, options?: Required<RequestPolicyOptions>): ResultAsync<AssetBorrowSample[], UnexpectedError>;
223
193
 
224
194
  /**
225
- * Health check query.
195
+ * Fetches a specific reserve by reserve ID, spoke, and chain.
226
196
  *
227
197
  * ```ts
228
- * const result = await health(client);
198
+ * const result = await reserve(client, {
199
+ * reserve: reserveId('SGVsbG8h'),
200
+ * user: evmAddress('0x742d35cc…'),
201
+ * });
229
202
  * ```
230
203
  *
231
204
  * @param client - Aave client.
232
- * @returns True or false
205
+ * @param request - The reserve request parameters.
206
+ * @param options - The query options.
207
+ * @returns The reserve data, or null if not found.
233
208
  */
234
- declare function health(client: AaveClient): ResultAsync<boolean, UnexpectedError>;
209
+ declare function reserve(client: AaveClient, request: ReserveRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<Reserve | null, UnexpectedError>;
235
210
  /**
236
- * Fetches the list of supported chains.
211
+ * Fetches reserves based on specified criteria.
237
212
  *
238
213
  * ```ts
239
- * const result = await chains(client, ChainsFilter.MAINNET_ONLY);
214
+ * const result = await reserves(client, {
215
+ * query: {
216
+ * spoke: {
217
+ * address: evmAddress('0x123...'),
218
+ * chainId: chainId(1)
219
+ * }
220
+ * },
221
+ * filter: ReservesRequestFilter.All,
222
+ * orderBy: { name: 'ASC' }
223
+ * });
240
224
  * ```
241
225
  *
242
226
  * @param client - Aave client.
243
- * @param filter - The filter for the chains.
244
- * @returns The list of supported chains.
227
+ * @param request - The reserves request parameters.
228
+ * @param options - The query options.
229
+ * @returns Array of reserves matching the criteria.
245
230
  */
246
- declare function chains(client: AaveClient, filter?: ChainsFilter): ResultAsync<Chain[], UnexpectedError>;
231
+ declare function reserves(client: AaveClient, request: ReservesRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<Reserve[], UnexpectedError>;
247
232
  /**
248
- * Fetches USD exchange rates for different tokens on a given market.
233
+ * Fetches borrow APY history for a specific reserve over time.
249
234
  *
250
235
  * ```ts
251
- * const result = await usdExchangeRates(client, {
252
- * market: evmAddress('0x1234…'),
253
- * underlyingTokens: [evmAddress('0x5678…'), evmAddress('0x90ab…')],
254
- * chainId: chainId(1),
236
+ * const result = await borrowApyHistory(client, {
237
+ * reserve: reserveId('SGVsbG8h'),
238
+ * window: TimeWindow.LastWeek
255
239
  * });
256
240
  * ```
257
241
  *
258
242
  * @param client - Aave client.
259
- * @param request - The USD exchange rates request parameters.
260
- * @returns The list of USD exchange rates.
243
+ * @param request - The borrow APY history request parameters.
244
+ * @returns The borrow APY history samples.
261
245
  */
262
- declare function usdExchangeRates(client: AaveClient, request: UsdExchangeRatesRequest): ResultAsync<UsdExchangeRate[], UnexpectedError>;
246
+ declare function borrowApyHistory(client: AaveClient, request: BorrowAPYHistoryRequest): ResultAsync<APYSample[], UnexpectedError>;
263
247
  /**
264
- * Checks if the API has processed a known transaction hash.
248
+ * Fetches supply APY history for a specific reserve over time.
249
+ *
250
+ * ```ts
251
+ * const result = await supplyApyHistory(client, {
252
+ * reserve: reserveId('SGVsbG8h'),
253
+ * window: TimeWindow.LastWeek
254
+ * });
255
+ * ```
265
256
  *
266
- * This is useful to know when cached data has been invalidated after
267
- * a transaction is complete, as the API uses caching and has an
268
- * invalidation task that may take 100-200ms longer.
257
+ * @param client - Aave client.
258
+ * @param request - The supply APY history request parameters.
259
+ * @returns The supply APY history samples.
260
+ */
261
+ declare function supplyApyHistory(client: AaveClient, request: SupplyAPYHistoryRequest): ResultAsync<APYSample[], UnexpectedError>;
262
+
263
+ /**
264
+ * Fetches a specific spoke.
269
265
  *
270
266
  * ```ts
271
- * const result = await borrow(client, request)
272
- * .andThen(sendWith(wallet))
273
- * .andThen(client.waitForTransaction);
267
+ * const result = await spoke(client, {
268
+ * query: { spokeId: spokeId('SGVsbG8h') }
269
+ * });
270
+ * ```
274
271
  *
275
- * if (result.isErr()) {
276
- * // Handle error
277
- * return;
278
- * }
272
+ * @param client - Aave client.
273
+ * @param request - The spoke request parameters.
274
+ * @returns The spoke data, or null if not found.
275
+ */
276
+ declare function spoke(client: AaveClient, request: SpokeRequest): ResultAsync<Spoke | null, UnexpectedError>;
277
+ /**
278
+ * Fetches spokes based on specified criteria.
279
279
  *
280
- * // Check if the transaction has been processed by the API
281
- * const processed = await hasProcessedKnownTransaction(client, {
282
- * txHash: result.value,
283
- * operation: OperationType.Borrow
280
+ * ```ts
281
+ * const result = await spokes(client, {
282
+ * query: { chainIds: [chainId(1)] }
284
283
  * });
284
+ * ```
285
285
  *
286
- * if (processed.isErr()) {
287
- * // Handle error
288
- * return;
289
- * }
286
+ * @param client - Aave client.
287
+ * @param request - The spokes request parameters.
288
+ * @returns Array of spokes matching the criteria.
289
+ */
290
+ declare function spokes(client: AaveClient, request: SpokesRequest): ResultAsync<Spoke[], UnexpectedError>;
291
+ /**
292
+ * Fetches all positions manager for a specific spoke.
290
293
  *
291
- * if (processed.value) {
292
- * // Transaction processed, cached data is up to date
293
- * console.log('Transaction processed, data is fresh');
294
- * } else {
295
- * // Transaction not yet processed, may need to wait
296
- * console.log('Transaction not yet processed');
297
- * }
294
+ * ```ts
295
+ * const result = await spokePositionManagers(client, {
296
+ * spoke: spokeId('SGVsbG8h'),
297
+ * });
298
298
  * ```
299
299
  *
300
300
  * @param client - Aave client.
301
- * @param request - The request containing transaction hash and operation type to check.
302
- * @returns True if the transaction has been processed, false otherwise.
301
+ * @param request - The spokes request parameters.
302
+ * @returns Array of spokes matching the criteria.
303
303
  */
304
- declare function hasProcessedKnownTransaction(client: AaveClient, request: HasProcessedKnownTransactionRequest): ResultAsync<boolean, UnexpectedError>;
304
+ declare function spokePositionManagers(client: AaveClient, request: SpokePositionManagersRequest): ResultAsync<PaginatedSpokePositionManagerResult, UnexpectedError>;
305
305
  /**
306
- * Fetches health factor preview for a given market action.
306
+ * Fetches all the positions managers of a user for a specific spoke.
307
307
  *
308
308
  * ```ts
309
- * const result = await healthFactorPreview(client, {
310
- * action: {
311
- * borrow: {
312
- * market: market.address,
313
- * amount: {
314
- * erc20: {
315
- * currency: evmAddress('0x5678…'),
316
- * value: '1000',
317
- * },
318
- * },
319
- * borrower: evmAddress('0x9abc…'),
320
- * chainId: market.chain.chainId,
321
- * },
322
- * },
309
+ * const result = await spokeUserPositionManagers(client, {
310
+ * spoke: spokeId('SGVsbG8h'),
311
+ * user: evmAddress('0x123...'),
323
312
  * });
324
313
  * ```
325
314
  *
326
315
  * @param client - Aave client.
327
- * @param request - The health factor preview request parameters.
328
- * @returns The health factor preview response with before and after values.
316
+ * @param request - The spokes and pagination request parameters.
317
+ * @returns Array of position managers of a user for a specific spoke.
329
318
  */
330
- declare function healthFactorPreview(client: AaveClient, request: HealthFactorPreviewRequest): ResultAsync<HealthFactorPreviewResponse, UnexpectedError>;
319
+ declare function spokeUserPositionManagers(client: AaveClient, request: SpokeUserPositionManagersRequest): ResultAsync<PaginatedSpokeUserPositionManagerResult, UnexpectedError>;
331
320
 
332
321
  /**
333
- * Generates EIP-712 typed data for ERC-20 permit signature.
322
+ * @internal
323
+ * Fetches a swap quote for the specified trade parameters.
334
324
  *
335
325
  * ```ts
336
- * const result = await permitTypedData(client, {
337
- * market: evmAddress('0x87870bca...'),
338
- * underlyingToken: evmAddress('0xa0b86a33...'),
339
- * amount: '1.5',
326
+ * const result = await swapQuote(client, {
340
327
  * chainId: chainId(1),
341
- * spender: evmAddress('0x123...'),
342
- * owner: evmAddress('0x456...'),
328
+ * buy: { erc20: evmAddress('0xA0b86a33E6...') },
329
+ * sell: { erc20: evmAddress('0x6B175474E...') },
330
+ * amount: bigDecimal('1000'),
331
+ * kind: SwapKind.SELL,
332
+ * from: evmAddress('0x742d35cc...'),
333
+ * });
334
+ * ```
335
+ *
336
+ * @param client - Aave client.
337
+ * @param request - The swap quote request parameters.
338
+ * @param options - The query options.
339
+ * @returns The swap quote including pricing and cost information.
340
+ */
341
+ declare function swapQuote(client: AaveClient, request: SwapQuoteRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<SwapQuote, UnexpectedError>;
342
+ /**
343
+ * @internal
344
+ * Fetches the list of tokens available for swapping on a specific chain.
345
+ *
346
+ * ```ts
347
+ * const result = await swappableTokens(client, {
348
+ * query: { chainIds: [chainId(1)] },
349
+ * });
350
+ * ```
351
+ *
352
+ * @param client - Aave client.
353
+ * @param request - The swappable tokens request parameters.
354
+ * @returns The list of tokens available for swapping.
355
+ */
356
+ declare function swappableTokens(client: AaveClient, request: SwappableTokensRequest): ResultAsync<Token[], UnexpectedError>;
357
+ /**
358
+ * @internal
359
+ * Prepares a swap for the specified trade parameters.
360
+ *
361
+ * ```ts
362
+ * const result = await prepareSwap(client, {
363
+ * market: {
364
+ * chainId: chainId(1),
365
+ * buy: { erc20: evmAddress('0xA0b86a33E6...') },
366
+ * sell: { erc20: evmAddress('0x6B175474E...') },
367
+ * amount: bigDecimal('1000'),
368
+ * kind: SwapKind.SELL,
369
+ * user: evmAddress('0x742d35cc...'),
370
+ * },
371
+ * }).andThen(plan => {
372
+ * switch (plan.__typename) {
373
+ * case 'SwapByIntent':
374
+ * return signSwapByIntentWith(plan.data)
375
+ * .andThen((signature) => swap({ intent: { quoteId: quote.quoteId, signature } }))
376
+ * .andThen((plan) => {
377
+ * // …
378
+ * });
379
+ * );
380
+ *
381
+ * case 'SwapByIntentWithApprovalRequired':
382
+ * return sendTransaction(plan.transaction)
383
+ * .andThen(signSwapByIntentWith(plan.data))
384
+ * .andThen((signature) => swap({ intent: { quoteId: quote.quoteId, signature } }))
385
+ * .andThen((plan) => {
386
+ * // …
387
+ * });
388
+ * );
389
+ *
390
+ * case 'SwapByTransaction':
391
+ * return swap({ transaction: { quoteId: quote.quoteId } })
392
+ * .andThen((plan) => {
393
+ * // …
394
+ * });
395
+ * );
396
+ *
397
+ * case 'InsufficientBalanceError':
398
+ * return errAsync(new Error(`Insufficient balance: ${plan.required.value} required.`));
399
+ * }
400
+ * });
401
+ * ```
402
+ *
403
+ * @param client - Aave client.
404
+ * @param request - The prepare swap request parameters.
405
+ * @param options - The query options.
406
+ * @returns The prepared swap result containing details of the swap.
407
+ */
408
+ declare function prepareSwap(client: AaveClient, request: PrepareSwapRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<PrepareSwapResult, UnexpectedError>;
409
+ /**
410
+ * @internal
411
+ * Fetches the status of a specific swap.
412
+ *
413
+ * ```ts
414
+ * const result = await swapStatus(client, {
415
+ * id: swapId('swap_123'),
343
416
  * });
417
+ * ```
418
+ *
419
+ * @param client - Aave client.
420
+ * @param request - The swap status request parameters.
421
+ * @param options - The query options.
422
+ * @returns The current status of the swap.
423
+ */
424
+ declare function swapStatus(client: AaveClient, request: SwapStatusRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<SwapStatus, UnexpectedError>;
425
+ type SwapOutcome = SwapCancelled | SwapExpired | SwapFulfilled;
426
+ /**
427
+ * @internal
428
+ * Waits for a swap to reach a final outcome (cancelled, expired, or fulfilled).
429
+ *
430
+ * ```ts
431
+ * const result = waitForSwapOutcome(client)(swapReceipt);
344
432
  *
345
433
  * if (result.isOk()) {
346
- * const typedData = result.value;
347
- * // Use typedData for permit signing
434
+ * const outcome = result.value;
435
+ * switch (outcome.__typename) {
436
+ * case 'SwapFulfilled':
437
+ * console.log('Swap completed successfully:', outcome.txHash);
438
+ * break;
439
+ * case 'SwapCancelled':
440
+ * console.log('Swap was cancelled:', outcome.cancelledAt);
441
+ * break;
442
+ * case 'SwapExpired':
443
+ * console.log('Swap expired:', outcome.expiredAt);
444
+ * break;
445
+ * }
446
+ * }
447
+ * ```
448
+ *
449
+ * @param client - Aave client configured with polling settings.
450
+ * @returns A function that takes a SwapReceipt and returns a ResultAsync with the final outcome.
451
+ */
452
+ declare function waitForSwapOutcome(client: AaveClient): (receipt: SwapReceipt) => ResultAsync<SwapOutcome, TimeoutError | UnexpectedError>;
453
+ /**
454
+ * @internal
455
+ * Executes a swap for the specified request parameters.
456
+ *
457
+ * ```ts
458
+ * const result = await swap(client, {
459
+ * intent: {
460
+ * quoteId: swapQuoteId('123...'),
461
+ * signature: {
462
+ * value: signature('0x456...'),
463
+ * deadline: 1234567890,
464
+ * },
465
+ * },
466
+ * }).andThen((plan) => {
467
+ * switch (plan.__typename) {
468
+ * case 'SwapTransactionRequest':
469
+ * return sendTransaction(plan.transaction)
470
+ * .map(() => plan.orderReceipt);
471
+ *
472
+ * case 'SwapApprovalRequired':
473
+ * return sendTransaction(plan.transaction)
474
+ * .andThen(() => sendTransaction(plan.originalTransaction))
475
+ * .map(() => plan.originalTransaction.orderReceipt);
476
+ *
477
+ * case 'SwapReceipt':
478
+ * return okAsync(plan.orderReceipt);
479
+ *
480
+ * case 'InsufficientBalanceError':
481
+ * return errAsync(new Error(`Insufficient balance: ${plan.required.value} required.`));
482
+ * }
483
+ * });
484
+ *
485
+ * if (result.isErr()) {
486
+ * console.error(result.error);
487
+ * return;
348
488
  * }
489
+ *
490
+ * console.log('Order receipt:', result.value);
349
491
  * ```
350
492
  *
351
493
  * @param client - Aave client.
352
- * @param request - The permit typed data request parameters.
353
- * @returns The EIP-712 typed data for permit signature.
494
+ * @param request - The swap request parameters.
495
+ * @returns The swap execution plan containing transaction details or receipt.
354
496
  */
355
- declare function permitTypedData(client: AaveClient, request: PermitTypedDataRequest): ResultAsync<PermitTypedDataResponse, UnexpectedError>;
356
-
497
+ declare function swap(client: AaveClient, request: SwapRequest): ResultAsync<SwapExecutionPlan, UnexpectedError>;
357
498
  /**
358
- * Fetches a specific reserve by market address, token address, and chain ID.
499
+ * @internal
500
+ * Prepares a swap cancellation for the specified swap ID.
359
501
  *
360
502
  * ```ts
361
- * const result = await reserve(client, {
362
- * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
363
- * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),
364
- * chainId: chainId(1),
503
+ * const result = await prepareSwapCancel(client, {
504
+ * id: swapId('123...'),
365
505
  * });
366
506
  * ```
367
507
  *
368
508
  * @param client - Aave client.
369
- * @param request - The reserve request parameters.
370
- * @returns The reserve data, or null if not found.
509
+ * @param request - The prepare swap cancel request parameters.
510
+ * @returns The prepared swap cancel result containing typed data for signing.
371
511
  */
372
- declare function reserve(client: AaveClient, request: ReserveRequest): ResultAsync<Reserve | null, UnexpectedError>;
512
+ declare function prepareSwapCancel(client: AaveClient, request: PrepareSwapCancelRequest): ResultAsync<PrepareSwapCancelResult, UnexpectedError>;
373
513
  /**
374
- * Fetches historical borrow APY data for a given underlying asset on a specific market,
375
- * within a defined time window.
514
+ * @internal
515
+ * Executes a swap cancellation for the specified request parameters.
376
516
  *
377
- * The returned data represents APY samples over time, or `null` if unavailable.
517
+ * ```ts
518
+ * const result = await cancelSwap(client, {
519
+ * intent: {
520
+ * id: swapId('123...'),
521
+ * signature: {
522
+ * value: signature('0x456...'),
523
+ * deadline: 1234567890,
524
+ * },
525
+ * },
526
+ * }).andThen((plan) => {
527
+ * switch (plan.__typename) {
528
+ * case 'TransactionRequest':
529
+ * return sendTransaction(plan)
530
+ * .map(() => ({ success: true }));
531
+ *
532
+ * case 'SwapCancelled':
533
+ * return okAsync(plan);
534
+ * }
535
+ * });
536
+ * ```
378
537
  *
379
- * @param client - The Aave client instance used to perform the query.
380
- * @param request - The borrow APY history request parameters.
381
- * @returns A `ResultAsync` containing an array of APY samples, or `null` if not found.
538
+ * @param client - Aave client.
539
+ * @param request - The cancel swap request parameters.
540
+ * @returns The cancel swap execution plan containing transaction details or cancellation receipt.
382
541
  */
383
- declare function borrowAPYHistory(client: AaveClient, request: BorrowAPYHistoryRequest): ResultAsync<APYSample[] | null, UnexpectedError>;
542
+ declare function cancelSwap(client: AaveClient, request: CancelSwapRequest): ResultAsync<CancelSwapExecutionPlan, UnexpectedError>;
384
543
  /**
385
- * Fetches historical supply APY data for a given underlying asset on a specific market,
386
- * within a defined time window.
544
+ * @internal
545
+ * Fetches the user's swap history for a specific chain.
387
546
  *
388
- * The returned data represents APY samples over time, or `null` if unavailable.
547
+ * ```ts
548
+ * const result = await userSwaps(client, {
549
+ * chainId: chainId(1),
550
+ * user: evmAddress('0x742d35cc...'),
551
+ * filterBy: [SwapStatusFilter.FULFILLED, SwapStatusFilter.OPEN],
552
+ * });
553
+ * ```
389
554
  *
390
- * @param client - The Aave client instance used to perform the query.
391
- * @param request - The supply APY history request parameters.
392
- * @returns A `ResultAsync` containing an array of APY samples, or `null` if not found.
555
+ * @param client - Aave client.
556
+ * @param request - The user swaps request parameters.
557
+ * @param options - The query options.
558
+ * @returns The paginated list of user swaps with their status information.
393
559
  */
394
- declare function supplyAPYHistory(client: AaveClient, request: SupplyAPYHistoryRequest): ResultAsync<APYSample[] | null, UnexpectedError>;
560
+ declare function userSwaps(client: AaveClient, request: UserSwapsRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<PaginatedUserSwapsResult, UnexpectedError>;
395
561
 
396
562
  /**
397
563
  * Creates a transaction to borrow from a market.
398
564
  *
399
565
  * ```ts
400
566
  * const result = await borrow(client, {
401
- * market: market.address,
402
567
  * amount: {
403
568
  * erc20: {
404
- * currency: evmAddress('0x5678…'),
405
- * value: '1000',
569
+ * value: bigDecimal('1000'),
406
570
  * },
407
571
  * },
408
- * borrower: evmAddress('0x9abc…'),
409
- * chainId: market.chain.chainId,
572
+ * reserve: reserveId('SGVsbG8h'),
573
+ * sender: evmAddress('0x9abc…'),
410
574
  * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
411
575
  *
412
576
  * if (result.isErr()) {
@@ -427,16 +591,19 @@ declare function borrow(client: AaveClient, request: BorrowRequest): ResultAsync
427
591
  *
428
592
  * ```ts
429
593
  * const result = await supply(client, {
430
- * market: market.address,
594
+ * reserve: {
595
+ * reserveId: "1234567890",
596
+ * spoke: evmAddress('0x8787…'),
597
+ * chainId: chainId(1),
598
+ * },
431
599
  * amount: {
432
600
  * erc20: {
433
- * currency: evmAddress('0x5678…'),
434
- * value: '1000',
601
+ * value: bigDecimal('1000'),
435
602
  * },
436
603
  * },
437
- * supplier: evmAddress('0x9abc…'),
438
- * chainId: market.chain.chainId,
439
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
604
+ * enableCollateral: true, // Optional, defaults to true
605
+ * sender: evmAddress('0x9abc…'),
606
+ * });
440
607
  *
441
608
  * if (result.isErr()) {
442
609
  * // Handle error, e.g. insufficient balance, signing error, etc.
@@ -456,17 +623,15 @@ declare function supply(client: AaveClient, request: SupplyRequest): ResultAsync
456
623
  *
457
624
  * ```ts
458
625
  * const result = await repay(client, {
459
- * market: market.address,
460
626
  * amount: {
461
627
  * erc20: {
462
- * currency: evmAddress('0x5678…'),
463
628
  * value: {
464
- * exact: '500',
629
+ * exact: bigDecimal('500'),
465
630
  * },
466
631
  * },
467
632
  * },
468
- * borrower: evmAddress('0x9abc…'),
469
- * chainId: market.chain.chainId,
633
+ * sender: evmAddress('0x9abc…'),
634
+ * reserve: reserveId('SGVsbG8h'),
470
635
  * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
471
636
  *
472
637
  * if (result.isErr()) {
@@ -483,19 +648,17 @@ declare function supply(client: AaveClient, request: SupplyRequest): ResultAsync
483
648
  */
484
649
  declare function repay(client: AaveClient, request: RepayRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
485
650
  /**
486
- * Creates a transaction to withdraw from a market.
651
+ * Creates a transaction to withdraw from a reserve.
487
652
  *
488
653
  * ```ts
489
654
  * const result = await withdraw(client, {
490
- * market: market.address,
655
+ * reserve: reserveId('SGVsbG8h'),
491
656
  * amount: {
492
657
  * erc20: {
493
- * currency: evmAddress('0x5678…'),
494
- * value: { exact: '750' },
658
+ * exact: bigDecimal('750.5'),
495
659
  * },
496
660
  * },
497
- * supplier: evmAddress('0x9abc…'),
498
- * chainId: market.chain.chainId,
661
+ * sender: evmAddress('0x9abc…'),
499
662
  * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
500
663
  *
501
664
  * if (result.isErr()) {
@@ -506,191 +669,118 @@ declare function repay(client: AaveClient, request: RepayRequest): ResultAsync<E
506
669
  * // result.value: TxHash
507
670
  * ```
508
671
  *
509
- * @param client - Aave client.
510
- * @param request - The withdraw request parameters.
511
- * @returns The transaction data, approval requirements, or insufficient balance error.
512
- */
513
- declare function withdraw(client: AaveClient, request: WithdrawRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
514
- /**
515
- * Creates a transaction to enable/disable the user's eMode for a market.
516
- *
517
- * **Example: Enable a Specific eMode**
672
+ * **Withdraw specific amount:**
518
673
  * ```ts
519
- * const result = await userSetEmode(client, {
520
- * market: market.address,
521
- * user: evmAddress('0x5678…'),
522
- * categoryId: market.eModeCategories[0].id,
523
- * chainId: market.chain.chainId,
524
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
525
- *
526
- * if (result.isErr()) {
527
- * // Handle error, e.g. signing error, etc.
528
- * return;
674
+ * amount: {
675
+ * erc20: {
676
+ * exact: bigDecimal('100.5'), // Exact amount to withdraw
677
+ * }
529
678
  * }
530
- *
531
- * // result.value: TxHash
532
679
  * ```
533
680
  *
534
- * **Example: Disable eMode**
681
+ * **Withdraw all available:**
535
682
  * ```ts
536
- * const result = await userSetEmode(client, {
537
- * market: market.address,
538
- * user: evmAddress('0x5678…'),
539
- * categoryId: null,
540
- * chainId: market.chain.chainId,
541
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
542
- *
543
- * if (result.isErr()) {
544
- * // Handle error, e.g. signing error, etc.
545
- * return;
683
+ * amount: {
684
+ * erc20: {
685
+ * max: true, // Withdraw the full position
686
+ * }
546
687
  * }
547
- *
548
- * // result.value: TxHash
549
688
  * ```
550
689
  *
551
- * @param client - Aave client.
552
- * @param request - The user set eMode request parameters.
553
- * @returns The transaction request data to set eMode.
554
- */
555
- declare function userSetEmode(client: AaveClient, request: UserSetEmodeRequest): ResultAsync<TransactionRequest, UnexpectedError>;
556
- /**
557
- * Creates a transaction to deposit assets into a vault and mint shares.
558
- *
690
+ * **Withdraw native token:**
559
691
  * ```ts
560
- * const result = await vaultDeposit(client, {
561
- * vault: evmAddress('0x1234…'),
562
- * amount: {
563
- * value: '1000',
564
- * },
565
- * depositor: evmAddress('0x9abc…'),
566
- * chainId: chainId(1),
567
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
568
- *
569
- * if (result.isErr()) {
570
- * // Handle error, e.g. insufficient balance, signing error, etc.
571
- * return;
692
+ * amount: {
693
+ * native: bigDecimal('0.5'), // For ETH on Ethereum
572
694
  * }
573
- *
574
- * // result.value: TxHash
575
695
  * ```
576
696
  *
577
697
  * @param client - Aave client.
578
- * @param request - The vault deposit request parameters.
698
+ * @param request - The withdraw request parameters.
579
699
  * @returns The transaction data, approval requirements, or insufficient balance error.
580
700
  */
581
- declare function vaultDeposit(client: AaveClient, request: VaultDepositRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
701
+ declare function withdraw(client: AaveClient, request: WithdrawRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
582
702
  /**
583
- * Creates a transaction to redeem vault shares for underlying assets.
703
+ * Creates a transaction to renounce a position manager of a user in a specific spoke.
584
704
  *
585
705
  * ```ts
586
- * const result = await vaultRedeemShares(client, {
587
- * vault: evmAddress('0x1234…'),
588
- * shares: {
589
- * amount: '500',
590
- * asAToken: false,
591
- * },
592
- * sharesOwner: evmAddress('0x9abc…'),
593
- * chainId: chainId(1),
706
+ * const result = await renounceSpokeUserPositionManager(client, {
707
+ * manager: evmAddress('0x9abc…'),
708
+ * managing: evmAddress('0xdef0…'),
709
+ * spoke: spokeId('SGVsbG8h'),
594
710
  * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
595
711
  *
596
712
  * if (result.isErr()) {
597
- * // Handle error, e.g. signing error, etc.
713
+ * // Handle error
598
714
  * return;
599
715
  * }
600
716
  *
601
717
  * // result.value: TxHash
602
718
  * ```
603
719
  *
604
- * @param client - Aave client.
605
- * @param request - The redeem vault shares request parameters.
606
- * @returns The transaction request data to redeem shares.
607
- */
608
- declare function vaultRedeemShares(client: AaveClient, request: VaultRedeemSharesRequest): ResultAsync<TransactionRequest, UnexpectedError>;
609
- /**
610
- * Creates an execution plan to deploy a new vault.
611
- *
612
- * ```ts
613
- * const result = await vaultDeploy(client, {
614
- * underlyingToken: evmAddress('0x1234…'),
615
- * market: evmAddress('0x5678…'),
616
- * deployer: evmAddress('0x9abc…'),
617
- * initialFee: '0.1',
618
- * shareName: 'Aave Vault Shares',
619
- * shareSymbol: 'avs',
620
- * initialLockDeposit: '1000',
621
- * chainId: chainId(1),
622
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
623
- *
624
- * if (result.isErr()) {
625
- * // Handle error, e.g. signing error, insufficient balance, etc.
626
- * return;
627
- * }
628
- *
629
- * // result.value: TxHash
630
- * ```
631
720
  *
632
721
  * @param client - Aave client.
633
- * @param request - The deploy vault request parameters.
634
- * @returns The execution plan data to deploy a vault. May require approval transactions.
722
+ * @param request - The renounce spoke user position manager request parameters.
723
+ * @returns The transaction data.
635
724
  */
636
- declare function vaultDeploy(client: AaveClient, request: VaultDeployRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
725
+ declare function renounceSpokeUserPositionManager(client: AaveClient, request: RenounceSpokeUserPositionManagerRequest): ResultAsync<TransactionRequest, UnexpectedError>;
637
726
  /**
638
- * Creates a transaction to set the vault fee (owner only).
727
+ * Creates a transaction to update user dynamic config for a specific spoke.
639
728
  *
640
729
  * ```ts
641
- * const result = await vaultSetFee(client, {
642
- * vault: evmAddress('0x1234…'),
643
- * newFee: '0.2',
644
- * chainId: chainId(1),
730
+ * const result = await updateUserDynamicConfig(client, {
731
+ * sender: evmAddress('0x9abc…'),
732
+ * spoke: spokeId('SGVsbG8h'),
645
733
  * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
646
734
  *
647
735
  * if (result.isErr()) {
648
- * // Handle error, e.g. signing error, etc.
736
+ * // Handle error
649
737
  * return;
650
738
  * }
651
739
  *
652
740
  * // result.value: TxHash
653
741
  * ```
654
742
  *
743
+ *
655
744
  * @param client - Aave client.
656
- * @param request - The set vault fee request parameters.
657
- * @returns The transaction request data to set vault fee.
745
+ * @param request - The update user dynamic config request parameters.
746
+ * @returns The transaction data.
658
747
  */
659
- declare function vaultSetFee(client: AaveClient, request: VaultSetFeeRequest): ResultAsync<TransactionRequest, UnexpectedError>;
748
+ declare function updateUserDynamicConfig(client: AaveClient, request: UpdateUserDynamicConfigRequest): ResultAsync<TransactionRequest, UnexpectedError>;
660
749
  /**
661
- * Creates a transaction to withdraw accumulated fees from a vault (owner only).
750
+ * Creates a transaction to update user risk premium for a specific spoke.
662
751
  *
663
752
  * ```ts
664
- * const result = await vaultWithdrawFees(client, {
665
- * vault: evmAddress('0x1234…'),
666
- * amount: '100',
667
- * chainId: chainId(1),
753
+ * const result = await updateUserRiskPremium(client, {
754
+ * sender: evmAddress('0x9abc…'),
755
+ * spoke: spokeId('SGVsbG8h'),
668
756
  * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
669
757
  *
670
758
  * if (result.isErr()) {
671
- * // Handle error, e.g. signing error, etc.
759
+ * // Handle error
672
760
  * return;
673
761
  * }
674
762
  *
675
763
  * // result.value: TxHash
676
764
  * ```
677
765
  *
766
+ *
678
767
  * @param client - Aave client.
679
- * @param request - The withdraw vault fees request parameters.
680
- * @returns The transaction request data to withdraw vault fees.
768
+ * @param request - The update user risk premium request parameters.
769
+ * @returns The transaction data.
681
770
  */
682
- declare function vaultWithdrawFees(client: AaveClient, request: VaultWithdrawFeesRequest): ResultAsync<TransactionRequest, UnexpectedError>;
771
+ declare function updateUserRiskPremium(client: AaveClient, request: UpdateUserRiskPremiumRequest): ResultAsync<TransactionRequest, UnexpectedError>;
683
772
  /**
684
- * Creates a transaction to withdraw assets from a vault, burning shares.
773
+ * Creates a transaction to liquidate a user's position.
685
774
  *
686
775
  * ```ts
687
- * const result = await vaultWithdraw(client, {
688
- * vault: evmAddress('0x1234…'),
776
+ * const result = await liquidatePosition(client, {
777
+ * collateral: reserveId('SGVsbG8h'),
778
+ * debt: reserveId('Q2lhbyE= '),
689
779
  * amount: {
690
- * value: '500',
780
+ * exact: bigDecimal('1000'),
691
781
  * },
692
- * sharesOwner: evmAddress('0x9abc…'),
693
- * chainId: chainId(1),
782
+ * liquidator: evmAddress('0x9abc…'),
783
+ * user: evmAddress('0xdef0…'),
694
784
  * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
695
785
  *
696
786
  * if (result.isErr()) {
@@ -702,46 +792,34 @@ declare function vaultWithdrawFees(client: AaveClient, request: VaultWithdrawFee
702
792
  * ```
703
793
  *
704
794
  * @param client - Aave client.
705
- * @param request - The withdraw vault request parameters.
706
- * @returns The transaction request data to withdraw from vault.
795
+ * @param request - The liquidate position request parameters.
796
+ * @returns The transaction data, approval requirements, or insufficient balance error.
707
797
  */
708
- declare function vaultWithdraw(client: AaveClient, request: VaultWithdrawRequest): ResultAsync<TransactionRequest, UnexpectedError>;
798
+ declare function liquidatePosition(client: AaveClient, request: LiquidatePositionRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
709
799
  /**
710
- * Creates a transaction to mint exact amount of vault shares by depositing calculated assets.
711
- *
712
- * ```ts
713
- * const result = await vaultMintShares(client, {
714
- * vault: evmAddress('0x1234…'),
715
- * shares: {
716
- * amount: '1000',
717
- * asAToken: false,
718
- * },
719
- * minter: evmAddress('0x9abc…'),
720
- * chainId: chainId(1),
721
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
800
+ * Sets or removes a position manager for a user on a specific spoke.
722
801
  *
723
- * if (result.isErr()) {
724
- * // Handle error, e.g. insufficient balance, signing error, etc.
725
- * return;
726
- * }
802
+ * **Position managers** can perform transactions on behalf of other users, including:
803
+ * - Supply assets
804
+ * - Borrow assets
805
+ * - Withdraw assets
806
+ * - Enable/disable collateral
727
807
  *
728
- * // result.value: TxHash
729
- * ```
730
- *
731
- * @param client - Aave client.
732
- * @param request - The mint vault shares request parameters.
733
- * @returns The transaction data, approval requirements, or insufficient balance error.
734
- */
735
- declare function vaultMintShares(client: AaveClient, request: VaultMintSharesRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
736
- /**
737
- * Creates a transaction to enable/disable a specific supplied asset as collateral.
808
+ * The `signature` parameter is an **ERC712 signature** that must be signed by the **user**
809
+ * (the account granting permissions) to authorize the position manager. The signature contains:
810
+ * - `value`: The actual cryptographic signature
811
+ * - `deadline`: Unix timestamp when the authorization expires
738
812
  *
739
813
  * ```ts
740
- * const result = await collateralToggle(client, {
741
- * market: market.address,
742
- * underlyingToken: market.supplyReserves[n].underlyingToken.address,
743
- * user: evmAddress('0x9abc…'),
744
- * chainId: market.chain.chainId,
814
+ * const result = await setSpokeUserPositionManager(client, {
815
+ * spoke: spokeId('SGVsbG8h'),
816
+ * manager: evmAddress('0x9abc…'), // Address that will become the position manager
817
+ * approve: true, // true to approve, false to remove the manager
818
+ * user: evmAddress('0xdef0…'), // User granting the permission (must sign the signature)
819
+ * signature: {
820
+ * value: '0x1234...', // ERC712 signature signed by the user
821
+ * deadline: 1735689600, // Unix timestamp when signature expires
822
+ * },
745
823
  * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
746
824
  *
747
825
  * if (result.isErr()) {
@@ -753,365 +831,203 @@ declare function vaultMintShares(client: AaveClient, request: VaultMintSharesReq
753
831
  * ```
754
832
  *
755
833
  * @param client - Aave client.
756
- * @param request - The collateral toggle request parameters.
757
- * @returns The transaction request data to toggle collateral.
834
+ * @param request - The spoke set for the position manager request parameters.
835
+ * @returns The transaction request data to set position manager.
758
836
  */
759
- declare function collateralToggle(client: AaveClient, request: CollateralToggleRequest): ResultAsync<TransactionRequest, UnexpectedError>;
837
+ declare function setSpokeUserPositionManager(client: AaveClient, request: SetSpokeUserPositionManagerRequest): ResultAsync<TransactionRequest, UnexpectedError>;
760
838
  /**
761
- * Creates a transaction to liquidate a non-healthy position with Health Factor below 1.
839
+ * Previews the impact of a potential action on a user's position.
762
840
  *
763
841
  * ```ts
764
- * const result = await liquidate(client, {
765
- * collateralToken: evmAddress('0x1234…'),
766
- * debtToken: evmAddress('0x5678…'),
767
- * user: evmAddress('0x9abc…'),
768
- * debtToCover: { max: true },
769
- * chainId: chainId(1),
770
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
771
- *
772
- * if (result.isErr()) {
773
- * // Handle error, e.g. signing error, etc.
774
- * return;
775
- * }
776
- *
777
- * // result.value: TxHash
842
+ * const result = await preview(client, {
843
+ * action: {
844
+ * supply: {
845
+ * reserve: reserveId('SGVsbG8h'),
846
+ * amount: {
847
+ * erc20: {
848
+ * value: '1000',
849
+ * },
850
+ * },
851
+ * sender: evmAddress('0x9abc…'),
852
+ * },
853
+ * },
854
+ * });
778
855
  * ```
779
856
  *
780
857
  * @param client - Aave client.
781
- * @param request - The liquidate request parameters.
782
- * @returns The transaction request data to liquidate position.
858
+ * @param request - The preview request parameters containing the action to preview.
859
+ * @param options - The query options.
860
+ * @returns The preview result showing position changes.
783
861
  */
784
- declare function liquidate(client: AaveClient, request: LiquidateRequest): ResultAsync<TransactionRequest, UnexpectedError>;
862
+ declare function preview(client: AaveClient, request: PreviewRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<PreviewUserPosition, UnexpectedError>;
785
863
  /**
786
- * Creates a transaction to approve a credit borrow delegator to be able to borrow on your behalf.
864
+ * Sets whether a user's supply should be used as collateral.
787
865
  *
788
866
  * ```ts
789
- * const result = await approveBorrowCreditDelegation(client, {
790
- * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
791
- * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),
792
- * amount: '1000',
793
- * user: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),
794
- * delegatee: evmAddress('0x5678…'),
795
- * chainId: chainId(1),
796
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
797
- *
798
- * if (result.isErr()) {
799
- * // Handle error, e.g. signing error, etc.
800
- * return;
801
- * }
802
- *
803
- * // result.value: TxHash
867
+ * const result = await setUserSupplyAsCollateral(client, {
868
+ * reserve: reserveId('SGVsbG8h'),
869
+ * sender: evmAddress('0x456...'),
870
+ * enableCollateral: true
871
+ * });
804
872
  * ```
805
873
  *
806
874
  * @param client - Aave client.
807
- * @param request - The approve borrow credit delegation request parameters.
808
- * @returns The transaction request data to approve credit delegation.
875
+ * @param request - The set user supply as collateral request parameters.
876
+ * @returns The transaction request to set collateral status.
809
877
  */
810
- declare function approveBorrowCreditDelegation(client: AaveClient, request: ApproveBorrowCreditDelegatorRequest): ResultAsync<TransactionRequest, UnexpectedError>;
878
+ declare function setUserSupplyAsCollateral(client: AaveClient, request: SetUserSupplyAsCollateralRequest): ResultAsync<TransactionRequest, UnexpectedError>;
811
879
  /**
812
- * Gets the amount delegated to the credit delegatee that can borrow on your behalf.
880
+ * Fetches paginated list of activities.
813
881
  *
814
882
  * ```ts
815
- * const result = await creditDelegateeAllowance(client, {
816
- * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
817
- * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),
818
- * user: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),
819
- * delegatee: evmAddress('0x5678…'),
820
- * chainId: chainId(1),
883
+ * const result = await activities(client, {
884
+ * query: {
885
+ * chainIds: [chainId(1)],
886
+ * },
887
+ * user: evmAddress('0x742d35cc…'), // Optional
888
+ * types: [ActivityType.Supply, ActivityType.Borrow, ActivityType.Withdraw, ActivityType.Repay],
821
889
  * });
822
- *
823
- * if (result.isErr()) {
824
- * // Handle error
825
- * return;
826
- * }
827
- *
828
- * // result.value: TokenAmount with credit delegation allowance
829
890
  * ```
830
891
  *
831
892
  * @param client - Aave client.
832
- * @param request - The credit delegatee allowance request parameters.
833
- * @returns The token amount representing the credit delegation allowance.
893
+ * @param request - The activities request parameters.
894
+ * @param options - The query options.
895
+ * @returns The paginated list of activities.
834
896
  */
835
- declare function creditDelegateeAllowance(client: AaveClient, request: CreditDelegateeAmountRequest): ResultAsync<TokenAmount, UnexpectedError>;
897
+ declare function activities(client: AaveClient, request: ActivitiesRequest, options?: CurrencyQueryOptions & RequestPolicyOptions): ResultAsync<PaginatedActivitiesResult, UnexpectedError>;
836
898
 
837
899
  /**
838
- * Fetches all user supply positions across the specified markets.
900
+ * Fetches all user supply positions across the specified spoke.
839
901
  *
840
902
  * ```ts
841
903
  * const result = await userSupplies(client, {
842
- * markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],
843
- * user: evmAddress('0x742d35cc…'),
904
+ * query: {
905
+ * userSpoke: {
906
+ * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
907
+ * user: evmAddress('0x742d35cc…'),
908
+ * },
909
+ * },
910
+ * orderBy: { name: 'ASC' },
844
911
  * });
845
912
  * ```
846
913
  *
847
914
  * @param client - Aave client.
848
915
  * @param request - The user supplies request parameters.
916
+ * @param options - The query options.
849
917
  * @returns The user's supply positions.
850
918
  */
851
- declare function userSupplies(client: AaveClient, request: UserSuppliesRequest): ResultAsync<MarketUserReserveSupplyPosition[], UnexpectedError>;
919
+ declare function userSupplies(client: AaveClient, request: UserSuppliesRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<UserSupplyItem[], UnexpectedError>;
852
920
  /**
853
- * Fetches all user borrow positions.
921
+ * Fetches all user borrow positions across the specified spoke.
854
922
  *
855
923
  * ```ts
856
924
  * const result = await userBorrows(client, {
857
- * markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],
858
- * user: evmAddress('0x742d35cc…'),
925
+ * query: {
926
+ * userSpoke: {
927
+ * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
928
+ * user: evmAddress('0x742d35cc…'),
929
+ * },
930
+ * },
931
+ * orderBy: { name: 'ASC' },
859
932
  * });
860
933
  * ```
861
934
  *
862
935
  * @param client - Aave client.
863
936
  * @param request - The user borrows request parameters.
937
+ * @param options - The query options.
864
938
  * @returns The user's borrow positions.
865
939
  */
866
- declare function userBorrows(client: AaveClient, request: UserBorrowsRequest): ResultAsync<MarketUserReserveBorrowPosition[], UnexpectedError>;
940
+ declare function userBorrows(client: AaveClient, request: UserBorrowsRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<UserBorrowItem[], UnexpectedError>;
941
+ type UserSummaryQueryOptions = Prettify<CurrencyQueryOptions & TimeWindowQueryOptions>;
867
942
  /**
868
- * Fetches the user's transaction history for a given market.
943
+ * Fetches a user's summary across all positions.
869
944
  *
870
945
  * ```ts
871
- * const result = await userTransactionHistory(client, {
872
- * chainId: chainId(1),
873
- * market: evmAddress('0x87870bca…'),
946
+ * const result = await userSummary(client, {
874
947
  * user: evmAddress('0x742d35cc…'),
875
- * });
876
- * ```
877
- *
878
- * @param client - Aave client.
879
- * @param request - The user transaction history request parameters.
880
- * @returns The user's paginated transaction history.
881
- */
882
- declare function userTransactionHistory(client: AaveClient, request: UserTransactionHistoryRequest): ResultAsync<PaginatedUserTransactionHistoryResult, UnexpectedError>;
883
-
884
- /**
885
- * Fetches a specific vault by address and chain ID.
886
- *
887
- * **Example: By Address**
888
- * ```ts
889
- * const result = await vault(client, {
890
- * by: {
891
- * address: evmAddress('0x1234…'),
892
- * },
893
- * chainId: chainId(1),
894
- * user: evmAddress('0x5678…'),
895
- * });
896
- * ```
897
- *
898
- * **Example: Tx Hash**
899
- * ```ts
900
- * const result = await vault(client, {
901
- * by: {
902
- * txHash: txHash('0x1234…'),
903
- * },
904
- * chainId: chainId(1),
905
- * user: evmAddress('0x5678…'),
906
- * });
907
- * ```
908
- *
909
- * @param client - Aave client.
910
- * @param request - The vault request parameters.
911
- * @returns The vault data, or null if not found.
912
- */
913
- declare function vault(client: AaveClient, request: VaultRequest): ResultAsync<Vault | null, UnexpectedError>;
914
- /**
915
- * Fetches vaults based on filter criteria.
916
- *
917
- * ```ts
918
- * const result = await vaults(client, {
919
- * criteria: {
920
- * ownedBy: [evmAddress('0x1234…')]
948
+ * filter: {
949
+ * spoke: { address: evmAddress('0x87870bca…'), chainId: chainId(1) },
921
950
  * },
922
- * pageSize: PageSize.Ten,
923
- * user: evmAddress('0x5678…'),
924
951
  * });
925
952
  * ```
926
953
  *
927
954
  * @param client - Aave client.
928
- * @param request - The vaults request parameters.
929
- * @returns The paginated vaults result.
955
+ * @param request - The user summary request parameters.
956
+ * @param options - The query options.
957
+ * @returns The user's financial summary.
930
958
  */
931
- declare function vaults(client: AaveClient, request: VaultsRequest): ResultAsync<PaginatedVaultsResult, UnexpectedError>;
959
+ declare function userSummary(client: AaveClient, request: UserSummaryRequest, { currency, timeWindow, }?: UserSummaryQueryOptions): ResultAsync<UserSummary, UnexpectedError>;
960
+ type UserPositionQueryOptions = CurrencyQueryOptions & TimeWindowQueryOptions;
932
961
  /**
933
- * Fetches vaults that a user has shares in.
962
+ * Fetches all user positions across specified chains.
934
963
  *
935
964
  * ```ts
936
- * const result = await userVaults(client, {
937
- * user: evmAddress('0x1234…'),
938
- * filters: {
939
- * markets: [evmAddress('0x5678…')]
965
+ * const result = await userPositions(client, {
966
+ * user: evmAddress('0x742d35cc…'),
967
+ * filter: {
968
+ * chainIds: [chainId(1), chainId(137)],
940
969
  * },
941
- * orderBy: { shares: OrderDirection.Desc },
942
- * pageSize: PageSize.Fifty,
943
- * });
944
- * ```
945
- *
946
- * @param client - Aave client.
947
- * @param request - The user vaults request parameters.
948
- * @returns The paginated user vaults result.
949
- */
950
- declare function userVaults(client: AaveClient, request: UserVaultsRequest): ResultAsync<PaginatedVaultsResult, UnexpectedError>;
951
- /**
952
- * Determines the amount of shares that would be received for a deposit.
953
- *
954
- * ```ts
955
- * const result = await vaultPreviewDeposit(client, {
956
- * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
957
- * chainId: chainId(1),
958
- * amount: bigDecimal('1000'),
959
- * });
960
- *
961
- * if (result.isOk()) {
962
- * console.log('Shares to receive:', result.value.amount.value);
963
- * console.log('USD value:', result.value.usd);
964
- * }
965
- * ```
966
- *
967
- * @param client - Aave client.
968
- * @param request - The vault preview deposit request parameters.
969
- * @returns The simulated shares amount that would be received.
970
- */
971
- declare function vaultPreviewDeposit(client: AaveClient, request: VaultPreviewDepositRequest): ResultAsync<TokenAmount, UnexpectedError>;
972
- /**
973
- * Determines the amount of assets that would be required to mint a specific amount of vault shares.
974
- *
975
- * ```ts
976
- * const result = await vaultPreviewMint(client, {
977
- * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
978
- * chainId: chainId(1),
979
- * amount: bigDecimal('500'),
980
- * });
981
- *
982
- * if (result.isOk()) {
983
- * console.log('Assets required:', result.value.amount.value);
984
- * console.log('USD value:', result.value.usd);
985
- * }
986
- * ```
987
- *
988
- * @param client - Aave client.
989
- * @param request - The vault preview mint request parameters.
990
- * @returns The simulated assets amount that would be required.
991
- */
992
- declare function vaultPreviewMint(client: AaveClient, request: VaultPreviewMintRequest): ResultAsync<TokenAmount, UnexpectedError>;
993
- /**
994
- * Determines the amount of shares that would be burned for a withdrawal.
995
- *
996
- * ```ts
997
- * const result = await vaultPreviewWithdraw(client, {
998
- * vault: evmAddress('0x1234…'),
999
- * chainId: chainId(1),
1000
- * amount: bigDecimal('750'),
970
+ * orderBy: { balance: 'DESC' },
1001
971
  * });
1002
- *
1003
- * if (result.isOk()) {
1004
- * console.log('Shares to burn:', result.value.amount.value);
1005
- * console.log('USD value:', result.value.usd);
1006
- * }
1007
972
  * ```
1008
973
  *
1009
974
  * @param client - Aave client.
1010
- * @param request - The vault preview withdraw request parameters.
1011
- * @returns The simulated shares amount that would be burned.
975
+ * @param request - The user positions request parameters.
976
+ * @param options - The query options.
977
+ * @returns The user's positions across all specified chains.
1012
978
  */
1013
- declare function vaultPreviewWithdraw(client: AaveClient, request: VaultPreviewWithdrawRequest): ResultAsync<TokenAmount, UnexpectedError>;
979
+ declare function userPositions(client: AaveClient, request: UserPositionsRequest, { currency, timeWindow, }?: UserPositionQueryOptions): ResultAsync<UserPosition[], UnexpectedError>;
1014
980
  /**
1015
- * Determines the amount of assets that would be received for redeeming a specific amount of vault shares.
981
+ * Fetches a specific user position by ID.
1016
982
  *
1017
983
  * ```ts
1018
- * const result = await vaultPreviewRedeem(client, {
1019
- * vault: evmAddress('0x1234…'),
1020
- * chainId: chainId(1),
1021
- * amount: bigDecimal('200'),
984
+ * const result = await userPosition(client, {
985
+ * id: userPositionId('SGVsbG8h'),
1022
986
  * });
1023
- *
1024
- * if (result.isOk()) {
1025
- * console.log('Assets to receive:', result.value.amount.value);
1026
- * console.log('USD value:', result.value.usd);
1027
- * }
1028
987
  * ```
1029
988
  *
1030
989
  * @param client - Aave client.
1031
- * @param request - The vault preview redeem request parameters.
1032
- * @returns The simulated assets amount that would be received.
990
+ * @param request - The user position request parameters.
991
+ * @param options - The query options.
992
+ * @returns The specific user position or null if not found.
1033
993
  */
1034
- declare function vaultPreviewRedeem(client: AaveClient, request: VaultPreviewRedeemRequest): ResultAsync<TokenAmount, UnexpectedError>;
994
+ declare function userPosition(client: AaveClient, request: UserPositionRequest, { currency, timeWindow, }?: UserPositionQueryOptions): ResultAsync<UserPosition | null, UnexpectedError>;
1035
995
  /**
1036
- * Fetches the user transaction history for a vault.
996
+ * Fetches all user balances across specified chains.
1037
997
  *
1038
998
  * ```ts
1039
- * const result = await vaultUserTransactionHistory(client, {
1040
- * vault: evmAddress('0x1234…'),
1041
- * chainId: chainId(1),
1042
- * user: evmAddress('0x5678…'),
999
+ * const result = await userBalances(client, {
1000
+ * user: evmAddress('0x742d35cc…'),
1001
+ * filter: {
1002
+ * chainIds: [chainId(1), chainId(137)],
1003
+ * },
1043
1004
  * });
1044
- *
1045
- * if (result.isOk()) {
1046
- * console.log('Transaction count:', result.value.items.length);
1047
- * result.value.items.forEach(tx => {
1048
- * if (tx.__typename === 'VaultUserDepositItem') {
1049
- * console.log('Deposit:', tx.asset.amount.value, 'shares:', tx.shares.amount.value);
1050
- * } else if (tx.__typename === 'VaultUserWithdrawItem') {
1051
- * console.log('Withdraw:', tx.asset.amount.value, 'shares:', tx.shares.amount.value);
1052
- * }
1053
- * });
1054
- * }
1055
1005
  * ```
1056
1006
  *
1057
1007
  * @param client - Aave client.
1058
- * @param request - The vault user transaction history request parameters.
1059
- * @returns The paginated vault user transaction history result.
1060
- */
1061
- declare function vaultUserTransactionHistory(client: AaveClient, request: VaultUserTransactionHistoryRequest): ResultAsync<PaginatedVaultUserTransactionHistoryResult, UnexpectedError>;
1008
+ * @param request - The user balances request parameters.
1009
+ * @param options - The query options.
1010
+ * @returns The user's balances across all specified chains.
1011
+ **/
1012
+ declare function userBalances(client: AaveClient, request: UserBalancesRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<UserBalance[], UnexpectedError>;
1062
1013
  /**
1063
- * Fetches the user activity data for a vault, including earnings breakdown over time.
1014
+ * Fetches user summary history over time.
1064
1015
  *
1065
1016
  * ```ts
1066
- * const result = await vaultUserActivity(client, {
1067
- * vault: evmAddress('0x1234…'),
1068
- * chainId: chainId(1),
1069
- * user: evmAddress('0x5678…'),
1017
+ * const result = await userSummaryHistory(client, {
1018
+ * user: evmAddress('0x742d35cc…'),
1019
+ * window: TimeWindow.LastWeek,
1020
+ * filter: {
1021
+ * chainIds: [chainId(1)]
1022
+ * }
1070
1023
  * });
1071
- *
1072
- * if (result.isOk()) {
1073
- * console.log('Total earned:', result.value.earned.amount.value);
1074
- * console.log('Activity breakdown count:', result.value.breakdown.length);
1075
- * result.value.breakdown.forEach(activity => {
1076
- * console.log('Date:', activity.date);
1077
- * console.log('Balance:', activity.balance.amount.value);
1078
- * console.log('Earned:', activity.earned.amount.value);
1079
- * });
1080
- * }
1081
- * ```
1082
- *
1083
- * @param client - Aave client.
1084
- * @param request - The vault user activity request parameters.
1085
- * @returns The vault user activity result.
1086
- */
1087
- declare function vaultUserActivity(client: AaveClient, request: VaultUserActivityRequest): ResultAsync<VaultUserActivityResult, UnexpectedError>;
1088
- /**
1089
- * Creates a transaction to transfer ownership of a vault.
1090
- *
1091
- * ```ts
1092
- * const result = await vaultTransferOwnership(client, {
1093
- * vault: evmAddress('0x1234…'),
1094
- * chainId: chainId(1),
1095
- * newOwner: evmAddress('0x5678…'),
1096
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
1097
1024
  * ```
1098
1025
  *
1099
1026
  * @param client - Aave client.
1100
- * @param request - The vault transfer ownership request parameters.
1101
- * @returns The transaction data for transferring vault ownership.
1102
- */
1103
- declare function vaultTransferOwnership(client: AaveClient, request: VaultTransferOwnershipRequest): ResultAsync<TransactionRequest, UnexpectedError>;
1104
- /**
1105
- * @internal
1106
- */
1107
- declare function vaultCreateRecipientsConfiguration(client: AaveClient, request: VaultCreateRecipientsConfigurationRequest): ResultAsync<TransactionRequest, UnexpectedError>;
1108
- /**
1109
- * @internal
1110
- */
1111
- declare function vaultRecipientConfiguration(client: AaveClient, request: VaultRecipientConfigurationRequest): ResultAsync<VaultFeesRecipientsConfiguration | null, UnexpectedError>;
1112
- /**
1113
- * @internal
1027
+ * @param request - The user summary history request parameters.
1028
+ * @param options - The query options.
1029
+ * @returns The user summary history items.
1114
1030
  */
1115
- declare function vaultSetRecipientsConfiguration(client: AaveClient, request: VaultSetRecipientsConfigurationRequest): ResultAsync<TransactionRequest, UnexpectedError>;
1031
+ declare function userSummaryHistory(client: AaveClient, request: UserSummaryHistoryRequest, options?: Required<CurrencyQueryOptions>): ResultAsync<UserSummaryHistoryItem[], UnexpectedError>;
1116
1032
 
1117
- export { type MarketRequest, type MarketsRequest, approveBorrowCreditDelegation, borrow, borrowAPYHistory, chains, collateralToggle, creditDelegateeAllowance, defaultMarketReservesRequestOrderBy, hasProcessedKnownTransaction, health, healthFactorPreview, liquidate, market, markets, permitTypedData, repay, reserve, savingsGhoBalance, savingsGhoDeposit, savingsGhoWithdraw, supply, supplyAPYHistory, usdExchangeRates, userBorrows, userMarketState, userMeritRewards, userSetEmode, userSupplies, userTransactionHistory, userVaults, vault, vaultCreateRecipientsConfiguration, vaultDeploy, vaultDeposit, vaultMintShares, vaultPreviewDeposit, vaultPreviewMint, vaultPreviewRedeem, vaultPreviewWithdraw, vaultRecipientConfiguration, vaultRedeemShares, vaultSetFee, vaultSetRecipientsConfiguration, vaultTransferOwnership, vaultUserActivity, vaultUserTransactionHistory, vaultWithdraw, vaultWithdrawFees, vaults, withdraw };
1033
+ export { type SwapOutcome, type UserPositionQueryOptions, type UserSummaryQueryOptions, activities, asset, assetBorrowHistory, assetPriceHistory, assetSupplyHistory, borrow, borrowApyHistory, cancelSwap, chain, chains, exchangeRate, hasProcessedKnownTransaction, hub, hubAssets, hubs, liquidatePosition, permitTypedData, prepareSwap, prepareSwapCancel, preview, renounceSpokeUserPositionManager, repay, reserve, reserves, setSpokeUserPositionManager, setUserSupplyAsCollateral, spoke, spokePositionManagers, spokeUserPositionManagers, spokes, supply, supplyApyHistory, swap, swapQuote, swapStatus, swappableTokens, updateUserDynamicConfig, updateUserRiskPremium, userBalances, userBorrows, userPosition, userPositions, userSummary, userSummaryHistory, userSupplies, userSwaps, waitForSwapOutcome, withdraw };