@typus/typus-sdk 0.4.3 → 0.4.4

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.
@@ -53,7 +53,7 @@ var apiToken = "5864284783:AAHwXWgt2YgLENdJ9mVBUDBVLHXrMLNgkic";
53
53
  */
54
54
  var chatId = "-1001784476809";
55
55
  (function () { return __awaiter(void 0, void 0, void 0, function () {
56
- var bidTypes, newAuctionType, endAuctionTypes, renewSec, vault;
56
+ var bidTypes, newAuctionType, endAuctionType, renewSec, vault;
57
57
  return __generator(this, function (_a) {
58
58
  switch (_a.label) {
59
59
  case 0:
@@ -63,11 +63,7 @@ var chatId = "-1001784476809";
63
63
  constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewBid<" + constants_1.TOKEN_PACKAGE + "::sui::SUI>",
64
64
  ];
65
65
  newAuctionType = constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewAuction";
66
- endAuctionTypes = [
67
- constants_1.DOV_PACKAGE + "::dutch::Delivery<" + constants_1.TOKEN_PACKAGE + "::eth::ETH>",
68
- constants_1.DOV_PACKAGE + "::dutch::Delivery<" + constants_1.TOKEN_PACKAGE + "::btc::BTC>",
69
- constants_1.DOV_PACKAGE + "::dutch::Delivery<" + constants_1.TOKEN_PACKAGE + "::sui::SUI>",
70
- ];
66
+ endAuctionType = constants_1.DOV_PACKAGE + "::dutch::Delivery<" + constants_1.TOKEN_PACKAGE + "::eth::ETH>";
71
67
  renewSec = 10;
72
68
  return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.COVERED_CALL_REGISTRY)];
73
69
  case 1:
@@ -85,16 +81,9 @@ var chatId = "-1001784476809";
85
81
  return [4 /*yield*/, getNewAuctionEventsCranker(newAuctionType, renewSec, vault)]; //evolution
86
82
  case 2:
87
83
  _a.sent(); //evolution
88
- endAuctionTypes.map(function (endAuctionType) { return __awaiter(void 0, void 0, void 0, function () {
89
- return __generator(this, function (_a) {
90
- switch (_a.label) {
91
- case 0: return [4 /*yield*/, getEndAuctionEventsCranker(endAuctionType, renewSec, vault)];
92
- case 1:
93
- _a.sent();
94
- return [2 /*return*/];
95
- }
96
- });
97
- }); });
84
+ return [4 /*yield*/, getEndAuctionEventsCranker(endAuctionType, renewSec, vault)];
85
+ case 3:
86
+ _a.sent();
98
87
  return [2 /*return*/];
99
88
  }
100
89
  });
@@ -105,14 +94,20 @@ function generateBidId(vault) {
105
94
  return __generator(this, function (_a) {
106
95
  liveVault = vault === null || vault === void 0 ? void 0 : vault.filter(function (v) {
107
96
  var start = moment_1.default.unix(Number(v.config.activationTsMs) / 1000);
108
- return start.isBefore((0, moment_1.default)());
97
+ var settled = v.vault.ableToDeposit === false && v.vault.ableToWithdraw === true;
98
+ return start.isBefore((0, moment_1.default)()) && !settled;
109
99
  });
110
100
  res = liveVault.map(function (v) {
101
+ var time = v.config.expirationTsMs;
111
102
  var expiration = moment_1.default
112
- .unix(Number(v.config.expirationTsMs) / 1000)
103
+ .unix(Number(time) / 1000)
113
104
  .format("DDMMMYY");
114
105
  var bidId = "".concat(v.asset, "-").concat(expiration, "-").concat(v.config.payoffConfig.strike, "-C");
115
- return bidId;
106
+ var obj = {
107
+ bidFormat: bidId,
108
+ bidTime: Number(time)
109
+ };
110
+ return obj;
116
111
  });
117
112
  return [2 /*return*/, res];
118
113
  });
@@ -154,13 +149,18 @@ function getBidEventsCranker(type, renewSec, vault) {
154
149
  // 'ETH-17Jan23-1750-C',
155
150
  // 'SUI-18Jan23-9-C'
156
151
  // ]
152
+ console.log(bidIds_1);
157
153
  newBid.map(function (e) { return __awaiter(_this, void 0, void 0, function () {
158
154
  var bidId, size;
159
155
  return __generator(this, function (_a) {
160
- bidId = bidIds_1.find(function (bidId) { return e.event.moveEvent.type.includes(bidId.split("-")[0]); });
156
+ bidId = bidIds_1.find(function (bidId) {
157
+ var type = e.event.moveEvent.type;
158
+ var asset = bidId.bidFormat.split("-")[0];
159
+ return e.event.moveEvent.type.includes(bidId.bidFormat.split("-")[0]);
160
+ });
161
161
  if (bidId) {
162
162
  size = (Number(e.event.moveEvent.fields.size) / (Math.pow(10, constants_1.TOKEN_DECIMAL))).toString();
163
- format_1 += bidId + " is bid with " + size + " " + bidId.split("-")[0] + "! \n";
163
+ format_1 += bidId.bidFormat + " is bid with " + size + " " + bidId.bidFormat.split("-")[0] + "! \n";
164
164
  }
165
165
  else {
166
166
  console.log("can't get bidId in getBidEventsCranker");
@@ -170,7 +170,7 @@ function getBidEventsCranker(type, renewSec, vault) {
170
170
  }); });
171
171
  telegramText = format_1;
172
172
  console.log(telegramText);
173
- sendEventToTelegramChannel(telegramText);
173
+ // sendEventToTelegramChannel(telegramText)
174
174
  res = newRes;
175
175
  _a.label = 3;
176
176
  case 3: return [2 /*return*/];
@@ -204,13 +204,13 @@ function getNewAuctionEventsCranker(type, renewSec, vault) {
204
204
  bidIds = _a.sent();
205
205
  bidIds.map(function (bidId) { return __awaiter(_this, void 0, void 0, function () {
206
206
  return __generator(this, function (_a) {
207
- format_2 += bidId + " auction is live now! \n";
207
+ format_2 += bidId.bidFormat + " auction is live now! \n";
208
208
  return [2 /*return*/];
209
209
  });
210
210
  }); });
211
211
  telegramText = format_2;
212
212
  console.log(telegramText);
213
- sendEventToTelegramChannel(telegramText);
213
+ // sendEventToTelegramChannel(telegramText)
214
214
  res = newRes;
215
215
  _a.label = 3;
216
216
  case 3: return [2 /*return*/];
@@ -244,13 +244,13 @@ function getEndAuctionEventsCranker(type, renewSec, vault) {
244
244
  bidIds = _a.sent();
245
245
  bidIds.map(function (bidId) { return __awaiter(_this, void 0, void 0, function () {
246
246
  return __generator(this, function (_a) {
247
- format_3 += bidId + " auction is closed! \n";
247
+ format_3 += bidId.bidFormat + " auction is closed! \n";
248
248
  return [2 /*return*/];
249
249
  });
250
250
  }); });
251
251
  telegramText = format_3;
252
252
  console.log(telegramText);
253
- sendEventToTelegramChannel(telegramText);
253
+ // sendEventToTelegramChannel(telegramText)
254
254
  res = newRes;
255
255
  _a.label = 3;
256
256
  case 3: return [2 /*return*/];
@@ -56,12 +56,12 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
56
56
  isRolling = true;
57
57
  token = "0x8f306b0fcbcbdee0b3a5e694c06039dfe8ca7f14" // minted token
58
58
  ;
59
- vaultIndex = "59";
59
+ vaultIndex = ["59"];
60
60
  return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
61
61
  case 1:
62
62
  typeArgument = _a.sent();
63
63
  console.log("test for claim, try to claim " + token + " for " + claimAmount + " ...");
64
- return [4 /*yield*/, (0, getClaimTx_1.getClaimTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex)];
64
+ return [4 /*yield*/, (0, getClaimTx_1.getClaimTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex[0])];
65
65
  case 2:
66
66
  claimTx = _a.sent();
67
67
  return [4 /*yield*/, signer.executeMoveCall(claimTx)];
@@ -1 +1 @@
1
- export declare function getClaimAllTx(packageId: string, registry: string, typeArgument: string, index: string): Promise<any>;
1
+ export declare function getClaimAllTx(packageId: string, registry: string, typeArgument: string, index: string[]): Promise<any>;
@@ -48,7 +48,7 @@ function getClaimAllTx(packageId, registry, typeArgument, index) {
48
48
  typeArguments: [typeArgument],
49
49
  arguments: [
50
50
  registry,
51
- [index],
51
+ index,
52
52
  ],
53
53
  gasBudget: 10000,
54
54
  };
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": "0.4.3",
5
+ "version": "0.4.4",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.5.0",
8
8
  "@mysten/sui.js": "^0.20.0",