@typus/typus-sdk 1.2.13 → 1.2.14

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.
@@ -173,6 +173,7 @@ export declare function getWithdrawHarvestClaimTx(input: {
173
173
  */
174
174
  export declare function getNewBidTx(input: {
175
175
  tx: TransactionBlock;
176
+ typusFrameworkPackageId: string;
176
177
  typusDovSinglePackageId: string;
177
178
  typusDovSingleRegistry: string;
178
179
  typeArguments: string[];
@@ -455,13 +455,26 @@ function getNewBidTx(input) {
455
455
  input.tx.transferObjects([input.tx.object(result[0])], input.user);
456
456
  }
457
457
  else {
458
+ var balance = input.tx.moveCall({
459
+ target: "".concat(input.typusFrameworkPackageId, "::utils::extract_balance"),
460
+ typeArguments: [input.typeArguments[1]],
461
+ arguments: [
462
+ input.tx.makeMoveVec({ objects: input.coins.map(function (coin) { return input.tx.object(coin); }) }),
463
+ input.tx.pure(input.premium_required),
464
+ ],
465
+ });
466
+ var coin = input.tx.moveCall({
467
+ target: "0x2::coin::from_balance",
468
+ typeArguments: [input.typeArguments[1]],
469
+ arguments: [input.tx.object(balance)],
470
+ });
458
471
  var result = input.tx.moveCall({
459
472
  target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid"),
460
473
  typeArguments: input.typeArguments,
461
474
  arguments: [
462
475
  input.tx.object(input.typusDovSingleRegistry),
463
476
  input.tx.pure(input.index),
464
- input.tx.makeMoveVec({ objects: input.coins.map(function (coin) { return input.tx.object(coin); }) }),
477
+ input.tx.makeMoveVec({ objects: [coin] }),
465
478
  input.tx.pure(input.size),
466
479
  input.tx.pure("0x6"),
467
480
  ],
@@ -67,10 +67,7 @@ function getUserHistory(provider, originPackage, vaults, sender, startTimeMs) {
67
67
  case 5:
68
68
  nextPage = _a.sent();
69
69
  txHistory = txHistory.concat(nextPage);
70
- if (result.hasNextPage && Number(result.data[24].timestampMs) < startTimeMs) {
71
- return [3 /*break*/, 6];
72
- }
73
- return [3 /*break*/, 3];
70
+ return [3 /*break*/, 6];
74
71
  case 6: return [2 /*return*/, txHistory];
75
72
  }
76
73
  });
@@ -86,10 +83,10 @@ function parseTxHistory(datas, originPackage, vaults) {
86
83
  case 0: return [4 /*yield*/, datas
87
84
  .filter(function (event) {
88
85
  var type = event.type;
89
- return type.startsWith(originPackage) || type.includes("typus_nft::First") || type.includes("typus_nft::ExpUpEvent");
86
+ return event.packageId == originPackage || type.includes("typus_nft::First") || type.includes("typus_nft::ExpUpEvent");
90
87
  })
91
88
  .reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
92
- var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, o_token, v, period, optionType, i, i, token, amount, amount, token, amount, size, token, amount, token, amount, i, b_token, size, bidder_balance;
89
+ var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, o_token, v, period, optionType, i, i, token, amount, token, amount, amount, token, amount, size, token, amount, token, amount, i, b_token, size, bidder_balance;
93
90
  var _a;
94
91
  return __generator(this, function (_b) {
95
92
  switch (_b.label) {
@@ -134,6 +131,7 @@ function parseTxHistory(datas, originPackage, vaults) {
134
131
  case "ClaimEvent":
135
132
  case "CompoundEvent":
136
133
  case "HarvestEvent":
134
+ case "RedeemEvent":
137
135
  optionType = "Covered Call";
138
136
  break;
139
137
  default:
@@ -149,6 +147,7 @@ function parseTxHistory(datas, originPackage, vaults) {
149
147
  case "ClaimEvent":
150
148
  case "CompoundEvent":
151
149
  case "HarvestEvent":
150
+ case "RedeemEvent":
152
151
  optionType = "Put Selling";
153
152
  break;
154
153
  default:
@@ -261,6 +260,13 @@ function parseTxHistory(datas, originPackage, vaults) {
261
260
  return [2 /*return*/, txHistory];
262
261
  }
263
262
  break;
263
+ case "RedeemEvent":
264
+ token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
265
+ amount = Number(event.parsedJson.amount) / Math.pow(10, (0, token_1.assetToDecimal)(token));
266
+ Action = "Harvest";
267
+ Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
268
+ Index = event.parsedJson.index;
269
+ break;
264
270
  case "TransferBidReceiptEvent":
265
271
  amount = Number(event.parsedJson.amount) / Math.pow(10, Number(event.parsedJson.decimal));
266
272
  Action = "Transfer Receipt";
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.13",
5
+ "version": "1.2.14",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.3",
8
8
  "@mysten/kiosk": "0.7.12",