Skip to content

Commit 2d4d901

Browse files
committed
chore: update to most recent GQL changes
1 parent 69dbb3a commit 2d4d901

File tree

8 files changed

+53
-82
lines changed

8 files changed

+53
-82
lines changed

packages/client/src/actions/vaults.ts

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,14 @@ import {
44
type UserVaultsRequest,
55
type Vault,
66
VaultQuery,
7-
type VaultQueryRequest,
7+
type VaultRequest,
88
VaultsQuery,
9-
type VaultsQueryRequest,
9+
type VaultsRequest,
1010
} from '@aave/graphql';
11-
import {
12-
type EvmAddress,
13-
type Prettify,
14-
type ResultAsync,
15-
ZERO_ADDRESS,
16-
} from '@aave/types';
11+
import type { ResultAsync } from '@aave/types';
1712
import type { AaveClient } from '../client';
1813
import type { UnexpectedError } from '../errors';
1914

20-
export type VaultRequest = Prettify<
21-
VaultQueryRequest & {
22-
/**
23-
* The user address to get user-specific data for the vault.
24-
* If not provided, user-specific fields will be null.
25-
*/
26-
user?: EvmAddress;
27-
}
28-
>;
29-
3015
/**
3116
* Fetches a specific vault by address and chain ID.
3217
*
@@ -44,25 +29,13 @@ export type VaultRequest = Prettify<
4429
*/
4530
export function vault(
4631
client: AaveClient,
47-
{ user, ...request }: VaultRequest,
32+
request: VaultRequest,
4833
): ResultAsync<Vault | null, UnexpectedError> {
4934
return client.query(VaultQuery, {
5035
request,
51-
includeUserShares: !!user,
52-
userAddress: user ?? ZERO_ADDRESS,
5336
});
5437
}
5538

56-
export type VaultsRequest = Prettify<
57-
VaultsQueryRequest & {
58-
/**
59-
* The user address to get user-specific data for the vaults.
60-
* If not provided, user-specific fields will be null.
61-
*/
62-
user?: EvmAddress;
63-
}
64-
>;
65-
6639
/**
6740
* Fetches vaults based on filter criteria.
6841
*
@@ -82,12 +55,10 @@ export type VaultsRequest = Prettify<
8255
*/
8356
export function vaults(
8457
client: AaveClient,
85-
{ user, ...request }: VaultsRequest,
58+
request: VaultsRequest,
8659
): ResultAsync<PaginatedVaultsResult, UnexpectedError> {
8760
return client.query(VaultsQuery, {
8861
request,
89-
includeUserShares: !!user,
90-
userAddress: user ?? ZERO_ADDRESS,
9162
});
9263
}
9364

@@ -115,7 +86,5 @@ export function userVaults(
11586
): ResultAsync<PaginatedVaultsResult, UnexpectedError> {
11687
return client.query(UserVaultsQuery, {
11788
request,
118-
includeUserShares: true,
119-
userAddress: request.user,
12089
});
12190
}

packages/graphql/schema.graphql

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ input ERC712Signature {
166166
}
167167

168168
type EmodeMarketCategory {
169+
"""The eMode id for the market"""
170+
id: Int!
171+
169172
"""The eMode label"""
170173
label: String!
171174

@@ -270,6 +273,9 @@ type InsufficientBalanceError {
270273
}
271274

272275
input LiquidateRequest {
276+
"""The market pool address"""
277+
market: EvmAddress!
278+
273279
"""
274280
The address of the token used as collateral, to receive as result of the liquidation
275281
"""
@@ -307,11 +313,9 @@ type Market {
307313
"""The liquidity pool address for the market"""
308314
address: EvmAddress!
309315

310-
"""The total borrows on the market"""
311-
totalBorrows: BigDecimal!
312-
313316
"""A list eModes the market can support"""
314317
eModeCategories: [EmodeMarketCategory!]!
318+
userStats: MarketUserStats
315319

316320
"""The market icon"""
317321
icon: String!
@@ -324,9 +328,6 @@ type Market {
324328

325329
"""The total available liquidity in USD"""
326330
totalAvailableLiquidity: BigDecimal!
327-
328-
"""The market user stats"""
329-
userStats: MarketUserStats
330331
}
331332

332333
type MarketInfo {
@@ -655,15 +656,15 @@ type Reserve {
655656
"""
656657
borrowInfo: ReserveBorrowInfo
657658

658-
"""A list eModes the reserve can support"""
659-
eModeInfo: [EmodeReserveInfo!]!
660-
661659
"""The reserve has been frozen all actions are stopped"""
662660
isFrozen: Boolean!
663661

664662
"""The reserve is paused you can still withdraw and some other actions"""
665663
isPaused: Boolean!
666664

665+
"""A list eModes the reserve can support"""
666+
eModeInfo: [EmodeReserveInfo!]!
667+
667668
"""
668669
The user's availability on the reserve to borrow and supply with balance
669670
"""
@@ -754,13 +755,13 @@ type ReserveSupplyInfo {
754755

755756
type ReserveUserAvailability {
756757
"""The user's balance of this asset"""
757-
balance: DecimalValue!
758+
balance: TokenAmount!
758759

759760
"""The amount the user can supply to this reserve"""
760-
supply: DecimalValue!
761+
suppliable: TokenAmount!
761762

762763
"""The amount the user can borrow from this reserve"""
763-
borrow: DecimalValue!
764+
borrowable: TokenAmount!
764765
}
765766

766767
input SetVaultFeeRequest {
@@ -998,7 +999,7 @@ type Vault {
998999
chainId: ChainId!
9991000

10001001
"""The user's shares on the vault"""
1001-
userShares(address: EvmAddress!): DecimalValue!
1002+
userShares: DecimalValue
10021003
}
10031004

10041005
input VaultDepositRequest {
@@ -1052,6 +1053,11 @@ input VaultRequest {
10521053

10531054
"""The chain id the vault is deployed on"""
10541055
chainId: ChainId!
1056+
1057+
"""
1058+
The user viewing it (can be connected wallet) - this caters for stuff like userShares and other user features
1059+
"""
1060+
user: EvmAddress
10551061
}
10561062

10571063
input VaultShareInput {
@@ -1069,6 +1075,11 @@ input VaultsRequest {
10691075
"""Filter criteria for vaults"""
10701076
criteria: VaultsRequestFilterCriteria!
10711077

1078+
"""
1079+
The user viewing it (can be connected wallet) - this caters for stuff like userShares and other user features
1080+
"""
1081+
user: EvmAddress
1082+
10721083
"""The page size"""
10731084
pageSize: PageSize! = FIFTY
10741085

packages/graphql/src/fragments/market.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export type EmodeMarketReserveInfo = FragmentOf<
5555
export const EmodeMarketCategoryFragment = graphql(
5656
`fragment EmodeMarketCategory on EmodeMarketCategory {
5757
__typename
58+
id
5859
label
5960
maxLTV {
6061
...DecimalValue
@@ -87,7 +88,6 @@ export const MarketFragment = graphql(
8788
icon
8889
totalMarketSize
8990
totalAvailableLiquidity
90-
totalBorrows
9191
eModeCategories {
9292
...EmodeMarketCategory
9393
}

packages/graphql/src/fragments/reserve.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,16 @@ export const ReserveUserAvailabilityFragment = graphql(
102102
`fragment ReserveUserAvailability on ReserveUserAvailability {
103103
__typename
104104
balance {
105-
...DecimalValue
105+
...TokenAmount
106106
}
107-
supply {
108-
...DecimalValue
107+
suppliable {
108+
...TokenAmount
109109
}
110-
borrow {
111-
...DecimalValue
110+
borrowable {
111+
...TokenAmount
112112
}
113113
}`,
114-
[DecimalValueFragment],
114+
[TokenAmountFragment],
115115
);
116116
export type ReserveUserAvailability = FragmentOf<
117117
typeof ReserveUserAvailabilityFragment

packages/graphql/src/fragments/vaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const VaultFragment = graphql(
2525
...TokenAmount
2626
}
2727
chainId
28-
userShares(address: $userAddress) @include(if: $includeUserShares) {
28+
userShares {
2929
...DecimalValue
3030
}
3131
}`,

0 commit comments

Comments
 (0)