@typus/typus-sdk 0.3.5 → 0.3.6
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.
- package/lib/test/eventListener.d.ts +1 -0
- package/lib/test/eventListener.js +72 -0
- package/lib/utils/auction/getBid.js +4 -4
- package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.js +60 -0
- package/lib/utils/authorized/getAuthorizedDeliveryTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedDeliveryTx.js +60 -0
- package/lib/utils/authorized/getAuthorizedEvolutionTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedEvolutionTx.js +63 -0
- package/lib/utils/authorized/getAuthorizedNewAuctionTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedNewAuctionTx.js +61 -0
- package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.js +77 -0
- package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.js +60 -0
- package/lib/utils/authorized/getAuthorizedSettleTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedSettleTx.js +61 -0
- package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.js +65 -0
- package/lib/utils/fetchData.d.ts +34 -34
- package/lib/utils/getVaultData.js +22 -21
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
var constants_1 = require("../constants");
|
|
43
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
44
|
+
var node_cron_1 = __importDefault(require("node-cron"));
|
|
45
|
+
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
46
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
47
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
node_cron_1.default.schedule('*/5 * * * * *', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var events;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, provider.getEvents(
|
|
54
|
+
// { MoveEvent: `${PACKAGE_ID}::amm::PoolCreationEvent` },
|
|
55
|
+
{ Object: "0x89bc7299c684413ab81f7536603451277b8ed754" }, null, null, 'descending')];
|
|
56
|
+
case 1:
|
|
57
|
+
events = _a.sent();
|
|
58
|
+
console.log(events.data.length);
|
|
59
|
+
events.data.forEach(function (envelope) {
|
|
60
|
+
var event = envelope.event;
|
|
61
|
+
// if (!('moveEvent' in event)) {
|
|
62
|
+
// throw new Error('Not a MoveEvent')
|
|
63
|
+
// }
|
|
64
|
+
console.log(event);
|
|
65
|
+
});
|
|
66
|
+
return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); });
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
});
|
|
72
|
+
}); })();
|
|
@@ -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:
|
|
67
|
-
size: Number(bidData.size / (Math.pow(10, constants_1.TOKEN_DECIMAL))),
|
|
68
|
-
tsMs:
|
|
69
|
-
tokenBalance:
|
|
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;
|
package/lib/utils/fetchData.d.ts
CHANGED
|
@@ -4,27 +4,27 @@ export interface SubVaults {
|
|
|
4
4
|
regular: string;
|
|
5
5
|
}
|
|
6
6
|
export interface VaultConfig {
|
|
7
|
-
strikeOtmPct:
|
|
8
|
-
strikeIncrement:
|
|
9
|
-
decaySpeed:
|
|
10
|
-
initialPrice:
|
|
11
|
-
finalPrice:
|
|
12
|
-
auctionDurationInMs:
|
|
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:
|
|
16
|
-
activationTsMs:
|
|
17
|
-
expirationTsMs:
|
|
18
|
-
tokenDecimal:
|
|
19
|
-
shareDecimal:
|
|
20
|
-
capacity:
|
|
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:
|
|
27
|
-
shareSupply:
|
|
26
|
+
balance: string;
|
|
27
|
+
shareSupply: string;
|
|
28
28
|
}
|
|
29
29
|
export interface Vault {
|
|
30
30
|
ableToDeposit: boolean;
|
|
@@ -34,42 +34,42 @@ export interface Vault {
|
|
|
34
34
|
rollingSubVault: SubVault;
|
|
35
35
|
}
|
|
36
36
|
export interface Bid {
|
|
37
|
-
price:
|
|
38
|
-
size:
|
|
39
|
-
tsMs:
|
|
40
|
-
tokenBalance:
|
|
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:
|
|
45
|
-
initialPrice:
|
|
46
|
-
finalPrice:
|
|
44
|
+
decaySpeed: string;
|
|
45
|
+
initialPrice: string;
|
|
46
|
+
finalPrice: string;
|
|
47
47
|
}
|
|
48
48
|
export interface Auction {
|
|
49
|
-
startTsMs:
|
|
50
|
-
endTsMs:
|
|
49
|
+
startTsMs: string;
|
|
50
|
+
endTsMs: string;
|
|
51
51
|
priceConfig: PriceConfig;
|
|
52
|
-
index:
|
|
52
|
+
index: string;
|
|
53
53
|
}
|
|
54
54
|
export interface CoveredCallVault {
|
|
55
55
|
vaultId: string;
|
|
56
|
-
vaultIdx:
|
|
56
|
+
vaultIdx: string;
|
|
57
57
|
asset: string;
|
|
58
58
|
config: Config;
|
|
59
59
|
vault: Vault;
|
|
60
60
|
auction: Auction;
|
|
61
|
-
prevBalance:
|
|
62
|
-
next:
|
|
63
|
-
deliveryPrice:
|
|
64
|
-
deliverySize:
|
|
61
|
+
prevBalance: string;
|
|
62
|
+
next: string;
|
|
63
|
+
deliveryPrice: string;
|
|
64
|
+
deliverySize: string;
|
|
65
65
|
owner: string;
|
|
66
|
-
tvl:
|
|
67
|
-
vaultBidPrice:
|
|
66
|
+
tvl: string;
|
|
67
|
+
vaultBidPrice: string;
|
|
68
68
|
}
|
|
69
69
|
export interface PayoffConfig {
|
|
70
|
-
exposureRatio:
|
|
71
|
-
premiumRoi:
|
|
72
|
-
strike:
|
|
70
|
+
exposureRatio: string;
|
|
71
|
+
premiumRoi: string;
|
|
72
|
+
strike: string;
|
|
73
73
|
}
|
|
74
74
|
export declare function getCoveredCallVaultsFromRegistry(registry: string): Promise<any>;
|
|
75
75
|
export declare function getTableFromCoveredCallVault(coveredCallVault: string): Promise<any>;
|
|
@@ -127,9 +127,9 @@ function getVaultDataFromRegistry(registry) {
|
|
|
127
127
|
};
|
|
128
128
|
payoffConfig = config.payoff_config.fields;
|
|
129
129
|
payoffConfigRes = {
|
|
130
|
-
exposureRatio:
|
|
131
|
-
premiumRoi:
|
|
132
|
-
strike:
|
|
130
|
+
exposureRatio: (payoffConfig.exposure_ratio),
|
|
131
|
+
premiumRoi: (payoffConfig.premium_roi),
|
|
132
|
+
strike: ((payoffConfig.strike) / (Math.pow(10, constants_1.PRICE_DECIMAL))).toString(),
|
|
133
133
|
};
|
|
134
134
|
configRes = {
|
|
135
135
|
period: config.period,
|
|
@@ -137,22 +137,22 @@ function getVaultDataFromRegistry(registry) {
|
|
|
137
137
|
expirationTsMs: config.expiration_ts_ms,
|
|
138
138
|
tokenDecimal: config.token_decimal,
|
|
139
139
|
shareDecimal: config.share_decimal,
|
|
140
|
-
capacity: Number(config.capacity) / (Math.pow(10, constants_1.TOKEN_DECIMAL)),
|
|
140
|
+
capacity: (Number(config.capacity) / (Math.pow(10, constants_1.TOKEN_DECIMAL))).toString(),
|
|
141
141
|
vaultConfig: vaultConfigRes,
|
|
142
142
|
nextVaultConfig: nextVaultConfigRes,
|
|
143
143
|
payoffConfig: payoffConfigRes,
|
|
144
144
|
};
|
|
145
145
|
maker = {
|
|
146
|
-
balance:
|
|
147
|
-
shareSupply:
|
|
146
|
+
balance: (vault.maker_sub_vault.fields.balance),
|
|
147
|
+
shareSupply: (vault.maker_sub_vault.fields.share_supply),
|
|
148
148
|
};
|
|
149
149
|
regular = {
|
|
150
|
-
balance:
|
|
151
|
-
shareSupply:
|
|
150
|
+
balance: (vault.regular_sub_vault.fields.balance),
|
|
151
|
+
shareSupply: (vault.regular_sub_vault.fields.share_supply),
|
|
152
152
|
};
|
|
153
153
|
rolling = {
|
|
154
|
-
balance:
|
|
155
|
-
shareSupply:
|
|
154
|
+
balance: (vault.rolling_sub_vault.fields.balance),
|
|
155
|
+
shareSupply: (vault.rolling_sub_vault.fields.share_supply),
|
|
156
156
|
};
|
|
157
157
|
vaultRes = {
|
|
158
158
|
ableToDeposit: vault.able_to_deposit,
|
|
@@ -167,22 +167,23 @@ function getVaultDataFromRegistry(registry) {
|
|
|
167
167
|
auction = objInfo.details.data.fields.value.fields.auction.fields;
|
|
168
168
|
priceConfig = auction.price_config.fields;
|
|
169
169
|
priceConfigRes = {
|
|
170
|
-
decaySpeed:
|
|
171
|
-
initialPrice:
|
|
172
|
-
finalPrice:
|
|
170
|
+
decaySpeed: (priceConfig.decay_speed),
|
|
171
|
+
initialPrice: (priceConfig.initial_price),
|
|
172
|
+
finalPrice: (priceConfig.final_price),
|
|
173
173
|
};
|
|
174
174
|
auctionRes = {
|
|
175
|
-
startTsMs:
|
|
176
|
-
endTsMs:
|
|
175
|
+
startTsMs: (auction.start_ts_ms),
|
|
176
|
+
endTsMs: (auction.end_ts_ms),
|
|
177
177
|
priceConfig: priceConfigRes,
|
|
178
|
-
index:
|
|
178
|
+
index: (auction.index),
|
|
179
179
|
};
|
|
180
180
|
return [4 /*yield*/, getVaultBidPrice(auctionRes, timeOracle)];
|
|
181
181
|
case 1:
|
|
182
182
|
vaultBidPrice = _d.sent();
|
|
183
|
+
console.log("get auction in " + vaultId);
|
|
183
184
|
return [3 /*break*/, 3];
|
|
184
185
|
case 2:
|
|
185
|
-
console.log("No auction");
|
|
186
|
+
console.log("No auction " + vaultId);
|
|
186
187
|
auctionRes = {};
|
|
187
188
|
vaultBidPrice = 0;
|
|
188
189
|
_d.label = 3;
|
|
@@ -194,18 +195,18 @@ function getVaultDataFromRegistry(registry) {
|
|
|
194
195
|
tvl = Number(vault.regular_sub_vault.fields.balance) + Number(vault.rolling_sub_vault.fields.balance);
|
|
195
196
|
res = {
|
|
196
197
|
vaultId: vaultId,
|
|
197
|
-
vaultIdx: vaultIdx,
|
|
198
|
+
vaultIdx: vaultIdx.toString(),
|
|
198
199
|
asset: asset,
|
|
199
200
|
config: configRes,
|
|
200
201
|
vault: vaultRes,
|
|
201
202
|
auction: auctionRes,
|
|
202
|
-
prevBalance: prevBalance,
|
|
203
|
+
prevBalance: prevBalance.toString(),
|
|
203
204
|
next: next,
|
|
204
205
|
deliveryPrice: deliveryPrice,
|
|
205
206
|
deliverySize: deliverySize,
|
|
206
207
|
owner: owner,
|
|
207
|
-
tvl: tvl,
|
|
208
|
-
vaultBidPrice: vaultBidPrice,
|
|
208
|
+
tvl: tvl.toString(),
|
|
209
|
+
vaultBidPrice: vaultBidPrice.toString(),
|
|
209
210
|
};
|
|
210
211
|
vaults.push(res);
|
|
211
212
|
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
|
+
"version": "0.3.6",
|
|
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
|
+
}
|