@typus/typus-perp-sdk 1.1.32-codegen-exp21 → 1.1.32-codegen-exp22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,10 +27,10 @@ export declare function getAccumulatedUser(): Promise<number>;
27
27
  * Returns
28
28
  * { timestamp: string, value: number }[]
29
29
  */
30
- export declare function getTlpPriceFromSentio(fromTimestamp?: number, toTimestamp?: number): Promise<{
30
+ export declare function getTlpPriceFromSentio(fromTimestamp?: number, toTimestamp?: number): Promise<Map<string, {
31
31
  timestamp: string;
32
32
  value: number;
33
- }[]>;
33
+ }[]>>;
34
34
  export declare function getTlpComparisonFromSentio(startTimestamp: number, endTimestamp: number): Promise<tlpComparison[]>;
35
35
  interface tlpComparison {
36
36
  hour: string;
@@ -392,8 +392,9 @@ async function getAccumulatedUser() {
392
392
  * { timestamp: string, value: number }[]
393
393
  */
394
394
  async function getTlpPriceFromSentio(fromTimestamp, toTimestamp) {
395
- let apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_perp/query";
395
+ let apiUrl = "https://api.sentio.xyz/v1/insights/typus/typus_perp/query";
396
396
  let requestData = {
397
+ version: 3,
397
398
  timeRange: {
398
399
  start: `${fromTimestamp ?? 0}`,
399
400
  end: `${toTimestamp ?? now()}`,
@@ -417,6 +418,11 @@ async function getTlpPriceFromSentio(fromTimestamp, toTimestamp) {
417
418
  },
418
419
  ],
419
420
  formulas: [],
421
+ cachePolicy: {
422
+ noCache: false,
423
+ cacheTtlSecs: 43200,
424
+ cacheRefreshTtlSecs: 1800,
425
+ },
420
426
  };
421
427
  let jsonData = JSON.stringify(requestData);
422
428
  let response = await fetch(apiUrl, {
@@ -425,10 +431,14 @@ async function getTlpPriceFromSentio(fromTimestamp, toTimestamp) {
425
431
  body: jsonData,
426
432
  });
427
433
  let data = await response.json();
428
- // console.log(data);
434
+ // console.dir(data, { depth: null });
429
435
  let samples = data.results[0].matrix.samples;
430
436
  // console.log(samples[0].values);
431
- return samples[0].values;
437
+ let map = new Map();
438
+ samples.forEach((sample) => {
439
+ map.set(sample.metric.labels.index, sample.values);
440
+ });
441
+ return map;
432
442
  }
433
443
  async function getTlpComparisonFromSentio(startTimestamp, endTimestamp) {
434
444
  let apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_perp/sql/execute";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typus/typus-perp-sdk",
3
- "version": "1.1.32-codegen-exp21",
3
+ "version": "1.1.32-codegen-exp22",
4
4
  "repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
5
5
  "author": "Typus",
6
6
  "description": "typus perp sdk",
@@ -44,4 +44,4 @@
44
44
  },
45
45
  "homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme",
46
46
  "packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f"
47
- }
47
+ }