@typus/typus-sdk 1.0.2 → 1.0.3
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 +20 -0
- package/lib/constants.d.ts +26 -0
- package/lib/constants.js +37 -0
- package/lib/scripts/getSubVault.d.ts +0 -0
- package/lib/scripts/getSubVault.js +6 -0
- package/lib/scripts/sui.d.ts +1 -0
- package/lib/scripts/sui.js +174 -0
- package/lib/test/authorized/testAuthorizedNewPortfolioVault.d.ts +1 -0
- package/lib/test/authorized/testAuthorizedNewPortfolioVault.js +82 -0
- package/lib/test/authorized/testAuthorizedUpdateUpcomingVaultConfig.d.ts +1 -0
- package/lib/test/authorized/testAuthorizedUpdateUpcomingVaultConfig.js +71 -0
- package/lib/test/authorized/testAuthorizedUpdateWarmupVaultConfig.d.ts +1 -0
- package/lib/test/authorized/testAuthorizedUpdateWarmupVaultConfig.js +68 -0
- package/lib/test/getBidData.d.ts +1 -0
- package/lib/test/getBidData.js +55 -0
- package/lib/test/getVaultData.d.ts +1 -0
- package/lib/test/getVaultData.js +55 -0
- package/lib/test/getWhiteListFromRegistry.d.ts +1 -0
- package/lib/test/getWhiteListFromRegistry.js +55 -0
- package/lib/test/helper/getAuctionMaxSize.d.ts +1 -0
- package/lib/test/helper/getAuctionMaxSize.js +76 -0
- package/lib/test/helper/getUserStatus.d.ts +1 -0
- package/lib/test/helper/getUserStatus.js +83 -0
- package/lib/test/testCrypto.d.ts +1 -0
- package/lib/test/testCrypto.js +54 -0
- package/lib/test/testMint.d.ts +1 -0
- package/lib/test/testMint.js +137 -0
- package/lib/test/testSubscribeEvent.d.ts +1 -0
- package/lib/test/testSubscribeEvent.js +97 -0
- package/lib/test/user/testClaim.d.ts +1 -0
- package/lib/test/user/testClaim.js +68 -0
- package/lib/test/user/testCompound.d.ts +1 -0
- package/lib/test/user/testCompound.js +68 -0
- package/lib/test/user/testDeposit.d.ts +1 -0
- package/lib/test/user/testDeposit.js +79 -0
- package/lib/test/user/testHarvest.d.ts +1 -0
- package/lib/test/user/testHarvest.js +68 -0
- package/lib/test/user/testNewBid.d.ts +1 -0
- 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/user/testWithdraw.js +70 -0
- package/lib/utils/auction/getBid.d.ts +3 -0
- package/lib/utils/auction/getBid.js +77 -0
- package/lib/utils/auction/sealedAuction.d.ts +33 -0
- package/lib/utils/auction/sealedAuction.js +64 -0
- package/lib/utils/fetchData.d.ts +96 -0
- package/lib/utils/fetchData.js +34 -0
- package/lib/utils/getMintTx.d.ts +1 -0
- package/lib/utils/getMintTx.js +62 -0
- package/lib/utils/getTypeArgumentFromToken.d.ts +2 -0
- package/lib/utils/getTypeArgumentFromToken.js +68 -0
- package/lib/utils/getVaultData.d.ts +5 -0
- package/lib/utils/getVaultData.js +242 -0
- package/lib/utils/getWhiteListFromRegistry.d.ts +2 -0
- package/lib/utils/getWhiteListFromRegistry.js +70 -0
- package/lib/utils/portfolio/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.d.ts +4 -0
- package/lib/utils/portfolio/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.js +63 -0
- package/lib/utils/portfolio/authorized/getAuthorizedDeliveryTx.d.ts +1 -0
- package/lib/utils/portfolio/authorized/getAuthorizedDeliveryTx.js +61 -0
- package/lib/utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx.d.ts +38 -0
- package/lib/utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx.js +116 -0
- package/lib/utils/portfolio/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.d.ts +4 -0
- package/lib/utils/portfolio/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.js +63 -0
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateCapacityTx.d.ts +1 -0
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateCapacityTx.js +60 -0
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.d.ts +4 -0
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.js +70 -0
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateWarmupVaultConfigTx.d.ts +1 -0
- package/lib/utils/portfolio/authorized/getAuthorizedUpdateWarmupVaultConfigTx.js +64 -0
- package/lib/utils/portfolio/helper/getAuctionMaxSize.d.ts +8 -0
- package/lib/utils/portfolio/helper/getAuctionMaxSize.js +66 -0
- package/lib/utils/portfolio/helper/getUserStatus.d.ts +29 -0
- package/lib/utils/portfolio/helper/getUserStatus.js +102 -0
- package/lib/utils/portfolio/manager/getAddAuthorizedUserTx.d.ts +8 -0
- package/lib/utils/portfolio/manager/getAddAuthorizedUserTx.js +67 -0
- package/lib/utils/portfolio/manager/getAddPortfolioVaultAuthorizedUserTx.d.ts +10 -0
- package/lib/utils/portfolio/manager/getAddPortfolioVaultAuthorizedUserTx.js +70 -0
- package/lib/utils/portfolio/manager/getCloseAuctionTx.d.ts +1 -0
- package/lib/utils/portfolio/manager/getCloseAuctionTx.js +62 -0
- package/lib/utils/portfolio/manager/getCloseVaultTx.d.ts +1 -0
- package/lib/utils/portfolio/manager/getCloseVaultTx.js +60 -0
- package/lib/utils/portfolio/manager/getDeliveryTx.d.ts +1 -0
- package/lib/utils/portfolio/manager/getDeliveryTx.js +62 -0
- package/lib/utils/portfolio/manager/getEvolutionTx.d.ts +15 -0
- package/lib/utils/portfolio/manager/getEvolutionTx.js +78 -0
- package/lib/utils/portfolio/manager/getNewManagerTx.d.ts +8 -0
- package/lib/utils/portfolio/manager/getNewManagerTx.js +66 -0
- package/lib/utils/portfolio/manager/getNewPortfolioVaultTx.d.ts +38 -0
- package/lib/utils/portfolio/manager/getNewPortfolioVaultTx.js +116 -0
- package/lib/utils/portfolio/manager/getRemoveAuthorizedUserTx.d.ts +8 -0
- package/lib/utils/portfolio/manager/getRemoveAuthorizedUserTx.js +67 -0
- package/lib/utils/portfolio/manager/getRemoveManagerTx.d.ts +6 -0
- package/lib/utils/portfolio/manager/getRemoveManagerTx.js +63 -0
- package/lib/utils/portfolio/manager/getRemovePortfolioVaultAuthorizedUserTx.d.ts +10 -0
- package/lib/utils/portfolio/manager/getRemovePortfolioVaultAuthorizedUserTx.js +70 -0
- package/lib/utils/portfolio/manager/getUpdateCapacityTx.d.ts +1 -0
- package/lib/utils/portfolio/manager/getUpdateCapacityTx.js +61 -0
- package/lib/utils/portfolio/user/getClaimAndHarvestTx.d.ts +9 -0
- package/lib/utils/portfolio/user/getClaimAndHarvestTx.js +67 -0
- package/lib/utils/portfolio/user/getClaimTx.d.ts +9 -0
- package/lib/utils/portfolio/user/getClaimTx.js +67 -0
- package/lib/utils/portfolio/user/getCompoundTx.d.ts +9 -0
- package/lib/utils/portfolio/user/getCompoundTx.js +67 -0
- package/lib/utils/portfolio/user/getDepositTx.d.ts +11 -0
- package/lib/utils/portfolio/user/getDepositTx.js +71 -0
- package/lib/utils/portfolio/user/getHarvestTx.d.ts +9 -0
- package/lib/utils/portfolio/user/getHarvestTx.js +67 -0
- package/lib/utils/portfolio/user/getNewBidTx.d.ts +13 -0
- package/lib/utils/portfolio/user/getNewBidTx.js +75 -0
- package/lib/utils/portfolio/user/getUnsubscribeTx.d.ts +10 -0
- package/lib/utils/portfolio/user/getUnsubscribeTx.js +69 -0
- package/lib/utils/portfolio/user/getWithdrawTx.d.ts +10 -0
- package/lib/utils/portfolio/user/getWithdrawTx.js +69 -0
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
vaultBidPrice: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Info {
|
|
15
|
+
index: string;
|
|
16
|
+
creator: string;
|
|
17
|
+
createTsMs: string;
|
|
18
|
+
round: string;
|
|
19
|
+
deliveryInfo: DeliveryInfo;
|
|
20
|
+
}
|
|
21
|
+
export interface Config {
|
|
22
|
+
optionType: string;
|
|
23
|
+
period: string;
|
|
24
|
+
activationTsMs: string;
|
|
25
|
+
expirationTsMs: string;
|
|
26
|
+
dTokenDecimal: string;
|
|
27
|
+
bTokenDecimal: string;
|
|
28
|
+
oTokenDecimal: string;
|
|
29
|
+
lotSize: string;
|
|
30
|
+
capacity: string;
|
|
31
|
+
leverage: string;
|
|
32
|
+
hasNext: boolean;
|
|
33
|
+
activeVaultConfig: VaultConfig;
|
|
34
|
+
warmupVaultConfig: VaultConfig;
|
|
35
|
+
upcomingVaultConfig: VaultConfig;
|
|
36
|
+
}
|
|
37
|
+
export declare function parseVaultConfig(vaultConfigF: any): VaultConfig;
|
|
38
|
+
export declare function parsePayoffConfig(payoffConfigF: any): PayoffConfig;
|
|
39
|
+
export interface PayoffConfig {
|
|
40
|
+
strikePct: string;
|
|
41
|
+
weight: string;
|
|
42
|
+
isBuyer: boolean;
|
|
43
|
+
strike: string;
|
|
44
|
+
}
|
|
45
|
+
export interface VaultConfig {
|
|
46
|
+
payoffConfigs: PayoffConfig[];
|
|
47
|
+
strikeIncrement: string;
|
|
48
|
+
decaySpeed: string;
|
|
49
|
+
initialPrice: string;
|
|
50
|
+
finalPrice: string;
|
|
51
|
+
auctionDurationInMs: string;
|
|
52
|
+
}
|
|
53
|
+
export interface DeliveryInfo {
|
|
54
|
+
round: string;
|
|
55
|
+
price: string;
|
|
56
|
+
size: string;
|
|
57
|
+
premium: string;
|
|
58
|
+
tsMs: string;
|
|
59
|
+
}
|
|
60
|
+
export interface DepositVault {
|
|
61
|
+
activeSubVault: SubVault;
|
|
62
|
+
deactivatingSubVault: SubVault;
|
|
63
|
+
inactiveSubVault: SubVault;
|
|
64
|
+
warmupSubVault: SubVault;
|
|
65
|
+
hasNext: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface BidVault {
|
|
68
|
+
bidderSubVault: SubVault;
|
|
69
|
+
premiumSubVault: SubVault;
|
|
70
|
+
performanceFeeSubVault: SubVault;
|
|
71
|
+
}
|
|
72
|
+
export interface SubVault {
|
|
73
|
+
balance: string;
|
|
74
|
+
shareSupply: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function parseSubVault(subVaultF: any): SubVault;
|
|
77
|
+
export interface Auction {
|
|
78
|
+
startTsMs: string;
|
|
79
|
+
endTsMs: string;
|
|
80
|
+
priceConfig: PriceConfig;
|
|
81
|
+
index: string;
|
|
82
|
+
totalBidSize: string;
|
|
83
|
+
ableToRemoveBid: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface PriceConfig {
|
|
86
|
+
decaySpeed: string;
|
|
87
|
+
initialPrice: string;
|
|
88
|
+
finalPrice: string;
|
|
89
|
+
}
|
|
90
|
+
export interface Bid {
|
|
91
|
+
price: string;
|
|
92
|
+
size: string;
|
|
93
|
+
tsMs: string;
|
|
94
|
+
tokenBalance: string;
|
|
95
|
+
ownerAddress: string;
|
|
96
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getMintTx(gasBudget: number, packageId: string, registry: string, moduleName: string, amount: number): Promise<any>;
|
|
@@ -0,0 +1,62 @@
|
|
|
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.getMintTx = void 0;
|
|
40
|
+
function getMintTx(gasBudget, packageId, registry, moduleName, amount) {
|
|
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: moduleName,
|
|
47
|
+
function: 'mint',
|
|
48
|
+
typeArguments: [],
|
|
49
|
+
arguments: [
|
|
50
|
+
registry,
|
|
51
|
+
amount,
|
|
52
|
+
],
|
|
53
|
+
gasBudget: gasBudget,
|
|
54
|
+
};
|
|
55
|
+
return [2 /*return*/, tx];
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.getMintTx = getMintTx;
|
|
60
|
+
/*
|
|
61
|
+
sui client call --gas-budget 10000 --package 0xe879e96fb90a8559127091f1176a2d10bb67c6ff --module "token_btc" --function "mint" --args 0x5dce92f67eeda471369b734deac0d540b751cea6 10000
|
|
62
|
+
*/
|
|
@@ -0,0 +1,68 @@
|
|
|
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 tmp, 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(token)];
|
|
48
|
+
case 1:
|
|
49
|
+
tmp = _a.sent();
|
|
50
|
+
if (tmp.status != "Exists") {
|
|
51
|
+
console.log("obj not exists, but is:");
|
|
52
|
+
console.log(tmp.status);
|
|
53
|
+
return [2 /*return*/];
|
|
54
|
+
}
|
|
55
|
+
typeArgument = tmp.details.data.type;
|
|
56
|
+
typeArgument = typeArgument.split("<")[1];
|
|
57
|
+
typeArgument = typeArgument.split(">")[0];
|
|
58
|
+
return [2 /*return*/, typeArgument];
|
|
59
|
+
case 2:
|
|
60
|
+
e_1 = _a.sent();
|
|
61
|
+
console.error(e_1);
|
|
62
|
+
return [3 /*break*/, 3];
|
|
63
|
+
case 3: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.getTypeArgumentFromToken = getTypeArgumentFromToken;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { JsonRpcProvider } from '@mysten/sui.js';
|
|
2
|
+
import { PortfolioVault, Auction } from "./fetchData";
|
|
3
|
+
export declare function getVaultDataFromRegistry(registry: string, provider: JsonRpcProvider): Promise<PortfolioVault[]>;
|
|
4
|
+
export declare function getVaultBidPrice(auction: Auction): Promise<number>;
|
|
5
|
+
export declare function getNodesKeyFromLinkedList(linkedList: string, provider: JsonRpcProvider): Promise<string[]>;
|
|
@@ -0,0 +1,242 @@
|
|
|
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.getNodesKeyFromLinkedList = exports.getVaultBidPrice = exports.getVaultDataFromRegistry = void 0;
|
|
51
|
+
var fetchData_1 = require("./fetchData");
|
|
52
|
+
function getVaultDataFromRegistry(registry, provider) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
var coveredCallVaults, coveredCallVaultsId, objsInfo, vaults, objsInfo_1, objsInfo_1_1, objInfo, vaultId, type, typeArgs, assets, deliveryInfo, fields, infoF, info, config, configRes, depositVaultF, depositVault, bidVaultF, bidVault, auctionRes, vaultBidPrice, auction, priceConfig, priceConfigRes, tvl, authority, res, e_1_1;
|
|
55
|
+
var e_1, _a;
|
|
56
|
+
return __generator(this, function (_b) {
|
|
57
|
+
switch (_b.label) {
|
|
58
|
+
case 0: return [4 /*yield*/, provider.getDynamicFields(registry)];
|
|
59
|
+
case 1:
|
|
60
|
+
coveredCallVaults = (_b.sent()).data;
|
|
61
|
+
coveredCallVaultsId = coveredCallVaults.map(function (e) { return e.objectId; });
|
|
62
|
+
return [4 /*yield*/, provider.getObjectBatch(coveredCallVaultsId)];
|
|
63
|
+
case 2:
|
|
64
|
+
objsInfo = _b.sent();
|
|
65
|
+
vaults = [];
|
|
66
|
+
_b.label = 3;
|
|
67
|
+
case 3:
|
|
68
|
+
_b.trys.push([3, 11, 12, 13]);
|
|
69
|
+
objsInfo_1 = __values(objsInfo), objsInfo_1_1 = objsInfo_1.next();
|
|
70
|
+
_b.label = 4;
|
|
71
|
+
case 4:
|
|
72
|
+
if (!!objsInfo_1_1.done) return [3 /*break*/, 10];
|
|
73
|
+
objInfo = objsInfo_1_1.value;
|
|
74
|
+
if (objInfo.status != "Exists") {
|
|
75
|
+
console.log("obj not exist");
|
|
76
|
+
return [3 /*break*/, 9];
|
|
77
|
+
}
|
|
78
|
+
vaultId = objInfo.details.data.fields.id.id;
|
|
79
|
+
type = objInfo.details.data.fields.value.type;
|
|
80
|
+
type = type.split("<")[1];
|
|
81
|
+
type = type.split(">")[0];
|
|
82
|
+
typeArgs = type.split(", ");
|
|
83
|
+
assets = typeArgs.map(function (x) { return x.split("::")[2]; });
|
|
84
|
+
deliveryInfo = void 0;
|
|
85
|
+
//@ts-ignore
|
|
86
|
+
if (objInfo.details.data.fields.value.fields.info.fields.delivery_info) {
|
|
87
|
+
fields = objInfo.details.data.fields.value.fields.info.fields.delivery_info.fields;
|
|
88
|
+
deliveryInfo = {
|
|
89
|
+
round: fields.round,
|
|
90
|
+
price: fields.price,
|
|
91
|
+
size: fields.size,
|
|
92
|
+
premium: fields.premium,
|
|
93
|
+
tsMs: fields.ts_ms,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
deliveryInfo = {};
|
|
98
|
+
}
|
|
99
|
+
infoF = objInfo.details.data.fields.value.fields.info.fields;
|
|
100
|
+
info = {
|
|
101
|
+
index: infoF.index,
|
|
102
|
+
creator: infoF.creator,
|
|
103
|
+
createTsMs: infoF.create_ts_ms,
|
|
104
|
+
round: infoF.round,
|
|
105
|
+
deliveryInfo: deliveryInfo
|
|
106
|
+
};
|
|
107
|
+
config = objInfo.details.data.fields.value.fields.config.fields;
|
|
108
|
+
configRes = {
|
|
109
|
+
optionType: config.option_type,
|
|
110
|
+
period: config.period,
|
|
111
|
+
activationTsMs: config.activation_ts_ms,
|
|
112
|
+
expirationTsMs: config.expiration_ts_ms,
|
|
113
|
+
dTokenDecimal: config.d_token_decimal,
|
|
114
|
+
bTokenDecimal: config.b_token_decimal,
|
|
115
|
+
oTokenDecimal: config.o_token_decimal,
|
|
116
|
+
lotSize: config.lot_size,
|
|
117
|
+
capacity: (Number(config.capacity) / (Math.pow(10, config.d_token_decimal))).toString(),
|
|
118
|
+
leverage: config.leverage,
|
|
119
|
+
hasNext: config.has_next,
|
|
120
|
+
activeVaultConfig: (0, fetchData_1.parseVaultConfig)(config.active_vault_config.fields),
|
|
121
|
+
warmupVaultConfig: (0, fetchData_1.parseVaultConfig)(config.warmup_vault_config.fields),
|
|
122
|
+
upcomingVaultConfig: (0, fetchData_1.parseVaultConfig)(config.upcoming_vault_config.fields),
|
|
123
|
+
};
|
|
124
|
+
depositVaultF = objInfo.details.data.fields.value.fields.deposit_vault.fields;
|
|
125
|
+
depositVault = {
|
|
126
|
+
activeSubVault: (0, fetchData_1.parseSubVault)(depositVaultF.active_sub_vault.fields),
|
|
127
|
+
deactivatingSubVault: (0, fetchData_1.parseSubVault)(depositVaultF.deactivating_sub_vault.fields),
|
|
128
|
+
inactiveSubVault: (0, fetchData_1.parseSubVault)(depositVaultF.inactive_sub_vault.fields),
|
|
129
|
+
warmupSubVault: (0, fetchData_1.parseSubVault)(depositVaultF.warmup_sub_vault.fields),
|
|
130
|
+
hasNext: depositVaultF.has_next
|
|
131
|
+
};
|
|
132
|
+
bidVaultF = objInfo.details.data.fields.value.fields.bid_vault.fields;
|
|
133
|
+
bidVault = {
|
|
134
|
+
bidderSubVault: (0, fetchData_1.parseSubVault)(bidVaultF.bidder_sub_vault.fields),
|
|
135
|
+
premiumSubVault: (0, fetchData_1.parseSubVault)(bidVaultF.premium_sub_vault.fields),
|
|
136
|
+
performanceFeeSubVault: (0, fetchData_1.parseSubVault)(bidVaultF.performance_fee_sub_vault.fields),
|
|
137
|
+
};
|
|
138
|
+
auctionRes = void 0;
|
|
139
|
+
vaultBidPrice = void 0;
|
|
140
|
+
if (!objInfo.details.data.fields.value.fields.auction) return [3 /*break*/, 6];
|
|
141
|
+
auction = objInfo.details.data.fields.value.fields.auction.fields;
|
|
142
|
+
priceConfig = auction.price_config.fields;
|
|
143
|
+
priceConfigRes = {
|
|
144
|
+
decaySpeed: (priceConfig.decay_speed),
|
|
145
|
+
initialPrice: (priceConfig.initial_price),
|
|
146
|
+
finalPrice: (priceConfig.final_price),
|
|
147
|
+
};
|
|
148
|
+
auctionRes = {
|
|
149
|
+
startTsMs: (auction.start_ts_ms),
|
|
150
|
+
endTsMs: (auction.end_ts_ms),
|
|
151
|
+
priceConfig: priceConfigRes,
|
|
152
|
+
index: (auction.index),
|
|
153
|
+
totalBidSize: auction.total_bid_size,
|
|
154
|
+
ableToRemoveBid: auction.able_to_remove_bid,
|
|
155
|
+
};
|
|
156
|
+
return [4 /*yield*/, getVaultBidPrice(auctionRes)
|
|
157
|
+
// console.log("get auction in " + vaultId)
|
|
158
|
+
];
|
|
159
|
+
case 5:
|
|
160
|
+
vaultBidPrice = _b.sent();
|
|
161
|
+
return [3 /*break*/, 7];
|
|
162
|
+
case 6:
|
|
163
|
+
// console.log("No auction " + vaultId)
|
|
164
|
+
auctionRes = {};
|
|
165
|
+
vaultBidPrice = 0;
|
|
166
|
+
_b.label = 7;
|
|
167
|
+
case 7:
|
|
168
|
+
tvl = Number(depositVault.activeSubVault.balance) + Number(depositVault.warmupSubVault.balance);
|
|
169
|
+
return [4 /*yield*/, getNodesKeyFromLinkedList(objInfo.details.data.fields.value.fields.authority, provider)];
|
|
170
|
+
case 8:
|
|
171
|
+
authority = _b.sent();
|
|
172
|
+
res = {
|
|
173
|
+
vaultId: vaultId,
|
|
174
|
+
typeArgs: typeArgs,
|
|
175
|
+
assets: assets,
|
|
176
|
+
info: info,
|
|
177
|
+
config: configRes,
|
|
178
|
+
depositVault: depositVault,
|
|
179
|
+
bidVault: bidVault,
|
|
180
|
+
auction: auctionRes,
|
|
181
|
+
authority: authority,
|
|
182
|
+
tvl: tvl.toString(),
|
|
183
|
+
vaultBidPrice: vaultBidPrice.toString(),
|
|
184
|
+
};
|
|
185
|
+
vaults.push(res);
|
|
186
|
+
_b.label = 9;
|
|
187
|
+
case 9:
|
|
188
|
+
objsInfo_1_1 = objsInfo_1.next();
|
|
189
|
+
return [3 /*break*/, 4];
|
|
190
|
+
case 10: return [3 /*break*/, 13];
|
|
191
|
+
case 11:
|
|
192
|
+
e_1_1 = _b.sent();
|
|
193
|
+
e_1 = { error: e_1_1 };
|
|
194
|
+
return [3 /*break*/, 13];
|
|
195
|
+
case 12:
|
|
196
|
+
try {
|
|
197
|
+
if (objsInfo_1_1 && !objsInfo_1_1.done && (_a = objsInfo_1.return)) _a.call(objsInfo_1);
|
|
198
|
+
}
|
|
199
|
+
finally { if (e_1) throw e_1.error; }
|
|
200
|
+
return [7 /*endfinally*/];
|
|
201
|
+
case 13: return [2 /*return*/, vaults];
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
exports.getVaultDataFromRegistry = getVaultDataFromRegistry;
|
|
207
|
+
function getVaultBidPrice(auction) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
209
|
+
var current, initialPrice, finalPrice, decaySpeed, start, end;
|
|
210
|
+
return __generator(this, function (_a) {
|
|
211
|
+
current = Date.now();
|
|
212
|
+
initialPrice = Number(auction.priceConfig.initialPrice);
|
|
213
|
+
finalPrice = Number(auction.priceConfig.finalPrice);
|
|
214
|
+
decaySpeed = Number(auction.priceConfig.decaySpeed);
|
|
215
|
+
start = Number(auction.startTsMs);
|
|
216
|
+
end = Number(auction.endTsMs);
|
|
217
|
+
/// decayed_price =
|
|
218
|
+
/// initial_price -
|
|
219
|
+
/// (initial_price - final_price) *
|
|
220
|
+
/// (1 - remaining_time / auction_duration) ^ decay_speed
|
|
221
|
+
// 1 - remaining_time / auction_duration => 1 - (end - current) / (end - start) => (current - start) / (end - start)
|
|
222
|
+
return [2 /*return*/, initialPrice -
|
|
223
|
+
(initialPrice - finalPrice) *
|
|
224
|
+
(((current - start) / (end - start)) ^ decaySpeed)];
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
exports.getVaultBidPrice = getVaultBidPrice;
|
|
229
|
+
function getNodesKeyFromLinkedList(linkedList, provider) {
|
|
230
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
231
|
+
var linkedListNodes;
|
|
232
|
+
return __generator(this, function (_a) {
|
|
233
|
+
switch (_a.label) {
|
|
234
|
+
case 0: return [4 /*yield*/, provider.getDynamicFields(linkedList.fields.whitelist.fields.nodes.fields.id.id)];
|
|
235
|
+
case 1:
|
|
236
|
+
linkedListNodes = (_a.sent()).data.map(function (d) { return d.name; });
|
|
237
|
+
return [2 /*return*/, linkedListNodes];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
exports.getNodesKeyFromLinkedList = getNodesKeyFromLinkedList;
|
|
@@ -0,0 +1,70 @@
|
|
|
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.getWhiteListFromRegistry = void 0;
|
|
40
|
+
function getWhiteListFromRegistry(registry, provider) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
+
var whiteLists, tmp, whiteListsTable, whiteListsNodes, whiteListsTableId, tmp2;
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
switch (_a.label) {
|
|
45
|
+
case 0:
|
|
46
|
+
console.log("registry: " + registry);
|
|
47
|
+
whiteLists = [];
|
|
48
|
+
return [4 /*yield*/, provider.getObject(registry)
|
|
49
|
+
//@ts-ignore
|
|
50
|
+
];
|
|
51
|
+
case 1:
|
|
52
|
+
tmp = _a.sent();
|
|
53
|
+
whiteListsTable = tmp.details.data.fields.authority.fields.whitelist.fields.nodes.fields.id.id;
|
|
54
|
+
return [4 /*yield*/, provider.getDynamicFields(whiteListsTable)];
|
|
55
|
+
case 2:
|
|
56
|
+
whiteListsNodes = (_a.sent()).data;
|
|
57
|
+
whiteListsTableId = whiteListsNodes.map(function (e) { return e.objectId; });
|
|
58
|
+
return [4 /*yield*/, provider.getObjectBatch(whiteListsTableId)
|
|
59
|
+
//@ts-ignore
|
|
60
|
+
];
|
|
61
|
+
case 3:
|
|
62
|
+
tmp2 = _a.sent();
|
|
63
|
+
//@ts-ignore
|
|
64
|
+
whiteLists = tmp2.map(function (e) { return e.details.data.fields.name; });
|
|
65
|
+
return [2 /*return*/, whiteLists];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
exports.getWhiteListFromRegistry = getWhiteListFromRegistry;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (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.getAuthorizedAddPortfolioVaultAuthorizedUserTx = void 0;
|
|
40
|
+
/**
|
|
41
|
+
* @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
|
|
42
|
+
*/
|
|
43
|
+
function getAuthorizedAddPortfolioVaultAuthorizedUserTx(gasBudget, packageId, registry, typeArguments, index, addresses) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
+
var tx;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
tx = {
|
|
48
|
+
packageObjectId: packageId,
|
|
49
|
+
module: 'portfolio',
|
|
50
|
+
function: 'authorized_add_portfolio_vault_authorized_user',
|
|
51
|
+
typeArguments: typeArguments,
|
|
52
|
+
arguments: [
|
|
53
|
+
registry,
|
|
54
|
+
index,
|
|
55
|
+
addresses,
|
|
56
|
+
],
|
|
57
|
+
gasBudget: gasBudget,
|
|
58
|
+
};
|
|
59
|
+
return [2 /*return*/, tx];
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
exports.getAuthorizedAddPortfolioVaultAuthorizedUserTx = getAuthorizedAddPortfolioVaultAuthorizedUserTx;
|