@typus/typus-sdk 0.3.3 → 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.
Files changed (76) hide show
  1. package/lib/constants.d.ts +6 -6
  2. package/lib/constants.js +6 -6
  3. package/lib/test/getBidData.js +4 -3
  4. package/lib/test/testClaim.js +1 -1
  5. package/lib/test/testDeposit.js +2 -2
  6. package/lib/test/testNewAuction.js +1 -1
  7. package/lib/test/testNewVault.js +13 -12
  8. package/lib/test/testSettle.js +7 -7
  9. package/lib/test/testUnsubscribe.js +5 -4
  10. package/lib/test/testWithdraw.js +1 -1
  11. package/lib/utils/auction/getBid.d.ts +2 -1
  12. package/lib/utils/auction/getBid.js +28 -5
  13. package/lib/utils/coveredCall/getDeliveryTx.d.ts +1 -1
  14. package/lib/utils/coveredCall/getDeliveryTx.js +1 -2
  15. package/lib/utils/coveredCall/getEvolutionTx.d.ts +1 -0
  16. package/lib/{scripts/coveredCall/getDeliveryTx.js → utils/coveredCall/getEvolutionTx.js} +25 -18
  17. package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +1 -1
  18. package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +3 -2
  19. package/lib/utils/coveredCall/getSubscribeTx.d.ts +1 -1
  20. package/lib/utils/coveredCall/getSubscribeTx.js +2 -1
  21. package/lib/utils/coveredCall/getUnsubscribeTx.d.ts +1 -1
  22. package/lib/utils/coveredCall/getUnsubscribeTx.js +2 -1
  23. package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.d.ts +1 -0
  24. package/lib/{scripts/getUpdateTimeOracleTx.js → utils/coveredCall/getUpdateNextVaultConfigTx.js} +26 -20
  25. package/lib/utils/coveredCall/getUpdatePayoffConfigTx.d.ts +1 -1
  26. package/lib/utils/coveredCall/getUpdatePayoffConfigTx.js +1 -2
  27. package/lib/utils/fetchData.d.ts +23 -0
  28. package/lib/utils/getVaultData.d.ts +2 -1
  29. package/lib/utils/getVaultData.js +203 -116
  30. package/package.json +1 -1
  31. package/lib/scripts/coveredCall/getClaimAllTx.d.ts +0 -1
  32. package/lib/scripts/coveredCall/getClaimAllTx.js +0 -56
  33. package/lib/scripts/coveredCall/getClaimTx.d.ts +0 -1
  34. package/lib/scripts/coveredCall/getClaimTx.js +0 -55
  35. package/lib/scripts/coveredCall/getDeliveryTx.d.ts +0 -1
  36. package/lib/scripts/coveredCall/getDepositTx.d.ts +0 -1
  37. package/lib/scripts/coveredCall/getDepositTx.js +0 -58
  38. package/lib/scripts/coveredCall/getNewAuctionTx.d.ts +0 -1
  39. package/lib/scripts/coveredCall/getNewAuctionTx.js +0 -58
  40. package/lib/scripts/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +0 -1
  41. package/lib/scripts/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +0 -59
  42. package/lib/scripts/coveredCall/getNewBidTx.d.ts +0 -1
  43. package/lib/scripts/coveredCall/getNewBidTx.js +0 -59
  44. package/lib/scripts/coveredCall/getNewCoveredCallVaultTx.d.ts +0 -1
  45. package/lib/scripts/coveredCall/getNewCoveredCallVaultTx.js +0 -68
  46. package/lib/scripts/coveredCall/getNewManagerTx.d.ts +0 -1
  47. package/lib/scripts/coveredCall/getNewManagerTx.js +0 -55
  48. package/lib/scripts/coveredCall/getRemoveBidTx.d.ts +0 -1
  49. package/lib/scripts/coveredCall/getRemoveBidTx.js +0 -56
  50. package/lib/scripts/coveredCall/getRemoveManagerTx.d.ts +0 -1
  51. package/lib/scripts/coveredCall/getRemoveManagerTx.js +0 -54
  52. package/lib/scripts/coveredCall/getRollOverTx.d.ts +0 -1
  53. package/lib/scripts/coveredCall/getRollOverTx.js +0 -55
  54. package/lib/scripts/coveredCall/getSettleTx.d.ts +0 -1
  55. package/lib/scripts/coveredCall/getSettleTx.js +0 -57
  56. package/lib/scripts/coveredCall/getSettleWithRollOverTx.d.ts +0 -1
  57. package/lib/scripts/coveredCall/getSettleWithRollOverTx.js +0 -57
  58. package/lib/scripts/coveredCall/getSubscribeTx.d.ts +0 -1
  59. package/lib/scripts/coveredCall/getSubscribeTx.js +0 -55
  60. package/lib/scripts/coveredCall/getUnsubscribeTx.d.ts +0 -1
  61. package/lib/scripts/coveredCall/getUnsubscribeTx.js +0 -55
  62. package/lib/scripts/coveredCall/getUpdatePayoffConfigTx.d.ts +0 -1
  63. package/lib/scripts/coveredCall/getUpdatePayoffConfigTx.js +0 -58
  64. package/lib/scripts/coveredCall/getWithdrawTx.d.ts +0 -1
  65. package/lib/scripts/coveredCall/getWithdrawTx.js +0 -57
  66. package/lib/scripts/getCreateTokenRegistryTx.d.ts +0 -1
  67. package/lib/scripts/getCreateTokenRegistryTx.js +0 -54
  68. package/lib/scripts/getMintTx.d.ts +0 -1
  69. package/lib/scripts/getMintTx.js +0 -57
  70. package/lib/scripts/getNewOracleTx.d.ts +0 -1
  71. package/lib/scripts/getNewOracleTx.js +0 -55
  72. package/lib/scripts/getNewTimeOracleTx.d.ts +0 -1
  73. package/lib/scripts/getNewTimeOracleTx.js +0 -54
  74. package/lib/scripts/getUpdateOracleTx.d.ts +0 -1
  75. package/lib/scripts/getUpdateOracleTx.js +0 -60
  76. package/lib/scripts/getUpdateTimeOracleTx.d.ts +0 -1
@@ -3,12 +3,12 @@ export declare const TOKEN_REGISTRY_BTC = "0xe0dc19dfc9023f2e86462aa37dc8fae290b
3
3
  export declare const TOKEN_REGISTRY_ETH = "0x9ad1db50850079e98d5972e3d9a8fdc90b9d1f19";
4
4
  export declare const TOKEN_REGISTRY_SUI = "0xc6128d63d24cbdb66e50cef4577e5cf36bb889e1";
5
5
  export declare const ORACLE_PACKAGE = "0x0d4b13cc0467c0620ce54abf703faa3b419d967b";
6
- export declare const COVERED_CALL_PACKAGE = "0x26bde55e579bd0418aaa140cd869153afeb34467";
7
- export declare const COVERED_CALL_REGISTRY = "0xf1d4a2db033cba8bb3a69cf3de2558d89bed6dd4";
8
- export declare const COVERED_CALL_MANAGER = "0xef73bf17e55fc9d5e31513df50c7e912bb729fc6";
9
- export declare const USER_SHARE_TABLE = "0xd1ea22029f899265c9588c0e19d0366e6bb60d44";
10
- export declare const MAKER_SHARE_TABLE = "0xf4db8e77a8763e1ac2d3038f53456410e2175989";
11
- export declare const DOV_PACKAGE = "0xaf114c36e5329271f84a0d2cb1310d0efa6c6bb9";
6
+ export declare const COVERED_CALL_PACKAGE = "0x8cd580538967d5a83a5695f9e2db9f3695e5bdc0";
7
+ export declare const COVERED_CALL_REGISTRY = "0xff3eae20040a8ec4d45bae3ac85b662cf8adea4f";
8
+ export declare const COVERED_CALL_MANAGER = "0xb37ffa9b254f94e4c402806bb6011a2a32642ff4";
9
+ export declare const USER_SHARE_TABLE = "0x27e557f1464297be0fd2b4fefee1e1077b145d08";
10
+ export declare const MAKER_SHARE_TABLE = "0x8f55dcd94ce055c1b97e906b9642c0ce6392557e";
11
+ export declare const DOV_PACKAGE = "0x1bf2cad8d9d4d11a8e2c981b0f6a9c9744887776";
12
12
  export declare const TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
13
13
  export declare const PRICE_DECIMAL = 8;
14
14
  export declare const TOKEN_DECIMAL = 9;
package/lib/constants.js CHANGED
@@ -9,13 +9,13 @@ exports.TOKEN_REGISTRY_SUI = "0xc6128d63d24cbdb66e50cef4577e5cf36bb889e1"; //fak
9
9
  //publish from typus-oracle
10
10
  exports.ORACLE_PACKAGE = "0x0d4b13cc0467c0620ce54abf703faa3b419d967b";
11
11
  //publish from typus-dov/cover_call
12
- exports.COVERED_CALL_PACKAGE = "0x26bde55e579bd0418aaa140cd869153afeb34467";
13
- exports.COVERED_CALL_REGISTRY = "0xf1d4a2db033cba8bb3a69cf3de2558d89bed6dd4";
14
- exports.COVERED_CALL_MANAGER = "0xef73bf17e55fc9d5e31513df50c7e912bb729fc6";
15
- exports.USER_SHARE_TABLE = "0xd1ea22029f899265c9588c0e19d0366e6bb60d44";
16
- exports.MAKER_SHARE_TABLE = "0xf4db8e77a8763e1ac2d3038f53456410e2175989";
12
+ exports.COVERED_CALL_PACKAGE = "0x8cd580538967d5a83a5695f9e2db9f3695e5bdc0";
13
+ exports.COVERED_CALL_REGISTRY = "0xff3eae20040a8ec4d45bae3ac85b662cf8adea4f";
14
+ exports.COVERED_CALL_MANAGER = "0xb37ffa9b254f94e4c402806bb6011a2a32642ff4";
15
+ exports.USER_SHARE_TABLE = "0x27e557f1464297be0fd2b4fefee1e1077b145d08";
16
+ exports.MAKER_SHARE_TABLE = "0x8f55dcd94ce055c1b97e906b9642c0ce6392557e";
17
17
  //publish from typus-dov/typus-dov
18
- exports.DOV_PACKAGE = "0xaf114c36e5329271f84a0d2cb1310d0efa6c6bb9";
18
+ exports.DOV_PACKAGE = "0x1bf2cad8d9d4d11a8e2c981b0f6a9c9744887776";
19
19
  exports.TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
20
20
  exports.PRICE_DECIMAL = 8;
21
21
  exports.TOKEN_DECIMAL = 9;
@@ -36,13 +36,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var constants_1 = require("../constants");
40
39
  var getBid_1 = require("../utils/auction/getBid");
41
40
  (function () { return __awaiter(void 0, void 0, void 0, function () {
42
- var bid;
41
+ var vault, bid;
43
42
  return __generator(this, function (_a) {
44
43
  switch (_a.label) {
45
- case 0: return [4 /*yield*/, (0, getBid_1.getBid)(constants_1.DOV_PACKAGE)];
44
+ case 0:
45
+ vault = "0x1e5807f118c2fc7e0f74eeb439b34f448532a900";
46
+ return [4 /*yield*/, (0, getBid_1.getBid)(vault)];
46
47
  case 1:
47
48
  bid = _a.sent();
48
49
  console.log(bid);
@@ -56,7 +56,7 @@ 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();
@@ -52,10 +52,10 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
52
52
  return __generator(this, function (_a) {
53
53
  switch (_a.label) {
54
54
  case 0:
55
- depositAmount = 100000000;
55
+ depositAmount = "100000000";
56
56
  isRolling = true;
57
57
  token = constants_1.TEST_MINT_TOKEN;
58
- vaultIndex = 0;
58
+ vaultIndex = "0";
59
59
  return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
60
60
  case 1:
61
61
  typeArgument = _a.sent();
@@ -80,7 +80,7 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
80
80
  _b = __read.apply(void 0, [_c.sent(), 2]), timeOracle = _b[0], timeOracleManager = _b[1];
81
81
  activationTsMs = 1671992000000;
82
82
  expirationTsMs = 1;
83
- return [4 /*yield*/, (0, getNewAuctionTx_1.getNewAuctionTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, vaultIndex, priceOracle, timeOracle)];
83
+ return [4 /*yield*/, (0, getNewAuctionTx_1.getNewAuctionTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, vaultIndex.toString(), priceOracle, timeOracle)];
84
84
  case 4:
85
85
  newAuctionTx = _c.sent();
86
86
  return [4 /*yield*/, signer.executeMoveCall(newAuctionTx)];
@@ -72,19 +72,20 @@ var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read
72
72
  var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
73
73
  var signer = new sui_js_1.RawSigner(keypair, provider);
74
74
  var token = constants_1.TEST_MINT_TOKEN; // minted token
75
- var tokenDecimal = 9;
76
- var shareDecimal = 4;
77
- var period = 1;
78
- var activationTsMs = 1671782400000;
75
+ var tokenDecimal = "9";
76
+ var shareDecimal = "4";
77
+ var period = "1";
78
+ var activationTsMs = "1671782400000";
79
79
  var expirationTsMs = 1671782400000 + 604800000;
80
- var capacity = 1000000000;
81
- var strikeOtmPct = 500;
82
- var strikeIncrement = 10000;
83
- var decaySpeed = 1;
84
- var initialPrice = 5000;
85
- var finalPrice = 1000;
86
- var auctionDurationInMs = 3600000;
80
+ var capacity = "1000000000";
81
+ var strikeOtmPct = "500";
82
+ var strikeIncrement = "10000";
83
+ var decaySpeed = "1";
84
+ var initialPrice = "5000";
85
+ var finalPrice = "1000";
86
+ var auctionDurationInMs = "3600000";
87
87
  var prevBalance = 0;
88
+ var leverage = "100";
88
89
  (function () { return __awaiter(void 0, void 0, void 0, function () {
89
90
  var typeArgument, _a, timeOracle, _, newCoveredCallVaultTx, moveCallTxn;
90
91
  return __generator(this, function (_b) {
@@ -98,7 +99,7 @@ var prevBalance = 0;
98
99
  case 2:
99
100
  _a = __read.apply(void 0, [_b.sent(), 2]), timeOracle = _a[0], _ = _a[1];
100
101
  console.log(typeArgument, timeOracle);
101
- return [4 /*yield*/, (0, getNewCoveredCallVaultTx_1.getNewCoveredCallVaultTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, timeOracle, period, activationTsMs, expirationTsMs, tokenDecimal, shareDecimal, capacity, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, prevBalance)];
102
+ return [4 /*yield*/, (0, getNewCoveredCallVaultTx_1.getNewCoveredCallVaultTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, timeOracle, period, activationTsMs, expirationTsMs.toString(), tokenDecimal, shareDecimal, capacity, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, [], leverage)];
102
103
  case 3:
103
104
  newCoveredCallVaultTx = _b.sent();
104
105
  return [4 /*yield*/, signer.executeMoveCall(newCoveredCallVaultTx)];
@@ -299,7 +299,7 @@ function updateTimeOracle(timeOracle, managerCap, ts) {
299
299
  });
300
300
  });
301
301
  }
302
- function createNewVault(packageId, registry, typeArgument, managerCap, timeOracle, period, activationTsMs, expirationTsMs, tokenDecimal, shareDecimal, capacity, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, prevBalance) {
302
+ function createNewVault(packageId, registry, typeArgument, managerCap, timeOracle, period, activationTsMs, expirationTsMs, tokenDecimal, shareDecimal, capacity, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, leverage) {
303
303
  return __awaiter(this, void 0, void 0, function () {
304
304
  var _this = this;
305
305
  return __generator(this, function (_a) {
@@ -309,7 +309,7 @@ function createNewVault(packageId, registry, typeArgument, managerCap, timeOracl
309
309
  switch (_a.label) {
310
310
  case 0:
311
311
  _a.trys.push([0, 4, , 5]);
312
- return [4 /*yield*/, (0, getNewCoveredCallVaultTx_1.getNewCoveredCallVaultTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, timeOracle, period, activationTsMs, expirationTsMs, tokenDecimal, shareDecimal, capacity, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, prevBalance)];
312
+ return [4 /*yield*/, (0, getNewCoveredCallVaultTx_1.getNewCoveredCallVaultTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, timeOracle, period.toString(), activationTsMs.toString(), expirationTsMs.toString(), tokenDecimal.toString(), shareDecimal.toString(), capacity.toString(), strikeOtmPct.toString(), strikeIncrement.toString(), decaySpeed.toString(), initialPrice.toString(), finalPrice.toString(), auctionDurationInMs.toString(), [], leverage.toString())];
313
313
  case 1:
314
314
  newCoveredCallVaultTx = _a.sent();
315
315
  return [4 /*yield*/, signer.executeMoveCall(newCoveredCallVaultTx)];
@@ -401,7 +401,7 @@ function depositToVault(typeArgument, vaultIndex, depositAmount) {
401
401
  switch (_a.label) {
402
402
  case 0:
403
403
  _a.trys.push([0, 3, , 4]);
404
- return [4 /*yield*/, (0, getDepositTx_1.getDepositTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, isRolling, token, depositAmount)];
404
+ return [4 /*yield*/, (0, getDepositTx_1.getDepositTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex.toString(), isRolling, token, depositAmount.toString())];
405
405
  case 1:
406
406
  depositTx = _a.sent();
407
407
  return [4 /*yield*/, signer.executeMoveCall(depositTx)];
@@ -466,7 +466,7 @@ function newBid(typeArgument, vaultIndex, size, token, timeOracle) {
466
466
  switch (_a.label) {
467
467
  case 0:
468
468
  _a.trys.push([0, 3, , 4]);
469
- return [4 /*yield*/, (0, getNewBidTx_1.getNewBidTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, size, token, timeOracle)];
469
+ return [4 /*yield*/, (0, getNewBidTx_1.getNewBidTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex.toString(), size.toString(), token, timeOracle)];
470
470
  case 1:
471
471
  newBidTx = _a.sent();
472
472
  return [4 /*yield*/, signer.executeMoveCall(newBidTx)];
@@ -498,7 +498,7 @@ function delivery(typeArgument, vaultIndex, sellSize, timeOracle) {
498
498
  switch (_a.label) {
499
499
  case 0:
500
500
  _a.trys.push([0, 3, , 4]);
501
- return [4 /*yield*/, (0, getDeliveryTx_1.getDeliveryTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_MANAGER, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, sellSize, timeOracle)];
501
+ return [4 /*yield*/, (0, getDeliveryTx_1.getDeliveryTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_MANAGER, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex.toString(), timeOracle)];
502
502
  case 1:
503
503
  deliveryTx = _a.sent();
504
504
  return [4 /*yield*/, signer.executeMoveCall(deliveryTx)];
@@ -531,7 +531,7 @@ function updatePayoffConfig(typeArgument, vaultIndex, price, premiumRoi, exposur
531
531
  switch (_a.label) {
532
532
  case 0:
533
533
  _a.trys.push([0, 3, , 4]);
534
- return [4 /*yield*/, (0, getUpdatePayoffConfigTx_1.getUpdatePayoffConfigTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, vaultIndex, price, premiumRoi, exposureRatio)];
534
+ return [4 /*yield*/, (0, getUpdatePayoffConfigTx_1.getUpdatePayoffConfigTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, vaultIndex.toString(), premiumRoi.toString(), exposureRatio.toString())];
535
535
  case 1:
536
536
  updatePayoffConfigTx = _a.sent();
537
537
  return [4 /*yield*/, signer.executeMoveCall(updatePayoffConfigTx)];
@@ -564,7 +564,7 @@ function settle(typeArgument, vaultIndex, priceOracle, timeOracle) {
564
564
  switch (_a.label) {
565
565
  case 0:
566
566
  _a.trys.push([0, 3, , 4]);
567
- return [4 /*yield*/, (0, getSettleTx_1.getSettleTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, vaultIndex, priceOracle, timeOracle)];
567
+ return [4 /*yield*/, (0, getSettleTx_1.getSettleTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, constants_1.COVERED_CALL_MANAGER, vaultIndex.toString(), priceOracle, timeOracle)];
568
568
  case 1:
569
569
  settleTx = _a.sent();
570
570
  return [4 /*yield*/, signer.executeMoveCall(settleTx)];
@@ -54,15 +54,16 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
54
54
  subvault balance:0, regular linked list node value:2234
55
55
  */
56
56
  (function () { return __awaiter(void 0, void 0, void 0, function () {
57
- var depositAmount, isRolling, token, vaultIndex, typeArgument, depositTx, unSubscribedTx;
57
+ var depositAmount, isRolling, token, vaultIndex, share, typeArgument, depositTx, unSubscribedTx;
58
58
  return __generator(this, function (_a) {
59
59
  switch (_a.label) {
60
60
  case 0:
61
- depositAmount = 123;
61
+ depositAmount = "123";
62
62
  isRolling = true;
63
63
  token = "0xaa8f8ccf372b461e5b8778b250bf13d9b1013174" // minted token
64
64
  ;
65
- vaultIndex = 3;
65
+ vaultIndex = "3";
66
+ share = "0";
66
67
  return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
67
68
  case 1:
68
69
  typeArgument = _a.sent();
@@ -73,7 +74,7 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
73
74
  case 3:
74
75
  _a.sent();
75
76
  console.log("deposit " + depositAmount + " to new vault successfully");
76
- return [4 /*yield*/, (0, getUnsubscribeTx_1.getUnsubscribeTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex)];
77
+ return [4 /*yield*/, (0, getUnsubscribeTx_1.getUnsubscribeTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, share)];
77
78
  case 4:
78
79
  unSubscribedTx = _a.sent();
79
80
  return [4 /*yield*/, signer.executeMoveCall(unSubscribedTx)];
@@ -57,7 +57,7 @@ var signer = new sui_js_1.RawSigner(keypair, provider);
57
57
  case 1:
58
58
  typeArgument = _a.sent();
59
59
  console.log("test for withdraw, try to withdraw " + token + " for " + withdrawAmount + " ...");
60
- return [4 /*yield*/, (0, getWithdrawTx_1.getWithdrawTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, isRolling, withdrawAmount)];
60
+ return [4 /*yield*/, (0, getWithdrawTx_1.getWithdrawTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex.toString(), isRolling, withdrawAmount.toString())];
61
61
  case 2:
62
62
  withdrawTx = _a.sent();
63
63
  return [4 /*yield*/, signer.executeMoveCall(withdrawTx)];
@@ -1 +1,2 @@
1
- export declare function getBid(dov: string): Promise<any>;
1
+ import { Bid } from "../fetchData";
2
+ export declare function getBid(vault: string): Promise<Bid[]>;
@@ -38,17 +38,40 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getBid = void 0;
40
40
  var sui_js_1 = require("@mysten/sui.js");
41
+ var constants_1 = require("../../constants");
41
42
  var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
42
- function getBid(dov) {
43
+ function getBid(vault) {
43
44
  return __awaiter(this, void 0, void 0, function () {
44
- var obj;
45
+ var obj, bidTable, obj2, ids, tmp, bids;
45
46
  return __generator(this, function (_a) {
46
47
  switch (_a.label) {
47
- case 0: return [4 /*yield*/, provider.getObject(dov)];
48
+ case 0: return [4 /*yield*/, provider.getObject(vault)];
48
49
  case 1:
49
50
  obj = _a.sent();
50
- console.log(obj);
51
- return [2 /*return*/];
51
+ if (obj.status != "Exists") {
52
+ console.log("obj not exists");
53
+ return [2 /*return*/, []];
54
+ }
55
+ bidTable = obj.details.data.fields.value.fields.auction.fields.bids.fields.id.id;
56
+ return [4 /*yield*/, provider.getObjectsOwnedByObject(bidTable)];
57
+ case 2:
58
+ obj2 = _a.sent();
59
+ ids = obj2.map(function (e) { return e.objectId; });
60
+ return [4 /*yield*/, provider.getObjectBatch(ids)];
61
+ case 3:
62
+ tmp = _a.sent();
63
+ bids = tmp.map(function (e) {
64
+ var bidData = e.details.data.fields.value.fields;
65
+ var res = {
66
+ price: Number(bidData.price),
67
+ size: Number(bidData.size / (Math.pow(10, constants_1.TOKEN_DECIMAL))),
68
+ tsMs: Number(bidData.ts_ms),
69
+ tokenBalance: Number(bidData.coin.fields.balance),
70
+ ownerAddress: bidData.owner,
71
+ };
72
+ return res;
73
+ });
74
+ return [2 /*return*/, bids];
52
75
  }
53
76
  });
54
77
  });
@@ -1 +1 @@
1
- export declare function getDeliveryTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: string, size: string, timeOracle: string): Promise<any>;
1
+ export declare function getDeliveryTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: string, timeOracle: string): Promise<any>;
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getDeliveryTx = void 0;
40
- function getDeliveryTx(packageId, managerCap, registry, typeArgument, index, size, timeOracle) {
40
+ function getDeliveryTx(packageId, managerCap, registry, typeArgument, index, timeOracle) {
41
41
  return __awaiter(this, void 0, void 0, function () {
42
42
  var tx;
43
43
  return __generator(this, function (_a) {
@@ -51,7 +51,6 @@ function getDeliveryTx(packageId, managerCap, registry, typeArgument, index, siz
51
51
  registry,
52
52
  index,
53
53
  timeOracle,
54
- size,
55
54
  ],
56
55
  gasBudget: 10000,
57
56
  };
@@ -0,0 +1 @@
1
+ export declare function getEvolutionTx(packageId: string, registry: string, typeArgument: string, managerCap: string, index: string, priceOracle: string, timeOracle: string, activationTsMs: string, expirationTsMs: string): Promise<any>;
@@ -36,22 +36,29 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var getDeliveryTx_1 = require("../../utils/coveredCall/getDeliveryTx");
40
- var constants_1 = require("../../constants");
41
- (function () { return __awaiter(void 0, void 0, void 0, function () {
42
- var index, size, timeOracle, deliveryTx;
43
- return __generator(this, function (_a) {
44
- switch (_a.label) {
45
- case 0:
46
- console.log("test for getSubscribeTx()");
47
- index = 0;
48
- size = 0;
49
- timeOracle = "";
50
- return [4 /*yield*/, (0, getDeliveryTx_1.getDeliveryTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_MANAGER, constants_1.COVERED_CALL_REGISTRY, constants_1.DEFAULT_TYPE_ARGUMENT, index, size, timeOracle)];
51
- case 1:
52
- deliveryTx = _a.sent();
53
- console.log(deliveryTx);
54
- return [2 /*return*/];
55
- }
39
+ exports.getEvolutionTx = void 0;
40
+ function getEvolutionTx(packageId, registry, typeArgument, managerCap, index, priceOracle, timeOracle, activationTsMs, expirationTsMs) {
41
+ return __awaiter(this, void 0, void 0, function () {
42
+ var tx;
43
+ return __generator(this, function (_a) {
44
+ tx = {
45
+ packageObjectId: packageId,
46
+ module: 'covered_call',
47
+ function: 'evolution',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ managerCap,
51
+ registry,
52
+ index,
53
+ priceOracle,
54
+ timeOracle,
55
+ activationTsMs,
56
+ expirationTsMs,
57
+ ],
58
+ gasBudget: 10000,
59
+ };
60
+ return [2 /*return*/, tx];
61
+ });
56
62
  });
57
- }); })();
63
+ }
64
+ exports.getEvolutionTx = getEvolutionTx;
@@ -1 +1 @@
1
- export declare function getNewCoveredCallVaultTx(packageId: string, registry: string, typeArgument: string, managerCap: string, timeOracle: string, period: string, activationTsMs: string, expirationTsMs: string, tokenDecimal: string, shareDecimal: string, capacity: string, strikeOtmPct: string, strikeIncrement: string, decaySpeed: string, initialPrice: string, finalPrice: string, auctionDurationInMs: string, prevBalance: string): Promise<any>;
1
+ export declare function getNewCoveredCallVaultTx(packageId: string, registry: string, typeArgument: string, managerCap: string, timeOracle: string, period: string, activationTsMs: string, expirationTsMs: string, tokenDecimal: string, shareDecimal: string, capacity: string, strikeOtmPct: string, strikeIncrement: string, decaySpeed: string, initialPrice: string, finalPrice: string, auctionDurationInMs: string, whitelist: string[], leverage: string): Promise<any>;
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getNewCoveredCallVaultTx = void 0;
40
- function getNewCoveredCallVaultTx(packageId, registry, typeArgument, managerCap, timeOracle, period, activationTsMs, expirationTsMs, tokenDecimal, shareDecimal, capacity, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, prevBalance) {
40
+ function getNewCoveredCallVaultTx(packageId, registry, typeArgument, managerCap, timeOracle, period, activationTsMs, expirationTsMs, tokenDecimal, shareDecimal, capacity, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, whitelist, leverage) {
41
41
  return __awaiter(this, void 0, void 0, function () {
42
42
  var tx;
43
43
  return __generator(this, function (_a) {
@@ -62,7 +62,8 @@ function getNewCoveredCallVaultTx(packageId, registry, typeArgument, managerCap,
62
62
  initialPrice,
63
63
  finalPrice,
64
64
  auctionDurationInMs,
65
- prevBalance,
65
+ leverage,
66
+ whitelist,
66
67
  ],
67
68
  gasBudget: 10000,
68
69
  };
@@ -1 +1 @@
1
- export declare function getSubscribeTx(packageId: string, registry: string, typeArgument: string, index: string): Promise<any>;
1
+ export declare function getSubscribeTx(packageId: string, registry: string, typeArgument: string, index: string, share: string): Promise<any>;
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getSubscribeTx = void 0;
40
- function getSubscribeTx(packageId, registry, typeArgument, index) {
40
+ function getSubscribeTx(packageId, registry, typeArgument, index, share) {
41
41
  return __awaiter(this, void 0, void 0, function () {
42
42
  var tx;
43
43
  return __generator(this, function (_a) {
@@ -49,6 +49,7 @@ function getSubscribeTx(packageId, registry, typeArgument, index) {
49
49
  arguments: [
50
50
  registry,
51
51
  index,
52
+ share,
52
53
  ],
53
54
  gasBudget: 10000,
54
55
  };
@@ -1 +1 @@
1
- export declare function getUnsubscribeTx(packageId: string, registry: string, typeArgument: string, index: string): Promise<any>;
1
+ export declare function getUnsubscribeTx(packageId: string, registry: string, typeArgument: string, index: string, share: string): Promise<any>;
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getUnsubscribeTx = void 0;
40
- function getUnsubscribeTx(packageId, registry, typeArgument, index) {
40
+ function getUnsubscribeTx(packageId, registry, typeArgument, index, share) {
41
41
  return __awaiter(this, void 0, void 0, function () {
42
42
  var tx;
43
43
  return __generator(this, function (_a) {
@@ -49,6 +49,7 @@ function getUnsubscribeTx(packageId, registry, typeArgument, index) {
49
49
  arguments: [
50
50
  registry,
51
51
  index,
52
+ share,
52
53
  ],
53
54
  gasBudget: 10000,
54
55
  };
@@ -0,0 +1 @@
1
+ export declare function getUpdateNextVaultConfigTx(packageId: string, registry: string, typeArgument: string, index: string, strikeOtmPct: string, strikeIncrement: string, decaySpeed: string, initialPrice: string, finalPrice: string, auctionDurationInMs: string): Promise<any>;
@@ -36,24 +36,30 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var getUpdateTimeOracleTx_1 = require("../utils/getUpdateTimeOracleTx");
40
- var constants_1 = require("../constants");
41
- (function () { return __awaiter(void 0, void 0, void 0, function () {
42
- var oracle, managerCap, ts, updateTimeOracleTx;
43
- return __generator(this, function (_a) {
44
- switch (_a.label) {
45
- case 0:
46
- console.log("test for getUpdateTimeOracleTx()");
47
- oracle = "0x7158f68a06bc09123fcba1645f4c56ca866a8e90" //created from "new oracle"
48
- ;
49
- managerCap = "0xa31180f78ee420b561240214c301df4adf9377ab" //created from "new oracle"
50
- ;
51
- ts = 5678;
52
- return [4 /*yield*/, (0, getUpdateTimeOracleTx_1.getUpdateTimeOracleTx)(constants_1.ORACLE_PACKAGE, oracle, managerCap, ts)];
53
- case 1:
54
- updateTimeOracleTx = _a.sent();
55
- console.log(updateTimeOracleTx);
56
- return [2 /*return*/];
57
- }
39
+ exports.getUpdateNextVaultConfigTx = void 0;
40
+ function getUpdateNextVaultConfigTx(packageId, registry, typeArgument, index, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs) {
41
+ return __awaiter(this, void 0, void 0, function () {
42
+ var tx;
43
+ return __generator(this, function (_a) {
44
+ tx = {
45
+ packageObjectId: packageId,
46
+ module: 'covered_call',
47
+ function: 'update_next_vault_config',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ strikeOtmPct,
53
+ strikeIncrement,
54
+ decaySpeed,
55
+ initialPrice,
56
+ finalPrice,
57
+ auctionDurationInMs,
58
+ ],
59
+ gasBudget: 1000,
60
+ };
61
+ return [2 /*return*/, tx];
62
+ });
58
63
  });
59
- }); })();
64
+ }
65
+ exports.getUpdateNextVaultConfigTx = getUpdateNextVaultConfigTx;
@@ -1 +1 @@
1
- export declare function getUpdatePayoffConfigTx(packageId: string, registry: string, typeArgument: string, managerCap: string, index: string, price: string, roi: string, exposureRatio: string): Promise<any>;
1
+ export declare function getUpdatePayoffConfigTx(packageId: string, registry: string, typeArgument: string, managerCap: string, index: string, roi: string, exposureRatio: string): Promise<any>;
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getUpdatePayoffConfigTx = void 0;
40
- function getUpdatePayoffConfigTx(packageId, registry, typeArgument, managerCap, index, price, roi, exposureRatio) {
40
+ function getUpdatePayoffConfigTx(packageId, registry, typeArgument, managerCap, index, roi, exposureRatio) {
41
41
  return __awaiter(this, void 0, void 0, function () {
42
42
  var tx;
43
43
  return __generator(this, function (_a) {
@@ -50,7 +50,6 @@ function getUpdatePayoffConfigTx(packageId, registry, typeArgument, managerCap,
50
50
  managerCap,
51
51
  registry,
52
52
  index,
53
- price,
54
53
  roi,
55
54
  exposureRatio,
56
55
  ],
@@ -33,15 +33,38 @@ export interface Vault {
33
33
  regularSubVault: SubVault;
34
34
  rollingSubVault: SubVault;
35
35
  }
36
+ export interface Bid {
37
+ price: number;
38
+ size: number;
39
+ tsMs: number;
40
+ tokenBalance: number;
41
+ ownerAddress: string;
42
+ }
43
+ export interface PriceConfig {
44
+ decaySpeed: number;
45
+ initialPrice: number;
46
+ finalPrice: number;
47
+ }
48
+ export interface Auction {
49
+ startTsMs: number;
50
+ endTsMs: number;
51
+ priceConfig: PriceConfig;
52
+ index: number;
53
+ }
36
54
  export interface CoveredCallVault {
37
55
  vaultId: string;
38
56
  vaultIdx: number;
39
57
  asset: string;
40
58
  config: Config;
41
59
  vault: Vault;
60
+ auction: Auction;
42
61
  prevBalance: number;
43
62
  next: number;
63
+ deliveryPrice: number;
64
+ deliverySize: number;
65
+ owner: string;
44
66
  tvl: number;
67
+ vaultBidPrice: number;
45
68
  }
46
69
  export interface PayoffConfig {
47
70
  exposureRatio: number;
@@ -1,2 +1,3 @@
1
- import { CoveredCallVault } from "../utils/fetchData";
1
+ import { CoveredCallVault, Auction } from "../utils/fetchData";
2
2
  export declare function getVaultDataFromRegistry(registry: string): Promise<CoveredCallVault[]>;
3
+ export declare function getVaultBidPrice(auction: Auction, timeOracle: string): Promise<number>;