@typus/typus-sdk 0.4.7 → 0.4.9

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 (151) hide show
  1. package/lib/constants.d.ts +30 -0
  2. package/lib/constants.js +38 -0
  3. package/lib/scripts/getSubVault.d.ts +0 -0
  4. package/lib/scripts/getSubVault.js +6 -0
  5. package/lib/scripts/sui.d.ts +1 -0
  6. package/lib/scripts/sui.js +187 -0
  7. package/lib/test/eventListener.d.ts +5 -0
  8. package/lib/test/eventListener.js +294 -0
  9. package/lib/test/getBidData.d.ts +1 -0
  10. package/lib/test/getBidData.js +53 -0
  11. package/lib/test/getMakersShares.d.ts +1 -0
  12. package/lib/test/getMakersShares.js +52 -0
  13. package/lib/test/getUsersShares.d.ts +1 -0
  14. package/lib/test/getUsersShares.js +52 -0
  15. package/lib/test/getVaultData.d.ts +1 -0
  16. package/lib/test/getVaultData.js +53 -0
  17. package/lib/test/testClaim.d.ts +1 -0
  18. package/lib/test/testClaim.js +81 -0
  19. package/lib/test/testCrypto.d.ts +1 -0
  20. package/lib/test/testCrypto.js +54 -0
  21. package/lib/test/testDeposit.d.ts +1 -0
  22. package/lib/test/testDeposit.js +73 -0
  23. package/lib/test/testDepositV2.d.ts +0 -0
  24. package/lib/test/testDepositV2.js +62 -0
  25. package/lib/test/testMint.d.ts +1 -0
  26. package/lib/test/testMint.js +136 -0
  27. package/lib/test/testNewAuction.d.ts +1 -0
  28. package/lib/test/testNewAuction.js +93 -0
  29. package/lib/test/testNewVault.d.ts +1 -0
  30. package/lib/test/testNewVault.js +152 -0
  31. package/lib/test/testOracle.d.ts +1 -0
  32. package/lib/test/testOracle.js +93 -0
  33. package/lib/test/testSettle.d.ts +1 -0
  34. package/lib/test/testSettle.js +589 -0
  35. package/lib/test/testSubscribeEvent.d.ts +1 -0
  36. package/lib/test/testSubscribeEvent.js +97 -0
  37. package/lib/test/testUnsubscribe.d.ts +1 -0
  38. package/lib/test/testUnsubscribe.js +87 -0
  39. package/lib/test/testWithdraw.d.ts +1 -0
  40. package/lib/test/testWithdraw.js +70 -0
  41. package/lib/utils/auction/getBid.d.ts +2 -0
  42. package/lib/utils/auction/getBid.js +79 -0
  43. package/lib/utils/auction/sealedAuction.d.ts +33 -0
  44. package/lib/utils/auction/sealedAuction.js +64 -0
  45. package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.d.ts +1 -0
  46. package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.js +60 -0
  47. package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
  48. package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.js +60 -0
  49. package/lib/utils/authorized/getAuthorizedDeliveryTx.d.ts +1 -0
  50. package/lib/utils/authorized/getAuthorizedDeliveryTx.js +60 -0
  51. package/lib/utils/authorized/getAuthorizedEvolutionTx.d.ts +1 -0
  52. package/lib/utils/authorized/getAuthorizedEvolutionTx.js +63 -0
  53. package/lib/utils/authorized/getAuthorizedLastEvolutionTx.d.ts +1 -0
  54. package/lib/utils/authorized/getAuthorizedLastEvolutionTx.js +62 -0
  55. package/lib/utils/authorized/getAuthorizedNewAuctionTx.d.ts +1 -0
  56. package/lib/utils/authorized/getAuthorizedNewAuctionTx.js +61 -0
  57. package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.d.ts +1 -0
  58. package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.js +77 -0
  59. package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.d.ts +1 -0
  60. package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.js +60 -0
  61. package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
  62. package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.js +60 -0
  63. package/lib/utils/authorized/getAuthorizedSettleTx.d.ts +1 -0
  64. package/lib/utils/authorized/getAuthorizedSettleTx.js +61 -0
  65. package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +1 -0
  66. package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.js +65 -0
  67. package/lib/utils/coveredCall/createPriceOracle.d.ts +1 -0
  68. package/lib/utils/coveredCall/createPriceOracle.js +92 -0
  69. package/lib/utils/coveredCall/createTimeOracle.d.ts +1 -0
  70. package/lib/utils/coveredCall/createTimeOracle.js +91 -0
  71. package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
  72. package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.js +61 -0
  73. package/lib/utils/coveredCall/getClaimAllTx.d.ts +1 -0
  74. package/lib/utils/coveredCall/getClaimAllTx.js +59 -0
  75. package/lib/utils/coveredCall/getClaimTx.d.ts +1 -0
  76. package/lib/utils/coveredCall/getClaimTx.js +59 -0
  77. package/lib/utils/coveredCall/getDeliveryTx.d.ts +1 -0
  78. package/lib/utils/coveredCall/getDeliveryTx.js +61 -0
  79. package/lib/utils/coveredCall/getDepositTx.d.ts +1 -0
  80. package/lib/utils/coveredCall/getDepositTx.js +65 -0
  81. package/lib/utils/coveredCall/getEvolutionTx.d.ts +1 -0
  82. package/lib/utils/coveredCall/getEvolutionTx.js +64 -0
  83. package/lib/utils/coveredCall/getLastEvolutionTx.d.ts +1 -0
  84. package/lib/utils/coveredCall/getLastEvolutionTx.js +63 -0
  85. package/lib/utils/coveredCall/getMakerClaimAllTx.d.ts +1 -0
  86. package/lib/utils/coveredCall/getMakerClaimAllTx.js +59 -0
  87. package/lib/utils/coveredCall/getMakerClaimTx.d.ts +1 -0
  88. package/lib/utils/coveredCall/getMakerClaimTx.js +59 -0
  89. package/lib/utils/coveredCall/getNewAuctionTx.d.ts +1 -0
  90. package/lib/utils/coveredCall/getNewAuctionTx.js +66 -0
  91. package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +1 -0
  92. package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +64 -0
  93. package/lib/utils/coveredCall/getNewBidTx.d.ts +1 -0
  94. package/lib/utils/coveredCall/getNewBidTx.js +62 -0
  95. package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +1 -0
  96. package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +77 -0
  97. package/lib/utils/coveredCall/getNewManagerTx.d.ts +1 -0
  98. package/lib/utils/coveredCall/getNewManagerTx.js +59 -0
  99. package/lib/utils/coveredCall/getRefundTx.d.ts +1 -0
  100. package/lib/utils/coveredCall/getRefundTx.js +59 -0
  101. package/lib/utils/coveredCall/getRemoveBidTx.d.ts +1 -0
  102. package/lib/utils/coveredCall/getRemoveBidTx.js +60 -0
  103. package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
  104. package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.js +61 -0
  105. package/lib/utils/coveredCall/getRemoveManagerTx.d.ts +1 -0
  106. package/lib/utils/coveredCall/getRemoveManagerTx.js +58 -0
  107. package/lib/utils/coveredCall/getRollOverTx.d.ts +1 -0
  108. package/lib/utils/coveredCall/getRollOverTx.js +60 -0
  109. package/lib/utils/coveredCall/getSettleTx.d.ts +1 -0
  110. package/lib/utils/coveredCall/getSettleTx.js +62 -0
  111. package/lib/utils/coveredCall/getSettleWithRollOverTx.d.ts +1 -0
  112. package/lib/utils/coveredCall/getSettleWithRollOverTx.js +62 -0
  113. package/lib/utils/coveredCall/getSubscribeTx.d.ts +1 -0
  114. package/lib/utils/coveredCall/getSubscribeTx.js +60 -0
  115. package/lib/utils/coveredCall/getUnsubscribeTx.d.ts +1 -0
  116. package/lib/utils/coveredCall/getUnsubscribeTx.js +63 -0
  117. package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.d.ts +1 -0
  118. package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.js +66 -0
  119. package/lib/utils/coveredCall/getUpdatePayoffConfigTx.d.ts +1 -0
  120. package/lib/utils/coveredCall/getUpdatePayoffConfigTx.js +62 -0
  121. package/lib/utils/coveredCall/getWithdrawTx.d.ts +1 -0
  122. package/lib/utils/coveredCall/getWithdrawTx.js +60 -0
  123. package/lib/utils/fetchData.d.ts +83 -0
  124. package/lib/utils/fetchData.js +206 -0
  125. package/lib/utils/getCreateTokenRegistryTx.d.ts +1 -0
  126. package/lib/utils/getCreateTokenRegistryTx.js +59 -0
  127. package/lib/utils/getMakersShares.d.ts +7 -0
  128. package/lib/utils/getMakersShares.js +148 -0
  129. package/lib/utils/getMintTx.d.ts +1 -0
  130. package/lib/utils/getMintTx.js +62 -0
  131. package/lib/utils/getNewOracleTx.d.ts +1 -0
  132. package/lib/utils/getNewOracleTx.js +59 -0
  133. package/lib/utils/getNewTimeOracleTx.d.ts +1 -0
  134. package/lib/utils/getNewTimeOracleTx.js +56 -0
  135. package/lib/utils/getTypeArgumentFromToken.d.ts +1 -0
  136. package/lib/utils/getTypeArgumentFromToken.js +71 -0
  137. package/lib/utils/getUpdateOracleTx.d.ts +1 -0
  138. package/lib/utils/getUpdateOracleTx.js +64 -0
  139. package/lib/utils/getUpdateTimeOracleTx.d.ts +1 -0
  140. package/lib/utils/getUpdateTimeOracleTx.js +60 -0
  141. package/lib/utils/getUsersShares.d.ts +8 -0
  142. package/lib/utils/getUsersShares.js +147 -0
  143. package/lib/utils/getVaultData.d.ts +3 -0
  144. package/lib/utils/getVaultData.js +262 -0
  145. package/lib/utils/getVaultIndexInRegistry.d.ts +1 -0
  146. package/lib/utils/getVaultIndexInRegistry.js +61 -0
  147. package/lib/utils/isObjAvailable.d.ts +0 -0
  148. package/lib/utils/isObjAvailable.js +14 -0
  149. package/lib/utils/loadUsersDepositData.d.ts +8 -0
  150. package/lib/utils/loadUsersDepositData.js +160 -0
  151. package/package.json +1 -1
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getAuthorizedEvolutionTx = void 0;
40
+ function getAuthorizedEvolutionTx(packageId, registry, typeArgument, 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: 'authorized_evolution',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ priceOracle,
53
+ timeOracle,
54
+ activationTsMs,
55
+ expirationTsMs,
56
+ ],
57
+ gasBudget: 10000,
58
+ };
59
+ return [2 /*return*/, tx];
60
+ });
61
+ });
62
+ }
63
+ exports.getAuthorizedEvolutionTx = getAuthorizedEvolutionTx;
@@ -0,0 +1 @@
1
+ export declare function getAuthorizedLastEvolutionTx(packageId: string, registry: string, typeArgument: string, index: string, priceOracle: string, timeOracle: string, expirationTsMs: string): Promise<any>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getAuthorizedLastEvolutionTx = void 0;
40
+ function getAuthorizedLastEvolutionTx(packageId, registry, typeArgument, index, priceOracle, timeOracle, 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: 'last_evolution',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ priceOracle,
53
+ timeOracle,
54
+ expirationTsMs,
55
+ ],
56
+ gasBudget: 10000,
57
+ };
58
+ return [2 /*return*/, tx];
59
+ });
60
+ });
61
+ }
62
+ exports.getAuthorizedLastEvolutionTx = getAuthorizedLastEvolutionTx;
@@ -0,0 +1 @@
1
+ export declare function getNewAuctionTx(packageId: string, registry: string, typeArgument: string, index: string, priceOracle: string, timeOracle: string): Promise<any>;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getNewAuctionTx = void 0;
40
+ function getNewAuctionTx(packageId, registry, typeArgument, index, priceOracle, timeOracle) {
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: 'authorized_new_auction',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ priceOracle,
53
+ timeOracle,
54
+ ],
55
+ gasBudget: 1000,
56
+ };
57
+ return [2 /*return*/, tx];
58
+ });
59
+ });
60
+ }
61
+ exports.getNewAuctionTx = getNewAuctionTx;
@@ -0,0 +1 @@
1
+ export declare function getAuthorizedNewCoveredCallVaultTx(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>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getAuthorizedNewCoveredCallVaultTx = void 0;
40
+ function getAuthorizedNewCoveredCallVaultTx(packageId, registry, typeArgument, managerCap, timeOracle, period, activationTsMs, expirationTsMs, tokenDecimal, shareDecimal, capacity, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, whitelist, leverage) {
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: 'authorized_new_covered_call_vault',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ managerCap,
51
+ registry,
52
+ timeOracle,
53
+ period,
54
+ activationTsMs,
55
+ expirationTsMs,
56
+ tokenDecimal,
57
+ shareDecimal,
58
+ capacity,
59
+ strikeOtmPct,
60
+ strikeIncrement,
61
+ decaySpeed,
62
+ initialPrice,
63
+ finalPrice,
64
+ auctionDurationInMs,
65
+ leverage,
66
+ whitelist,
67
+ ],
68
+ gasBudget: 10000,
69
+ };
70
+ return [2 /*return*/, tx];
71
+ });
72
+ });
73
+ }
74
+ exports.getAuthorizedNewCoveredCallVaultTx = getAuthorizedNewCoveredCallVaultTx;
75
+ /*
76
+ sui client call --package 0x1543511bdce9ea3c401c4939126cea518adee965 --module covered_call --function new_covered_call_vault --type-args 0x2::sui::SUI --args 0x8517b2dbaae56eeb84352e4869b289459c68965b 0xb02452d0bbef3cbdc7840ea5bad27bcdd4031675 123 leoAsset 456 --gas-budget 100000
77
+ */
@@ -0,0 +1 @@
1
+ export declare function getAuthorizedRemoveAuthorizedUserTx(packageId: string, registry: string, managerCap: string, address: string): Promise<any>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getAuthorizedRemoveAuthorizedUserTx = void 0;
40
+ function getAuthorizedRemoveAuthorizedUserTx(packageId, registry, managerCap, address) {
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: 'remove_authorized_user',
48
+ typeArguments: [],
49
+ arguments: [
50
+ managerCap,
51
+ registry,
52
+ address,
53
+ ],
54
+ gasBudget: 10000,
55
+ };
56
+ return [2 /*return*/, tx];
57
+ });
58
+ });
59
+ }
60
+ exports.getAuthorizedRemoveAuthorizedUserTx = getAuthorizedRemoveAuthorizedUserTx;
@@ -0,0 +1 @@
1
+ export declare function getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx(packageId: string, registry: string, typeArgument: string, index: string, address: string): Promise<any>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx = void 0;
40
+ function getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx(packageId, registry, typeArgument, index, address) {
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: 'authorized_remove_covered_call_vault_authorized_user',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ address,
53
+ ],
54
+ gasBudget: 10000,
55
+ };
56
+ return [2 /*return*/, tx];
57
+ });
58
+ });
59
+ }
60
+ exports.getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx = getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx;
@@ -0,0 +1 @@
1
+ export declare function getAuthorizedSettleTx(packageId: string, registry: string, typeArgument: string, index: string, priceOracle: string, timeOracle: string): Promise<any>;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getAuthorizedSettleTx = void 0;
40
+ function getAuthorizedSettleTx(packageId, registry, typeArgument, index, priceOracle, timeOracle) {
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: 'authorized_settle',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ priceOracle,
53
+ timeOracle,
54
+ ],
55
+ gasBudget: 10000,
56
+ };
57
+ return [2 /*return*/, tx];
58
+ });
59
+ });
60
+ }
61
+ exports.getAuthorizedSettleTx = getAuthorizedSettleTx;
@@ -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>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
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: 'authorized_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
+ });
63
+ });
64
+ }
65
+ exports.getUpdateNextVaultConfigTx = getUpdateNextVaultConfigTx;
@@ -0,0 +1 @@
1
+ export declare function createPriceOracle(typeArgument: string): Promise<[string, string]>;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.createPriceOracle = void 0;
40
+ var getNewOracleTx_1 = require("../../utils/getNewOracleTx");
41
+ var constants_1 = require("../../constants");
42
+ var sui_js_1 = require("@mysten/sui.js");
43
+ var provider = new sui_js_1.JsonRpcProvider(constants_1.TESTNET_RPC_ENDPOINT); //for read only operations
44
+ var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
45
+ var signer = new sui_js_1.RawSigner(keypair, provider);
46
+ var decimal = 8;
47
+ function createPriceOracle(typeArgument) {
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ var _this = this;
50
+ return __generator(this, function (_a) {
51
+ return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
52
+ var newOracleTx, moveCallTxn, digest, txn, priceOracle, managerCap, e_1;
53
+ return __generator(this, function (_a) {
54
+ switch (_a.label) {
55
+ case 0:
56
+ _a.trys.push([0, 4, , 5]);
57
+ console.log("create new price oracle...");
58
+ return [4 /*yield*/, (0, getNewOracleTx_1.getNewOracleTx)(constants_1.ORACLE_PACKAGE, typeArgument, decimal)];
59
+ case 1:
60
+ newOracleTx = _a.sent();
61
+ return [4 /*yield*/, signer.executeMoveCall(newOracleTx)];
62
+ case 2:
63
+ moveCallTxn = _a.sent();
64
+ digest = moveCallTxn.EffectsCert.certificate.transactionDigest;
65
+ return [4 /*yield*/, provider.getTransactionWithEffects(digest)];
66
+ case 3:
67
+ txn = _a.sent();
68
+ priceOracle = void 0;
69
+ managerCap = void 0;
70
+ if (txn.effects.created[0].owner["AddressOwner"] == undefined) {
71
+ priceOracle = txn.effects.created[0].reference.objectId;
72
+ managerCap = txn.effects.created[1].reference.objectId;
73
+ }
74
+ else {
75
+ priceOracle = txn.effects.created[1].reference.objectId;
76
+ managerCap = txn.effects.created[0].reference.objectId;
77
+ }
78
+ resolve([priceOracle, managerCap]);
79
+ return [3 /*break*/, 5];
80
+ case 4:
81
+ e_1 = _a.sent();
82
+ console.error("err in createPriceOracle");
83
+ reject(e_1);
84
+ return [3 /*break*/, 5];
85
+ case 5: return [2 /*return*/];
86
+ }
87
+ });
88
+ }); })];
89
+ });
90
+ });
91
+ }
92
+ exports.createPriceOracle = createPriceOracle;
@@ -0,0 +1 @@
1
+ export declare function createTimeOracle(): Promise<[string, string]>;