@typus/typus-sdk 1.0.63 → 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.
@@ -7,9 +7,9 @@ function typeArgsToAssets(typeArgs) {
7
7
  var typeArgs = x.split("::");
8
8
  switch ((0, sui_js_1.normalizeSuiAddress)(typeArgs[0])) {
9
9
  case "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881":
10
- return "WBTC";
10
+ return "BTC";
11
11
  case "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5":
12
- return "WETH";
12
+ return "ETH";
13
13
  case "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf":
14
14
  return "USDC";
15
15
  case "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c":
@@ -25,9 +25,9 @@ function assetToDecimal(asset) {
25
25
  switch (asset) {
26
26
  case "SUI":
27
27
  return 9;
28
- case "WBTC":
28
+ case "BTC":
29
29
  return 8;
30
- case "WETH":
30
+ case "ETH":
31
31
  return 8;
32
32
  case "USDC":
33
33
  return 6;
@@ -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
  };
@@ -32,6 +32,7 @@ export interface AdditionalConfig {
32
32
  auction_lot_size: string;
33
33
  auction_benchmark_price: string;
34
34
  oracle_id: string;
35
+ risk_level: string;
35
36
  }
36
37
  export declare function getUserShares(provider: JsonRpcProvider, packageId: string, registry: string, indexes: string[], user: string): Promise<Map<string, UserShare>>;
37
38
  export declare function getAuctionMaxSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, priceOracle: string): Promise<BigInt>;
@@ -367,12 +367,18 @@ function getAdditionalConfigs(provider, packageId, additional_config_registry, i
367
367
  return (0, tools_1.AddressFromBytes)(reader.readBytes(32));
368
368
  })
369
369
  .at(0);
370
+ var risk_level = reader
371
+ .readVec(function (reader) {
372
+ return reader.read8();
373
+ })
374
+ .at(0);
370
375
  result[index] = {
371
376
  index: index,
372
377
  auction_start_delay_ts_ms: auction_start_delay_ts_ms ? auction_start_delay_ts_ms : "0",
373
378
  auction_lot_size: auction_lot_size ? auction_lot_size : "0",
374
379
  auction_benchmark_price: auction_benchmark_price ? auction_benchmark_price : "0",
375
380
  oracle_id: oracle_id ? oracle_id : "0",
381
+ risk_level: risk_level ? risk_level : "0",
376
382
  };
377
383
  });
378
384
  // @ts-ignore
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.63",
5
+ "version": "1.0.65",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.7.1",
8
8
  "@mysten/sui.js": "^0.34.1",