@typus/typus-sdk 1.0.64 → 1.0.65

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.
@@ -5,12 +5,12 @@ interface Show {
5
5
  ProjectedAPY: number;
6
6
  ActivationDate: Date;
7
7
  SettlementTime: Date;
8
- StrikePrice: number[];
8
+ StrikePrice: number[] | undefined;
9
9
  SettlePrice: number;
10
10
  Return: number;
11
11
  Filled: number;
12
12
  PaidToDepositors: number;
13
- PaidToBidders: any;
14
- EarnedByDepositors: any;
13
+ PaidToBidders: number;
14
+ EarnedByDepositors: number;
15
15
  }
16
16
  export {};
@@ -146,15 +146,12 @@ function getShowMap(apiUrl, portfolioVaults, vaultIndex) {
146
146
  var show;
147
147
  return __generator(this, function (_a) {
148
148
  switch (_a.label) {
149
- case 0:
150
- if (!(groupEvent.settleEvent && groupEvent.newAuctionEvent)) return [3 /*break*/, 2];
151
- return [4 /*yield*/, groupEventToShow(groupEvent, portfolioVaults[outerKey])];
149
+ case 0: return [4 /*yield*/, groupEventToShow(groupEvent, portfolioVaults[outerKey])];
152
150
  case 1:
153
151
  show = _a.sent();
154
152
  // console.log(show);
155
153
  newInnerMap_1.set(innerKey, show);
156
- _a.label = 2;
157
- case 2: return [2 /*return*/];
154
+ return [2 /*return*/];
158
155
  }
159
156
  });
160
157
  }); });
@@ -173,16 +170,14 @@ function getShowMap(apiUrl, portfolioVaults, vaultIndex) {
173
170
  }
174
171
  exports.getShowMap = getShowMap;
175
172
  function groupEventToShow(groupEvent, portfolioVault) {
173
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
176
174
  return __awaiter(this, void 0, void 0, function () {
177
- var newAuctionEvent, deliveryEvent, settleEvent, PaidToDepositors, portfolio_payoff, PaidToBidders, exp, result;
178
- return __generator(this, function (_a) {
179
- newAuctionEvent = groupEvent.newAuctionEvent;
180
- deliveryEvent = groupEvent.deliveryEvent;
181
- settleEvent = groupEvent.settleEvent;
182
- PaidToDepositors = Number(deliveryEvent.premium_value) / Math.pow(10, Number(portfolioVault.config.bTokenDecimal));
183
- portfolio_payoff = settleEvent.portfolio_payoff_is_neg
184
- ? Number(-settleEvent.portfolio_payoff)
185
- : Number(settleEvent.portfolio_payoff);
175
+ var PaidToDepositors, portfolio_payoff, PaidToBidders, exp, result;
176
+ return __generator(this, function (_o) {
177
+ PaidToDepositors = Number((_a = groupEvent.deliveryEvent) === null || _a === void 0 ? void 0 : _a.premium_value) / Math.pow(10, Number(portfolioVault.config.bTokenDecimal));
178
+ portfolio_payoff = ((_b = groupEvent.settleEvent) === null || _b === void 0 ? void 0 : _b.portfolio_payoff_is_neg)
179
+ ? Number(-((_c = groupEvent.settleEvent) === null || _c === void 0 ? void 0 : _c.portfolio_payoff))
180
+ : Number((_d = groupEvent.settleEvent) === null || _d === void 0 ? void 0 : _d.portfolio_payoff);
186
181
  PaidToBidders = portfolio_payoff / Math.pow(10, Number(portfolioVault.config.oTokenDecimal));
187
182
  switch (portfolioVault.config.period) {
188
183
  case 0:
@@ -196,14 +191,17 @@ function groupEventToShow(groupEvent, portfolioVault) {
196
191
  break;
197
192
  }
198
193
  result = {
199
- ProjectedAPY: Math.pow((1 + (1.01 * Number(deliveryEvent.delivery_price)) / Math.pow(10, Number(portfolioVault.config.bTokenDecimal))), exp) - 1,
200
- ActivationDate: new Date(Number(newAuctionEvent.timestamp_ms)),
201
- SettlementTime: new Date(Number(settleEvent.timestamp_ms)),
202
- StrikePrice: newAuctionEvent.vault_config.payoffConfigs.map(function (payoffConfig) { return Number(payoffConfig.strike) / Math.pow(10, 8); }),
203
- SettlePrice: Number(settleEvent.oracle_price) / Math.pow(10, 8),
204
- Return: Number(settleEvent.share_price) / Math.pow(10, 8) - 1,
205
- Filled: Number(deliveryEvent.delivery_size) / Number(deliveryEvent.max_size),
194
+ // newAuctionEvent
195
+ ActivationDate: new Date(Number((_e = groupEvent.newAuctionEvent) === null || _e === void 0 ? void 0 : _e.timestamp_ms)),
196
+ StrikePrice: (_f = groupEvent.newAuctionEvent) === null || _f === void 0 ? void 0 : _f.vault_config.payoffConfigs.map(function (payoffConfig) { return Number(payoffConfig.strike) / Math.pow(10, 8); }),
197
+ // deliveryEvent
198
+ ProjectedAPY: Math.pow((1 + (1.01 * Number((_g = groupEvent.deliveryEvent) === null || _g === void 0 ? void 0 : _g.delivery_price)) / Math.pow(10, Number(portfolioVault.config.bTokenDecimal))), exp) - 1,
199
+ Filled: Number((_h = groupEvent.deliveryEvent) === null || _h === void 0 ? void 0 : _h.delivery_size) / Number((_j = groupEvent.deliveryEvent) === null || _j === void 0 ? void 0 : _j.max_size),
206
200
  PaidToDepositors: PaidToDepositors,
201
+ // settleEvent
202
+ SettlementTime: new Date(Number((_k = groupEvent.settleEvent) === null || _k === void 0 ? void 0 : _k.timestamp_ms)),
203
+ SettlePrice: Number((_l = groupEvent.settleEvent) === null || _l === void 0 ? void 0 : _l.oracle_price) / Math.pow(10, 8),
204
+ Return: Number((_m = groupEvent.settleEvent) === null || _m === void 0 ? void 0 : _m.share_price) / Math.pow(10, 8) - 1,
207
205
  PaidToBidders: PaidToBidders,
208
206
  EarnedByDepositors: PaidToDepositors - PaidToBidders,
209
207
  };
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.0.64",
5
+ "version": "1.0.65",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.1",
8
8
  "@mysten/sui.js": "^0.34.1",