1- import { PV_V2 , PV_V4 } from 'constants/pv'
1+ import { PV_V2 , PV_V4 , PV_V5 } from 'constants/pv'
22import { useProjectTlQuery , useProjectsQuery } from 'generated/graphql'
33import { useProjectQuery , useSuckerGroupTlQuery } from 'generated/v4v5/graphql'
44import { daysToMS , minutesToMS } from 'utils/units'
@@ -109,14 +109,14 @@ export function useProjectTimeline({
109109 variables : {
110110 chainId : chainId || 0 ,
111111 projectId,
112- version : parseInt ( pv )
112+ version : parseInt ( pv ) ,
113113 } ,
114- skip : pv !== PV_V4 || ! chainId || ! projectId ,
114+ skip : ( pv !== PV_V4 && pv !== PV_V5 ) || ! chainId || ! projectId ,
115115 } )
116116
117- const { data : v4QueryResult } = useSuckerGroupTlQuery ( {
117+ const { data : v4v5QueryResult } = useSuckerGroupTlQuery ( {
118118 client : bendystrawClient ,
119- skip : pv !== PV_V4 || ! project ?. project ?. suckerGroupId ,
119+ skip : ( pv !== PV_V4 && pv !== PV_V5 ) || ! project ?. project ?. suckerGroupId ,
120120 variables : {
121121 suckerGroupId : project ?. project ?. suckerGroupId ,
122122 startTimestamp : timestamps ?. [ 0 ] ,
@@ -166,15 +166,15 @@ export function useProjectTimeline({
166166
167167 // unlike v1v2v3 points where we always query an arbitrary number of points for a specified time window, we can trust that v4 points only exist where a change has occurred, leaving no need to "fill in the gaps".
168168 const v4Points : ProjectTimelinePoint [ ] | undefined = useMemo ( ( ) => {
169- if ( ! v4QueryResult || ! timestamps || ! project ?. project ) return
169+ if ( ! v4v5QueryResult || ! timestamps || ! project ?. project ) return
170170
171171 // first point before the current timestamp range. If undefined, assume project was created within timestamp range
172- const previous = v4QueryResult . previous . items . length
173- ? v4QueryResult . previous . items [ 0 ]
172+ const previous = v4v5QueryResult . previous . items . length
173+ ? v4v5QueryResult . previous . items [ 0 ]
174174 : undefined
175175 // last point within the timestamp range
176- const final = v4QueryResult . range . items . length
177- ? v4QueryResult . range . items [ v4QueryResult . range . items . length - 1 ]
176+ const final = v4v5QueryResult . range . items . length
177+ ? v4v5QueryResult . range . items [ v4v5QueryResult . range . items . length - 1 ]
178178 : undefined
179179
180180 // extrapolate first point. If project was created before timestamp window, use previous point data. Otherwise use project.createdAt
@@ -205,7 +205,7 @@ export function useProjectTimeline({
205205
206206 return [
207207 firstPoint ,
208- ...v4QueryResult . range . items . map (
208+ ...v4v5QueryResult . range . items . map (
209209 ( { volume, balance, trendingScore, timestamp } ) => ( {
210210 timestamp,
211211 volume : wadToFloat ( volume ) ,
@@ -215,7 +215,7 @@ export function useProjectTimeline({
215215 ) ,
216216 lastPoint ,
217217 ]
218- } , [ v4QueryResult , timestamps , project ?. project ] )
218+ } , [ v4v5QueryResult , timestamps , project ?. project ] )
219219
220220 return {
221221 v1v2v3Points,
0 commit comments