Skip to content

Commit

Permalink
fix: use-get-dex-volumes hook (#1534)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao authored Aug 22, 2023
1 parent 861e494 commit 1084182
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/hooks/api/use-get-dex-volume.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ const GET_DEX_VOLUMES = gql`
...AmountFields
}
}
endVolumes: cumulativeDexTradingVolumes(limit: 1, orderBy: tillTimestamp_DESC, where: { tillTimestamp_lte: $end }) {
endVolumes: cumulativeDexTradingVolumes(
limit: 1
orderBy: tillTimestamp_DESC
where: { tillTimestamp_lte: $end, tillTimestamp_gte: $start }
) {
tillTimestamp
amounts {
...AmountFields
Expand Down Expand Up @@ -95,6 +99,10 @@ const useGetDexVolumes = (range: DateRangeVolume): UseGetCurrenciesResult => {

const data = await graphQLClient.request(GET_DEX_VOLUMES, { start, end });

if (!data.startVolumes.length || !data.endVolumes.length) {
return {};
}

const [startVolumes] = data.startVolumes;
const [endVolumes] = data.endVolumes;

Expand Down

2 comments on commit 1084182

@vercel
Copy link

@vercel vercel bot commented on 1084182 Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 1084182 Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.