@typus/typus-sdk 1.1.57 → 1.1.59
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/mainnet.json +67 -0
- package/lib/utils/auto-bid/user-entry.d.ts +27 -0
- package/lib/utils/auto-bid/user-entry.js +102 -0
- package/lib/utils/auto-bid/view-function.d.ts +33 -0
- package/lib/utils/auto-bid/view-function.js +215 -0
- package/lib/utils/nft-staking/authorized-entry.d.ts +2 -2
- package/lib/utils/nft-staking/authorized-entry.js +29 -9
- package/lib/utils/nft-staking/user-entry.d.ts +3 -3
- package/lib/utils/nft-staking/user-entry.js +6 -6
- package/lib/utils/price.d.ts +2 -0
- package/lib/utils/price.js +101 -1
- package/lib/utils/recap2023.d.ts +1 -0
- package/lib/utils/recap2023.js +176 -0
- package/lib/utils/tails-exp-dice/fetch.d.ts +1 -0
- package/lib/utils/tails-exp-dice/fetch.js +9 -6
- package/lib/utils/token.js +4 -0
- package/lib/utils/typus-dov-single-v2/authorized-entry.d.ts +1 -0
- package/lib/utils/typus-dov-single-v2/authorized-entry.js +1 -0
- package/lib/utils/typus-dov-single-v2/mfud-user-entry.d.ts +125 -0
- package/lib/utils/typus-dov-single-v2/mfud-user-entry.js +270 -0
- package/lib/utils/typus-dov-single-v2/user-entry.d.ts +133 -30
- package/lib/utils/typus-dov-single-v2/user-entry.js +334 -253
- package/lib/utils/typus-dov-single-v2/user-history.js +8 -1
- package/package.json +1 -1
package/lib/utils/price.js
CHANGED
|
@@ -35,8 +35,19 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
38
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getLatestPrice = exports.getPairPrices = void 0;
|
|
50
|
+
exports.getLatestPriceUSD = exports.getPythLatestPrice = exports.getLatestPrice = exports.getPairPrices = void 0;
|
|
40
51
|
var apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/db-price";
|
|
41
52
|
function getPairPrices(pair, startTs, endTs) {
|
|
42
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -84,3 +95,92 @@ function getLatestPrice(pair) {
|
|
|
84
95
|
});
|
|
85
96
|
}
|
|
86
97
|
exports.getLatestPrice = getLatestPrice;
|
|
98
|
+
function getPythLatestPrice() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
+
var apiUrlWithParams, response, map, data;
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
apiUrlWithParams = "https://hermes.pyth.network/api/latest_price_feeds?ids[]=0x23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744&ids[]=0xe5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef&ids[]=0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a&ids[]=0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43&ids[]=0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace&ids[]=0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d&ids[]=0xf9c2e890443dd995d0baafc08eea3358be1ffb874f93f99c30b3816c460bbac3&ids[]=0x03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5&ids[]=0x2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b&ids[]=0xdcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c&ids[]=0x7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592&ids[]=0x53614f1cb0c031d4af66c04cb9c756234adad0e1cee85303795091499a4084eb";
|
|
105
|
+
return [4 /*yield*/, fetch(apiUrlWithParams, {
|
|
106
|
+
method: "GET",
|
|
107
|
+
headers: { "Content-Type": "application/json" },
|
|
108
|
+
})];
|
|
109
|
+
case 1:
|
|
110
|
+
response = _a.sent();
|
|
111
|
+
map = new Map();
|
|
112
|
+
if (!response.ok) return [3 /*break*/, 3];
|
|
113
|
+
return [4 /*yield*/, response.json()];
|
|
114
|
+
case 2:
|
|
115
|
+
data = _a.sent();
|
|
116
|
+
data.forEach(function (p) {
|
|
117
|
+
var token = pythId[p.id];
|
|
118
|
+
var price = p.price.price / Math.pow(10, -p.price.expo);
|
|
119
|
+
map.set(token, price);
|
|
120
|
+
});
|
|
121
|
+
return [2 /*return*/, map];
|
|
122
|
+
case 3: return [2 /*return*/];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
exports.getPythLatestPrice = getPythLatestPrice;
|
|
128
|
+
function getLatestPriceUSD() {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
+
var prices, _a, _b, pair, currentTimestampInSeconds, minuteAgo, res, price, e_1_1;
|
|
131
|
+
var e_1, _c;
|
|
132
|
+
return __generator(this, function (_d) {
|
|
133
|
+
switch (_d.label) {
|
|
134
|
+
case 0: return [4 /*yield*/, getPythLatestPrice()];
|
|
135
|
+
case 1:
|
|
136
|
+
prices = (_d.sent());
|
|
137
|
+
_d.label = 2;
|
|
138
|
+
case 2:
|
|
139
|
+
_d.trys.push([2, 7, 8, 9]);
|
|
140
|
+
_a = __values(["SUIFUD", "SUIBUCK", "SUIAFSUI"]), _b = _a.next();
|
|
141
|
+
_d.label = 3;
|
|
142
|
+
case 3:
|
|
143
|
+
if (!!_b.done) return [3 /*break*/, 6];
|
|
144
|
+
pair = _b.value;
|
|
145
|
+
currentTimestampInSeconds = Math.floor(new Date().getTime() / 1000);
|
|
146
|
+
minuteAgo = currentTimestampInSeconds - 300;
|
|
147
|
+
return [4 /*yield*/, getPairPrices(pair, minuteAgo.toString(), currentTimestampInSeconds.toString())];
|
|
148
|
+
case 4:
|
|
149
|
+
res = _d.sent();
|
|
150
|
+
price = res.at(-1).price;
|
|
151
|
+
prices.set(pair.replace("SUI", ""), prices.get("SUI") / Number(price));
|
|
152
|
+
_d.label = 5;
|
|
153
|
+
case 5:
|
|
154
|
+
_b = _a.next();
|
|
155
|
+
return [3 /*break*/, 3];
|
|
156
|
+
case 6: return [3 /*break*/, 9];
|
|
157
|
+
case 7:
|
|
158
|
+
e_1_1 = _d.sent();
|
|
159
|
+
e_1 = { error: e_1_1 };
|
|
160
|
+
return [3 /*break*/, 9];
|
|
161
|
+
case 8:
|
|
162
|
+
try {
|
|
163
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
164
|
+
}
|
|
165
|
+
finally { if (e_1) throw e_1.error; }
|
|
166
|
+
return [7 /*endfinally*/];
|
|
167
|
+
case 9: return [2 /*return*/, prices];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
exports.getLatestPriceUSD = getLatestPriceUSD;
|
|
173
|
+
var pythId = {
|
|
174
|
+
"23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744": "SUI",
|
|
175
|
+
e5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef: "CETUS",
|
|
176
|
+
eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a: "USDC",
|
|
177
|
+
e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43: "BTC",
|
|
178
|
+
ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace: "ETH",
|
|
179
|
+
ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d: "SOL",
|
|
180
|
+
f9c2e890443dd995d0baafc08eea3358be1ffb874f93f99c30b3816c460bbac3: "TURBOS",
|
|
181
|
+
"03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5": "APT",
|
|
182
|
+
"2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b": "USDT",
|
|
183
|
+
dcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c: "DOGE",
|
|
184
|
+
"7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592": "INJ",
|
|
185
|
+
"53614f1cb0c031d4af66c04cb9c756234adad0e1cee85303795091499a4084eb": "SEI",
|
|
186
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function recap2023(user: string): Promise<(string | number | undefined)[]>;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
49
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
+
if (!m) return o;
|
|
52
|
+
var i = m.call(o), r, ar = [], e;
|
|
53
|
+
try {
|
|
54
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
+
}
|
|
56
|
+
catch (error) { e = { error: error }; }
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
+
}
|
|
61
|
+
finally { if (e) throw e.error; }
|
|
62
|
+
}
|
|
63
|
+
return ar;
|
|
64
|
+
};
|
|
65
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
66
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
67
|
+
};
|
|
68
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
|
+
exports.recap2023 = void 0;
|
|
70
|
+
var mainnet_json_1 = __importDefault(require("../mainnet.json"));
|
|
71
|
+
var user_history_1 = require("../utils/typus-dov-single-v2/user-history");
|
|
72
|
+
var view_function_1 = require("../utils/typus-dov-single-v2/view-function");
|
|
73
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
74
|
+
var price_1 = require("../utils/price");
|
|
75
|
+
var fetch_1 = require("../utils/nft-staking/fetch");
|
|
76
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
var user, res;
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0:
|
|
81
|
+
user = "0xdc72506f269feb89822c13e66b282bc52c5724c27e575a04cbec949a13671d13";
|
|
82
|
+
return [4 /*yield*/, recap2023(user)];
|
|
83
|
+
case 1:
|
|
84
|
+
res = _a.sent();
|
|
85
|
+
console.log(res);
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}); })();
|
|
90
|
+
function recap2023(user) {
|
|
91
|
+
var _a, _b, _c, _d;
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
var provider, vaults, userHistory, earn, userHistory_1, userHistory_1_1, history_1, token, amount, sum_1, prices, sum, _e, _f, _g, token, amount, price, res_1;
|
|
94
|
+
var e_1, _h, _j, _k, _l, _m, e_2, _o;
|
|
95
|
+
return __generator(this, function (_p) {
|
|
96
|
+
switch (_p.label) {
|
|
97
|
+
case 0:
|
|
98
|
+
provider = new client_1.SuiClient({
|
|
99
|
+
url: mainnet_json_1.default.RPC_ENDPOINT,
|
|
100
|
+
});
|
|
101
|
+
return [4 /*yield*/, (0, view_function_1.getVaults)(provider, mainnet_json_1.default.SINGLE_COLLATERAL_PACKAGE, mainnet_json_1.default.SINGLE_COLLATERAL_REGISTRY, [])];
|
|
102
|
+
case 1:
|
|
103
|
+
vaults = _p.sent();
|
|
104
|
+
return [4 /*yield*/, (0, user_history_1.getUserHistory)(provider, mainnet_json_1.default.SINGLE_COLLATERAL_PACKAGE_ORIGIN, vaults, user, 0)];
|
|
105
|
+
case 2:
|
|
106
|
+
userHistory = _p.sent();
|
|
107
|
+
console.log(userHistory);
|
|
108
|
+
earn = new Map();
|
|
109
|
+
try {
|
|
110
|
+
for (userHistory_1 = __values(userHistory), userHistory_1_1 = userHistory_1.next(); !userHistory_1_1.done; userHistory_1_1 = userHistory_1.next()) {
|
|
111
|
+
history_1 = userHistory_1_1.value;
|
|
112
|
+
token = "";
|
|
113
|
+
amount = "";
|
|
114
|
+
if (history_1.Action.startsWith("Harvest")) {
|
|
115
|
+
_j = __read((_a = history_1.Amount) === null || _a === void 0 ? void 0 : _a.split(" "), 2), amount = _j[0], token = _j[1];
|
|
116
|
+
// console.log(`Harvest ${amount} ${token}`);
|
|
117
|
+
}
|
|
118
|
+
else if (history_1.Action.startsWith("Compound")) {
|
|
119
|
+
_k = __read((_b = history_1.Amount) === null || _b === void 0 ? void 0 : _b.split(" "), 2), amount = _k[0], token = _k[1];
|
|
120
|
+
// console.log(`Compound ${amount} ${token}`);
|
|
121
|
+
}
|
|
122
|
+
else if (history_1.Action.startsWith("Exercise")) {
|
|
123
|
+
_l = __read((_c = history_1.Amount) === null || _c === void 0 ? void 0 : _c.split(" "), 2), amount = _l[0], token = _l[1];
|
|
124
|
+
// console.log(`Exercise ${amount} ${token}`);
|
|
125
|
+
}
|
|
126
|
+
else if (history_1.Action.startsWith("Claim Profit Sharing")) {
|
|
127
|
+
_m = __read((_d = history_1.Amount) === null || _d === void 0 ? void 0 : _d.split(" "), 2), amount = _m[0], token = _m[1];
|
|
128
|
+
// console.log(`Claim Profit Sharing ${amount} ${token}`);
|
|
129
|
+
}
|
|
130
|
+
if (earn.has(token)) {
|
|
131
|
+
sum_1 = earn.get(token);
|
|
132
|
+
earn.set(token, sum_1 + Number(amount));
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
earn.set(token, Number(amount));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
140
|
+
finally {
|
|
141
|
+
try {
|
|
142
|
+
if (userHistory_1_1 && !userHistory_1_1.done && (_h = userHistory_1.return)) _h.call(userHistory_1);
|
|
143
|
+
}
|
|
144
|
+
finally { if (e_1) throw e_1.error; }
|
|
145
|
+
}
|
|
146
|
+
// console.log(earn);
|
|
147
|
+
earn.delete("");
|
|
148
|
+
return [4 /*yield*/, (0, price_1.getLatestPriceUSD)()];
|
|
149
|
+
case 3:
|
|
150
|
+
prices = _p.sent();
|
|
151
|
+
sum = 0;
|
|
152
|
+
try {
|
|
153
|
+
for (_e = __values(earn.entries()), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
154
|
+
_g = __read(_f.value, 2), token = _g[0], amount = _g[1];
|
|
155
|
+
price = prices.get(token.replace("W", ""));
|
|
156
|
+
// console.log(`${token} ${price * amount}`);
|
|
157
|
+
sum += price * amount;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
161
|
+
finally {
|
|
162
|
+
try {
|
|
163
|
+
if (_f && !_f.done && (_o = _e.return)) _o.call(_e);
|
|
164
|
+
}
|
|
165
|
+
finally { if (e_2) throw e_2.error; }
|
|
166
|
+
}
|
|
167
|
+
return [4 /*yield*/, (0, fetch_1.getUserStake)(provider, mainnet_json_1.default.NFT_TABLE, user)];
|
|
168
|
+
case 4:
|
|
169
|
+
res_1 = _p.sent();
|
|
170
|
+
// console.log(res_1!.number); // null
|
|
171
|
+
return [2 /*return*/, [sum, res_1 === null || res_1 === void 0 ? void 0 : res_1.url]];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
exports.recap2023 = recap2023;
|
|
@@ -54,6 +54,7 @@ export interface ProfitSharing {
|
|
|
54
54
|
pool: string;
|
|
55
55
|
remaining: string;
|
|
56
56
|
total: string;
|
|
57
|
+
tokenType: string;
|
|
57
58
|
}
|
|
58
59
|
export declare function getProfitSharing(provider: SuiClient, diceProfitSharing: string): Promise<ProfitSharing>;
|
|
59
60
|
export declare function calculateLevelReward(totalRewards: number, levelShares: number[], numOfHolders: number[]): number[];
|
|
@@ -246,18 +246,21 @@ function getLeaderBoard(drawDisplays) {
|
|
|
246
246
|
}
|
|
247
247
|
exports.getLeaderBoard = getLeaderBoard;
|
|
248
248
|
function getProfitSharing(provider, diceProfitSharing) {
|
|
249
|
-
var _a, _b;
|
|
249
|
+
var _a, _b, _c, _d;
|
|
250
250
|
return __awaiter(this, void 0, void 0, function () {
|
|
251
|
-
var object, result;
|
|
252
|
-
return __generator(this, function (
|
|
253
|
-
switch (
|
|
251
|
+
var object, type, tokenType, result;
|
|
252
|
+
return __generator(this, function (_e) {
|
|
253
|
+
switch (_e.label) {
|
|
254
254
|
case 0: return [4 /*yield*/, provider.getObject({
|
|
255
255
|
id: diceProfitSharing,
|
|
256
256
|
options: { showContent: true },
|
|
257
257
|
})];
|
|
258
258
|
case 1:
|
|
259
|
-
object =
|
|
260
|
-
|
|
259
|
+
object = _e.sent();
|
|
260
|
+
type = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content.type;
|
|
261
|
+
tokenType = (_b = type.split("<").at(-1)) === null || _b === void 0 ? void 0 : _b.replace(">>", "");
|
|
262
|
+
result = (_d = (_c = object.data) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.fields.value.fields;
|
|
263
|
+
result.tokenType = tokenType;
|
|
261
264
|
return [2 /*return*/, result];
|
|
262
265
|
}
|
|
263
266
|
});
|
package/lib/utils/token.js
CHANGED
|
@@ -24,6 +24,10 @@ function typeArgToAsset(typeArg) {
|
|
|
24
24
|
return "TURBOS";
|
|
25
25
|
case "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37":
|
|
26
26
|
return "APT";
|
|
27
|
+
case "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1":
|
|
28
|
+
return "FUD";
|
|
29
|
+
case "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc":
|
|
30
|
+
return "AFSUI";
|
|
27
31
|
default:
|
|
28
32
|
if (typeArgs[2] == "BTC") {
|
|
29
33
|
return "WBTC";
|
|
@@ -64,6 +64,7 @@ export interface UpdateConfigRequests {
|
|
|
64
64
|
capacity?: string;
|
|
65
65
|
leverage?: string;
|
|
66
66
|
riskLevel?: string;
|
|
67
|
+
depositIncentiveBpDivisorDecimal?: string;
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
export declare function getUpdateConfigTx(gasBudget: number, packageId: string, registry: string, requests: UpdateConfigRequests[]): Promise<TransactionBlock>;
|
|
@@ -156,6 +156,7 @@ function getUpdateConfigTx(gasBudget, packageId, registry, requests) {
|
|
|
156
156
|
tx.pure(request.config.capacity ? [request.config.capacity] : []),
|
|
157
157
|
tx.pure(request.config.leverage ? [request.config.leverage] : []),
|
|
158
158
|
tx.pure(request.config.riskLevel ? [request.config.riskLevel] : []),
|
|
159
|
+
tx.pure(request.config.depositIncentiveBpDivisorDecimal ? [request.config.depositIncentiveBpDivisorDecimal] : []),
|
|
159
160
|
],
|
|
160
161
|
});
|
|
161
162
|
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { TransactionBlock, TransactionObjectArgument } from "@mysten/sui.js/transactions";
|
|
2
|
+
export declare function getDepositTx(input: {
|
|
3
|
+
tx: TransactionBlock;
|
|
4
|
+
typusFrameworkOriginPackageId: string;
|
|
5
|
+
typusDovSinglePackageId: string;
|
|
6
|
+
typusDovSingleRegistry: string;
|
|
7
|
+
mfudPackageId: string;
|
|
8
|
+
mfudRegistry: string;
|
|
9
|
+
mfudAmount: string;
|
|
10
|
+
typeArguments: string[];
|
|
11
|
+
index: string;
|
|
12
|
+
receipts: string[] | TransactionObjectArgument[];
|
|
13
|
+
user: string;
|
|
14
|
+
coins: string[];
|
|
15
|
+
}): TransactionBlock;
|
|
16
|
+
export declare function getWithdrawTx(input: {
|
|
17
|
+
tx: TransactionBlock;
|
|
18
|
+
typusFrameworkOriginPackageId: string;
|
|
19
|
+
typusFrameworkPackageId: string;
|
|
20
|
+
typusDovSinglePackageId: string;
|
|
21
|
+
typusDovSingleRegistry: string;
|
|
22
|
+
mfudPackageId: string;
|
|
23
|
+
mfudRegistry: string;
|
|
24
|
+
typeArguments: string[];
|
|
25
|
+
index: string;
|
|
26
|
+
receipts: string[] | TransactionObjectArgument[];
|
|
27
|
+
user: string;
|
|
28
|
+
amount?: string;
|
|
29
|
+
}): TransactionBlock;
|
|
30
|
+
export declare function getUnsubscribeTx(input: {
|
|
31
|
+
tx: TransactionBlock;
|
|
32
|
+
typusFrameworkOriginPackageId: string;
|
|
33
|
+
typusDovSinglePackageId: string;
|
|
34
|
+
typusDovSingleRegistry: string;
|
|
35
|
+
typeArguments: string[];
|
|
36
|
+
index: string;
|
|
37
|
+
receipts: string[] | TransactionObjectArgument[];
|
|
38
|
+
user: string;
|
|
39
|
+
amount?: string;
|
|
40
|
+
}): TransactionBlock;
|
|
41
|
+
export declare function getCompoundTx(input: {
|
|
42
|
+
tx: TransactionBlock;
|
|
43
|
+
typusFrameworkOriginPackageId: string;
|
|
44
|
+
typusDovSinglePackageId: string;
|
|
45
|
+
typusDovSingleRegistry: string;
|
|
46
|
+
typeArguments: string[];
|
|
47
|
+
index: string;
|
|
48
|
+
receipts: string[] | TransactionObjectArgument[];
|
|
49
|
+
user: string;
|
|
50
|
+
}): TransactionBlock;
|
|
51
|
+
export declare function getClaimTx(input: {
|
|
52
|
+
tx: TransactionBlock;
|
|
53
|
+
typusFrameworkOriginPackageId: string;
|
|
54
|
+
typusFrameworkPackageId: string;
|
|
55
|
+
typusDovSinglePackageId: string;
|
|
56
|
+
typusDovSingleRegistry: string;
|
|
57
|
+
mfudPackageId: string;
|
|
58
|
+
mfudRegistry: string;
|
|
59
|
+
typeArguments: string[];
|
|
60
|
+
index: string;
|
|
61
|
+
receipts: string[] | TransactionObjectArgument[];
|
|
62
|
+
user: string;
|
|
63
|
+
}): TransactionBlock;
|
|
64
|
+
export declare function getHarvestTx(input: {
|
|
65
|
+
tx: TransactionBlock;
|
|
66
|
+
typusFrameworkOriginPackageId: string;
|
|
67
|
+
typusFrameworkPackageId: string;
|
|
68
|
+
typusDovSinglePackageId: string;
|
|
69
|
+
typusDovSingleRegistry: string;
|
|
70
|
+
mfudPackageId: string;
|
|
71
|
+
mfudRegistry: string;
|
|
72
|
+
typeArguments: string[];
|
|
73
|
+
index: string;
|
|
74
|
+
receipts: string[] | TransactionObjectArgument[];
|
|
75
|
+
user: string;
|
|
76
|
+
}): TransactionBlock;
|
|
77
|
+
export declare function getRedeemTx(input: {
|
|
78
|
+
tx: TransactionBlock;
|
|
79
|
+
typusFrameworkOriginPackageId: string;
|
|
80
|
+
typusFrameworkPackageId: string;
|
|
81
|
+
typusDovSinglePackageId: string;
|
|
82
|
+
typusDovSingleRegistry: string;
|
|
83
|
+
mfudPackageId: string;
|
|
84
|
+
mfudRegistry: string;
|
|
85
|
+
typeArguments: string[];
|
|
86
|
+
index: string;
|
|
87
|
+
receipts: string[] | TransactionObjectArgument[];
|
|
88
|
+
user: string;
|
|
89
|
+
}): TransactionBlock;
|
|
90
|
+
export declare function getNewBidTx(input: {
|
|
91
|
+
tx: TransactionBlock;
|
|
92
|
+
typusDovSinglePackageId: string;
|
|
93
|
+
typusDovSingleRegistry: string;
|
|
94
|
+
mfudPackageId: string;
|
|
95
|
+
mfudRegistry: string;
|
|
96
|
+
typeArguments: string[];
|
|
97
|
+
index: string;
|
|
98
|
+
coins: string[];
|
|
99
|
+
size: string;
|
|
100
|
+
premium_required: string;
|
|
101
|
+
user: string;
|
|
102
|
+
}): TransactionBlock;
|
|
103
|
+
export declare function getExerciseTx(input: {
|
|
104
|
+
tx: TransactionBlock;
|
|
105
|
+
typusFrameworkOriginPackageId: string;
|
|
106
|
+
typusFrameworkPackageId: string;
|
|
107
|
+
typusDovSinglePackageId: string;
|
|
108
|
+
typusDovSingleRegistry: string;
|
|
109
|
+
mfudPackageId: string;
|
|
110
|
+
mfudRegistry: string;
|
|
111
|
+
typeArguments: string[];
|
|
112
|
+
index: string;
|
|
113
|
+
receipts: string[] | TransactionObjectArgument[];
|
|
114
|
+
user: string;
|
|
115
|
+
}): TransactionBlock;
|
|
116
|
+
export declare function getRebateTx(input: {
|
|
117
|
+
tx: TransactionBlock;
|
|
118
|
+
typusFrameworkPackageId: string;
|
|
119
|
+
typusDovSinglePackageId: string;
|
|
120
|
+
typusDovSingleRegistry: string;
|
|
121
|
+
mfudPackageId: string;
|
|
122
|
+
mfudRegistry: string;
|
|
123
|
+
typeArgument: string;
|
|
124
|
+
user: string;
|
|
125
|
+
}): TransactionBlock;
|