@aave/client 0.4.0 → 0.6.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 (57) hide show
  1. package/package.json +3 -3
  2. package/dist/actions/index.cjs +0 -2
  3. package/dist/actions/index.cjs.map +0 -1
  4. package/dist/actions/index.d.cts +0 -945
  5. package/dist/actions/index.d.ts +0 -945
  6. package/dist/actions/index.js +0 -2
  7. package/dist/actions/index.js.map +0 -1
  8. package/dist/chunk-5UVVSXS5.js +0 -3
  9. package/dist/chunk-5UVVSXS5.js.map +0 -1
  10. package/dist/chunk-FW4363Y4.js +0 -2
  11. package/dist/chunk-FW4363Y4.js.map +0 -1
  12. package/dist/chunk-G5WP6QBY.js +0 -3
  13. package/dist/chunk-G5WP6QBY.js.map +0 -1
  14. package/dist/chunk-QYPBLR6B.js +0 -3
  15. package/dist/chunk-QYPBLR6B.js.map +0 -1
  16. package/dist/chunk-XAKMUIVL.js +0 -2
  17. package/dist/chunk-XAKMUIVL.js.map +0 -1
  18. package/dist/ethers.cjs +0 -3
  19. package/dist/ethers.cjs.map +0 -1
  20. package/dist/ethers.d.cts +0 -22
  21. package/dist/ethers.d.ts +0 -22
  22. package/dist/ethers.js +0 -2
  23. package/dist/ethers.js.map +0 -1
  24. package/dist/index.cjs +0 -4
  25. package/dist/index.cjs.map +0 -1
  26. package/dist/index.d.cts +0 -250
  27. package/dist/index.d.ts +0 -250
  28. package/dist/index.js +0 -2
  29. package/dist/index.js.map +0 -1
  30. package/dist/magic-string.es-PTUXR566.js +0 -14
  31. package/dist/magic-string.es-PTUXR566.js.map +0 -1
  32. package/dist/privy.cjs +0 -4
  33. package/dist/privy.cjs.map +0 -1
  34. package/dist/privy.d.cts +0 -18
  35. package/dist/privy.d.ts +0 -18
  36. package/dist/privy.js +0 -2
  37. package/dist/privy.js.map +0 -1
  38. package/dist/test-utils.cjs +0 -450
  39. package/dist/test-utils.cjs.map +0 -1
  40. package/dist/test-utils.d.cts +0 -37
  41. package/dist/test-utils.d.ts +0 -37
  42. package/dist/test-utils.js +0 -438
  43. package/dist/test-utils.js.map +0 -1
  44. package/dist/thirdweb.cjs +0 -3
  45. package/dist/thirdweb.cjs.map +0 -1
  46. package/dist/thirdweb.d.cts +0 -18
  47. package/dist/thirdweb.d.ts +0 -18
  48. package/dist/thirdweb.js +0 -2
  49. package/dist/thirdweb.js.map +0 -1
  50. package/dist/types-DwXCLJq5.d.cts +0 -72
  51. package/dist/types-DwXCLJq5.d.ts +0 -72
  52. package/dist/viem.cjs +0 -4
  53. package/dist/viem.cjs.map +0 -1
  54. package/dist/viem.d.cts +0 -30
  55. package/dist/viem.d.ts +0 -30
  56. package/dist/viem.js +0 -2
  57. package/dist/viem.js.map +0 -1
@@ -1,945 +0,0 @@
1
- import { MarketReservesRequestOrderBy, Market, UserMarketStateRequest, MarketUserState, ChainsFilter, Chain, UsdExchangeRatesRequest, UsdExchangeRate, HasProcessedKnownTransactionRequest, HealthFactorPreviewRequest, HealthFactorPreviewResponse, PermitTypedDataRequest, PermitTypedDataResponse, ReserveRequest, Reserve, BorrowAPYHistoryRequest, APYSample, SupplyAPYHistoryRequest, BorrowRequest, ExecutionPlan, SupplyRequest, RepayRequest, WithdrawRequest, UserSetEmodeRequest, TransactionRequest, VaultDepositRequest, VaultRedeemSharesRequest, VaultDeployRequest, VaultSetFeeRequest, VaultWithdrawFeesRequest, VaultWithdrawRequest, VaultMintSharesRequest, CollateralToggleRequest, LiquidateRequest, ApproveBorrowCreditDelegatorRequest, CreditDelegateeAmountRequest, TokenAmount, UserSuppliesRequest, MarketUserReserveSupplyPosition, UserBorrowsRequest, MarketUserReserveBorrowPosition, UserTransactionHistoryRequest, PaginatedUserTransactionHistoryResult, VaultRequest, Vault, VaultsRequest, PaginatedVaultsResult, UserVaultsRequest, VaultPreviewDepositRequest, VaultPreviewMintRequest, VaultPreviewWithdrawRequest, VaultPreviewRedeemRequest, VaultUserTransactionHistoryRequest, PaginatedVaultUserTransactionHistoryResult } from '@aave/graphql';
2
- import { ChainId, EvmAddress, ResultAsync } from '@aave/types';
3
- import { AaveClient } from '../index.js';
4
- import { U as UnexpectedError } from '../types-DwXCLJq5.js';
5
- import '@urql/core';
6
-
7
- declare const defaultMarketReservesRequestOrderBy: MarketReservesRequestOrderBy;
8
- type MarketsRequest = {
9
- /**
10
- * The markets you want to see based on the chain ids.
11
- */
12
- chainIds: ChainId[];
13
- /**
14
- * The user viewing the market (e.g., the connected wallet).
15
- *
16
- * If not provided, user fields will not be included.
17
- */
18
- user?: EvmAddress;
19
- /**
20
- * The order by clause for the borrow reserves in the market.
21
- *
22
- * @defaultValue { tokenName: OrderDirection.Asc }
23
- */
24
- borrowsOrderBy?: MarketReservesRequestOrderBy;
25
- /**
26
- * The order by clause for the supply reserves in the market.
27
- *
28
- * @defaultValue { tokenName: OrderDirection.Asc }
29
- */
30
- suppliesOrderBy?: MarketReservesRequestOrderBy;
31
- };
32
- /**
33
- * Fetches all markets for the specified chain IDs.
34
- *
35
- * ```ts
36
- * const result = await markets(client, {
37
- * chainIds: [chainId(1), chainId(8453)],
38
- * });
39
- * ```
40
- *
41
- * @param client - Aave client.
42
- * @param request - The markets request parameters.
43
- * @returns The list of markets.
44
- */
45
- declare function markets(client: AaveClient, { chainIds, borrowsOrderBy, suppliesOrderBy, user, }: MarketsRequest): ResultAsync<Market[], UnexpectedError>;
46
- type MarketRequest = {
47
- /**
48
- * The pool address for the market.
49
- */
50
- address: EvmAddress;
51
- /**
52
- * The chain id the market pool address is deployed on.
53
- */
54
- chainId: ChainId;
55
- /**
56
- * The user viewing the market (e.g., the connected wallet).
57
- *
58
- * If not provided, user fields will not be included.
59
- */
60
- user?: EvmAddress;
61
- /**
62
- * The order by clause for the borrow reserves in the market.
63
- *
64
- * @defaultValue { tokenName: OrderDirection.Asc }
65
- */
66
- borrowsOrderBy?: MarketReservesRequestOrderBy;
67
- /**
68
- * The order by clause for the supply reserves in the market.
69
- *
70
- * @defaultValue { tokenName: OrderDirection.Asc }
71
- */
72
- suppliesOrderBy?: MarketReservesRequestOrderBy;
73
- };
74
- /**
75
- * Fetches a specific market by address and chain ID.
76
- *
77
- * ```ts
78
- * const result = await market(client, {
79
- * address: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
80
- * chainId: chainId(1),
81
- * });
82
- * ```
83
- *
84
- * @param client - Aave client.
85
- * @param request - The market request parameters.
86
- * @returns The market data, or null if not found.
87
- */
88
- declare function market(client: AaveClient, { address, chainId, user, borrowsOrderBy, suppliesOrderBy, }: MarketRequest): ResultAsync<Market | null, UnexpectedError>;
89
- /**
90
- * Fetches user account market data across all reserves.
91
- *
92
- * ```ts
93
- * const result = await userMarketState(client, {
94
- * market: evmAddress('0x1234…'),
95
- * user: evmAddress('0x5678…'),
96
- * chainId: chainId(1)
97
- * });
98
- * ```
99
- *
100
- * @param client - Aave client.
101
- * @param request - The user market state request parameters.
102
- * @returns The user's market state.
103
- */
104
- declare function userMarketState(client: AaveClient, request: UserMarketStateRequest): ResultAsync<MarketUserState, UnexpectedError>;
105
-
106
- /**
107
- * Health check query.
108
- *
109
- * ```ts
110
- * const result = await health(client);
111
- * ```
112
- *
113
- * @param client - Aave client.
114
- * @returns True or false
115
- */
116
- declare function health(client: AaveClient): ResultAsync<boolean, UnexpectedError>;
117
- /**
118
- * Fetches the list of supported chains.
119
- *
120
- * ```ts
121
- * const result = await chains(client, ChainsFilter.MAINNET_ONLY);
122
- * ```
123
- *
124
- * @param client - Aave client.
125
- * @param filter - The filter for the chains.
126
- * @returns The list of supported chains.
127
- */
128
- declare function chains(client: AaveClient, filter?: ChainsFilter): ResultAsync<Chain[], UnexpectedError>;
129
- /**
130
- * Fetches USD exchange rates for different tokens on a given market.
131
- *
132
- * ```ts
133
- * const result = await usdExchangeRates(client, {
134
- * market: evmAddress('0x1234…'),
135
- * underlyingTokens: [evmAddress('0x5678…'), evmAddress('0x90ab…')],
136
- * chainId: chainId(1),
137
- * });
138
- * ```
139
- *
140
- * @param client - Aave client.
141
- * @param request - The USD exchange rates request parameters.
142
- * @returns The list of USD exchange rates.
143
- */
144
- declare function usdExchangeRates(client: AaveClient, request: UsdExchangeRatesRequest): ResultAsync<UsdExchangeRate[], UnexpectedError>;
145
- /**
146
- * Checks if the API has processed a known transaction hash.
147
- *
148
- * This is useful to know when cached data has been invalidated after
149
- * a transaction is complete, as the API uses caching and has an
150
- * invalidation task that may take 100-200ms longer.
151
- *
152
- * ```ts
153
- * const result = await borrow(client, request)
154
- * .andThen(sendWith(wallet))
155
- * .andThen(client.waitForTransaction);
156
- *
157
- * if (result.isErr()) {
158
- * // Handle error
159
- * return;
160
- * }
161
- *
162
- * // Check if the transaction has been processed by the API
163
- * const processed = await hasProcessedKnownTransaction(client, {
164
- * txHash: result.value,
165
- * operation: OperationType.Borrow
166
- * });
167
- *
168
- * if (processed.isErr()) {
169
- * // Handle error
170
- * return;
171
- * }
172
- *
173
- * if (processed.value) {
174
- * // Transaction processed, cached data is up to date
175
- * console.log('Transaction processed, data is fresh');
176
- * } else {
177
- * // Transaction not yet processed, may need to wait
178
- * console.log('Transaction not yet processed');
179
- * }
180
- * ```
181
- *
182
- * @param client - Aave client.
183
- * @param request - The request containing transaction hash and operation type to check.
184
- * @returns True if the transaction has been processed, false otherwise.
185
- */
186
- declare function hasProcessedKnownTransaction(client: AaveClient, request: HasProcessedKnownTransactionRequest): ResultAsync<boolean, UnexpectedError>;
187
- /**
188
- * Fetches health factor preview for a given market action.
189
- *
190
- * ```ts
191
- * const result = await healthFactorPreview(client, {
192
- * action: {
193
- * borrow: {
194
- * market: market.address,
195
- * amount: {
196
- * erc20: {
197
- * currency: evmAddress('0x5678…'),
198
- * value: '1000',
199
- * },
200
- * },
201
- * borrower: evmAddress('0x9abc…'),
202
- * chainId: market.chain.chainId,
203
- * },
204
- * },
205
- * });
206
- * ```
207
- *
208
- * @param client - Aave client.
209
- * @param request - The health factor preview request parameters.
210
- * @returns The health factor preview response with before and after values.
211
- */
212
- declare function healthFactorPreview(client: AaveClient, request: HealthFactorPreviewRequest): ResultAsync<HealthFactorPreviewResponse, UnexpectedError>;
213
-
214
- /**
215
- * Generates EIP-712 typed data for ERC-20 permit signature.
216
- *
217
- * ```ts
218
- * const result = await permitTypedData(client, {
219
- * market: evmAddress('0x87870bca...'),
220
- * underlyingToken: evmAddress('0xa0b86a33...'),
221
- * amount: '1.5',
222
- * chainId: chainId(1),
223
- * spender: evmAddress('0x123...'),
224
- * owner: evmAddress('0x456...'),
225
- * });
226
- *
227
- * if (result.isOk()) {
228
- * const typedData = result.value;
229
- * // Use typedData for permit signing
230
- * }
231
- * ```
232
- *
233
- * @param client - Aave client.
234
- * @param request - The permit typed data request parameters.
235
- * @returns The EIP-712 typed data for permit signature.
236
- */
237
- declare function permitTypedData(client: AaveClient, request: PermitTypedDataRequest): ResultAsync<PermitTypedDataResponse, UnexpectedError>;
238
-
239
- /**
240
- * Fetches a specific reserve by market address, token address, and chain ID.
241
- *
242
- * ```ts
243
- * const result = await reserve(client, {
244
- * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
245
- * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),
246
- * chainId: chainId(1),
247
- * });
248
- * ```
249
- *
250
- * @param client - Aave client.
251
- * @param request - The reserve request parameters.
252
- * @returns The reserve data, or null if not found.
253
- */
254
- declare function reserve(client: AaveClient, request: ReserveRequest): ResultAsync<Reserve | null, UnexpectedError>;
255
- /**
256
- * Fetches historical borrow APY data for a given underlying asset on a specific market,
257
- * within a defined time window.
258
- *
259
- * The returned data represents APY samples over time, or `null` if unavailable.
260
- *
261
- * @param client - The Aave client instance used to perform the query.
262
- * @param request - The borrow APY history request parameters.
263
- * @returns A `ResultAsync` containing an array of APY samples, or `null` if not found.
264
- */
265
- declare function borrowAPYHistory(client: AaveClient, request: BorrowAPYHistoryRequest): ResultAsync<APYSample[] | null, UnexpectedError>;
266
- /**
267
- * Fetches historical supply APY data for a given underlying asset on a specific market,
268
- * within a defined time window.
269
- *
270
- * The returned data represents APY samples over time, or `null` if unavailable.
271
- *
272
- * @param client - The Aave client instance used to perform the query.
273
- * @param request - The supply APY history request parameters.
274
- * @returns A `ResultAsync` containing an array of APY samples, or `null` if not found.
275
- */
276
- declare function supplyAPYHistory(client: AaveClient, request: SupplyAPYHistoryRequest): ResultAsync<APYSample[] | null, UnexpectedError>;
277
-
278
- /**
279
- * Creates a transaction to borrow from a market.
280
- *
281
- * ```ts
282
- * const result = await borrow(client, {
283
- * market: market.address,
284
- * amount: {
285
- * erc20: {
286
- * currency: evmAddress('0x5678…'),
287
- * value: '1000',
288
- * },
289
- * },
290
- * borrower: evmAddress('0x9abc…'),
291
- * chainId: market.chain.chainId,
292
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
293
- *
294
- * if (result.isErr()) {
295
- * // Handle error, e.g. signing error, etc.
296
- * return;
297
- * }
298
- *
299
- * // result.value: TxHash
300
- * ```
301
- *
302
- * @param client - Aave client.
303
- * @param request - The borrow request parameters.
304
- * @returns The transaction data, approval requirements, or insufficient balance error.
305
- */
306
- declare function borrow(client: AaveClient, request: BorrowRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
307
- /**
308
- * Creates a transaction to supply to a market.
309
- *
310
- * ```ts
311
- * const result = await supply(client, {
312
- * market: market.address,
313
- * amount: {
314
- * erc20: {
315
- * currency: evmAddress('0x5678…'),
316
- * value: '1000',
317
- * },
318
- * },
319
- * supplier: evmAddress('0x9abc…'),
320
- * chainId: market.chain.chainId,
321
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
322
- *
323
- * if (result.isErr()) {
324
- * // Handle error, e.g. insufficient balance, signing error, etc.
325
- * return;
326
- * }
327
- *
328
- * // result.value: TxHash
329
- * ```
330
- *
331
- * @param client - Aave client.
332
- * @param request - The supply request parameters.
333
- * @returns The transaction data, approval requirements, or insufficient balance error.
334
- */
335
- declare function supply(client: AaveClient, request: SupplyRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
336
- /**
337
- * Creates a transaction to repay to a market.
338
- *
339
- * ```ts
340
- * const result = await repay(client, {
341
- * market: market.address,
342
- * amount: {
343
- * erc20: {
344
- * currency: evmAddress('0x5678…'),
345
- * value: {
346
- * exact: '500',
347
- * },
348
- * },
349
- * },
350
- * borrower: evmAddress('0x9abc…'),
351
- * chainId: market.chain.chainId,
352
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
353
- *
354
- * if (result.isErr()) {
355
- * // Handle error, e.g. insufficient balance, signing error, etc.
356
- * return;
357
- * }
358
- *
359
- * // result.value: TxHash
360
- * ```
361
- *
362
- * @param client - Aave client.
363
- * @param request - The repay request parameters.
364
- * @returns The transaction data, approval requirements, or insufficient balance error.
365
- */
366
- declare function repay(client: AaveClient, request: RepayRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
367
- /**
368
- * Creates a transaction to withdraw from a market.
369
- *
370
- * ```ts
371
- * const result = await withdraw(client, {
372
- * market: market.address,
373
- * amount: {
374
- * erc20: {
375
- * currency: evmAddress('0x5678…'),
376
- * value: { exact: '750' },
377
- * },
378
- * },
379
- * supplier: evmAddress('0x9abc…'),
380
- * chainId: market.chain.chainId,
381
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
382
- *
383
- * if (result.isErr()) {
384
- * // Handle error, e.g. insufficient balance, signing error, etc.
385
- * return;
386
- * }
387
- *
388
- * // result.value: TxHash
389
- * ```
390
- *
391
- * @param client - Aave client.
392
- * @param request - The withdraw request parameters.
393
- * @returns The transaction data, approval requirements, or insufficient balance error.
394
- */
395
- declare function withdraw(client: AaveClient, request: WithdrawRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
396
- /**
397
- * Creates a transaction to enable/disable the user's eMode for a market.
398
- *
399
- * **Example: Enable a Specific eMode**
400
- * ```ts
401
- * const result = await userSetEmode(client, {
402
- * market: market.address,
403
- * user: evmAddress('0x5678…'),
404
- * categoryId: market.eModeCategories[0].id,
405
- * chainId: market.chain.chainId,
406
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
407
- *
408
- * if (result.isErr()) {
409
- * // Handle error, e.g. signing error, etc.
410
- * return;
411
- * }
412
- *
413
- * // result.value: TxHash
414
- * ```
415
- *
416
- * **Example: Disable eMode**
417
- * ```ts
418
- * const result = await userSetEmode(client, {
419
- * market: market.address,
420
- * user: evmAddress('0x5678…'),
421
- * categoryId: null,
422
- * chainId: market.chain.chainId,
423
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
424
- *
425
- * if (result.isErr()) {
426
- * // Handle error, e.g. signing error, etc.
427
- * return;
428
- * }
429
- *
430
- * // result.value: TxHash
431
- * ```
432
- *
433
- * @param client - Aave client.
434
- * @param request - The user set eMode request parameters.
435
- * @returns The transaction request data to set eMode.
436
- */
437
- declare function userSetEmode(client: AaveClient, request: UserSetEmodeRequest): ResultAsync<TransactionRequest, UnexpectedError>;
438
- /**
439
- * Creates a transaction to deposit assets into a vault and mint shares.
440
- *
441
- * ```ts
442
- * const result = await vaultDeposit(client, {
443
- * vault: evmAddress('0x1234…'),
444
- * amount: {
445
- * value: '1000',
446
- * },
447
- * depositor: evmAddress('0x9abc…'),
448
- * chainId: chainId(1),
449
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
450
- *
451
- * if (result.isErr()) {
452
- * // Handle error, e.g. insufficient balance, signing error, etc.
453
- * return;
454
- * }
455
- *
456
- * // result.value: TxHash
457
- * ```
458
- *
459
- * @param client - Aave client.
460
- * @param request - The vault deposit request parameters.
461
- * @returns The transaction data, approval requirements, or insufficient balance error.
462
- */
463
- declare function vaultDeposit(client: AaveClient, request: VaultDepositRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
464
- /**
465
- * Creates a transaction to redeem vault shares for underlying assets.
466
- *
467
- * ```ts
468
- * const result = await vaultRedeemShares(client, {
469
- * vault: evmAddress('0x1234…'),
470
- * shares: {
471
- * amount: '500',
472
- * asAToken: false,
473
- * },
474
- * sharesOwner: evmAddress('0x9abc…'),
475
- * chainId: chainId(1),
476
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
477
- *
478
- * if (result.isErr()) {
479
- * // Handle error, e.g. signing error, etc.
480
- * return;
481
- * }
482
- *
483
- * // result.value: TxHash
484
- * ```
485
- *
486
- * @param client - Aave client.
487
- * @param request - The redeem vault shares request parameters.
488
- * @returns The transaction request data to redeem shares.
489
- */
490
- declare function vaultRedeemShares(client: AaveClient, request: VaultRedeemSharesRequest): ResultAsync<TransactionRequest, UnexpectedError>;
491
- /**
492
- * Creates an execution plan to deploy a new vault.
493
- *
494
- * ```ts
495
- * const result = await vaultDeploy(client, {
496
- * underlyingToken: evmAddress('0x1234…'),
497
- * market: evmAddress('0x5678…'),
498
- * deployer: evmAddress('0x9abc…'),
499
- * initialFee: '0.1',
500
- * shareName: 'Aave Vault Shares',
501
- * shareSymbol: 'avs',
502
- * initialLockDeposit: '1000',
503
- * chainId: chainId(1),
504
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
505
- *
506
- * if (result.isErr()) {
507
- * // Handle error, e.g. signing error, insufficient balance, etc.
508
- * return;
509
- * }
510
- *
511
- * // result.value: TxHash
512
- * ```
513
- *
514
- * @param client - Aave client.
515
- * @param request - The deploy vault request parameters.
516
- * @returns The execution plan data to deploy a vault. May require approval transactions.
517
- */
518
- declare function vaultDeploy(client: AaveClient, request: VaultDeployRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
519
- /**
520
- * Creates a transaction to set the vault fee (owner only).
521
- *
522
- * ```ts
523
- * const result = await vaultSetFee(client, {
524
- * vault: evmAddress('0x1234…'),
525
- * newFee: '0.2',
526
- * chainId: chainId(1),
527
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
528
- *
529
- * if (result.isErr()) {
530
- * // Handle error, e.g. signing error, etc.
531
- * return;
532
- * }
533
- *
534
- * // result.value: TxHash
535
- * ```
536
- *
537
- * @param client - Aave client.
538
- * @param request - The set vault fee request parameters.
539
- * @returns The transaction request data to set vault fee.
540
- */
541
- declare function vaultSetFee(client: AaveClient, request: VaultSetFeeRequest): ResultAsync<TransactionRequest, UnexpectedError>;
542
- /**
543
- * Creates a transaction to withdraw accumulated fees from a vault (owner only).
544
- *
545
- * ```ts
546
- * const result = await vaultWithdrawFees(client, {
547
- * vault: evmAddress('0x1234…'),
548
- * amount: '100',
549
- * chainId: chainId(1),
550
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
551
- *
552
- * if (result.isErr()) {
553
- * // Handle error, e.g. signing error, etc.
554
- * return;
555
- * }
556
- *
557
- * // result.value: TxHash
558
- * ```
559
- *
560
- * @param client - Aave client.
561
- * @param request - The withdraw vault fees request parameters.
562
- * @returns The transaction request data to withdraw vault fees.
563
- */
564
- declare function vaultWithdrawFees(client: AaveClient, request: VaultWithdrawFeesRequest): ResultAsync<TransactionRequest, UnexpectedError>;
565
- /**
566
- * Creates a transaction to withdraw assets from a vault, burning shares.
567
- *
568
- * ```ts
569
- * const result = await vaultWithdraw(client, {
570
- * vault: evmAddress('0x1234…'),
571
- * amount: {
572
- * value: '500',
573
- * },
574
- * sharesOwner: evmAddress('0x9abc…'),
575
- * chainId: chainId(1),
576
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
577
- *
578
- * if (result.isErr()) {
579
- * // Handle error, e.g. signing error, etc.
580
- * return;
581
- * }
582
- *
583
- * // result.value: TxHash
584
- * ```
585
- *
586
- * @param client - Aave client.
587
- * @param request - The withdraw vault request parameters.
588
- * @returns The transaction request data to withdraw from vault.
589
- */
590
- declare function vaultWithdraw(client: AaveClient, request: VaultWithdrawRequest): ResultAsync<TransactionRequest, UnexpectedError>;
591
- /**
592
- * Creates a transaction to mint exact amount of vault shares by depositing calculated assets.
593
- *
594
- * ```ts
595
- * const result = await vaultMintShares(client, {
596
- * vault: evmAddress('0x1234…'),
597
- * shares: {
598
- * amount: '1000',
599
- * asAToken: false,
600
- * },
601
- * minter: evmAddress('0x9abc…'),
602
- * chainId: chainId(1),
603
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
604
- *
605
- * if (result.isErr()) {
606
- * // Handle error, e.g. insufficient balance, signing error, etc.
607
- * return;
608
- * }
609
- *
610
- * // result.value: TxHash
611
- * ```
612
- *
613
- * @param client - Aave client.
614
- * @param request - The mint vault shares request parameters.
615
- * @returns The transaction data, approval requirements, or insufficient balance error.
616
- */
617
- declare function vaultMintShares(client: AaveClient, request: VaultMintSharesRequest): ResultAsync<ExecutionPlan, UnexpectedError>;
618
- /**
619
- * Creates a transaction to enable/disable a specific supplied asset as collateral.
620
- *
621
- * ```ts
622
- * const result = await collateralToggle(client, {
623
- * market: market.address,
624
- * underlyingToken: market.supplyReserves[n].underlyingToken.address,
625
- * user: evmAddress('0x9abc…'),
626
- * chainId: market.chain.chainId,
627
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
628
- *
629
- * if (result.isErr()) {
630
- * // Handle error, e.g. signing error, etc.
631
- * return;
632
- * }
633
- *
634
- * // result.value: TxHash
635
- * ```
636
- *
637
- * @param client - Aave client.
638
- * @param request - The collateral toggle request parameters.
639
- * @returns The transaction request data to toggle collateral.
640
- */
641
- declare function collateralToggle(client: AaveClient, request: CollateralToggleRequest): ResultAsync<TransactionRequest, UnexpectedError>;
642
- /**
643
- * Creates a transaction to liquidate a non-healthy position with Health Factor below 1.
644
- *
645
- * ```ts
646
- * const result = await liquidate(client, {
647
- * collateralToken: evmAddress('0x1234…'),
648
- * debtToken: evmAddress('0x5678…'),
649
- * user: evmAddress('0x9abc…'),
650
- * debtToCover: { max: true },
651
- * chainId: chainId(1),
652
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
653
- *
654
- * if (result.isErr()) {
655
- * // Handle error, e.g. signing error, etc.
656
- * return;
657
- * }
658
- *
659
- * // result.value: TxHash
660
- * ```
661
- *
662
- * @param client - Aave client.
663
- * @param request - The liquidate request parameters.
664
- * @returns The transaction request data to liquidate position.
665
- */
666
- declare function liquidate(client: AaveClient, request: LiquidateRequest): ResultAsync<TransactionRequest, UnexpectedError>;
667
- /**
668
- * Creates a transaction to approve a credit borrow delegator to be able to borrow on your behalf.
669
- *
670
- * ```ts
671
- * const result = await approveBorrowCreditDelegation(client, {
672
- * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
673
- * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),
674
- * amount: '1000',
675
- * user: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),
676
- * delegatee: evmAddress('0x5678…'),
677
- * chainId: chainId(1),
678
- * }).andThen(sendWith(wallet)).andThen(client.waitForTransaction);
679
- *
680
- * if (result.isErr()) {
681
- * // Handle error, e.g. signing error, etc.
682
- * return;
683
- * }
684
- *
685
- * // result.value: TxHash
686
- * ```
687
- *
688
- * @param client - Aave client.
689
- * @param request - The approve borrow credit delegation request parameters.
690
- * @returns The transaction request data to approve credit delegation.
691
- */
692
- declare function approveBorrowCreditDelegation(client: AaveClient, request: ApproveBorrowCreditDelegatorRequest): ResultAsync<TransactionRequest, UnexpectedError>;
693
- /**
694
- * Gets the amount delegated to the credit delegatee that can borrow on your behalf.
695
- *
696
- * ```ts
697
- * const result = await creditDelegateeAllowance(client, {
698
- * market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
699
- * underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),
700
- * user: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),
701
- * delegatee: evmAddress('0x5678…'),
702
- * chainId: chainId(1),
703
- * });
704
- *
705
- * if (result.isErr()) {
706
- * // Handle error
707
- * return;
708
- * }
709
- *
710
- * // result.value: TokenAmount with credit delegation allowance
711
- * ```
712
- *
713
- * @param client - Aave client.
714
- * @param request - The credit delegatee allowance request parameters.
715
- * @returns The token amount representing the credit delegation allowance.
716
- */
717
- declare function creditDelegateeAllowance(client: AaveClient, request: CreditDelegateeAmountRequest): ResultAsync<TokenAmount, UnexpectedError>;
718
-
719
- /**
720
- * Fetches all user supply positions across the specified markets.
721
- *
722
- * ```ts
723
- * const result = await userSupplies(client, {
724
- * markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],
725
- * user: evmAddress('0x742d35cc…'),
726
- * });
727
- * ```
728
- *
729
- * @param client - Aave client.
730
- * @param request - The user supplies request parameters.
731
- * @returns The user's supply positions.
732
- */
733
- declare function userSupplies(client: AaveClient, request: UserSuppliesRequest): ResultAsync<MarketUserReserveSupplyPosition[], UnexpectedError>;
734
- /**
735
- * Fetches all user borrow positions.
736
- *
737
- * ```ts
738
- * const result = await userBorrows(client, {
739
- * markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],
740
- * user: evmAddress('0x742d35cc…'),
741
- * });
742
- * ```
743
- *
744
- * @param client - Aave client.
745
- * @param request - The user borrows request parameters.
746
- * @returns The user's borrow positions.
747
- */
748
- declare function userBorrows(client: AaveClient, request: UserBorrowsRequest): ResultAsync<MarketUserReserveBorrowPosition[], UnexpectedError>;
749
- /**
750
- * Fetches the user's transaction history for a given market.
751
- *
752
- * ```ts
753
- * const result = await userTransactionHistory(client, {
754
- * chainId: chainId(1),
755
- * market: evmAddress('0x87870bca…'),
756
- * user: evmAddress('0x742d35cc…'),
757
- * });
758
- * ```
759
- *
760
- * @param client - Aave client.
761
- * @param request - The user transaction history request parameters.
762
- * @returns The user's paginated transaction history.
763
- */
764
- declare function userTransactionHistory(client: AaveClient, request: UserTransactionHistoryRequest): ResultAsync<PaginatedUserTransactionHistoryResult, UnexpectedError>;
765
-
766
- /**
767
- * Fetches a specific vault by address and chain ID.
768
- *
769
- * **Example: By Address**
770
- * ```ts
771
- * const result = await vault(client, {
772
- * by: {
773
- * address: evmAddress('0x1234…'),
774
- * },
775
- * chainId: chainId(1),
776
- * user: evmAddress('0x5678…'),
777
- * });
778
- * ```
779
- *
780
- * **Example: Tx Hash**
781
- * ```ts
782
- * const result = await vault(client, {
783
- * by: {
784
- * txHash: txHash('0x1234…'),
785
- * },
786
- * chainId: chainId(1),
787
- * user: evmAddress('0x5678…'),
788
- * });
789
- * ```
790
- *
791
- * @param client - Aave client.
792
- * @param request - The vault request parameters.
793
- * @returns The vault data, or null if not found.
794
- */
795
- declare function vault(client: AaveClient, request: VaultRequest): ResultAsync<Vault | null, UnexpectedError>;
796
- /**
797
- * Fetches vaults based on filter criteria.
798
- *
799
- * ```ts
800
- * const result = await vaults(client, {
801
- * criteria: {
802
- * ownedBy: [evmAddress('0x1234…')]
803
- * },
804
- * pageSize: PageSize.Ten,
805
- * user: evmAddress('0x5678…'),
806
- * });
807
- * ```
808
- *
809
- * @param client - Aave client.
810
- * @param request - The vaults request parameters.
811
- * @returns The paginated vaults result.
812
- */
813
- declare function vaults(client: AaveClient, request: VaultsRequest): ResultAsync<PaginatedVaultsResult, UnexpectedError>;
814
- /**
815
- * Fetches vaults that a user has shares in.
816
- *
817
- * ```ts
818
- * const result = await userVaults(client, {
819
- * user: evmAddress('0x1234…'),
820
- * filters: {
821
- * markets: [evmAddress('0x5678…')]
822
- * },
823
- * orderBy: { shares: OrderDirection.Desc },
824
- * pageSize: PageSize.Fifty,
825
- * });
826
- * ```
827
- *
828
- * @param client - Aave client.
829
- * @param request - The user vaults request parameters.
830
- * @returns The paginated user vaults result.
831
- */
832
- declare function userVaults(client: AaveClient, request: UserVaultsRequest): ResultAsync<PaginatedVaultsResult, UnexpectedError>;
833
- /**
834
- * Determines the amount of shares that would be received for a deposit.
835
- *
836
- * ```ts
837
- * const result = await vaultPreviewDeposit(client, {
838
- * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
839
- * chainId: chainId(1),
840
- * amount: bigDecimal('1000'),
841
- * });
842
- *
843
- * if (result.isOk()) {
844
- * console.log('Shares to receive:', result.value.amount.value);
845
- * console.log('USD value:', result.value.usd);
846
- * }
847
- * ```
848
- *
849
- * @param client - Aave client.
850
- * @param request - The vault preview deposit request parameters.
851
- * @returns The simulated shares amount that would be received.
852
- */
853
- declare function vaultPreviewDeposit(client: AaveClient, request: VaultPreviewDepositRequest): ResultAsync<TokenAmount, UnexpectedError>;
854
- /**
855
- * Determines the amount of assets that would be required to mint a specific amount of vault shares.
856
- *
857
- * ```ts
858
- * const result = await vaultPreviewMint(client, {
859
- * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
860
- * chainId: chainId(1),
861
- * amount: bigDecimal('500'),
862
- * });
863
- *
864
- * if (result.isOk()) {
865
- * console.log('Assets required:', result.value.amount.value);
866
- * console.log('USD value:', result.value.usd);
867
- * }
868
- * ```
869
- *
870
- * @param client - Aave client.
871
- * @param request - The vault preview mint request parameters.
872
- * @returns The simulated assets amount that would be required.
873
- */
874
- declare function vaultPreviewMint(client: AaveClient, request: VaultPreviewMintRequest): ResultAsync<TokenAmount, UnexpectedError>;
875
- /**
876
- * Determines the amount of shares that would be burned for a withdrawal.
877
- *
878
- * ```ts
879
- * const result = await vaultPreviewWithdraw(client, {
880
- * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
881
- * chainId: chainId(1),
882
- * amount: bigDecimal('750'),
883
- * });
884
- *
885
- * if (result.isOk()) {
886
- * console.log('Shares to burn:', result.value.amount.value);
887
- * console.log('USD value:', result.value.usd);
888
- * }
889
- * ```
890
- *
891
- * @param client - Aave client.
892
- * @param request - The vault preview withdraw request parameters.
893
- * @returns The simulated shares amount that would be burned.
894
- */
895
- declare function vaultPreviewWithdraw(client: AaveClient, request: VaultPreviewWithdrawRequest): ResultAsync<TokenAmount, UnexpectedError>;
896
- /**
897
- * Determines the amount of assets that would be received for redeeming a specific amount of vault shares.
898
- *
899
- * ```ts
900
- * const result = await vaultPreviewRedeem(client, {
901
- * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
902
- * chainId: chainId(1),
903
- * amount: bigDecimal('200'),
904
- * });
905
- *
906
- * if (result.isOk()) {
907
- * console.log('Assets to receive:', result.value.amount.value);
908
- * console.log('USD value:', result.value.usd);
909
- * }
910
- * ```
911
- *
912
- * @param client - Aave client.
913
- * @param request - The vault preview redeem request parameters.
914
- * @returns The simulated assets amount that would be received.
915
- */
916
- declare function vaultPreviewRedeem(client: AaveClient, request: VaultPreviewRedeemRequest): ResultAsync<TokenAmount, UnexpectedError>;
917
- /**
918
- * Fetches the user transaction history for a vault.
919
- *
920
- * ```ts
921
- * const result = await vaultUserTransactionHistory(client, {
922
- * vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
923
- * chainId: chainId(1),
924
- * user: evmAddress('0x5678901234567890abcdef1234567890abcdef12'),
925
- * });
926
- *
927
- * if (result.isOk()) {
928
- * console.log('Transaction count:', result.value.items.length);
929
- * result.value.items.forEach(tx => {
930
- * if (tx.__typename === 'VaultUserDepositItem') {
931
- * console.log('Deposit:', tx.asset.amount.value, 'shares:', tx.shares.amount.value);
932
- * } else if (tx.__typename === 'VaultUserWithdrawItem') {
933
- * console.log('Withdraw:', tx.asset.amount.value, 'shares:', tx.shares.amount.value);
934
- * }
935
- * });
936
- * }
937
- * ```
938
- *
939
- * @param client - Aave client.
940
- * @param request - The vault user transaction history request parameters.
941
- * @returns The paginated vault user transaction history result.
942
- */
943
- declare function vaultUserTransactionHistory(client: AaveClient, request: VaultUserTransactionHistoryRequest): ResultAsync<PaginatedVaultUserTransactionHistoryResult, UnexpectedError>;
944
-
945
- export { type MarketRequest, type MarketsRequest, approveBorrowCreditDelegation, borrow, borrowAPYHistory, chains, collateralToggle, creditDelegateeAllowance, defaultMarketReservesRequestOrderBy, hasProcessedKnownTransaction, health, healthFactorPreview, liquidate, market, markets, permitTypedData, repay, reserve, supply, supplyAPYHistory, usdExchangeRates, userBorrows, userMarketState, userSetEmode, userSupplies, userTransactionHistory, userVaults, vault, vaultDeploy, vaultDeposit, vaultMintShares, vaultPreviewDeposit, vaultPreviewMint, vaultPreviewRedeem, vaultPreviewWithdraw, vaultRedeemShares, vaultSetFee, vaultUserTransactionHistory, vaultWithdraw, vaultWithdrawFees, vaults, withdraw };