@typus/typus-sdk 1.0.27 → 1.0.29
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/package.json +2 -2
- package/lib/constants.d.ts +0 -22
- package/lib/constants.js +0 -35
- package/lib/utils/auction/sealedAuction.d.ts +0 -33
- package/lib/utils/auction/sealedAuction.js +0 -64
- package/lib/utils/portfolio/leader-board.d.ts +0 -7
- package/lib/utils/portfolio/leader-board.js +0 -197
- package/lib/utils/portfolio/mint.d.ts +0 -2
- package/lib/utils/portfolio/mint.js +0 -58
- package/lib/utils/portfolio/multiple-collateral/authorized-entry.d.ts +0 -102
- package/lib/utils/portfolio/multiple-collateral/authorized-entry.js +0 -295
- package/lib/utils/portfolio/multiple-collateral/manager-entry.d.ts +0 -219
- package/lib/utils/portfolio/multiple-collateral/manager-entry.js +0 -584
- package/lib/utils/portfolio/multiple-collateral/portfolio-vault.d.ts +0 -68
- package/lib/utils/portfolio/multiple-collateral/portfolio-vault.js +0 -296
- package/lib/utils/portfolio/multiple-collateral/user-entry.d.ts +0 -93
- package/lib/utils/portfolio/multiple-collateral/user-entry.js +0 -280
- package/lib/utils/portfolio/multiple-collateral/user-share.d.ts +0 -9
- package/lib/utils/portfolio/multiple-collateral/user-share.js +0 -166
- package/lib/utils/portfolio/multiple-collateral/view-function.d.ts +0 -9
- package/lib/utils/portfolio/multiple-collateral/view-function.js +0 -88
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.d.ts +0 -5
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.js +0 -61
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedDeliveryTx.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedDeliveryTx.js +0 -63
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedNewPortfolioVaultTx.d.ts +0 -39
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedNewPortfolioVaultTx.js +0 -118
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.d.ts +0 -5
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.js +0 -61
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateCapacityTx.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateCapacityTx.js +0 -58
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.d.ts +0 -5
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.js +0 -72
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateWarmupVaultConfigTx.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateWarmupVaultConfigTx.js +0 -66
- package/lib/utils/portfolio/single-collateral/manager/getAddAuthorizedUserTx.d.ts +0 -9
- package/lib/utils/portfolio/single-collateral/manager/getAddAuthorizedUserTx.js +0 -65
- package/lib/utils/portfolio/single-collateral/manager/getAddPortfolioVaultAuthorizedUserTx.d.ts +0 -11
- package/lib/utils/portfolio/single-collateral/manager/getAddPortfolioVaultAuthorizedUserTx.js +0 -67
- package/lib/utils/portfolio/single-collateral/manager/getCloseAuctionTx.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/manager/getCloseAuctionTx.js +0 -64
- package/lib/utils/portfolio/single-collateral/manager/getCloseVaultTx.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/manager/getCloseVaultTx.js +0 -58
- package/lib/utils/portfolio/single-collateral/manager/getDeliveryTx.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/manager/getDeliveryTx.js +0 -64
- package/lib/utils/portfolio/single-collateral/manager/getEvolutionTx.d.ts +0 -16
- package/lib/utils/portfolio/single-collateral/manager/getEvolutionTx.js +0 -80
- package/lib/utils/portfolio/single-collateral/manager/getNewManagerTx.d.ts +0 -9
- package/lib/utils/portfolio/single-collateral/manager/getNewManagerTx.js +0 -65
- package/lib/utils/portfolio/single-collateral/manager/getNewPortfolioVaultTx.d.ts +0 -39
- package/lib/utils/portfolio/single-collateral/manager/getNewPortfolioVaultTx.js +0 -118
- package/lib/utils/portfolio/single-collateral/manager/getRemoveAuthorizedUserTx.d.ts +0 -9
- package/lib/utils/portfolio/single-collateral/manager/getRemoveAuthorizedUserTx.js +0 -65
- package/lib/utils/portfolio/single-collateral/manager/getRemoveManagerTx.d.ts +0 -7
- package/lib/utils/portfolio/single-collateral/manager/getRemoveManagerTx.js +0 -63
- package/lib/utils/portfolio/single-collateral/manager/getRemovePortfolioVaultAuthorizedUserTx.d.ts +0 -11
- package/lib/utils/portfolio/single-collateral/manager/getRemovePortfolioVaultAuthorizedUserTx.js +0 -67
- package/lib/utils/portfolio/single-collateral/manager/getUpdateCapacityTx.d.ts +0 -2
- package/lib/utils/portfolio/single-collateral/manager/getUpdateCapacityTx.js +0 -58
- package/lib/utils/portfolio/single-collateral/portfolio-vault.d.ts +0 -61
- package/lib/utils/portfolio/single-collateral/portfolio-vault.js +0 -241
- package/lib/utils/portfolio/single-collateral/user-entry.d.ts +0 -81
- package/lib/utils/portfolio/single-collateral/user-entry.js +0 -247
- package/lib/utils/portfolio/single-collateral/user-share.d.ts +0 -8
- package/lib/utils/portfolio/single-collateral/user-share.js +0 -139
- package/lib/utils/portfolio/single-collateral/view-function.d.ts +0 -11
- package/lib/utils/portfolio/single-collateral/view-function.js +0 -99
- package/lib/utils/tools.d.ts +0 -1
- package/lib/utils/tools.js +0 -12
- package/lib/utils/typus-framework/dutch.d.ts +0 -25
- package/lib/utils/typus-framework/dutch.js +0 -84
- package/lib/utils/typus-framework/vault.d.ts +0 -32
- package/lib/utils/typus-framework/vault.js +0 -32
|
@@ -1,139 +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 __read = (this && this.__read) || function (o, n) {
|
|
39
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
-
if (!m) return o;
|
|
41
|
-
var i = m.call(o), r, ar = [], e;
|
|
42
|
-
try {
|
|
43
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
-
}
|
|
45
|
-
catch (error) { e = { error: error }; }
|
|
46
|
-
finally {
|
|
47
|
-
try {
|
|
48
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
-
}
|
|
50
|
-
finally { if (e) throw e.error; }
|
|
51
|
-
}
|
|
52
|
-
return ar;
|
|
53
|
-
};
|
|
54
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.getUserShares = void 0;
|
|
56
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
57
|
-
var tools_1 = require("../../tools");
|
|
58
|
-
function getUserShares(provider, packageId, registry, indexes, user) {
|
|
59
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
-
var transactionBlock, target, transactionBlockArguments, bytes, result, user_share_bytes, index, tag, share;
|
|
61
|
-
return __generator(this, function (_a) {
|
|
62
|
-
switch (_a.label) {
|
|
63
|
-
case 0:
|
|
64
|
-
transactionBlock = new sui_js_1.TransactionBlock();
|
|
65
|
-
target = "".concat(packageId, "::single_collateral::get_user_shares");
|
|
66
|
-
transactionBlockArguments = [transactionBlock.pure(registry), transactionBlock.pure(indexes), transactionBlock.pure(user)];
|
|
67
|
-
transactionBlock.moveCall({
|
|
68
|
-
target: target,
|
|
69
|
-
arguments: transactionBlockArguments,
|
|
70
|
-
});
|
|
71
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: user })];
|
|
72
|
-
case 1:
|
|
73
|
-
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
74
|
-
result = Array.from(new Map()).reduce(function (map, _a) {
|
|
75
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
76
|
-
map[key] = value;
|
|
77
|
-
return map;
|
|
78
|
-
}, {});
|
|
79
|
-
while (bytes.length > 49) {
|
|
80
|
-
user_share_bytes = bytes.splice(bytes.length - 49, 49);
|
|
81
|
-
index = (0, tools_1.U64FromBytes)(user_share_bytes.splice(0, 8).reverse()).toString();
|
|
82
|
-
tag = (0, tools_1.U64FromBytes)(user_share_bytes.splice(0, 1).reverse()).toString();
|
|
83
|
-
user_share_bytes.splice(0, 32);
|
|
84
|
-
share = (0, tools_1.U64FromBytes)(user_share_bytes.splice(0, 8).reverse());
|
|
85
|
-
if (result[index] == undefined) {
|
|
86
|
-
result[index] = {
|
|
87
|
-
index: index,
|
|
88
|
-
depositVaultUserShare: {
|
|
89
|
-
activeSubVaultUserShare: BigInt(0),
|
|
90
|
-
deactivatingSubVaultUserShare: BigInt(0),
|
|
91
|
-
inactiveSubVaultUserShare: BigInt(0),
|
|
92
|
-
warmupSubVaultUserShare: BigInt(0),
|
|
93
|
-
},
|
|
94
|
-
bidVaultUserShare: {
|
|
95
|
-
bidderSubVaultUserShare: BigInt(0),
|
|
96
|
-
premiumSubVaultUserShare: BigInt(0),
|
|
97
|
-
performanceFeeSubVaultUserShare: BigInt(0),
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
result[index].index = index;
|
|
102
|
-
switch (tag) {
|
|
103
|
-
case "0": {
|
|
104
|
-
result[index].depositVaultUserShare.activeSubVaultUserShare = share;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
case "1": {
|
|
108
|
-
result[index].depositVaultUserShare.deactivatingSubVaultUserShare = share;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
case "2": {
|
|
112
|
-
result[index].depositVaultUserShare.inactiveSubVaultUserShare = share;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case "3": {
|
|
116
|
-
result[index].depositVaultUserShare.warmupSubVaultUserShare = share;
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
case "4": {
|
|
120
|
-
result[index].bidVaultUserShare.bidderSubVaultUserShare = share;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
case "5": {
|
|
124
|
-
result[index].bidVaultUserShare.premiumSubVaultUserShare = share;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
case "6": {
|
|
128
|
-
result[index].bidVaultUserShare.performanceFeeSubVaultUserShare = share;
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
// @ts-ignore
|
|
134
|
-
return [2 /*return*/, result];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
exports.getUserShares = getUserShares;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider } from "@mysten/sui.js";
|
|
2
|
-
import { DepositVaultUserShare, BidVaultUserShare } from "../../typus-framework/vault";
|
|
3
|
-
export declare const CLOCK = "0x6";
|
|
4
|
-
export declare const SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
5
|
-
export interface UserShare {
|
|
6
|
-
index: string;
|
|
7
|
-
depositVaultUserShare: DepositVaultUserShare;
|
|
8
|
-
bidVaultUserShare: BidVaultUserShare;
|
|
9
|
-
}
|
|
10
|
-
export declare function getAuctionMaxSize(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string): Promise<BigInt>;
|
|
11
|
-
export declare function getMaxLossPerUnit(provider: JsonRpcProvider, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string): Promise<BigInt>;
|
|
@@ -1,99 +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.getMaxLossPerUnit = exports.getAuctionMaxSize = exports.SENDER = exports.CLOCK = void 0;
|
|
40
|
-
var sui_js_1 = require("@mysten/sui.js");
|
|
41
|
-
var tools_1 = require("../../tools");
|
|
42
|
-
exports.CLOCK = "0x6";
|
|
43
|
-
exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
44
|
-
function getAuctionMaxSize(provider, packageId, typeArguments, registry, index, priceOracle) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
-
var transactionBlock, target, transactionBlockArguments, bytes;
|
|
47
|
-
return __generator(this, function (_a) {
|
|
48
|
-
switch (_a.label) {
|
|
49
|
-
case 0:
|
|
50
|
-
transactionBlock = new sui_js_1.TransactionBlock();
|
|
51
|
-
target = "".concat(packageId, "::single_collateral::get_auction_max_size");
|
|
52
|
-
transactionBlockArguments = [
|
|
53
|
-
transactionBlock.pure(registry),
|
|
54
|
-
transactionBlock.pure(index),
|
|
55
|
-
transactionBlock.pure(priceOracle),
|
|
56
|
-
transactionBlock.pure(exports.CLOCK),
|
|
57
|
-
];
|
|
58
|
-
transactionBlock.moveCall({
|
|
59
|
-
target: target,
|
|
60
|
-
typeArguments: typeArguments,
|
|
61
|
-
arguments: transactionBlockArguments,
|
|
62
|
-
});
|
|
63
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: exports.SENDER })];
|
|
64
|
-
case 1:
|
|
65
|
-
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
66
|
-
return [2 /*return*/, (0, tools_1.U64FromBytes)(bytes.reverse())];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
exports.getAuctionMaxSize = getAuctionMaxSize;
|
|
72
|
-
function getMaxLossPerUnit(provider, packageId, typeArguments, registry, index, priceOracle) {
|
|
73
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var transactionBlock, target, transactionBlockArguments, bytes;
|
|
75
|
-
return __generator(this, function (_a) {
|
|
76
|
-
switch (_a.label) {
|
|
77
|
-
case 0:
|
|
78
|
-
transactionBlock = new sui_js_1.TransactionBlock();
|
|
79
|
-
target = "".concat(packageId, "::single_collateral::get_max_loss_per_unit");
|
|
80
|
-
transactionBlockArguments = [
|
|
81
|
-
transactionBlock.pure(registry),
|
|
82
|
-
transactionBlock.pure(index),
|
|
83
|
-
transactionBlock.pure(priceOracle),
|
|
84
|
-
transactionBlock.pure(exports.CLOCK),
|
|
85
|
-
];
|
|
86
|
-
transactionBlock.moveCall({
|
|
87
|
-
target: target,
|
|
88
|
-
typeArguments: typeArguments,
|
|
89
|
-
arguments: transactionBlockArguments,
|
|
90
|
-
});
|
|
91
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: exports.SENDER })];
|
|
92
|
-
case 1:
|
|
93
|
-
bytes = (_a.sent()).results[0].returnValues[0][0];
|
|
94
|
-
return [2 /*return*/, (0, tools_1.U64FromBytes)(bytes.reverse())];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
exports.getMaxLossPerUnit = getMaxLossPerUnit;
|
package/lib/utils/tools.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function U64FromBytes(x: any): bigint;
|
package/lib/utils/tools.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.U64FromBytes = void 0;
|
|
4
|
-
function U64FromBytes(x) {
|
|
5
|
-
var val = BigInt(0);
|
|
6
|
-
for (var i = 0; i < x.length; i++) {
|
|
7
|
-
val = val << BigInt(8);
|
|
8
|
-
val += BigInt(x[i]);
|
|
9
|
-
}
|
|
10
|
-
return val;
|
|
11
|
-
}
|
|
12
|
-
exports.U64FromBytes = U64FromBytes;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider } from "@mysten/sui.js";
|
|
2
|
-
export interface Auction {
|
|
3
|
-
startTsMs: string;
|
|
4
|
-
endTsMs: string;
|
|
5
|
-
priceConfig: PriceConfig;
|
|
6
|
-
bidIndex: string;
|
|
7
|
-
bids: string;
|
|
8
|
-
ownerships: string;
|
|
9
|
-
totalBidSize: string;
|
|
10
|
-
ableToRemoveBid: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface PriceConfig {
|
|
13
|
-
decaySpeed: string;
|
|
14
|
-
initialPrice: string;
|
|
15
|
-
finalPrice: string;
|
|
16
|
-
}
|
|
17
|
-
export interface Bid {
|
|
18
|
-
price: string;
|
|
19
|
-
size: string;
|
|
20
|
-
tsMs: string;
|
|
21
|
-
tokenBalance: string;
|
|
22
|
-
ownerAddress: string;
|
|
23
|
-
}
|
|
24
|
-
export declare function parseAuction(auction: any): Auction;
|
|
25
|
-
export declare function getBids(provider: JsonRpcProvider, auction: Auction): Promise<Bid[]>;
|
|
@@ -1,84 +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.getBids = exports.parseAuction = void 0;
|
|
40
|
-
function parseAuction(auction) {
|
|
41
|
-
return {
|
|
42
|
-
startTsMs: auction.fields.start_ts_ms,
|
|
43
|
-
endTsMs: auction.fields.end_ts_ms,
|
|
44
|
-
priceConfig: {
|
|
45
|
-
decaySpeed: auction.fields.price_config.fields.decay_speed,
|
|
46
|
-
initialPrice: auction.fields.price_config.fields.initial_price,
|
|
47
|
-
finalPrice: auction.fields.price_config.fields.final_price,
|
|
48
|
-
},
|
|
49
|
-
bidIndex: auction.fields.bid_index,
|
|
50
|
-
bids: auction.fields.bids.fields.id.id,
|
|
51
|
-
ownerships: auction.fields.ownerships.fields.id.id,
|
|
52
|
-
totalBidSize: auction.fields.total_bid_size,
|
|
53
|
-
ableToRemoveBid: auction.fields.able_to_remove_bid,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
exports.parseAuction = parseAuction;
|
|
57
|
-
function getBids(provider, auction) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var bidIds;
|
|
60
|
-
return __generator(this, function (_a) {
|
|
61
|
-
switch (_a.label) {
|
|
62
|
-
case 0: return [4 /*yield*/, provider.getDynamicFields({ parentId: auction.bids })];
|
|
63
|
-
case 1:
|
|
64
|
-
bidIds = (_a.sent()).data.map(function (x) { return x.objectId; });
|
|
65
|
-
return [4 /*yield*/, provider.multiGetObjects({
|
|
66
|
-
ids: bidIds,
|
|
67
|
-
options: { showContent: true },
|
|
68
|
-
})];
|
|
69
|
-
case 2: return [2 /*return*/, (_a.sent()).map(function (e) {
|
|
70
|
-
//@ts-ignore
|
|
71
|
-
var bidData = e.data.content.fields.value.fields;
|
|
72
|
-
return {
|
|
73
|
-
price: bidData.price,
|
|
74
|
-
size: bidData.size,
|
|
75
|
-
tsMs: bidData.ts_ms,
|
|
76
|
-
tokenBalance: bidData.balance,
|
|
77
|
-
ownerAddress: bidData.bidder,
|
|
78
|
-
};
|
|
79
|
-
})];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
exports.getBids = getBids;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface DepositVault {
|
|
2
|
-
token: string;
|
|
3
|
-
activeSubVault: SubVault;
|
|
4
|
-
deactivatingSubVault: SubVault;
|
|
5
|
-
inactiveSubVault: SubVault;
|
|
6
|
-
warmupSubVault: SubVault;
|
|
7
|
-
hasNext: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface BidVault {
|
|
10
|
-
token: string;
|
|
11
|
-
bidderSubVault: SubVault;
|
|
12
|
-
premiumSubVault: SubVault;
|
|
13
|
-
performanceFeeSubVault: SubVault;
|
|
14
|
-
}
|
|
15
|
-
export interface SubVault {
|
|
16
|
-
balance: string;
|
|
17
|
-
shareSupply: string;
|
|
18
|
-
}
|
|
19
|
-
export interface DepositVaultUserShare {
|
|
20
|
-
activeSubVaultUserShare: bigint;
|
|
21
|
-
deactivatingSubVaultUserShare: bigint;
|
|
22
|
-
inactiveSubVaultUserShare: bigint;
|
|
23
|
-
warmupSubVaultUserShare: bigint;
|
|
24
|
-
}
|
|
25
|
-
export interface BidVaultUserShare {
|
|
26
|
-
bidderSubVaultUserShare: bigint;
|
|
27
|
-
premiumSubVaultUserShare: bigint;
|
|
28
|
-
performanceFeeSubVaultUserShare: bigint;
|
|
29
|
-
}
|
|
30
|
-
export declare function parseDepositVault(depositVault: any): DepositVault;
|
|
31
|
-
export declare function parseBidVault(bidVault: any): BidVault;
|
|
32
|
-
export declare function parseSubVault(subVault: any): SubVault;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSubVault = exports.parseBidVault = exports.parseDepositVault = void 0;
|
|
4
|
-
function parseDepositVault(depositVault) {
|
|
5
|
-
return {
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
token: new RegExp(".*<.*, (.*)>").exec(depositVault.type)[1],
|
|
8
|
-
activeSubVault: parseSubVault(depositVault.fields.active_sub_vault),
|
|
9
|
-
deactivatingSubVault: parseSubVault(depositVault.fields.deactivating_sub_vault),
|
|
10
|
-
inactiveSubVault: parseSubVault(depositVault.fields.inactive_sub_vault),
|
|
11
|
-
warmupSubVault: parseSubVault(depositVault.fields.warmup_sub_vault),
|
|
12
|
-
hasNext: depositVault.fields.has_next,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.parseDepositVault = parseDepositVault;
|
|
16
|
-
function parseBidVault(bidVault) {
|
|
17
|
-
return {
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
token: new RegExp(".*<.*, (.*)>").exec(bidVault.type)[1],
|
|
20
|
-
bidderSubVault: parseSubVault(bidVault.fields.bidder_sub_vault),
|
|
21
|
-
premiumSubVault: parseSubVault(bidVault.fields.premium_sub_vault),
|
|
22
|
-
performanceFeeSubVault: parseSubVault(bidVault.fields.performance_fee_sub_vault),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
exports.parseBidVault = parseBidVault;
|
|
26
|
-
function parseSubVault(subVault) {
|
|
27
|
-
return {
|
|
28
|
-
balance: subVault.fields.balance,
|
|
29
|
-
shareSupply: subVault.fields.share_supply,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.parseSubVault = parseSubVault;
|