Skip to content

Commit

Permalink
[limit] add limit to vault & user stats
Browse files Browse the repository at this point in the history
  • Loading branch information
dfkadyr-stakewise committed Jan 24, 2025
1 parent bd4457f commit cc6577f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/graphql/subgraph/vault/userRewardsQuery.graphql
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
query UserRewards(
$where: AllocatorStats_filter
$limit: Int
) {
allocator: allocatorStats_collection(
interval: day
first: $limit
where: $where
) {
apy
Expand Down
3 changes: 2 additions & 1 deletion src/graphql/subgraph/vault/vaultStatsQuery.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
query VaultStats($vaultAddress: String! $timestamp: Timestamp!) {
query VaultStats($vaultAddress: String! $timestamp: Timestamp!, $limit: Int) {
vaultStats: vaultStats_collection(
interval: day
first: $limit
where: {
vault: $vaultAddress
timestamp_gte: $timestamp,
Expand Down
1 change: 1 addition & 0 deletions src/methods/vault/requests/getUserStats/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const getUserStats = (input: GetUserStatsInput) => {
return graphql.subgraph.vault.fetchUserRewardsQuery({
url: apiUrls.getSubgraphqlUrl(options),
variables: {
limit: daysCount,
where: {
timestamp_gte: String(getTimestamp(daysCount)),
allocator_: {
Expand Down
1 change: 1 addition & 0 deletions src/methods/vault/requests/getVaultStats/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const getVaultStats = (input: GetVaultStatsInput) => {
url: apiUrls.getSubgraphqlUrl(options),
variables: {
timestamp,
limit: daysCount,
vaultAddress: vaultAddress.toLowerCase(),
},
modifyResult: modifyVaultStats,
Expand Down

0 comments on commit cc6577f

Please sign in to comment.