@typus/typus-sdk 0.6.3 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config.json +17 -20
- package/lib/constants.d.ts +8 -6
- package/lib/constants.js +9 -7
- package/lib/scripts/sui.js +1 -2
- package/lib/test/authorized/testAuthorizedNewPortfolioVault.js +82 -0
- package/lib/test/{testClaim.js → authorized/testAuthorizedUpdateUpcomingVaultConfig.js} +19 -30
- package/lib/test/authorized/testAuthorizedUpdateWarmupVaultConfig.js +68 -0
- package/lib/test/getBidData.js +1 -1
- package/lib/test/getVaultData.js +2 -2
- package/lib/test/getWhiteListFromRegistry.js +2 -2
- package/lib/test/helper/getAuctionMaxSize.js +76 -0
- package/lib/test/helper/getUserStatus.js +75 -0
- package/lib/test/testMint.js +1 -1
- package/lib/test/testSubscribeEvent.js +1 -1
- package/lib/test/{testWithdraw.js → user/testClaim.js} +14 -17
- package/lib/test/{getMakersShares.js → user/testCompound.js} +21 -7
- package/lib/test/{testUnsubscribe.js → user/testDeposit.js} +28 -37
- package/lib/test/{getUsersShares.js → user/testHarvest.js} +21 -7
- package/lib/test/user/testNewBid.js +77 -0
- package/lib/test/user/testUnsubscribe.d.ts +1 -0
- package/lib/test/user/testUnsubscribe.js +69 -0
- package/lib/test/user/testWithdraw.d.ts +1 -0
- package/lib/test/{testDeposit.js → user/testWithdraw.js} +15 -19
- package/lib/utils/auction/getBid.js +0 -1
- package/lib/utils/fetchData.d.ts +72 -61
- package/lib/utils/fetchData.js +27 -198
- package/lib/utils/getTypeArgumentFromToken.js +0 -1
- package/lib/utils/getVaultData.d.ts +2 -2
- package/lib/utils/getVaultData.js +123 -162
- package/lib/utils/getWhiteListFromRegistry.js +0 -1
- package/lib/utils/portfolio/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.d.ts +1 -1
- package/lib/utils/portfolio/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.js +2 -2
- package/lib/utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx.d.ts +4 -3
- package/lib/utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx.js +5 -3
- package/lib/utils/portfolio/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.d.ts +1 -1
- package/lib/utils/portfolio/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.js +2 -2
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.d.ts +4 -0
- package/lib/utils/portfolio/authorized/{getAuthorizedUpdateNextVaultConfigTx.js → getAuthorizedUpdateUpcomingVaultConfigTx.js} +5 -5
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateWarmupVaultConfigTx.d.ts +1 -0
- package/lib/utils/portfolio/{manager/getUpdateVaultConfigTx.js → authorized/getAuthorizedUpdateWarmupVaultConfigTx.js} +4 -5
- package/lib/utils/portfolio/helper/getAuctionMaxSize.d.ts +8 -0
- package/lib/utils/portfolio/{manager/getLastEvolutionTx.js → helper/getAuctionMaxSize.js} +11 -7
- package/lib/utils/portfolio/helper/getUserStatus.d.ts +29 -0
- package/lib/utils/portfolio/{authorized/getAuthorizedEvolutionTx.js → helper/getUserStatus.js} +50 -9
- package/lib/utils/portfolio/manager/getAddAuthorizedUserTx.d.ts +8 -1
- package/lib/utils/portfolio/manager/getAddAuthorizedUserTx.js +9 -2
- package/lib/utils/portfolio/manager/getAddPortfolioVaultAuthorizedUserTx.d.ts +6 -0
- package/lib/utils/portfolio/manager/getAddPortfolioVaultAuthorizedUserTx.js +6 -0
- package/lib/utils/portfolio/manager/getEvolutionTx.d.ts +15 -1
- package/lib/utils/portfolio/manager/getEvolutionTx.js +14 -0
- package/lib/utils/portfolio/manager/getNewManagerTx.d.ts +8 -1
- package/lib/utils/portfolio/manager/getNewManagerTx.js +9 -2
- package/lib/utils/portfolio/manager/getNewPortfolioVaultTx.d.ts +5 -5
- package/lib/utils/portfolio/manager/getNewPortfolioVaultTx.js +5 -5
- package/lib/utils/portfolio/manager/getRemoveAuthorizedUserTx.d.ts +7 -0
- package/lib/utils/portfolio/manager/getRemoveAuthorizedUserTx.js +7 -0
- package/lib/utils/portfolio/manager/getRemoveManagerTx.d.ts +5 -0
- package/lib/utils/portfolio/manager/getRemoveManagerTx.js +5 -0
- package/lib/utils/portfolio/manager/getRemovePortfolioVaultAuthorizedUserTx.d.ts +7 -1
- package/lib/utils/portfolio/manager/getRemovePortfolioVaultAuthorizedUserTx.js +7 -1
- package/lib/utils/portfolio/user/getClaimAndHarvestTx.d.ts +9 -1
- package/lib/utils/portfolio/user/getClaimAndHarvestTx.js +11 -3
- package/lib/utils/portfolio/user/getClaimTx.d.ts +9 -1
- package/lib/utils/portfolio/user/getClaimTx.js +8 -0
- package/lib/utils/portfolio/user/getCompoundTx.d.ts +9 -0
- package/lib/utils/portfolio/{authorized/getAuthorizedLastEvolutionTx.js → user/getCompoundTx.js} +12 -6
- package/lib/utils/portfolio/user/getDepositTx.d.ts +10 -0
- package/lib/utils/portfolio/user/getDepositTx.js +10 -0
- package/lib/utils/portfolio/user/getHarvestTx.d.ts +9 -1
- package/lib/utils/portfolio/user/getHarvestTx.js +8 -0
- package/lib/utils/portfolio/user/getNewBidTx.d.ts +13 -1
- package/lib/utils/portfolio/user/getNewBidTx.js +12 -0
- package/lib/utils/portfolio/user/getUnsubscribeTx.d.ts +10 -1
- package/lib/utils/portfolio/user/getUnsubscribeTx.js +9 -0
- package/lib/utils/portfolio/user/getWithdrawTx.d.ts +10 -1
- package/lib/utils/portfolio/user/getWithdrawTx.js +9 -0
- package/package.json +2 -2
- package/lib/test/eventListener.d.ts +0 -5
- package/lib/test/eventListener.js +0 -397
- package/lib/test/testDepositV2.d.ts +0 -0
- package/lib/test/testDepositV2.js +0 -64
- package/lib/test/testNewAuction.js +0 -94
- package/lib/test/testNewVault.js +0 -153
- package/lib/test/testOracle.js +0 -94
- package/lib/test/testSettle.js +0 -590
- package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedDeliveryTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedDeliveryTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedEvolutionTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedEvolutionTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedLastEvolutionTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedLastEvolutionTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedNewAuctionTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedNewAuctionTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.js +0 -76
- package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedSettleTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedSettleTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedUpdateCapacityTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedUpdateCapacityTx.js +0 -56
- package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.js +0 -65
- package/lib/utils/authorized/getAuthorizedUpdateVaultConfigTx.d.ts +0 -1
- package/lib/utils/authorized/getAuthorizedUpdateVaultConfigTx.js +0 -64
- package/lib/utils/coveredCall/createPriceOracle.d.ts +0 -1
- package/lib/utils/coveredCall/createPriceOracle.js +0 -93
- package/lib/utils/coveredCall/createTimeOracle.d.ts +0 -1
- package/lib/utils/coveredCall/createTimeOracle.js +0 -92
- package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.js +0 -61
- package/lib/utils/coveredCall/getClaimAllTx.d.ts +0 -1
- package/lib/utils/coveredCall/getClaimAllTx.js +0 -59
- package/lib/utils/coveredCall/getClaimTx.d.ts +0 -1
- package/lib/utils/coveredCall/getClaimTx.js +0 -59
- package/lib/utils/coveredCall/getCloseAuctionTx.d.ts +0 -1
- package/lib/utils/coveredCall/getCloseAuctionTx.js +0 -61
- package/lib/utils/coveredCall/getCloseVaultTx.d.ts +0 -1
- package/lib/utils/coveredCall/getCloseVaultTx.js +0 -60
- package/lib/utils/coveredCall/getDeliveryTx.d.ts +0 -1
- package/lib/utils/coveredCall/getDeliveryTx.js +0 -61
- package/lib/utils/coveredCall/getDepositTx.d.ts +0 -1
- package/lib/utils/coveredCall/getDepositTx.js +0 -65
- package/lib/utils/coveredCall/getEvolutionTx.d.ts +0 -1
- package/lib/utils/coveredCall/getEvolutionTx.js +0 -64
- package/lib/utils/coveredCall/getLastEvolutionTx.d.ts +0 -1
- package/lib/utils/coveredCall/getLastEvolutionTx.js +0 -63
- package/lib/utils/coveredCall/getMakerClaimAllTx.d.ts +0 -1
- package/lib/utils/coveredCall/getMakerClaimAllTx.js +0 -59
- package/lib/utils/coveredCall/getMakerClaimTx.d.ts +0 -1
- package/lib/utils/coveredCall/getMakerClaimTx.js +0 -59
- package/lib/utils/coveredCall/getNewAuctionTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewAuctionTx.js +0 -66
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +0 -64
- package/lib/utils/coveredCall/getNewBidTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewBidTx.js +0 -62
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +0 -77
- package/lib/utils/coveredCall/getNewManagerTx.d.ts +0 -1
- package/lib/utils/coveredCall/getNewManagerTx.js +0 -59
- package/lib/utils/coveredCall/getRefundTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRefundTx.js +0 -59
- package/lib/utils/coveredCall/getRemoveBidTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRemoveBidTx.js +0 -60
- package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.js +0 -61
- package/lib/utils/coveredCall/getRemoveManagerTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRemoveManagerTx.js +0 -58
- package/lib/utils/coveredCall/getRollOverTx.d.ts +0 -1
- package/lib/utils/coveredCall/getRollOverTx.js +0 -60
- package/lib/utils/coveredCall/getSettleTx.d.ts +0 -1
- package/lib/utils/coveredCall/getSettleTx.js +0 -62
- package/lib/utils/coveredCall/getSettleWithRollOverTx.d.ts +0 -1
- package/lib/utils/coveredCall/getSettleWithRollOverTx.js +0 -62
- package/lib/utils/coveredCall/getSubscribeTx.d.ts +0 -1
- package/lib/utils/coveredCall/getSubscribeTx.js +0 -60
- package/lib/utils/coveredCall/getUnsubscribeTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUnsubscribeTx.js +0 -63
- package/lib/utils/coveredCall/getUpdateCapacityTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUpdateCapacityTx.js +0 -61
- package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.js +0 -66
- package/lib/utils/coveredCall/getUpdatePayoffConfigTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUpdatePayoffConfigTx.js +0 -62
- package/lib/utils/coveredCall/getUpdateVaultConfigTx.d.ts +0 -1
- package/lib/utils/coveredCall/getUpdateVaultConfigTx.js +0 -65
- package/lib/utils/coveredCall/getWithdrawTx.d.ts +0 -1
- package/lib/utils/coveredCall/getWithdrawTx.js +0 -60
- package/lib/utils/fetchPortfolioData.d.ts +0 -93
- package/lib/utils/fetchPortfolioData.js +0 -205
- package/lib/utils/getCreateTokenRegistryTx.d.ts +0 -1
- package/lib/utils/getCreateTokenRegistryTx.js +0 -59
- package/lib/utils/getMakersShares.d.ts +0 -8
- package/lib/utils/getMakersShares.js +0 -145
- package/lib/utils/getNewOracleTx.d.ts +0 -1
- package/lib/utils/getNewOracleTx.js +0 -59
- package/lib/utils/getNewTimeOracleTx.d.ts +0 -1
- package/lib/utils/getNewTimeOracleTx.js +0 -56
- package/lib/utils/getUpdateOracleTx.d.ts +0 -1
- package/lib/utils/getUpdateOracleTx.js +0 -64
- package/lib/utils/getUpdateTimeOracleTx.d.ts +0 -1
- package/lib/utils/getUpdateTimeOracleTx.js +0 -60
- package/lib/utils/getUsersShares.d.ts +0 -9
- package/lib/utils/getUsersShares.js +0 -148
- package/lib/utils/getVaultIndexInRegistry.d.ts +0 -1
- package/lib/utils/getVaultIndexInRegistry.js +0 -61
- package/lib/utils/isObjAvailable.d.ts +0 -0
- package/lib/utils/isObjAvailable.js +0 -14
- package/lib/utils/loadUsersDepositData.d.ts +0 -8
- package/lib/utils/loadUsersDepositData.js +0 -160
- package/lib/utils/portfolio/authorized/getAuthorizedEvolutionTx.d.ts +0 -1
- package/lib/utils/portfolio/authorized/getAuthorizedLastEvolutionTx.d.ts +0 -1
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +0 -4
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateVaultConfigTx.d.ts +0 -1
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateVaultConfigTx.js +0 -64
- package/lib/utils/portfolio/manager/getLastEvolutionTx.d.ts +0 -1
- package/lib/utils/portfolio/manager/getUpdateNextVaultConfigTx.d.ts +0 -4
- package/lib/utils/portfolio/manager/getUpdateNextVaultConfigTx.js +0 -71
- package/lib/utils/portfolio/manager/getUpdateVaultConfigTx.d.ts +0 -1
- package/lib/utils/portfolio/user/getCompoundPremiumTx.d.ts +0 -1
- package/lib/utils/portfolio/user/getCompoundPremiumTx.js +0 -60
- /package/lib/test/{getMakersShares.d.ts → authorized/testAuthorizedNewPortfolioVault.d.ts} +0 -0
- /package/lib/test/{getUsersShares.d.ts → authorized/testAuthorizedUpdateUpcomingVaultConfig.d.ts} +0 -0
- /package/lib/test/{testClaim.d.ts → authorized/testAuthorizedUpdateWarmupVaultConfig.d.ts} +0 -0
- /package/lib/test/{testDeposit.d.ts → helper/getAuctionMaxSize.d.ts} +0 -0
- /package/lib/test/{testNewAuction.d.ts → helper/getUserStatus.d.ts} +0 -0
- /package/lib/test/{testNewVault.d.ts → user/testClaim.d.ts} +0 -0
- /package/lib/test/{testOracle.d.ts → user/testCompound.d.ts} +0 -0
- /package/lib/test/{testSettle.d.ts → user/testDeposit.d.ts} +0 -0
- /package/lib/test/{testUnsubscribe.d.ts → user/testHarvest.d.ts} +0 -0
- /package/lib/test/{testWithdraw.d.ts → user/testNewBid.d.ts} +0 -0
|
@@ -1,205 +0,0 @@
|
|
|
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
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.getUserDataFromLinkedListNode = exports.getLinkedListNodesFromTable = exports.getTableUnderSubVault = exports.getSubVaultsFromTable = exports.getTableFromCoveredCallVault = exports.getCoveredCallVaultsFromRegistry = void 0;
|
|
51
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
52
|
-
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
|
|
53
|
-
var decode = function (str) { return Buffer.from(str, 'base64').toString('binary'); };
|
|
54
|
-
//new version: getVaultDataFromRegistry()
|
|
55
|
-
function getCoveredCallVaultsFromRegistry(registry) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var coveredCallVaults;
|
|
58
|
-
return __generator(this, function (_a) {
|
|
59
|
-
switch (_a.label) {
|
|
60
|
-
case 0:
|
|
61
|
-
console.log("registry: " + registry);
|
|
62
|
-
return [4 /*yield*/, provider.getDynamicFields(registry)];
|
|
63
|
-
case 1:
|
|
64
|
-
coveredCallVaults = (_a.sent()).data;
|
|
65
|
-
console.log("under the registry, there are " + coveredCallVaults.length + " covered call vaults");
|
|
66
|
-
return [2 /*return*/, coveredCallVaults];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
exports.getCoveredCallVaultsFromRegistry = getCoveredCallVaultsFromRegistry;
|
|
72
|
-
function getTableFromCoveredCallVault(coveredCallVault) {
|
|
73
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var tmp, tableUnderCoveredCallVault;
|
|
75
|
-
return __generator(this, function (_a) {
|
|
76
|
-
switch (_a.label) {
|
|
77
|
-
case 0:
|
|
78
|
-
console.log("coveredCallVault: " + coveredCallVault);
|
|
79
|
-
return [4 /*yield*/, provider.getObject(coveredCallVault)];
|
|
80
|
-
case 1:
|
|
81
|
-
tmp = _a.sent();
|
|
82
|
-
if (tmp.status != "Exists") {
|
|
83
|
-
console.log("obj not exists");
|
|
84
|
-
return [2 /*return*/];
|
|
85
|
-
}
|
|
86
|
-
tableUnderCoveredCallVault = tmp.details.data.fields.value.fields.vault.fields.sub_vaults.fields.id.id;
|
|
87
|
-
console.log("table : " + tableUnderCoveredCallVault);
|
|
88
|
-
return [2 /*return*/, tableUnderCoveredCallVault];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
exports.getTableFromCoveredCallVault = getTableFromCoveredCallVault;
|
|
94
|
-
function getSubVaultsFromTable(tableUnderCoveredCallVault) {
|
|
95
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var subVaults, result, subVaults_1, subVaults_1_1, subVault, txn, name_1, e_1_1;
|
|
97
|
-
var e_1, _a;
|
|
98
|
-
return __generator(this, function (_b) {
|
|
99
|
-
switch (_b.label) {
|
|
100
|
-
case 0: return [4 /*yield*/, provider.getDynamicFields(tableUnderCoveredCallVault)];
|
|
101
|
-
case 1:
|
|
102
|
-
subVaults = (_b.sent()).data;
|
|
103
|
-
console.log("there are " + subVaults.length + " sub vault under table, representing rolling, regular and maker");
|
|
104
|
-
result = {};
|
|
105
|
-
_b.label = 2;
|
|
106
|
-
case 2:
|
|
107
|
-
_b.trys.push([2, 7, 8, 9]);
|
|
108
|
-
subVaults_1 = __values(subVaults), subVaults_1_1 = subVaults_1.next();
|
|
109
|
-
_b.label = 3;
|
|
110
|
-
case 3:
|
|
111
|
-
if (!!subVaults_1_1.done) return [3 /*break*/, 6];
|
|
112
|
-
subVault = subVaults_1_1.value;
|
|
113
|
-
return [4 /*yield*/, provider.getObject(subVault.objectId)];
|
|
114
|
-
case 4:
|
|
115
|
-
txn = _b.sent();
|
|
116
|
-
if (txn.status != "Exists") {
|
|
117
|
-
console.log("obj not exists");
|
|
118
|
-
return [2 /*return*/, {}];
|
|
119
|
-
}
|
|
120
|
-
name_1 = decode(txn.details.data.fields.name) //rolling / regular / maker
|
|
121
|
-
;
|
|
122
|
-
//@ts-ignore
|
|
123
|
-
result[name_1] = txn.details.data.fields.id.id;
|
|
124
|
-
_b.label = 5;
|
|
125
|
-
case 5:
|
|
126
|
-
subVaults_1_1 = subVaults_1.next();
|
|
127
|
-
return [3 /*break*/, 3];
|
|
128
|
-
case 6: return [3 /*break*/, 9];
|
|
129
|
-
case 7:
|
|
130
|
-
e_1_1 = _b.sent();
|
|
131
|
-
e_1 = { error: e_1_1 };
|
|
132
|
-
return [3 /*break*/, 9];
|
|
133
|
-
case 8:
|
|
134
|
-
try {
|
|
135
|
-
if (subVaults_1_1 && !subVaults_1_1.done && (_a = subVaults_1.return)) _a.call(subVaults_1);
|
|
136
|
-
}
|
|
137
|
-
finally { if (e_1) throw e_1.error; }
|
|
138
|
-
return [7 /*endfinally*/];
|
|
139
|
-
case 9:
|
|
140
|
-
console.log("sub vaults:");
|
|
141
|
-
console.log(result);
|
|
142
|
-
return [2 /*return*/, result];
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
exports.getSubVaultsFromTable = getSubVaultsFromTable;
|
|
148
|
-
function getTableUnderSubVault(subVault) {
|
|
149
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var tmp, table;
|
|
151
|
-
return __generator(this, function (_a) {
|
|
152
|
-
switch (_a.label) {
|
|
153
|
-
case 0:
|
|
154
|
-
console.log("sub vault: " + subVault);
|
|
155
|
-
return [4 /*yield*/, provider.getObject(subVault)];
|
|
156
|
-
case 1:
|
|
157
|
-
tmp = _a.sent();
|
|
158
|
-
if (tmp.status != "Exists") {
|
|
159
|
-
console.log("obj not exists");
|
|
160
|
-
return [2 /*return*/, ""];
|
|
161
|
-
}
|
|
162
|
-
table = tmp.details.data.fields.value.fields.user_shares.fields.nodes.fields.id.id;
|
|
163
|
-
console.log("table under sub vault: ", table);
|
|
164
|
-
return [2 /*return*/, table];
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
exports.getTableUnderSubVault = getTableUnderSubVault;
|
|
170
|
-
function getLinkedListNodesFromTable(table) {
|
|
171
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
172
|
-
var linkedListNodes;
|
|
173
|
-
return __generator(this, function (_a) {
|
|
174
|
-
switch (_a.label) {
|
|
175
|
-
case 0: return [4 /*yield*/, provider.getDynamicFields(table)];
|
|
176
|
-
case 1:
|
|
177
|
-
linkedListNodes = (_a.sent()).data;
|
|
178
|
-
console.log("there are " + linkedListNodes.length + " linked list nodes in table");
|
|
179
|
-
return [2 /*return*/, linkedListNodes];
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
exports.getLinkedListNodesFromTable = getLinkedListNodesFromTable;
|
|
185
|
-
function getUserDataFromLinkedListNode(linkedListNode) {
|
|
186
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
187
|
-
var tmp, usersData;
|
|
188
|
-
return __generator(this, function (_a) {
|
|
189
|
-
switch (_a.label) {
|
|
190
|
-
case 0: return [4 /*yield*/, provider.getObject(linkedListNode)];
|
|
191
|
-
case 1:
|
|
192
|
-
tmp = _a.sent();
|
|
193
|
-
if (tmp.status != "Exists") {
|
|
194
|
-
console.log("obj not exists");
|
|
195
|
-
return [2 /*return*/];
|
|
196
|
-
}
|
|
197
|
-
usersData = tmp.details.data.fields;
|
|
198
|
-
console.log("users data from linked list node:");
|
|
199
|
-
console.log(usersData);
|
|
200
|
-
return [2 /*return*/, usersData];
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
exports.getUserDataFromLinkedListNode = getUserDataFromLinkedListNode;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getCreateTokenRegistryTx(gasBudget: number, packageId: string): Promise<any>;
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
exports.getCreateTokenRegistryTx = void 0;
|
|
40
|
-
function getCreateTokenRegistryTx(gasBudget, packageId) {
|
|
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: 'token',
|
|
47
|
-
function: 'new',
|
|
48
|
-
typeArguments: [],
|
|
49
|
-
arguments: [],
|
|
50
|
-
gasBudget: gasBudget,
|
|
51
|
-
};
|
|
52
|
-
return [2 /*return*/, tx];
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.getCreateTokenRegistryTx = getCreateTokenRegistryTx;
|
|
57
|
-
/*
|
|
58
|
-
sui client call --gas-budget 10000 --package $PACKAGE --module "token" --function "new"
|
|
59
|
-
*/
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider } from '@mysten/sui.js';
|
|
2
|
-
export interface MakerShare {
|
|
3
|
-
coveredCallVaultIndex: string;
|
|
4
|
-
share: string;
|
|
5
|
-
maker: string;
|
|
6
|
-
depositAmount: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function getMakersShares(makerShareTable: string, registry: string, provider: JsonRpcProvider): Promise<MakerShare[]>;
|
|
@@ -1,145 +0,0 @@
|
|
|
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
|
-
var __values = (this && this.__values) || function(o) {
|
|
39
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
-
if (m) return m.call(o);
|
|
41
|
-
if (o && typeof o.length === "number") return {
|
|
42
|
-
next: function () {
|
|
43
|
-
if (o && i >= o.length) o = void 0;
|
|
44
|
-
return { value: o && o[i++], done: !o };
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.getMakersShares = void 0;
|
|
51
|
-
function getSubVaultsData(registry, provider) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var subVaultsData, coveredCallVaults, coveredCallVaultsId, objsInfo, objsInfo_1, objsInfo_1_1, objInfo, vaultId, vault, subVaultData;
|
|
54
|
-
var e_1, _a;
|
|
55
|
-
return __generator(this, function (_b) {
|
|
56
|
-
switch (_b.label) {
|
|
57
|
-
case 0:
|
|
58
|
-
subVaultsData = new Map();
|
|
59
|
-
return [4 /*yield*/, provider.getDynamicFields(registry)];
|
|
60
|
-
case 1:
|
|
61
|
-
coveredCallVaults = (_b.sent()).data;
|
|
62
|
-
coveredCallVaultsId = coveredCallVaults.map(function (e) { return e.objectId; });
|
|
63
|
-
return [4 /*yield*/, provider.getObjectBatch(coveredCallVaultsId)];
|
|
64
|
-
case 2:
|
|
65
|
-
objsInfo = _b.sent();
|
|
66
|
-
try {
|
|
67
|
-
for (objsInfo_1 = __values(objsInfo), objsInfo_1_1 = objsInfo_1.next(); !objsInfo_1_1.done; objsInfo_1_1 = objsInfo_1.next()) {
|
|
68
|
-
objInfo = objsInfo_1_1.value;
|
|
69
|
-
if (objInfo.status != "Exists") {
|
|
70
|
-
console.log("obj not exist");
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
vaultId = Number(objInfo.details.data.fields.name);
|
|
74
|
-
vault = objInfo.details.data.fields.value.fields.vault.fields;
|
|
75
|
-
subVaultData = {
|
|
76
|
-
makerTotalSupply: Number(vault.maker_sub_vault.fields.balance),
|
|
77
|
-
makerTotalBalance: Number(vault.maker_sub_vault.fields.share_supply),
|
|
78
|
-
};
|
|
79
|
-
subVaultsData.set(vaultId, subVaultData);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
83
|
-
finally {
|
|
84
|
-
try {
|
|
85
|
-
if (objsInfo_1_1 && !objsInfo_1_1.done && (_a = objsInfo_1.return)) _a.call(objsInfo_1);
|
|
86
|
-
}
|
|
87
|
-
finally { if (e_1) throw e_1.error; }
|
|
88
|
-
}
|
|
89
|
-
return [2 /*return*/, subVaultsData];
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
function getMakersShares(makerShareTable, registry, provider) {
|
|
95
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var subVaultsData, makerShareIds, makerShares;
|
|
97
|
-
return __generator(this, function (_a) {
|
|
98
|
-
switch (_a.label) {
|
|
99
|
-
case 0: return [4 /*yield*/, getSubVaultsData(registry, provider)]; //vault idx to subvault info
|
|
100
|
-
case 1:
|
|
101
|
-
subVaultsData = _a.sent() //vault idx to subvault info
|
|
102
|
-
;
|
|
103
|
-
return [4 /*yield*/, provider.getDynamicFields(makerShareTable)];
|
|
104
|
-
case 2:
|
|
105
|
-
makerShareIds = (_a.sent()).data.map(function (x) { return x.objectId; });
|
|
106
|
-
return [4 /*yield*/, provider.getObjectBatch(makerShareIds)];
|
|
107
|
-
case 3:
|
|
108
|
-
makerShares = (_a.sent()).map(function (x) {
|
|
109
|
-
var _a, _b;
|
|
110
|
-
if (x.status != "Exists") {
|
|
111
|
-
console.log("obj not exist");
|
|
112
|
-
return {};
|
|
113
|
-
}
|
|
114
|
-
//@ts-ignore
|
|
115
|
-
var obj = (x.details.data.fields);
|
|
116
|
-
/*
|
|
117
|
-
{
|
|
118
|
-
id: { id: '0xae32e84281a8e08fade4f72d0c5f861061deb608' },
|
|
119
|
-
name: {
|
|
120
|
-
type: '0xb92f3c4c26151b86977b8811765fe74cb133a35f::covered_call::MakerShareKey',
|
|
121
|
-
fields: { index: '0', maker: '0x4a3b00eac21bfbe062932a5c2b9710245edb2cc2' }
|
|
122
|
-
},
|
|
123
|
-
value: '23000000000'
|
|
124
|
-
}
|
|
125
|
-
*/
|
|
126
|
-
var index = obj.name.fields.index;
|
|
127
|
-
var share = obj.value;
|
|
128
|
-
var maker = obj.name.fields.maker;
|
|
129
|
-
var depositAmount = (Number(share) / ((_a = subVaultsData.get(Number(index))) === null || _a === void 0 ? void 0 : _a.makerTotalSupply) * ((_b = subVaultsData.get(Number(index))) === null || _b === void 0 ? void 0 : _b.makerTotalBalance));
|
|
130
|
-
var res = {
|
|
131
|
-
coveredCallVaultIndex: index,
|
|
132
|
-
//@ts-ignore
|
|
133
|
-
share: share,
|
|
134
|
-
//@ts-ignore
|
|
135
|
-
maker: maker,
|
|
136
|
-
depositAmount: depositAmount.toFixed(0),
|
|
137
|
-
};
|
|
138
|
-
return res;
|
|
139
|
-
});
|
|
140
|
-
return [2 /*return*/, makerShares];
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
exports.getMakersShares = getMakersShares;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getNewOracleTx(gasBudget: number, packageId: string, typeArgument: string, decimal: number): Promise<any>;
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
exports.getNewOracleTx = void 0;
|
|
40
|
-
function getNewOracleTx(gasBudget, packageId, typeArgument, decimal) {
|
|
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: 'oracle',
|
|
47
|
-
function: 'new_oracle',
|
|
48
|
-
typeArguments: [typeArgument],
|
|
49
|
-
arguments: [decimal],
|
|
50
|
-
gasBudget: gasBudget,
|
|
51
|
-
};
|
|
52
|
-
return [2 /*return*/, tx];
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.getNewOracleTx = getNewOracleTx;
|
|
57
|
-
/*
|
|
58
|
-
sui client call --gas-budget 1000 --package $PACKAGE --module "oracle" --function "new_oracle" --type-args 0x2::sui::SUI
|
|
59
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getNewTimeOracleTx(gasBudget: number, packageId: string): Promise<any>;
|
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
exports.getNewTimeOracleTx = void 0;
|
|
40
|
-
function getNewTimeOracleTx(gasBudget, packageId) {
|
|
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: 'new_time',
|
|
48
|
-
typeArguments: [],
|
|
49
|
-
arguments: [],
|
|
50
|
-
gasBudget: gasBudget,
|
|
51
|
-
};
|
|
52
|
-
return [2 /*return*/, tx];
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.getNewTimeOracleTx = getNewTimeOracleTx;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getUpdateOracleTx(gasBudget: number, packageId: string, typeArgument: string, oracle: string, managerCap: string, price: number, unix: number): Promise<any>;
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
exports.getUpdateOracleTx = void 0;
|
|
40
|
-
function getUpdateOracleTx(gasBudget, packageId, typeArgument, oracle, managerCap, price, unix) {
|
|
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: 'oracle',
|
|
47
|
-
function: 'update',
|
|
48
|
-
typeArguments: [typeArgument],
|
|
49
|
-
arguments: [
|
|
50
|
-
oracle,
|
|
51
|
-
managerCap,
|
|
52
|
-
price,
|
|
53
|
-
unix
|
|
54
|
-
],
|
|
55
|
-
gasBudget: gasBudget,
|
|
56
|
-
};
|
|
57
|
-
return [2 /*return*/, tx];
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
exports.getUpdateOracleTx = getUpdateOracleTx;
|
|
62
|
-
/*
|
|
63
|
-
sui client call --gas-budget 1000 --package $PACKAGE --module "oracle" --function "update" --type-args 0x2::sui::SUI --args 0x7158f68a06bc09123fcba1645f4c56ca866a8e90 0xa31180f78ee420b561240214c301df4adf9377ab 1201 1328
|
|
64
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getUpdateTimeOracleTx(gasBudget: number, packageId: string, oracle: string, managerCap: string, ts: number): Promise<any>;
|