Skip to content

Commit 5e33b6e

Browse files
committed
fix: explorer timeseries return only fxrp data
1 parent 74c4aaf commit 5e33b6e

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

packages/fasset-indexer-api/src/controllers/explorer.controller.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Controller, Get, ParseBoolPipe, ParseIntPipe, Query, UseInterceptors } from '@nestjs/common'
22
import { CacheInterceptor } from '@nestjs/cache-manager'
33
import { ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger'
4+
import { FAssetType } from 'fasset-indexer-core'
45
import { ExplorerService } from '../services/explorer.service'
56
import { DashboardService } from '../services/dashboard.service'
67
import { apiResponse, ApiResponse } from '../shared/api-response'
@@ -128,29 +129,31 @@ export class ExplorerController {
128129
}
129130

130131
@Get('/timeseries/redeemed?')
131-
@ApiOperation({ summary: 'Time series of the total $ value of redeemed FAssets' })
132+
@ApiOperation({ summary: 'Time series of the total redeemed FXRP' })
132133
@ApiQuery({ name: "startTime", type: Number, required: false })
133134
getTimeSeriesRedeemed(
134135
@Query('endtime', ParseIntPipe) end: number,
135136
@Query('npoints', ParseIntPipe) npoints: number,
136137
@Query('startTime', new ParseIntPipe({ optional: true })) start?: number
137-
): Promise<ApiResponse<Types.TimeSeries<bigint>>> {
138+
): Promise<ApiResponse<Types.FAssetTimeSeries<bigint>>> {
138139
const err = this.restrictPoints(end, npoints, start)
139140
if (err !== null) return apiResponse(Promise.reject(err), 400)
140-
return apiResponse(this.dashboard.redeemedAggregateTimeSeries(end, npoints, start), 200)
141+
const key = FAssetType[FAssetType.FXRP]
142+
return apiResponse(this.dashboard.redeemedTimeSeries(end, npoints, start).then(x => x[key]), 200)
141143
}
142144

143145
@Get('/timeseries/minted?')
144-
@ApiOperation({ summary: 'Time series of the total $ value of minted FAssets' })
146+
@ApiOperation({ summary: 'Time series of the total minted FXRP' })
145147
@ApiQuery({ name: "startTime", type: Number, required: false })
146148
getTimeSeriesMinted(
147149
@Query('endtime', ParseIntPipe) end: number,
148150
@Query('npoints', ParseIntPipe) npoints: number,
149151
@Query('startTime', new ParseIntPipe({ optional: true })) start?: number
150-
): Promise<ApiResponse<Types.TimeSeries<bigint>>> {
152+
): Promise<ApiResponse<Types.FAssetTimeSeries<bigint>>> {
151153
const err = this.restrictPoints(end, npoints, start)
152154
if (err !== null) return apiResponse(Promise.reject(err), 400)
153-
return apiResponse(this.dashboard.mintedAggregateTimeSeries(end, npoints, start), 200)
155+
const key = FAssetType[FAssetType.FXRP]
156+
return apiResponse(this.dashboard.mintedTimeSeries(end, npoints, start).then(x => x[key]), 200)
154157
}
155158

156159
private parseTransactionTypes(types: string[]): Types.TransactionType[] {

0 commit comments

Comments
 (0)