@typus/typus-sdk 1.2.66-tgld → 1.2.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils/api/defillama/tvl.d.ts +1 -0
- package/lib/utils/{user/view-functions.js → api/defillama/tvl.js} +13 -25
- package/lib/utils/{leader-board.d.ts → api/sentio/leader-board.d.ts} +0 -7
- package/lib/utils/api/sentio/leader-board.js +104 -0
- package/lib/utils/api/sentio/reward-generated.d.ts +8 -0
- package/lib/utils/api/sentio/reward-generated.js +175 -0
- package/lib/utils/locked-period-vault/user-entry.d.ts +81 -0
- package/lib/utils/locked-period-vault/user-entry.js +101 -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 +303 -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/db-data.d.ts +19 -0
- package/lib/utils/typus-dov-single/db-data.js +226 -0
- package/lib/utils/typus-dov-single/portfolio-vault.d.ts +63 -0
- package/lib/utils/typus-dov-single/portfolio-vault.js +284 -0
- package/lib/utils/typus-dov-single/registry.d.ts +14 -0
- package/lib/utils/typus-dov-single/registry.js +126 -0
- package/lib/utils/typus-dov-single/user-entry.d.ts +103 -0
- package/lib/utils/typus-dov-single/user-entry.js +388 -0
- package/lib/utils/typus-dov-single/user-history.d.ts +17 -0
- package/lib/utils/typus-dov-single/user-history.js +146 -0
- package/lib/utils/typus-dov-single/view-function.d.ts +50 -0
- package/lib/utils/typus-dov-single/view-function.js +444 -0
- package/lib/utils/typus-dov-single-v2/mfud-user-entry.d.ts +0 -4
- package/lib/utils/typus-dov-single-v2/mfud-user-entry.js +1 -5
- package/lib/utils/typus-dov-single-v2/user-entry.d.ts +0 -4
- package/lib/utils/typus-dov-single-v2/user-entry.js +2 -10
- package/lib/utils/typus-dov-single-v2/user-history.js +5 -1
- package/package.json +1 -1
- package/lib/utils/airdrop/authority-entry.d.ts +0 -22
- package/lib/utils/airdrop/authority-entry.js +0 -138
- package/lib/utils/airdrop/user-entry.d.ts +0 -10
- package/lib/utils/airdrop/user-entry.js +0 -21
- package/lib/utils/airdrop/view-functions.d.ts +0 -10
- package/lib/utils/airdrop/view-functions.js +0 -72
- package/lib/utils/leader-board.js +0 -333
- package/lib/utils/leaderboard/authority-entry.d.ts +0 -22
- package/lib/utils/leaderboard/authority-entry.js +0 -91
- package/lib/utils/leaderboard/view-function.d.ts +0 -21
- package/lib/utils/leaderboard/view-function.js +0 -92
- package/lib/utils/user/view-functions.d.ts +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTvl(): Promise<number>;
|
|
@@ -36,36 +36,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
|
|
41
|
-
var bcs_1 = require("@mysten/bcs");
|
|
42
|
-
exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
43
|
-
function getAirdrop(input) {
|
|
39
|
+
exports.getTvl = void 0;
|
|
40
|
+
function getTvl() {
|
|
44
41
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
var
|
|
42
|
+
var response, data;
|
|
46
43
|
return __generator(this, function (_a) {
|
|
47
44
|
switch (_a.label) {
|
|
48
|
-
case 0:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
target: "".concat(input.typusPackageId, "::user::get_user_metadata"),
|
|
52
|
-
typeArguments: [],
|
|
53
|
-
arguments: [
|
|
54
|
-
transactionBlock.pure(input.typusEcosystemVersion),
|
|
55
|
-
transactionBlock.pure(input.typusUserRegistry),
|
|
56
|
-
transactionBlock.pure(input.user),
|
|
57
|
-
],
|
|
58
|
-
});
|
|
59
|
-
return [4 /*yield*/, input.provider.devInspectTransactionBlock({ sender: exports.SENDER, transactionBlock: transactionBlock })];
|
|
45
|
+
case 0: return [4 /*yield*/, fetch("https://api.llama.fi/tvl/typus-finance", {
|
|
46
|
+
method: "GET",
|
|
47
|
+
})];
|
|
60
48
|
case 1:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
response = _a.sent();
|
|
50
|
+
return [4 /*yield*/, response.json()];
|
|
51
|
+
case 2:
|
|
52
|
+
data = _a.sent();
|
|
53
|
+
// console.log(data);
|
|
54
|
+
return [2 /*return*/, data];
|
|
67
55
|
}
|
|
68
56
|
});
|
|
69
57
|
});
|
|
70
58
|
}
|
|
71
|
-
exports.
|
|
59
|
+
exports.getTvl = getTvl;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export declare function getDepositorLeaderBoard(start?: string, end?: string, step?: number): Promise<LeaderBoard[]>;
|
|
2
|
-
export declare function getBidderLeaderBoard(startTimestamp?: string, end?: string): Promise<LeaderBoard[]>;
|
|
3
|
-
interface LeaderBoard {
|
|
4
|
-
user: string;
|
|
5
|
-
score: number;
|
|
6
|
-
}
|
|
7
1
|
export interface ExpLeaderBoard {
|
|
8
2
|
nft_id: string;
|
|
9
3
|
total_exp_earn: number;
|
|
@@ -11,4 +5,3 @@ export interface ExpLeaderBoard {
|
|
|
11
5
|
}
|
|
12
6
|
export declare function getExpLeaderBoardWithOwner(expLeaderBoard: ExpLeaderBoard[], ownerMap: Map<string, string>): Promise<ExpLeaderBoard[]>;
|
|
13
7
|
export declare function getExpLeaderBoard(startTimestamp: string, endTimestamp?: string): Promise<ExpLeaderBoard[]>;
|
|
14
|
-
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// const apiUrl = "https://app.sentio.xyz/api/v1/insights/wayne/typus/query";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
+
function step(op) {
|
|
17
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19
|
+
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;
|
|
20
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
+
switch (op[0]) {
|
|
22
|
+
case 0: case 1: t = op; break;
|
|
23
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
+
default:
|
|
27
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
+
if (t[2]) _.ops.pop();
|
|
32
|
+
_.trys.pop(); continue;
|
|
33
|
+
}
|
|
34
|
+
op = body.call(thisArg, _);
|
|
35
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.getExpLeaderBoard = exports.getExpLeaderBoardWithOwner = void 0;
|
|
41
|
+
function getExpLeaderBoardWithOwner(expLeaderBoard, ownerMap) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
+
return __generator(this, function (_a) {
|
|
44
|
+
return [2 /*return*/, expLeaderBoard.map(function (l) {
|
|
45
|
+
l.owner = ownerMap.get(l.nft_id);
|
|
46
|
+
return l;
|
|
47
|
+
})];
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.getExpLeaderBoardWithOwner = getExpLeaderBoardWithOwner;
|
|
52
|
+
var headers = {
|
|
53
|
+
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
54
|
+
"Content-Type": "application/json",
|
|
55
|
+
};
|
|
56
|
+
function getExpLeaderBoard(startTimestamp, endTimestamp) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
+
var apiUrl, _endTimestamp, requestData, jsonData, response, data;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
63
|
+
_endTimestamp = endTimestamp ? endTimestamp : "9999999999";
|
|
64
|
+
requestData = {
|
|
65
|
+
sqlQuery: {
|
|
66
|
+
// sql: `SELECT S.distinct_id AS owner, SUM(E.exp_earn) AS total_exp_earn
|
|
67
|
+
// FROM ExpUp E
|
|
68
|
+
// JOIN (
|
|
69
|
+
// SELECT number, distinct_id
|
|
70
|
+
// FROM StakeNft
|
|
71
|
+
// WHERE (number, timestamp) IN (
|
|
72
|
+
// SELECT number, MAX(timestamp) AS max_timestamp
|
|
73
|
+
// FROM StakeNft
|
|
74
|
+
// GROUP BY number
|
|
75
|
+
// )
|
|
76
|
+
// ) S ON E.number = S.number
|
|
77
|
+
// WHERE E.timestamp >= ${startTimestamp} && E.timestamp < ${_endTimestamp}
|
|
78
|
+
// GROUP BY owner
|
|
79
|
+
// ORDER BY total_exp_earn DESC;`,
|
|
80
|
+
sql: "\n SELECT E.nft_id as nft_id, SUM(E.exp_earn) as total_exp_earn\n FROM ExpUp E\n WHERE E.timestamp >= ".concat(startTimestamp, " && E.timestamp < ").concat(_endTimestamp, "\n GROUP BY nft_id\n ORDER BY total_exp_earn DESC;\n "),
|
|
81
|
+
size: 200,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
jsonData = JSON.stringify(requestData);
|
|
85
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
86
|
+
method: "POST",
|
|
87
|
+
headers: headers,
|
|
88
|
+
body: jsonData,
|
|
89
|
+
})];
|
|
90
|
+
case 1:
|
|
91
|
+
response = _a.sent();
|
|
92
|
+
return [4 /*yield*/, response.json()];
|
|
93
|
+
case 2:
|
|
94
|
+
data = _a.sent();
|
|
95
|
+
return [2 /*return*/, data.result.rows];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
exports.getExpLeaderBoard = getExpLeaderBoard;
|
|
101
|
+
// (async () => {
|
|
102
|
+
// const res1 = await getExpLeaderBoard("0");
|
|
103
|
+
// console.log(res1);
|
|
104
|
+
// })();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function getTotalDepositorIncentive(): Promise<TokenAmount>;
|
|
2
|
+
export declare function getTotalPremium(): Promise<number>;
|
|
3
|
+
export declare function getTotalProfitSharing(): Promise<TokenAmount[]>;
|
|
4
|
+
interface TokenAmount {
|
|
5
|
+
token: string;
|
|
6
|
+
total_amount: string;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
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.getTotalProfitSharing = exports.getTotalPremium = exports.getTotalDepositorIncentive = void 0;
|
|
40
|
+
var headers = {
|
|
41
|
+
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
};
|
|
44
|
+
function getTotalDepositorIncentive() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
+
var apiUrl, requestData, jsonData, response, data;
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
51
|
+
requestData = {
|
|
52
|
+
sqlQuery: {
|
|
53
|
+
sql: "\n SELECT SUM(E.depositor_incentive_value) as incentive\n FROM Delivery E\n ",
|
|
54
|
+
size: 2000000,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
jsonData = JSON.stringify(requestData);
|
|
58
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
59
|
+
method: "POST",
|
|
60
|
+
headers: headers,
|
|
61
|
+
body: jsonData,
|
|
62
|
+
})];
|
|
63
|
+
case 1:
|
|
64
|
+
response = _a.sent();
|
|
65
|
+
return [4 /*yield*/, response.json()];
|
|
66
|
+
case 2:
|
|
67
|
+
data = _a.sent();
|
|
68
|
+
return [2 /*return*/, { token: "SUI", total_amount: data.result.rows[0].incentive }];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.getTotalDepositorIncentive = getTotalDepositorIncentive;
|
|
74
|
+
function getTotalPremium() {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
var apiUrl, requestData, jsonData, response, data;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_v2/query";
|
|
81
|
+
requestData = {
|
|
82
|
+
timeRange: {
|
|
83
|
+
start: "now",
|
|
84
|
+
end: "now",
|
|
85
|
+
step: 3600,
|
|
86
|
+
timezone: "Europe/Paris",
|
|
87
|
+
},
|
|
88
|
+
limit: 1,
|
|
89
|
+
queries: [
|
|
90
|
+
{
|
|
91
|
+
metricsQuery: {
|
|
92
|
+
query: "PremiumUSD",
|
|
93
|
+
alias: "",
|
|
94
|
+
id: "a",
|
|
95
|
+
labelSelector: {},
|
|
96
|
+
aggregate: {
|
|
97
|
+
op: "SUM",
|
|
98
|
+
grouping: ["chain"],
|
|
99
|
+
},
|
|
100
|
+
functions: [
|
|
101
|
+
{
|
|
102
|
+
name: "sum_over_time",
|
|
103
|
+
arguments: [
|
|
104
|
+
{
|
|
105
|
+
durationValue: {
|
|
106
|
+
value: 520,
|
|
107
|
+
unit: "w",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
disabled: false,
|
|
114
|
+
},
|
|
115
|
+
dataSource: "METRICS",
|
|
116
|
+
sourceName: "",
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
formulas: [],
|
|
120
|
+
};
|
|
121
|
+
jsonData = JSON.stringify(requestData);
|
|
122
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
123
|
+
method: "POST",
|
|
124
|
+
headers: headers,
|
|
125
|
+
body: jsonData,
|
|
126
|
+
})];
|
|
127
|
+
case 1:
|
|
128
|
+
response = _a.sent();
|
|
129
|
+
return [4 /*yield*/, response.json()];
|
|
130
|
+
case 2:
|
|
131
|
+
data = _a.sent();
|
|
132
|
+
return [2 /*return*/, data.results[0].matrix.samples[0].values[0].value];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
exports.getTotalPremium = getTotalPremium;
|
|
138
|
+
function getTotalProfitSharing() {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
+
var apiUrl, requestData, jsonData, response, data;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
145
|
+
requestData = {
|
|
146
|
+
sqlQuery: {
|
|
147
|
+
sql: "\n SELECT token, SUM(amount) AS total_amount\n FROM ClaimProfitSharing\n GROUP BY token;\n ",
|
|
148
|
+
size: 2000000,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
jsonData = JSON.stringify(requestData);
|
|
152
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
153
|
+
method: "POST",
|
|
154
|
+
headers: headers,
|
|
155
|
+
body: jsonData,
|
|
156
|
+
})];
|
|
157
|
+
case 1:
|
|
158
|
+
response = _a.sent();
|
|
159
|
+
return [4 /*yield*/, response.json()];
|
|
160
|
+
case 2:
|
|
161
|
+
data = _a.sent();
|
|
162
|
+
return [2 /*return*/, data.result.rows];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
exports.getTotalProfitSharing = getTotalProfitSharing;
|
|
168
|
+
// (async () => {
|
|
169
|
+
// const res1 = await getTotalDepositorIncentive();
|
|
170
|
+
// console.log(res1);
|
|
171
|
+
// const res2 = await getTotalPremium();
|
|
172
|
+
// console.log(res2);
|
|
173
|
+
// const res3 = await getTotalProfitSharing();
|
|
174
|
+
// console.log(res3);
|
|
175
|
+
// })();
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { TransactionBlock, TransactionObjectArgument } from "@mysten/sui.js/transactions";
|
|
2
|
+
/**
|
|
3
|
+
public fun lock_receipt(
|
|
4
|
+
registry: &mut Registry,
|
|
5
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
6
|
+
index: u64,
|
|
7
|
+
receipt: TypusDepositReceipt, // from tails_staking::deposit result or owned
|
|
8
|
+
split_active_share: u64,
|
|
9
|
+
split_warmup_share: u64,
|
|
10
|
+
clock: &Clock,
|
|
11
|
+
ctx: &mut TxContext
|
|
12
|
+
): TypusDepositReceipt
|
|
13
|
+
*/
|
|
14
|
+
export declare function getLockReceiptTx(input: {
|
|
15
|
+
tx: TransactionBlock;
|
|
16
|
+
lockedVaultPackageId: string;
|
|
17
|
+
typusDovSingleRegistry: string;
|
|
18
|
+
lockedVaultRegistry: string;
|
|
19
|
+
index: string;
|
|
20
|
+
receipt: TransactionObjectArgument;
|
|
21
|
+
split_active_share: string;
|
|
22
|
+
split_warmup_share: string;
|
|
23
|
+
}): TransactionBlock;
|
|
24
|
+
/**
|
|
25
|
+
public fun leave(
|
|
26
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
27
|
+
index: u64,
|
|
28
|
+
clock: &Clock,
|
|
29
|
+
ctx: &mut TxContext
|
|
30
|
+
)
|
|
31
|
+
*/
|
|
32
|
+
export declare function getLeaveTx(input: {
|
|
33
|
+
tx: TransactionBlock;
|
|
34
|
+
lockedVaultPackageId: string;
|
|
35
|
+
lockedVaultRegistry: string;
|
|
36
|
+
index: string;
|
|
37
|
+
}): TransactionBlock;
|
|
38
|
+
/**
|
|
39
|
+
public fun unlock_receipt(
|
|
40
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
41
|
+
index: u64,
|
|
42
|
+
ctx: &mut TxContext
|
|
43
|
+
)
|
|
44
|
+
*/
|
|
45
|
+
export declare function getUnlockReceiptTx(input: {
|
|
46
|
+
tx: TransactionBlock;
|
|
47
|
+
lockedVaultPackageId: string;
|
|
48
|
+
lockedVaultRegistry: string;
|
|
49
|
+
index: string;
|
|
50
|
+
}): TransactionBlock;
|
|
51
|
+
/**
|
|
52
|
+
public fun withdraw_incentive<T>(
|
|
53
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
54
|
+
index: u64,
|
|
55
|
+
ctx: &mut TxContext
|
|
56
|
+
): Coin<T>
|
|
57
|
+
*/
|
|
58
|
+
export declare function getWithdrawIncentiveTx(input: {
|
|
59
|
+
tx: TransactionBlock;
|
|
60
|
+
lockedVaultPackageId: string;
|
|
61
|
+
lockedVaultRegistry: string;
|
|
62
|
+
index: string;
|
|
63
|
+
sender: string;
|
|
64
|
+
}): TransactionBlock;
|
|
65
|
+
/**
|
|
66
|
+
public fun withdraw_premium<D_TOKEN, B_TOKEN>(
|
|
67
|
+
registry: &mut Registry,
|
|
68
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
69
|
+
index: u64,
|
|
70
|
+
ctx: &mut TxContext
|
|
71
|
+
): Coin<B_TOKEN>
|
|
72
|
+
*/
|
|
73
|
+
export declare function getWithdrawPremiumTx(input: {
|
|
74
|
+
tx: TransactionBlock;
|
|
75
|
+
lockedVaultPackageId: string;
|
|
76
|
+
typusDovSingleRegistry: string;
|
|
77
|
+
lockedVaultRegistry: string;
|
|
78
|
+
index: string;
|
|
79
|
+
sender: string;
|
|
80
|
+
typeArguments: string[];
|
|
81
|
+
}): TransactionBlock;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWithdrawPremiumTx = exports.getWithdrawIncentiveTx = exports.getUnlockReceiptTx = exports.getLeaveTx = exports.getLockReceiptTx = void 0;
|
|
4
|
+
var constants_1 = require("../../constants");
|
|
5
|
+
/**
|
|
6
|
+
public fun lock_receipt(
|
|
7
|
+
registry: &mut Registry,
|
|
8
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
9
|
+
index: u64,
|
|
10
|
+
receipt: TypusDepositReceipt, // from tails_staking::deposit result or owned
|
|
11
|
+
split_active_share: u64,
|
|
12
|
+
split_warmup_share: u64,
|
|
13
|
+
clock: &Clock,
|
|
14
|
+
ctx: &mut TxContext
|
|
15
|
+
): TypusDepositReceipt
|
|
16
|
+
*/
|
|
17
|
+
function getLockReceiptTx(input) {
|
|
18
|
+
input.tx.moveCall({
|
|
19
|
+
target: "".concat(input.lockedVaultPackageId, "::locked_period_vault::lock_receipt"),
|
|
20
|
+
typeArguments: [],
|
|
21
|
+
arguments: [
|
|
22
|
+
input.tx.object(input.typusDovSingleRegistry),
|
|
23
|
+
input.tx.object(input.lockedVaultRegistry),
|
|
24
|
+
input.tx.pure(input.index),
|
|
25
|
+
input.receipt,
|
|
26
|
+
input.tx.pure(input.split_active_share),
|
|
27
|
+
input.tx.pure(input.split_warmup_share),
|
|
28
|
+
input.tx.pure(constants_1.CLOCK),
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
return input.tx;
|
|
32
|
+
}
|
|
33
|
+
exports.getLockReceiptTx = getLockReceiptTx;
|
|
34
|
+
/**
|
|
35
|
+
public fun leave(
|
|
36
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
37
|
+
index: u64,
|
|
38
|
+
clock: &Clock,
|
|
39
|
+
ctx: &mut TxContext
|
|
40
|
+
)
|
|
41
|
+
*/
|
|
42
|
+
function getLeaveTx(input) {
|
|
43
|
+
input.tx.moveCall({
|
|
44
|
+
target: "".concat(input.lockedVaultPackageId, "::locked_period_vault::leave"),
|
|
45
|
+
typeArguments: [],
|
|
46
|
+
arguments: [input.tx.object(input.lockedVaultRegistry), input.tx.pure(input.index), input.tx.pure(constants_1.CLOCK)],
|
|
47
|
+
});
|
|
48
|
+
return input.tx;
|
|
49
|
+
}
|
|
50
|
+
exports.getLeaveTx = getLeaveTx;
|
|
51
|
+
/**
|
|
52
|
+
public fun unlock_receipt(
|
|
53
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
54
|
+
index: u64,
|
|
55
|
+
ctx: &mut TxContext
|
|
56
|
+
)
|
|
57
|
+
*/
|
|
58
|
+
function getUnlockReceiptTx(input) {
|
|
59
|
+
input.tx.moveCall({
|
|
60
|
+
target: "".concat(input.lockedVaultPackageId, "::locked_period_vault::unlock_receipt"),
|
|
61
|
+
typeArguments: [],
|
|
62
|
+
arguments: [input.tx.object(input.lockedVaultRegistry), input.tx.pure(input.index)],
|
|
63
|
+
});
|
|
64
|
+
return input.tx;
|
|
65
|
+
}
|
|
66
|
+
exports.getUnlockReceiptTx = getUnlockReceiptTx;
|
|
67
|
+
/**
|
|
68
|
+
public fun withdraw_incentive<T>(
|
|
69
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
70
|
+
index: u64,
|
|
71
|
+
ctx: &mut TxContext
|
|
72
|
+
): Coin<T>
|
|
73
|
+
*/
|
|
74
|
+
function getWithdrawIncentiveTx(input) {
|
|
75
|
+
var coin = input.tx.moveCall({
|
|
76
|
+
target: "".concat(input.lockedVaultPackageId, "::locked_period_vault::withdraw_incentive"),
|
|
77
|
+
typeArguments: ["0x2::sui::SUI"],
|
|
78
|
+
arguments: [input.tx.object(input.lockedVaultRegistry), input.tx.pure(input.index)],
|
|
79
|
+
});
|
|
80
|
+
input.tx.transferObjects([coin], input.sender);
|
|
81
|
+
return input.tx;
|
|
82
|
+
}
|
|
83
|
+
exports.getWithdrawIncentiveTx = getWithdrawIncentiveTx;
|
|
84
|
+
/**
|
|
85
|
+
public fun withdraw_premium<D_TOKEN, B_TOKEN>(
|
|
86
|
+
registry: &mut Registry,
|
|
87
|
+
locked_vault_registry: &mut LockedVaultRegistry,
|
|
88
|
+
index: u64,
|
|
89
|
+
ctx: &mut TxContext
|
|
90
|
+
): Coin<B_TOKEN>
|
|
91
|
+
*/
|
|
92
|
+
function getWithdrawPremiumTx(input) {
|
|
93
|
+
var coin = input.tx.moveCall({
|
|
94
|
+
target: "".concat(input.lockedVaultPackageId, "::locked_period_vault::withdraw_premium"),
|
|
95
|
+
typeArguments: input.typeArguments,
|
|
96
|
+
arguments: [input.tx.object(input.typusDovSingleRegistry), input.tx.object(input.lockedVaultRegistry), input.tx.pure(input.index)],
|
|
97
|
+
});
|
|
98
|
+
input.tx.transferObjects([coin], input.sender);
|
|
99
|
+
return input.tx;
|
|
100
|
+
}
|
|
101
|
+
exports.getWithdrawPremiumTx = getWithdrawPremiumTx;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
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>;
|