@typus/typus-sdk 1.0.22 → 1.0.24
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/utils/portfolio/{single-collateral/getMintTx.js → mint.js} +3 -5
- package/lib/utils/portfolio/multiple-collateral/user-entry.d.ts +13 -4
- package/lib/utils/portfolio/multiple-collateral/user-entry.js +13 -4
- package/lib/utils/portfolio/single-collateral/user-entry.d.ts +81 -0
- package/lib/utils/portfolio/single-collateral/user-entry.js +247 -0
- package/package.json +1 -1
- package/lib/scripts/sui.d.ts +0 -1
- package/lib/scripts/sui.js +0 -174
- 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/utils/auction/getBid.d.ts +0 -3
- package/lib/utils/auction/getBid.js +0 -75
- package/lib/utils/portfolio/single-collateral/fetchData.d.ts +0 -97
- package/lib/utils/portfolio/single-collateral/fetchData.js +0 -34
- package/lib/utils/portfolio/single-collateral/getTypeArgumentFromToken.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/getTypeArgumentFromToken.js +0 -74
- package/lib/utils/portfolio/single-collateral/getVaultData.d.ts +0 -15
- package/lib/utils/portfolio/single-collateral/getVaultData.js +0 -315
- package/lib/utils/portfolio/single-collateral/getWhiteListFromRegistry.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/getWhiteListFromRegistry.js +0 -73
- package/lib/utils/portfolio/single-collateral/user/getClaimAndHarvestTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getClaimAndHarvestTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getClaimTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getClaimTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getCompoundTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getCompoundTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getDepositTx.d.ts +0 -12
- package/lib/utils/portfolio/single-collateral/user/getDepositTx.js +0 -69
- package/lib/utils/portfolio/single-collateral/user/getHarvestTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getHarvestTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getNewBidTx.d.ts +0 -14
- package/lib/utils/portfolio/single-collateral/user/getNewBidTx.js +0 -78
- package/lib/utils/portfolio/single-collateral/user/getUnsubscribeTx.d.ts +0 -10
- package/lib/utils/portfolio/single-collateral/user/getUnsubscribeTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/user/getWithdrawTx.d.ts +0 -11
- package/lib/utils/portfolio/single-collateral/user/getWithdrawTx.js +0 -67
- /package/lib/utils/portfolio/{single-collateral/getLeaderBoard.d.ts → leader-board.d.ts} +0 -0
- /package/lib/utils/portfolio/{single-collateral/getLeaderBoard.js → leader-board.js} +0 -0
- /package/lib/utils/portfolio/{single-collateral/getMintTx.d.ts → mint.d.ts} +0 -0
|
@@ -1,130 +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 typed_rpc_1 = require("typed-rpc");
|
|
41
|
-
var constants_1 = require("../constants");
|
|
42
|
-
var getDepositTx_1 = require("../utils/portfolio/single-collateral/user/getDepositTx");
|
|
43
|
-
// The initiator of the transaction
|
|
44
|
-
var SENDER_ADDRESS = "0xb6c7e3b1c61ee81516a8317f221daa035f1503e0ac3ae7a50b61834bc7a3ead9";
|
|
45
|
-
var SENDER_RECOVERY_PHRASE = "TEST_MNEMONIC";
|
|
46
|
-
// gas budget, in MIST
|
|
47
|
-
var GAS_BUDGET = 5000000;
|
|
48
|
-
// Gas Station endpoint:
|
|
49
|
-
var SPONSOR_RPC_URL = "https://api.shinami.com/gas/v1/sui_testnet_17aa4c66d7a325601abde1f043793003";
|
|
50
|
-
// Sui Node endpoint:
|
|
51
|
-
var connection = new sui_js_1.Connection({
|
|
52
|
-
fullnode: "https://node.shinami.com:443/api/v1/sui_testnet_c702de54dad05016124f2cfabc1de7e8",
|
|
53
|
-
});
|
|
54
|
-
var suiProvider = new sui_js_1.JsonRpcProvider(connection);
|
|
55
|
-
// Create the sender's address key pair from the recovery phrase
|
|
56
|
-
var keyPair = sui_js_1.Ed25519Keypair.deriveKeypair(SENDER_RECOVERY_PHRASE);
|
|
57
|
-
// Create the sender's address key pair from the sender's private key
|
|
58
|
-
// const buf = Buffer.from(SENDER_PRIVATE_KEY, "base64");
|
|
59
|
-
// const keyPair = Ed25519Keypair.fromSecretKey(buf.slice(1));
|
|
60
|
-
// Create a signer for the sender's keypair
|
|
61
|
-
var signer = new sui_js_1.RawSigner(keyPair, suiProvider);
|
|
62
|
-
var sponsor = (0, typed_rpc_1.rpcClient)(SPONSOR_RPC_URL);
|
|
63
|
-
// Different examples of programmable transaction blocks that can be crafted.
|
|
64
|
-
var progTxnTransfer = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
-
var gasBudget, typeArguments, vaultIndex, coins, depositAmount, transactionBlock;
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0:
|
|
69
|
-
gasBudget = 100000000;
|
|
70
|
-
typeArguments = [
|
|
71
|
-
"0xd175cff04f1d49574efb6f138bc3b9b7313915a57b5ca04141fb1cb4f66984b2::eth::ETH",
|
|
72
|
-
"0xd175cff04f1d49574efb6f138bc3b9b7313915a57b5ca04141fb1cb4f66984b2::eth::ETH",
|
|
73
|
-
"0xd175cff04f1d49574efb6f138bc3b9b7313915a57b5ca04141fb1cb4f66984b2::eth::ETH",
|
|
74
|
-
];
|
|
75
|
-
vaultIndex = "4";
|
|
76
|
-
coins = [
|
|
77
|
-
"0x07bb1b0bd176a5e9e0377758282bd0eb27070f2684a88a2cf57964fb4da11c0d",
|
|
78
|
-
"0x2a908b66b02c450fefbede9ef02672dc2291163284e59fd90841a6024bf3aa82",
|
|
79
|
-
"0x99711f3c9a87b3ba9c9a61a6dbb4022f24799a8814c419f106cedc2c2f7b70b1",
|
|
80
|
-
"0xad5ae185437c4ef43d571e7efd188a849e6b5bf49cbd810e90b775458a8495e6",
|
|
81
|
-
"0xb9c0ef30cf9729d6ad54d3a17b524010d494eb5c16fa9b4d4859998dde485282",
|
|
82
|
-
"0xcbc37498f1be79ef68f8a01e025dfa7c83203c9e50f8eebef8b7108cacba1691",
|
|
83
|
-
"0xd162905fccb0332a99b5f5f00172a11d1e5c3e7feb9590165b02e19e5f7ba8b5",
|
|
84
|
-
"0xdd489edccfba1f64d02fd693c22d5faa069d6d3bb65b33b24e5a5d12f99dadce",
|
|
85
|
-
"0xf5426d21d861dc22aef1b78cb7ade67793ff1caa2d2004324954855c203a48bc",
|
|
86
|
-
];
|
|
87
|
-
depositAmount = "100000000";
|
|
88
|
-
return [4 /*yield*/, (0, getDepositTx_1.getDepositTx)(gasBudget, constants_1.PORTFOLIO_PACKAGE, constants_1.MODULE, constants_1.REGISTRY, typeArguments, vaultIndex, coins, depositAmount)];
|
|
89
|
-
case 1:
|
|
90
|
-
transactionBlock = _a.sent();
|
|
91
|
-
return [2 /*return*/, transactionBlock];
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}); };
|
|
95
|
-
var sponsorTransactionE2E = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
|
-
var gaslessTxb, gaslessPayloadBytes, gaslessPayloadBase64, sponsoredResponse, sponsoredStatus, senderSig, executeResponse;
|
|
97
|
-
var _a;
|
|
98
|
-
return __generator(this, function (_b) {
|
|
99
|
-
switch (_b.label) {
|
|
100
|
-
case 0:
|
|
101
|
-
gaslessTxb = progTxnTransfer();
|
|
102
|
-
return [4 /*yield*/, gaslessTxb];
|
|
103
|
-
case 1: return [4 /*yield*/, (_b.sent()).build({ provider: suiProvider, onlyTransactionKind: true })];
|
|
104
|
-
case 2:
|
|
105
|
-
gaslessPayloadBytes = _b.sent();
|
|
106
|
-
gaslessPayloadBase64 = btoa(gaslessPayloadBytes.reduce(function (data, byte) { return data + String.fromCharCode(byte); }, ""));
|
|
107
|
-
return [4 /*yield*/, sponsor.gas_sponsorTransactionBlock(gaslessPayloadBase64, SENDER_ADDRESS, GAS_BUDGET)];
|
|
108
|
-
case 3:
|
|
109
|
-
sponsoredResponse = _b.sent();
|
|
110
|
-
return [4 /*yield*/, sponsor.gas_getSponsoredTransactionBlockStatus(sponsoredResponse.txDigest)];
|
|
111
|
-
case 4:
|
|
112
|
-
sponsoredStatus = _b.sent();
|
|
113
|
-
console.log("Sponsorship Status:", sponsoredStatus);
|
|
114
|
-
return [4 /*yield*/, signer.signTransactionBlock({ transactionBlock: sui_js_1.TransactionBlock.from(sponsoredResponse.txBytes) })];
|
|
115
|
-
case 5:
|
|
116
|
-
senderSig = _b.sent();
|
|
117
|
-
return [4 /*yield*/, suiProvider.executeTransactionBlock({
|
|
118
|
-
transactionBlock: sponsoredResponse.txBytes,
|
|
119
|
-
signature: [senderSig.signature, sponsoredResponse.signature],
|
|
120
|
-
options: { showEffects: true },
|
|
121
|
-
requestType: "WaitForLocalExecution",
|
|
122
|
-
})];
|
|
123
|
-
case 6:
|
|
124
|
-
executeResponse = _b.sent();
|
|
125
|
-
console.log("Execution Status:", (_a = executeResponse.effects) === null || _a === void 0 ? void 0 : _a.status.status);
|
|
126
|
-
return [2 /*return*/];
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}); };
|
|
130
|
-
sponsorTransactionE2E();
|
|
@@ -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
|
-
exports.getBid = void 0;
|
|
40
|
-
var constants_1 = require("../../constants");
|
|
41
|
-
function getBid(portfolioVault, provider) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
-
var obj2, ids, tmp, bids;
|
|
44
|
-
return __generator(this, function (_a) {
|
|
45
|
-
switch (_a.label) {
|
|
46
|
-
case 0: return [4 /*yield*/, provider.getDynamicFields({ parentId: portfolioVault.auction.bids })];
|
|
47
|
-
case 1:
|
|
48
|
-
obj2 = (_a.sent()).data;
|
|
49
|
-
ids = obj2.map(function (e) { return e.objectId; });
|
|
50
|
-
return [4 /*yield*/, provider.multiGetObjects({
|
|
51
|
-
ids: ids,
|
|
52
|
-
options: { showContent: true },
|
|
53
|
-
})];
|
|
54
|
-
case 2:
|
|
55
|
-
tmp = _a.sent();
|
|
56
|
-
bids = tmp.map(function (e) {
|
|
57
|
-
var _a;
|
|
58
|
-
//@ts-ignore
|
|
59
|
-
var bidData = (_a = e.data) === null || _a === void 0 ? void 0 : _a.content.fields.value.fields;
|
|
60
|
-
// console.log(bidData);
|
|
61
|
-
var res = {
|
|
62
|
-
price: bidData.price,
|
|
63
|
-
size: Number(bidData.size / Math.pow(10, constants_1.TOKEN_DECIMAL)).toString(),
|
|
64
|
-
tsMs: bidData.ts_ms,
|
|
65
|
-
tokenBalance: bidData.balance,
|
|
66
|
-
ownerAddress: bidData.bidder,
|
|
67
|
-
};
|
|
68
|
-
return res;
|
|
69
|
-
});
|
|
70
|
-
return [2 /*return*/, bids];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
exports.getBid = getBid;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
export interface PortfolioVault {
|
|
2
|
-
vaultId: string;
|
|
3
|
-
typeArgs: string[];
|
|
4
|
-
assets: string[];
|
|
5
|
-
info: Info;
|
|
6
|
-
config: Config;
|
|
7
|
-
depositVault: DepositVault;
|
|
8
|
-
bidVault: BidVault;
|
|
9
|
-
auction: Auction;
|
|
10
|
-
authority: string[];
|
|
11
|
-
tvl: string;
|
|
12
|
-
}
|
|
13
|
-
export interface Info {
|
|
14
|
-
index: string;
|
|
15
|
-
creator: string;
|
|
16
|
-
createTsMs: string;
|
|
17
|
-
round: string;
|
|
18
|
-
deliveryInfo: DeliveryInfo;
|
|
19
|
-
}
|
|
20
|
-
export interface Config {
|
|
21
|
-
optionType: string;
|
|
22
|
-
period: number;
|
|
23
|
-
activationTsMs: string;
|
|
24
|
-
expirationTsMs: string;
|
|
25
|
-
dTokenDecimal: string;
|
|
26
|
-
bTokenDecimal: string;
|
|
27
|
-
oTokenDecimal: string;
|
|
28
|
-
lotSize: string;
|
|
29
|
-
capacity: string;
|
|
30
|
-
leverage: string;
|
|
31
|
-
hasNext: boolean;
|
|
32
|
-
activeVaultConfig: VaultConfig;
|
|
33
|
-
warmupVaultConfig: VaultConfig;
|
|
34
|
-
upcomingVaultConfig: VaultConfig;
|
|
35
|
-
}
|
|
36
|
-
export declare function parseVaultConfig(vaultConfigF: any): VaultConfig;
|
|
37
|
-
export declare function parsePayoffConfig(payoffConfigF: any): PayoffConfig;
|
|
38
|
-
export interface PayoffConfig {
|
|
39
|
-
strikePct: string;
|
|
40
|
-
weight: string;
|
|
41
|
-
isBuyer: boolean;
|
|
42
|
-
strike: string;
|
|
43
|
-
}
|
|
44
|
-
export interface VaultConfig {
|
|
45
|
-
payoffConfigs: PayoffConfig[];
|
|
46
|
-
strikeIncrement: string;
|
|
47
|
-
decaySpeed: string;
|
|
48
|
-
initialPrice: string;
|
|
49
|
-
finalPrice: string;
|
|
50
|
-
auctionDurationInMs: string;
|
|
51
|
-
}
|
|
52
|
-
export interface DeliveryInfo {
|
|
53
|
-
round: string;
|
|
54
|
-
price: string;
|
|
55
|
-
size: string;
|
|
56
|
-
premium: string;
|
|
57
|
-
tsMs: string;
|
|
58
|
-
}
|
|
59
|
-
export interface DepositVault {
|
|
60
|
-
activeSubVault: SubVault;
|
|
61
|
-
deactivatingSubVault: SubVault;
|
|
62
|
-
inactiveSubVault: SubVault;
|
|
63
|
-
warmupSubVault: SubVault;
|
|
64
|
-
hasNext: boolean;
|
|
65
|
-
}
|
|
66
|
-
export interface BidVault {
|
|
67
|
-
bidderSubVault: SubVault;
|
|
68
|
-
premiumSubVault: SubVault;
|
|
69
|
-
performanceFeeSubVault: SubVault;
|
|
70
|
-
}
|
|
71
|
-
export interface SubVault {
|
|
72
|
-
balance: string;
|
|
73
|
-
shareSupply: string;
|
|
74
|
-
}
|
|
75
|
-
export declare function parseSubVault(subVaultF: any): SubVault;
|
|
76
|
-
export interface Auction {
|
|
77
|
-
startTsMs: string;
|
|
78
|
-
endTsMs: string;
|
|
79
|
-
priceConfig: PriceConfig;
|
|
80
|
-
index: string;
|
|
81
|
-
bids: string;
|
|
82
|
-
ownerships: string;
|
|
83
|
-
totalBidSize: string;
|
|
84
|
-
ableToRemoveBid: boolean;
|
|
85
|
-
}
|
|
86
|
-
export interface PriceConfig {
|
|
87
|
-
decaySpeed: string;
|
|
88
|
-
initialPrice: string;
|
|
89
|
-
finalPrice: string;
|
|
90
|
-
}
|
|
91
|
-
export interface Bid {
|
|
92
|
-
price: string;
|
|
93
|
-
size: string;
|
|
94
|
-
tsMs: string;
|
|
95
|
-
tokenBalance: string;
|
|
96
|
-
ownerAddress: string;
|
|
97
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSubVault = exports.parsePayoffConfig = exports.parseVaultConfig = void 0;
|
|
4
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
5
|
-
var provider = new sui_js_1.JsonRpcProvider(sui_js_1.devnetConnection); //for read only operations
|
|
6
|
-
var decode = function (str) { return Buffer.from(str, "base64").toString("binary"); };
|
|
7
|
-
function parseVaultConfig(vaultConfigF) {
|
|
8
|
-
var payoffConfigs = vaultConfigF.payoff_configs.map(function (x) { return parsePayoffConfig(x.fields); });
|
|
9
|
-
return {
|
|
10
|
-
payoffConfigs: payoffConfigs,
|
|
11
|
-
strikeIncrement: vaultConfigF.strike_increment,
|
|
12
|
-
decaySpeed: vaultConfigF.decay_speed,
|
|
13
|
-
initialPrice: vaultConfigF.initial_price,
|
|
14
|
-
finalPrice: vaultConfigF.final_price,
|
|
15
|
-
auctionDurationInMs: vaultConfigF.auction_duration_in_ms,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
exports.parseVaultConfig = parseVaultConfig;
|
|
19
|
-
function parsePayoffConfig(payoffConfigF) {
|
|
20
|
-
return {
|
|
21
|
-
strikePct: payoffConfigF.strike_pct,
|
|
22
|
-
weight: payoffConfigF.weight,
|
|
23
|
-
isBuyer: payoffConfigF.is_buyer,
|
|
24
|
-
strike: payoffConfigF.strike,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.parsePayoffConfig = parsePayoffConfig;
|
|
28
|
-
function parseSubVault(subVaultF) {
|
|
29
|
-
return {
|
|
30
|
-
balance: subVaultF.balance,
|
|
31
|
-
shareSupply: subVaultF.share_supply,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
exports.parseSubVault = parseSubVault;
|
|
@@ -1,74 +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.getTypeArgumentFromToken = void 0;
|
|
40
|
-
function getTypeArgumentFromToken(token, provider) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
-
var tokenInfo, typeArgument, e_1;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
_a.trys.push([0, 2, , 3]);
|
|
47
|
-
return [4 /*yield*/, provider.getObject({
|
|
48
|
-
id: token,
|
|
49
|
-
options: { showContent: true },
|
|
50
|
-
})];
|
|
51
|
-
case 1:
|
|
52
|
-
tokenInfo = _a.sent();
|
|
53
|
-
if (tokenInfo.error !== undefined) {
|
|
54
|
-
console.log("obj not exists, but is:");
|
|
55
|
-
console.log(tokenInfo.error.code);
|
|
56
|
-
return [2 /*return*/];
|
|
57
|
-
}
|
|
58
|
-
1;
|
|
59
|
-
console.log(tokenInfo);
|
|
60
|
-
typeArgument = tokenInfo.data.content.type;
|
|
61
|
-
console.log(typeArgument);
|
|
62
|
-
typeArgument = typeArgument.split("<")[1];
|
|
63
|
-
typeArgument = typeArgument.split(">")[0];
|
|
64
|
-
return [2 /*return*/, typeArgument];
|
|
65
|
-
case 2:
|
|
66
|
-
e_1 = _a.sent();
|
|
67
|
-
console.error(e_1);
|
|
68
|
-
return [3 /*break*/, 3];
|
|
69
|
-
case 3: return [2 /*return*/];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
exports.getTypeArgumentFromToken = getTypeArgumentFromToken;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider } from "@mysten/sui.js";
|
|
2
|
-
import { PortfolioVault } from "./fetchData";
|
|
3
|
-
export declare function getVaultDataFromRegistry(registry: string, provider: JsonRpcProvider, index?: string): Promise<PortfolioVault[]>;
|
|
4
|
-
export declare function getNodesKeyFromLinkedList(linkedList: string, provider: JsonRpcProvider): Promise<string[]>;
|
|
5
|
-
export declare function getUserShares(user_share_registry: string, provider: JsonRpcProvider, user: string): Promise<Share[]>;
|
|
6
|
-
export interface Share {
|
|
7
|
-
index: string;
|
|
8
|
-
tag: string;
|
|
9
|
-
value: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function getUserInfo(user_share_registry: string, provider: JsonRpcProvider): Promise<UserInfo[]>;
|
|
12
|
-
export interface UserInfo {
|
|
13
|
-
user: string;
|
|
14
|
-
shares: Share[];
|
|
15
|
-
}
|