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