@typus/typus-sdk 1.0.22 → 1.0.23
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.js +1 -3
- package/package.json +1 -1
- package/lib/test/faucet.d.ts +0 -1
- package/lib/test/faucet.js +0 -53
- package/lib/test/getUserInfo.d.ts +0 -1
- package/lib/test/getUserInfo.js +0 -46
- package/lib/test/mergeCoins.d.ts +0 -1
- package/lib/test/mergeCoins.js +0 -75
- package/lib/test/multiple-collateral/getAuctionMaxSize.d.ts +0 -1
- package/lib/test/multiple-collateral/getAuctionMaxSize.js +0 -63
- package/lib/test/multiple-collateral/getBids.d.ts +0 -1
- package/lib/test/multiple-collateral/getBids.js +0 -63
- package/lib/test/multiple-collateral/getMaxLossPerUnit.d.ts +0 -1
- package/lib/test/multiple-collateral/getMaxLossPerUnit.js +0 -63
- package/lib/test/multiple-collateral/getPortfolioVaults.d.ts +0 -1
- package/lib/test/multiple-collateral/getPortfolioVaults.js +0 -62
- package/lib/test/multiple-collateral/getUserShares.d.ts +0 -1
- package/lib/test/multiple-collateral/getUserShares.js +0 -60
- package/lib/test/single-collateral/authorized/testAuthorizedNewPortfolioVault.d.ts +0 -1
- package/lib/test/single-collateral/authorized/testAuthorizedNewPortfolioVault.js +0 -88
- package/lib/test/single-collateral/authorized/testAuthorizedUpdateUpcomingVaultConfig.d.ts +0 -1
- package/lib/test/single-collateral/authorized/testAuthorizedUpdateUpcomingVaultConfig.js +0 -77
- package/lib/test/single-collateral/authorized/testAuthorizedUpdateWarmupVaultConfig.d.ts +0 -1
- package/lib/test/single-collateral/authorized/testAuthorizedUpdateWarmupVaultConfig.js +0 -74
- package/lib/test/single-collateral/getAuctionMaxSize.d.ts +0 -1
- package/lib/test/single-collateral/getAuctionMaxSize.js +0 -63
- package/lib/test/single-collateral/getBidData.d.ts +0 -1
- package/lib/test/single-collateral/getBidData.js +0 -62
- package/lib/test/single-collateral/getBids.d.ts +0 -1
- package/lib/test/single-collateral/getBids.js +0 -63
- package/lib/test/single-collateral/getMaxLossPerUnit.d.ts +0 -1
- package/lib/test/single-collateral/getMaxLossPerUnit.js +0 -63
- package/lib/test/single-collateral/getPortfolioVaults.d.ts +0 -1
- package/lib/test/single-collateral/getPortfolioVaults.js +0 -57
- package/lib/test/single-collateral/getUserShares.d.ts +0 -1
- package/lib/test/single-collateral/getUserShares.js +0 -60
- package/lib/test/single-collateral/getVaultData.d.ts +0 -1
- package/lib/test/single-collateral/getVaultData.js +0 -56
- package/lib/test/single-collateral/getWhiteListFromRegistry.d.ts +0 -1
- package/lib/test/single-collateral/getWhiteListFromRegistry.js +0 -55
- package/lib/test/single-collateral/testCrypto.d.ts +0 -1
- package/lib/test/single-collateral/testCrypto.js +0 -54
- package/lib/test/single-collateral/testMint.d.ts +0 -1
- package/lib/test/single-collateral/testMint.js +0 -145
- package/lib/test/single-collateral/testSDK.d.ts +0 -1
- package/lib/test/single-collateral/testSDK.js +0 -73
- package/lib/test/single-collateral/testSubscribeEvent.d.ts +0 -1
- package/lib/test/single-collateral/testSubscribeEvent.js +0 -82
- package/lib/test/single-collateral/user/testClaim.d.ts +0 -1
- package/lib/test/single-collateral/user/testClaim.js +0 -68
- package/lib/test/single-collateral/user/testCompound.d.ts +0 -1
- package/lib/test/single-collateral/user/testCompound.js +0 -68
- package/lib/test/single-collateral/user/testDeposit.d.ts +0 -1
- package/lib/test/single-collateral/user/testDeposit.js +0 -85
- package/lib/test/single-collateral/user/testHarvest.d.ts +0 -1
- package/lib/test/single-collateral/user/testHarvest.js +0 -68
- package/lib/test/single-collateral/user/testNewBid.d.ts +0 -1
- package/lib/test/single-collateral/user/testNewBid.js +0 -83
- package/lib/test/single-collateral/user/testUnsubscribe.d.ts +0 -1
- package/lib/test/single-collateral/user/testUnsubscribe.js +0 -72
- package/lib/test/single-collateral/user/testWithdraw.d.ts +0 -1
- package/lib/test/single-collateral/user/testWithdraw.js +0 -71
- package/lib/test/sponsorTransaction.d.ts +0 -1
- package/lib/test/sponsorTransaction.js +0 -130
package/lib/constants.js
CHANGED
|
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.PERFORMANCE_FEE_SUB_VAULT_TAG = exports.PREMIUM_SUB_VAULT_TAG = exports.BIDDER_SUB_VAULT_TAG = exports.WARMUP_SUB_VAULT_TAG = exports.INACTIVE_SUB_VAULT_TAG = exports.DEACTIVATING_SUB_VAULT_TAG = exports.ACTIVE_SUB_VAULT_TAG = exports.testnetConnection = exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.TEST_MINT_TOKEN = exports.SINGLE_COLLATERAL_BID_VAULT_REGISTRY = exports.SINGLE_COLLATERAL_DEPOSIT_VAULT_REGISTRY = exports.MODULE = exports.REGISTRY = exports.PORTFOLIO_PACKAGE = exports.DOGE_ORACLE = exports.APT_ORACLE = exports.SUI_ORACLE = exports.ETH_ORACLE = exports.BTC_ORACLE = exports.SENDER = exports.CLOCK = exports.TIME_ORACLE = exports.ORACLE_PACKAGE = exports.TOKEN_REGISTRY_SUI = exports.TOKEN_PACKAGE = void 0;
|
|
7
7
|
var sui_js_1 = require("@mysten/sui.js");
|
|
8
8
|
var config_json_1 = __importDefault(require("./config.json"));
|
|
9
|
-
var path_1 = __importDefault(require("path"));
|
|
10
|
-
var dotenv_1 = __importDefault(require("dotenv"));
|
|
11
9
|
// import .env file if exists
|
|
12
|
-
|
|
10
|
+
// dotenv.config({ path: path.resolve(__dirname, ".env") });
|
|
13
11
|
//publish from sui-dev-token
|
|
14
12
|
exports.TOKEN_PACKAGE = config_json_1.default.TOKEN_PACKAGE;
|
|
15
13
|
exports.TOKEN_REGISTRY_SUI = "0x3b87b3f0403f527d28fd1301074a12446f43817a";
|
package/package.json
CHANGED
package/lib/test/faucet.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/test/faucet.js
DELETED
|
@@ -1,53 +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
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
40
|
-
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.testnetConnection); //for read only operations
|
|
41
|
-
var address = "0xb6c7e3b1c61ee81516a8317f221daa035f1503e0ac3ae7a50b61834bc7a3ead9";
|
|
42
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
-
var res;
|
|
44
|
-
return __generator(this, function (_a) {
|
|
45
|
-
switch (_a.label) {
|
|
46
|
-
case 0: return [4 /*yield*/, provider.requestSuiFromFaucet(address)];
|
|
47
|
-
case 1:
|
|
48
|
-
res = _a.sent();
|
|
49
|
-
console.log(res);
|
|
50
|
-
return [2 /*return*/];
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/test/getUserInfo.js
DELETED
|
@@ -1,46 +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
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
40
|
-
var connection = new sui_js_1.Connection({ fullnode: "https://rpc-testnet.suiscan.xyz:443" });
|
|
41
|
-
var provider = new sui_js_1.JsonRpcProvider(connection); //for read only operations
|
|
42
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
return [2 /*return*/];
|
|
45
|
-
});
|
|
46
|
-
}); })();
|
package/lib/test/mergeCoins.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/test/mergeCoins.js
DELETED
|
@@ -1,75 +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
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
40
|
-
var connection = new sui_js_1.Connection({ fullnode: "https://rpc-testnet.suiscan.xyz:443" });
|
|
41
|
-
var provider = new sui_js_1.JsonRpcProvider(connection); //for read only operations
|
|
42
|
-
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(String(process.env.MNEMONIC));
|
|
43
|
-
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
44
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
-
var coin_type, coins, _a, _b, payment, coin_ids, tx, gas, res;
|
|
46
|
-
var _c;
|
|
47
|
-
return __generator(this, function (_d) {
|
|
48
|
-
switch (_d.label) {
|
|
49
|
-
case 0:
|
|
50
|
-
coin_type = "0x2::sui::SUI";
|
|
51
|
-
_b = (_a = provider).getAllCoins;
|
|
52
|
-
_c = {};
|
|
53
|
-
return [4 /*yield*/, signer.getAddress()];
|
|
54
|
-
case 1: return [4 /*yield*/, _b.apply(_a, [(_c.owner = _d.sent(),
|
|
55
|
-
_c)])];
|
|
56
|
-
case 2:
|
|
57
|
-
coins = (_d.sent()).data;
|
|
58
|
-
// console.log(coins);
|
|
59
|
-
coins = coins.filter(function (c) { return c.coinType == coin_type && c.lockedUntilEpoch == null; });
|
|
60
|
-
payment = coins.pop();
|
|
61
|
-
coin_ids = coins.map(function (c) { return c.coinObjectId; });
|
|
62
|
-
tx = new sui_js_1.TransactionBlock();
|
|
63
|
-
tx.mergeCoins(tx.pure(coin_ids.pop()), coin_ids.map(function (id) { return tx.object(id); }));
|
|
64
|
-
tx.setGasBudget(100000000);
|
|
65
|
-
gas = { objectId: payment.coinObjectId, version: payment.version, digest: payment.digest };
|
|
66
|
-
tx.setGasPayment([gas]);
|
|
67
|
-
console.log(payment);
|
|
68
|
-
return [4 /*yield*/, signer.signAndExecuteTransactionBlock({ transactionBlock: tx })];
|
|
69
|
-
case 3:
|
|
70
|
-
res = _d.sent();
|
|
71
|
-
console.log(res);
|
|
72
|
-
return [2 /*return*/];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
43
|
-
var config_json_1 = __importDefault(require("../../config.json"));
|
|
44
|
-
var view_function_1 = require("../../utils/portfolio/multiple-collateral/view-function");
|
|
45
|
-
var portfolio_vault_1 = require("../../utils/portfolio/multiple-collateral/portfolio-vault");
|
|
46
|
-
var provider = new sui_js_1.JsonRpcProvider(new sui_js_1.Connection({ fullnode: config_json_1.default.RPC_ENDPOINT }));
|
|
47
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
-
var index, portfolioVaults, result;
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0:
|
|
52
|
-
index = "0";
|
|
53
|
-
return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_BID_VAULT_REGISTRY)];
|
|
54
|
-
case 1:
|
|
55
|
-
portfolioVaults = _a.sent();
|
|
56
|
-
return [4 /*yield*/, (0, view_function_1.getAuctionMaxSize)(provider, config_json_1.default.PORTFOLIO_PACKAGE, portfolioVaults[index].typeArgs, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, index)];
|
|
57
|
-
case 2:
|
|
58
|
-
result = _a.sent();
|
|
59
|
-
console.log(JSON.stringify(result, function (_, v) { return (typeof v === "bigint" ? "".concat(v) : v); }, 2));
|
|
60
|
-
return [2 /*return*/];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
43
|
-
var config_json_1 = __importDefault(require("../../config.json"));
|
|
44
|
-
var portfolio_vault_1 = require("../../utils/portfolio/multiple-collateral/portfolio-vault");
|
|
45
|
-
var dutch_1 = require("../../utils/typus-framework/dutch");
|
|
46
|
-
var provider = new sui_js_1.JsonRpcProvider(new sui_js_1.Connection({ fullnode: config_json_1.default.RPC_ENDPOINT }));
|
|
47
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
-
var index, portfolioVaults, bid;
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0:
|
|
52
|
-
index = "0";
|
|
53
|
-
return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.SINGLE_COLLATERAL_BID_VAULT_REGISTRY)];
|
|
54
|
-
case 1:
|
|
55
|
-
portfolioVaults = _a.sent();
|
|
56
|
-
return [4 /*yield*/, (0, dutch_1.getBids)(provider, portfolioVaults[index].auction)];
|
|
57
|
-
case 2:
|
|
58
|
-
bid = _a.sent();
|
|
59
|
-
console.log(bid);
|
|
60
|
-
return [2 /*return*/];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,63 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
43
|
-
var config_json_1 = __importDefault(require("../../config.json"));
|
|
44
|
-
var view_function_1 = require("../../utils/portfolio/multiple-collateral/view-function");
|
|
45
|
-
var portfolio_vault_1 = require("../../utils/portfolio/multiple-collateral/portfolio-vault");
|
|
46
|
-
var provider = new sui_js_1.JsonRpcProvider(new sui_js_1.Connection({ fullnode: config_json_1.default.RPC_ENDPOINT }));
|
|
47
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
-
var index, portfolioVaults, result;
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0:
|
|
52
|
-
index = "0";
|
|
53
|
-
return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_TOKEN_DEPOSIT_VAULT_REGISTRY, config_json_1.default.MULTIPLE_COLLATERAL_BID_VAULT_REGISTRY)];
|
|
54
|
-
case 1:
|
|
55
|
-
portfolioVaults = _a.sent();
|
|
56
|
-
return [4 /*yield*/, (0, view_function_1.getMaxLossPerUnit)(provider, config_json_1.default.PORTFOLIO_PACKAGE, portfolioVaults[index].typeArgs, config_json_1.default.MULTIPLE_COLLATERAL_REGISTRY, index)];
|
|
57
|
-
case 2:
|
|
58
|
-
result = _a.sent();
|
|
59
|
-
console.log(JSON.stringify(result, function (_, v) { return (typeof v === "bigint" ? "".concat(v) : v); }, 2));
|
|
60
|
-
return [2 /*return*/];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,62 +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
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
40
|
-
var portfolio_vault_1 = require("../../utils/portfolio/multiple-collateral/portfolio-vault");
|
|
41
|
-
var connection = new sui_js_1.Connection({
|
|
42
|
-
fullnode: 'https://rpc-testnet.suiscan.xyz:443',
|
|
43
|
-
});
|
|
44
|
-
// const connection = new Connection({ fullnode: "https://fullnode.testnet.sui.io:443" });
|
|
45
|
-
var provider = new sui_js_1.JsonRpcProvider(connection); //for read only operations
|
|
46
|
-
var registry = "0x5083936779bd8bbc26f374baf90981ad5af8f57fe22920105aa47d4e012364de";
|
|
47
|
-
var token_deposit_vault_registry = "0x5a2a467af76e2fc84e98336478224ae81c222e5a8162af4a575302867edbcb56";
|
|
48
|
-
var usd_deposit_vault_registry = "0xe33913a1152396ea7efb726d1333e54efae3e48fe1ae3fd8ea5a9d5cfeae3f2f";
|
|
49
|
-
var bid_vault_registry = "0xd492fe560cba6f9aa061d4f4dbdfb48f13f5d1536a1583b2cf583b5a1e944fc6";
|
|
50
|
-
;
|
|
51
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
-
var result;
|
|
53
|
-
return __generator(this, function (_a) {
|
|
54
|
-
switch (_a.label) {
|
|
55
|
-
case 0: return [4 /*yield*/, (0, portfolio_vault_1.getPortfolioVaults)(provider, registry, token_deposit_vault_registry, usd_deposit_vault_registry, bid_vault_registry)];
|
|
56
|
-
case 1:
|
|
57
|
-
result = _a.sent();
|
|
58
|
-
console.log(JSON.stringify(result, function (_, v) { return (typeof v === 'bigint' ? "".concat(v) : v); }, 2));
|
|
59
|
-
return [2 /*return*/];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,60 +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
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
40
|
-
var user_share_1 = require("../../utils/portfolio/multiple-collateral/user-share");
|
|
41
|
-
var connection = new sui_js_1.Connection({ fullnode: "https://rpc-testnet.suiscan.xyz:443" });
|
|
42
|
-
// const connection = new Connection({ fullnode: "https://fullnode.testnet.sui.io:443" });
|
|
43
|
-
var provider = new sui_js_1.JsonRpcProvider(connection); //for read only operations
|
|
44
|
-
var packageId = "0xab7e0bab5980ad0b55d3fae9d64c1bd41043a3bf383ff41dbc7f0c4ffe766213";
|
|
45
|
-
var registry = "0x5083936779bd8bbc26f374baf90981ad5af8f57fe22920105aa47d4e012364de";
|
|
46
|
-
var user = "0x603272d1e61de086a18751482684f882642eb080144aee425c4c34b5e56470b0";
|
|
47
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
-
var indexes, result;
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0:
|
|
52
|
-
indexes = ["0", "1", "2"];
|
|
53
|
-
return [4 /*yield*/, (0, user_share_1.getUserShares)(provider, packageId, registry, indexes, user)];
|
|
54
|
-
case 1:
|
|
55
|
-
result = _a.sent();
|
|
56
|
-
console.log(JSON.stringify(result, function (_, v) { return (typeof v === "bigint" ? "".concat(v) : v); }, 2));
|
|
57
|
-
return [2 /*return*/];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}); })();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,88 +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
|
-
var constants_1 = require("../../../constants");
|
|
40
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
41
|
-
var getAuthorizedNewPortfolioVaultTx_1 = require("../../../utils/portfolio/single-collateral/authorized/getAuthorizedNewPortfolioVaultTx");
|
|
42
|
-
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.devnetConnection); //for read only operations
|
|
43
|
-
var keypair = sui_js_1.Ed25519Keypair.deriveKeypair(String(process.env.MNEMONIC));
|
|
44
|
-
var signer = new sui_js_1.RawSigner(keypair, provider);
|
|
45
|
-
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
-
var typeArguments, optionType, period, activationTsMs, expirationTsMs, dTokenDecimal, bTokenDecimal, oTokenDecimal, capacity, strikePct, weight, isBuyer, strikeIncrement, lotSize, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, whitelist, leverage, hasNext, gasBudget, claimTx, res;
|
|
47
|
-
return __generator(this, function (_a) {
|
|
48
|
-
switch (_a.label) {
|
|
49
|
-
case 0:
|
|
50
|
-
typeArguments = [
|
|
51
|
-
"0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC",
|
|
52
|
-
"0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC",
|
|
53
|
-
"0x8ccdddc0e8d9287953375ae83cda731d7c75e0ec::btc::BTC",
|
|
54
|
-
];
|
|
55
|
-
optionType = "0";
|
|
56
|
-
period = "0";
|
|
57
|
-
activationTsMs = "1678694400000";
|
|
58
|
-
expirationTsMs = "1678780800000";
|
|
59
|
-
dTokenDecimal = "9";
|
|
60
|
-
bTokenDecimal = "9";
|
|
61
|
-
oTokenDecimal = "9";
|
|
62
|
-
capacity = "1000000000000";
|
|
63
|
-
strikePct = ["10254"];
|
|
64
|
-
weight = ["1"];
|
|
65
|
-
isBuyer = [false];
|
|
66
|
-
strikeIncrement = "20000000000";
|
|
67
|
-
lotSize = "100000";
|
|
68
|
-
decaySpeed = "1";
|
|
69
|
-
initialPrice = "12176899";
|
|
70
|
-
finalPrice = "1791643";
|
|
71
|
-
auctionDurationInMs = "3600000";
|
|
72
|
-
whitelist = [];
|
|
73
|
-
leverage = "100";
|
|
74
|
-
hasNext = true;
|
|
75
|
-
gasBudget = 100000;
|
|
76
|
-
return [4 /*yield*/, (0, getAuthorizedNewPortfolioVaultTx_1.getAuthorizedNewPortfolioVaultTx)(gasBudget, constants_1.PORTFOLIO_PACKAGE, constants_1.REGISTRY, typeArguments, constants_1.TIME_ORACLE, optionType, period, activationTsMs, expirationTsMs, dTokenDecimal, bTokenDecimal, oTokenDecimal, capacity, strikePct, weight, isBuyer, strikeIncrement, lotSize, decaySpeed, initialPrice, finalPrice, auctionDurationInMs, whitelist, leverage, hasNext)];
|
|
77
|
-
case 1:
|
|
78
|
-
claimTx = _a.sent();
|
|
79
|
-
return [4 /*yield*/, signer.signAndExecuteTransactionBlock({
|
|
80
|
-
transactionBlock: claimTx,
|
|
81
|
-
})];
|
|
82
|
-
case 2:
|
|
83
|
-
res = _a.sent();
|
|
84
|
-
console.log(res);
|
|
85
|
-
return [2 /*return*/];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}); })();
|