@typus/typus-perp-sdk 1.1.41 → 1.1.43

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.
@@ -0,0 +1 @@
1
+ export declare function getRevenue(): Promise<Array<[string, number]>>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRevenue = getRevenue;
4
+ async function getRevenue() {
5
+ const apiUrl = "https://api.llama.fi/summary/fees/typus-finance?dataType=dailyRevenue";
6
+ const headers = {
7
+ Accept: "*/*",
8
+ };
9
+ const response = await fetch(apiUrl, {
10
+ method: "GET",
11
+ headers,
12
+ });
13
+ const data = await response.json();
14
+ const chart = Array.isArray(data?.totalDataChart) ? data.totalDataChart : [];
15
+ const monthly = aggregateMonthly(chart);
16
+ return monthly;
17
+ }
18
+ function aggregateMonthly(chart) {
19
+ const map = new Map();
20
+ for (const entry of chart) {
21
+ const ts = Number(entry[0]) || 0;
22
+ const val = Number(entry[1]) || 0;
23
+ const d = new Date(ts * 1000);
24
+ const ym = `${d.getUTCFullYear()}-${String(d.getUTCMonth() + 1).padStart(2, "0")}`;
25
+ map.set(ym, (map.get(ym) || 0) + val);
26
+ }
27
+ return Array.from(map.entries()).sort((a, b) => a[0].localeCompare(b[0]));
28
+ }
29
+ // getRevenue().then((data) => {
30
+ // console.log("Monthly sums:", data);
31
+ // });
@@ -721,7 +721,7 @@ async function getLeaderboardFromSentio(startTs, endTs) {
721
721
  t.distinct_id as Address,
722
722
  t.total_volume as Trading_Vol,
723
723
  cast(t.total_volume AS Decimal256(18)) / cast(s.top10_total_volume AS Decimal256(18)) AS Volume_Share_Top10,
724
- Volume_Share_Top10 * 150 as PrizePool_Share
724
+ Volume_Share_Top10 * 350 as PrizePool_Share
725
725
  FROM top10 t
726
726
  JOIN top10_sum s ON t.logical_date = s.logical_date
727
727
  WHERE Date >= ${startTs} AND Date < ${endTs}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typus/typus-perp-sdk",
3
- "version": "1.1.41",
3
+ "version": "1.1.43",
4
4
  "repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
5
5
  "author": "Typus",
6
6
  "description": "typus perp sdk",
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@mysten/bcs": "1.9.2",
10
10
  "@mysten/sui": "1.44.0",
11
- "@typus/typus-sdk": "1.8.39"
11
+ "@typus/typus-sdk": "1.8.40"
12
12
  },
13
13
  "resolutions": {
14
14
  "@mysten/bcs": "1.9.2",
@@ -45,4 +45,4 @@
45
45
  },
46
46
  "homepage": "https://github.com/Typus-Lab/typus-perp-sdk#readme",
47
47
  "packageManager": "yarn@4.10.3+sha512.c38cafb5c7bb273f3926d04e55e1d8c9dfa7d9c3ea1f36a4868fa028b9e5f72298f0b7f401ad5eb921749eb012eb1c3bb74bf7503df3ee43fd600d14a018266f"
48
- }
48
+ }