Skip to content

Commit 1c997cf

Browse files
authored
Merge pull request #31 from aave/chore/refactors-preview-hooks
fix: linting issue and tsdoc
2 parents f366936 + 7b65205 commit 1c997cf

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

packages/client/src/actions/eMode.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
import { sendWith } from '../viem';
2020
import { market, userMarketState } from './markets';
2121
import { supply, userSetEmode } from './transactions';
22-
import { userSupplies } from './user';
2322

2423
describe('Given an Aave Market', () => {
2524
describe('When a user enables an E-Mode category for the given market', () => {

packages/react/src/vaults.ts

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,13 @@ import {
77
} from '@aave/client/actions';
88
import {
99
type PaginatedVaultsResult,
10-
SupplyRequest,
1110
type TokenAmount,
1211
UserVaultsQuery,
1312
type UserVaultsRequest,
1413
type Vault,
15-
VaultPreviewDepositQuery,
1614
type VaultPreviewDepositRequest,
17-
VaultPreviewMintQuery,
1815
type VaultPreviewMintRequest,
19-
VaultPreviewRedeemQuery,
2016
type VaultPreviewRedeemRequest,
21-
VaultPreviewWithdrawQuery,
2217
type VaultPreviewWithdrawRequest,
2318
VaultQuery,
2419
type VaultRequest,
@@ -199,10 +194,7 @@ export function useUserVaults({
199194
* Determines the amount of shares that would be received for a deposit.
200195
*
201196
* ```ts
202-
* const [preview, previewing] = useVaultDepositPreview();
203-
*
204-
* const loading = previewing.loading;
205-
* const error = previewing.error;
197+
* const [preview, { loading, error }] = useVaultDepositPreview();
206198
*
207199
* // …
208200
*
@@ -234,15 +226,22 @@ export function useVaultDepositPreview(): UseAsyncTask<
234226
/**
235227
* Determines the amount of assets that would be required to mint a specific amount of vault shares.
236228
*
237-
* This signature supports React Suspense:
229+
* ```ts
230+
* const [preview, { loading, error }] = useVaultMintPreview();
238231
*
239-
* ```tsx
240-
* const { data } = useVaultMintPreview({
232+
* // …
233+
*
234+
* const result = await preview({
241235
* vault: evmAddress('0x1234567890abcdef1234567890abcdef12345678'),
242236
* chainId: chainId(1),
243237
* amount: bigDecimal('500'),
244-
* suspense: true,
245238
* });
239+
*
240+
* if (result.isErr()) {
241+
* console.error(result.error);
242+
* } else {
243+
* console.log(result.value);
244+
* }
246245
* ```
247246
*/
248247
export function useVaultMintPreview(): UseAsyncTask<
@@ -261,10 +260,7 @@ export function useVaultMintPreview(): UseAsyncTask<
261260
* Determines the amount of shares that would be burned for a withdrawal.
262261
*
263262
* ```ts
264-
* const [preview, previewing] = useVaultWithdrawPreview();
265-
*
266-
* const loading = previewing.loading;
267-
* const error = previewing.error;
263+
* const [preview, { loading, error }] = useVaultWithdrawPreview();
268264
*
269265
* // …
270266
*
@@ -299,10 +295,7 @@ export function useVaultWithdrawPreview(): UseAsyncTask<
299295
* This signature supports React Suspense:
300296
*
301297
* ```ts
302-
* const [preview, previewing] = useVaultRedeemPreview();
303-
*
304-
* const loading = previewing.loading;
305-
* const error = previewing.error;
298+
* const [preview, { loading, error }] = useVaultRedeemPreview();
306299
*
307300
* // …
308301
*

0 commit comments

Comments
 (0)