@typus/typus-sdk 1.8.43 → 1.9.1
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/dist/src/auto-bid/view-function.d.ts +0 -2
- package/dist/src/auto-bid/view-function.js +7 -76
- package/dist/src/dice/fetch.d.ts +2 -2
- package/dist/src/dice/fetch.js +34 -91
- package/dist/src/typus/airdrop/view-function.js +7 -8
- package/dist/src/typus/leaderboard/view-function.js +7 -8
- package/dist/src/typus/tails-staking/view-function.js +14 -14
- package/dist/src/typus/user/view-function.js +5 -6
- package/dist/src/typus-dov-single-v2/function/index.d.ts +0 -1
- package/dist/src/typus-dov-single-v2/function/index.js +0 -1
- package/dist/src/typus-dov-single-v2/function/token.js +1 -1
- package/dist/src/typus-dov-single-v2/history/index.d.ts +0 -1
- package/dist/src/typus-dov-single-v2/history/index.js +0 -1
- package/dist/src/typus-dov-single-v2/history/user-history.d.ts +5 -3
- package/dist/src/typus-dov-single-v2/history/user-history.js +124 -187
- package/dist/src/typus-dov-single-v2/otc-entry.js +5 -6
- package/dist/src/typus-dov-single-v2/user-entry.d.ts +1 -1
- package/dist/src/typus-dov-single-v2/view-function.d.ts +3 -0
- package/dist/src/typus-dov-single-v2/view-function.js +74 -28
- package/dist/src/typus-hedge/view-function.js +10 -10
- package/dist/src/typus-launch/airdrop/view-function.js +7 -5
- package/dist/src/typus-launch/auction/view-function.js +17 -16
- package/dist/src/typus-launch/funding-vault/view-function.js +21 -19
- package/dist/src/typus-launch/improvement-proposal/view-function.js +33 -18
- package/dist/src/typus-launch/ve-typus/view-function.js +19 -15
- package/dist/src/typus-nft/fetch.d.ts +2 -36
- package/dist/src/typus-nft/fetch.js +34 -396
- package/dist/src/typus-nft/index.d.ts +0 -1
- package/dist/src/typus-nft/index.js +0 -1
- package/dist/src/typus-safu/view-function.js +13 -13
- package/dist/src/utils/api/price.js +6 -58
- package/dist/src/utils/api/sentio/events.js +4 -4
- package/dist/src/utils/api/sentio/leader-board.js +1 -1
- package/dist/src/utils/api/sentio/reward-generated.js +16 -16
- package/dist/src/utils/api/sentio/vault-history.js +1 -1
- package/dist/src/utils/graphQl.d.ts +27 -0
- package/dist/src/utils/graphQl.js +132 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/oracle.js +13 -14
- package/dist/src/utils/sponsoredTx.d.ts +2 -2
- package/dist/src/utils/typusConfig.d.ts +4 -0
- package/dist/src/utils/typusConfig.js +33 -31
- package/package.json +10 -9
- package/dist/src/dice/view-function.d.ts +0 -1
- package/dist/src/dice/view-function.js +0 -20
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +0 -87
- package/dist/src/typus-dov-single-v2/function/bidding.js +0 -653
- package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +0 -123
- package/dist/src/typus-dov-single-v2/history/vault-history.js +0 -307
- package/dist/src/typus-nft/user-entry.d.ts +0 -57
- package/dist/src/typus-nft/user-entry.js +0 -161
|
@@ -42,5 +42,3 @@ export interface TypusBidReceipt {
|
|
|
42
42
|
metadata: string;
|
|
43
43
|
u64_padding: string[];
|
|
44
44
|
}
|
|
45
|
-
export declare function getStrategies(config: TypusConfig, strategyIds: string[]): Promise<Map<string, StrategyV2>>;
|
|
46
|
-
export declare function getStrategyIds(config: TypusConfig, parentId: string): Promise<string[]>;
|
|
@@ -65,9 +65,6 @@ var __values = (this && this.__values) || function(o) {
|
|
|
65
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
66
|
exports.getUserStrategies = getUserStrategies;
|
|
67
67
|
exports.getStrategyPool = getStrategyPool;
|
|
68
|
-
exports.getStrategies = getStrategies;
|
|
69
|
-
exports.getStrategyIds = getStrategyIds;
|
|
70
|
-
var client_1 = require("@mysten/sui/client");
|
|
71
68
|
var bcs_1 = require("@mysten/bcs");
|
|
72
69
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
73
70
|
var tools_1 = require("../../src/utils/tools");
|
|
@@ -79,7 +76,7 @@ function getUserStrategies(config, input
|
|
|
79
76
|
return __generator(this, function (_a) {
|
|
80
77
|
switch (_a.label) {
|
|
81
78
|
case 0:
|
|
82
|
-
provider =
|
|
79
|
+
provider = config.gRpcClient();
|
|
83
80
|
transaction = new transactions_1.Transaction();
|
|
84
81
|
target = "".concat(config.package.dovSingle, "::auto_bid::view_user_strategies");
|
|
85
82
|
transactionBlockArguments = [
|
|
@@ -92,10 +89,11 @@ function getUserStrategies(config, input
|
|
|
92
89
|
typeArguments: [],
|
|
93
90
|
arguments: transactionBlockArguments,
|
|
94
91
|
});
|
|
95
|
-
return [4 /*yield*/, provider.
|
|
92
|
+
return [4 /*yield*/, provider.simulateTransaction({ transaction: transaction, checksEnabled: false, include: { commandResults: true } })];
|
|
96
93
|
case 1:
|
|
97
|
-
results = (_a.sent())
|
|
98
|
-
|
|
94
|
+
results = (_a.sent())
|
|
95
|
+
.commandResults;
|
|
96
|
+
objBCS = results[0].returnValues[0].bcs;
|
|
99
97
|
reader = new bcs_1.BcsReader(new Uint8Array(objBCS));
|
|
100
98
|
strategies = [];
|
|
101
99
|
reader.readVec(function (reader, i) {
|
|
@@ -201,8 +199,8 @@ function getStrategyPool(config) {
|
|
|
201
199
|
return __generator(this, function (_f) {
|
|
202
200
|
switch (_f.label) {
|
|
203
201
|
case 0:
|
|
204
|
-
provider =
|
|
205
|
-
return [4 /*yield*/, provider.getObject({
|
|
202
|
+
provider = config.gRpcClient();
|
|
203
|
+
return [4 /*yield*/, provider.getObject({ objectId: config.registry.dov.autoBid, include: { content: true } })];
|
|
206
204
|
case 1:
|
|
207
205
|
pool = (_e = (_f.sent()).data) === null || _e === void 0 ? void 0 : _e.content.fields;
|
|
208
206
|
vaults = pool.strategies.fields.contents;
|
|
@@ -246,70 +244,3 @@ function getStrategyPool(config) {
|
|
|
246
244
|
});
|
|
247
245
|
});
|
|
248
246
|
}
|
|
249
|
-
function getStrategies(config, strategyIds) {
|
|
250
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
251
|
-
var provider, strategies, len, results, results_1, results_1_1, result, fields;
|
|
252
|
-
var e_3, _a;
|
|
253
|
-
var _b;
|
|
254
|
-
return __generator(this, function (_c) {
|
|
255
|
-
switch (_c.label) {
|
|
256
|
-
case 0:
|
|
257
|
-
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
258
|
-
strategies = new Map();
|
|
259
|
-
_c.label = 1;
|
|
260
|
-
case 1:
|
|
261
|
-
if (!(strategyIds.length > 0)) return [3 /*break*/, 3];
|
|
262
|
-
len = strategyIds.length > 50 ? 50 : strategyIds.length;
|
|
263
|
-
return [4 /*yield*/, provider.multiGetObjects({ ids: strategyIds.splice(0, len), options: { showContent: true } })];
|
|
264
|
-
case 2:
|
|
265
|
-
results = _c.sent();
|
|
266
|
-
try {
|
|
267
|
-
for (results_1 = (e_3 = void 0, __values(results)), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
268
|
-
result = results_1_1.value;
|
|
269
|
-
fields = (_b = result.data) === null || _b === void 0 ? void 0 : _b.content.fields;
|
|
270
|
-
// console.log(fields);
|
|
271
|
-
strategies.set(fields.name, fields.value.fields);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
275
|
-
finally {
|
|
276
|
-
try {
|
|
277
|
-
if (results_1_1 && !results_1_1.done && (_a = results_1.return)) _a.call(results_1);
|
|
278
|
-
}
|
|
279
|
-
finally { if (e_3) throw e_3.error; }
|
|
280
|
-
}
|
|
281
|
-
return [3 /*break*/, 1];
|
|
282
|
-
case 3: return [2 /*return*/, strategies];
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
function getStrategyIds(config, parentId) {
|
|
288
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
289
|
-
var provider, result, datas;
|
|
290
|
-
return __generator(this, function (_a) {
|
|
291
|
-
switch (_a.label) {
|
|
292
|
-
case 0:
|
|
293
|
-
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
294
|
-
return [4 /*yield*/, provider.getDynamicFields({
|
|
295
|
-
parentId: parentId,
|
|
296
|
-
})];
|
|
297
|
-
case 1:
|
|
298
|
-
result = _a.sent();
|
|
299
|
-
datas = result.data;
|
|
300
|
-
_a.label = 2;
|
|
301
|
-
case 2:
|
|
302
|
-
if (!result.hasNextPage) return [3 /*break*/, 4];
|
|
303
|
-
return [4 /*yield*/, provider.getDynamicFields({
|
|
304
|
-
parentId: parentId,
|
|
305
|
-
cursor: result.nextCursor,
|
|
306
|
-
})];
|
|
307
|
-
case 3:
|
|
308
|
-
result = _a.sent();
|
|
309
|
-
datas = datas.concat(result.data);
|
|
310
|
-
return [3 /*break*/, 2];
|
|
311
|
-
case 4: return [2 /*return*/, datas.map(function (data) { return data.objectId; })];
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
}
|
package/dist/src/dice/fetch.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export interface DrawEvent {
|
|
|
61
61
|
signature_2: number[];
|
|
62
62
|
signer: string;
|
|
63
63
|
stake_amount: string;
|
|
64
|
-
|
|
64
|
+
timestamp: string;
|
|
65
65
|
exp?: string;
|
|
66
66
|
exp_amount?: string;
|
|
67
67
|
reward?: string;
|
|
@@ -75,6 +75,6 @@ export interface DrawDisplay {
|
|
|
75
75
|
result_2: string;
|
|
76
76
|
bet_amount: string;
|
|
77
77
|
exp: string;
|
|
78
|
-
|
|
78
|
+
timestamp: string;
|
|
79
79
|
reward?: string;
|
|
80
80
|
}
|
package/dist/src/dice/fetch.js
CHANGED
|
@@ -35,30 +35,20 @@ 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
|
-
};
|
|
49
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
39
|
exports.getPlaygrounds = getPlaygrounds;
|
|
51
40
|
exports.getHistory = getHistory;
|
|
52
41
|
exports.parseHistory = parseHistory;
|
|
53
|
-
|
|
42
|
+
// import { SuiClient, SuiEventFilter } from "@mysten/sui/client";
|
|
54
43
|
var constants_1 = require("../../src/constants");
|
|
44
|
+
var graphQl_1 = require("../../src/utils/graphQl");
|
|
55
45
|
function getPlaygrounds(config, input) {
|
|
56
46
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var
|
|
47
|
+
var graphQlClient, registry, dfs, result;
|
|
58
48
|
return __generator(this, function (_a) {
|
|
59
49
|
switch (_a.label) {
|
|
60
50
|
case 0:
|
|
61
|
-
|
|
51
|
+
graphQlClient = config.graphQlClient();
|
|
62
52
|
registry = "";
|
|
63
53
|
switch (input.module) {
|
|
64
54
|
case "tails_exp":
|
|
@@ -70,61 +60,27 @@ function getPlaygrounds(config, input) {
|
|
|
70
60
|
default:
|
|
71
61
|
break;
|
|
72
62
|
}
|
|
73
|
-
return [4 /*yield*/,
|
|
63
|
+
return [4 /*yield*/, (0, graphQl_1.getDynamicObjectFields)(graphQlClient, registry, "Playground")];
|
|
74
64
|
case 1:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
case 2:
|
|
84
|
-
objects = _a.sent();
|
|
85
|
-
result = objects
|
|
86
|
-
// @ts-ignore
|
|
87
|
-
.filter(function (object) { var _a, _b; return (_b = (_a = object.data) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.type.endsWith("Playground"); })
|
|
88
|
-
.map(function (object) {
|
|
89
|
-
var e_1, _a;
|
|
90
|
-
var _b;
|
|
91
|
-
// @ts-ignore
|
|
92
|
-
var fields = (_b = object.data) === null || _b === void 0 ? void 0 : _b.content.fields;
|
|
93
|
-
// console.log(fields);
|
|
94
|
-
var opened_games = new Map();
|
|
95
|
-
if (fields.opened_games.fields) {
|
|
96
|
-
try {
|
|
97
|
-
for (var _c = __values(fields.opened_games.fields.contents), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
98
|
-
var curr = _d.value;
|
|
99
|
-
// console.log(curr);
|
|
100
|
-
opened_games.set(curr.fields.key, curr.fields.value.fields);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
104
|
-
finally {
|
|
105
|
-
try {
|
|
106
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
107
|
-
}
|
|
108
|
-
finally { if (e_1) throw e_1.error; }
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// console.log(opened_games);
|
|
112
|
-
var game_config = fields.game_config.fields;
|
|
113
|
-
// console.log(game_config);
|
|
65
|
+
dfs = _a.sent();
|
|
66
|
+
// console.log(dfs);
|
|
67
|
+
if (!dfs) {
|
|
68
|
+
console.error("Not found any playground");
|
|
69
|
+
return [2 /*return*/, []];
|
|
70
|
+
}
|
|
71
|
+
result = dfs.map(function (df) {
|
|
72
|
+
var _a;
|
|
114
73
|
var playground = {
|
|
115
|
-
id:
|
|
116
|
-
house_whitelist:
|
|
117
|
-
public_key:
|
|
118
|
-
num_of_games:
|
|
119
|
-
stake_token:
|
|
120
|
-
opened_games:
|
|
121
|
-
game_config: game_config,
|
|
122
|
-
is_active:
|
|
74
|
+
id: df.id,
|
|
75
|
+
house_whitelist: df.house_whitelist,
|
|
76
|
+
public_key: df.public_key,
|
|
77
|
+
num_of_games: df.num_of_games,
|
|
78
|
+
stake_token: df.stake_token,
|
|
79
|
+
opened_games: new Map(),
|
|
80
|
+
game_config: df.game_config,
|
|
81
|
+
is_active: df.is_active,
|
|
82
|
+
exp_config: (_a = df.exp_config) !== null && _a !== void 0 ? _a : undefined,
|
|
123
83
|
};
|
|
124
|
-
if (fields.exp_config) {
|
|
125
|
-
playground.exp_config = fields.exp_config.fields;
|
|
126
|
-
}
|
|
127
|
-
// console.log(playground);
|
|
128
84
|
return playground;
|
|
129
85
|
});
|
|
130
86
|
return [2 /*return*/, result];
|
|
@@ -134,11 +90,11 @@ function getPlaygrounds(config, input) {
|
|
|
134
90
|
}
|
|
135
91
|
function getHistory(config, input) {
|
|
136
92
|
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var
|
|
93
|
+
var graphQlClient, MoveEventType, events, history;
|
|
138
94
|
return __generator(this, function (_a) {
|
|
139
95
|
switch (_a.label) {
|
|
140
96
|
case 0:
|
|
141
|
-
|
|
97
|
+
graphQlClient = config.graphQlClient();
|
|
142
98
|
MoveEventType = "";
|
|
143
99
|
switch (input.module) {
|
|
144
100
|
case "tails_exp":
|
|
@@ -155,27 +111,13 @@ function getHistory(config, input) {
|
|
|
155
111
|
default:
|
|
156
112
|
break;
|
|
157
113
|
}
|
|
158
|
-
|
|
159
|
-
MoveEventType: MoveEventType,
|
|
160
|
-
};
|
|
161
|
-
return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending" })];
|
|
114
|
+
return [4 /*yield*/, (0, graphQl_1.getEvents)(graphQlClient, MoveEventType, null, null, false)];
|
|
162
115
|
case 1:
|
|
163
|
-
|
|
164
|
-
return [4 /*yield*/, parseHistory(
|
|
116
|
+
events = _a.sent();
|
|
117
|
+
return [4 /*yield*/, parseHistory(events, input.playgrounds)];
|
|
165
118
|
case 2:
|
|
166
119
|
history = _a.sent();
|
|
167
|
-
|
|
168
|
-
case 3:
|
|
169
|
-
if (!(result.hasNextPage && history.length <= 60)) return [3 /*break*/, 6];
|
|
170
|
-
return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending", cursor: result.nextCursor })];
|
|
171
|
-
case 4:
|
|
172
|
-
result = _a.sent();
|
|
173
|
-
return [4 /*yield*/, parseHistory(result.data, input.playgrounds)];
|
|
174
|
-
case 5:
|
|
175
|
-
nextPage = _a.sent();
|
|
176
|
-
history = history.concat(nextPage);
|
|
177
|
-
return [3 /*break*/, 3];
|
|
178
|
-
case 6: return [2 /*return*/, history];
|
|
120
|
+
return [2 /*return*/, history];
|
|
179
121
|
}
|
|
180
122
|
});
|
|
181
123
|
});
|
|
@@ -185,8 +127,9 @@ function parseHistory(datas, playgrounds) {
|
|
|
185
127
|
var result;
|
|
186
128
|
return __generator(this, function (_a) {
|
|
187
129
|
result = datas.map(function (event) {
|
|
188
|
-
|
|
189
|
-
drawEvent
|
|
130
|
+
// console.log(event);
|
|
131
|
+
var drawEvent = event.contents.json;
|
|
132
|
+
drawEvent.timestamp = event.timestamp;
|
|
190
133
|
var playground = playgrounds[Number(drawEvent.index)];
|
|
191
134
|
var coinType = "0x" + playground.stake_token;
|
|
192
135
|
var asset = (0, constants_1.typeArgToAsset)(coinType);
|
|
@@ -236,7 +179,7 @@ function parseHistory(datas, playgrounds) {
|
|
|
236
179
|
result_2: result_2,
|
|
237
180
|
bet_amount: "".concat(amount, " ").concat(asset),
|
|
238
181
|
exp: "".concat(exp, " EXP"),
|
|
239
|
-
|
|
182
|
+
timestamp: drawEvent.timestamp,
|
|
240
183
|
};
|
|
241
184
|
if (drawEvent.reward) {
|
|
242
185
|
var reward = Number(drawEvent.reward) / Math.pow(10, decimal);
|
|
@@ -285,8 +228,8 @@ function parseHistory(datas, playgrounds) {
|
|
|
285
228
|
// }
|
|
286
229
|
// export async function getProfitSharing(provider: SuiClient, diceProfitSharing: string) {
|
|
287
230
|
// let object = await provider.getObject({
|
|
288
|
-
//
|
|
289
|
-
//
|
|
231
|
+
// objectId: diceProfitSharing,
|
|
232
|
+
// include: { content: true },
|
|
290
233
|
// });
|
|
291
234
|
// // @ts-ignore
|
|
292
235
|
// let type: string = object.data?.content.type;
|
|
@@ -38,16 +38,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getAirdrop = getAirdrop;
|
|
40
40
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
41
|
-
var client_1 = require("@mysten/sui/client");
|
|
42
41
|
var bcs_1 = require("@mysten/bcs");
|
|
43
|
-
var constants_1 = require("../../../src/constants");
|
|
44
42
|
function getAirdrop(config, input) {
|
|
45
43
|
return __awaiter(this, void 0, void 0, function () {
|
|
46
44
|
var provider, transaction, results, bytes, reader;
|
|
47
45
|
return __generator(this, function (_a) {
|
|
48
46
|
switch (_a.label) {
|
|
49
47
|
case 0:
|
|
50
|
-
provider =
|
|
48
|
+
provider = config.gRpcClient();
|
|
51
49
|
transaction = new transactions_1.Transaction();
|
|
52
50
|
transaction.moveCall({
|
|
53
51
|
target: "".concat(config.package.typus, "::airdrop::get_airdrop"),
|
|
@@ -59,13 +57,14 @@ function getAirdrop(config, input) {
|
|
|
59
57
|
transaction.pure.address(input.user),
|
|
60
58
|
],
|
|
61
59
|
});
|
|
62
|
-
return [4 /*yield*/, provider.
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
return [4 /*yield*/, provider.simulateTransaction({
|
|
61
|
+
transaction: transaction,
|
|
62
|
+
checksEnabled: false,
|
|
63
|
+
include: { commandResults: true },
|
|
65
64
|
})];
|
|
66
65
|
case 1:
|
|
67
|
-
results = (_a.sent()).
|
|
68
|
-
bytes = results[results.length - 1].returnValues[0]
|
|
66
|
+
results = (_a.sent()).commandResults;
|
|
67
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
69
68
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
70
69
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
71
70
|
return reader.read64();
|
|
@@ -38,17 +38,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getRankings = getRankings;
|
|
40
40
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
41
|
-
var client_1 = require("@mysten/sui/client");
|
|
42
41
|
var bcs_1 = require("@mysten/bcs");
|
|
43
42
|
var utils_1 = require("../../../src/utils");
|
|
44
|
-
var constants_1 = require("../../../src/constants");
|
|
45
43
|
function getRankings(config, input) {
|
|
46
44
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
45
|
var provider, transaction, results, bytes, reader, result;
|
|
48
46
|
return __generator(this, function (_a) {
|
|
49
47
|
switch (_a.label) {
|
|
50
48
|
case 0:
|
|
51
|
-
provider =
|
|
49
|
+
provider = config.gRpcClient();
|
|
52
50
|
transaction = new transactions_1.Transaction();
|
|
53
51
|
transaction.moveCall({
|
|
54
52
|
target: "".concat(config.package.typus, "::leaderboard::get_rankings"),
|
|
@@ -63,13 +61,14 @@ function getRankings(config, input) {
|
|
|
63
61
|
transaction.pure.bool(input.active),
|
|
64
62
|
],
|
|
65
63
|
});
|
|
66
|
-
return [4 /*yield*/, provider.
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
return [4 /*yield*/, provider.simulateTransaction({
|
|
65
|
+
transaction: transaction,
|
|
66
|
+
checksEnabled: false,
|
|
67
|
+
include: { commandResults: true },
|
|
69
68
|
})];
|
|
70
69
|
case 1:
|
|
71
|
-
results = (_a.sent()).
|
|
72
|
-
bytes = results[results.length - 1].returnValues[0]
|
|
70
|
+
results = (_a.sent()).commandResults;
|
|
71
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
73
72
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
74
73
|
result = reader.readVec(function (reader, i) {
|
|
75
74
|
if (i == 0) {
|
|
@@ -39,17 +39,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.getStakingInfo = getStakingInfo;
|
|
40
40
|
exports.getLevelCounts = getLevelCounts;
|
|
41
41
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
42
|
-
var client_1 = require("@mysten/sui/client");
|
|
43
42
|
var bcs_1 = require("@mysten/bcs");
|
|
44
43
|
var utils_1 = require("../../../src/utils");
|
|
45
|
-
var constants_1 = require("../../../src/constants");
|
|
46
44
|
function getStakingInfo(config, input) {
|
|
47
45
|
return __awaiter(this, void 0, void 0, function () {
|
|
48
46
|
var provider, transaction, results, bytes, reader, length;
|
|
49
47
|
return __generator(this, function (_a) {
|
|
50
48
|
switch (_a.label) {
|
|
51
49
|
case 0:
|
|
52
|
-
provider =
|
|
50
|
+
provider = config.gRpcClient();
|
|
53
51
|
transaction = new transactions_1.Transaction();
|
|
54
52
|
transaction.moveCall({
|
|
55
53
|
target: "".concat(config.package.typus, "::tails_staking::get_staking_info"),
|
|
@@ -60,13 +58,14 @@ function getStakingInfo(config, input) {
|
|
|
60
58
|
transaction.pure.address(input.user),
|
|
61
59
|
],
|
|
62
60
|
});
|
|
63
|
-
return [4 /*yield*/, provider.
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
return [4 /*yield*/, provider.simulateTransaction({
|
|
62
|
+
transaction: transaction,
|
|
63
|
+
checksEnabled: false,
|
|
64
|
+
include: { commandResults: true },
|
|
66
65
|
})];
|
|
67
66
|
case 1:
|
|
68
|
-
results = (_a.sent()).
|
|
69
|
-
bytes = results[results.length - 1].returnValues[0]
|
|
67
|
+
results = (_a.sent()).commandResults;
|
|
68
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
70
69
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
71
70
|
length = reader.readULEB();
|
|
72
71
|
if (length > 0) {
|
|
@@ -102,20 +101,21 @@ function getLevelCounts(config) {
|
|
|
102
101
|
return __generator(this, function (_a) {
|
|
103
102
|
switch (_a.label) {
|
|
104
103
|
case 0:
|
|
105
|
-
provider =
|
|
104
|
+
provider = config.gRpcClient();
|
|
106
105
|
transaction = new transactions_1.Transaction();
|
|
107
106
|
transaction.moveCall({
|
|
108
107
|
target: "".concat(config.package.typus, "::tails_staking::get_level_counts"),
|
|
109
108
|
typeArguments: [],
|
|
110
109
|
arguments: [transaction.object(config.version.typus), transaction.object(config.registry.typus.tailsStaking)],
|
|
111
110
|
});
|
|
112
|
-
return [4 /*yield*/, provider.
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
return [4 /*yield*/, provider.simulateTransaction({
|
|
112
|
+
transaction: transaction,
|
|
113
|
+
checksEnabled: false,
|
|
114
|
+
include: { commandResults: true },
|
|
115
115
|
})];
|
|
116
116
|
case 1:
|
|
117
|
-
results = (_a.sent()).
|
|
118
|
-
bytes = results[results.length - 1].returnValues[0]
|
|
117
|
+
results = (_a.sent()).commandResults;
|
|
118
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
119
119
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
120
120
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
121
121
|
return Number.parseInt(reader.read64());
|
|
@@ -38,16 +38,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getUserMetadata = getUserMetadata;
|
|
40
40
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
41
|
-
var client_1 = require("@mysten/sui/client");
|
|
42
41
|
var bcs_1 = require("@mysten/bcs");
|
|
43
|
-
var constants_1 = require("../../../src/constants");
|
|
44
42
|
function getUserMetadata(config, input) {
|
|
45
43
|
return __awaiter(this, void 0, void 0, function () {
|
|
46
44
|
var provider, transaction, results, bytes, reader;
|
|
47
45
|
return __generator(this, function (_a) {
|
|
48
46
|
switch (_a.label) {
|
|
49
47
|
case 0:
|
|
50
|
-
provider =
|
|
48
|
+
provider = config.gRpcClient();
|
|
51
49
|
transaction = new transactions_1.Transaction();
|
|
52
50
|
transaction.moveCall({
|
|
53
51
|
target: "".concat(config.package.typus, "::user::get_user_metadata"),
|
|
@@ -58,10 +56,11 @@ function getUserMetadata(config, input) {
|
|
|
58
56
|
transaction.pure.address(input.user),
|
|
59
57
|
],
|
|
60
58
|
});
|
|
61
|
-
return [4 /*yield*/, provider.
|
|
59
|
+
return [4 /*yield*/, provider.simulateTransaction({ transaction: transaction, checksEnabled: false, include: { commandResults: true } })];
|
|
62
60
|
case 1:
|
|
63
|
-
results = (_a.sent())
|
|
64
|
-
|
|
61
|
+
results = (_a.sent())
|
|
62
|
+
.commandResults;
|
|
63
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
65
64
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
66
65
|
reader.readULEB();
|
|
67
66
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./bidding"), exports);
|
|
18
17
|
__exportStar(require("./token"), exports);
|
|
19
18
|
__exportStar(require("./vault"), exports);
|
|
@@ -37,6 +37,6 @@ var getTokenName = function (_a) {
|
|
|
37
37
|
else {
|
|
38
38
|
tokenName = (_c = exports.UnwrappedToken[token]) !== null && _c !== void 0 ? _c : token;
|
|
39
39
|
}
|
|
40
|
-
return million ? (_d = exports.MillionToken[tokenName]) !== null && _d !== void 0 ? _d : tokenName : (_e = exports.RemoveMillionToken[tokenName]) !== null && _e !== void 0 ? _e : tokenName;
|
|
40
|
+
return million ? ((_d = exports.MillionToken[tokenName]) !== null && _d !== void 0 ? _d : tokenName) : ((_e = exports.RemoveMillionToken[tokenName]) !== null && _e !== void 0 ? _e : tokenName);
|
|
41
41
|
};
|
|
42
42
|
exports.getTokenName = getTokenName;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { EventId, SuiClient, SuiEvent } from "@mysten/sui/client";
|
|
2
1
|
import { Vault } from "../../../src/typus-dov-single-v2";
|
|
3
2
|
import { TOKEN } from "../../../src/constants";
|
|
4
3
|
export { getNewBidFromSentio, getExerciseFromSentio } from "../../../src/utils/api/sentio/events";
|
|
5
|
-
|
|
6
|
-
export declare function
|
|
4
|
+
import { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
5
|
+
export declare function getUserEvents(graphQlClient: SuiGraphQLClient, sender: string, cursor?: string | null): Promise<{
|
|
6
|
+
events: import("../../../src/utils/graphQl").Event[];
|
|
7
|
+
beforeCursor: string | null;
|
|
8
|
+
}>;
|
|
7
9
|
export interface TxHistory {
|
|
8
10
|
Index: string | undefined;
|
|
9
11
|
Action: string | undefined;
|