@typus/typus-sdk 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/lib/constants.d.ts +5 -2
  2. package/lib/constants.js +7 -5
  3. package/lib/scripts/coveredCall/getClaimAllTx.d.ts +1 -0
  4. package/lib/scripts/coveredCall/getClaimAllTx.js +56 -0
  5. package/lib/scripts/coveredCall/getClaimTx.d.ts +1 -0
  6. package/lib/scripts/coveredCall/getClaimTx.js +57 -0
  7. package/lib/scripts/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +2 -4
  8. package/lib/scripts/coveredCall/getNewCoveredCallVaultTx.js +2 -5
  9. package/lib/scripts/coveredCall/getNewManagerTx.d.ts +1 -0
  10. package/lib/scripts/coveredCall/getNewManagerTx.js +55 -0
  11. package/lib/scripts/coveredCall/getRemoveManagerTx.d.ts +1 -0
  12. package/lib/scripts/coveredCall/getRemoveManagerTx.js +54 -0
  13. package/lib/scripts/coveredCall/getRollOverTx.d.ts +1 -0
  14. package/lib/scripts/coveredCall/getRollOverTx.js +55 -0
  15. package/lib/scripts/coveredCall/getSettleTx.d.ts +1 -0
  16. package/lib/scripts/coveredCall/getSettleTx.js +57 -0
  17. package/lib/scripts/coveredCall/getSettleWithRollOverTx.d.ts +1 -0
  18. package/lib/scripts/coveredCall/getSettleWithRollOverTx.js +57 -0
  19. package/lib/scripts/coveredCall/getUpdatePayoffConfigTx.d.ts +1 -0
  20. package/lib/scripts/coveredCall/getUpdatePayoffConfigTx.js +57 -0
  21. package/lib/scripts/getMintTx.js +1 -1
  22. package/lib/scripts/getNewOracleTx.js +1 -1
  23. package/lib/scripts/getNewTimeOracleTx.d.ts +1 -0
  24. package/lib/scripts/getNewTimeOracleTx.js +54 -0
  25. package/lib/scripts/getSubVault.d.ts +0 -1
  26. package/lib/scripts/getSubVault.js +5 -51
  27. package/lib/scripts/getUpdateTimeOracleTx.d.ts +1 -0
  28. package/lib/scripts/getUpdateTimeOracleTx.js +59 -0
  29. package/lib/test/testMint.js +11 -9
  30. package/lib/test/testNewVault.js +7 -9
  31. package/lib/test/testSettle.d.ts +1 -0
  32. package/lib/test/testSettle.js +437 -0
  33. package/lib/utils/coveredCall/getClaimAllTx.d.ts +1 -0
  34. package/lib/utils/coveredCall/getClaimAllTx.js +60 -0
  35. package/lib/utils/coveredCall/getClaimTx.d.ts +1 -0
  36. package/lib/utils/coveredCall/getClaimTx.js +61 -0
  37. package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +1 -1
  38. package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +1 -2
  39. package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +1 -1
  40. package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +1 -3
  41. package/lib/utils/coveredCall/getNewManagerTx.d.ts +1 -0
  42. package/lib/utils/coveredCall/getNewManagerTx.js +59 -0
  43. package/lib/utils/coveredCall/getRemoveManagerTx.d.ts +1 -0
  44. package/lib/utils/coveredCall/getRemoveManagerTx.js +58 -0
  45. package/lib/utils/coveredCall/getRollOverTx.d.ts +1 -0
  46. package/lib/utils/coveredCall/getRollOverTx.js +60 -0
  47. package/lib/utils/coveredCall/getSettleTx.d.ts +1 -0
  48. package/lib/utils/coveredCall/getSettleTx.js +62 -0
  49. package/lib/utils/coveredCall/getSettleWithRollOverTx.d.ts +1 -0
  50. package/lib/utils/coveredCall/getSettleWithRollOverTx.js +62 -0
  51. package/lib/utils/coveredCall/getUpdatePayoffConfigTx.d.ts +1 -0
  52. package/lib/utils/coveredCall/getUpdatePayoffConfigTx.js +62 -0
  53. package/lib/utils/getNewTimeOracleTx.d.ts +1 -0
  54. package/lib/utils/getNewTimeOracleTx.js +56 -0
  55. package/lib/utils/getSubVault.d.ts +0 -3
  56. package/lib/utils/getSubVault.js +51 -137
  57. package/lib/utils/getUpdateTimeOracleTx.d.ts +1 -0
  58. package/lib/utils/getUpdateTimeOracleTx.js +60 -0
  59. package/lib/utils/getVaultIndexInRegistry.d.ts +1 -0
  60. package/lib/utils/getVaultIndexInRegistry.js +56 -0
  61. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export declare function getUpdateTimeOracleTx(packageId: string, oracle: string, managerCap: string, ts: number): 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.getUpdateTimeOracleTx = void 0;
40
+ function getUpdateTimeOracleTx(packageId, oracle, managerCap, ts) {
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: 'unix_time',
47
+ function: 'update',
48
+ typeArguments: [],
49
+ arguments: [
50
+ oracle,
51
+ managerCap,
52
+ ts
53
+ ],
54
+ gasBudget: 1000,
55
+ };
56
+ return [2 /*return*/, tx];
57
+ });
58
+ });
59
+ }
60
+ exports.getUpdateTimeOracleTx = getUpdateTimeOracleTx;
@@ -0,0 +1 @@
1
+ export declare function getVaultIndexInregistry(registry: string): Promise<number>;
@@ -0,0 +1,56 @@
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.getVaultIndexInregistry = void 0;
40
+ var sui_js_1 = require("@mysten/sui.js");
41
+ var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
42
+ function getVaultIndexInregistry(registry) {
43
+ return __awaiter(this, void 0, void 0, function () {
44
+ var txn, index;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0: return [4 /*yield*/, provider.getObject(registry)];
48
+ case 1:
49
+ txn = _a.sent();
50
+ index = txn.details.data.fields.name;
51
+ return [2 /*return*/, index];
52
+ }
53
+ });
54
+ });
55
+ }
56
+ exports.getVaultIndexInregistry = getVaultIndexInregistry;
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.1.8",
5
+ "version": "0.1.9",
6
6
  "dependencies": {
7
7
  "@mysten/sui.js": "^0.17.1",
8
8
  "@types/node": "^17.0.0",