@typus/typus-sdk 1.0.29 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants.d.ts +22 -0
- package/lib/constants.js +28 -0
- package/lib/utils/auction/sealedAuction.d.ts +33 -0
- package/lib/utils/auction/sealedAuction.js +64 -0
- package/lib/utils/leader-board.d.ts +7 -0
- package/lib/utils/leader-board.js +197 -0
- package/lib/utils/mint.d.ts +2 -0
- package/lib/utils/mint.js +58 -0
- package/lib/utils/tools.d.ts +1 -0
- package/lib/utils/tools.js +12 -0
- package/lib/utils/typus-dov-double/authorized-entry.d.ts +102 -0
- package/lib/utils/typus-dov-double/authorized-entry.js +295 -0
- package/lib/utils/typus-dov-double/manager-entry.d.ts +219 -0
- package/lib/utils/typus-dov-double/manager-entry.js +584 -0
- package/lib/utils/typus-dov-double/portfolio-vault.d.ts +68 -0
- package/lib/utils/typus-dov-double/portfolio-vault.js +296 -0
- package/lib/utils/typus-dov-double/user-entry.d.ts +93 -0
- package/lib/utils/typus-dov-double/user-entry.js +280 -0
- package/lib/utils/typus-dov-double/view-function.d.ts +11 -0
- package/lib/utils/typus-dov-double/view-function.js +213 -0
- package/lib/utils/typus-dov-single/portfolio-vault.d.ts +61 -0
- package/lib/utils/typus-dov-single/portfolio-vault.js +241 -0
- package/lib/utils/typus-dov-single/user-entry.d.ts +81 -0
- package/lib/utils/typus-dov-single/user-entry.js +284 -0
- package/lib/utils/typus-dov-single/view-function.d.ts +10 -0
- package/lib/utils/typus-dov-single/view-function.js +196 -0
- package/lib/utils/typus-framework/dutch.d.ts +25 -0
- package/lib/utils/typus-framework/dutch.js +84 -0
- package/lib/utils/typus-framework/vault.d.ts +32 -0
- package/lib/utils/typus-framework/vault.js +32 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Connection } from "@mysten/sui.js";
|
|
2
|
+
export declare const CLOCK = "0x6";
|
|
3
|
+
export declare const SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
4
|
+
export declare const PRICE_DECIMAL = 8;
|
|
5
|
+
export declare const TOKEN_DECIMAL = 9;
|
|
6
|
+
export declare const DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
|
7
|
+
export declare const FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
|
|
8
|
+
export declare const TOKEN_NAME: string[];
|
|
9
|
+
export declare const TOKEN_NAME_TO_MODULE: {
|
|
10
|
+
BTC: string;
|
|
11
|
+
ETH: string;
|
|
12
|
+
SUI: string;
|
|
13
|
+
USDC: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const testnetConnection: Connection;
|
|
16
|
+
export declare const ACTIVE_SUB_VAULT_TAG: number;
|
|
17
|
+
export declare const DEACTIVATING_SUB_VAULT_TAG: number;
|
|
18
|
+
export declare const INACTIVE_SUB_VAULT_TAG: number;
|
|
19
|
+
export declare const WARMUP_SUB_VAULT_TAG: number;
|
|
20
|
+
export declare const BIDDER_SUB_VAULT_TAG: number;
|
|
21
|
+
export declare const PREMIUM_SUB_VAULT_TAG: number;
|
|
22
|
+
export declare const PERFORMANCE_FEE_SUB_VAULT_TAG: number;
|
package/lib/constants.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PERFORMANCE_FEE_SUB_VAULT_TAG = exports.PREMIUM_SUB_VAULT_TAG = exports.BIDDER_SUB_VAULT_TAG = exports.WARMUP_SUB_VAULT_TAG = exports.INACTIVE_SUB_VAULT_TAG = exports.DEACTIVATING_SUB_VAULT_TAG = exports.ACTIVE_SUB_VAULT_TAG = exports.testnetConnection = exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.SENDER = exports.CLOCK = void 0;
|
|
4
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
5
|
+
exports.CLOCK = "0x6";
|
|
6
|
+
exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
7
|
+
exports.PRICE_DECIMAL = 8;
|
|
8
|
+
exports.TOKEN_DECIMAL = 9;
|
|
9
|
+
exports.DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
|
10
|
+
exports.FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
|
|
11
|
+
exports.TOKEN_NAME = ["BTC", "ETH", "SUI", "USDC", "USDT", "APT", "DOGE"];
|
|
12
|
+
exports.TOKEN_NAME_TO_MODULE = {
|
|
13
|
+
BTC: "btc",
|
|
14
|
+
ETH: "eth",
|
|
15
|
+
SUI: "sui",
|
|
16
|
+
USDC: "usdc",
|
|
17
|
+
};
|
|
18
|
+
exports.testnetConnection = new sui_js_1.Connection({
|
|
19
|
+
fullnode: "https://fullnode.testnet.sui.io:443/",
|
|
20
|
+
faucet: "https://faucet.testnet.sui.io/gas",
|
|
21
|
+
});
|
|
22
|
+
exports.ACTIVE_SUB_VAULT_TAG = 0;
|
|
23
|
+
exports.DEACTIVATING_SUB_VAULT_TAG = 1;
|
|
24
|
+
exports.INACTIVE_SUB_VAULT_TAG = 2;
|
|
25
|
+
exports.WARMUP_SUB_VAULT_TAG = 3;
|
|
26
|
+
exports.BIDDER_SUB_VAULT_TAG = 4;
|
|
27
|
+
exports.PREMIUM_SUB_VAULT_TAG = 5;
|
|
28
|
+
exports.PERFORMANCE_FEE_SUB_VAULT_TAG = 6;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BcsWriter } from '@mysten/bcs';
|
|
2
|
+
/**
|
|
3
|
+
* Encrypt bid info
|
|
4
|
+
* @param {bigint} price bid price
|
|
5
|
+
* @param {bigint} size bid size
|
|
6
|
+
* @param {string} secret secret to encrypt the bid info
|
|
7
|
+
* @returns the first element is the random number generated during bid encryption process,
|
|
8
|
+
* and the second is bid ciphertext
|
|
9
|
+
*/
|
|
10
|
+
export declare function encryptBid(price: bigint, size: bigint, secret: string): [bigint, string];
|
|
11
|
+
/**
|
|
12
|
+
* Decrypt to bid info
|
|
13
|
+
* @param {string} encryptedBid bid ciphertext
|
|
14
|
+
* @param {string} secret secret to decrypt the ciphertext to plain bid info
|
|
15
|
+
* @returns [bid price, bid size, blindingFactor]
|
|
16
|
+
*/
|
|
17
|
+
export declare function decryptBid(encryptedBid: string, secret: string): [BigInt, BigInt, BigInt];
|
|
18
|
+
/**
|
|
19
|
+
* Get hash of bid info - should be same as onchain
|
|
20
|
+
* @param {bigint} price bid price
|
|
21
|
+
* @param {bigint} size bid size
|
|
22
|
+
* @param {bigint} blindingFactor a random number
|
|
23
|
+
* @returns {string} the hash of bid info
|
|
24
|
+
*/
|
|
25
|
+
export declare function getBidHash(price: bigint, size: bigint, blindingFactor: bigint): string;
|
|
26
|
+
/**
|
|
27
|
+
* Serialize bid info to BCS buffer - should be same as onchain
|
|
28
|
+
* @param {bigint} price bid price
|
|
29
|
+
* @param {bigint} size bid size
|
|
30
|
+
* @param {bigint} blindingFactor a random number
|
|
31
|
+
* @returns {BcsWriter} the serialized bid info
|
|
32
|
+
*/
|
|
33
|
+
export declare function constructBidInfo(price: bigint, size: bigint, blindingFactor: bigint): BcsWriter;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.constructBidInfo = exports.getBidHash = exports.decryptBid = exports.encryptBid = void 0;
|
|
7
|
+
var bcs_1 = require("@mysten/bcs");
|
|
8
|
+
var js_sha3_1 = require("js-sha3");
|
|
9
|
+
var encrypt_with_password_1 = __importDefault(require("encrypt-with-password"));
|
|
10
|
+
var random_bigint_1 = __importDefault(require("random-bigint"));
|
|
11
|
+
/**
|
|
12
|
+
* Encrypt bid info
|
|
13
|
+
* @param {bigint} price bid price
|
|
14
|
+
* @param {bigint} size bid size
|
|
15
|
+
* @param {string} secret secret to encrypt the bid info
|
|
16
|
+
* @returns the first element is the random number generated during bid encryption process,
|
|
17
|
+
* and the second is bid ciphertext
|
|
18
|
+
*/
|
|
19
|
+
function encryptBid(price, size, secret) {
|
|
20
|
+
var randomNumber = (0, random_bigint_1.default)(64);
|
|
21
|
+
var msg = constructBidInfo(price, size, randomNumber);
|
|
22
|
+
var res = encrypt_with_password_1.default.encrypt(msg.toString("hex"), secret);
|
|
23
|
+
return [randomNumber, res];
|
|
24
|
+
}
|
|
25
|
+
exports.encryptBid = encryptBid;
|
|
26
|
+
/**
|
|
27
|
+
* Decrypt to bid info
|
|
28
|
+
* @param {string} encryptedBid bid ciphertext
|
|
29
|
+
* @param {string} secret secret to decrypt the ciphertext to plain bid info
|
|
30
|
+
* @returns [bid price, bid size, blindingFactor]
|
|
31
|
+
*/
|
|
32
|
+
function decryptBid(encryptedBid, secret) {
|
|
33
|
+
var res = encrypt_with_password_1.default.decrypt(encryptedBid, secret);
|
|
34
|
+
var buffer = Buffer.from(res, "hex");
|
|
35
|
+
var price = buffer.slice(0, buffer.length / 3).readBigUInt64LE(0);
|
|
36
|
+
var size = buffer.slice(buffer.length / 3, buffer.length / 3 * 2).readBigUInt64LE(0);
|
|
37
|
+
var blindingFactor = buffer.slice(buffer.length / 3 * 2).readBigUInt64LE(0);
|
|
38
|
+
return [price, size, blindingFactor];
|
|
39
|
+
}
|
|
40
|
+
exports.decryptBid = decryptBid;
|
|
41
|
+
/**
|
|
42
|
+
* Get hash of bid info - should be same as onchain
|
|
43
|
+
* @param {bigint} price bid price
|
|
44
|
+
* @param {bigint} size bid size
|
|
45
|
+
* @param {bigint} blindingFactor a random number
|
|
46
|
+
* @returns {string} the hash of bid info
|
|
47
|
+
*/
|
|
48
|
+
function getBidHash(price, size, blindingFactor) {
|
|
49
|
+
var msg = constructBidInfo(price, size, blindingFactor);
|
|
50
|
+
var hash = (0, js_sha3_1.sha3_256)(msg.toBytes());
|
|
51
|
+
return hash;
|
|
52
|
+
}
|
|
53
|
+
exports.getBidHash = getBidHash;
|
|
54
|
+
/**
|
|
55
|
+
* Serialize bid info to BCS buffer - should be same as onchain
|
|
56
|
+
* @param {bigint} price bid price
|
|
57
|
+
* @param {bigint} size bid size
|
|
58
|
+
* @param {bigint} blindingFactor a random number
|
|
59
|
+
* @returns {BcsWriter} the serialized bid info
|
|
60
|
+
*/
|
|
61
|
+
function constructBidInfo(price, size, blindingFactor) {
|
|
62
|
+
return new bcs_1.BcsWriter().write64(price).write64(size).write64(blindingFactor);
|
|
63
|
+
}
|
|
64
|
+
exports.constructBidInfo = constructBidInfo;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getDepositorLeaderBoard(start?: string, end?: string, step?: number): Promise<LeaderBoard[]>;
|
|
2
|
+
export declare function getBidderLeaderBoard(start?: string, end?: string, step?: number): Promise<LeaderBoard[]>;
|
|
3
|
+
interface LeaderBoard {
|
|
4
|
+
user: string;
|
|
5
|
+
score: number;
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,197 @@
|
|
|
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.getBidderLeaderBoard = exports.getDepositorLeaderBoard = void 0;
|
|
40
|
+
var apiUrl = "https://app.sentio.xyz/api/v1/metrics/wayne/typus/query_range";
|
|
41
|
+
var headers = {
|
|
42
|
+
"api-key": "oBOW8DsO1izVrINCy6Tmxga9YcWeOL87O",
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
};
|
|
45
|
+
var depositorRequestData = {
|
|
46
|
+
queries: [
|
|
47
|
+
{
|
|
48
|
+
query: "callPortfolioHarvest",
|
|
49
|
+
alias: "",
|
|
50
|
+
id: "a",
|
|
51
|
+
labelSelector: {},
|
|
52
|
+
aggregate: {
|
|
53
|
+
op: "SUM",
|
|
54
|
+
grouping: ["user"],
|
|
55
|
+
},
|
|
56
|
+
functions: [],
|
|
57
|
+
disabled: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
query: "callPortfolioCompound",
|
|
61
|
+
alias: "",
|
|
62
|
+
id: "b",
|
|
63
|
+
labelSelector: {},
|
|
64
|
+
aggregate: {
|
|
65
|
+
op: "SUM",
|
|
66
|
+
grouping: ["user"],
|
|
67
|
+
},
|
|
68
|
+
functions: [],
|
|
69
|
+
disabled: true,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
formulas: [
|
|
73
|
+
{
|
|
74
|
+
expression: "a+b",
|
|
75
|
+
alias: "Score",
|
|
76
|
+
id: "A",
|
|
77
|
+
disabled: false,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
timeRange: {
|
|
81
|
+
start: "now",
|
|
82
|
+
end: "now",
|
|
83
|
+
step: 1,
|
|
84
|
+
},
|
|
85
|
+
samplesLimit: 200,
|
|
86
|
+
};
|
|
87
|
+
function getDepositorLeaderBoard(start, end, step) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
+
var jsonData, response, data, samples, leader_board;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0:
|
|
93
|
+
if (start) {
|
|
94
|
+
depositorRequestData.timeRange.start = start;
|
|
95
|
+
}
|
|
96
|
+
if (end) {
|
|
97
|
+
depositorRequestData.timeRange.end = end;
|
|
98
|
+
}
|
|
99
|
+
if (step) {
|
|
100
|
+
depositorRequestData.timeRange.step = step;
|
|
101
|
+
}
|
|
102
|
+
jsonData = JSON.stringify(depositorRequestData);
|
|
103
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
104
|
+
method: "POST",
|
|
105
|
+
headers: headers,
|
|
106
|
+
body: jsonData,
|
|
107
|
+
})];
|
|
108
|
+
case 1:
|
|
109
|
+
response = _a.sent();
|
|
110
|
+
if (!response.ok) return [3 /*break*/, 3];
|
|
111
|
+
return [4 /*yield*/, response.json()];
|
|
112
|
+
case 2:
|
|
113
|
+
data = _a.sent();
|
|
114
|
+
samples = data.results[0].matrix.samples;
|
|
115
|
+
leader_board = samples.map(function (element) {
|
|
116
|
+
// console.log("metric:", element.metric, "values: ", element.values);
|
|
117
|
+
// console.log("user:", element.metric.labels.user, "score: ", element.values.at(-1).value);
|
|
118
|
+
return { user: element.metric.labels.user, score: element.values.at(-1).value };
|
|
119
|
+
});
|
|
120
|
+
leader_board.sort(function (a, b) { return b.score - a.score; });
|
|
121
|
+
// console.log(leader_board);
|
|
122
|
+
return [2 /*return*/, leader_board];
|
|
123
|
+
case 3: throw new Error("HTTP error! Status: ".concat(response.status));
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
exports.getDepositorLeaderBoard = getDepositorLeaderBoard;
|
|
129
|
+
var bidderRequestData = {
|
|
130
|
+
queries: [
|
|
131
|
+
{
|
|
132
|
+
query: "callPortfolioNewBid",
|
|
133
|
+
alias: "Score",
|
|
134
|
+
id: "a",
|
|
135
|
+
labelSelector: {},
|
|
136
|
+
aggregate: {
|
|
137
|
+
op: "SUM",
|
|
138
|
+
grouping: ["user"],
|
|
139
|
+
},
|
|
140
|
+
functions: [],
|
|
141
|
+
disabled: false,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
formulas: [],
|
|
145
|
+
timeRange: {
|
|
146
|
+
start: "now",
|
|
147
|
+
end: "now",
|
|
148
|
+
step: 1,
|
|
149
|
+
},
|
|
150
|
+
samplesLimit: 200,
|
|
151
|
+
};
|
|
152
|
+
function getBidderLeaderBoard(start, end, step) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
+
var jsonData, response, data, samples, leader_board;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
if (start) {
|
|
159
|
+
bidderRequestData.timeRange.start = start;
|
|
160
|
+
}
|
|
161
|
+
if (end) {
|
|
162
|
+
bidderRequestData.timeRange.end = end;
|
|
163
|
+
}
|
|
164
|
+
if (step) {
|
|
165
|
+
bidderRequestData.timeRange.step = step;
|
|
166
|
+
}
|
|
167
|
+
jsonData = JSON.stringify(bidderRequestData);
|
|
168
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
169
|
+
method: "POST",
|
|
170
|
+
headers: headers,
|
|
171
|
+
body: jsonData,
|
|
172
|
+
})];
|
|
173
|
+
case 1:
|
|
174
|
+
response = _a.sent();
|
|
175
|
+
if (!response.ok) return [3 /*break*/, 3];
|
|
176
|
+
return [4 /*yield*/, response.json()];
|
|
177
|
+
case 2:
|
|
178
|
+
data = _a.sent();
|
|
179
|
+
samples = data.results[0].matrix.samples;
|
|
180
|
+
leader_board = samples.map(function (element) {
|
|
181
|
+
// console.log("metric:", element.metric, "values: ", element.values);
|
|
182
|
+
// console.log("user:", element.metric.labels.user, "score: ", element.values.at(-1).value);
|
|
183
|
+
return { user: element.metric.labels.user, score: element.values.at(-1).value };
|
|
184
|
+
});
|
|
185
|
+
leader_board.sort(function (a, b) { return b.score - a.score; });
|
|
186
|
+
// console.log(leader_board);
|
|
187
|
+
return [2 /*return*/, leader_board];
|
|
188
|
+
case 3: throw new Error("HTTP error! Status: ".concat(response.status));
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
exports.getBidderLeaderBoard = getBidderLeaderBoard;
|
|
194
|
+
// (async () => {
|
|
195
|
+
// console.log(await getDepositorLeaderBoard("1682434800"));
|
|
196
|
+
// console.log(await getBidderLeaderBoard("1682434800"));
|
|
197
|
+
// })();
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
var sui_js_1 = require("@mysten/sui.js");
|
|
41
|
+
function getMintTx(gasBudget, packageId, registry, moduleName, amount) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
var tx;
|
|
44
|
+
return __generator(this, function (_a) {
|
|
45
|
+
tx = new sui_js_1.TransactionBlock();
|
|
46
|
+
tx.moveCall({
|
|
47
|
+
target: "".concat(packageId, "::").concat(moduleName, "::mint"),
|
|
48
|
+
arguments: [tx.pure(registry), tx.pure(amount)],
|
|
49
|
+
});
|
|
50
|
+
tx.setGasBudget(gasBudget);
|
|
51
|
+
return [2 /*return*/, tx];
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.getMintTx = getMintTx;
|
|
56
|
+
/*
|
|
57
|
+
sui client call --gas-budget 10000 --package 0xe879e96fb90a8559127091f1176a2d10bb67c6ff --module "token_btc" --function "mint" --args 0x5dce92f67eeda471369b734deac0d540b751cea6 10000
|
|
58
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function U64FromBytes(x: any): bigint;
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js";
|
|
2
|
+
/**
|
|
3
|
+
public(friend) entry fun authorized_add_portfolio_vault_authorized_user<O_TOKEN, U_TOKEN, B_TOKEN>(
|
|
4
|
+
registry: &mut Registry,
|
|
5
|
+
index: u64,
|
|
6
|
+
users: vector<address>,
|
|
7
|
+
ctx: &mut TxContext,
|
|
8
|
+
)
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAuthorizedAddPortfolioVaultAuthorizedUserTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, users: string[]): Promise<TransactionBlock>;
|
|
11
|
+
/**
|
|
12
|
+
public(friend) entry fun authorized_remove_portfolio_vault_authorized_user<O_TOKEN, U_TOKEN, B_TOKEN>(
|
|
13
|
+
registry: &mut Registry,
|
|
14
|
+
index: u64,
|
|
15
|
+
users: vector<address>,
|
|
16
|
+
ctx: &mut TxContext,
|
|
17
|
+
)
|
|
18
|
+
*/
|
|
19
|
+
export declare function getAuthorizedRemovePortfolioVaultAuthorizedUserTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, users: string[]): Promise<TransactionBlock>;
|
|
20
|
+
/**
|
|
21
|
+
public(friend) entry fun authorized_new_portfolio_vault<O_TOKEN, U_TOKEN, B_TOKEN>(
|
|
22
|
+
registry: &mut Registry,
|
|
23
|
+
price_oracle: &Oracle<O_TOKEN>,
|
|
24
|
+
clock: &Clock,
|
|
25
|
+
strategy_name: String,
|
|
26
|
+
period: u8,
|
|
27
|
+
activation_ts_ms: u64,
|
|
28
|
+
expiration_ts_ms: u64,
|
|
29
|
+
o_token_decimal: u64,
|
|
30
|
+
u_token_decimal: u64,
|
|
31
|
+
b_token_decimal: u64,
|
|
32
|
+
capacity: u64,
|
|
33
|
+
call_strike_pct: vector<u64>,
|
|
34
|
+
call_weight: vector<u64>,
|
|
35
|
+
call_is_buyer: vector<bool>,
|
|
36
|
+
put_strike_pct: vector<u64>,
|
|
37
|
+
put_weight: vector<u64>,
|
|
38
|
+
put_is_buyer: vector<bool>,
|
|
39
|
+
strike_increment: u64,
|
|
40
|
+
lot_size: u64,
|
|
41
|
+
decay_speed: u64,
|
|
42
|
+
initial_price: u64,
|
|
43
|
+
final_price: u64,
|
|
44
|
+
auction_duration_in_ms: u64,
|
|
45
|
+
leverage: u64,
|
|
46
|
+
has_next: bool,
|
|
47
|
+
whitelist: vector<address>,
|
|
48
|
+
ctx: &mut TxContext
|
|
49
|
+
)
|
|
50
|
+
*/
|
|
51
|
+
export declare function getAuthorizedNewPortfolioVaultTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, priceOracle: string, strategy_name: String, period: string, activation_ts_ms: string, expiration_ts_ms: string, o_token_decimal: string, u_token_decimal: string, b_token_decimal: string, capacity: string, call_strike_pct: string[], call_weight: string[], call_is_buyer: boolean[], put_strike_pct: string[], put_weight: string[], put_is_buyer: boolean[], strike_increment: string, lot_size: string, decay_speed: string, initial_price: string, final_price: string, auction_duration_in_ms: string, leverage: string, has_next: boolean, whitelist: string[]): Promise<TransactionBlock>;
|
|
52
|
+
/**
|
|
53
|
+
public(friend) entry fun authorized_update_capacity<O_TOKEN, U_TOKEN, B_TOKEN>(
|
|
54
|
+
registry: &mut Registry,
|
|
55
|
+
index: u64,
|
|
56
|
+
capacity: u64,
|
|
57
|
+
ctx: &mut TxContext,
|
|
58
|
+
)
|
|
59
|
+
*/
|
|
60
|
+
export declare function getAuthorizedUpdateCapacityTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, capacity: string): Promise<TransactionBlock>;
|
|
61
|
+
/**
|
|
62
|
+
public(friend) entry fun authorized_update_warmup_vault_config<O_TOKEN, U_TOKEN, B_TOKEN>(
|
|
63
|
+
registry: &mut Registry,
|
|
64
|
+
index: u64,
|
|
65
|
+
strike_increment: u64,
|
|
66
|
+
decay_speed: u64,
|
|
67
|
+
initial_price: u64,
|
|
68
|
+
final_price: u64,
|
|
69
|
+
auction_duration_in_ms: u64,
|
|
70
|
+
ctx: &mut TxContext,
|
|
71
|
+
)
|
|
72
|
+
*/
|
|
73
|
+
export declare function getAuthorizedUpdateWarmupVaultConfigTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, strike_increment: string, decay_speed: string, initial_price: string, final_price: string, auction_duration_in_ms: string): Promise<TransactionBlock>;
|
|
74
|
+
/**
|
|
75
|
+
public(friend) entry fun authorized_update_upcoming_vault_config<O_TOKEN, U_TOKEN, B_TOKEN>(
|
|
76
|
+
registry: &mut Registry,
|
|
77
|
+
index: u64,
|
|
78
|
+
call_strike_pct: vector<u64>,
|
|
79
|
+
call_weight: vector<u64>,
|
|
80
|
+
call_is_buyer: vector<bool>,
|
|
81
|
+
put_strike_pct: vector<u64>,
|
|
82
|
+
put_weight: vector<u64>,
|
|
83
|
+
put_is_buyer: vector<bool>,
|
|
84
|
+
strike_increment: u64,
|
|
85
|
+
decay_speed: u64,
|
|
86
|
+
initial_price: u64,
|
|
87
|
+
final_price: u64,
|
|
88
|
+
auction_duration_in_ms: u64,
|
|
89
|
+
ctx: &mut TxContext,
|
|
90
|
+
)
|
|
91
|
+
*/
|
|
92
|
+
export declare function getAuthorizedUpdateUpcomingVaultConfigTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, call_strike_pct: string[], call_weight: string[], call_is_buyer: boolean[], put_strike_pct: string[], put_weight: string[], put_is_buyer: boolean[], strike_increment: string, decay_speed: string, initial_price: string, final_price: string, auction_duration_in_ms: string): Promise<TransactionBlock>;
|
|
93
|
+
/**
|
|
94
|
+
public(friend) entry fun authorized_delivery<O_TOKEN, U_TOKEN, B_TOKEN>(
|
|
95
|
+
registry: &mut Registry,
|
|
96
|
+
index: u64,
|
|
97
|
+
price_oracle: &Oracle<O_TOKEN>,
|
|
98
|
+
clock: &Clock,
|
|
99
|
+
ctx: &mut TxContext
|
|
100
|
+
)
|
|
101
|
+
*/
|
|
102
|
+
export declare function getAuthorizedDeliveryTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string): Promise<TransactionBlock>;
|