@typus/typus-sdk 1.2.25 → 1.2.27

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.
@@ -18,17 +18,18 @@ export interface StrategyV2 {
18
18
  target_rounds: string[];
19
19
  receipts: TypusBidReceipt[];
20
20
  active: boolean;
21
- string_padding: string[];
21
+ u64_padding: string[];
22
22
  bid_times: string;
23
23
  bid_round: string;
24
24
  bid_ts_ms: string;
25
25
  bid_rounds: string[];
26
26
  accumulated_profit: string;
27
- remaining_balance: string;
28
- gain_to_harvest: string;
27
+ remaining_balance: string | undefined;
28
+ gain_to_harvest: string | undefined;
29
29
  my_bids: {
30
30
  [key: string]: BidShare;
31
31
  };
32
+ status: "active" | "insufficient balance" | "finished";
32
33
  }
33
34
  export interface TypusBidReceipt {
34
35
  id: string;
@@ -173,8 +173,6 @@ function getUserStrategies(provider, packageId, registry, strategyPool, user
173
173
  }),
174
174
  accumulated_profit: reader.read64(),
175
175
  strategy_index: reader.read64(),
176
- // remaining_balance: reader.read64(),
177
- // gain_to_harvest: reader.read64(),
178
176
  };
179
177
  var my_bids = Array.from(new Map()).reduce(function (map, _a) {
180
178
  var _b = __read(_a, 2), key = _b[0], value = _b[1];
@@ -209,6 +207,17 @@ function getUserStrategies(provider, packageId, registry, strategyPool, user
209
207
  });
210
208
  // console.log(my_bids);
211
209
  strategy.my_bids = my_bids;
210
+ strategy.remaining_balance = strategy.u64_padding.at(0);
211
+ strategy.gain_to_harvest = strategy.u64_padding.at(1);
212
+ if (strategy.bid_times == strategy.max_times) {
213
+ strategy.status = "finished";
214
+ }
215
+ else if (!strategy.active) {
216
+ strategy.status = "insufficient balance";
217
+ }
218
+ else {
219
+ strategy.status = "active";
220
+ }
212
221
  // console.log(strategy);
213
222
  strategies.push(strategy);
214
223
  });
@@ -4,4 +4,9 @@ interface LeaderBoard {
4
4
  user: string;
5
5
  score: number;
6
6
  }
7
+ interface ExpEarn {
8
+ address: string;
9
+ total_exp_earn: number;
10
+ }
11
+ export declare function getExpLeaderBoard(startTimestamp: string): Promise<ExpEarn[]>;
7
12
  export {};
@@ -52,7 +52,7 @@ var __read = (this && this.__read) || function (o, n) {
52
52
  return ar;
53
53
  };
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.getBidderLeaderBoard = exports.getDepositorLeaderBoard = void 0;
55
+ exports.getExpLeaderBoard = exports.getBidderLeaderBoard = exports.getDepositorLeaderBoard = void 0;
56
56
  var apiUrl = "https://app.sentio.xyz/api/v1/insights/wayne/typus/query";
57
57
  var headers = {
58
58
  "api-key": "oBOW8DsO1izVrINCy6Tmxga9YcWeOL87O",
@@ -267,6 +267,40 @@ function getBidderLeaderBoard(startTimestamp, end) {
267
267
  });
268
268
  }
269
269
  exports.getBidderLeaderBoard = getBidderLeaderBoard;
270
+ function getExpLeaderBoard(startTimestamp) {
271
+ return __awaiter(this, void 0, void 0, function () {
272
+ var apiUrl, headers, requestData, jsonData, response, data;
273
+ return __generator(this, function (_a) {
274
+ switch (_a.label) {
275
+ case 0:
276
+ apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
277
+ headers = {
278
+ "api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
279
+ "Content-Type": "application/json",
280
+ };
281
+ requestData = {
282
+ sqlQuery: {
283
+ sql: "SELECT S.distinct_id as address, SUM(E.exp_earn) as total_exp_earn\nFROM ExpUp E\nJOIN StakeNft S ON E.number = S.number\nWHERE timestamp >= ".concat(startTimestamp, "\nGROUP BY address\nORDER BY total_exp_earn DESC;"),
284
+ size: 1000,
285
+ },
286
+ };
287
+ jsonData = JSON.stringify(requestData);
288
+ return [4 /*yield*/, fetch(apiUrl, {
289
+ method: "POST",
290
+ headers: headers,
291
+ body: jsonData,
292
+ })];
293
+ case 1:
294
+ response = _a.sent();
295
+ return [4 /*yield*/, response.json()];
296
+ case 2:
297
+ data = _a.sent();
298
+ return [2 /*return*/, data.result.rows];
299
+ }
300
+ });
301
+ });
302
+ }
303
+ exports.getExpLeaderBoard = getExpLeaderBoard;
270
304
  (function () { return __awaiter(void 0, void 0, void 0, function () {
271
305
  return __generator(this, function (_a) {
272
306
  return [2 /*return*/];
@@ -165,7 +165,7 @@ function getCreateKioskAndLockNftTx(kioskClient, gasBudget, nftPackageId, policy
165
165
  tx = new transactions_1.TransactionBlock();
166
166
  kioskTx = new kiosk_1.KioskTransaction({ transactionBlock: tx, kioskClient: kioskClient });
167
167
  kioskTx.create();
168
- kioskTx.lock({ itemType: "".concat(nftPackageId, "::typus_nft::Tails"), itemId: nft_id, policy: policy });
168
+ kioskTx.lock({ itemType: "".concat(nftPackageId, "::typus_nft::Tails"), itemId: nft_id, policy: policy, item: nft_id });
169
169
  kiosk = kioskTx.kiosk, kioskCap = kioskTx.kioskCap;
170
170
  if (kiosk && kioskCap) {
171
171
  tx.moveCall({
package/package.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.2.25",
5
+ "version": "1.2.27",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
- "@mysten/kiosk": "0.7.12",
9
- "@mysten/sui.js": "0.48.0",
8
+ "@mysten/kiosk": "0.8.3",
9
+ "@mysten/sui.js": "0.50.1",
10
10
  "@types/node": "^20.5.7",
11
11
  "aftermath-ts-sdk": "^1.1.14",
12
12
  "bignumber.js": "^9.1.1",