@typus/typus-sdk 0.3.4 → 0.3.5

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.
@@ -88,7 +88,7 @@ function getVaultDataFromRegistry(registry) {
88
88
  case 3:
89
89
  _a = __read.apply(void 0, [_c.sent(), 2]), timeOracle = _a[0], _ = _a[1];
90
90
  _loop_1 = function (objInfo) {
91
- var vaultId, vaultIdx, type, asset, config, vault, prevBalance, vaultConfig, vaultConfigRes, nextVaultConfig, nextVaultConfigRes, payoffConfig, payoffConfigRes, configRes, maker, regular, rolling, vaultRes, auctionRes, auction, priceConfig, priceConfigRes, next, deliveryPrice, deliverySize, owner, tvl, vaultBidPrice, res;
91
+ var vaultId, vaultIdx, type, asset, config, vault, prevBalance, vaultConfig, vaultConfigRes, nextVaultConfig, nextVaultConfigRes, payoffConfig, payoffConfigRes, configRes, maker, regular, rolling, vaultRes, auctionRes, vaultBidPrice, auction, priceConfig, priceConfigRes, next, deliveryPrice, deliverySize, owner, tvl, res;
92
92
  return __generator(this, function (_d) {
93
93
  switch (_d.label) {
94
94
  case 0:
@@ -162,34 +162,36 @@ function getVaultDataFromRegistry(registry) {
162
162
  rollingSubVault: rolling,
163
163
  };
164
164
  auctionRes = void 0;
165
- //@ts-ignore
166
- if (objInfo.details.data.fields.value.fields.auction) {
167
- auction = objInfo.details.data.fields.value.fields.auction.fields;
168
- priceConfig = auction.price_config.fields;
169
- priceConfigRes = {
170
- decaySpeed: Number(priceConfig.decay_speed),
171
- initialPrice: Number(priceConfig.initial_price),
172
- finalPrice: Number(priceConfig.final_price),
173
- };
174
- auctionRes = {
175
- startTsMs: Number(auction.start_ts_ms),
176
- endTsMs: Number(auction.end_ts_ms),
177
- priceConfig: priceConfigRes,
178
- index: Number(auction.index),
179
- };
180
- }
181
- else {
182
- console.log("No auction");
183
- auctionRes = {};
184
- }
165
+ vaultBidPrice = void 0;
166
+ if (!objInfo.details.data.fields.value.fields.auction) return [3 /*break*/, 2];
167
+ auction = objInfo.details.data.fields.value.fields.auction.fields;
168
+ priceConfig = auction.price_config.fields;
169
+ priceConfigRes = {
170
+ decaySpeed: Number(priceConfig.decay_speed),
171
+ initialPrice: Number(priceConfig.initial_price),
172
+ finalPrice: Number(priceConfig.final_price),
173
+ };
174
+ auctionRes = {
175
+ startTsMs: Number(auction.start_ts_ms),
176
+ endTsMs: Number(auction.end_ts_ms),
177
+ priceConfig: priceConfigRes,
178
+ index: Number(auction.index),
179
+ };
180
+ return [4 /*yield*/, getVaultBidPrice(auctionRes, timeOracle)];
181
+ case 1:
182
+ vaultBidPrice = _d.sent();
183
+ return [3 /*break*/, 3];
184
+ case 2:
185
+ console.log("No auction");
186
+ auctionRes = {};
187
+ vaultBidPrice = 0;
188
+ _d.label = 3;
189
+ case 3:
185
190
  next = objInfo.details.data.fields.value.fields.next;
186
191
  deliveryPrice = objInfo.details.data.fields.value.fields.delivery_price;
187
192
  deliverySize = objInfo.details.data.fields.value.fields.delivery_size;
188
193
  owner = objInfo.details.data.fields.value.fields.owner;
189
194
  tvl = Number(vault.regular_sub_vault.fields.balance) + Number(vault.rolling_sub_vault.fields.balance);
190
- return [4 /*yield*/, getVaultBidPrice(auctionRes, timeOracle)];
191
- case 1:
192
- vaultBidPrice = _d.sent();
193
195
  res = {
194
196
  vaultId: vaultId,
195
197
  vaultIdx: vaultIdx,
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.3.4",
5
+ "version": "0.3.5",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.5.0",
8
8
  "@mysten/sui.js": "^0.20.0",