@typus/typus-sdk 1.2.56 → 1.2.58

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.
@@ -17,4 +17,4 @@ export interface TxHistory {
17
17
  Date: Date;
18
18
  txDigest: string;
19
19
  }
20
- export declare function getUserBid(startTimestamp: string, userAddress: string): Promise<any[]>;
20
+ export declare function getFromSentio(event: string, userAddress: string, startTimestamp: string): Promise<any[]>;
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.getUserBid = exports.getAutoBidEvents = exports.getUserEvents = exports.getUserHistory = void 0;
42
+ exports.getFromSentio = exports.getAutoBidEvents = exports.getUserEvents = exports.getUserHistory = void 0;
43
43
  var token_1 = require("../token");
44
44
  var bignumber_js_1 = __importDefault(require("bignumber.js"));
45
45
  function getUserHistory(provider, originPackage, vaults, sender, startTimeMs) {
@@ -66,7 +66,7 @@ function getUserHistory(provider, originPackage, vaults, sender, startTimeMs) {
66
66
  return false;
67
67
  }
68
68
  }));
69
- return [4 /*yield*/, parseTxHistory(datas, originPackage, vaults)];
69
+ return [4 /*yield*/, parseTxHistory(datas.sort(function (a, b) { return Number(b.timestampMs) - Number(a.timestampMs); }), originPackage, vaults)];
70
70
  case 3:
71
71
  txHistory = _a.sent();
72
72
  return [2 /*return*/, txHistory];
@@ -161,7 +161,7 @@ function parseTxHistory(datas, originPackage, vaults) {
161
161
  return event.packageId == originPackage || type.includes("typus_nft::First") || type.includes("typus_nft::ExpUpEvent");
162
162
  })
163
163
  .reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
164
- var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, v, period, optionType, i, i, token, amount, deposit_amount, deposit_amount, balance, balance, profit, token, amount, amount, token, amount, size, token, amount, token, amount, i, size, bidder_balance;
164
+ var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, v, period, optionType, i, i, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, i, size, bidder_balance;
165
165
  var _a;
166
166
  return __generator(this, function (_b) {
167
167
  switch (_b.label) {
@@ -376,6 +376,11 @@ function parseTxHistory(datas, originPackage, vaults) {
376
376
  Amount = "".concat((0, bignumber_js_1.default)(balance).toFixed(), " ").concat(b_token, "\n").concat((0, bignumber_js_1.default)(profit).toFixed(), " ").concat(d_token);
377
377
  }
378
378
  break;
379
+ case "WithdrawProfitEvent":
380
+ Action = "Harvest Gain";
381
+ profit = Number(event.parsedJson.profit) / Math.pow(10, (0, token_1.assetToDecimal)(d_token));
382
+ Amount = "".concat((0, bignumber_js_1.default)(profit).toFixed(), " ").concat(d_token);
383
+ break;
379
384
  case "RedeemEvent":
380
385
  token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
381
386
  amount = Number(event.parsedJson.amount) / Math.pow(10, (0, token_1.assetToDecimal)(token));
@@ -461,7 +466,7 @@ function parseTxHistory(datas, originPackage, vaults) {
461
466
  });
462
467
  });
463
468
  }
464
- function getUserBid(startTimestamp, userAddress) {
469
+ function getFromSentio(event, userAddress, startTimestamp) {
465
470
  return __awaiter(this, void 0, void 0, function () {
466
471
  var apiUrl, headers, requestData, jsonData, response, data;
467
472
  return __generator(this, function (_a) {
@@ -474,7 +479,7 @@ function getUserBid(startTimestamp, userAddress) {
474
479
  };
475
480
  requestData = {
476
481
  sqlQuery: {
477
- sql: "\n SELECT *\n FROM NewBid\n WHERE distinct_id = \"".concat(userAddress, "\" && timestamp >= ").concat(startTimestamp, "\n ORDER BY timestamp DESC;\n "),
482
+ sql: "\n SELECT *\n FROM ".concat(event, "\n WHERE distinct_id = \"").concat(userAddress, "\" && timestamp >= ").concat(startTimestamp, "\n ORDER BY timestamp DESC;\n "),
478
483
  size: 1000,
479
484
  },
480
485
  };
@@ -494,4 +499,11 @@ function getUserBid(startTimestamp, userAddress) {
494
499
  });
495
500
  });
496
501
  }
497
- exports.getUserBid = getUserBid;
502
+ exports.getFromSentio = getFromSentio;
503
+ function getUserHistoryFromSentio(vaults, sender, startTimeMs) {
504
+ return __awaiter(this, void 0, void 0, function () {
505
+ return __generator(this, function (_a) {
506
+ return [2 /*return*/];
507
+ });
508
+ });
509
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.2.56",
5
+ "version": "1.2.58",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
8
  "@mysten/kiosk": "0.7.12",