Skip to content

Commit

Permalink
chore: add limit to the query
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jan 19, 2024
1 parent c736323 commit 70d2495
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/components/utils/datahub/active-staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ export async function getRewardHistory(address: string): Promise<RewardHistory>

const GET_TOP_USERS = gql`
query GetTopUsers($from: String!) {
activeStakingStakersRankedBySuperLikesForPeriod(args: { fromTime: $from }) {
activeStakingStakersRankedBySuperLikesForPeriod(args: { fromTime: $from, limit: 3 }) {
address
count
}
activeStakingCreatorsRankedBySuperLikesForPeriod(args: { fromTime: $from }) {
activeStakingCreatorsRankedBySuperLikesForPeriod(args: { fromTime: $from, limit: 3 }) {
address
count
}
Expand All @@ -312,18 +312,14 @@ export async function getTopUsers(): Promise<TopUsers> {
})

return {
creators: res.activeStakingCreatorsRankedBySuperLikesForPeriod
.slice(0, 3)
.map(({ address, count }) => ({
address,
superLikesCount: count,
})),
stakers: res.activeStakingStakersRankedBySuperLikesForPeriod
.slice(0, 3)
.map(({ address, count }) => ({
address,
superLikesCount: count,
})),
creators: res.activeStakingCreatorsRankedBySuperLikesForPeriod.map(({ address, count }) => ({
address,
superLikesCount: count,
})),
stakers: res.activeStakingStakersRankedBySuperLikesForPeriod.map(({ address, count }) => ({
address,
superLikesCount: count,
})),
}
}

Expand Down

0 comments on commit 70d2495

Please sign in to comment.