@typus/typus-sdk 1.4.20 → 1.4.21
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/token-user-entry.d.ts +46 -8
- package/dist/src/auto-bid/token-user-entry.js +117 -74
- package/dist/src/auto-bid/user-entry.d.ts +42 -8
- package/dist/src/auto-bid/user-entry.js +92 -93
- package/dist/src/auto-bid/view-function.d.ts +8 -5
- package/dist/src/auto-bid/view-function.js +26 -15
- package/dist/src/constants/constant.d.ts +1 -0
- package/dist/src/constants/constant.js +2 -1
- package/dist/src/dice/api.d.ts +13 -1
- package/dist/src/dice/api.js +25 -14
- package/dist/src/dice/fetch.d.ts +8 -12
- package/dist/src/dice/fetch.js +77 -30
- package/dist/src/dice/user-entry.d.ts +29 -17
- package/dist/src/dice/user-entry.js +114 -79
- package/dist/src/dice/view-function.d.ts +14 -1
- package/dist/src/dice/view-function.js +34 -25
- package/dist/src/typus/airdrop/view-function.d.ts +1 -2
- package/dist/src/typus/airdrop/view-function.js +6 -3
- package/dist/src/typus/leaderboard/view-function.d.ts +1 -2
- package/dist/src/typus/leaderboard/view-function.js +6 -3
- package/dist/src/typus/tails-staking/authority-entry.js +2 -2
- package/dist/src/typus/tails-staking/view-function.d.ts +2 -3
- package/dist/src/typus/tails-staking/view-function.js +10 -6
- package/dist/src/typus/user/view-function.d.ts +1 -2
- package/dist/src/typus/user/view-function.js +6 -4
- package/dist/src/typus-dov-single-v2/authority-entry.d.ts +0 -25
- package/dist/src/typus-dov-single-v2/authority-entry.js +26 -0
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +5 -3
- package/dist/src/typus-dov-single-v2/function/bidding.js +17 -14
- package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +3 -2
- package/dist/src/typus-dov-single-v2/history/vault-history.js +6 -4
- package/dist/src/typus-dov-single-v2/token-user-entry.js +10 -10
- package/dist/src/typus-dov-single-v2/view-function.d.ts +6 -7
- package/dist/src/typus-dov-single-v2/view-function.js +26 -19
- package/dist/src/typus-nft/user-entry.d.ts +25 -6
- package/dist/src/typus-nft/user-entry.js +24 -36
- package/dist/src/typus-perp/fetch.d.ts +7 -8
- package/dist/src/typus-perp/fetch.js +35 -24
- package/dist/src/typus-perp/user/order.d.ts +4 -11
- package/dist/src/typus-perp/user/order.js +23 -23
- package/dist/src/typus-perp/user/orderWithBidReceipt.d.ts +9 -9
- package/dist/src/typus-perp/user/orderWithBidReceipt.js +50 -49
- package/dist/src/typus-perp/user/tlp.d.ts +5 -13
- package/dist/src/typus-perp/user/tlp.js +30 -30
- package/dist/src/typus-safu/user-entry.d.ts +4 -8
- package/dist/src/typus-safu/user-entry.js +56 -56
- package/dist/src/typus-safu/view-function.d.ts +0 -3
- package/dist/src/typus-safu/view-function.js +10 -7
- package/package.json +1 -1
|
@@ -67,6 +67,7 @@ exports.getUserStrategies = getUserStrategies;
|
|
|
67
67
|
exports.getStrategyPool = getStrategyPool;
|
|
68
68
|
exports.getStrategies = getStrategies;
|
|
69
69
|
exports.getStrategyIds = getStrategyIds;
|
|
70
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
70
71
|
var bcs_1 = require("@mysten/bcs");
|
|
71
72
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
72
73
|
var tools_1 = require("../utils/tools");
|
|
@@ -118,23 +119,28 @@ bcs.registerStructType("TypusBidReceipt", {
|
|
|
118
119
|
metadata: "String",
|
|
119
120
|
u64_padding: "vector<u64>",
|
|
120
121
|
});
|
|
121
|
-
function getUserStrategies(
|
|
122
|
+
function getUserStrategies(config, input
|
|
122
123
|
// typeArguments: string[] // [D_TOKEN, B_TOKEN]
|
|
123
124
|
) {
|
|
124
125
|
return __awaiter(this, void 0, void 0, function () {
|
|
125
|
-
var transactionBlock, target, transactionBlockArguments, results, objBCS, reader, strategies;
|
|
126
|
+
var provider, transactionBlock, target, transactionBlockArguments, results, objBCS, reader, strategies;
|
|
126
127
|
return __generator(this, function (_a) {
|
|
127
128
|
switch (_a.label) {
|
|
128
129
|
case 0:
|
|
130
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
129
131
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
130
|
-
target = "".concat(
|
|
131
|
-
transactionBlockArguments = [
|
|
132
|
+
target = "".concat(config.package.dovSingle, "::auto_bid::view_user_strategies");
|
|
133
|
+
transactionBlockArguments = [
|
|
134
|
+
transactionBlock.pure(config.registry.dov.dovSingle),
|
|
135
|
+
transactionBlock.object(input.strategyPool),
|
|
136
|
+
transactionBlock.pure(input.user),
|
|
137
|
+
];
|
|
132
138
|
transactionBlock.moveCall({
|
|
133
139
|
target: target,
|
|
134
140
|
typeArguments: [],
|
|
135
141
|
arguments: transactionBlockArguments,
|
|
136
142
|
});
|
|
137
|
-
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: user })];
|
|
143
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ transactionBlock: transactionBlock, sender: input.user })];
|
|
138
144
|
case 1:
|
|
139
145
|
results = (_a.sent()).results;
|
|
140
146
|
objBCS = results[0].returnValues[0][0];
|
|
@@ -230,14 +236,16 @@ function getUserStrategies(provider, packageId, registry, strategyPool, user
|
|
|
230
236
|
});
|
|
231
237
|
});
|
|
232
238
|
}
|
|
233
|
-
function getStrategyPool(
|
|
239
|
+
function getStrategyPool(config, strategyPool) {
|
|
234
240
|
return __awaiter(this, void 0, void 0, function () {
|
|
235
|
-
var pool, vaults, strategies, vaults_1, vaults_1_1, vault, signals, _a, _b, signal, strategyTable, strategy_pool;
|
|
241
|
+
var provider, pool, vaults, strategies, vaults_1, vaults_1_1, vault, signals, _a, _b, signal, strategyTable, strategy_pool;
|
|
236
242
|
var e_1, _c, e_2, _d;
|
|
237
243
|
var _e;
|
|
238
244
|
return __generator(this, function (_f) {
|
|
239
245
|
switch (_f.label) {
|
|
240
|
-
case 0:
|
|
246
|
+
case 0:
|
|
247
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
248
|
+
return [4 /*yield*/, provider.getObject({ id: strategyPool, options: { showContent: true } })];
|
|
241
249
|
case 1:
|
|
242
250
|
pool = (_e = (_f.sent()).data) === null || _e === void 0 ? void 0 : _e.content.fields;
|
|
243
251
|
vaults = pool.strategies.fields.contents;
|
|
@@ -281,14 +289,15 @@ function getStrategyPool(provider, strategyPool) {
|
|
|
281
289
|
});
|
|
282
290
|
});
|
|
283
291
|
}
|
|
284
|
-
function getStrategies(
|
|
292
|
+
function getStrategies(config, strategyIds) {
|
|
285
293
|
return __awaiter(this, void 0, void 0, function () {
|
|
286
|
-
var strategies, len, results, results_1, results_1_1, result, fields;
|
|
294
|
+
var provider, strategies, len, results, results_1, results_1_1, result, fields;
|
|
287
295
|
var e_3, _a;
|
|
288
296
|
var _b;
|
|
289
297
|
return __generator(this, function (_c) {
|
|
290
298
|
switch (_c.label) {
|
|
291
299
|
case 0:
|
|
300
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
292
301
|
strategies = new Map();
|
|
293
302
|
_c.label = 1;
|
|
294
303
|
case 1:
|
|
@@ -318,14 +327,16 @@ function getStrategies(provider, strategyIds) {
|
|
|
318
327
|
});
|
|
319
328
|
});
|
|
320
329
|
}
|
|
321
|
-
function getStrategyIds(
|
|
330
|
+
function getStrategyIds(config, parentId) {
|
|
322
331
|
return __awaiter(this, void 0, void 0, function () {
|
|
323
|
-
var result, datas;
|
|
332
|
+
var provider, result, datas;
|
|
324
333
|
return __generator(this, function (_a) {
|
|
325
334
|
switch (_a.label) {
|
|
326
|
-
case 0:
|
|
327
|
-
|
|
328
|
-
|
|
335
|
+
case 0:
|
|
336
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
337
|
+
return [4 /*yield*/, provider.getDynamicFields({
|
|
338
|
+
parentId: parentId,
|
|
339
|
+
})];
|
|
329
340
|
case 1:
|
|
330
341
|
result = _a.sent();
|
|
331
342
|
datas = result.data;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
2
|
export declare const CLOCK = "0x6";
|
|
3
|
+
export declare const SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
3
4
|
export declare const PRICE_DECIMAL = 8;
|
|
4
5
|
export declare const TOKEN_DECIMAL = 9;
|
|
5
6
|
export declare const DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
|
@@ -1,8 +1,9 @@
|
|
|
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.testnetConnection = exports.mainnetConnection = exports.TOKEN_NAME_TO_MODULE = exports.TOKEN_NAME = exports.FAKE_TOKEN_TYPE_ARGUMENT = exports.DEFAULT_TYPE_ARGUMENT = exports.TOKEN_DECIMAL = exports.PRICE_DECIMAL = exports.CLOCK = void 0;
|
|
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.testnetConnection = exports.mainnetConnection = 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;
|
|
4
4
|
var client_1 = require("@mysten/sui.js/client");
|
|
5
5
|
exports.CLOCK = "0x6";
|
|
6
|
+
exports.SENDER = "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
|
6
7
|
exports.PRICE_DECIMAL = 8;
|
|
7
8
|
exports.TOKEN_DECIMAL = 9;
|
|
8
9
|
exports.DEFAULT_TYPE_ARGUMENT = "0x2::sui::SUI";
|
package/dist/src/dice/api.d.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { TypusConfig } from "src/utils";
|
|
2
|
+
export declare function getDrawResult(config: TypusConfig, input: {
|
|
3
|
+
network: "mainnet" | "testnet";
|
|
4
|
+
module: "tails_exp" | "combo_dice";
|
|
5
|
+
index: string;
|
|
6
|
+
amount: string;
|
|
7
|
+
guess_1: string;
|
|
8
|
+
larger_than_1: boolean;
|
|
9
|
+
guess_2: string;
|
|
10
|
+
larger_than_2: boolean;
|
|
11
|
+
vrf_input_1: number[];
|
|
12
|
+
vrf_input_2: number[];
|
|
13
|
+
}): Promise<any>;
|
package/dist/src/dice/api.js
CHANGED
|
@@ -37,29 +37,40 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getDrawResult = getDrawResult;
|
|
40
|
-
function getDrawResult(
|
|
40
|
+
function getDrawResult(config, input) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
-
var queryParams, vrf_input_1_string, vrf_input_2_string, apiUrl, apiUrlWithParams, response, data;
|
|
42
|
+
var registry, queryParams, vrf_input_1_string, vrf_input_2_string, apiUrl, apiUrlWithParams, response, data;
|
|
43
43
|
return __generator(this, function (_a) {
|
|
44
44
|
switch (_a.label) {
|
|
45
45
|
case 0:
|
|
46
|
+
registry = "";
|
|
47
|
+
switch (input.module) {
|
|
48
|
+
case "tails_exp":
|
|
49
|
+
registry = config.registry.dice.tailsExp;
|
|
50
|
+
break;
|
|
51
|
+
case "combo_dice":
|
|
52
|
+
registry = config.registry.dice.comboDice;
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
46
57
|
queryParams = new URLSearchParams({
|
|
47
|
-
network: network,
|
|
48
|
-
packageId:
|
|
58
|
+
network: input.network,
|
|
59
|
+
packageId: config.package.dice,
|
|
49
60
|
registry: registry,
|
|
50
|
-
index: index,
|
|
51
|
-
amount: amount,
|
|
52
|
-
guess_1: guess_1,
|
|
53
|
-
larger_than_1: "".concat(larger_than_1),
|
|
54
|
-
guess_2: guess_2,
|
|
55
|
-
larger_than_2: "".concat(larger_than_2),
|
|
61
|
+
index: input.index,
|
|
62
|
+
amount: input.amount,
|
|
63
|
+
guess_1: input.guess_1,
|
|
64
|
+
larger_than_1: "".concat(input.larger_than_1),
|
|
65
|
+
guess_2: input.guess_2,
|
|
66
|
+
larger_than_2: "".concat(input.larger_than_2),
|
|
56
67
|
});
|
|
57
|
-
vrf_input_1_string = JSON.stringify(vrf_input_1);
|
|
58
|
-
vrf_input_2_string = JSON.stringify(vrf_input_2);
|
|
59
|
-
if (module === "tails_exp") {
|
|
68
|
+
vrf_input_1_string = JSON.stringify(input.vrf_input_1);
|
|
69
|
+
vrf_input_2_string = JSON.stringify(input.vrf_input_2);
|
|
70
|
+
if (input.module === "tails_exp") {
|
|
60
71
|
apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/draw-result-1";
|
|
61
72
|
}
|
|
62
|
-
else if (module === "combo_dice") {
|
|
73
|
+
else if (input.module === "combo_dice") {
|
|
63
74
|
apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/draw-result-2";
|
|
64
75
|
}
|
|
65
76
|
apiUrlWithParams = "".concat(apiUrl, "?").concat(queryParams.toString(), "&vrf_input_1=").concat(vrf_input_1_string, "&vrf_input_2=").concat(vrf_input_2_string);
|
package/dist/src/dice/fetch.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getPlaygrounds(
|
|
1
|
+
import { TypusConfig } from "src/utils";
|
|
2
|
+
export declare function getPlaygrounds(config: TypusConfig, input: {
|
|
3
|
+
module: "tails_exp" | "combo_dice";
|
|
4
|
+
}): Promise<Playground[]>;
|
|
3
5
|
export interface Playground {
|
|
4
6
|
id: string;
|
|
5
7
|
house_whitelist: string[];
|
|
@@ -37,7 +39,10 @@ export interface Game {
|
|
|
37
39
|
larger_than_2: boolean | null;
|
|
38
40
|
vrf_input_2: number[] | null;
|
|
39
41
|
}
|
|
40
|
-
export declare function getHistory(
|
|
42
|
+
export declare function getHistory(config: TypusConfig, input: {
|
|
43
|
+
module: "tails_exp" | "combo_dice";
|
|
44
|
+
playgrounds: Playground[];
|
|
45
|
+
}): Promise<DrawDisplay[]>;
|
|
41
46
|
export declare function parseHistory(datas: any, playgrounds: Playground[]): Promise<DrawDisplay[]>;
|
|
42
47
|
export interface DrawEvent {
|
|
43
48
|
answer_1: string;
|
|
@@ -73,12 +78,3 @@ export interface DrawDisplay {
|
|
|
73
78
|
timestampMs: string;
|
|
74
79
|
reward?: string;
|
|
75
80
|
}
|
|
76
|
-
export interface ProfitSharing {
|
|
77
|
-
level_profits: string[];
|
|
78
|
-
level_users: string[];
|
|
79
|
-
pool: string;
|
|
80
|
-
remaining: string;
|
|
81
|
-
total: string;
|
|
82
|
-
tokenType: string;
|
|
83
|
-
}
|
|
84
|
-
export declare function getProfitSharing(provider: SuiClient, diceProfitSharing: string): Promise<ProfitSharing>;
|
package/dist/src/dice/fetch.js
CHANGED
|
@@ -50,14 +50,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
50
50
|
exports.getPlaygrounds = getPlaygrounds;
|
|
51
51
|
exports.getHistory = getHistory;
|
|
52
52
|
exports.parseHistory = parseHistory;
|
|
53
|
-
|
|
53
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
54
54
|
var constants_1 = require("../constants");
|
|
55
|
-
function getPlaygrounds(
|
|
55
|
+
function getPlaygrounds(config, input) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var playgroundIds, objects, result;
|
|
57
|
+
var provider, registry, playgroundIds, objects, result;
|
|
58
58
|
return __generator(this, function (_a) {
|
|
59
59
|
switch (_a.label) {
|
|
60
|
-
case 0:
|
|
60
|
+
case 0:
|
|
61
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
62
|
+
registry = "";
|
|
63
|
+
switch (input.module) {
|
|
64
|
+
case "tails_exp":
|
|
65
|
+
registry = config.registry.dice.tailsExp;
|
|
66
|
+
break;
|
|
67
|
+
case "combo_dice":
|
|
68
|
+
registry = config.registry.dice.comboDice;
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
return [4 /*yield*/, provider.getDynamicFields({ parentId: registry })];
|
|
61
74
|
case 1:
|
|
62
75
|
playgroundIds = (_a.sent()).data
|
|
63
76
|
.filter(function (a) { return a.objectType.endsWith("Playground"); })
|
|
@@ -119,19 +132,31 @@ function getPlaygrounds(provider, diceRegistry) {
|
|
|
119
132
|
});
|
|
120
133
|
});
|
|
121
134
|
}
|
|
122
|
-
function getHistory(
|
|
135
|
+
function getHistory(config, input) {
|
|
123
136
|
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
-
var eventFilter, result, history, nextPage;
|
|
137
|
+
var provider, registry, eventFilter, result, history, nextPage;
|
|
125
138
|
return __generator(this, function (_a) {
|
|
126
139
|
switch (_a.label) {
|
|
127
140
|
case 0:
|
|
141
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
142
|
+
registry = "";
|
|
143
|
+
switch (input.module) {
|
|
144
|
+
case "tails_exp":
|
|
145
|
+
registry = config.registry.dice.tailsExp;
|
|
146
|
+
break;
|
|
147
|
+
case "combo_dice":
|
|
148
|
+
registry = config.registry.dice.comboDice;
|
|
149
|
+
break;
|
|
150
|
+
default:
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
128
153
|
eventFilter = {
|
|
129
|
-
MoveEventType: "".concat(
|
|
154
|
+
MoveEventType: "".concat(registry, "::").concat(module, "::Draw"),
|
|
130
155
|
};
|
|
131
156
|
return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending" })];
|
|
132
157
|
case 1:
|
|
133
158
|
result = _a.sent();
|
|
134
|
-
return [4 /*yield*/, parseHistory(result.data, playgrounds)];
|
|
159
|
+
return [4 /*yield*/, parseHistory(result.data, input.playgrounds)];
|
|
135
160
|
case 2:
|
|
136
161
|
history = _a.sent();
|
|
137
162
|
_a.label = 3;
|
|
@@ -140,7 +165,7 @@ function getHistory(provider, dicePackage, module, playgrounds) {
|
|
|
140
165
|
return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending", cursor: result.nextCursor })];
|
|
141
166
|
case 4:
|
|
142
167
|
result = _a.sent();
|
|
143
|
-
return [4 /*yield*/, parseHistory(result.data, playgrounds)];
|
|
168
|
+
return [4 /*yield*/, parseHistory(result.data, input.playgrounds)];
|
|
144
169
|
case 5:
|
|
145
170
|
nextPage = _a.sent();
|
|
146
171
|
history = history.concat(nextPage);
|
|
@@ -223,24 +248,46 @@ function parseHistory(datas, playgrounds) {
|
|
|
223
248
|
});
|
|
224
249
|
});
|
|
225
250
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
251
|
+
// export interface LeaderBoard {
|
|
252
|
+
// player: string;
|
|
253
|
+
// total_bet_amount: number;
|
|
254
|
+
// total_earn_exp: number;
|
|
255
|
+
// }
|
|
256
|
+
// export async function getLeaderBoard(drawDisplays: DrawDisplay[]): Promise<LeaderBoard[]> {
|
|
257
|
+
// let leaderBoard: LeaderBoard[] = [];
|
|
258
|
+
// for (let drawDisplay of drawDisplays) {
|
|
259
|
+
// let i = leaderBoard.findIndex((x) => x.player == drawDisplay.player);
|
|
260
|
+
// if (i == -1) {
|
|
261
|
+
// leaderBoard.push({
|
|
262
|
+
// player: drawDisplay.player,
|
|
263
|
+
// total_bet_amount: Number(drawDisplay.bet_amount.split(" ")[0]),
|
|
264
|
+
// total_earn_exp: Number(drawDisplay.exp.split(" ")[0]),
|
|
265
|
+
// } as LeaderBoard);
|
|
266
|
+
// } else {
|
|
267
|
+
// leaderBoard[i].total_bet_amount += Number(drawDisplay.bet_amount.split(" ")[0]);
|
|
268
|
+
// leaderBoard[i].total_earn_exp += Number(drawDisplay.exp.split(" ")[0]);
|
|
269
|
+
// }
|
|
270
|
+
// }
|
|
271
|
+
// return leaderBoard;
|
|
272
|
+
// }
|
|
273
|
+
// export interface ProfitSharing {
|
|
274
|
+
// level_profits: string[];
|
|
275
|
+
// level_users: string[];
|
|
276
|
+
// pool: string;
|
|
277
|
+
// remaining: string;
|
|
278
|
+
// total: string;
|
|
279
|
+
// tokenType: string;
|
|
280
|
+
// }
|
|
281
|
+
// export async function getProfitSharing(provider: SuiClient, diceProfitSharing: string) {
|
|
282
|
+
// const object = await provider.getObject({
|
|
283
|
+
// id: diceProfitSharing,
|
|
284
|
+
// options: { showContent: true },
|
|
285
|
+
// });
|
|
286
|
+
// // @ts-ignore
|
|
287
|
+
// const type: string = object.data?.content.type;
|
|
288
|
+
// const tokenType = type.split("<").at(-1)?.replace(">>", "")!;
|
|
289
|
+
// // @ts-ignore
|
|
290
|
+
// const result = object.data?.content?.fields.value.fields as ProfitSharing;
|
|
291
|
+
// result.tokenType = tokenType;
|
|
292
|
+
// return result;
|
|
293
|
+
// }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
|
+
import { TypusConfig } from "src/utils";
|
|
2
3
|
/**
|
|
3
4
|
public(friend) entry fun new_game<TOKEN>(
|
|
4
5
|
registry: &mut Registry,
|
|
@@ -8,8 +9,13 @@ import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
|
8
9
|
ctx: &mut TxContext
|
|
9
10
|
)
|
|
10
11
|
*/
|
|
11
|
-
export declare function newGameTx(
|
|
12
|
-
|
|
12
|
+
export declare function newGameTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
13
|
+
module: "tails_exp" | "combo_dice";
|
|
14
|
+
typeArguments: string[];
|
|
15
|
+
index: string;
|
|
16
|
+
coins: string[];
|
|
17
|
+
amount: string;
|
|
18
|
+
}): Promise<TransactionBlock>;
|
|
13
19
|
/**
|
|
14
20
|
public(friend) entry fun play_guess(
|
|
15
21
|
registry: &mut Registry,
|
|
@@ -22,9 +28,25 @@ registry: string, index: string, coins: string[], amount: string): Promise<Trans
|
|
|
22
28
|
ctx: &mut TxContext
|
|
23
29
|
)
|
|
24
30
|
*/
|
|
25
|
-
export declare function playGuessTx(
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
export declare function playGuessTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
32
|
+
module: "tails_exp" | "combo_dice";
|
|
33
|
+
index: string;
|
|
34
|
+
guess_1: string;
|
|
35
|
+
larger_than_1: boolean;
|
|
36
|
+
guess_2: string;
|
|
37
|
+
larger_than_2: boolean;
|
|
38
|
+
}): Promise<TransactionBlock>;
|
|
39
|
+
export declare function newGamePlayGuessTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
40
|
+
module: "tails_exp" | "combo_dice";
|
|
41
|
+
typeArguments: string[];
|
|
42
|
+
index: string;
|
|
43
|
+
coins: string[];
|
|
44
|
+
amount: string;
|
|
45
|
+
guess_1: string;
|
|
46
|
+
larger_than_1: boolean;
|
|
47
|
+
guess_2: string;
|
|
48
|
+
larger_than_2: boolean;
|
|
49
|
+
}): Promise<TransactionBlock>;
|
|
28
50
|
/**
|
|
29
51
|
public fun consume_exp_coin_staked(
|
|
30
52
|
registry: &mut Registry,
|
|
@@ -34,12 +56,7 @@ registry: string, expRegistry: string, index: string, coins: string[], amount: s
|
|
|
34
56
|
coin: Coin<TAILS_EXP>,
|
|
35
57
|
) {
|
|
36
58
|
*/
|
|
37
|
-
export declare function getConsumeExpCoinStakedTx(input: {
|
|
38
|
-
tx: TransactionBlock;
|
|
39
|
-
packageId: string;
|
|
40
|
-
tailsExpRegistry: string;
|
|
41
|
-
typusEcosystemVersion: string;
|
|
42
|
-
tailsStakingRegistry: string;
|
|
59
|
+
export declare function getConsumeExpCoinStakedTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
43
60
|
tails: string;
|
|
44
61
|
coins: string[];
|
|
45
62
|
amount: string;
|
|
@@ -55,12 +72,7 @@ export declare function getConsumeExpCoinStakedTx(input: {
|
|
|
55
72
|
coin: Coin<TAILS_EXP>,
|
|
56
73
|
) {
|
|
57
74
|
*/
|
|
58
|
-
export declare function getConsumeExpCoinUnstakedTx(input: {
|
|
59
|
-
tx: TransactionBlock;
|
|
60
|
-
packageId: string;
|
|
61
|
-
tailsExpRegistry: string;
|
|
62
|
-
typusEcosystemVersion: string;
|
|
63
|
-
tailsStakingRegistry: string;
|
|
75
|
+
export declare function getConsumeExpCoinUnstakedTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
64
76
|
kiosk: string;
|
|
65
77
|
kioskCap: string;
|
|
66
78
|
tails: string;
|