@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.
Files changed (73) hide show
  1. package/package.json +2 -2
  2. package/lib/constants.d.ts +0 -22
  3. package/lib/constants.js +0 -35
  4. package/lib/utils/auction/sealedAuction.d.ts +0 -33
  5. package/lib/utils/auction/sealedAuction.js +0 -64
  6. package/lib/utils/portfolio/leader-board.d.ts +0 -7
  7. package/lib/utils/portfolio/leader-board.js +0 -197
  8. package/lib/utils/portfolio/mint.d.ts +0 -2
  9. package/lib/utils/portfolio/mint.js +0 -58
  10. package/lib/utils/portfolio/multiple-collateral/authorized-entry.d.ts +0 -102
  11. package/lib/utils/portfolio/multiple-collateral/authorized-entry.js +0 -295
  12. package/lib/utils/portfolio/multiple-collateral/manager-entry.d.ts +0 -219
  13. package/lib/utils/portfolio/multiple-collateral/manager-entry.js +0 -584
  14. package/lib/utils/portfolio/multiple-collateral/portfolio-vault.d.ts +0 -68
  15. package/lib/utils/portfolio/multiple-collateral/portfolio-vault.js +0 -296
  16. package/lib/utils/portfolio/multiple-collateral/user-entry.d.ts +0 -93
  17. package/lib/utils/portfolio/multiple-collateral/user-entry.js +0 -280
  18. package/lib/utils/portfolio/multiple-collateral/user-share.d.ts +0 -9
  19. package/lib/utils/portfolio/multiple-collateral/user-share.js +0 -166
  20. package/lib/utils/portfolio/multiple-collateral/view-function.d.ts +0 -9
  21. package/lib/utils/portfolio/multiple-collateral/view-function.js +0 -88
  22. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.d.ts +0 -5
  23. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.js +0 -61
  24. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedDeliveryTx.d.ts +0 -2
  25. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedDeliveryTx.js +0 -63
  26. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedNewPortfolioVaultTx.d.ts +0 -39
  27. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedNewPortfolioVaultTx.js +0 -118
  28. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.d.ts +0 -5
  29. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.js +0 -61
  30. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateCapacityTx.d.ts +0 -2
  31. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateCapacityTx.js +0 -58
  32. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.d.ts +0 -5
  33. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.js +0 -72
  34. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateWarmupVaultConfigTx.d.ts +0 -2
  35. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateWarmupVaultConfigTx.js +0 -66
  36. package/lib/utils/portfolio/single-collateral/manager/getAddAuthorizedUserTx.d.ts +0 -9
  37. package/lib/utils/portfolio/single-collateral/manager/getAddAuthorizedUserTx.js +0 -65
  38. package/lib/utils/portfolio/single-collateral/manager/getAddPortfolioVaultAuthorizedUserTx.d.ts +0 -11
  39. package/lib/utils/portfolio/single-collateral/manager/getAddPortfolioVaultAuthorizedUserTx.js +0 -67
  40. package/lib/utils/portfolio/single-collateral/manager/getCloseAuctionTx.d.ts +0 -2
  41. package/lib/utils/portfolio/single-collateral/manager/getCloseAuctionTx.js +0 -64
  42. package/lib/utils/portfolio/single-collateral/manager/getCloseVaultTx.d.ts +0 -2
  43. package/lib/utils/portfolio/single-collateral/manager/getCloseVaultTx.js +0 -58
  44. package/lib/utils/portfolio/single-collateral/manager/getDeliveryTx.d.ts +0 -2
  45. package/lib/utils/portfolio/single-collateral/manager/getDeliveryTx.js +0 -64
  46. package/lib/utils/portfolio/single-collateral/manager/getEvolutionTx.d.ts +0 -16
  47. package/lib/utils/portfolio/single-collateral/manager/getEvolutionTx.js +0 -80
  48. package/lib/utils/portfolio/single-collateral/manager/getNewManagerTx.d.ts +0 -9
  49. package/lib/utils/portfolio/single-collateral/manager/getNewManagerTx.js +0 -65
  50. package/lib/utils/portfolio/single-collateral/manager/getNewPortfolioVaultTx.d.ts +0 -39
  51. package/lib/utils/portfolio/single-collateral/manager/getNewPortfolioVaultTx.js +0 -118
  52. package/lib/utils/portfolio/single-collateral/manager/getRemoveAuthorizedUserTx.d.ts +0 -9
  53. package/lib/utils/portfolio/single-collateral/manager/getRemoveAuthorizedUserTx.js +0 -65
  54. package/lib/utils/portfolio/single-collateral/manager/getRemoveManagerTx.d.ts +0 -7
  55. package/lib/utils/portfolio/single-collateral/manager/getRemoveManagerTx.js +0 -63
  56. package/lib/utils/portfolio/single-collateral/manager/getRemovePortfolioVaultAuthorizedUserTx.d.ts +0 -11
  57. package/lib/utils/portfolio/single-collateral/manager/getRemovePortfolioVaultAuthorizedUserTx.js +0 -67
  58. package/lib/utils/portfolio/single-collateral/manager/getUpdateCapacityTx.d.ts +0 -2
  59. package/lib/utils/portfolio/single-collateral/manager/getUpdateCapacityTx.js +0 -58
  60. package/lib/utils/portfolio/single-collateral/portfolio-vault.d.ts +0 -61
  61. package/lib/utils/portfolio/single-collateral/portfolio-vault.js +0 -241
  62. package/lib/utils/portfolio/single-collateral/user-entry.d.ts +0 -81
  63. package/lib/utils/portfolio/single-collateral/user-entry.js +0 -247
  64. package/lib/utils/portfolio/single-collateral/user-share.d.ts +0 -8
  65. package/lib/utils/portfolio/single-collateral/user-share.js +0 -139
  66. package/lib/utils/portfolio/single-collateral/view-function.d.ts +0 -11
  67. package/lib/utils/portfolio/single-collateral/view-function.js +0 -99
  68. package/lib/utils/tools.d.ts +0 -1
  69. package/lib/utils/tools.js +0 -12
  70. package/lib/utils/typus-framework/dutch.d.ts +0 -25
  71. package/lib/utils/typus-framework/dutch.js +0 -84
  72. package/lib/utils/typus-framework/vault.d.ts +0 -32
  73. package/lib/utils/typus-framework/vault.js +0 -32
package/package.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.0.27",
5
+ "version": "1.0.29",
6
6
  "dependencies": {
7
- "@mysten/sui.js": "^0.32.1",
7
+ "@mysten/sui.js": "^0.33.0",
8
8
  "@types/node": "^17.0.0",
9
9
  "bignumber.js": "^9.1.1",
10
10
  "bs58": "^4.0.1",
@@ -1,22 +0,0 @@
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 DELETED
@@ -1,35 +0,0 @@
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.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;
7
- var sui_js_1 = require("@mysten/sui.js");
8
- var path_1 = __importDefault(require("path"));
9
- var dotenv_1 = __importDefault(require("dotenv"));
10
- // import .env file if exists
11
- dotenv_1.default.config({ path: path_1.default.resolve(__dirname, ".env") });
12
- exports.CLOCK = "0x6";
13
- exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
14
- exports.PRICE_DECIMAL = 8;
15
- exports.TOKEN_DECIMAL = 9;
16
- exports.DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
17
- exports.FAKE_TOKEN_TYPE_ARGUMENT = "0x27b3674c685046f66cad1d5496d2967894fa5329::token::USDC";
18
- exports.TOKEN_NAME = ["BTC", "ETH", "SUI", "USDC", "USDT", "APT", "DOGE"];
19
- exports.TOKEN_NAME_TO_MODULE = {
20
- BTC: "btc",
21
- ETH: "eth",
22
- SUI: "sui",
23
- USDC: "usdc",
24
- };
25
- exports.testnetConnection = new sui_js_1.Connection({
26
- fullnode: "https://fullnode.testnet.sui.io:443/",
27
- faucet: "https://faucet.testnet.sui.io/gas",
28
- });
29
- exports.ACTIVE_SUB_VAULT_TAG = 0;
30
- exports.DEACTIVATING_SUB_VAULT_TAG = 1;
31
- exports.INACTIVE_SUB_VAULT_TAG = 2;
32
- exports.WARMUP_SUB_VAULT_TAG = 3;
33
- exports.BIDDER_SUB_VAULT_TAG = 4;
34
- exports.PREMIUM_SUB_VAULT_TAG = 5;
35
- exports.PERFORMANCE_FEE_SUB_VAULT_TAG = 6;
@@ -1,33 +0,0 @@
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;
@@ -1,64 +0,0 @@
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;
@@ -1,7 +0,0 @@
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 {};
@@ -1,197 +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.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
- // })();
@@ -1,2 +0,0 @@
1
- import { TransactionBlock } from "@mysten/sui.js";
2
- export declare function getMintTx(gasBudget: number, packageId: string, registry: string, moduleName: string, amount: number): Promise<TransactionBlock>;
@@ -1,58 +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.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
- */
@@ -1,102 +0,0 @@
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>;