feat:log running test feature

This commit is contained in:
Wojtek Rybakiewicz
2023-11-03 18:18:39 +01:00
parent 41c8fe5eb7
commit d3f8594bb9
3 changed files with 24 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
"body-parser": "^1.19.0",
"consola": "^2.15.3",
"cors": "^2.8.5",
"csv-file-to-json": "^4.0.5",
"deep-sort-object": "^1.0.2",
"errorhandler": "^1.5.1",
"express": "^4.18.1",

View File

@@ -17,6 +17,8 @@ import { logger } from "../helpers/logger";
import { tryCleanCollection } from "../helpers/mongo";
import { requestDataPackages } from "redstone-sdk";
import { providerToDataServiceId } from "../providers";
import axios from "axios";
import csvToJSON from "csv-file-to-json";
export interface PriceWithParams
extends Omit<Price, "signature" | "evmSignature" | "liteEvmSignature"> {
@@ -291,6 +293,21 @@ const toMap = (priceList: any) => {
return map;
};
async function requestInflux(query: string) {
const config = {
headers: {
Authorization: `Token ${process.env.INFLUXDB_TOKEN}`,
"Content-Type": "application/vnd.flux",
},
};
const result = await axios.post(
`${process.env.INFLUXDB_URL}/api/v2/query?org=redstone`,
query,
config
);
const json = csvToJSON({ data: result.data });
}
export const prices = (router: Router) => {
/**
* This endpoint is used for fetching prices data.
@@ -322,6 +339,7 @@ export const prices = (router: Router) => {
!params.limit &&
shouldRunTestFeature()
) {
console.log("Running test feature");
const provider = await getProviderFromParams(
req.query as { provider: string }
);

View File

@@ -1897,6 +1897,11 @@ cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"
csv-file-to-json@^4.0.5:
version "4.0.5"
resolved "https://registry.yarnpkg.com/csv-file-to-json/-/csv-file-to-json-4.0.5.tgz#277cf87ca2a16fd29192f79e368ef65c85582514"
integrity sha512-r1X/WS/mke9ozV3e11lHd+P8FFMttNepmfd9y8HXmbYRvLgFXEUKnYCQrQC56aJiNhRUwIxz/kdrcxMzBgYibg==
debug@2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"