@typus/typus-sdk 1.2.96 → 1.2.97

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.
@@ -149,7 +149,7 @@ function parseTxHistory(datas, originPackage, vaults) {
149
149
  }
150
150
  })
151
151
  .reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
152
- var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, i, i, i, token, amount, token, amount, amount, token, amount, token, amount, token, amount, token, amount, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, size, bidder_balance;
152
+ var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, i, i, i, token, amount, token, amount, amount, token, amount, token, amount, token, amount, b_token_name, b_token_amount, i_token_name, i_token_amount, token, amount, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, size, bidder_balance;
153
153
  var _a, _b, _c;
154
154
  var _d;
155
155
  return __generator(this, function (_e) {
@@ -303,25 +303,6 @@ function parseTxHistory(datas, originPackage, vaults) {
303
303
  txDigest: event.id.txDigest,
304
304
  });
305
305
  }
306
- if (event.parsedJson.log[6] > 0) {
307
- // harvest
308
- Action = "Harvest";
309
- token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.b_token.name);
310
- amount = Number(event.parsedJson.log[6]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
311
- Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
312
- txHistory.push({
313
- Index: Index,
314
- Period: Period,
315
- Action: Action,
316
- Amount: Amount,
317
- Vault: Vault,
318
- RiskLevel: RiskLevel,
319
- Tails: Tails,
320
- Exp: Exp,
321
- Date: new Date(Number(event.timestampMs)),
322
- txDigest: event.id.txDigest,
323
- });
324
- }
325
306
  if (event.parsedJson.log[9] > 0) {
326
307
  // claim
327
308
  Action = "Claim";
@@ -341,12 +322,18 @@ function parseTxHistory(datas, originPackage, vaults) {
341
322
  txDigest: event.id.txDigest,
342
323
  });
343
324
  }
344
- if (event.parsedJson.log[10] > 0) {
345
- // redeem
346
- Action = "Harvest Reward";
347
- token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.i_token.name);
348
- amount = Number(event.parsedJson.log[10]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
349
- Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
325
+ if (event.parsedJson.log[6] > 0 && event.parsedJson.log[10] > 0) {
326
+ // Harvest d token and i token
327
+ Action = "Harvest";
328
+ b_token_name = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.b_token.name);
329
+ b_token_amount = Number(event.parsedJson.log[6]) / Math.pow(10, (0, token_1.assetToDecimal)(b_token_name));
330
+ i_token_name = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.i_token.name);
331
+ i_token_amount = Number(event.parsedJson.log[10]) / Math.pow(10, (0, token_1.assetToDecimal)(i_token_name));
332
+ Amount = "".concat((0, bignumber_js_1.default)(b_token_amount).toFixed(), " ").concat(b_token_name, "\n").concat((0, bignumber_js_1.default)(i_token_amount).toFixed(), " ").concat(i_token_name);
333
+ // var amount =
334
+ // Number(event.parsedJson!.log[6]) / 10 ** assetToDecimal(token)!
335
+ // Number(event.parsedJson!.log[10]) / 10 ** assetToDecimal(token)!;
336
+ // Amount = `${BigNumber(amount).toFixed()} ${token}`;
350
337
  txHistory.push({
351
338
  Index: Index,
352
339
  Period: Period,
@@ -360,6 +347,46 @@ function parseTxHistory(datas, originPackage, vaults) {
360
347
  txDigest: event.id.txDigest,
361
348
  });
362
349
  }
350
+ else {
351
+ if (event.parsedJson.log[6] > 0) {
352
+ // harvest
353
+ Action = "Harvest";
354
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.b_token.name);
355
+ amount = Number(event.parsedJson.log[6]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
356
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
357
+ txHistory.push({
358
+ Index: Index,
359
+ Period: Period,
360
+ Action: Action,
361
+ Amount: Amount,
362
+ Vault: Vault,
363
+ RiskLevel: RiskLevel,
364
+ Tails: Tails,
365
+ Exp: Exp,
366
+ Date: new Date(Number(event.timestampMs)),
367
+ txDigest: event.id.txDigest,
368
+ });
369
+ }
370
+ if (event.parsedJson.log[10] > 0) {
371
+ // redeem
372
+ Action = "Harvest Reward";
373
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.i_token.name);
374
+ amount = Number(event.parsedJson.log[10]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
375
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
376
+ txHistory.push({
377
+ Index: Index,
378
+ Period: Period,
379
+ Action: Action,
380
+ Amount: Amount,
381
+ Vault: Vault,
382
+ RiskLevel: RiskLevel,
383
+ Tails: Tails,
384
+ Exp: Exp,
385
+ Date: new Date(Number(event.timestampMs)),
386
+ txDigest: event.id.txDigest,
387
+ });
388
+ }
389
+ }
363
390
  return [2 /*return*/, txHistory];
364
391
  case "NewStrategyEventV2":
365
392
  Action = "Create Strategy";
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.96",
5
+ "version": "1.2.97",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
8
  "@mysten/kiosk": "0.8.10",