Skip to content

Commit

Permalink
[fix-export-rewards] fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Cast0001 committed Feb 3, 2025
1 parent 5bf8ab9 commit a3e04ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/graphql/subgraph/stats/fiatByDayQuery.graphql
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
query FiatByDay(
$limit: Int!
$dateTo: Timestamp!
$dateFrom: Timestamp!
) {
exchangeRate: exchangeRateStats_collection(
interval: day
first: $limit
where: {
timestamp_gte: $dateFrom,
timestamp_lte: $dateTo
Expand Down
11 changes: 7 additions & 4 deletions src/methods/vault/requests/getUserRewards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const getUserRewards = async (input: GetUserRewardsInput): Promise<MergedReward[
graphql.subgraph.stats.fetchFiatByDayQuery({
url: ratesUrl,
variables: {
limit,
dateTo: timestampTo,
dateFrom: timestampFrom,
},
Expand All @@ -68,13 +69,15 @@ const getUserRewards = async (input: GetUserRewardsInput): Promise<MergedReward[
? graphql.subgraph.stats.fetchFiatByDayQuery({
url: subgraphUrl,
variables: {
limit,
dateTo: timestampTo,
dateFrom: timestampFrom,
},
modifyResult: (data) => (data.exchangeRate || []).reduce((acc, { timestamp, assetsUsdRate }) => ({
...acc,
[timestamp]: assetsUsdRate,
}), {}),
modifyResult: (data) => (data.exchangeRate || [])
.reduce((acc, { timestamp, assetsUsdRate }) => ({
...acc,
[timestamp]: assetsUsdRate,
}), {}),
})
: Promise.resolve({}),
])
Expand Down

0 comments on commit a3e04ed

Please sign in to comment.