@typus/typus-perp-sdk 1.0.72 → 1.0.74

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.
@@ -13,8 +13,8 @@ export interface Volume {
13
13
  timestamp: string;
14
14
  value: number;
15
15
  }
16
- export declare function getTlpFeeFromSentio(fromTimestamp: number, toTimestamp?: number): Promise<number>;
17
- export declare function getTotalVolumeFromSentio(fromTimestamp: number, toTimestamp?: number): Promise<number>;
16
+ export declare function getTlpFeeFromSentio(fromTimestamp?: number, toTimestamp?: number): Promise<number>;
17
+ export declare function getTotalVolumeFromSentio(fromTimestamp?: number, toTimestamp?: number): Promise<number>;
18
18
  /** Returns Accumulated Users */
19
19
  export declare function getAccumulatedUser(): Promise<number>;
20
20
  /**
@@ -24,7 +24,7 @@ export declare function getAccumulatedUser(): Promise<number>;
24
24
  * Returns
25
25
  * { timestamp: string, value: number }[]
26
26
  */
27
- export declare function getTlpPriceFromSentio(fromTimestamp: number, toTimestamp?: number): Promise<{
27
+ export declare function getTlpPriceFromSentio(fromTimestamp?: number, toTimestamp?: number): Promise<{
28
28
  timestamp: string;
29
29
  value: number;
30
30
  }[]>;
@@ -175,14 +175,14 @@ function now() {
175
175
  }
176
176
  function getTlpFeeFromSentio(fromTimestamp, toTimestamp) {
177
177
  return __awaiter(this, void 0, void 0, function () {
178
- var apiUrl, requestData, jsonData, response, data, first, last, fee;
178
+ var apiUrl, requestData, jsonData, response, data, first, last, initial_value, fee;
179
179
  return __generator(this, function (_a) {
180
180
  switch (_a.label) {
181
181
  case 0:
182
182
  apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_perp_mainnet/query";
183
183
  requestData = {
184
184
  timeRange: {
185
- start: "".concat(fromTimestamp),
185
+ start: "".concat(fromTimestamp !== null && fromTimestamp !== void 0 ? fromTimestamp : 0),
186
186
  end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp : now()),
187
187
  step: 3600,
188
188
  },
@@ -220,7 +220,8 @@ function getTlpFeeFromSentio(fromTimestamp, toTimestamp) {
220
220
  data = _a.sent();
221
221
  first = data.results[0].matrix.samples[0].values[0];
222
222
  last = data.results[0].matrix.samples[0].values.at(-1);
223
- fee = last.value - first.value;
223
+ initial_value = fromTimestamp ? first.value : 0;
224
+ fee = last.value - initial_value;
224
225
  // console.log(fee);
225
226
  return [2 /*return*/, fee];
226
227
  }
@@ -229,14 +230,14 @@ function getTlpFeeFromSentio(fromTimestamp, toTimestamp) {
229
230
  }
230
231
  function getTotalVolumeFromSentio(fromTimestamp, toTimestamp) {
231
232
  return __awaiter(this, void 0, void 0, function () {
232
- var apiUrl, requestData, jsonData, response, data, result;
233
+ var apiUrl, requestData, jsonData, response, data, initial_value, result;
233
234
  return __generator(this, function (_a) {
234
235
  switch (_a.label) {
235
236
  case 0:
236
237
  apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_perp_mainnet/query";
237
238
  requestData = {
238
239
  timeRange: {
239
- start: "".concat(fromTimestamp),
240
+ start: "".concat(fromTimestamp !== null && fromTimestamp !== void 0 ? fromTimestamp : 0),
240
241
  end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp : now()),
241
242
  step: 3600,
242
243
  },
@@ -273,7 +274,8 @@ function getTotalVolumeFromSentio(fromTimestamp, toTimestamp) {
273
274
  return [4 /*yield*/, response.json()];
274
275
  case 2:
275
276
  data = _a.sent();
276
- result = data.results[0].matrix.samples[0].values.at(-1).value - data.results[0].matrix.samples[0].values.at(0).value;
277
+ initial_value = fromTimestamp ? data.results[0].matrix.samples[0].values.at(0).value : 0;
278
+ result = data.results[0].matrix.samples[0].values.at(-1).value - initial_value;
277
279
  // console.log(result);
278
280
  return [2 /*return*/, result];
279
281
  }
@@ -358,7 +360,7 @@ function getTlpPriceFromSentio(fromTimestamp, toTimestamp) {
358
360
  apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_perp_mainnet/query";
359
361
  requestData = {
360
362
  timeRange: {
361
- start: "".concat(fromTimestamp),
363
+ start: "".concat(fromTimestamp !== null && fromTimestamp !== void 0 ? fromTimestamp : 0),
362
364
  end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp : now()),
363
365
  step: 3600,
364
366
  },
@@ -402,6 +404,6 @@ function getTlpPriceFromSentio(fromTimestamp, toTimestamp) {
402
404
  // getVolumeFromSentio();
403
405
  // getAccumulatedUser().then((x) => console.log(x));
404
406
  // getTradingVolumeFromSentio(1747008000, 1, 1747011600);
405
- // getTlpPriceFromSentio(now() - 3600 * 24 * 30).then((x) => console.dir(x, { depth: null }));
406
- // getTotalVolumeFromSentio(now() - 3600 * 24 * 30).then((x) => console.log(x));
407
- // getTlpFeeFromSentio(now() - 3600 * 24 * 30).then((x) => console.log(x));
407
+ // getTlpPriceFromSentio(0).then((x) => console.dir(x, { depth: null }));
408
+ // getTotalVolumeFromSentio(0).then((x) => console.log(x));
409
+ // getTlpFeeFromSentio(0).then((x) => console.log(x));
package/dist/src/index.js CHANGED
@@ -36,7 +36,7 @@ transactions_1.Transaction.registerGlobalSerializationPlugin("namedPackagesPlugi
36
36
  exports.PERP_PACKAGE_ID = exports.NETWORK == "MAINNET"
37
37
  ? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5"
38
38
  : "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9";
39
- exports.PERP_PUBLISHED_AT = exports.NETWORK == "MAINNET" ? "0xceddbccc7c674aba60f97104bbe218c59c84f6099d5692a35ec390c5c2dd1131" : "@typus/perp";
39
+ exports.PERP_PUBLISHED_AT = exports.NETWORK == "MAINNET" ? "0x4b119d8c0e7c87a1b25df8ef3646a5205f1a20811930f742656e7db97dd2e3f5" : "@typus/perp";
40
40
  exports.PERP_PKG_V1 = exports.NETWORK == "MAINNET"
41
41
  ? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5"
42
42
  : "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9";
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@typus/typus-perp-sdk",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
5
5
  "author": "Typus",
6
6
  "description": "typus perp sdk",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "@typus/typus-sdk": "1.7.2"
9
+ "@typus/typus-sdk": "1.7.4"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/bs58": "^4.0.1",