@typus/typus-sdk 0.3.9 → 0.4.1

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 (28) hide show
  1. package/lib/constants.d.ts +13 -11
  2. package/lib/constants.js +14 -12
  3. package/lib/test/eventListener.d.ts +1 -0
  4. package/lib/test/eventListener.js +66 -10
  5. package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.d.ts +1 -0
  6. package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.js +60 -0
  7. package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.d.ts +1 -1
  8. package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.js +3 -3
  9. package/lib/utils/authorized/getAuthorizedLastEvolutionTx.d.ts +1 -0
  10. package/lib/utils/authorized/getAuthorizedLastEvolutionTx.js +62 -0
  11. package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.d.ts +1 -0
  12. package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.js +60 -0
  13. package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
  14. package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.js +61 -0
  15. package/lib/utils/coveredCall/getLastEvolutionTx.d.ts +1 -0
  16. package/lib/utils/coveredCall/getLastEvolutionTx.js +63 -0
  17. package/lib/utils/coveredCall/getMakerClaimAllTx.d.ts +1 -0
  18. package/lib/utils/coveredCall/getMakerClaimAllTx.js +59 -0
  19. package/lib/utils/coveredCall/getMakerClaimTx.d.ts +1 -0
  20. package/lib/utils/coveredCall/getMakerClaimTx.js +59 -0
  21. package/lib/utils/coveredCall/getRefundTx.d.ts +1 -0
  22. package/lib/utils/coveredCall/getRefundTx.js +59 -0
  23. package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
  24. package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.js +61 -0
  25. package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.d.ts +1 -1
  26. package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.js +2 -1
  27. package/lib/utils/getVaultData.js +28 -47
  28. package/package.json +1 -1
@@ -1,14 +1,16 @@
1
- export declare const TOKEN_PACKAGE = "0x2c9a10117599e2d3232495a525b10f679691c9ae";
2
- export declare const TOKEN_REGISTRY_BTC = "0xe0dc19dfc9023f2e86462aa37dc8fae290b4e2bb";
3
- export declare const TOKEN_REGISTRY_ETH = "0x9ad1db50850079e98d5972e3d9a8fdc90b9d1f19";
4
- export declare const TOKEN_REGISTRY_SUI = "0xc6128d63d24cbdb66e50cef4577e5cf36bb889e1";
5
- export declare const ORACLE_PACKAGE = "0x0d4b13cc0467c0620ce54abf703faa3b419d967b";
6
- export declare const COVERED_CALL_PACKAGE = "0x9e02627cbd517b378cb2119862f618078246c813";
7
- export declare const COVERED_CALL_REGISTRY = "0x3b94b2ead34d0f617c6302ceb2f4e4cb8ff69ae6";
8
- export declare const COVERED_CALL_MANAGER = "0x10f71ab8bac2a9be4d4972e07a1ea67bef94c263";
9
- export declare const USER_SHARE_TABLE = "0xa885de38c4e3a28c136ea6aa6cc49a934261042a";
10
- export declare const MAKER_SHARE_TABLE = "0x70241eccfc271f3c54efc56392f5a6c77950501e";
11
- export declare const DOV_PACKAGE = "0x1bf2cad8d9d4d11a8e2c981b0f6a9c9744887776";
1
+ export declare const TOKEN_PACKAGE = "0x1ed338b4e737d89729386b8170b0f45910ad30fa";
2
+ export declare const TOKEN_REGISTRY_BTC = "0xf5f939a6a79927e55582985a8bf125d37b0ab297";
3
+ export declare const TOKEN_REGISTRY_ETH = "0xb79efcacd84dc70dd6969686d7e7fadadc14c2d5";
4
+ export declare const TOKEN_REGISTRY_SUI = "0xde095084d4485b0482ab8dc8fe8c8328902fa223";
5
+ export declare const ORACLE_PACKAGE = "0x5b1f5680041041624069ef03f23947001b073642";
6
+ export declare const TIME_ORACLE = "0x1480773700cdeecfbac028f5345ec8f472750ef8";
7
+ export declare const COVERED_CALL_PACKAGE = "0x00d18316601f16439dec0a6b3e40ef861fc84ee4";
8
+ export declare const COVERED_CALL_REGISTRY = "0xe3960d9dc8e39328e514d42d3318c5878145c27e";
9
+ export declare const COVERED_CALL_MANAGER = "0xfe26a77c66f4ae0314e1510921f8dea9be01db9c";
10
+ export declare const USER_SHARE_TABLE = "0x4d98c1efa4aef5b02e8fe27bca6ac4d8dde62935";
11
+ export declare const USER_REFUND_TABLE = "0x3e80b4c0f7d1b05a73d180487aa2bbf5e3c77792";
12
+ export declare const MAKER_SHARE_TABLE = "0xef0dabd3f82d4cc09c440a61f095a977d72ade05";
13
+ export declare const DOV_PACKAGE = "0xdbb42109c373ded4b97016230e5d065fb96813b8";
12
14
  export declare const TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
13
15
  export declare const PRICE_DECIMAL = 8;
14
16
  export declare const TOKEN_DECIMAL = 9;
package/lib/constants.js CHANGED
@@ -1,21 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.TEST_MNEMONIC = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.TEST_MINT_TOKEN = exports.DOV_PACKAGE = exports.MAKER_SHARE_TABLE = exports.USER_SHARE_TABLE = exports.COVERED_CALL_MANAGER = exports.COVERED_CALL_REGISTRY = exports.COVERED_CALL_PACKAGE = exports.ORACLE_PACKAGE = exports.TOKEN_REGISTRY_SUI = exports.TOKEN_REGISTRY_ETH = exports.TOKEN_REGISTRY_BTC = exports.TOKEN_PACKAGE = void 0;
3
+ exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.TEST_MNEMONIC = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.TEST_MINT_TOKEN = exports.DOV_PACKAGE = exports.MAKER_SHARE_TABLE = exports.USER_REFUND_TABLE = exports.USER_SHARE_TABLE = exports.COVERED_CALL_MANAGER = exports.COVERED_CALL_REGISTRY = exports.COVERED_CALL_PACKAGE = exports.TIME_ORACLE = exports.ORACLE_PACKAGE = exports.TOKEN_REGISTRY_SUI = exports.TOKEN_REGISTRY_ETH = exports.TOKEN_REGISTRY_BTC = exports.TOKEN_PACKAGE = void 0;
4
4
  //publish from sui-dev-token
5
- exports.TOKEN_PACKAGE = "0x2c9a10117599e2d3232495a525b10f679691c9ae";
6
- exports.TOKEN_REGISTRY_BTC = "0xe0dc19dfc9023f2e86462aa37dc8fae290b4e2bb"; //fake btc registry
7
- exports.TOKEN_REGISTRY_ETH = "0x9ad1db50850079e98d5972e3d9a8fdc90b9d1f19"; //fake eth registry
8
- exports.TOKEN_REGISTRY_SUI = "0xc6128d63d24cbdb66e50cef4577e5cf36bb889e1"; //fake usdc registry
5
+ exports.TOKEN_PACKAGE = "0x1ed338b4e737d89729386b8170b0f45910ad30fa";
6
+ exports.TOKEN_REGISTRY_BTC = "0xf5f939a6a79927e55582985a8bf125d37b0ab297"; //fake btc registry
7
+ exports.TOKEN_REGISTRY_ETH = "0xb79efcacd84dc70dd6969686d7e7fadadc14c2d5"; //fake eth registry
8
+ exports.TOKEN_REGISTRY_SUI = "0xde095084d4485b0482ab8dc8fe8c8328902fa223"; //fake usdc registry
9
9
  //publish from typus-oracle
10
- exports.ORACLE_PACKAGE = "0x0d4b13cc0467c0620ce54abf703faa3b419d967b";
10
+ exports.ORACLE_PACKAGE = "0x5b1f5680041041624069ef03f23947001b073642";
11
+ exports.TIME_ORACLE = "0x1480773700cdeecfbac028f5345ec8f472750ef8";
11
12
  //publish from typus-dov/cover_call
12
- exports.COVERED_CALL_PACKAGE = "0x9e02627cbd517b378cb2119862f618078246c813";
13
- exports.COVERED_CALL_REGISTRY = "0x3b94b2ead34d0f617c6302ceb2f4e4cb8ff69ae6";
14
- exports.COVERED_CALL_MANAGER = "0x10f71ab8bac2a9be4d4972e07a1ea67bef94c263";
15
- exports.USER_SHARE_TABLE = "0xa885de38c4e3a28c136ea6aa6cc49a934261042a";
16
- exports.MAKER_SHARE_TABLE = "0x70241eccfc271f3c54efc56392f5a6c77950501e";
13
+ exports.COVERED_CALL_PACKAGE = "0x00d18316601f16439dec0a6b3e40ef861fc84ee4";
14
+ exports.COVERED_CALL_REGISTRY = "0xe3960d9dc8e39328e514d42d3318c5878145c27e";
15
+ exports.COVERED_CALL_MANAGER = "0xfe26a77c66f4ae0314e1510921f8dea9be01db9c";
16
+ exports.USER_SHARE_TABLE = "0x4d98c1efa4aef5b02e8fe27bca6ac4d8dde62935";
17
+ exports.USER_REFUND_TABLE = "0x3e80b4c0f7d1b05a73d180487aa2bbf5e3c77792";
18
+ exports.MAKER_SHARE_TABLE = "0xef0dabd3f82d4cc09c440a61f095a977d72ade05";
17
19
  //publish from typus-dov/typus-dov
18
- exports.DOV_PACKAGE = "0x1bf2cad8d9d4d11a8e2c981b0f6a9c9744887776";
20
+ exports.DOV_PACKAGE = "0xdbb42109c373ded4b97016230e5d065fb96813b8";
19
21
  exports.TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
20
22
  exports.PRICE_DECIMAL = 8;
21
23
  exports.TOKEN_DECIMAL = 9;
@@ -1,3 +1,4 @@
1
1
  export declare function getBidEventsCranker(type: string, renewSec: number): Promise<void>;
2
2
  export declare function getNewAuctionEventsCranker(type: string, renewSec: number): Promise<void>;
3
+ export declare function getEndAuctionEventsCranker(type: string, renewSec: number): Promise<void>;
3
4
  export declare function sendEventToTelegramChannel(text: any): Promise<void>;
@@ -39,11 +39,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.sendEventToTelegramChannel = exports.getNewAuctionEventsCranker = exports.getBidEventsCranker = void 0;
42
+ exports.sendEventToTelegramChannel = exports.getEndAuctionEventsCranker = exports.getNewAuctionEventsCranker = exports.getBidEventsCranker = void 0;
43
43
  var constants_1 = require("../constants");
44
44
  var sui_js_1 = require("@mysten/sui.js");
45
45
  var node_cron_1 = __importDefault(require("node-cron"));
46
46
  var XMLHttpRequest_1 = require("XMLHttpRequest");
47
+ var moment_1 = __importDefault(require("moment"));
47
48
  var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
48
49
  var apiToken = "5864284783:AAHwXWgt2YgLENdJ9mVBUDBVLHXrMLNgkic";
49
50
  /*
@@ -53,10 +54,18 @@ var chatId = "-1001784476809";
53
54
  (function () { return __awaiter(void 0, void 0, void 0, function () {
54
55
  var bidType, newAuctionType, renewSec;
55
56
  return __generator(this, function (_a) {
56
- bidType = constants_1.DOV_PACKAGE + "::dutch::NewBid<" + constants_1.TOKEN_PACKAGE + "::eth::ETH>";
57
- newAuctionType = constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewAuction";
58
- renewSec = 10;
59
- return [2 /*return*/];
57
+ switch (_a.label) {
58
+ case 0:
59
+ bidType = constants_1.DOV_PACKAGE + "::dutch::NewBid<" + constants_1.TOKEN_PACKAGE + "::eth::ETH>";
60
+ newAuctionType = constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewAuction";
61
+ renewSec = 10;
62
+ return [4 /*yield*/, getBidEventsCranker(bidType, renewSec)
63
+ // await getNewAuctionEventsCranker(newAuctionType, renewSec)
64
+ ];
65
+ case 1:
66
+ _a.sent();
67
+ return [2 /*return*/];
68
+ }
60
69
  });
61
70
  }); })();
62
71
  function getBidEventsCranker(type, renewSec) {
@@ -66,7 +75,7 @@ function getBidEventsCranker(type, renewSec) {
66
75
  return __generator(this, function (_a) {
67
76
  res = [];
68
77
  node_cron_1.default.schedule('*/' + renewSec.toString() + ' * * * * *', function () { return __awaiter(_this, void 0, void 0, function () {
69
- var events, newRes, newBid;
78
+ var events, newRes, newBid, newBidFormat_1, telegramText;
70
79
  return __generator(this, function (_a) {
71
80
  switch (_a.label) {
72
81
  case 0:
@@ -85,7 +94,16 @@ function getBidEventsCranker(type, renewSec) {
85
94
  newBid = newRes.filter(function (e) {
86
95
  return res.indexOf(e) === -1;
87
96
  });
88
- newBid.map(function (e) { console.log(e.event.moveEvent.fields); });
97
+ console.log("new bid amount: " + newBid.length);
98
+ newBidFormat_1 = "";
99
+ newBid.map(function (e) {
100
+ var time = moment_1.default.unix(e.timestamp / 1000).format("YYYY MM/DD HH:mm:ss");
101
+ var size = Number(e.event.moveEvent.fields.size) / (Math.pow(10, constants_1.TOKEN_DECIMAL));
102
+ newBidFormat_1 += "New bid: \n" + "Time: " + time + " \nBider: " + e.event.moveEvent.sender + " \n" + "Size: " + size.toString() + "\n";
103
+ });
104
+ console.log(newBidFormat_1);
105
+ telegramText = newBidFormat_1;
106
+ // sendEventToTelegramChannel(telegramText)
89
107
  res = newRes;
90
108
  }
91
109
  return [2 /*return*/];
@@ -99,12 +117,53 @@ function getBidEventsCranker(type, renewSec) {
99
117
  exports.getBidEventsCranker = getBidEventsCranker;
100
118
  function getNewAuctionEventsCranker(type, renewSec) {
101
119
  return __awaiter(this, void 0, void 0, function () {
120
+ var res;
121
+ var _this = this;
102
122
  return __generator(this, function (_a) {
123
+ res = [];
124
+ node_cron_1.default.schedule('*/' + renewSec.toString() + ' * * * * *', function () { return __awaiter(_this, void 0, void 0, function () {
125
+ var events, newRes, newAuction, timesFormat_1, telegramText;
126
+ return __generator(this, function (_a) {
127
+ switch (_a.label) {
128
+ case 0:
129
+ console.log("listening for every " + renewSec.toString() + " s...");
130
+ return [4 /*yield*/, provider.getEvents({ MoveEvent: type }, null, null)];
131
+ case 1:
132
+ events = _a.sent();
133
+ newRes = events.data;
134
+ if (newRes.length != res.length) {
135
+ console.log("start a new auction!");
136
+ console.log(events);
137
+ newAuction = newRes.filter(function (e) {
138
+ return res.indexOf(e) === -1;
139
+ });
140
+ timesFormat_1 = "";
141
+ newAuction.map(function (e) {
142
+ var time = moment_1.default.unix(e.timestamp / 1000).format("YYYY MM/DD HH:mm:ss");
143
+ console.log(time);
144
+ timesFormat_1 += time + " \n";
145
+ });
146
+ telegramText = " auction is live now!";
147
+ // sendEventToTelegramChannel(telegramText)
148
+ res = newRes;
149
+ }
150
+ return [2 /*return*/];
151
+ }
152
+ });
153
+ }); });
103
154
  return [2 /*return*/];
104
155
  });
105
156
  });
106
157
  }
107
158
  exports.getNewAuctionEventsCranker = getNewAuctionEventsCranker;
159
+ function getEndAuctionEventsCranker(type, renewSec) {
160
+ return __awaiter(this, void 0, void 0, function () {
161
+ return __generator(this, function (_a) {
162
+ return [2 /*return*/];
163
+ });
164
+ });
165
+ }
166
+ exports.getEndAuctionEventsCranker = getEndAuctionEventsCranker;
108
167
  function sendEventToTelegramChannel(text) {
109
168
  return __awaiter(this, void 0, void 0, function () {
110
169
  var urlString, request;
@@ -113,9 +172,6 @@ function sendEventToTelegramChannel(text) {
113
172
  request = new XMLHttpRequest_1.XMLHttpRequest();
114
173
  request.open("GET", urlString);
115
174
  request.send();
116
- request.onload = function () {
117
- console.log(JSON.parse(request.responseText));
118
- };
119
175
  return [2 /*return*/];
120
176
  });
121
177
  });
@@ -0,0 +1 @@
1
+ export declare function getAuthorizedAddAuthorizedUserTx(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 (_) 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.getAuthorizedAddAuthorizedUserTx = void 0;
40
+ function getAuthorizedAddAuthorizedUserTx(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: 'add_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.getAuthorizedAddAuthorizedUserTx = getAuthorizedAddAuthorizedUserTx;
@@ -1 +1 @@
1
- export declare function getauthorizedAddCoveredCallVaultAuthorizedUserTx(packageId: string, registry: string, typeArgument: string, index: string, address: string): Promise<any>;
1
+ export declare function getAuthorizedAddCoveredCallVaultAuthorizedUserTx(packageId: string, registry: string, typeArgument: string, index: string, address: string): Promise<any>;
@@ -36,8 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getauthorizedAddCoveredCallVaultAuthorizedUserTx = void 0;
40
- function getauthorizedAddCoveredCallVaultAuthorizedUserTx(packageId, registry, typeArgument, index, address) {
39
+ exports.getAuthorizedAddCoveredCallVaultAuthorizedUserTx = void 0;
40
+ function getAuthorizedAddCoveredCallVaultAuthorizedUserTx(packageId, registry, typeArgument, index, address) {
41
41
  return __awaiter(this, void 0, void 0, function () {
42
42
  var tx;
43
43
  return __generator(this, function (_a) {
@@ -57,4 +57,4 @@ function getauthorizedAddCoveredCallVaultAuthorizedUserTx(packageId, registry, t
57
57
  });
58
58
  });
59
59
  }
60
- exports.getauthorizedAddCoveredCallVaultAuthorizedUserTx = getauthorizedAddCoveredCallVaultAuthorizedUserTx;
60
+ exports.getAuthorizedAddCoveredCallVaultAuthorizedUserTx = getAuthorizedAddCoveredCallVaultAuthorizedUserTx;
@@ -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 (_) 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 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 (_) 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 getAddCoveredCallVaultAuthorizedUserTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: string, address: 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 (_) 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.getAddCoveredCallVaultAuthorizedUserTx = void 0;
40
+ function getAddCoveredCallVaultAuthorizedUserTx(packageId, managerCap, 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: 'add_covered_call_vault_authorized_user',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ managerCap,
51
+ registry,
52
+ index,
53
+ address,
54
+ ],
55
+ gasBudget: 10000,
56
+ };
57
+ return [2 /*return*/, tx];
58
+ });
59
+ });
60
+ }
61
+ exports.getAddCoveredCallVaultAuthorizedUserTx = getAddCoveredCallVaultAuthorizedUserTx;
@@ -0,0 +1 @@
1
+ export declare function getEvolutionTx(packageId: string, registry: string, typeArgument: string, managerCap: string, index: string, priceOracle: string, timeOracle: string, expirationTsMs: string): Promise<any>;
@@ -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 (_) 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.getEvolutionTx = void 0;
40
+ function getEvolutionTx(packageId, registry, typeArgument, managerCap, 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
+ managerCap,
51
+ registry,
52
+ index,
53
+ priceOracle,
54
+ timeOracle,
55
+ expirationTsMs,
56
+ ],
57
+ gasBudget: 10000,
58
+ };
59
+ return [2 /*return*/, tx];
60
+ });
61
+ });
62
+ }
63
+ exports.getEvolutionTx = getEvolutionTx;
@@ -0,0 +1 @@
1
+ export declare function getMakerClaimAllTx(packageId: string, registry: string, typeArgument: string, index: string): Promise<any>;
@@ -0,0 +1,59 @@
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 (_) 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.getMakerClaimAllTx = void 0;
40
+ function getMakerClaimAllTx(packageId, registry, typeArgument, index) {
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: 'maker_claim_all',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ ],
53
+ gasBudget: 10000,
54
+ };
55
+ return [2 /*return*/, tx];
56
+ });
57
+ });
58
+ }
59
+ exports.getMakerClaimAllTx = getMakerClaimAllTx;
@@ -0,0 +1 @@
1
+ export declare function getMakerClaimTx(packageId: string, registry: string, typeArgument: string, index: string): Promise<any>;
@@ -0,0 +1,59 @@
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 (_) 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.getMakerClaimTx = void 0;
40
+ function getMakerClaimTx(packageId, registry, typeArgument, index) {
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: 'maker_claim',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ ],
53
+ gasBudget: 10000,
54
+ };
55
+ return [2 /*return*/, tx];
56
+ });
57
+ });
58
+ }
59
+ exports.getMakerClaimTx = getMakerClaimTx;
@@ -0,0 +1 @@
1
+ export declare function getRefundTx(packageId: string, registry: string, typeArgument: string, index: string): Promise<any>;
@@ -0,0 +1,59 @@
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 (_) 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.getRefundTx = void 0;
40
+ function getRefundTx(packageId, registry, typeArgument, index) {
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: 'refund',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ ],
53
+ gasBudget: 10000,
54
+ };
55
+ return [2 /*return*/, tx];
56
+ });
57
+ });
58
+ }
59
+ exports.getRefundTx = getRefundTx;
@@ -0,0 +1 @@
1
+ export declare function getRemoveCoveredCallVaultAuthorizedUserTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: string, address: 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 (_) 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.getRemoveCoveredCallVaultAuthorizedUserTx = void 0;
40
+ function getRemoveCoveredCallVaultAuthorizedUserTx(packageId, managerCap, 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: 'remove_covered_call_vault_authorized_user',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ managerCap,
51
+ registry,
52
+ index,
53
+ address,
54
+ ],
55
+ gasBudget: 10000,
56
+ };
57
+ return [2 /*return*/, tx];
58
+ });
59
+ });
60
+ }
61
+ exports.getRemoveCoveredCallVaultAuthorizedUserTx = getRemoveCoveredCallVaultAuthorizedUserTx;
@@ -1 +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>;
1
+ export declare function getUpdateNextVaultConfigTx(packageId: string, managerCap: string, registry: string, typeArgument: string, index: string, strikeOtmPct: string, strikeIncrement: string, decaySpeed: string, initialPrice: string, finalPrice: string, auctionDurationInMs: 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.getUpdateNextVaultConfigTx = void 0;
40
- function getUpdateNextVaultConfigTx(packageId, registry, typeArgument, index, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs) {
40
+ function getUpdateNextVaultConfigTx(packageId, managerCap, registry, typeArgument, index, strikeOtmPct, strikeIncrement, decaySpeed, initialPrice, finalPrice, auctionDurationInMs) {
41
41
  return __awaiter(this, void 0, void 0, function () {
42
42
  var tx;
43
43
  return __generator(this, function (_a) {
@@ -47,6 +47,7 @@ function getUpdateNextVaultConfigTx(packageId, registry, typeArgument, index, st
47
47
  function: 'update_next_vault_config',
48
48
  typeArguments: [typeArgument],
49
49
  arguments: [
50
+ managerCap,
50
51
  registry,
51
52
  index,
52
53
  strikeOtmPct,
@@ -35,22 +35,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
- var __read = (this && this.__read) || function (o, n) {
39
- var m = typeof Symbol === "function" && o[Symbol.iterator];
40
- if (!m) return o;
41
- var i = m.call(o), r, ar = [], e;
42
- try {
43
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
- }
45
- catch (error) { e = { error: error }; }
46
- finally {
47
- try {
48
- if (r && !r.done && (m = i["return"])) m.call(i);
49
- }
50
- finally { if (e) throw e.error; }
51
- }
52
- return ar;
53
- };
54
38
  var __values = (this && this.__values) || function(o) {
55
39
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
56
40
  if (m) return m.call(o);
@@ -66,31 +50,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
66
50
  exports.getVaultBidPrice = exports.getVaultDataFromRegistry = void 0;
67
51
  var sui_js_1 = require("@mysten/sui.js");
68
52
  var constants_1 = require("../constants");
69
- var createTimeOracle_1 = require("../utils/coveredCall/createTimeOracle");
70
53
  var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
71
54
  function getVaultDataFromRegistry(registry) {
72
55
  return __awaiter(this, void 0, void 0, function () {
73
- var coveredCallVaults, coveredCallVaultsId, objsInfo, vaults, _a, timeOracle, _, _loop_1, objsInfo_1, objsInfo_1_1, objInfo, e_1_1;
74
- var e_1, _b;
75
- return __generator(this, function (_c) {
76
- switch (_c.label) {
56
+ var coveredCallVaults, coveredCallVaultsId, objsInfo, vaults, timeOracle, _loop_1, objsInfo_1, objsInfo_1_1, objInfo, e_1_1;
57
+ var e_1, _a;
58
+ return __generator(this, function (_b) {
59
+ switch (_b.label) {
77
60
  case 0:
78
61
  console.log("registry: " + registry);
79
62
  return [4 /*yield*/, provider.getObjectsOwnedByObject(registry)];
80
63
  case 1:
81
- coveredCallVaults = _c.sent();
64
+ coveredCallVaults = _b.sent();
82
65
  coveredCallVaultsId = coveredCallVaults.map(function (e) { return e.objectId; });
83
66
  return [4 /*yield*/, provider.getObjectBatch(coveredCallVaultsId)];
84
67
  case 2:
85
- objsInfo = _c.sent();
68
+ objsInfo = _b.sent();
86
69
  vaults = [];
87
- return [4 /*yield*/, (0, createTimeOracle_1.createTimeOracle)()];
88
- case 3:
89
- _a = __read.apply(void 0, [_c.sent(), 2]), timeOracle = _a[0], _ = _a[1];
70
+ timeOracle = constants_1.TIME_ORACLE;
90
71
  _loop_1 = function (objInfo) {
91
72
  var vaultId, vaultIdx, type, asset, config, vault, prev, vaultConfig, vaultConfigRes, nextVaultConfig, nextVaultConfigRes, payoffConfig, payoffConfigRes, configRes, maker, regular, rolling, vaultRes, auctionRes, vaultBidPrice, auction, priceConfig, priceConfigRes, next, totalBidSize, deliveryInfo, owner, tvl, res;
92
- return __generator(this, function (_d) {
93
- switch (_d.label) {
73
+ return __generator(this, function (_c) {
74
+ switch (_c.label) {
94
75
  case 0:
95
76
  if (objInfo.status != "Exists") {
96
77
  console.log("obj not exist");
@@ -180,14 +161,14 @@ function getVaultDataFromRegistry(registry) {
180
161
  };
181
162
  return [4 /*yield*/, getVaultBidPrice(auctionRes, timeOracle)];
182
163
  case 1:
183
- vaultBidPrice = _d.sent();
164
+ vaultBidPrice = _c.sent();
184
165
  console.log("get auction in " + vaultId);
185
166
  return [3 /*break*/, 3];
186
167
  case 2:
187
168
  console.log("No auction " + vaultId);
188
169
  auctionRes = {};
189
170
  vaultBidPrice = 0;
190
- _d.label = 3;
171
+ _c.label = 3;
191
172
  case 3:
192
173
  next = objInfo.details.data.fields.value.fields.next;
193
174
  totalBidSize = objInfo.details.data.fields.value.fields.total_bid_size;
@@ -214,33 +195,33 @@ function getVaultDataFromRegistry(registry) {
214
195
  }
215
196
  });
216
197
  };
217
- _c.label = 4;
218
- case 4:
219
- _c.trys.push([4, 9, 10, 11]);
198
+ _b.label = 3;
199
+ case 3:
200
+ _b.trys.push([3, 8, 9, 10]);
220
201
  objsInfo_1 = __values(objsInfo), objsInfo_1_1 = objsInfo_1.next();
221
- _c.label = 5;
222
- case 5:
223
- if (!!objsInfo_1_1.done) return [3 /*break*/, 8];
202
+ _b.label = 4;
203
+ case 4:
204
+ if (!!objsInfo_1_1.done) return [3 /*break*/, 7];
224
205
  objInfo = objsInfo_1_1.value;
225
206
  return [5 /*yield**/, _loop_1(objInfo)];
207
+ case 5:
208
+ _b.sent();
209
+ _b.label = 6;
226
210
  case 6:
227
- _c.sent();
228
- _c.label = 7;
229
- case 7:
230
211
  objsInfo_1_1 = objsInfo_1.next();
231
- return [3 /*break*/, 5];
232
- case 8: return [3 /*break*/, 11];
233
- case 9:
234
- e_1_1 = _c.sent();
212
+ return [3 /*break*/, 4];
213
+ case 7: return [3 /*break*/, 10];
214
+ case 8:
215
+ e_1_1 = _b.sent();
235
216
  e_1 = { error: e_1_1 };
236
- return [3 /*break*/, 11];
237
- case 10:
217
+ return [3 /*break*/, 10];
218
+ case 9:
238
219
  try {
239
- if (objsInfo_1_1 && !objsInfo_1_1.done && (_b = objsInfo_1.return)) _b.call(objsInfo_1);
220
+ if (objsInfo_1_1 && !objsInfo_1_1.done && (_a = objsInfo_1.return)) _a.call(objsInfo_1);
240
221
  }
241
222
  finally { if (e_1) throw e_1.error; }
242
223
  return [7 /*endfinally*/];
243
- case 11: return [2 /*return*/, vaults];
224
+ case 10: return [2 /*return*/, vaults];
244
225
  }
245
226
  });
246
227
  });
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": "0.3.9",
5
+ "version": "0.4.1",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.5.0",
8
8
  "@mysten/sui.js": "^0.20.0",