@typus/typus-sdk 1.0.56 → 1.0.57

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.
@@ -78,5 +78,5 @@ export declare function getUnsubscribeTx(gasBudget: number, packageId: string, t
78
78
  )
79
79
  @param typeArguments [Deposit Vault Token, Bid Vault Token, Oracle Token]
80
80
  */
81
- export declare function getNewBidTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string, coins: string[], size: string, premium_required: string, // fe float * b_token_decimal
81
+ export declare function getNewBidTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, priceOracle: string, coins: string[], size: string, premium_required: string, // fe float * b_token_decimal
82
82
  usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
@@ -250,7 +250,7 @@ exports.getUnsubscribeTx = getUnsubscribeTx;
250
250
  )
251
251
  @param typeArguments [Deposit Vault Token, Bid Vault Token, Oracle Token]
252
252
  */
253
- function getNewBidTx(gasBudget, packageId, typeArguments, registry, index, priceOracle, coins, size, premium_required, // fe float * b_token_decimal
253
+ function getNewBidTx(gasBudget, packageId, typeArguments, registry, additional_config_registry, index, priceOracle, coins, size, premium_required, // fe float * b_token_decimal
254
254
  usingSponsoredGasCoin) {
255
255
  if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
256
256
  return __awaiter(this, void 0, void 0, function () {
@@ -263,7 +263,15 @@ usingSponsoredGasCoin) {
263
263
  tx.moveCall({
264
264
  target: "".concat(packageId, "::typus_dov_single::new_bid"),
265
265
  typeArguments: typeArguments,
266
- arguments: [tx.pure(registry), tx.pure(index), tx.pure(priceOracle), tx.pure("0x6"), tx.makeMoveVec({ objects: [coin] }), tx.pure(size)],
266
+ arguments: [
267
+ tx.pure(registry),
268
+ tx.pure(additional_config_registry),
269
+ tx.pure(index),
270
+ tx.pure(priceOracle),
271
+ tx.pure("0x6"),
272
+ tx.makeMoveVec({ objects: [coin] }),
273
+ tx.pure(size),
274
+ ],
267
275
  });
268
276
  }
269
277
  else {
@@ -272,6 +280,7 @@ usingSponsoredGasCoin) {
272
280
  typeArguments: typeArguments,
273
281
  arguments: [
274
282
  tx.pure(registry),
283
+ tx.pure(additional_config_registry),
275
284
  tx.pure(index),
276
285
  tx.pure(priceOracle),
277
286
  tx.pure("0x6"),
@@ -26,9 +26,17 @@ export interface VaultUserShares {
26
26
  premium: VaultUserShare[];
27
27
  performanceFee: VaultUserShare[];
28
28
  }
29
+ export interface AdditionalConfig {
30
+ index: string;
31
+ auction_start_delay_ts_ms: string;
32
+ auction_lot_size: string;
33
+ auction_benchmark_price: string;
34
+ oracle_id: string;
35
+ }
29
36
  export declare function getUserShares(provider: JsonRpcProvider, packageId: string, registry: string, indexes: string[], user: string): Promise<Map<string, UserShare>>;
30
- export declare function getAuctionMaxSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string): Promise<BigInt>;
31
- export declare function getMaxLossPerUnit(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string): Promise<BigInt>;
37
+ export declare function getAuctionMaxSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, priceOracle: string): Promise<BigInt>;
38
+ export declare function getMaxLossPerUnit(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, additional_config_registry: string, index: string, priceOracle: string): Promise<BigInt>;
32
39
  export declare function getAuctionTotalBidSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string): Promise<BigInt>;
33
40
  export declare function getAuctionBids(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string): Promise<UserBid[]>;
34
41
  export declare function getVaultUserShares(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string): Promise<VaultUserShares>;
42
+ export declare function getAdditionalConfigs(provider: JsonRpcProvider, packageId: string, additional_config_registry: string, indexes: string[]): Promise<Map<string, AdditionalConfig>>;
@@ -52,8 +52,9 @@ var __read = (this && this.__read) || function (o, n) {
52
52
  return ar;
53
53
  };
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.getVaultUserShares = exports.getAuctionBids = exports.getAuctionTotalBidSize = exports.getMaxLossPerUnit = exports.getAuctionMaxSize = exports.getUserShares = void 0;
55
+ exports.getAdditionalConfigs = exports.getVaultUserShares = exports.getAuctionBids = exports.getAuctionTotalBidSize = exports.getMaxLossPerUnit = exports.getAuctionMaxSize = exports.getUserShares = void 0;
56
56
  var sui_js_1 = require("@mysten/sui.js");
57
+ var bcs_1 = require("@mysten/bcs");
57
58
  var tools_1 = require("../tools");
58
59
  var constants_1 = require("../../constants");
59
60
  function getUserShares(provider, packageId, registry, indexes, user) {
@@ -138,7 +139,7 @@ function getUserShares(provider, packageId, registry, indexes, user) {
138
139
  });
139
140
  }
140
141
  exports.getUserShares = getUserShares;
141
- function getAuctionMaxSize(provider, packageId, typeArguments, registry, index, priceOracle) {
142
+ function getAuctionMaxSize(provider, packageId, typeArguments, registry, additional_config_registry, index, priceOracle) {
142
143
  return __awaiter(this, void 0, void 0, function () {
143
144
  var transactionBlock, target, transactionBlockArguments, bytes;
144
145
  return __generator(this, function (_a) {
@@ -148,6 +149,7 @@ function getAuctionMaxSize(provider, packageId, typeArguments, registry, index,
148
149
  target = "".concat(packageId, "::typus_dov_single::get_auction_max_size");
149
150
  transactionBlockArguments = [
150
151
  transactionBlock.pure(registry),
152
+ transactionBlock.pure(additional_config_registry),
151
153
  transactionBlock.pure(index),
152
154
  transactionBlock.pure(priceOracle),
153
155
  transactionBlock.pure(constants_1.CLOCK),
@@ -166,7 +168,7 @@ function getAuctionMaxSize(provider, packageId, typeArguments, registry, index,
166
168
  });
167
169
  }
168
170
  exports.getAuctionMaxSize = getAuctionMaxSize;
169
- function getMaxLossPerUnit(provider, packageId, typeArguments, registry, index, priceOracle) {
171
+ function getMaxLossPerUnit(provider, packageId, typeArguments, registry, additional_config_registry, index, priceOracle) {
170
172
  return __awaiter(this, void 0, void 0, function () {
171
173
  var transactionBlock, target, transactionBlockArguments, bytes;
172
174
  return __generator(this, function (_a) {
@@ -176,6 +178,7 @@ function getMaxLossPerUnit(provider, packageId, typeArguments, registry, index,
176
178
  target = "".concat(packageId, "::typus_dov_single::get_max_loss_per_unit");
177
179
  transactionBlockArguments = [
178
180
  transactionBlock.pure(registry),
181
+ transactionBlock.pure(additional_config_registry),
179
182
  transactionBlock.pure(index),
180
183
  transactionBlock.pure(priceOracle),
181
184
  transactionBlock.pure(constants_1.CLOCK),
@@ -313,3 +316,69 @@ function parseVaultUserShares(bytes) {
313
316
  }
314
317
  return result.reverse();
315
318
  }
319
+ function getAdditionalConfigs(provider, packageId, additional_config_registry, indexes) {
320
+ return __awaiter(this, void 0, void 0, function () {
321
+ var transactionBlock, target, transactionBlockArguments, bytes, reader, result;
322
+ return __generator(this, function (_a) {
323
+ switch (_a.label) {
324
+ case 0:
325
+ transactionBlock = new sui_js_1.TransactionBlock();
326
+ target = "".concat(packageId, "::typus_dov_single::get_additional_configs");
327
+ transactionBlockArguments = [transactionBlock.pure(additional_config_registry), transactionBlock.pure(indexes)];
328
+ // let transactionBlockArguments = [];
329
+ transactionBlock.moveCall({
330
+ target: target,
331
+ arguments: transactionBlockArguments,
332
+ });
333
+ return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: constants_1.SENDER })];
334
+ case 1:
335
+ bytes = (_a.sent()).results[0].returnValues[0][0];
336
+ reader = new bcs_1.BcsReader(new Uint8Array(bytes));
337
+ result = Array.from(new Map()).reduce(function (map, _a) {
338
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
339
+ map[key] = value;
340
+ return map;
341
+ }, {});
342
+ // index: u64
343
+ // auction_start_delay_ts_ms: Option<u64>
344
+ // auction_lot_size: Option<u64>
345
+ // auction_benchmark_price: Option<u64>
346
+ // oracle_id: Option<address>
347
+ reader.readVec(function (reader) {
348
+ reader.read8();
349
+ var index = reader.read64();
350
+ var auction_start_delay_ts_ms = reader
351
+ .readVec(function (reader) {
352
+ return reader.read64();
353
+ })
354
+ .at(0);
355
+ var auction_lot_size = reader
356
+ .readVec(function (reader) {
357
+ return reader.read64();
358
+ })
359
+ .at(0);
360
+ var auction_benchmark_price = reader
361
+ .readVec(function (reader) {
362
+ return reader.read64();
363
+ })
364
+ .at(0);
365
+ var oracle_id = reader
366
+ .readVec(function (reader) {
367
+ return reader.read64();
368
+ })
369
+ .at(0);
370
+ result[index] = {
371
+ index: index,
372
+ auction_start_delay_ts_ms: auction_start_delay_ts_ms ? auction_start_delay_ts_ms : "0",
373
+ auction_lot_size: auction_lot_size ? auction_lot_size : "0",
374
+ auction_benchmark_price: auction_benchmark_price ? auction_benchmark_price : "0",
375
+ oracle_id: oracle_id ? oracle_id : "0",
376
+ };
377
+ });
378
+ // @ts-ignore
379
+ return [2 /*return*/, result];
380
+ }
381
+ });
382
+ });
383
+ }
384
+ exports.getAdditionalConfigs = getAdditionalConfigs;
package/package.json CHANGED
@@ -2,8 +2,9 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.0.56",
5
+ "version": "1.0.57",
6
6
  "dependencies": {
7
+ "@mysten/bcs": "^0.7.1",
7
8
  "@mysten/sui.js": "^0.34.1",
8
9
  "@types/node": "^17.0.0",
9
10
  "bignumber.js": "^9.1.1",