@typus/typus-sdk 1.2.49 → 1.2.51

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.
package/lib/mainnet.json CHANGED
@@ -30,12 +30,12 @@
30
30
  "SCALLOP_MARKET": "0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9",
31
31
  "SCALLOP_REWARD_POOL_FOR_SUI": "0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9",
32
32
  "SCALLOP_REWARD_POOL_FOR_USDC": "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8",
33
- "VERSION": "2.18.13",
33
+ "VERSION": "2.19.3",
34
34
  "EXP_GUESS_PACKAGE": "0x32d670520a10a87b8c042d2259c2d1f7c319329bafcf6f893ad9aaf01a43db8b",
35
35
  "EXP_GUESS_PACKAGE_ORIGIN": "0x32d670520a10a87b8c042d2259c2d1f7c319329bafcf6f893ad9aaf01a43db8b",
36
36
  "EXP_GUESS_REGISTRY": "0x70c6cbe6764b315cee1b24f483a0fc8307f047f1fab2a0d4438624845e6ba3f2",
37
37
  "FRAMEWORK_PACKAGE": "0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274",
38
- "SINGLE_COLLATERAL_PACKAGE": "0xb12e58dee672ad3161e023ac2315e2d39866fbf0960abcb1ce755f24f5578b59",
38
+ "SINGLE_COLLATERAL_PACKAGE": "0x7de806a4277bc31aa12afdce194c38f89cb2f171539a426375dbe730db2d0221",
39
39
  "SINGLE_COLLATERAL_PACKAGE_ORIGIN": "0x321848bf1ae327a9e022ccb3701940191e02fa193ab160d9c0e49cd3c003de3a",
40
40
  "SINGLE_COLLATERAL_REGISTRY": "0x3d70b09359e3ca8301ae0abeda4f2fdf72ce313ba58c919ce568e5f535fd2ea8",
41
41
  "SINGLE_COLLATERAL_PORTFOLIO_VAULT_REGISTRY": "0xa1a186d050e3172ef4701c16048c99b11f785969874fa2642b9cbcf59cde7fc0",
@@ -319,6 +319,11 @@ function getNewBidTx(input) {
319
319
  ],
320
320
  });
321
321
  input.tx.transferObjects([input.tx.object(result[0])], input.user);
322
+ var fud_coin = input.tx.moveCall({
323
+ target: "".concat(input.mfudPackageId, "::mfud::burn"),
324
+ arguments: [input.tx.object(input.mfudRegistry), input.tx.object(result[1])],
325
+ });
326
+ input.tx.transferObjects([input.tx.object(fud_coin)], input.user);
322
327
  return input.tx;
323
328
  }
324
329
  exports.getNewBidTx = getNewBidTx;
@@ -442,7 +442,7 @@ function getNewBidTx(input) {
442
442
  input.typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
443
443
  var _a = __read(input.tx.splitCoins(input.tx.gas, [input.tx.pure(input.premium_required)]), 1), coin = _a[0];
444
444
  var result = input.tx.moveCall({
445
- target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid"),
445
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid_v2"),
446
446
  typeArguments: input.typeArguments,
447
447
  arguments: [
448
448
  input.tx.object(input.typusDovSingleRegistry),
@@ -453,6 +453,11 @@ function getNewBidTx(input) {
453
453
  ],
454
454
  });
455
455
  input.tx.transferObjects([input.tx.object(result[0])], input.user);
456
+ input.tx.moveCall({
457
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_coins"),
458
+ typeArguments: [input.typeArguments[1]],
459
+ arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
460
+ });
456
461
  }
457
462
  else {
458
463
  var balance = input.tx.moveCall({
@@ -469,7 +474,7 @@ function getNewBidTx(input) {
469
474
  arguments: [input.tx.object(balance)],
470
475
  });
471
476
  var result = input.tx.moveCall({
472
- target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid"),
477
+ target: "".concat(input.typusDovSinglePackageId, "::tails_staking::new_bid_v2"),
473
478
  typeArguments: input.typeArguments,
474
479
  arguments: [
475
480
  input.tx.object(input.typusDovSingleRegistry),
@@ -480,6 +485,11 @@ function getNewBidTx(input) {
480
485
  ],
481
486
  });
482
487
  input.tx.transferObjects([input.tx.object(result[0])], input.user);
488
+ input.tx.moveCall({
489
+ target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_coins"),
490
+ typeArguments: [input.typeArguments[1]],
491
+ arguments: [input.tx.object(result[1]), input.tx.pure(input.user)],
492
+ });
483
493
  }
484
494
  return input.tx;
485
495
  }
@@ -89,7 +89,7 @@ function parseTxHistory(datas, originPackage, vaults) {
89
89
  return event.packageId == originPackage || type.includes("typus_nft::First") || type.includes("typus_nft::ExpUpEvent");
90
90
  })
91
91
  .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, token, amount, amount, token, amount, size, token, amount, token, amount, i, b_token, size, bidder_balance;
92
+ 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;
93
93
  var _a;
94
94
  return __generator(this, function (_b) {
95
95
  switch (_b.label) {
@@ -98,9 +98,9 @@ function parseTxHistory(datas, originPackage, vaults) {
98
98
  txHistory = _b.sent();
99
99
  functionType = (_a = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type)) === null || _a === void 0 ? void 0 : _a.slice(1, 4);
100
100
  action = functionType[2];
101
- Index = event.parsedJson.index;
102
- if (event.parsedJson.index) {
103
- v = vaults[event.parsedJson.index];
101
+ Index = event.parsedJson.index || event.parsedJson.vault_index;
102
+ if (Index) {
103
+ v = vaults[Index];
104
104
  if (v) {
105
105
  period = void 0;
106
106
  switch (v.info.period) {
@@ -192,6 +192,8 @@ function parseTxHistory(datas, originPackage, vaults) {
192
192
  break;
193
193
  }
194
194
  Vault = "".concat(v.info.settlementBaseName, " ").concat(period, " ").concat(optionType);
195
+ d_token = (0, token_1.typeArgToAsset)("0x" + v.info.depositToken);
196
+ b_token = (0, token_1.typeArgToAsset)("0x" + v.info.bidToken);
195
197
  o_token = (0, token_1.typeArgToAsset)("0x" + v.info.settlementBase);
196
198
  }
197
199
  }
@@ -240,8 +242,13 @@ function parseTxHistory(datas, originPackage, vaults) {
240
242
  break;
241
243
  case "LevelUpEvent":
242
244
  Action = "Level Up to Level ".concat(event.parsedJson.level);
243
- Tails = "#".concat(event.parsedJson.number);
244
- break;
245
+ if (event.parsedJson.number) {
246
+ Tails = "#".concat(event.parsedJson.number);
247
+ break;
248
+ }
249
+ else {
250
+ return [2 /*return*/, txHistory];
251
+ }
245
252
  case "DepositEvent":
246
253
  case "WithdrawEvent":
247
254
  case "UnsubscribeEvent":
@@ -252,8 +259,11 @@ function parseTxHistory(datas, originPackage, vaults) {
252
259
  token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
253
260
  amount = Number(event.parsedJson.amount) / Math.pow(10, Number(event.parsedJson.decimal));
254
261
  Action = action.slice(0, action.length - 5);
262
+ if (Action == "Harvest") {
263
+ Action = "Harvest Reward";
264
+ }
255
265
  Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
256
- Index = event.parsedJson.index;
266
+ Index = Index;
257
267
  if (i != -1) {
258
268
  txHistory[i].Action = Action;
259
269
  txHistory[i].Amount = Amount;
@@ -263,12 +273,35 @@ function parseTxHistory(datas, originPackage, vaults) {
263
273
  return [2 /*return*/, txHistory];
264
274
  }
265
275
  break;
276
+ case "NewStrategyEventV2":
277
+ Action = "Create Strategy";
278
+ deposit_amount = Number(event.parsedJson.deposit_amount) / Math.pow(10, (0, token_1.assetToDecimal)(b_token));
279
+ Amount = "".concat((0, bignumber_js_1.default)(deposit_amount).toFixed(), " ").concat(b_token);
280
+ break;
281
+ case "UpdateStrategyEvent":
282
+ Action = "Update Strategy";
283
+ deposit_amount = Number(event.parsedJson.deposit_amount) / Math.pow(10, (0, token_1.assetToDecimal)(b_token));
284
+ Amount = "".concat((0, bignumber_js_1.default)(deposit_amount).toFixed(), " ").concat(b_token);
285
+ break;
286
+ case "CloseStrategyEventV2":
287
+ Action = "Close Strategy";
288
+ if (b_token == d_token) {
289
+ balance = (Number(event.parsedJson.u64_padding[0]) + Number(event.parsedJson.u64_padding[1])) /
290
+ Math.pow(10, (0, token_1.assetToDecimal)(b_token));
291
+ Amount = "".concat((0, bignumber_js_1.default)(balance).toFixed(), " ").concat(b_token);
292
+ }
293
+ else {
294
+ balance = Number(event.parsedJson.u64_padding[0]) / Math.pow(10, (0, token_1.assetToDecimal)(b_token));
295
+ profit = Number(event.parsedJson.u64_padding[1]) / Math.pow(10, (0, token_1.assetToDecimal)(d_token));
296
+ Amount = "".concat((0, bignumber_js_1.default)(balance).toFixed(), " ").concat(b_token, "\n").concat((0, bignumber_js_1.default)(profit).toFixed(), " ").concat(d_token);
297
+ }
298
+ break;
266
299
  case "RedeemEvent":
267
300
  token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
268
301
  amount = Number(event.parsedJson.amount) / Math.pow(10, (0, token_1.assetToDecimal)(token));
269
302
  Action = "Harvest";
270
303
  Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
271
- Index = event.parsedJson.index;
304
+ Index = Index;
272
305
  break;
273
306
  case "TransferBidReceiptEvent":
274
307
  amount = Number(event.parsedJson.amount) / Math.pow(10, Number(event.parsedJson.decimal));
@@ -307,6 +340,8 @@ function parseTxHistory(datas, originPackage, vaults) {
307
340
  Action = action.slice(0, action.length - 5) + " ".concat(size, " ").concat(o_token);
308
341
  Amount = "".concat((0, bignumber_js_1.default)(bidder_balance).toFixed(), " ").concat(b_token);
309
342
  if (i != -1) {
343
+ txHistory[i].Index = Index;
344
+ txHistory[i].Period = Period;
310
345
  txHistory[i].Action = Action;
311
346
  txHistory[i].Amount = Amount;
312
347
  txHistory[i].Vault = Vault;
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.49",
5
+ "version": "1.2.51",
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.4",
9
+ "@mysten/sui.js": "0.51.0",
10
10
  "@types/node": "^20.5.7",
11
11
  "aftermath-ts-sdk": "^1.1.14",
12
12
  "bignumber.js": "^9.1.1",