@typus/typus-sdk 0.3.5 → 0.3.7

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 (24) hide show
  1. package/lib/constants.d.ts +5 -5
  2. package/lib/constants.js +5 -5
  3. package/lib/test/eventListener.d.ts +2 -0
  4. package/lib/test/eventListener.js +110 -0
  5. package/lib/utils/auction/getBid.js +4 -4
  6. package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
  7. package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.js +60 -0
  8. package/lib/utils/authorized/getAuthorizedDeliveryTx.d.ts +1 -0
  9. package/lib/utils/authorized/getAuthorizedDeliveryTx.js +60 -0
  10. package/lib/utils/authorized/getAuthorizedEvolutionTx.d.ts +1 -0
  11. package/lib/utils/authorized/getAuthorizedEvolutionTx.js +63 -0
  12. package/lib/utils/authorized/getAuthorizedNewAuctionTx.d.ts +1 -0
  13. package/lib/utils/authorized/getAuthorizedNewAuctionTx.js +61 -0
  14. package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.d.ts +1 -0
  15. package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.js +77 -0
  16. package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
  17. package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.js +60 -0
  18. package/lib/utils/authorized/getAuthorizedSettleTx.d.ts +1 -0
  19. package/lib/utils/authorized/getAuthorizedSettleTx.js +61 -0
  20. package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +1 -0
  21. package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.js +65 -0
  22. package/lib/utils/fetchData.d.ts +38 -34
  23. package/lib/utils/getVaultData.js +29 -27
  24. package/package.json +3 -2
@@ -3,11 +3,11 @@ export declare const TOKEN_REGISTRY_BTC = "0xe0dc19dfc9023f2e86462aa37dc8fae290b
3
3
  export declare const TOKEN_REGISTRY_ETH = "0x9ad1db50850079e98d5972e3d9a8fdc90b9d1f19";
4
4
  export declare const TOKEN_REGISTRY_SUI = "0xc6128d63d24cbdb66e50cef4577e5cf36bb889e1";
5
5
  export declare const ORACLE_PACKAGE = "0x0d4b13cc0467c0620ce54abf703faa3b419d967b";
6
- export declare const COVERED_CALL_PACKAGE = "0x8cd580538967d5a83a5695f9e2db9f3695e5bdc0";
7
- export declare const COVERED_CALL_REGISTRY = "0xff3eae20040a8ec4d45bae3ac85b662cf8adea4f";
8
- export declare const COVERED_CALL_MANAGER = "0xb37ffa9b254f94e4c402806bb6011a2a32642ff4";
9
- export declare const USER_SHARE_TABLE = "0x27e557f1464297be0fd2b4fefee1e1077b145d08";
10
- export declare const MAKER_SHARE_TABLE = "0x8f55dcd94ce055c1b97e906b9642c0ce6392557e";
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
11
  export declare const DOV_PACKAGE = "0x1bf2cad8d9d4d11a8e2c981b0f6a9c9744887776";
12
12
  export declare const TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
13
13
  export declare const PRICE_DECIMAL = 8;
package/lib/constants.js CHANGED
@@ -9,11 +9,11 @@ exports.TOKEN_REGISTRY_SUI = "0xc6128d63d24cbdb66e50cef4577e5cf36bb889e1"; //fak
9
9
  //publish from typus-oracle
10
10
  exports.ORACLE_PACKAGE = "0x0d4b13cc0467c0620ce54abf703faa3b419d967b";
11
11
  //publish from typus-dov/cover_call
12
- exports.COVERED_CALL_PACKAGE = "0x8cd580538967d5a83a5695f9e2db9f3695e5bdc0";
13
- exports.COVERED_CALL_REGISTRY = "0xff3eae20040a8ec4d45bae3ac85b662cf8adea4f";
14
- exports.COVERED_CALL_MANAGER = "0xb37ffa9b254f94e4c402806bb6011a2a32642ff4";
15
- exports.USER_SHARE_TABLE = "0x27e557f1464297be0fd2b4fefee1e1077b145d08";
16
- exports.MAKER_SHARE_TABLE = "0x8f55dcd94ce055c1b97e906b9642c0ce6392557e";
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";
17
17
  //publish from typus-dov/typus-dov
18
18
  exports.DOV_PACKAGE = "0x1bf2cad8d9d4d11a8e2c981b0f6a9c9744887776";
19
19
  exports.TEST_MINT_TOKEN = "0x672612858fcb5c6abf944638253142820c251753";
@@ -0,0 +1,2 @@
1
+ export declare function getBidEventsCranker(type: string, renewSec: number): Promise<void>;
2
+ export declare function getNewAuctionEventsCranker(type: string, renewSec: number): Promise<void>;
@@ -0,0 +1,110 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.getNewAuctionEventsCranker = exports.getBidEventsCranker = void 0;
43
+ var constants_1 = require("../constants");
44
+ var sui_js_1 = require("@mysten/sui.js");
45
+ var node_cron_1 = __importDefault(require("node-cron"));
46
+ var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
47
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
48
+ var bidType, newAuctionType, renewSec;
49
+ return __generator(this, function (_a) {
50
+ switch (_a.label) {
51
+ case 0:
52
+ bidType = constants_1.DOV_PACKAGE + "::dutch::NewBid<" + constants_1.TOKEN_PACKAGE + "::eth::ETH>";
53
+ newAuctionType = constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewAuction";
54
+ renewSec = 10;
55
+ return [4 /*yield*/, getBidEventsCranker(bidType, renewSec)];
56
+ case 1:
57
+ _a.sent();
58
+ return [4 /*yield*/, getNewAuctionEventsCranker(newAuctionType, renewSec)];
59
+ case 2:
60
+ _a.sent();
61
+ return [2 /*return*/];
62
+ }
63
+ });
64
+ }); })();
65
+ function getBidEventsCranker(type, renewSec) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var res;
68
+ var _this = this;
69
+ return __generator(this, function (_a) {
70
+ res = [];
71
+ node_cron_1.default.schedule('*/' + renewSec.toString() + ' * * * * *', function () { return __awaiter(_this, void 0, void 0, function () {
72
+ var events, newRes, newBid;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ console.log("listening for every " + renewSec.toString() + " s...");
77
+ return [4 /*yield*/, provider.getEvents(
78
+ /// from object id , can only get one event
79
+ // { Object: "0x89bc7299c684413ab81f7536603451277b8ed754" },
80
+ // { Transaction: "4aTaXLyCwT9geQg5PC3UAGGBMbuySFCzeJ6Cf62RrUEg"},
81
+ { MoveEvent: type }, null, null)];
82
+ case 1:
83
+ events = _a.sent();
84
+ newRes = events.data;
85
+ if (newRes.length != res.length) {
86
+ console.log("the total bid event number now:" + events.data.length);
87
+ console.log("there are " + (newRes.length - res.length).toString() + " new bids");
88
+ newBid = newRes.filter(function (e) {
89
+ return res.indexOf(e) === -1;
90
+ });
91
+ newBid.map(function (e) { console.log(e.event.moveEvent.fields); });
92
+ res = newRes;
93
+ }
94
+ return [2 /*return*/];
95
+ }
96
+ });
97
+ }); });
98
+ return [2 /*return*/];
99
+ });
100
+ });
101
+ }
102
+ exports.getBidEventsCranker = getBidEventsCranker;
103
+ function getNewAuctionEventsCranker(type, renewSec) {
104
+ return __awaiter(this, void 0, void 0, function () {
105
+ return __generator(this, function (_a) {
106
+ return [2 /*return*/];
107
+ });
108
+ });
109
+ }
110
+ exports.getNewAuctionEventsCranker = getNewAuctionEventsCranker;
@@ -63,10 +63,10 @@ function getBid(vault) {
63
63
  bids = tmp.map(function (e) {
64
64
  var bidData = e.details.data.fields.value.fields;
65
65
  var res = {
66
- price: Number(bidData.price),
67
- size: Number(bidData.size / (Math.pow(10, constants_1.TOKEN_DECIMAL))),
68
- tsMs: Number(bidData.ts_ms),
69
- tokenBalance: Number(bidData.coin.fields.balance),
66
+ price: (bidData.price),
67
+ size: Number(bidData.size / (Math.pow(10, constants_1.TOKEN_DECIMAL))).toString(),
68
+ tsMs: (bidData.ts_ms),
69
+ tokenBalance: (bidData.coin.fields.balance),
70
70
  ownerAddress: bidData.owner,
71
71
  };
72
72
  return res;
@@ -0,0 +1 @@
1
+ export declare function getauthorizedAddCoveredCallVaultAuthorizedUserTx(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 (_) 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.getauthorizedAddCoveredCallVaultAuthorizedUserTx = void 0;
40
+ function getauthorizedAddCoveredCallVaultAuthorizedUserTx(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_add_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.getauthorizedAddCoveredCallVaultAuthorizedUserTx = getauthorizedAddCoveredCallVaultAuthorizedUserTx;
@@ -0,0 +1 @@
1
+ export declare function getAuthorizedDeliveryTx(packageId: string, registry: string, typeArgument: string, index: string, timeOracle: 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.getAuthorizedDeliveryTx = void 0;
40
+ function getAuthorizedDeliveryTx(packageId, registry, typeArgument, index, 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_delivery',
48
+ typeArguments: [typeArgument],
49
+ arguments: [
50
+ registry,
51
+ index,
52
+ timeOracle,
53
+ ],
54
+ gasBudget: 10000,
55
+ };
56
+ return [2 /*return*/, tx];
57
+ });
58
+ });
59
+ }
60
+ exports.getAuthorizedDeliveryTx = getAuthorizedDeliveryTx;
@@ -0,0 +1 @@
1
+ export declare function getAuthorizedEvolutionTx(packageId: string, registry: string, typeArgument: string, index: string, priceOracle: string, timeOracle: string, activationTsMs: 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.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 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 (_) 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 (_) 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 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 (_) 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 (_) 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 (_) 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;
@@ -4,27 +4,27 @@ export interface SubVaults {
4
4
  regular: string;
5
5
  }
6
6
  export interface VaultConfig {
7
- strikeOtmPct: number;
8
- strikeIncrement: number;
9
- decaySpeed: number;
10
- initialPrice: number;
11
- finalPrice: number;
12
- auctionDurationInMs: number;
7
+ strikeOtmPct: string;
8
+ strikeIncrement: string;
9
+ decaySpeed: string;
10
+ initialPrice: string;
11
+ finalPrice: string;
12
+ auctionDurationInMs: string;
13
13
  }
14
14
  export interface Config {
15
- period: number;
16
- activationTsMs: number;
17
- expirationTsMs: number;
18
- tokenDecimal: number;
19
- shareDecimal: number;
20
- capacity: number;
15
+ period: string;
16
+ activationTsMs: string;
17
+ expirationTsMs: string;
18
+ tokenDecimal: string;
19
+ shareDecimal: string;
20
+ capacity: string;
21
21
  vaultConfig: VaultConfig;
22
22
  nextVaultConfig: VaultConfig;
23
23
  payoffConfig: PayoffConfig;
24
24
  }
25
25
  export interface SubVault {
26
- balance: number;
27
- shareSupply: number;
26
+ balance: string;
27
+ shareSupply: string;
28
28
  }
29
29
  export interface Vault {
30
30
  ableToDeposit: boolean;
@@ -34,42 +34,46 @@ export interface Vault {
34
34
  rollingSubVault: SubVault;
35
35
  }
36
36
  export interface Bid {
37
- price: number;
38
- size: number;
39
- tsMs: number;
40
- tokenBalance: number;
37
+ price: string;
38
+ size: string;
39
+ tsMs: string;
40
+ tokenBalance: string;
41
41
  ownerAddress: string;
42
42
  }
43
43
  export interface PriceConfig {
44
- decaySpeed: number;
45
- initialPrice: number;
46
- finalPrice: number;
44
+ decaySpeed: string;
45
+ initialPrice: string;
46
+ finalPrice: string;
47
47
  }
48
48
  export interface Auction {
49
- startTsMs: number;
50
- endTsMs: number;
49
+ startTsMs: string;
50
+ endTsMs: string;
51
51
  priceConfig: PriceConfig;
52
- index: number;
52
+ index: string;
53
+ }
54
+ export interface DeliveryInfo {
55
+ deliveryPrice: string;
56
+ deliverySize: string;
53
57
  }
54
58
  export interface CoveredCallVault {
55
59
  vaultId: string;
56
- vaultIdx: number;
60
+ vaultIdx: string;
57
61
  asset: string;
58
62
  config: Config;
59
63
  vault: Vault;
60
64
  auction: Auction;
61
- prevBalance: number;
62
- next: number;
63
- deliveryPrice: number;
64
- deliverySize: number;
65
+ prev: string;
66
+ next: string;
67
+ totalBidSize: string;
68
+ deliveryInfo: DeliveryInfo;
65
69
  owner: string;
66
- tvl: number;
67
- vaultBidPrice: number;
70
+ tvl: string;
71
+ vaultBidPrice: string;
68
72
  }
69
73
  export interface PayoffConfig {
70
- exposureRatio: number;
71
- premiumRoi: number;
72
- strike: number;
74
+ exposureRatio: string;
75
+ premiumRoi: string;
76
+ strike: string;
73
77
  }
74
78
  export declare function getCoveredCallVaultsFromRegistry(registry: string): Promise<any>;
75
79
  export declare function getTableFromCoveredCallVault(coveredCallVault: string): Promise<any>;
@@ -88,7 +88,7 @@ function getVaultDataFromRegistry(registry) {
88
88
  case 3:
89
89
  _a = __read.apply(void 0, [_c.sent(), 2]), timeOracle = _a[0], _ = _a[1];
90
90
  _loop_1 = function (objInfo) {
91
- var vaultId, vaultIdx, type, asset, config, vault, prevBalance, vaultConfig, vaultConfigRes, nextVaultConfig, nextVaultConfigRes, payoffConfig, payoffConfigRes, configRes, maker, regular, rolling, vaultRes, auctionRes, vaultBidPrice, auction, priceConfig, priceConfigRes, next, deliveryPrice, deliverySize, owner, tvl, res;
91
+ 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
92
  return __generator(this, function (_d) {
93
93
  switch (_d.label) {
94
94
  case 0:
@@ -106,7 +106,8 @@ function getVaultDataFromRegistry(registry) {
106
106
  }
107
107
  config = objInfo.details.data.fields.value.fields.config.fields;
108
108
  vault = objInfo.details.data.fields.value.fields.vault.fields;
109
- prevBalance = objInfo.details.data.fields.value.fields.prev_balance;
109
+ prev = objInfo.details.data.fields.value.fields.prev;
110
+ prev = (prev != null) ? prev : 0;
110
111
  vaultConfig = config.vault_config.fields;
111
112
  vaultConfigRes = {
112
113
  strikeOtmPct: vaultConfig.strike_otm_pct,
@@ -127,9 +128,9 @@ function getVaultDataFromRegistry(registry) {
127
128
  };
128
129
  payoffConfig = config.payoff_config.fields;
129
130
  payoffConfigRes = {
130
- exposureRatio: Number(payoffConfig.exposure_ratio),
131
- premiumRoi: Number(payoffConfig.premium_roi),
132
- strike: Number(payoffConfig.strike) / (Math.pow(10, constants_1.PRICE_DECIMAL)),
131
+ exposureRatio: (payoffConfig.exposure_ratio),
132
+ premiumRoi: (payoffConfig.premium_roi),
133
+ strike: ((payoffConfig.strike) / (Math.pow(10, constants_1.PRICE_DECIMAL))).toString(),
133
134
  };
134
135
  configRes = {
135
136
  period: config.period,
@@ -137,22 +138,22 @@ function getVaultDataFromRegistry(registry) {
137
138
  expirationTsMs: config.expiration_ts_ms,
138
139
  tokenDecimal: config.token_decimal,
139
140
  shareDecimal: config.share_decimal,
140
- capacity: Number(config.capacity) / (Math.pow(10, constants_1.TOKEN_DECIMAL)),
141
+ capacity: (Number(config.capacity) / (Math.pow(10, constants_1.TOKEN_DECIMAL))).toString(),
141
142
  vaultConfig: vaultConfigRes,
142
143
  nextVaultConfig: nextVaultConfigRes,
143
144
  payoffConfig: payoffConfigRes,
144
145
  };
145
146
  maker = {
146
- balance: Number(vault.maker_sub_vault.fields.balance),
147
- shareSupply: Number(vault.maker_sub_vault.fields.share_supply),
147
+ balance: (vault.maker_sub_vault.fields.balance),
148
+ shareSupply: (vault.maker_sub_vault.fields.share_supply),
148
149
  };
149
150
  regular = {
150
- balance: Number(vault.regular_sub_vault.fields.balance),
151
- shareSupply: Number(vault.regular_sub_vault.fields.share_supply),
151
+ balance: (vault.regular_sub_vault.fields.balance),
152
+ shareSupply: (vault.regular_sub_vault.fields.share_supply),
152
153
  };
153
154
  rolling = {
154
- balance: Number(vault.rolling_sub_vault.fields.balance),
155
- shareSupply: Number(vault.rolling_sub_vault.fields.share_supply),
155
+ balance: (vault.rolling_sub_vault.fields.balance),
156
+ shareSupply: (vault.rolling_sub_vault.fields.share_supply),
156
157
  };
157
158
  vaultRes = {
158
159
  ableToDeposit: vault.able_to_deposit,
@@ -167,45 +168,46 @@ function getVaultDataFromRegistry(registry) {
167
168
  auction = objInfo.details.data.fields.value.fields.auction.fields;
168
169
  priceConfig = auction.price_config.fields;
169
170
  priceConfigRes = {
170
- decaySpeed: Number(priceConfig.decay_speed),
171
- initialPrice: Number(priceConfig.initial_price),
172
- finalPrice: Number(priceConfig.final_price),
171
+ decaySpeed: (priceConfig.decay_speed),
172
+ initialPrice: (priceConfig.initial_price),
173
+ finalPrice: (priceConfig.final_price),
173
174
  };
174
175
  auctionRes = {
175
- startTsMs: Number(auction.start_ts_ms),
176
- endTsMs: Number(auction.end_ts_ms),
176
+ startTsMs: (auction.start_ts_ms),
177
+ endTsMs: (auction.end_ts_ms),
177
178
  priceConfig: priceConfigRes,
178
- index: Number(auction.index),
179
+ index: (auction.index),
179
180
  };
180
181
  return [4 /*yield*/, getVaultBidPrice(auctionRes, timeOracle)];
181
182
  case 1:
182
183
  vaultBidPrice = _d.sent();
184
+ console.log("get auction in " + vaultId);
183
185
  return [3 /*break*/, 3];
184
186
  case 2:
185
- console.log("No auction");
187
+ console.log("No auction " + vaultId);
186
188
  auctionRes = {};
187
189
  vaultBidPrice = 0;
188
190
  _d.label = 3;
189
191
  case 3:
190
192
  next = objInfo.details.data.fields.value.fields.next;
191
- deliveryPrice = objInfo.details.data.fields.value.fields.delivery_price;
192
- deliverySize = objInfo.details.data.fields.value.fields.delivery_size;
193
+ totalBidSize = objInfo.details.data.fields.value.fields.total_bid_size;
194
+ deliveryInfo = objInfo.details.data.fields.value.fields.delivery_info;
193
195
  owner = objInfo.details.data.fields.value.fields.owner;
194
196
  tvl = Number(vault.regular_sub_vault.fields.balance) + Number(vault.rolling_sub_vault.fields.balance);
195
197
  res = {
196
198
  vaultId: vaultId,
197
- vaultIdx: vaultIdx,
199
+ vaultIdx: vaultIdx.toString(),
198
200
  asset: asset,
199
201
  config: configRes,
200
202
  vault: vaultRes,
201
203
  auction: auctionRes,
202
- prevBalance: prevBalance,
204
+ prev: prev.toString(),
203
205
  next: next,
204
- deliveryPrice: deliveryPrice,
205
- deliverySize: deliverySize,
206
+ totalBidSize: totalBidSize,
207
+ deliveryInfo: deliveryInfo,
206
208
  owner: owner,
207
- tvl: tvl,
208
- vaultBidPrice: vaultBidPrice,
209
+ tvl: tvl.toString(),
210
+ vaultBidPrice: vaultBidPrice.toString(),
209
211
  };
210
212
  vaults.push(res);
211
213
  return [2 /*return*/];
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.5",
5
+ "version": "0.3.7",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.5.0",
8
8
  "@mysten/sui.js": "^0.20.0",
@@ -34,6 +34,7 @@
34
34
  "mkdirp": "^0.5.5",
35
35
  "mocha": "^10.1.0",
36
36
  "moment": "^2.29.4",
37
+ "node-cron": "^3.0.2",
37
38
  "once": "^1.4.0",
38
39
  "path-is-absolute": "^1.0.1",
39
40
  "path-parse": "^1.0.7",
@@ -78,4 +79,4 @@
78
79
  "url": "https://github.com/Typus-Lab/typus-sdk/issues"
79
80
  },
80
81
  "homepage": "https://github.com/Typus-Lab/typus-sdk#readme"
81
- }
82
+ }