@aave/react 0.6.0 → 0.7.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.
- package/dist/chunk-SECI6TSB.js +2 -0
- package/dist/chunk-SECI6TSB.js.map +1 -0
- package/dist/ethers.cjs +2 -0
- package/dist/ethers.cjs.map +1 -0
- package/dist/ethers.d.cts +123 -0
- package/dist/ethers.d.ts +123 -0
- package/dist/ethers.js +2 -0
- package/dist/ethers.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1349 -0
- package/dist/index.d.ts +1349 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/privy.cjs +2 -0
- package/dist/privy.cjs.map +1 -0
- package/dist/privy.d.cts +112 -0
- package/dist/privy.d.ts +112 -0
- package/dist/privy.js +2 -0
- package/dist/privy.js.map +1 -0
- package/dist/tasks-DUn7x8pK.d.cts +87 -0
- package/dist/tasks-DUn7x8pK.d.ts +87 -0
- package/dist/thirdweb.cjs +3 -0
- package/dist/thirdweb.cjs.map +1 -0
- package/dist/thirdweb.d.cts +119 -0
- package/dist/thirdweb.d.ts +119 -0
- package/dist/thirdweb.js +3 -0
- package/dist/thirdweb.js.map +1 -0
- package/dist/viem.cjs +2 -0
- package/dist/viem.cjs.map +1 -0
- package/dist/viem.d.cts +115 -0
- package/dist/viem.d.ts +115 -0
- package/dist/viem.js +2 -0
- package/dist/viem.js.map +1 -0
- package/package.json +4 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1349 @@
|
|
|
1
|
+
import { AaveClient, UnexpectedError } from '@aave/client';
|
|
2
|
+
export * from '@aave/client';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
import { SavingsGhoBalanceRequest, TokenAmount, SavingsGhoWithdrawRequest, ExecutionPlan, SavingsGhoDepositRequest, UserMeritRewardsRequest, UserMeritRewards, Market, ChainsFilter, Chain, UsdExchangeRatesRequest, UsdExchangeRate, HealthFactorPreviewRequest, HealthFactorPreviewResponse, ReserveRequest, Reserve, BorrowAPYHistoryRequest, APYSample, SupplyAPYHistoryRequest, CreditDelegateeAmountRequest, SupplyRequest, BorrowRequest, RepayRequest, WithdrawRequest, UserSetEmodeRequest, TransactionRequest, CollateralToggleRequest, LiquidateRequest, VaultDepositRequest, VaultMintSharesRequest, VaultRedeemSharesRequest, VaultWithdrawRequest, VaultDeployRequest, VaultSetFeeRequest, VaultWithdrawFeesRequest, VaultTransferOwnershipRequest, ApproveBorrowCreditDelegatorRequest, UserSuppliesRequest, MarketUserReserveSupplyPosition, UserBorrowsRequest, MarketUserReserveBorrowPosition, UserMarketStateRequest, MarketUserState, UserTransactionHistoryRequest, PaginatedUserTransactionHistoryResult, VaultRequest, Vault, VaultsRequest, PaginatedVaultsResult, UserVaultsRequest, VaultPreviewDepositRequest, VaultPreviewMintRequest, VaultPreviewWithdrawRequest, VaultPreviewRedeemRequest, VaultUserTransactionHistoryRequest, PaginatedVaultUserTransactionHistoryResult, VaultUserActivityRequest, VaultUserActivityResult } from '@aave/graphql';
|
|
5
|
+
import { U as UseAsyncTask } from './tasks-DUn7x8pK.cjs';
|
|
6
|
+
import { MarketRequest, MarketsRequest } from '@aave/client/actions';
|
|
7
|
+
import '@aave/types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A read hook result.
|
|
11
|
+
*
|
|
12
|
+
* It's a discriminated union of the possible results of a read operation:
|
|
13
|
+
* - Rely on the `loading` value to determine if the `data` or `error` can be evaluated.
|
|
14
|
+
* - If `error` is `undefined`, then `data` value will be available.
|
|
15
|
+
*/
|
|
16
|
+
type ReadResult<T, E = never> = {
|
|
17
|
+
data: undefined;
|
|
18
|
+
error: undefined;
|
|
19
|
+
loading: true;
|
|
20
|
+
} | {
|
|
21
|
+
data: T;
|
|
22
|
+
error: undefined;
|
|
23
|
+
loading: false;
|
|
24
|
+
} | {
|
|
25
|
+
data: undefined;
|
|
26
|
+
error: E;
|
|
27
|
+
loading: false;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
declare const ReadResult: {
|
|
33
|
+
Initial: <T, E = never>() => ReadResult<T, E>;
|
|
34
|
+
Success: <T, E = never>(data: T) => ReadResult<T, E>;
|
|
35
|
+
Failure: <T, E = never>(error: E) => ReadResult<T, E>;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A read hook result that supports React Suspense
|
|
39
|
+
*/
|
|
40
|
+
type SuspenseResult<T> = {
|
|
41
|
+
data: T;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
type Suspendable = {
|
|
48
|
+
suspense: true;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* <AaveProvider> props
|
|
53
|
+
*/
|
|
54
|
+
type AaveProviderProps = {
|
|
55
|
+
/**
|
|
56
|
+
* The children to render
|
|
57
|
+
*/
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* The Aave client instance to use
|
|
61
|
+
*/
|
|
62
|
+
client: AaveClient;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Manages the internal state of the Aave SDK.
|
|
66
|
+
*
|
|
67
|
+
* ```tsx
|
|
68
|
+
* import { AaveProvider, AaveClient, production } from '@aave/react';
|
|
69
|
+
*
|
|
70
|
+
* const client = AaveClient.create({
|
|
71
|
+
* environment: production,
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* function App() {
|
|
75
|
+
* return (
|
|
76
|
+
* <AaveProvider client={client}>
|
|
77
|
+
* // ...
|
|
78
|
+
* </AaveProvider>
|
|
79
|
+
* );
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
declare function AaveProvider({ children, client }: AaveProviderProps): React.JSX.Element;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Retrieve the injected {@link AaveClient} from the context.
|
|
87
|
+
*/
|
|
88
|
+
declare function useAaveClient(): AaveClient;
|
|
89
|
+
|
|
90
|
+
type SavingsGhoBalanceArgs = SavingsGhoBalanceRequest;
|
|
91
|
+
/**
|
|
92
|
+
* Fetches the current sGHO balance for a user.
|
|
93
|
+
*
|
|
94
|
+
* This signature supports React Suspense:
|
|
95
|
+
*
|
|
96
|
+
* ```tsx
|
|
97
|
+
* const { data } = useSavingsGhoBalance({
|
|
98
|
+
* user: evmAddress('0x742d35cc…'),
|
|
99
|
+
* suspense: true,
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
declare function useSavingsGhoBalance(args: SavingsGhoBalanceArgs & Suspendable): SuspenseResult<TokenAmount>;
|
|
104
|
+
/**
|
|
105
|
+
* Fetches the current sGHO balance for a user.
|
|
106
|
+
*
|
|
107
|
+
* ```tsx
|
|
108
|
+
* const { data, error, loading } = useSavingsGhoBalance({
|
|
109
|
+
* user: evmAddress('0x742d35cc…'),
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function useSavingsGhoBalance(args: SavingsGhoBalanceArgs): ReadResult<TokenAmount>;
|
|
114
|
+
/**
|
|
115
|
+
* A hook that provides a way to withdraw sGHO.
|
|
116
|
+
*
|
|
117
|
+
* ```ts
|
|
118
|
+
* const [withdraw, withdrawing] = useSavingsGhoWithdraw();
|
|
119
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
120
|
+
*
|
|
121
|
+
* const loading = withdrawing.loading && sending.loading;
|
|
122
|
+
* const error = withdrawing.error || sending.error;
|
|
123
|
+
*
|
|
124
|
+
* // …
|
|
125
|
+
*
|
|
126
|
+
* const result = await withdraw({ ... })
|
|
127
|
+
* .andThen((plan) => {
|
|
128
|
+
* switch (plan.__typename) {
|
|
129
|
+
* case 'TransactionRequest':
|
|
130
|
+
* return sendTransaction(plan);
|
|
131
|
+
*
|
|
132
|
+
* case 'ApprovalRequired':
|
|
133
|
+
* return sendTransaction(plan.approval)
|
|
134
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
135
|
+
*
|
|
136
|
+
* case 'InsufficientBalanceError':
|
|
137
|
+
* return errAsync(
|
|
138
|
+
* new Error(`Insufficient balance to withdraw: ${plan.required.value} is the maximum withdrawal allowed.`)
|
|
139
|
+
* );
|
|
140
|
+
* }
|
|
141
|
+
* });
|
|
142
|
+
*
|
|
143
|
+
* if (result.isErr()) {
|
|
144
|
+
* console.error(result.error);
|
|
145
|
+
* return;
|
|
146
|
+
* }
|
|
147
|
+
*
|
|
148
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
declare function useSavingsGhoWithdraw(): UseAsyncTask<SavingsGhoWithdrawRequest, ExecutionPlan, UnexpectedError>;
|
|
152
|
+
/**
|
|
153
|
+
* A hook that provides a way to deposit GHO into sGHO.
|
|
154
|
+
*
|
|
155
|
+
* ```ts
|
|
156
|
+
* const [deposit, depositing] = useSavingsGhoDeposit();
|
|
157
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
158
|
+
*
|
|
159
|
+
* const loading = depositing.loading && sending.loading;
|
|
160
|
+
* const error = depositing.error || sending.error;
|
|
161
|
+
*
|
|
162
|
+
* // …
|
|
163
|
+
*
|
|
164
|
+
* const result = await deposit({ ... })
|
|
165
|
+
* .andThen((plan) => {
|
|
166
|
+
* switch (plan.__typename) {
|
|
167
|
+
* case 'TransactionRequest':
|
|
168
|
+
* return sendTransaction(plan);
|
|
169
|
+
*
|
|
170
|
+
* case 'ApprovalRequired':
|
|
171
|
+
* return sendTransaction(plan.approval)
|
|
172
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
173
|
+
*
|
|
174
|
+
* case 'InsufficientBalanceError':
|
|
175
|
+
* return errAsync(
|
|
176
|
+
* new Error(`Insufficient balance: ${plan.required.value} required.`)
|
|
177
|
+
* );
|
|
178
|
+
* }
|
|
179
|
+
* });
|
|
180
|
+
*
|
|
181
|
+
* if (result.isErr()) {
|
|
182
|
+
* console.error(result.error);
|
|
183
|
+
* return;
|
|
184
|
+
* }
|
|
185
|
+
*
|
|
186
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
declare function useSavingsGhoDeposit(): UseAsyncTask<SavingsGhoDepositRequest, ExecutionPlan, UnexpectedError>;
|
|
190
|
+
|
|
191
|
+
type UserMeritRewardsArgs = UserMeritRewardsRequest;
|
|
192
|
+
/**
|
|
193
|
+
* Fetches Merit claim rewards for a user with the transaction request to claim them.
|
|
194
|
+
*
|
|
195
|
+
* This signature supports React Suspense:
|
|
196
|
+
*
|
|
197
|
+
* ```tsx
|
|
198
|
+
* const { data } = useUserMeritRewards({
|
|
199
|
+
* user: evmAddress('0x742d35cc…'),
|
|
200
|
+
* chainId: chainId(1),
|
|
201
|
+
* suspense: true,
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
declare function useUserMeritRewards(args: UserMeritRewardsArgs & Suspendable): SuspenseResult<UserMeritRewards | null>;
|
|
206
|
+
/**
|
|
207
|
+
* Fetches Merit claim rewards for a user with the transaction request to claim them.
|
|
208
|
+
*
|
|
209
|
+
* ```tsx
|
|
210
|
+
* const { data, loading } = useUserMeritRewards({
|
|
211
|
+
* user: evmAddress('0x742d35cc…'),
|
|
212
|
+
* chainId: chainId(1),
|
|
213
|
+
* });
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare function useUserMeritRewards(args: UserMeritRewardsArgs): ReadResult<UserMeritRewards | null>;
|
|
217
|
+
|
|
218
|
+
type UseAaveMarketArgs = MarketRequest;
|
|
219
|
+
/**
|
|
220
|
+
* Fetch a single Aave Market.
|
|
221
|
+
*
|
|
222
|
+
* This signature supports React Suspense:
|
|
223
|
+
*
|
|
224
|
+
* ```tsx
|
|
225
|
+
* const { data } = useAaveMarket({
|
|
226
|
+
* address: evmAddress('0x8787…'),
|
|
227
|
+
* chainId: chainId(1),
|
|
228
|
+
* suspense: true,
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
declare function useAaveMarket(args: UseAaveMarketArgs & Suspendable): SuspenseResult<Market | null>;
|
|
233
|
+
/**
|
|
234
|
+
* Fetch a single Aave Market.
|
|
235
|
+
*
|
|
236
|
+
* ```tsx
|
|
237
|
+
* const { data, error, loading } = useAaveMarket({
|
|
238
|
+
* address: evmAddress('0x8787…'),
|
|
239
|
+
* chainId: chainId(1),
|
|
240
|
+
* });
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
declare function useAaveMarket(args: UseAaveMarketArgs): ReadResult<Market | null>;
|
|
244
|
+
type UseAaveMarketsArgs = MarketsRequest;
|
|
245
|
+
/**
|
|
246
|
+
* Fetch all Aave Markets for the specified chains.
|
|
247
|
+
*
|
|
248
|
+
* This signature supports React Suspense:
|
|
249
|
+
*
|
|
250
|
+
* ```tsx
|
|
251
|
+
* const { data } = useAaveMarkets({
|
|
252
|
+
* chainIds: [chainId(1), chainId(8453)],
|
|
253
|
+
* user: evmAddress('0x742d35cc...'),
|
|
254
|
+
* suspense: true
|
|
255
|
+
* });
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
declare function useAaveMarkets(args: UseAaveMarketsArgs & Suspendable): SuspenseResult<Market[]>;
|
|
259
|
+
/**
|
|
260
|
+
* Fetch all Aave Markets for the specified chains.
|
|
261
|
+
*
|
|
262
|
+
* ```tsx
|
|
263
|
+
* const { data, error, loading } = useAaveMarkets({
|
|
264
|
+
* chainIds: [chainId(1), chainId(8453)],
|
|
265
|
+
* user: evmAddress('0x742d35cc...'),
|
|
266
|
+
* });
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
declare function useAaveMarkets(args: UseAaveMarketsArgs): ReadResult<Market[]>;
|
|
270
|
+
|
|
271
|
+
type UseAaveChainsArgs = {
|
|
272
|
+
filter?: ChainsFilter;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Fetch all supported Aave chains.
|
|
276
|
+
*
|
|
277
|
+
* This signature supports React Suspense:
|
|
278
|
+
*
|
|
279
|
+
* ```tsx
|
|
280
|
+
* const { data } = useAaveChains({
|
|
281
|
+
* filter: ChainsFilter.MAINNET_ONLY,
|
|
282
|
+
* suspense: true,
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
declare function useAaveChains(args: UseAaveChainsArgs & Suspendable): SuspenseResult<Chain[]>;
|
|
287
|
+
/**
|
|
288
|
+
* Fetch all supported Aave chains.
|
|
289
|
+
*
|
|
290
|
+
* ```tsx
|
|
291
|
+
* const { data, error, loading } = useAaveChains({
|
|
292
|
+
* filter: ChainsFilter.MAINNET_ONLY,
|
|
293
|
+
* });
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
declare function useAaveChains(args: UseAaveChainsArgs): ReadResult<Chain[]>;
|
|
297
|
+
/**
|
|
298
|
+
* Health check query.
|
|
299
|
+
*
|
|
300
|
+
* This signature supports React Suspense:
|
|
301
|
+
*
|
|
302
|
+
* ```tsx
|
|
303
|
+
* const { data } = useAaveHealth({
|
|
304
|
+
* suspense: true,
|
|
305
|
+
* });
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
declare function useAaveHealth(args: Suspendable): SuspenseResult<boolean>;
|
|
309
|
+
/**
|
|
310
|
+
* Health check query.
|
|
311
|
+
*
|
|
312
|
+
* ```tsx
|
|
313
|
+
* const { data, error, loading } = useAaveHealth();
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
declare function useAaveHealth(): ReadResult<boolean>;
|
|
317
|
+
type UseUsdExchangeRatesArgs = UsdExchangeRatesRequest;
|
|
318
|
+
/**
|
|
319
|
+
* Fetch USD exchange rates for different tokens on a given market.
|
|
320
|
+
*
|
|
321
|
+
* This signature supports React Suspense:
|
|
322
|
+
*
|
|
323
|
+
* ```tsx
|
|
324
|
+
* const { data } = useUsdExchangeRates({
|
|
325
|
+
* market: evmAddress('0x1234…'),
|
|
326
|
+
* underlyingTokens: [evmAddress('0x5678…'), evmAddress('0x90ab…')],
|
|
327
|
+
* chainId: chainId(1),
|
|
328
|
+
* suspense: true,
|
|
329
|
+
* });
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
declare function useUsdExchangeRates(args: UseUsdExchangeRatesArgs & Suspendable): SuspenseResult<UsdExchangeRate[]>;
|
|
333
|
+
/**
|
|
334
|
+
* Fetch USD exchange rates for different tokens on a given market.
|
|
335
|
+
*
|
|
336
|
+
* ```tsx
|
|
337
|
+
* const { data, error, loading } = useUsdExchangeRates({
|
|
338
|
+
* market: evmAddress('0x1234…'),
|
|
339
|
+
* underlyingTokens: [evmAddress('0x5678…'), evmAddress('0x90ab…')],
|
|
340
|
+
* chainId: chainId(1),
|
|
341
|
+
* });
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
declare function useUsdExchangeRates(args: UseUsdExchangeRatesArgs): ReadResult<UsdExchangeRate[]>;
|
|
345
|
+
/**
|
|
346
|
+
* Determines the health factor after a given action.
|
|
347
|
+
*
|
|
348
|
+
* ```ts
|
|
349
|
+
* const [preview, { loading, error }] = useAaveHealthFactorPreview();
|
|
350
|
+
*
|
|
351
|
+
* // …
|
|
352
|
+
*
|
|
353
|
+
* const result = await preview({
|
|
354
|
+
* action: {
|
|
355
|
+
* borrow: {
|
|
356
|
+
* market: market.address,
|
|
357
|
+
* amount: {
|
|
358
|
+
* erc20: {
|
|
359
|
+
* currency: evmAddress('0x5678…'),
|
|
360
|
+
* value: '1000',
|
|
361
|
+
* },
|
|
362
|
+
* },
|
|
363
|
+
* borrower: evmAddress('0x9abc…'),
|
|
364
|
+
* chainId: market.chain.chainId,
|
|
365
|
+
* },
|
|
366
|
+
* },
|
|
367
|
+
* });
|
|
368
|
+
*
|
|
369
|
+
* if (result.isErr()) {
|
|
370
|
+
* console.error(result.error);
|
|
371
|
+
* } else {
|
|
372
|
+
* console.log(result.value);
|
|
373
|
+
* }
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
declare function useAaveHealthFactorPreview(): UseAsyncTask<HealthFactorPreviewRequest, HealthFactorPreviewResponse, UnexpectedError>;
|
|
377
|
+
|
|
378
|
+
type UseAaveReserveArgs = ReserveRequest;
|
|
379
|
+
/**
|
|
380
|
+
* Fetch a single Aave Reserve.
|
|
381
|
+
*
|
|
382
|
+
* This signature supports React Suspense:
|
|
383
|
+
*
|
|
384
|
+
* ```tsx
|
|
385
|
+
* const { data } = useAaveReserve({
|
|
386
|
+
* market: evmAddress('0x87870bca...'),
|
|
387
|
+
* underlyingToken: evmAddress('0xa0b86a33...'),
|
|
388
|
+
* chainId: chainId(1),
|
|
389
|
+
* suspense: true,
|
|
390
|
+
* });
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
declare function useAaveReserve(args: UseAaveReserveArgs & Suspendable): SuspenseResult<Reserve | null>;
|
|
394
|
+
/**
|
|
395
|
+
* Fetch a single Aave Reserve.
|
|
396
|
+
*
|
|
397
|
+
* ```tsx
|
|
398
|
+
* const { data, error, loading } = useAaveReserve({
|
|
399
|
+
* market: evmAddress('0x87870bca...'),
|
|
400
|
+
* underlyingToken: evmAddress('0xa0b86a33...'),
|
|
401
|
+
* chainId: chainId(1),
|
|
402
|
+
* });
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
declare function useAaveReserve(args: UseAaveReserveArgs): ReadResult<Reserve | null>;
|
|
406
|
+
type UseBorrowAPYHistoryArgs = BorrowAPYHistoryRequest;
|
|
407
|
+
/**
|
|
408
|
+
* Fetches historical borrow APY data for a given underlying asset on a specific market
|
|
409
|
+
* within a defined time window.
|
|
410
|
+
*
|
|
411
|
+
* This signature supports React Suspense:
|
|
412
|
+
*
|
|
413
|
+
* ```tsx
|
|
414
|
+
* const { data } = useBorrowAPYHistory({
|
|
415
|
+
* chainId: chainId(1),
|
|
416
|
+
* underlyingToken: evmAddress('0x742d35cc…'),
|
|
417
|
+
* market: evmAddress('0x24dc35d3c…'),
|
|
418
|
+
* window: TimeWindow.LastWeek
|
|
419
|
+
* suspense: true
|
|
420
|
+
* });
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
declare function useBorrowAPYHistory(args: UseBorrowAPYHistoryArgs & Suspendable): SuspenseResult<APYSample[]>;
|
|
424
|
+
/**
|
|
425
|
+
* Fetches historical borrow APY data for a given underlying asset on a specific market
|
|
426
|
+
* within a defined time window.
|
|
427
|
+
*
|
|
428
|
+
* ```tsx
|
|
429
|
+
* const { data } = useBorrowAPYHistory({
|
|
430
|
+
* chainId: chainId(1),
|
|
431
|
+
* underlyingToken: evmAddress('0x742d35cc…'),
|
|
432
|
+
* market: evmAddress('0x24dc35d3c…'),
|
|
433
|
+
* window: TimeWindow.LastWeek
|
|
434
|
+
* });
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
declare function useBorrowAPYHistory(args: UseBorrowAPYHistoryArgs): ReadResult<APYSample[]>;
|
|
438
|
+
type UseSupplyAPYHistoryArgs = SupplyAPYHistoryRequest;
|
|
439
|
+
/**
|
|
440
|
+
* Fetches historical supply APY data for a given underlying asset on a specific market
|
|
441
|
+
* within a defined time window.
|
|
442
|
+
*
|
|
443
|
+
* This signature supports React Suspense:
|
|
444
|
+
*
|
|
445
|
+
* ```tsx
|
|
446
|
+
* const { data } = useSupplyAPYHistory({
|
|
447
|
+
* chainId: chainId(1),
|
|
448
|
+
* underlyingToken: evmAddress('0x742d35cc…'),
|
|
449
|
+
* market: evmAddress('0x24dc35d3c…'),
|
|
450
|
+
* window: TimeWindow.LastWeek,
|
|
451
|
+
* suspense: true
|
|
452
|
+
* });
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
declare function useSupplyAPYHistory(args: UseSupplyAPYHistoryArgs & Suspendable): SuspenseResult<APYSample[]>;
|
|
456
|
+
/**
|
|
457
|
+
* Fetches historical supply APY data for a given underlying asset on a specific market
|
|
458
|
+
* within a defined time window.
|
|
459
|
+
*
|
|
460
|
+
* ```tsx
|
|
461
|
+
* const { data } = useSupplyAPYHistory({
|
|
462
|
+
* chainId: chainId(1),
|
|
463
|
+
* underlyingToken: evmAddress('0x742d35cc…'),
|
|
464
|
+
* market: evmAddress('0x24dc35d3c…'),
|
|
465
|
+
* window: TimeWindow.LastWeek
|
|
466
|
+
* });
|
|
467
|
+
* ```
|
|
468
|
+
*/
|
|
469
|
+
declare function useSupplyAPYHistory(args: UseSupplyAPYHistoryArgs): ReadResult<APYSample[]>;
|
|
470
|
+
type UseCreditDelegateeAllowanceArgs = CreditDelegateeAmountRequest;
|
|
471
|
+
/**
|
|
472
|
+
* Get the amount delegated to the credit delegatee that can borrow on your behalf.
|
|
473
|
+
*
|
|
474
|
+
* This signature supports React Suspense:
|
|
475
|
+
*
|
|
476
|
+
* ```tsx
|
|
477
|
+
* const { data } = useCreditDelegateeAllowance({
|
|
478
|
+
* market: evmAddress('0x87870bca...'),
|
|
479
|
+
* underlyingToken: evmAddress('0xa0b86a33...'),
|
|
480
|
+
* user: evmAddress('0x742d35cc...'),
|
|
481
|
+
* delegatee: evmAddress('0x5678...'),
|
|
482
|
+
* chainId: chainId(1),
|
|
483
|
+
* suspense: true,
|
|
484
|
+
* });
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
declare function useCreditDelegateeAllowance(args: UseCreditDelegateeAllowanceArgs & Suspendable): SuspenseResult<TokenAmount>;
|
|
488
|
+
/**
|
|
489
|
+
* Get the amount delegated to the credit delegatee that can borrow on your behalf.
|
|
490
|
+
*
|
|
491
|
+
* ```tsx
|
|
492
|
+
* const { data, error, loading } = useCreditDelegateeAllowance({
|
|
493
|
+
* market: evmAddress('0x87870bca...'),
|
|
494
|
+
* underlyingToken: evmAddress('0xa0b86a33...'),
|
|
495
|
+
* user: evmAddress('0x742d35cc...'),
|
|
496
|
+
* delegatee: evmAddress('0x5678...'),
|
|
497
|
+
* chainId: chainId(1),
|
|
498
|
+
* });
|
|
499
|
+
* ```
|
|
500
|
+
*/
|
|
501
|
+
declare function useCreditDelegateeAllowance(args: UseCreditDelegateeAllowanceArgs): ReadResult<TokenAmount>;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* A hook that provides a way to supply assets to an Aave market.
|
|
505
|
+
*
|
|
506
|
+
* ```ts
|
|
507
|
+
* const [supply, supplying] = useSupply();
|
|
508
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
509
|
+
*
|
|
510
|
+
* const loading = supplying.loading && sending.loading;
|
|
511
|
+
* const error = supplying.error || sending.error;
|
|
512
|
+
*
|
|
513
|
+
* // …
|
|
514
|
+
*
|
|
515
|
+
* const result = await supply({ ... })
|
|
516
|
+
* .andThen((plan) => {
|
|
517
|
+
* switch (plan.__typename) {
|
|
518
|
+
* case 'TransactionRequest':
|
|
519
|
+
* return sendTransaction(plan);
|
|
520
|
+
*
|
|
521
|
+
* case 'ApprovalRequired':
|
|
522
|
+
* return sendTransaction(plan.approval)
|
|
523
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
524
|
+
*
|
|
525
|
+
* case 'InsufficientBalanceError':
|
|
526
|
+
* return errAsync(
|
|
527
|
+
* new Error(`Insufficient balance: ${plan.required.value} required.`)
|
|
528
|
+
* );
|
|
529
|
+
* }
|
|
530
|
+
* });
|
|
531
|
+
*
|
|
532
|
+
* if (result.isErr()) {
|
|
533
|
+
* console.error(result.error);
|
|
534
|
+
* return;
|
|
535
|
+
* }
|
|
536
|
+
*
|
|
537
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
declare function useSupply(): UseAsyncTask<SupplyRequest, ExecutionPlan, UnexpectedError>;
|
|
541
|
+
/**
|
|
542
|
+
* A hook that provides a way to borrow assets from an Aave market.
|
|
543
|
+
*
|
|
544
|
+
* ```ts
|
|
545
|
+
* const [borrow, borrowing] = useBorrow();
|
|
546
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
547
|
+
*
|
|
548
|
+
* const loading = borrowing.loading && sending.loading;
|
|
549
|
+
* const error = borrowing.error || sending.error;
|
|
550
|
+
*
|
|
551
|
+
* // …
|
|
552
|
+
*
|
|
553
|
+
* const result = await borrow({ ... })
|
|
554
|
+
* .andThen((plan) => {
|
|
555
|
+
* switch (plan.__typename) {
|
|
556
|
+
* case 'TransactionRequest':
|
|
557
|
+
* return sendTransaction(plan);
|
|
558
|
+
*
|
|
559
|
+
* case 'ApprovalRequired':
|
|
560
|
+
* return sendTransaction(plan.approval)
|
|
561
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
562
|
+
*
|
|
563
|
+
* case 'InsufficientBalanceError':
|
|
564
|
+
* return errAsync(
|
|
565
|
+
* new Error(`Insufficient balance: ${plan.required.value} required.`)
|
|
566
|
+
* );
|
|
567
|
+
* }
|
|
568
|
+
* });
|
|
569
|
+
*
|
|
570
|
+
* if (result.isErr()) {
|
|
571
|
+
* console.error(result.error);
|
|
572
|
+
* return;
|
|
573
|
+
* }
|
|
574
|
+
*
|
|
575
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
578
|
+
declare function useBorrow(): UseAsyncTask<BorrowRequest, ExecutionPlan, UnexpectedError>;
|
|
579
|
+
/**
|
|
580
|
+
* A hook that provides a way to repay borrowed assets to an Aave market.
|
|
581
|
+
*
|
|
582
|
+
* ```ts
|
|
583
|
+
* const [repay, repaying] = useRepay();
|
|
584
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
585
|
+
*
|
|
586
|
+
* const loading = repaying.loading && sending.loading;
|
|
587
|
+
* const error = repaying.error || sending.error;
|
|
588
|
+
*
|
|
589
|
+
* // …
|
|
590
|
+
*
|
|
591
|
+
* const result = await repay({ ... })
|
|
592
|
+
* .andThen((plan) => {
|
|
593
|
+
* switch (plan.__typename) {
|
|
594
|
+
* case 'TransactionRequest':
|
|
595
|
+
* return sendTransaction(plan);
|
|
596
|
+
*
|
|
597
|
+
* case 'ApprovalRequired':
|
|
598
|
+
* return sendTransaction(plan.approval)
|
|
599
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
600
|
+
*
|
|
601
|
+
* case 'InsufficientBalanceError':
|
|
602
|
+
* return errAsync(
|
|
603
|
+
* new Error(`Insufficient balance: ${plan.required.value} required.`)
|
|
604
|
+
* );
|
|
605
|
+
* }
|
|
606
|
+
* });
|
|
607
|
+
*
|
|
608
|
+
* if (result.isErr()) {
|
|
609
|
+
* console.error(result.error);
|
|
610
|
+
* return;
|
|
611
|
+
* }
|
|
612
|
+
*
|
|
613
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
614
|
+
* ```
|
|
615
|
+
*/
|
|
616
|
+
declare function useRepay(): UseAsyncTask<RepayRequest, ExecutionPlan, UnexpectedError>;
|
|
617
|
+
/**
|
|
618
|
+
* A hook that provides a way to withdraw supplied assets from an Aave market.
|
|
619
|
+
*
|
|
620
|
+
* ```ts
|
|
621
|
+
* const [withdraw, withdrawing] = useWithdraw();
|
|
622
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
623
|
+
*
|
|
624
|
+
* const loading = withdrawing.loading && sending.loading;
|
|
625
|
+
* const error = withdrawing.error || sending.error;
|
|
626
|
+
*
|
|
627
|
+
* // …
|
|
628
|
+
*
|
|
629
|
+
* const result = await withdraw({ ... })
|
|
630
|
+
* .andThen((plan) => {
|
|
631
|
+
* switch (plan.__typename) {
|
|
632
|
+
* case 'TransactionRequest':
|
|
633
|
+
* return sendTransaction(plan);
|
|
634
|
+
*
|
|
635
|
+
* case 'ApprovalRequired':
|
|
636
|
+
* return sendTransaction(plan.approval)
|
|
637
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
638
|
+
*
|
|
639
|
+
* case 'InsufficientBalanceError':
|
|
640
|
+
* return errAsync(
|
|
641
|
+
* new Error(`Insufficient balance: ${plan.required.value} required.`)
|
|
642
|
+
* );
|
|
643
|
+
* }
|
|
644
|
+
* });
|
|
645
|
+
*
|
|
646
|
+
* if (result.isErr()) {
|
|
647
|
+
* console.error(result.error);
|
|
648
|
+
* return;
|
|
649
|
+
* }
|
|
650
|
+
*
|
|
651
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
652
|
+
* ```
|
|
653
|
+
*/
|
|
654
|
+
declare function useWithdraw(): UseAsyncTask<WithdrawRequest, ExecutionPlan, UnexpectedError>;
|
|
655
|
+
/**
|
|
656
|
+
* A hook that provides a way to set eMode for a user.
|
|
657
|
+
*
|
|
658
|
+
* ```ts
|
|
659
|
+
* const [setUserEMode, setting] = useUserEMode();
|
|
660
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
661
|
+
*
|
|
662
|
+
* const loading = setting.loading && sending.loading;
|
|
663
|
+
* const error = setting.error || sending.error;
|
|
664
|
+
*
|
|
665
|
+
* // …
|
|
666
|
+
*
|
|
667
|
+
* const result = await setUserEMode({ ... })
|
|
668
|
+
* .andThen(sendTransaction);
|
|
669
|
+
*
|
|
670
|
+
* if (result.isErr()) {
|
|
671
|
+
* console.error(result.error);
|
|
672
|
+
* return;
|
|
673
|
+
* }
|
|
674
|
+
*
|
|
675
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
declare function useUserEMode(): UseAsyncTask<UserSetEmodeRequest, TransactionRequest, UnexpectedError>;
|
|
679
|
+
/**
|
|
680
|
+
* A hook that provides a way to enable/disable a specific supplied asset as collateral.
|
|
681
|
+
*
|
|
682
|
+
* ```ts
|
|
683
|
+
* const [toggle, toggling] = useCollateralToggle();
|
|
684
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
685
|
+
*
|
|
686
|
+
* const loading = toggling.loading && sending.loading;
|
|
687
|
+
* const error = toggling.error || sending.error;
|
|
688
|
+
*
|
|
689
|
+
* // …
|
|
690
|
+
*
|
|
691
|
+
* const result = await toggle({ ... })
|
|
692
|
+
* .andThen(sendTransaction);
|
|
693
|
+
*
|
|
694
|
+
* if (result.isErr()) {
|
|
695
|
+
* console.error(result.error);
|
|
696
|
+
* return;
|
|
697
|
+
* }
|
|
698
|
+
*
|
|
699
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
declare function useCollateralToggle(): UseAsyncTask<CollateralToggleRequest, TransactionRequest, UnexpectedError>;
|
|
703
|
+
/**
|
|
704
|
+
* A hook that provides a way to liquidate a non-healthy position with Health Factor below 1.
|
|
705
|
+
*
|
|
706
|
+
* ```ts
|
|
707
|
+
* const [liquidate, liquidating] = useLiquidate();
|
|
708
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
709
|
+
*
|
|
710
|
+
* const loading = liquidating.loading && sending.loading;
|
|
711
|
+
* const error = liquidating.error || sending.error;
|
|
712
|
+
*
|
|
713
|
+
* // …
|
|
714
|
+
*
|
|
715
|
+
* const result = await liquidate({ ... })
|
|
716
|
+
* .andThen(sendTransaction);
|
|
717
|
+
*
|
|
718
|
+
* if (result.isErr()) {
|
|
719
|
+
* console.error(result.error);
|
|
720
|
+
* return;
|
|
721
|
+
* }
|
|
722
|
+
*
|
|
723
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
declare function useLiquidate(): UseAsyncTask<LiquidateRequest, TransactionRequest, UnexpectedError>;
|
|
727
|
+
/**
|
|
728
|
+
* A hook that provides a way to deposit assets into a vault.
|
|
729
|
+
*
|
|
730
|
+
* ```ts
|
|
731
|
+
* const [deposit, depositing] = useVaultDeposit();
|
|
732
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
733
|
+
*
|
|
734
|
+
* const loading = depositing.loading && sending.loading;
|
|
735
|
+
* const error = depositing.error || sending.error;
|
|
736
|
+
*
|
|
737
|
+
* // …
|
|
738
|
+
*
|
|
739
|
+
* const result = await deposit({ ... })
|
|
740
|
+
* .andThen((plan) => {
|
|
741
|
+
* switch (plan.__typename) {
|
|
742
|
+
* case 'TransactionRequest':
|
|
743
|
+
* return sendTransaction(plan);
|
|
744
|
+
*
|
|
745
|
+
* case 'ApprovalRequired':
|
|
746
|
+
* return sendTransaction(plan.approval)
|
|
747
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
748
|
+
*
|
|
749
|
+
* case 'InsufficientBalanceError':
|
|
750
|
+
* return errAsync(
|
|
751
|
+
* new Error(`Insufficient balance: ${plan.required.value} required.`)
|
|
752
|
+
* );
|
|
753
|
+
* }
|
|
754
|
+
* });
|
|
755
|
+
*
|
|
756
|
+
* if (result.isErr()) {
|
|
757
|
+
* console.error(result.error);
|
|
758
|
+
* return;
|
|
759
|
+
* }
|
|
760
|
+
*
|
|
761
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
762
|
+
* ```
|
|
763
|
+
*/
|
|
764
|
+
declare function useVaultDeposit(): UseAsyncTask<VaultDepositRequest, ExecutionPlan, UnexpectedError>;
|
|
765
|
+
/**
|
|
766
|
+
* A hook that provides a way to mint vault shares.
|
|
767
|
+
*
|
|
768
|
+
* ```ts
|
|
769
|
+
* const [mint, minting] = useVaultMintShares();
|
|
770
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
771
|
+
*
|
|
772
|
+
* const loading = minting.loading && sending.loading;
|
|
773
|
+
* const error = minting.error || sending.error;
|
|
774
|
+
*
|
|
775
|
+
* // …
|
|
776
|
+
*
|
|
777
|
+
* const result = await mint({ ... })
|
|
778
|
+
* .andThen((plan) => {
|
|
779
|
+
* switch (plan.__typename) {
|
|
780
|
+
* case 'TransactionRequest':
|
|
781
|
+
* return sendTransaction(plan);
|
|
782
|
+
*
|
|
783
|
+
* case 'ApprovalRequired':
|
|
784
|
+
* return sendTransaction(plan.approval)
|
|
785
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
786
|
+
*
|
|
787
|
+
* case 'InsufficientBalanceError':
|
|
788
|
+
* return errAsync(
|
|
789
|
+
* new Error(`Insufficient balance: ${plan.required.value} required.`)
|
|
790
|
+
* );
|
|
791
|
+
* }
|
|
792
|
+
* });
|
|
793
|
+
*
|
|
794
|
+
* if (result.isErr()) {
|
|
795
|
+
* console.error(result.error);
|
|
796
|
+
* return;
|
|
797
|
+
* }
|
|
798
|
+
*
|
|
799
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
800
|
+
* ```
|
|
801
|
+
*/
|
|
802
|
+
declare function useVaultMintShares(): UseAsyncTask<VaultMintSharesRequest, ExecutionPlan, UnexpectedError>;
|
|
803
|
+
/**
|
|
804
|
+
* A hook that provides a way to redeem vault shares.
|
|
805
|
+
*
|
|
806
|
+
* ```ts
|
|
807
|
+
* const [redeem, redeeming] = useVaultRedeemShares();
|
|
808
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
809
|
+
*
|
|
810
|
+
* const loading = redeeming.loading && sending.loading;
|
|
811
|
+
* const error = redeeming.error || sending.error;
|
|
812
|
+
*
|
|
813
|
+
* // …
|
|
814
|
+
*
|
|
815
|
+
* const result = await redeem({ ... })
|
|
816
|
+
* .andThen(sendTransaction);
|
|
817
|
+
*
|
|
818
|
+
* if (result.isErr()) {
|
|
819
|
+
* console.error(result.error);
|
|
820
|
+
* return;
|
|
821
|
+
* }
|
|
822
|
+
*
|
|
823
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
824
|
+
* ```
|
|
825
|
+
*/
|
|
826
|
+
declare function useVaultRedeemShares(): UseAsyncTask<VaultRedeemSharesRequest, TransactionRequest, UnexpectedError>;
|
|
827
|
+
/**
|
|
828
|
+
* A hook that provides a way to withdraw assets from a vault.
|
|
829
|
+
*
|
|
830
|
+
* ```ts
|
|
831
|
+
* const [withdraw, withdrawing] = useVaultWithdraw();
|
|
832
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
833
|
+
*
|
|
834
|
+
* const loading = withdrawing.loading && sending.loading;
|
|
835
|
+
* const error = withdrawing.error || sending.error;
|
|
836
|
+
*
|
|
837
|
+
* // …
|
|
838
|
+
*
|
|
839
|
+
* const result = await withdraw({ ... })
|
|
840
|
+
* .andThen(sendTransaction);
|
|
841
|
+
*
|
|
842
|
+
* if (result.isErr()) {
|
|
843
|
+
* console.error(result.error);
|
|
844
|
+
* return;
|
|
845
|
+
* }
|
|
846
|
+
*
|
|
847
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
848
|
+
* ```
|
|
849
|
+
*/
|
|
850
|
+
declare function useVaultWithdraw(): UseAsyncTask<VaultWithdrawRequest, TransactionRequest, UnexpectedError>;
|
|
851
|
+
/**
|
|
852
|
+
* A hook that provides a way to deploy a vault.
|
|
853
|
+
*
|
|
854
|
+
* ```ts
|
|
855
|
+
* const [deploy, deploying] = useVaultDeploy();
|
|
856
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
857
|
+
*
|
|
858
|
+
* const loading = deploying.loading && sending.loading;
|
|
859
|
+
* const error = deploying.error || sending.error;
|
|
860
|
+
*
|
|
861
|
+
* // …
|
|
862
|
+
*
|
|
863
|
+
* const result = await deploy({ ... })
|
|
864
|
+
* .andThen((plan) => {
|
|
865
|
+
* switch (plan.__typename) {
|
|
866
|
+
* case 'TransactionRequest':
|
|
867
|
+
* return sendTransaction(plan);
|
|
868
|
+
*
|
|
869
|
+
* case 'ApprovalRequired':
|
|
870
|
+
* return sendTransaction(plan.approval)
|
|
871
|
+
* .andThen(() => sendTransaction(plan.originalTransaction));
|
|
872
|
+
*
|
|
873
|
+
* case 'InsufficientBalanceError':
|
|
874
|
+
* return errAsync(
|
|
875
|
+
* new Error(`Insufficient balance: ${plan.required.value} required.`)
|
|
876
|
+
* );
|
|
877
|
+
* }
|
|
878
|
+
* });
|
|
879
|
+
*
|
|
880
|
+
* if (result.isErr()) {
|
|
881
|
+
* console.error(result.error);
|
|
882
|
+
* return;
|
|
883
|
+
* }
|
|
884
|
+
*
|
|
885
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
886
|
+
* ```
|
|
887
|
+
*/
|
|
888
|
+
declare function useVaultDeploy(): UseAsyncTask<VaultDeployRequest, ExecutionPlan, UnexpectedError>;
|
|
889
|
+
/**
|
|
890
|
+
* A hook that provides a way to set vault fee.
|
|
891
|
+
*
|
|
892
|
+
* ```ts
|
|
893
|
+
* const [setFee, setting] = useVaultSetFee();
|
|
894
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
895
|
+
*
|
|
896
|
+
* const loading = setting.loading && sending.loading;
|
|
897
|
+
* const error = setting.error || sending.error;
|
|
898
|
+
*
|
|
899
|
+
* // …
|
|
900
|
+
*
|
|
901
|
+
* const result = await setFee({ ... })
|
|
902
|
+
* .andThen(sendTransaction);
|
|
903
|
+
*
|
|
904
|
+
* if (result.isErr()) {
|
|
905
|
+
* console.error(result.error);
|
|
906
|
+
* return;
|
|
907
|
+
* }
|
|
908
|
+
*
|
|
909
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
910
|
+
* ```
|
|
911
|
+
*/
|
|
912
|
+
declare function useVaultSetFee(): UseAsyncTask<VaultSetFeeRequest, TransactionRequest, UnexpectedError>;
|
|
913
|
+
/**
|
|
914
|
+
* A hook that provides a way to withdraw vault fees.
|
|
915
|
+
*
|
|
916
|
+
* ```ts
|
|
917
|
+
* const [withdraw, withdrawing] = useVaultWithdrawFees();
|
|
918
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
919
|
+
*
|
|
920
|
+
* const loading = withdrawing.loading && sending.loading;
|
|
921
|
+
* const error = withdrawing.error || sending.error;
|
|
922
|
+
*
|
|
923
|
+
* // …
|
|
924
|
+
*
|
|
925
|
+
* const result = await withdraw({ ... })
|
|
926
|
+
* .andThen(sendTransaction);
|
|
927
|
+
*
|
|
928
|
+
* if (result.isErr()) {
|
|
929
|
+
* console.error(result.error);
|
|
930
|
+
* return;
|
|
931
|
+
* }
|
|
932
|
+
*
|
|
933
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
934
|
+
* ```
|
|
935
|
+
*/
|
|
936
|
+
declare function useVaultWithdrawFees(): UseAsyncTask<VaultWithdrawFeesRequest, TransactionRequest, UnexpectedError>;
|
|
937
|
+
/**
|
|
938
|
+
* A hook that provides a way to transfer ownership of a vault.
|
|
939
|
+
*
|
|
940
|
+
* ```ts
|
|
941
|
+
* const [transferOwnership, transferring] = useVaultTransferOwnership();
|
|
942
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
943
|
+
*
|
|
944
|
+
* const loading = transferring.loading && sending.loading;
|
|
945
|
+
* const error = transferring.error || sending.error;
|
|
946
|
+
*
|
|
947
|
+
* // …
|
|
948
|
+
*
|
|
949
|
+
* const result = await transferOwnership({ ... })
|
|
950
|
+
* .andThen(sendTransaction);
|
|
951
|
+
*
|
|
952
|
+
* if (result.isErr()) {
|
|
953
|
+
* console.error(result.error);
|
|
954
|
+
* return;
|
|
955
|
+
* }
|
|
956
|
+
*
|
|
957
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
958
|
+
* ```
|
|
959
|
+
*/
|
|
960
|
+
declare function useVaultTransferOwnership(): UseAsyncTask<VaultTransferOwnershipRequest, TransactionRequest, UnexpectedError>;
|
|
961
|
+
/**
|
|
962
|
+
* A hook that provides a way to approve a credit borrow delegator to be able to borrow on your behalf.
|
|
963
|
+
*
|
|
964
|
+
* ```ts
|
|
965
|
+
* const [approve, approving] = useApproveBorrowCreditDelegation();
|
|
966
|
+
* const [sendTransaction, sending] = useSendTransaction(wallet);
|
|
967
|
+
*
|
|
968
|
+
* const loading = approving.loading && sending.loading;
|
|
969
|
+
* const error = approving.error || sending.error;
|
|
970
|
+
*
|
|
971
|
+
* // …
|
|
972
|
+
*
|
|
973
|
+
* const result = await approve({
|
|
974
|
+
* market: evmAddress('0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2'),
|
|
975
|
+
* underlyingToken: evmAddress('0xa0b86a33e6441c8c5f0bb9b7e5e1f8bbf5b78b5c'),
|
|
976
|
+
* amount: '1000',
|
|
977
|
+
* user: evmAddress('0x742d35cc6e5c4ce3b69a2a8c7c8e5f7e9a0b1234'),
|
|
978
|
+
* delegatee: evmAddress('0x5678…'),
|
|
979
|
+
* chainId: chainId(1),
|
|
980
|
+
* }).andThen(sendTransaction);
|
|
981
|
+
*
|
|
982
|
+
* if (result.isErr()) {
|
|
983
|
+
* console.error(result.error);
|
|
984
|
+
* return;
|
|
985
|
+
* }
|
|
986
|
+
*
|
|
987
|
+
* console.log('Transaction sent with hash:', result.value);
|
|
988
|
+
* ```
|
|
989
|
+
*/
|
|
990
|
+
declare function useApproveBorrowCreditDelegation(): UseAsyncTask<ApproveBorrowCreditDelegatorRequest, TransactionRequest, UnexpectedError>;
|
|
991
|
+
|
|
992
|
+
type UseUserSuppliesArgs = UserSuppliesRequest;
|
|
993
|
+
/**
|
|
994
|
+
* Fetch all user supply positions.
|
|
995
|
+
*
|
|
996
|
+
* This signature supports React Suspense:
|
|
997
|
+
*
|
|
998
|
+
* ```tsx
|
|
999
|
+
* const { data } = useUserSupplies({
|
|
1000
|
+
* markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],
|
|
1001
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1002
|
+
* orderBy: { name: OrderDirection.ASC },
|
|
1003
|
+
* suspense: true,
|
|
1004
|
+
* });
|
|
1005
|
+
* ```
|
|
1006
|
+
*/
|
|
1007
|
+
declare function useUserSupplies(args: UseUserSuppliesArgs & Suspendable): SuspenseResult<MarketUserReserveSupplyPosition[]>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Fetch all user supply positions.
|
|
1010
|
+
*
|
|
1011
|
+
* ```tsx
|
|
1012
|
+
* const { data, error, loading } = useUserSupplies({
|
|
1013
|
+
* markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],
|
|
1014
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1015
|
+
* orderBy: { name: OrderDirection.ASC },
|
|
1016
|
+
* });
|
|
1017
|
+
* ```
|
|
1018
|
+
*/
|
|
1019
|
+
declare function useUserSupplies(args: UseUserSuppliesArgs): ReadResult<MarketUserReserveSupplyPosition[]>;
|
|
1020
|
+
type UseUserBorrowsArgs = UserBorrowsRequest;
|
|
1021
|
+
/**
|
|
1022
|
+
* Fetch all user borrow positions.
|
|
1023
|
+
*
|
|
1024
|
+
* This signature supports React Suspense:
|
|
1025
|
+
*
|
|
1026
|
+
* ```tsx
|
|
1027
|
+
* const { data } = useUserBorrows({
|
|
1028
|
+
* markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],
|
|
1029
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1030
|
+
* orderBy: { name: OrderDirection.ASC },
|
|
1031
|
+
* suspense: true
|
|
1032
|
+
* });
|
|
1033
|
+
* ```
|
|
1034
|
+
*/
|
|
1035
|
+
declare function useUserBorrows(args: UseUserBorrowsArgs & Suspendable): SuspenseResult<MarketUserReserveBorrowPosition[]>;
|
|
1036
|
+
/**
|
|
1037
|
+
* Fetch all user borrow positions.
|
|
1038
|
+
*
|
|
1039
|
+
* ```tsx
|
|
1040
|
+
* const { data, error, loading } = useUserBorrows({
|
|
1041
|
+
* markets: [{ address: evmAddress('0x87870bca…'), chainId: chainId(1) }],
|
|
1042
|
+
* user: evmAddress('0x742d35cc…'),
|
|
1043
|
+
* orderBy: { name: OrderDirection.ASC },
|
|
1044
|
+
* });
|
|
1045
|
+
* ```
|
|
1046
|
+
*/
|
|
1047
|
+
declare function useUserBorrows(args: UseUserBorrowsArgs): ReadResult<MarketUserReserveBorrowPosition[]>;
|
|
1048
|
+
type UseUserStateArgs = UserMarketStateRequest;
|
|
1049
|
+
/**
|
|
1050
|
+
* Fetch user account market data across all reserves.
|
|
1051
|
+
*
|
|
1052
|
+
* This signature supports React Suspense:
|
|
1053
|
+
*
|
|
1054
|
+
* ```tsx
|
|
1055
|
+
* const { data } = useUserMarketState({
|
|
1056
|
+
* market: evmAddress('0x1234…'),
|
|
1057
|
+
* user: evmAddress('0x5678…'),
|
|
1058
|
+
* chainId: chainId(1),
|
|
1059
|
+
* suspense: true,
|
|
1060
|
+
* });
|
|
1061
|
+
* ```
|
|
1062
|
+
*/
|
|
1063
|
+
declare function useUserMarketState(args: UseUserStateArgs & Suspendable): SuspenseResult<MarketUserState>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Fetch user account market data across all reserves.
|
|
1066
|
+
*
|
|
1067
|
+
* ```tsx
|
|
1068
|
+
* const { data, error, loading } = useUserMarketState({
|
|
1069
|
+
* market: evmAddress('0x1234…'),
|
|
1070
|
+
* user: evmAddress('0x5678…'),
|
|
1071
|
+
* chainId: chainId(1),
|
|
1072
|
+
* });
|
|
1073
|
+
* ```
|
|
1074
|
+
*/
|
|
1075
|
+
declare function useUserMarketState(args: UseUserStateArgs): ReadResult<MarketUserState>;
|
|
1076
|
+
type UseUserTransactionHistoryArgs = UserTransactionHistoryRequest;
|
|
1077
|
+
/**
|
|
1078
|
+
* Fetch user transaction history.
|
|
1079
|
+
*
|
|
1080
|
+
* This signature supports React Suspense:
|
|
1081
|
+
*
|
|
1082
|
+
* ```tsx
|
|
1083
|
+
* const { data } = useUserTransactionHistory({
|
|
1084
|
+
* suspense: true,
|
|
1085
|
+
* });
|
|
1086
|
+
* ```
|
|
1087
|
+
*/
|
|
1088
|
+
declare function useUserTransactionHistory(args: UseUserTransactionHistoryArgs & Suspendable): SuspenseResult<PaginatedUserTransactionHistoryResult>;
|
|
1089
|
+
/**
|
|
1090
|
+
* Fetch user transaction history.
|
|
1091
|
+
*
|
|
1092
|
+
* ```tsx
|
|
1093
|
+
* const { data, error, loading } = useUserTransactionHistory();
|
|
1094
|
+
* ```
|
|
1095
|
+
*/
|
|
1096
|
+
declare function useUserTransactionHistory(args: UseUserTransactionHistoryArgs): ReadResult<PaginatedUserTransactionHistoryResult>;
|
|
1097
|
+
|
|
1098
|
+
type UseVaultArgs = VaultRequest;
|
|
1099
|
+
/**
|
|
1100
|
+
* Fetch a single vault by address and chain ID.
|
|
1101
|
+
*
|
|
1102
|
+
* This signature supports React Suspense:
|
|
1103
|
+
*
|
|
1104
|
+
* ```tsx
|
|
1105
|
+
* const { data } = useVault({
|
|
1106
|
+
* by: {
|
|
1107
|
+
* address: evmAddress('0x1234…'),
|
|
1108
|
+
* },
|
|
1109
|
+
* chainId: chainId(1),
|
|
1110
|
+
* user: evmAddress('0x5678…'),
|
|
1111
|
+
* suspense: true,
|
|
1112
|
+
* });
|
|
1113
|
+
* ```
|
|
1114
|
+
*/
|
|
1115
|
+
declare function useVault(args: UseVaultArgs & Suspendable): SuspenseResult<Vault | null>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Fetch a single vault by address and chain ID.
|
|
1118
|
+
*
|
|
1119
|
+
* ```tsx
|
|
1120
|
+
* const { data, error, loading } = useVault({
|
|
1121
|
+
* address: evmAddress('0x1234…'),
|
|
1122
|
+
* chainId: chainId(1),
|
|
1123
|
+
* user: evmAddress('0x5678…'),
|
|
1124
|
+
* });
|
|
1125
|
+
* ```
|
|
1126
|
+
*/
|
|
1127
|
+
declare function useVault(args: UseVaultArgs): ReadResult<Vault | null>;
|
|
1128
|
+
type UseVaultsArgs = VaultsRequest;
|
|
1129
|
+
/**
|
|
1130
|
+
* Fetch vaults based on filter criteria.
|
|
1131
|
+
*
|
|
1132
|
+
* This signature supports React Suspense:
|
|
1133
|
+
*
|
|
1134
|
+
* ```tsx
|
|
1135
|
+
* const { data } = useVaults({
|
|
1136
|
+
* criteria: {
|
|
1137
|
+
* ownedBy: [evmAddress('0x1234…')]
|
|
1138
|
+
* },
|
|
1139
|
+
* pageSize: PageSize.Ten,
|
|
1140
|
+
* user: evmAddress('0x5678…'),
|
|
1141
|
+
* suspense: true,
|
|
1142
|
+
* });
|
|
1143
|
+
* ```
|
|
1144
|
+
*/
|
|
1145
|
+
declare function useVaults(args: UseVaultsArgs & Suspendable): SuspenseResult<PaginatedVaultsResult>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Fetch vaults based on filter criteria.
|
|
1148
|
+
*
|
|
1149
|
+
* ```tsx
|
|
1150
|
+
* const { data, error, loading } = useVaults({
|
|
1151
|
+
* criteria: {
|
|
1152
|
+
* ownedBy: [evmAddress('0x1234…')]
|
|
1153
|
+
* },
|
|
1154
|
+
* pageSize: PageSize.Ten,
|
|
1155
|
+
* user: evmAddress('0x5678…'),
|
|
1156
|
+
* });
|
|
1157
|
+
* ```
|
|
1158
|
+
*/
|
|
1159
|
+
declare function useVaults(args: UseVaultsArgs): ReadResult<PaginatedVaultsResult>;
|
|
1160
|
+
type UseUserVaultsArgs = UserVaultsRequest;
|
|
1161
|
+
/**
|
|
1162
|
+
* Fetch vaults that a user has shares in.
|
|
1163
|
+
*
|
|
1164
|
+
* This signature supports React Suspense:
|
|
1165
|
+
*
|
|
1166
|
+
* ```tsx
|
|
1167
|
+
* const { data } = useUserVaults({
|
|
1168
|
+
* user: evmAddress('0x1234…'),
|
|
1169
|
+
* filters: {
|
|
1170
|
+
* markets: [evmAddress('0x5678…')]
|
|
1171
|
+
* },
|
|
1172
|
+
* orderBy: { shares: OrderDirection.Desc },
|
|
1173
|
+
* pageSize: PageSize.Fifty,
|
|
1174
|
+
* suspense: true,
|
|
1175
|
+
* });
|
|
1176
|
+
* ```
|
|
1177
|
+
*/
|
|
1178
|
+
declare function useUserVaults(args: UseUserVaultsArgs & Suspendable): SuspenseResult<PaginatedVaultsResult>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Fetch vaults that a user has shares in.
|
|
1181
|
+
*
|
|
1182
|
+
* ```tsx
|
|
1183
|
+
* const { data, error, loading } = useUserVaults({
|
|
1184
|
+
* user: evmAddress('0x1234…'),
|
|
1185
|
+
* filters: {
|
|
1186
|
+
* markets: [evmAddress('0x5678…')]
|
|
1187
|
+
* },
|
|
1188
|
+
* orderBy: { shares: OrderDirection.Desc },
|
|
1189
|
+
* pageSize: PageSize.Fifty,
|
|
1190
|
+
* });
|
|
1191
|
+
* ```
|
|
1192
|
+
*/
|
|
1193
|
+
declare function useUserVaults(args: UseUserVaultsArgs): ReadResult<PaginatedVaultsResult>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Determines the amount of shares that would be received for a deposit.
|
|
1196
|
+
*
|
|
1197
|
+
* ```ts
|
|
1198
|
+
* const [preview, { loading, error }] = useVaultDepositPreview();
|
|
1199
|
+
*
|
|
1200
|
+
* // …
|
|
1201
|
+
*
|
|
1202
|
+
* const result = await preview({
|
|
1203
|
+
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
|
|
1204
|
+
* chainId: chainId(1),
|
|
1205
|
+
* amount: bigDecimal('1000'),
|
|
1206
|
+
* });
|
|
1207
|
+
*
|
|
1208
|
+
* if (result.isErr()) {
|
|
1209
|
+
* console.error(result.error);
|
|
1210
|
+
* } else {
|
|
1211
|
+
* console.log(result.value);
|
|
1212
|
+
* }
|
|
1213
|
+
* ```
|
|
1214
|
+
*/
|
|
1215
|
+
declare function useVaultDepositPreview(): UseAsyncTask<VaultPreviewDepositRequest, TokenAmount, UnexpectedError>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Determines the amount of assets that would be required to mint a specific amount of vault shares.
|
|
1218
|
+
*
|
|
1219
|
+
* ```ts
|
|
1220
|
+
* const [preview, { loading, error }] = useVaultMintPreview();
|
|
1221
|
+
*
|
|
1222
|
+
* // …
|
|
1223
|
+
*
|
|
1224
|
+
* const result = await preview({
|
|
1225
|
+
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
|
|
1226
|
+
* chainId: chainId(1),
|
|
1227
|
+
* amount: bigDecimal('500'),
|
|
1228
|
+
* });
|
|
1229
|
+
*
|
|
1230
|
+
* if (result.isErr()) {
|
|
1231
|
+
* console.error(result.error);
|
|
1232
|
+
* } else {
|
|
1233
|
+
* console.log(result.value);
|
|
1234
|
+
* }
|
|
1235
|
+
* ```
|
|
1236
|
+
*/
|
|
1237
|
+
declare function useVaultMintPreview(): UseAsyncTask<VaultPreviewMintRequest, TokenAmount, UnexpectedError>;
|
|
1238
|
+
/**
|
|
1239
|
+
* Determines the amount of shares that would be burned for a withdrawal.
|
|
1240
|
+
*
|
|
1241
|
+
* ```ts
|
|
1242
|
+
* const [preview, { loading, error }] = useVaultWithdrawPreview();
|
|
1243
|
+
*
|
|
1244
|
+
* // …
|
|
1245
|
+
*
|
|
1246
|
+
* const result = await preview({
|
|
1247
|
+
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
|
|
1248
|
+
* chainId: chainId(1),
|
|
1249
|
+
* amount: bigDecimal('750'),
|
|
1250
|
+
* });
|
|
1251
|
+
*
|
|
1252
|
+
* if (result.isErr()) {
|
|
1253
|
+
* console.error(result.error);
|
|
1254
|
+
* } else {
|
|
1255
|
+
* console.log(result.value);
|
|
1256
|
+
* }
|
|
1257
|
+
* ```
|
|
1258
|
+
*/
|
|
1259
|
+
declare function useVaultWithdrawPreview(): UseAsyncTask<VaultPreviewWithdrawRequest, TokenAmount, UnexpectedError>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Determines the amount of assets that would be received for redeeming a specific amount of vault shares.
|
|
1262
|
+
*
|
|
1263
|
+
* This signature supports React Suspense:
|
|
1264
|
+
*
|
|
1265
|
+
* ```ts
|
|
1266
|
+
* const [preview, { loading, error }] = useVaultRedeemPreview();
|
|
1267
|
+
*
|
|
1268
|
+
* // …
|
|
1269
|
+
*
|
|
1270
|
+
* const result = await preview({
|
|
1271
|
+
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
|
|
1272
|
+
* chainId: chainId(1),
|
|
1273
|
+
* amount: bigDecimal('200'),
|
|
1274
|
+
* });
|
|
1275
|
+
*
|
|
1276
|
+
* if (result.isErr()) {
|
|
1277
|
+
* console.error(result.error);
|
|
1278
|
+
* } else {
|
|
1279
|
+
* console.log(result.value);
|
|
1280
|
+
* }
|
|
1281
|
+
* ```
|
|
1282
|
+
*/
|
|
1283
|
+
declare function useVaultRedeemPreview(): UseAsyncTask<VaultPreviewRedeemRequest, TokenAmount, UnexpectedError>;
|
|
1284
|
+
type UseVaultUserTransactionHistoryArgs = VaultUserTransactionHistoryRequest;
|
|
1285
|
+
/**
|
|
1286
|
+
* Fetch user transaction history for a vault.
|
|
1287
|
+
*
|
|
1288
|
+
* This signature supports React Suspense:
|
|
1289
|
+
*
|
|
1290
|
+
* ```tsx
|
|
1291
|
+
* const { data } = useVaultUserTransactionHistory({
|
|
1292
|
+
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
|
|
1293
|
+
* chainId: chainId(1),
|
|
1294
|
+
* user: evmAddress('0x5678901234567890abcdef1234567890abcdef12'),
|
|
1295
|
+
* suspense: true,
|
|
1296
|
+
* });
|
|
1297
|
+
* ```
|
|
1298
|
+
*/
|
|
1299
|
+
declare function useVaultUserTransactionHistory(args: UseVaultUserTransactionHistoryArgs & Suspendable): SuspenseResult<PaginatedVaultUserTransactionHistoryResult>;
|
|
1300
|
+
/**
|
|
1301
|
+
* Fetch user transaction history for a vault.
|
|
1302
|
+
*
|
|
1303
|
+
* ```tsx
|
|
1304
|
+
* const { data, error, loading } = useVaultUserTransactionHistory({
|
|
1305
|
+
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
|
|
1306
|
+
* chainId: chainId(1),
|
|
1307
|
+
* user: evmAddress('0x5678901234567890abcdef1234567890abcdef12'),
|
|
1308
|
+
* });
|
|
1309
|
+
* ```
|
|
1310
|
+
*/
|
|
1311
|
+
declare function useVaultUserTransactionHistory(args: UseVaultUserTransactionHistoryArgs): ReadResult<PaginatedVaultUserTransactionHistoryResult>;
|
|
1312
|
+
type UseVaultUserActivityArgs = VaultUserActivityRequest;
|
|
1313
|
+
/**
|
|
1314
|
+
* Fetch user activity data for a vault, including earnings breakdown over time.
|
|
1315
|
+
*
|
|
1316
|
+
* This signature supports React Suspense:
|
|
1317
|
+
*
|
|
1318
|
+
* ```tsx
|
|
1319
|
+
* const { data } = useVaultUserActivity({
|
|
1320
|
+
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
|
|
1321
|
+
* chainId: chainId(1),
|
|
1322
|
+
* user: evmAddress('0x5678901234567890abcdef1234567890abcdef12'),
|
|
1323
|
+
* suspense: true,
|
|
1324
|
+
* });
|
|
1325
|
+
* ```
|
|
1326
|
+
*/
|
|
1327
|
+
declare function useVaultUserActivity(args: UseVaultUserActivityArgs & Suspendable): SuspenseResult<VaultUserActivityResult>;
|
|
1328
|
+
/**
|
|
1329
|
+
* Fetch user activity data for a vault, including earnings breakdown over time.
|
|
1330
|
+
*
|
|
1331
|
+
* ```tsx
|
|
1332
|
+
* const { data, error, loading } = useVaultUserActivity({
|
|
1333
|
+
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
|
|
1334
|
+
* chainId: chainId(1),
|
|
1335
|
+
* user: evmAddress('0x5678901234567890abcdef1234567890abcdef12'),
|
|
1336
|
+
* });
|
|
1337
|
+
*
|
|
1338
|
+
* if (data) {
|
|
1339
|
+
* console.log('Total earned:', data.earned.amount.value);
|
|
1340
|
+
* data.breakdown.forEach(activity => {
|
|
1341
|
+
* console.log('Date:', activity.date);
|
|
1342
|
+
* console.log('Balance:', activity.balance.amount.value);
|
|
1343
|
+
* });
|
|
1344
|
+
* }
|
|
1345
|
+
* ```
|
|
1346
|
+
*/
|
|
1347
|
+
declare function useVaultUserActivity(args: UseVaultUserActivityArgs): ReadResult<VaultUserActivityResult>;
|
|
1348
|
+
|
|
1349
|
+
export { AaveProvider, type AaveProviderProps, type SavingsGhoBalanceArgs, type UseAaveChainsArgs, type UseAaveMarketArgs, type UseAaveMarketsArgs, type UseAaveReserveArgs, type UseBorrowAPYHistoryArgs, type UseCreditDelegateeAllowanceArgs, type UseSupplyAPYHistoryArgs, type UseUsdExchangeRatesArgs, type UseUserBorrowsArgs, type UseUserStateArgs, type UseUserSuppliesArgs, type UseUserTransactionHistoryArgs, type UseUserVaultsArgs, type UseVaultArgs, type UseVaultUserActivityArgs, type UseVaultUserTransactionHistoryArgs, type UseVaultsArgs, type UserMeritRewardsArgs, useAaveChains, useAaveClient, useAaveHealth, useAaveHealthFactorPreview, useAaveMarket, useAaveMarkets, useAaveReserve, useApproveBorrowCreditDelegation, useBorrow, useBorrowAPYHistory, useCollateralToggle, useCreditDelegateeAllowance, useLiquidate, useRepay, useSavingsGhoBalance, useSavingsGhoDeposit, useSavingsGhoWithdraw, useSupply, useSupplyAPYHistory, useUsdExchangeRates, useUserBorrows, useUserEMode, useUserMarketState, useUserMeritRewards, useUserSupplies, useUserTransactionHistory, useUserVaults, useVault, useVaultDeploy, useVaultDeposit, useVaultDepositPreview, useVaultMintPreview, useVaultMintShares, useVaultRedeemPreview, useVaultRedeemShares, useVaultSetFee, useVaultTransferOwnership, useVaultUserActivity, useVaultUserTransactionHistory, useVaultWithdraw, useVaultWithdrawFees, useVaultWithdrawPreview, useVaults, useWithdraw };
|