@@ -186,12 +186,16 @@ const StatDivider = styled.div`
186186 margin: 2rem 0;
187187 }
188188`
189-
190- interface L2DataResponse {
189+ interface L2DataResponseItem {
191190 daily : {
192191 data : Array < [ string , number , number ] >
193192 }
194193}
194+ interface L2DataResponse {
195+ layers2s : L2DataResponseItem
196+ combined : L2DataResponseItem
197+ bridges : L2DataResponseItem
198+ }
195199
196200interface FeeDataResponse {
197201 data : Array < { id : string ; results : { feeTransferEth : number } } >
@@ -214,20 +218,23 @@ const Layer2Page = ({ data }: PageProps<Queries.Layer2PageQuery>) => {
214218 `${ GATSBY_FUNCTIONS_PATH } /l2beat`
215219 )
216220
221+ const dailyData = l2BeatData . layers2s . daily . data
222+
217223 // formatted TVL from L2beat API formatted
218224 const TVL = new Intl . NumberFormat ( localeForStatsBoxNumbers , {
219225 style : "currency" ,
220226 currency : "USD" ,
221227 notation : "compact" ,
222228 minimumSignificantDigits : 2 ,
223229 maximumSignificantDigits : 3 ,
224- } ) . format ( l2BeatData . daily . data [ l2BeatData . daily . data . length - 1 ] [ 1 ] )
230+ } ) . format ( dailyData [ dailyData . length - 1 ] [ 1 ] )
231+
225232 setTVL ( `${ TVL } ` )
226233 // Calculate percent change ((new value - old value) / old value) *100)
227234 const percentage =
228- ( ( l2BeatData . daily . data [ l2BeatData . daily . data . length - 1 ] [ 1 ] -
229- l2BeatData . daily . data [ l2BeatData . daily . data . length - 31 ] [ 1 ] ) /
230- l2BeatData . daily . data [ l2BeatData . daily . data . length - 31 ] [ 1 ] ) *
235+ ( ( dailyData [ dailyData . length - 1 ] [ 1 ] -
236+ dailyData [ dailyData . length - 31 ] [ 1 ] ) /
237+ dailyData [ dailyData . length - 31 ] [ 1 ] ) *
231238 100
232239 setL2PercentChange (
233240 percentage > 0
0 commit comments