|
1 | 1 | import { Controller, Get, ParseBoolPipe, ParseIntPipe, Query, UseInterceptors } from '@nestjs/common' |
2 | 2 | import { CacheInterceptor } from '@nestjs/cache-manager' |
3 | 3 | import { ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger' |
| 4 | +import { FAssetType } from 'fasset-indexer-core' |
4 | 5 | import { ExplorerService } from '../services/explorer.service' |
5 | 6 | import { DashboardService } from '../services/dashboard.service' |
6 | 7 | import { apiResponse, ApiResponse } from '../shared/api-response' |
@@ -128,29 +129,31 @@ export class ExplorerController { |
128 | 129 | } |
129 | 130 |
|
130 | 131 | @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' }) |
132 | 133 | @ApiQuery({ name: "startTime", type: Number, required: false }) |
133 | 134 | getTimeSeriesRedeemed( |
134 | 135 | @Query('endtime', ParseIntPipe) end: number, |
135 | 136 | @Query('npoints', ParseIntPipe) npoints: number, |
136 | 137 | @Query('startTime', new ParseIntPipe({ optional: true })) start?: number |
137 | | - ): Promise<ApiResponse<Types.TimeSeries<bigint>>> { |
| 138 | + ): Promise<ApiResponse<Types.FAssetTimeSeries<bigint>>> { |
138 | 139 | const err = this.restrictPoints(end, npoints, start) |
139 | 140 | 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) |
141 | 143 | } |
142 | 144 |
|
143 | 145 | @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' }) |
145 | 147 | @ApiQuery({ name: "startTime", type: Number, required: false }) |
146 | 148 | getTimeSeriesMinted( |
147 | 149 | @Query('endtime', ParseIntPipe) end: number, |
148 | 150 | @Query('npoints', ParseIntPipe) npoints: number, |
149 | 151 | @Query('startTime', new ParseIntPipe({ optional: true })) start?: number |
150 | | - ): Promise<ApiResponse<Types.TimeSeries<bigint>>> { |
| 152 | + ): Promise<ApiResponse<Types.FAssetTimeSeries<bigint>>> { |
151 | 153 | const err = this.restrictPoints(end, npoints, start) |
152 | 154 | 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) |
154 | 157 | } |
155 | 158 |
|
156 | 159 | private parseTransactionTypes(types: string[]): Types.TransactionType[] { |
|
0 commit comments