@typus/typus-sdk 0.4.7 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants.d.ts +30 -0
- package/lib/constants.js +38 -0
- package/lib/scripts/getSubVault.d.ts +0 -0
- package/lib/scripts/getSubVault.js +6 -0
- package/lib/scripts/sui.d.ts +1 -0
- package/lib/scripts/sui.js +187 -0
- package/lib/test/eventListener.d.ts +5 -0
- package/lib/test/eventListener.js +294 -0
- package/lib/test/getBidData.d.ts +1 -0
- package/lib/test/getBidData.js +53 -0
- package/lib/test/getMakersShares.d.ts +1 -0
- package/lib/test/getMakersShares.js +52 -0
- package/lib/test/getUsersShares.d.ts +1 -0
- package/lib/test/getUsersShares.js +52 -0
- package/lib/test/getVaultData.d.ts +1 -0
- package/lib/test/getVaultData.js +53 -0
- package/lib/test/testClaim.d.ts +1 -0
- package/lib/test/testClaim.js +81 -0
- package/lib/test/testCrypto.d.ts +1 -0
- package/lib/test/testCrypto.js +54 -0
- package/lib/test/testDeposit.d.ts +1 -0
- package/lib/test/testDeposit.js +73 -0
- package/lib/test/testDepositV2.d.ts +0 -0
- package/lib/test/testDepositV2.js +62 -0
- package/lib/test/testMint.d.ts +1 -0
- package/lib/test/testMint.js +136 -0
- package/lib/test/testNewAuction.d.ts +1 -0
- package/lib/test/testNewAuction.js +93 -0
- package/lib/test/testNewVault.d.ts +1 -0
- package/lib/test/testNewVault.js +152 -0
- package/lib/test/testOracle.d.ts +1 -0
- package/lib/test/testOracle.js +93 -0
- package/lib/test/testSettle.d.ts +1 -0
- package/lib/test/testSettle.js +589 -0
- package/lib/test/testSubscribeEvent.d.ts +1 -0
- package/lib/test/testSubscribeEvent.js +97 -0
- package/lib/test/testUnsubscribe.d.ts +1 -0
- package/lib/test/testUnsubscribe.js +87 -0
- package/lib/test/testWithdraw.d.ts +1 -0
- package/lib/test/testWithdraw.js +70 -0
- package/lib/utils/auction/getBid.d.ts +2 -0
- package/lib/utils/auction/getBid.js +79 -0
- package/lib/utils/auction/sealedAuction.d.ts +33 -0
- package/lib/utils/auction/sealedAuction.js +64 -0
- package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.js +60 -0
- 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/getAuthorizedLastEvolutionTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedLastEvolutionTx.js +62 -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/getAuthorizedRemoveAuthorizedUserTx.d.ts +1 -0
- package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.js +60 -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/coveredCall/createPriceOracle.d.ts +1 -0
- package/lib/utils/coveredCall/createPriceOracle.js +92 -0
- package/lib/utils/coveredCall/createTimeOracle.d.ts +1 -0
- package/lib/utils/coveredCall/createTimeOracle.js +91 -0
- package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
- package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.js +61 -0
- package/lib/utils/coveredCall/getClaimAllTx.d.ts +1 -0
- package/lib/utils/coveredCall/getClaimAllTx.js +59 -0
- package/lib/utils/coveredCall/getClaimTx.d.ts +1 -0
- package/lib/utils/coveredCall/getClaimTx.js +59 -0
- package/lib/utils/coveredCall/getDeliveryTx.d.ts +1 -0
- package/lib/utils/coveredCall/getDeliveryTx.js +61 -0
- package/lib/utils/coveredCall/getDepositTx.d.ts +1 -0
- package/lib/utils/coveredCall/getDepositTx.js +65 -0
- package/lib/utils/coveredCall/getEvolutionTx.d.ts +1 -0
- package/lib/utils/coveredCall/getEvolutionTx.js +64 -0
- package/lib/utils/coveredCall/getLastEvolutionTx.d.ts +1 -0
- package/lib/utils/coveredCall/getLastEvolutionTx.js +63 -0
- package/lib/utils/coveredCall/getMakerClaimAllTx.d.ts +1 -0
- package/lib/utils/coveredCall/getMakerClaimAllTx.js +59 -0
- package/lib/utils/coveredCall/getMakerClaimTx.d.ts +1 -0
- package/lib/utils/coveredCall/getMakerClaimTx.js +59 -0
- package/lib/utils/coveredCall/getNewAuctionTx.d.ts +1 -0
- package/lib/utils/coveredCall/getNewAuctionTx.js +66 -0
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +1 -0
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +64 -0
- package/lib/utils/coveredCall/getNewBidTx.d.ts +1 -0
- package/lib/utils/coveredCall/getNewBidTx.js +62 -0
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +1 -0
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +77 -0
- package/lib/utils/coveredCall/getNewManagerTx.d.ts +1 -0
- package/lib/utils/coveredCall/getNewManagerTx.js +59 -0
- package/lib/utils/coveredCall/getRefundTx.d.ts +1 -0
- package/lib/utils/coveredCall/getRefundTx.js +59 -0
- package/lib/utils/coveredCall/getRemoveBidTx.d.ts +1 -0
- package/lib/utils/coveredCall/getRemoveBidTx.js +60 -0
- package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.d.ts +1 -0
- package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.js +61 -0
- package/lib/utils/coveredCall/getRemoveManagerTx.d.ts +1 -0
- package/lib/utils/coveredCall/getRemoveManagerTx.js +58 -0
- package/lib/utils/coveredCall/getRollOverTx.d.ts +1 -0
- package/lib/utils/coveredCall/getRollOverTx.js +60 -0
- package/lib/utils/coveredCall/getSettleTx.d.ts +1 -0
- package/lib/utils/coveredCall/getSettleTx.js +62 -0
- package/lib/utils/coveredCall/getSettleWithRollOverTx.d.ts +1 -0
- package/lib/utils/coveredCall/getSettleWithRollOverTx.js +62 -0
- package/lib/utils/coveredCall/getSubscribeTx.d.ts +1 -0
- package/lib/utils/coveredCall/getSubscribeTx.js +60 -0
- package/lib/utils/coveredCall/getUnsubscribeTx.d.ts +1 -0
- package/lib/utils/coveredCall/getUnsubscribeTx.js +63 -0
- package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.d.ts +1 -0
- package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.js +66 -0
- package/lib/utils/coveredCall/getUpdatePayoffConfigTx.d.ts +1 -0
- package/lib/utils/coveredCall/getUpdatePayoffConfigTx.js +62 -0
- package/lib/utils/coveredCall/getWithdrawTx.d.ts +1 -0
- package/lib/utils/coveredCall/getWithdrawTx.js +60 -0
- package/lib/utils/fetchData.d.ts +83 -0
- package/lib/utils/fetchData.js +206 -0
- package/lib/utils/getCreateTokenRegistryTx.d.ts +1 -0
- package/lib/utils/getCreateTokenRegistryTx.js +59 -0
- package/lib/utils/getMakersShares.d.ts +7 -0
- package/lib/utils/getMakersShares.js +148 -0
- package/lib/utils/getMintTx.d.ts +1 -0
- package/lib/utils/getMintTx.js +62 -0
- package/lib/utils/getNewOracleTx.d.ts +1 -0
- package/lib/utils/getNewOracleTx.js +59 -0
- package/lib/utils/getNewTimeOracleTx.d.ts +1 -0
- package/lib/utils/getNewTimeOracleTx.js +56 -0
- package/lib/utils/getTypeArgumentFromToken.d.ts +1 -0
- package/lib/utils/getTypeArgumentFromToken.js +71 -0
- package/lib/utils/getUpdateOracleTx.d.ts +1 -0
- package/lib/utils/getUpdateOracleTx.js +64 -0
- package/lib/utils/getUpdateTimeOracleTx.d.ts +1 -0
- package/lib/utils/getUpdateTimeOracleTx.js +60 -0
- package/lib/utils/getUsersShares.d.ts +8 -0
- package/lib/utils/getUsersShares.js +147 -0
- package/lib/utils/getVaultData.d.ts +3 -0
- package/lib/utils/getVaultData.js +262 -0
- package/lib/utils/getVaultIndexInRegistry.d.ts +1 -0
- package/lib/utils/getVaultIndexInRegistry.js +61 -0
- package/lib/utils/isObjAvailable.d.ts +0 -0
- package/lib/utils/isObjAvailable.js +14 -0
- package/lib/utils/loadUsersDepositData.d.ts +8 -0
- package/lib/utils/loadUsersDepositData.js +160 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var constants_1 = require("../constants");
|
|
40
|
+
var getMakersShares_1 = require("../utils/getMakersShares");
|
|
41
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var makersShares;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0: return [4 /*yield*/, (0, getMakersShares_1.getMakersShares)(constants_1.MAKER_SHARE_TABLE, constants_1.COVERED_CALL_REGISTRY)];
|
|
46
|
+
case 1:
|
|
47
|
+
makersShares = _a.sent();
|
|
48
|
+
console.log(makersShares);
|
|
49
|
+
return [2 /*return*/];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}); })();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var constants_1 = require("../constants");
|
|
40
|
+
var getUsersShares_1 = require("../utils/getUsersShares");
|
|
41
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var usersShares;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0: return [4 /*yield*/, (0, getUsersShares_1.getUsersShares)(constants_1.USER_SHARE_TABLE, constants_1.COVERED_CALL_REGISTRY)];
|
|
46
|
+
case 1:
|
|
47
|
+
usersShares = _a.sent();
|
|
48
|
+
console.log(usersShares);
|
|
49
|
+
return [2 /*return*/];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}); })();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var constants_1 = require("../constants");
|
|
40
|
+
var getVaultData_1 = require("../utils/getVaultData");
|
|
41
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var res;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0: return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.COVERED_CALL_REGISTRY)];
|
|
46
|
+
case 1:
|
|
47
|
+
res = _a.sent();
|
|
48
|
+
console.log("vault: ");
|
|
49
|
+
console.log(res);
|
|
50
|
+
return [2 /*return*/];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}); })();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var getClaimTx_1 = require("../utils/coveredCall/getClaimTx");
|
|
40
|
+
var getClaimAllTx_1 = require("../utils/coveredCall/getClaimAllTx");
|
|
41
|
+
var constants_1 = require("../constants");
|
|
42
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
43
|
+
var getTypeArgumentFromToken_1 = require("../utils/getTypeArgumentFromToken");
|
|
44
|
+
var provider = new sui_js_1.JsonRpcProvider(constants_1.TESTNET_RPC_ENDPOINT); //for read only operations
|
|
45
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
46
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
47
|
+
/*
|
|
48
|
+
after claim,
|
|
49
|
+
*/
|
|
50
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
+
var claimAmount, isRolling, token, vaultIndex, typeArgument, claimTx, claimAllTx;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
claimAmount = 13;
|
|
56
|
+
isRolling = true;
|
|
57
|
+
token = "0x8f306b0fcbcbdee0b3a5e694c06039dfe8ca7f14" // minted token
|
|
58
|
+
;
|
|
59
|
+
vaultIndex = ["59"];
|
|
60
|
+
return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
|
|
61
|
+
case 1:
|
|
62
|
+
typeArgument = _a.sent();
|
|
63
|
+
console.log("test for claim, try to claim " + token + " for " + claimAmount + " ...");
|
|
64
|
+
return [4 /*yield*/, (0, getClaimTx_1.getClaimTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex[0])];
|
|
65
|
+
case 2:
|
|
66
|
+
claimTx = _a.sent();
|
|
67
|
+
return [4 /*yield*/, signer.executeMoveCall(claimTx)];
|
|
68
|
+
case 3:
|
|
69
|
+
_a.sent();
|
|
70
|
+
console.log("claim successfully");
|
|
71
|
+
return [4 /*yield*/, (0, getClaimAllTx_1.getClaimAllTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex)];
|
|
72
|
+
case 4:
|
|
73
|
+
claimAllTx = _a.sent();
|
|
74
|
+
return [4 /*yield*/, signer.executeMoveCall(claimAllTx)];
|
|
75
|
+
case 5:
|
|
76
|
+
_a.sent();
|
|
77
|
+
console.log("claim all successfully");
|
|
78
|
+
return [2 /*return*/];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}); })();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var sealedAuction_1 = require("../utils/auction/sealedAuction");
|
|
40
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
+
var price, size, secret, encryptedBid, hash, bid;
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
price = BigInt(100);
|
|
44
|
+
size = BigInt(2);
|
|
45
|
+
secret = "my secret";
|
|
46
|
+
encryptedBid = (0, sealedAuction_1.encryptBid)(price, size, secret);
|
|
47
|
+
console.log("encryptedBid: ", encryptedBid);
|
|
48
|
+
hash = (0, sealedAuction_1.getBidHash)(price, size, encryptedBid[0]);
|
|
49
|
+
console.log("hash: ", hash);
|
|
50
|
+
bid = (0, sealedAuction_1.decryptBid)(encryptedBid[1], "my secret");
|
|
51
|
+
console.log("bid: ", bid);
|
|
52
|
+
return [2 /*return*/];
|
|
53
|
+
});
|
|
54
|
+
}); })();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var getDepositTx_1 = require("../utils/coveredCall/getDepositTx");
|
|
40
|
+
var constants_1 = require("../constants");
|
|
41
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
42
|
+
var getTypeArgumentFromToken_1 = require("../utils/getTypeArgumentFromToken");
|
|
43
|
+
var provider = new sui_js_1.JsonRpcProvider(constants_1.TESTNET_RPC_ENDPOINT); //for read only operations
|
|
44
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
45
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
46
|
+
/*
|
|
47
|
+
after deposit, token object (minted token) balance will decrease,
|
|
48
|
+
and subVault "rolling_sub_vault" will increase
|
|
49
|
+
*/
|
|
50
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
+
var depositAmount, isRolling, token, vaultIndex, typeArgument, depositTx;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
depositAmount = "100000000";
|
|
56
|
+
isRolling = true;
|
|
57
|
+
token = constants_1.TEST_MINT_TOKEN;
|
|
58
|
+
vaultIndex = "0";
|
|
59
|
+
return [4 /*yield*/, (0, getTypeArgumentFromToken_1.getTypeArgumentFromToken)(token)];
|
|
60
|
+
case 1:
|
|
61
|
+
typeArgument = _a.sent();
|
|
62
|
+
console.log("test for deposit, try to deposit " + token + " for " + depositAmount + " ...");
|
|
63
|
+
return [4 /*yield*/, (0, getDepositTx_1.getDepositTx)(constants_1.COVERED_CALL_PACKAGE, constants_1.COVERED_CALL_REGISTRY, typeArgument, vaultIndex, token, depositAmount)];
|
|
64
|
+
case 2:
|
|
65
|
+
depositTx = _a.sent();
|
|
66
|
+
return [4 /*yield*/, signer.executeMoveCall(depositTx)];
|
|
67
|
+
case 3:
|
|
68
|
+
_a.sent();
|
|
69
|
+
console.log("deposit to vault successfully");
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); })();
|
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { getNewSharkFinVaultTx } from "../utils/getNewSharkFinVaultTx"
|
|
3
|
+
// import { getDepositTx } from "../utils/coveredCall/getDepositTx"
|
|
4
|
+
// import { SHARKFIN_PACKAGE, SHARKFIN_REGISTRY, TEST_MNEMONIC, TOKEN_REGISTRY } from "../constants"
|
|
5
|
+
// import { JsonRpcProvider, Ed25519Keypair, RawSigner, Network } from '@mysten/sui.js';
|
|
6
|
+
// import { expect } from 'chai';
|
|
7
|
+
// import * as assert from "assert";
|
|
8
|
+
// const provider = new JsonRpcProvider(TESTNET_RPC_ENDPOINT);//for read only operations
|
|
9
|
+
// const keypair = Ed25519Keypair.deriveKeypair(TEST_MNEMONIC);
|
|
10
|
+
// const signer = new RawSigner(keypair, provider);
|
|
11
|
+
// /*
|
|
12
|
+
// after deposit, token object balance will decrease, and new vault "deposit" in fields will increase
|
|
13
|
+
// */
|
|
14
|
+
// describe('deposit', async () => {
|
|
15
|
+
// //init
|
|
16
|
+
// let depositAmount = 123;
|
|
17
|
+
// let typeArgument = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC" //0x27b3674c685046f66cad1d5496d2967894fa5329:TOKEN_PACKAGE
|
|
18
|
+
// let expiration = 1671344789
|
|
19
|
+
// let bullish = true
|
|
20
|
+
// let lowBarrierPrice = 1
|
|
21
|
+
// let highBarrierPrice = 10
|
|
22
|
+
// let isRolling = true;
|
|
23
|
+
// let token = "0xdb85a3efc1706010fa9530ef3b8a8a5cf4b290b7"
|
|
24
|
+
// console.log("test for deposit, try to deposit " + token + " for " + depositAmount + " ...")
|
|
25
|
+
// it('Check registry', async () => {
|
|
26
|
+
// try {
|
|
27
|
+
// await provider.getObject(SHARKFIN_REGISTRY)
|
|
28
|
+
// assert.ok("Get registry successfully");
|
|
29
|
+
// } catch (e) {
|
|
30
|
+
// assert.fail("Wrong registry")
|
|
31
|
+
// }
|
|
32
|
+
// })
|
|
33
|
+
// it('Create new vault in registry', async () => {
|
|
34
|
+
// try {
|
|
35
|
+
// let newSharkFinVaultTx: any = await getNewSharkFinVaultTx(SHARKFIN_PACKAGE, SHARKFIN_REGISTRY, typeArgument, expiration, bullish, lowBarrierPrice, highBarrierPrice);
|
|
36
|
+
// let moveCallTxn = await signer.executeMoveCall(newSharkFinVaultTx);
|
|
37
|
+
// console.log(moveCallTxn)
|
|
38
|
+
// assert.ok("Create new vault in registry successfully");
|
|
39
|
+
// } catch (e) {
|
|
40
|
+
// assert.fail("Can't create new vault in registry")
|
|
41
|
+
// }
|
|
42
|
+
// })
|
|
43
|
+
// it('Check vault number after create new vault', async () => {
|
|
44
|
+
// try {
|
|
45
|
+
// let registry = await provider.getObject(SHARKFIN_REGISTRY)
|
|
46
|
+
// //@ts-ignore
|
|
47
|
+
// let numOfVaultBeforeCreateVault = registry.details.data.fields.num_of_vault
|
|
48
|
+
// // console.log("numOfVaultBeforeCreateVault: " + numOfVaultBeforeCreateVault)
|
|
49
|
+
// let newSharkFinVaultTx: any = await getNewSharkFinVaultTx(SHARKFIN_PACKAGE, SHARKFIN_REGISTRY, typeArgument, expiration, bullish, lowBarrierPrice, highBarrierPrice);
|
|
50
|
+
// await signer.executeMoveCall(newSharkFinVaultTx);
|
|
51
|
+
// registry = await provider.getObject(SHARKFIN_REGISTRY)
|
|
52
|
+
// //@ts-ignore
|
|
53
|
+
// let numOfVaultAfterCreateVault = registry.details.data.fields.num_of_vault
|
|
54
|
+
// // console.log("numOfVaultAfterCreateVault: " + numOfVaultAfterCreateVault)
|
|
55
|
+
// assert.ok(numOfVaultAfterCreateVault == numOfVaultBeforeCreateVault + 1, "wrong vault number");
|
|
56
|
+
// } catch (e) {
|
|
57
|
+
// assert.fail("Error in check vault number after create new vault")
|
|
58
|
+
// }
|
|
59
|
+
// })
|
|
60
|
+
// it('Deposit to new vault', async () => {
|
|
61
|
+
// })
|
|
62
|
+
// })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var getMintTx_1 = require("../utils/getMintTx");
|
|
40
|
+
var constants_1 = require("../constants");
|
|
41
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
42
|
+
var provider = new sui_js_1.JsonRpcProvider(constants_1.TESTNET_RPC_ENDPOINT); //for read only operations
|
|
43
|
+
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(constants_1.TEST_MNEMONIC);
|
|
44
|
+
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
45
|
+
var mintAmount = 1000500000;
|
|
46
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var tokenRegistry, moduleName, mintTx, moveCallTxn;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
tokenRegistry = constants_1.TOKEN_REGISTRY_SUI;
|
|
52
|
+
return [4 /*yield*/, prepareData(tokenRegistry)];
|
|
53
|
+
case 1:
|
|
54
|
+
moduleName = _a.sent();
|
|
55
|
+
return [4 /*yield*/, (0, getMintTx_1.getMintTx)(constants_1.TOKEN_PACKAGE, tokenRegistry, moduleName, mintAmount)];
|
|
56
|
+
case 2:
|
|
57
|
+
mintTx = _a.sent();
|
|
58
|
+
return [4 /*yield*/, signer.executeMoveCall(mintTx)];
|
|
59
|
+
case 3:
|
|
60
|
+
moveCallTxn = _a.sent();
|
|
61
|
+
return [4 /*yield*/, checkData(moveCallTxn, tokenRegistry)];
|
|
62
|
+
case 4:
|
|
63
|
+
_a.sent();
|
|
64
|
+
return [2 /*return*/];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}); })();
|
|
68
|
+
function prepareData(tokenRegistry) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var obj, type_1, tokenName, moudleName, e_1;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
switch (_a.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
_a.trys.push([0, 2, , 3]);
|
|
75
|
+
console.log("test for mint, try to mint " + mintAmount + " ...");
|
|
76
|
+
return [4 /*yield*/, provider.getObject(tokenRegistry)];
|
|
77
|
+
case 1:
|
|
78
|
+
obj = _a.sent();
|
|
79
|
+
if (obj.status != "Exists") {
|
|
80
|
+
console.log("obj not exists");
|
|
81
|
+
return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
type_1 = obj.details.data.fields.treasury_cap.fields.total_supply.type;
|
|
84
|
+
console.log("type arugment : " + type_1);
|
|
85
|
+
tokenName = constants_1.TOKEN_NAME.find(function (e) { return type_1.includes(e); });
|
|
86
|
+
if (!tokenName) {
|
|
87
|
+
console.log("can't find token in type: " + type_1);
|
|
88
|
+
return [2 /*return*/];
|
|
89
|
+
}
|
|
90
|
+
moudleName = constants_1.TOKEN_NAME_TO_MODULE[tokenName];
|
|
91
|
+
//@ts-ignore
|
|
92
|
+
console.log("Before: total mint fake " + tokenName + " token in the registry: " + obj.details.data.fields.treasury_cap.fields.total_supply.fields.value);
|
|
93
|
+
return [2 /*return*/, moudleName];
|
|
94
|
+
case 2:
|
|
95
|
+
e_1 = _a.sent();
|
|
96
|
+
console.error(e_1);
|
|
97
|
+
return [3 /*break*/, 3];
|
|
98
|
+
case 3: return [2 /*return*/];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function checkData(moveCallTxn, tokenRegistry) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
+
var digest, txn, tokenObjectId, tokenObj, newTokenId, obj, e_2;
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0:
|
|
109
|
+
_a.trys.push([0, 4, , 5]);
|
|
110
|
+
digest = moveCallTxn.EffectsCert.certificate.transactionDigest;
|
|
111
|
+
return [4 /*yield*/, provider.getTransactionWithEffects(digest)];
|
|
112
|
+
case 1:
|
|
113
|
+
txn = _a.sent();
|
|
114
|
+
tokenObjectId = txn.effects.created[0].reference.objectId;
|
|
115
|
+
return [4 /*yield*/, provider.getObject(tokenObjectId)
|
|
116
|
+
//@ts-ignore
|
|
117
|
+
];
|
|
118
|
+
case 2:
|
|
119
|
+
tokenObj = _a.sent();
|
|
120
|
+
newTokenId = tokenObj.details.data.fields.id.id;
|
|
121
|
+
console.log("newTokenId: " + newTokenId);
|
|
122
|
+
return [4 /*yield*/, provider.getObject(tokenRegistry)];
|
|
123
|
+
case 3:
|
|
124
|
+
obj = _a.sent();
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
console.log("After: total mint in the registry: " + obj.details.data.fields.treasury_cap.fields.total_supply.fields.value);
|
|
127
|
+
return [3 /*break*/, 5];
|
|
128
|
+
case 4:
|
|
129
|
+
e_2 = _a.sent();
|
|
130
|
+
console.error(e_2);
|
|
131
|
+
return [3 /*break*/, 5];
|
|
132
|
+
case 5: return [2 /*return*/];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|