@typus/typus-sdk 1.8.41 → 1.8.43-upgrade
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/constants/constant.d.ts +0 -3
- package/dist/src/constants/constant.js +1 -8
- package/dist/src/constants/token.d.ts +1 -1
- package/dist/src/constants/token.js +12 -0
- package/dist/src/dice/fetch.d.ts +0 -4
- package/dist/src/dice/fetch.js +59 -116
- package/dist/src/typus/airdrop/view-function.js +5 -8
- package/dist/src/typus/leaderboard/view-function.js +5 -8
- package/dist/src/typus/tails-staking/view-function.js +10 -14
- package/dist/src/typus/user/view-function.js +5 -6
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +4 -3
- package/dist/src/typus-dov-single-v2/function/bidding.js +10 -11
- 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 +2 -3
- package/dist/src/typus-dov-single-v2/history/user-history.js +122 -184
- 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.js +29 -27
- package/dist/src/typus-hedge/view-function.js +10 -10
- package/dist/src/typus-launch/airdrop/view-function.js +3 -5
- package/dist/src/typus-launch/auction/view-function.js +17 -16
- package/dist/src/typus-launch/funding-vault/view-function.js +20 -18
- package/dist/src/typus-launch/improvement-proposal/view-function.js +17 -18
- package/dist/src/typus-launch/ve-typus/view-function.js +15 -15
- package/dist/src/typus-safu/view-function.js +13 -13
- package/dist/src/utils/api/price.js +1 -1
- package/dist/src/utils/graphQl.d.ts +24 -0
- package/dist/src/utils/graphQl.js +129 -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/pyth/constant.js +4 -0
- 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 +9 -10
- 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/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/fetch.d.ts +0 -70
- package/dist/src/typus-nft/fetch.js +0 -631
- package/dist/src/typus-nft/index.d.ts +0 -2
- package/dist/src/typus-nft/index.js +0 -18
- 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({ id: config.registry.dov.autoBid,
|
|
202
|
+
provider = config.gRpcClient();
|
|
203
|
+
return [4 /*yield*/, provider.getObject({ id: 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
|
-
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui/client";
|
|
2
1
|
export declare const CLOCK = "0x6";
|
|
3
2
|
export declare const SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
4
3
|
export declare const PRICE_DECIMAL = 8;
|
|
@@ -12,8 +11,6 @@ export declare const TOKEN_NAME_TO_MODULE: {
|
|
|
12
11
|
SUI: string;
|
|
13
12
|
USDC: string;
|
|
14
13
|
};
|
|
15
|
-
export declare const mainnetConnection: SuiClient;
|
|
16
|
-
export declare const testnetConnection: SuiClient;
|
|
17
14
|
export declare const ACTIVE_SUB_VAULT_TAG: number;
|
|
18
15
|
export declare const DEACTIVATING_SUB_VAULT_TAG: number;
|
|
19
16
|
export declare const INACTIVE_SUB_VAULT_TAG: number;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PERFORMANCE_FEE_SUB_VAULT_TAG = exports.PREMIUM_SUB_VAULT_TAG = exports.BIDDER_SUB_VAULT_TAG = exports.WARMUP_SUB_VAULT_TAG = exports.INACTIVE_SUB_VAULT_TAG = exports.DEACTIVATING_SUB_VAULT_TAG = exports.ACTIVE_SUB_VAULT_TAG = exports.
|
|
4
|
-
var client_1 = require("@mysten/sui/client");
|
|
3
|
+
exports.PERFORMANCE_FEE_SUB_VAULT_TAG = exports.PREMIUM_SUB_VAULT_TAG = exports.BIDDER_SUB_VAULT_TAG = exports.WARMUP_SUB_VAULT_TAG = exports.INACTIVE_SUB_VAULT_TAG = exports.DEACTIVATING_SUB_VAULT_TAG = exports.ACTIVE_SUB_VAULT_TAG = exports.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;
|
|
5
4
|
exports.CLOCK = "0x6";
|
|
6
5
|
exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
7
6
|
exports.PRICE_DECIMAL = 8;
|
|
@@ -15,12 +14,6 @@ exports.TOKEN_NAME_TO_MODULE = {
|
|
|
15
14
|
SUI: "sui",
|
|
16
15
|
USDC: "usdc",
|
|
17
16
|
};
|
|
18
|
-
exports.mainnetConnection = new client_1.SuiClient({
|
|
19
|
-
url: "https://fullnode.mainnet.sui.io:443/",
|
|
20
|
-
});
|
|
21
|
-
exports.testnetConnection = new client_1.SuiClient({
|
|
22
|
-
url: "https://fullnode.testnet.sui.io:443/",
|
|
23
|
-
});
|
|
24
17
|
exports.ACTIVE_SUB_VAULT_TAG = 0;
|
|
25
18
|
exports.DEACTIVATING_SUB_VAULT_TAG = 1;
|
|
26
19
|
exports.INACTIVE_SUB_VAULT_TAG = 2;
|
|
@@ -9,7 +9,7 @@ export declare const tokenType: {
|
|
|
9
9
|
[key in TOKEN]: string;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export type TOKEN = "SUI" | "CETUS" | "TURBOS" | "NAVX" | "SCA" | "DEEP" | "BLUE" | "TYPUS" | "NS" | "WAL" | "HAEDAL" | "FUD" | "BLUB" | "LIQ" | "HIPPO" | "MFUD" | "MBLUB" | "MLIQ" | "BUCK" | "USDY" | "AUSD" | "USDC" | "wSOL" | "wAPT" | "WBTC" | "wETH" | "wUSDC" | "wUSDT" | "BNB" | "sbETH" | "sbUSDT" | "sbBTC" | "LBTC" | "xBTC" | "TBTC" | "VSUI" | "HASUI" | "AFSUI" | "SPSUI" | "STSUI" | "INJ" | "JUP" | "SEI" | "JPY" | "XAU" | "DOGE" | "HYPE" | "XRP" | "BNB" | "USOIL" | "XAG" | "QQQX" | "SPYX" | "NVDAX" | "TSLAX" | "AAPLX" | "GOOGLX" | "METAX" | "COINX" | "CRCLX" | "sSCA" | "TEXP" | "USD";
|
|
12
|
+
export type TOKEN = "SUI" | "CETUS" | "TURBOS" | "NAVX" | "SCA" | "DEEP" | "BLUE" | "TYPUS" | "NS" | "WAL" | "HAEDAL" | "FUD" | "BLUB" | "LIQ" | "HIPPO" | "MFUD" | "MBLUB" | "MLIQ" | "BUCK" | "USDY" | "AUSD" | "USDC" | "wSOL" | "wAPT" | "WBTC" | "wETH" | "wUSDC" | "wUSDT" | "BNB" | "sbETH" | "sbUSDT" | "sbBTC" | "LBTC" | "xBTC" | "TBTC" | "VSUI" | "HASUI" | "AFSUI" | "SPSUI" | "STSUI" | "INJ" | "JUP" | "SEI" | "JPY" | "XAU" | "DOGE" | "HYPE" | "XRP" | "BNB" | "USOIL" | "XAG" | "QQQX" | "SPYX" | "NVDAX" | "TSLAX" | "AAPLX" | "GOOGLX" | "METAX" | "COINX" | "CRCLX" | "HOODX" | "MSTRX" | "sSCA" | "TEXP" | "USD";
|
|
13
13
|
export declare const oracle: {
|
|
14
14
|
MAINNET: {
|
|
15
15
|
[key in TOKEN]?: string;
|
|
@@ -212,6 +212,10 @@ function typeArgToAsset(typeArg) {
|
|
|
212
212
|
return "COINX";
|
|
213
213
|
case "0xc5771d7ab8cc3111cf838f7c0c5433ec6f4841a9136291f5b363229288a1b846::crclx::CRCLX": // MAINNET
|
|
214
214
|
return "CRCLX";
|
|
215
|
+
case "0x0d90ea56c38bdf0c167516999dc6a8781c821f3346b44448d7888ef452d55f6c::hoodx::HOODX": // MAINNET
|
|
216
|
+
return "HOODX";
|
|
217
|
+
case "0x289e1687139d7cf83f5848063ff1c0eded47cebe12010e81f3625636f341efec::mstrx::MSTRX": // MAINNET
|
|
218
|
+
return "MSTRX";
|
|
215
219
|
default:
|
|
216
220
|
throw new Error("Unknown typeArg: ".concat(typeArg));
|
|
217
221
|
}
|
|
@@ -248,6 +252,8 @@ function assetToDecimal(asset) {
|
|
|
248
252
|
case "METAX":
|
|
249
253
|
case "COINX":
|
|
250
254
|
case "CRCLX":
|
|
255
|
+
case "HOODX":
|
|
256
|
+
case "MSTRX":
|
|
251
257
|
return 9;
|
|
252
258
|
case "WBTC":
|
|
253
259
|
case "sbETH":
|
|
@@ -349,6 +355,8 @@ exports.tokenType = {
|
|
|
349
355
|
METAX: "0x72e15b9fd01209df5a600aa640de86c276a0d0ffc3794c918200f4716dbf3bf1::metax::METAX",
|
|
350
356
|
COINX: "0x003a49883e870b82ce4a3977e721f41e3b66d8fde9314e3188f225a1cdd731c3::coinx::COINX",
|
|
351
357
|
CRCLX: "0xc5771d7ab8cc3111cf838f7c0c5433ec6f4841a9136291f5b363229288a1b846::crclx::CRCLX",
|
|
358
|
+
HOODX: "0x0d90ea56c38bdf0c167516999dc6a8781c821f3346b44448d7888ef452d55f6c::hoodx::HOODX",
|
|
359
|
+
MSTRX: "0x289e1687139d7cf83f5848063ff1c0eded47cebe12010e81f3625636f341efec::mstrx::MSTRX",
|
|
352
360
|
},
|
|
353
361
|
TESTNET: {
|
|
354
362
|
SUI: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
@@ -413,6 +421,8 @@ exports.tokenType = {
|
|
|
413
421
|
METAX: "",
|
|
414
422
|
COINX: "",
|
|
415
423
|
CRCLX: "",
|
|
424
|
+
HOODX: "",
|
|
425
|
+
MSTRX: "",
|
|
416
426
|
},
|
|
417
427
|
};
|
|
418
428
|
exports.oracle = {
|
|
@@ -463,6 +473,8 @@ exports.oracle = {
|
|
|
463
473
|
METAX: "0xa092d2d3b160cb4fc2d9d3370ea80a02658652a3876fcfce7698376be1e01006",
|
|
464
474
|
COINX: "0x05d85f9d77247f3a7d701adeeb16e38c436c10d8b75dc0a2bd0baa5b2ac271f7",
|
|
465
475
|
CRCLX: "0x9dcd38327f49d327c53ab1b42b920325e0e7df6c20cfbfe83e59a2d5b60e5d3a",
|
|
476
|
+
HOODX: "0x40a55058609dbcf3a712296cd98c4936c576ff7854c54eabe2ae89e8e1a638c5",
|
|
477
|
+
MSTRX: "0xbfa56dfffc9af02fef9d14418274dc9e92a0ae71def9fbe698f479d551257924",
|
|
466
478
|
},
|
|
467
479
|
TESTNET: {
|
|
468
480
|
SUI: "0x9083c9ce1a1eef569bb1a8b31dfa5e0fce2e05887e68ba79ca6ae522acd041f3",
|
package/dist/src/dice/fetch.d.ts
CHANGED
|
@@ -39,10 +39,6 @@ export interface Game {
|
|
|
39
39
|
larger_than_2: boolean | null;
|
|
40
40
|
vrf_input_2: number[] | null;
|
|
41
41
|
}
|
|
42
|
-
export declare function getHistory(config: TypusConfig, input: {
|
|
43
|
-
module: "tails_exp" | "combo_dice";
|
|
44
|
-
playgrounds: Playground[];
|
|
45
|
-
}): Promise<DrawDisplay[]>;
|
|
46
42
|
export declare function parseHistory(datas: any, playgrounds: Playground[]): Promise<DrawDisplay[]>;
|
|
47
43
|
export interface DrawEvent {
|
|
48
44
|
answer_1: string;
|
package/dist/src/dice/fetch.js
CHANGED
|
@@ -35,30 +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
|
-
};
|
|
49
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
39
|
exports.getPlaygrounds = getPlaygrounds;
|
|
51
|
-
exports.getHistory = getHistory;
|
|
52
40
|
exports.parseHistory = parseHistory;
|
|
53
|
-
|
|
41
|
+
// import { SuiClient, SuiEventFilter } from "@mysten/sui/client";
|
|
54
42
|
var constants_1 = require("../../src/constants");
|
|
43
|
+
var graphQl_1 = require("../../src/utils/graphQl");
|
|
55
44
|
function getPlaygrounds(config, input) {
|
|
56
45
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var
|
|
46
|
+
var graphQlClient, registry, dfs, result;
|
|
58
47
|
return __generator(this, function (_a) {
|
|
59
48
|
switch (_a.label) {
|
|
60
49
|
case 0:
|
|
61
|
-
|
|
50
|
+
graphQlClient = config.graphQlClient();
|
|
62
51
|
registry = "";
|
|
63
52
|
switch (input.module) {
|
|
64
53
|
case "tails_exp":
|
|
@@ -70,61 +59,27 @@ function getPlaygrounds(config, input) {
|
|
|
70
59
|
default:
|
|
71
60
|
break;
|
|
72
61
|
}
|
|
73
|
-
return [4 /*yield*/,
|
|
62
|
+
return [4 /*yield*/, (0, graphQl_1.getDynamicObjectFields)(graphQlClient, registry, "Playground")];
|
|
74
63
|
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);
|
|
64
|
+
dfs = _a.sent();
|
|
65
|
+
// console.log(dfs);
|
|
66
|
+
if (!dfs) {
|
|
67
|
+
console.error("Not found any playground");
|
|
68
|
+
return [2 /*return*/, []];
|
|
69
|
+
}
|
|
70
|
+
result = dfs.map(function (df) {
|
|
71
|
+
var _a;
|
|
114
72
|
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:
|
|
73
|
+
id: df.id,
|
|
74
|
+
house_whitelist: df.house_whitelist,
|
|
75
|
+
public_key: df.public_key,
|
|
76
|
+
num_of_games: df.num_of_games,
|
|
77
|
+
stake_token: df.stake_token,
|
|
78
|
+
opened_games: new Map(),
|
|
79
|
+
game_config: df.game_config,
|
|
80
|
+
is_active: df.is_active,
|
|
81
|
+
exp_config: (_a = df.exp_config) !== null && _a !== void 0 ? _a : undefined,
|
|
123
82
|
};
|
|
124
|
-
if (fields.exp_config) {
|
|
125
|
-
playground.exp_config = fields.exp_config.fields;
|
|
126
|
-
}
|
|
127
|
-
// console.log(playground);
|
|
128
83
|
return playground;
|
|
129
84
|
});
|
|
130
85
|
return [2 /*return*/, result];
|
|
@@ -132,54 +87,42 @@ function getPlaygrounds(config, input) {
|
|
|
132
87
|
});
|
|
133
88
|
});
|
|
134
89
|
}
|
|
135
|
-
function getHistory(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
}
|
|
90
|
+
// export async function getHistory(
|
|
91
|
+
// config: TypusConfig,
|
|
92
|
+
// input: {
|
|
93
|
+
// module: "tails_exp" | "combo_dice";
|
|
94
|
+
// playgrounds: Playground[];
|
|
95
|
+
// }
|
|
96
|
+
// ): Promise<DrawDisplay[]> {
|
|
97
|
+
// const provider = config.gRpcClient();
|
|
98
|
+
// let MoveEventType = "";
|
|
99
|
+
// switch (input.module) {
|
|
100
|
+
// case "tails_exp":
|
|
101
|
+
// MoveEventType = `${config.packageOrigin.dice}::tails_exp::Draw`;
|
|
102
|
+
// break;
|
|
103
|
+
// case "combo_dice":
|
|
104
|
+
// if (config.rpcEndpoint.includes("mainnet")) {
|
|
105
|
+
// MoveEventType = `${config.packageOrigin.dice}::combo_dice::Draw`;
|
|
106
|
+
// } else {
|
|
107
|
+
// MoveEventType = `0xf1d628b4f14f9dae42d73a6cdee9b5f80567fee323166c4ecfb124de7d4ff254::combo_dice::Draw`;
|
|
108
|
+
// }
|
|
109
|
+
// break;
|
|
110
|
+
// default:
|
|
111
|
+
// break;
|
|
112
|
+
// }
|
|
113
|
+
// let eventFilter: SuiEventFilter = {
|
|
114
|
+
// MoveEventType,
|
|
115
|
+
// };
|
|
116
|
+
// var result = await provider.queryEvents({ query: eventFilter, order: "descending" });
|
|
117
|
+
// // console.log(result);
|
|
118
|
+
// var history = await parseHistory(result.data, input.playgrounds);
|
|
119
|
+
// while (result.hasNextPage && history.length <= 60) {
|
|
120
|
+
// result = await provider.queryEvents({ query: eventFilter, order: "descending", cursor: result.cursor });
|
|
121
|
+
// let nextPage = await parseHistory(result.data, input.playgrounds);
|
|
122
|
+
// history = history.concat(nextPage);
|
|
123
|
+
// }
|
|
124
|
+
// return history;
|
|
125
|
+
// }
|
|
183
126
|
function parseHistory(datas, playgrounds) {
|
|
184
127
|
return __awaiter(this, void 0, void 0, function () {
|
|
185
128
|
var result;
|
|
@@ -286,7 +229,7 @@ function parseHistory(datas, playgrounds) {
|
|
|
286
229
|
// export async function getProfitSharing(provider: SuiClient, diceProfitSharing: string) {
|
|
287
230
|
// let object = await provider.getObject({
|
|
288
231
|
// id: diceProfitSharing,
|
|
289
|
-
//
|
|
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,12 @@ function getAirdrop(config, input) {
|
|
|
59
57
|
transaction.pure.address(input.user),
|
|
60
58
|
],
|
|
61
59
|
});
|
|
62
|
-
return [4 /*yield*/, provider.
|
|
63
|
-
|
|
64
|
-
transactionBlock: transaction,
|
|
60
|
+
return [4 /*yield*/, provider.simulateTransaction({
|
|
61
|
+
transaction: transaction,
|
|
65
62
|
})];
|
|
66
63
|
case 1:
|
|
67
|
-
results = (_a.sent()).
|
|
68
|
-
bytes = results[results.length - 1].returnValues[0]
|
|
64
|
+
results = (_a.sent()).commandResults;
|
|
65
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
69
66
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
70
67
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
71
68
|
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,12 @@ function getRankings(config, input) {
|
|
|
63
61
|
transaction.pure.bool(input.active),
|
|
64
62
|
],
|
|
65
63
|
});
|
|
66
|
-
return [4 /*yield*/, provider.
|
|
67
|
-
|
|
68
|
-
transactionBlock: transaction,
|
|
64
|
+
return [4 /*yield*/, provider.simulateTransaction({
|
|
65
|
+
transaction: transaction,
|
|
69
66
|
})];
|
|
70
67
|
case 1:
|
|
71
|
-
results = (_a.sent()).
|
|
72
|
-
bytes = results[results.length - 1].returnValues[0]
|
|
68
|
+
results = (_a.sent()).commandResults;
|
|
69
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
73
70
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
74
71
|
result = reader.readVec(function (reader, i) {
|
|
75
72
|
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,12 @@ function getStakingInfo(config, input) {
|
|
|
60
58
|
transaction.pure.address(input.user),
|
|
61
59
|
],
|
|
62
60
|
});
|
|
63
|
-
return [4 /*yield*/, provider.
|
|
64
|
-
|
|
65
|
-
transactionBlock: transaction,
|
|
61
|
+
return [4 /*yield*/, provider.simulateTransaction({
|
|
62
|
+
transaction: transaction,
|
|
66
63
|
})];
|
|
67
64
|
case 1:
|
|
68
|
-
results = (_a.sent()).
|
|
69
|
-
bytes = results[results.length - 1].returnValues[0]
|
|
65
|
+
results = (_a.sent()).commandResults;
|
|
66
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
70
67
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
71
68
|
length = reader.readULEB();
|
|
72
69
|
if (length > 0) {
|
|
@@ -102,20 +99,19 @@ function getLevelCounts(config) {
|
|
|
102
99
|
return __generator(this, function (_a) {
|
|
103
100
|
switch (_a.label) {
|
|
104
101
|
case 0:
|
|
105
|
-
provider =
|
|
102
|
+
provider = config.gRpcClient();
|
|
106
103
|
transaction = new transactions_1.Transaction();
|
|
107
104
|
transaction.moveCall({
|
|
108
105
|
target: "".concat(config.package.typus, "::tails_staking::get_level_counts"),
|
|
109
106
|
typeArguments: [],
|
|
110
107
|
arguments: [transaction.object(config.version.typus), transaction.object(config.registry.typus.tailsStaking)],
|
|
111
108
|
});
|
|
112
|
-
return [4 /*yield*/, provider.
|
|
113
|
-
|
|
114
|
-
transactionBlock: transaction,
|
|
109
|
+
return [4 /*yield*/, provider.simulateTransaction({
|
|
110
|
+
transaction: transaction,
|
|
115
111
|
})];
|
|
116
112
|
case 1:
|
|
117
|
-
results = (_a.sent()).
|
|
118
|
-
bytes = results[results.length - 1].returnValues[0]
|
|
113
|
+
results = (_a.sent()).commandResults;
|
|
114
|
+
bytes = results[results.length - 1].returnValues[0].bcs;
|
|
119
115
|
reader = new bcs_1.BcsReader(new Uint8Array(bytes));
|
|
120
116
|
return [2 /*return*/, reader.readVec(function (reader) {
|
|
121
117
|
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) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Auction, BidShare, Vault } from "../../../src/typus-dov-single-v2";
|
|
2
|
-
import { SuiObjectResponse } from "@mysten/sui/client";
|
|
3
2
|
import BigNumber from "bignumber.js";
|
|
4
3
|
import { TypusConfig } from "../../../src/utils";
|
|
5
4
|
export declare const tokenOrder: {
|
|
@@ -62,8 +61,10 @@ export declare const parseBidReceipt: (vaults: Vault[], bidReceipts: {
|
|
|
62
61
|
bidVaultsInfo: BidVaultInfo[];
|
|
63
62
|
};
|
|
64
63
|
export declare const parseBid: (bidVaultInfo: BidVaultInfo, bidShare: BidShare, auction: Auction | null, oTokenPrice: string, isAutoBid: boolean) => Bid & OrderBy;
|
|
65
|
-
export declare function getUserOwnedObjects(config: TypusConfig, user: string): Promise<
|
|
66
|
-
|
|
64
|
+
export declare function getUserOwnedObjects(config: TypusConfig, user: string): Promise<import("@mysten/sui/client", { with: { "resolution-mode": "import" } }).SuiClientTypes.Object<{
|
|
65
|
+
content: true;
|
|
66
|
+
}>[]>;
|
|
67
|
+
export declare const getUserBidReceipts: (config: TypusConfig, data: any) => Promise<{
|
|
67
68
|
[key: string]: Receipt[];
|
|
68
69
|
}>;
|
|
69
70
|
/**
|