@typus/typus-sdk 1.4.8 → 1.4.9
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/config.json +6 -5
- package/dist/src/dice/api.d.ts +1 -0
- package/dist/src/{tails-exp-dice → dice}/api.js +8 -3
- package/dist/src/{tails-exp-dice → dice}/fetch.d.ts +15 -11
- package/dist/src/{tails-exp-dice → dice}/fetch.js +45 -70
- package/dist/src/{tails-exp-dice → dice}/user-entry.d.ts +4 -4
- package/dist/src/{tails-exp-dice → dice}/user-entry.js +26 -11
- package/dist/src/dice/view-function.d.ts +8 -0
- package/dist/src/{tails-exp-dice → dice}/view-function.js +3 -3
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
- package/dist/src/tails-exp-dice/api.d.ts +0 -1
- package/dist/src/tails-exp-dice/view-function.d.ts +0 -8
- /package/dist/src/{tails-exp-dice → dice}/index.d.ts +0 -0
- /package/dist/src/{tails-exp-dice → dice}/index.js +0 -0
package/dist/config.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"PACKAGE_ORIGIN": {
|
|
5
5
|
"DOV_SINGLE": "0x321848bf1ae327a9e022ccb3701940191e02fa193ab160d9c0e49cd3c003de3a",
|
|
6
6
|
"FRAMEWORK": "0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274",
|
|
7
|
-
"
|
|
7
|
+
"DICE": "0x37816d28c34cc0df82655ca97b3f066112a5f3c202cbb4aaa76c8af54e779750",
|
|
8
8
|
"MFUD": "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d",
|
|
9
9
|
"NFT": "0xbd147bc7f12f38f175d78947a61364e8e077b9b188b00e7094bc0c3623162196",
|
|
10
10
|
"ORACLE": "0x855eb2d260ee42b898266e6df90bfd3c4ed821ccb253a352c159c223244a4b8a",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"PACKAGE": {
|
|
15
15
|
"DOV_SINGLE": "0xf7ef57f3bd98455262417886b17eb4d5af1a18d2dec19c5b34e512bf4fc10acf",
|
|
16
16
|
"FRAMEWORK": "0x5c6648fb219c046256488486d23d4af7bc562d5ab5c382e1f4b558066a327fe8",
|
|
17
|
-
"
|
|
17
|
+
"DICE": "0x14f1676b7a3b3a6c35eeff747bdb6fcb5bfe920755086c4af1079c23107c22aa",
|
|
18
18
|
"MFUD": "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d",
|
|
19
19
|
"NFT": "0xba06aae31d9b7c9f651e783272c7e4f776fb5ae17e89d525b75a17b099f58202",
|
|
20
20
|
"ORACLE": "0x978f65df8570a075298598a9965c18de9087f9e888eb3430fe20334f5c554cfd",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"REGISTRY": {
|
|
25
25
|
"AIRDROP": "0x4b451f4632bd64af82d5e6fe46e20705c9468bd46d6758a0f7093fde2930d084",
|
|
26
26
|
"DOV_SINGLE": "0x3d70b09359e3ca8301ae0abeda4f2fdf72ce313ba58c919ce568e5f535fd2ea8",
|
|
27
|
+
"TYPUS_DICE": "0x16657424191772d40afac15738abb26cdf41172d2d205694b04d1300ad403c55",
|
|
27
28
|
"EXP_GUESS": "0x7679ab7157f13ec945579e3098ba589eb8b4eec841c775799d2aa22b565187c7",
|
|
28
29
|
"LEADERBOARD": "0xc515a3e7fd12ba902f7f1ebe52c676136e1b34cb614ae9c79a46b257ca7d5534",
|
|
29
30
|
"MFUD": "0xb8d7e7ab783e56700c0212bd9f0938bba9dd3e7241c149e6c52b21334ec45ece",
|
|
@@ -62,8 +63,7 @@
|
|
|
62
63
|
"RPC_ENDPOINT": "https://sui-testnet.blastapi.io:443/7f446a12-c4ab-4e3c-b2d8-ebb0fcbe5cdd",
|
|
63
64
|
"PACKAGE_ORIGIN": {
|
|
64
65
|
"DOV_SINGLE": "0x6c9a394a43844fc09d9617bc8a8e775a4521f0e28e83de1da780d043a498671f",
|
|
65
|
-
"
|
|
66
|
-
"EXP_GUESS": "0x9b43ee208a3b235810c145bca1161d1a71d08bfe76b1e55bb3db319ea95d0149",
|
|
66
|
+
"DICE": "0x9b43ee208a3b235810c145bca1161d1a71d08bfe76b1e55bb3db319ea95d0149",
|
|
67
67
|
"FRAMEWORK": "0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded",
|
|
68
68
|
"MFUD": "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c",
|
|
69
69
|
"NFT": "0x5cfd0819411be98034cba544cbffab192c2c35674a05ff57f4f1c5042875b828",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"PACKAGE": {
|
|
76
76
|
"DOV_SINGLE": "0x2e462aa0224bec76acaea81c51ca5b9ae4b27ec50281a764797c84148c8a463f",
|
|
77
|
-
"
|
|
77
|
+
"DICE": "0x112321a74fb0903aff5c654603c19060552a704b5fb13a6cefa84e1147e66db8",
|
|
78
78
|
"FRAMEWORK": "0x90ca6e2393e3adc91b4e9b70ab16c017e5f70f7094b6f09b913fef2833a656e9",
|
|
79
79
|
"MFUD": "0x7755ff79f0f27256c73e6c197e25b407ef6d4b9bd6e1af8cdd50fef28f84712c",
|
|
80
80
|
"NFT": "0x0f5162014f18686640b8d0adefd60c3fe5b377413ec4f1e77001c67d96f8501a",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"LEADERBOARD": "0x4faabe5a4a509a145fc9bae95761d34c11571da4cb25d681f06ffcbadbc355e7",
|
|
89
89
|
"MFUD": "0x7ad87901531693f1baa541712947860dcc543617e11b14993ad70d20daf159c6",
|
|
90
90
|
"TAILS_EXP": "0x37e0c8c80a5099d5dfe1b0aeae62e3f01916be73935090efb9c95279b7bb1ce7",
|
|
91
|
+
"TYPUS_DICE": "0x034f58472d9604eee3e1fb5896e4d6a14f426c17c504cdb9dcdc7269ca4ad3b4",
|
|
91
92
|
"EXP_GUESS": "0x37e0c8c80a5099d5dfe1b0aeae62e3f01916be73935090efb9c95279b7bb1ce7",
|
|
92
93
|
"TAILS_STAKING": "0x989bd585b580dfc22d9d7656a5807b2f6c8fe36260a2003ef697adc8a38d21af",
|
|
93
94
|
"TGLD": "0x2118b4056c89d90a6dc40d198fbe239cb8e83f7ea20daaf4ea53341c7fdb043c",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDrawResult(network: "mainnet" | "testnet", packageId: string, module: "tails_exp" | "combo_dice", registry: string, index: string, amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean, vrf_input_1: number[], vrf_input_2: number[]): Promise<any>;
|
|
@@ -37,10 +37,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getDrawResult = getDrawResult;
|
|
40
|
-
|
|
41
|
-
function getDrawResult(network, packageId, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2) {
|
|
40
|
+
function getDrawResult(network, packageId, module, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2) {
|
|
42
41
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
-
var queryParams, vrf_input_1_string, vrf_input_2_string, apiUrlWithParams, response, data;
|
|
42
|
+
var queryParams, vrf_input_1_string, vrf_input_2_string, apiUrl, apiUrlWithParams, response, data;
|
|
44
43
|
return __generator(this, function (_a) {
|
|
45
44
|
switch (_a.label) {
|
|
46
45
|
case 0:
|
|
@@ -57,6 +56,12 @@ function getDrawResult(network, packageId, registry, index, amount, guess_1, lar
|
|
|
57
56
|
});
|
|
58
57
|
vrf_input_1_string = JSON.stringify(vrf_input_1);
|
|
59
58
|
vrf_input_2_string = JSON.stringify(vrf_input_2);
|
|
59
|
+
if (module === "tails_exp") {
|
|
60
|
+
apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/draw-result-1";
|
|
61
|
+
}
|
|
62
|
+
else if (module === "combo_dice") {
|
|
63
|
+
apiUrl = "https://us-central1-aqueous-freedom-378103.cloudfunctions.net/draw-result-2";
|
|
64
|
+
}
|
|
60
65
|
apiUrlWithParams = "".concat(apiUrl, "?").concat(queryParams.toString(), "&vrf_input_1=").concat(vrf_input_1_string, "&vrf_input_2=").concat(vrf_input_2_string);
|
|
61
66
|
return [4 /*yield*/, fetch(apiUrlWithParams, {
|
|
62
67
|
method: "GET",
|
|
@@ -9,14 +9,22 @@ export interface Playground {
|
|
|
9
9
|
opened_games: Map<string, Game>;
|
|
10
10
|
game_config: GameConfig;
|
|
11
11
|
is_active: boolean;
|
|
12
|
+
exp_config?: ExpConfig;
|
|
12
13
|
}
|
|
13
14
|
export interface GameConfig {
|
|
14
15
|
max_stake: string;
|
|
15
16
|
min_stake: string;
|
|
16
17
|
stake_lot_size: string;
|
|
17
|
-
base_exp_divisor: string;
|
|
18
|
-
losses_multiplier_bp: string;
|
|
19
18
|
critical_hits_multiplier_bp: string;
|
|
19
|
+
base_exp_divisor?: string;
|
|
20
|
+
losses_multiplier_bp?: string;
|
|
21
|
+
banker_edge_bp?: string;
|
|
22
|
+
max_single_game_loss_ratio_bp?: string;
|
|
23
|
+
u64_padding?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface ExpConfig {
|
|
26
|
+
base_exp_divisor: string;
|
|
27
|
+
u64_padding: string[];
|
|
20
28
|
}
|
|
21
29
|
export interface Game {
|
|
22
30
|
game_id: string;
|
|
@@ -29,13 +37,11 @@ export interface Game {
|
|
|
29
37
|
larger_than_2: boolean | null;
|
|
30
38
|
vrf_input_2: number[] | null;
|
|
31
39
|
}
|
|
32
|
-
export declare function getHistory(provider: SuiClient, dicePackage: string, playgrounds: Playground[]): Promise<DrawDisplay[]>;
|
|
33
|
-
export declare function waitHistory(provider: SuiClient, dicePackage: string, onMessage: any): Promise<import("@mysten/sui.js/client").Unsubscribe>;
|
|
40
|
+
export declare function getHistory(provider: SuiClient, dicePackage: string, module: "tails_exp" | "combo_dice", playgrounds: Playground[]): Promise<DrawDisplay[]>;
|
|
34
41
|
export declare function parseHistory(datas: any, playgrounds: Playground[]): Promise<DrawDisplay[]>;
|
|
35
42
|
export interface DrawEvent {
|
|
36
43
|
answer_1: string;
|
|
37
44
|
answer_2: string;
|
|
38
|
-
exp: string;
|
|
39
45
|
game_id: string;
|
|
40
46
|
guess_1: string;
|
|
41
47
|
guess_2: string;
|
|
@@ -51,6 +57,9 @@ export interface DrawEvent {
|
|
|
51
57
|
signer: string;
|
|
52
58
|
stake_amount: string;
|
|
53
59
|
timestampMs: string;
|
|
60
|
+
exp?: string;
|
|
61
|
+
exp_amount?: string;
|
|
62
|
+
reward?: string;
|
|
54
63
|
}
|
|
55
64
|
export interface DrawDisplay {
|
|
56
65
|
game_id: string;
|
|
@@ -62,13 +71,8 @@ export interface DrawDisplay {
|
|
|
62
71
|
bet_amount: string;
|
|
63
72
|
exp: string;
|
|
64
73
|
timestampMs: string;
|
|
74
|
+
reward?: string;
|
|
65
75
|
}
|
|
66
|
-
export interface LeaderBoard {
|
|
67
|
-
player: string;
|
|
68
|
-
total_bet_amount: number;
|
|
69
|
-
total_earn_exp: number;
|
|
70
|
-
}
|
|
71
|
-
export declare function getLeaderBoard(drawDisplays: DrawDisplay[]): Promise<LeaderBoard[]>;
|
|
72
76
|
export interface ProfitSharing {
|
|
73
77
|
level_profits: string[];
|
|
74
78
|
level_users: string[];
|
|
@@ -49,9 +49,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.getPlaygrounds = getPlaygrounds;
|
|
51
51
|
exports.getHistory = getHistory;
|
|
52
|
-
exports.waitHistory = waitHistory;
|
|
53
52
|
exports.parseHistory = parseHistory;
|
|
54
|
-
exports.getLeaderBoard = getLeaderBoard;
|
|
55
53
|
exports.getProfitSharing = getProfitSharing;
|
|
56
54
|
exports.calculateLevelReward = calculateLevelReward;
|
|
57
55
|
var token_1 = require("../constants/token");
|
|
@@ -76,16 +74,30 @@ function getPlaygrounds(provider, diceRegistry) {
|
|
|
76
74
|
// @ts-ignore
|
|
77
75
|
.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"); })
|
|
78
76
|
.map(function (object) {
|
|
79
|
-
var _a;
|
|
77
|
+
var e_1, _a;
|
|
78
|
+
var _b;
|
|
80
79
|
// @ts-ignore
|
|
81
|
-
var fields = (
|
|
80
|
+
var fields = (_b = object.data) === null || _b === void 0 ? void 0 : _b.content.fields;
|
|
82
81
|
// console.log(fields);
|
|
83
|
-
var opened_games =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
var opened_games = new Map();
|
|
83
|
+
if (fields.opened_games.fields) {
|
|
84
|
+
try {
|
|
85
|
+
for (var _c = __values(fields.opened_games.fields.contents), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
86
|
+
var curr = _d.value;
|
|
87
|
+
// console.log(curr);
|
|
88
|
+
opened_games.set(curr.fields.key, curr.fields.value.fields);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
92
|
+
finally {
|
|
93
|
+
try {
|
|
94
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
95
|
+
}
|
|
96
|
+
finally { if (e_1) throw e_1.error; }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
88
99
|
// console.log(opened_games);
|
|
100
|
+
var game_config = fields.game_config.fields;
|
|
89
101
|
// console.log(game_config);
|
|
90
102
|
var playground = {
|
|
91
103
|
id: fields.id.id,
|
|
@@ -97,6 +109,9 @@ function getPlaygrounds(provider, diceRegistry) {
|
|
|
97
109
|
game_config: game_config,
|
|
98
110
|
is_active: fields.is_active,
|
|
99
111
|
};
|
|
112
|
+
if (fields.exp_config) {
|
|
113
|
+
playground.exp_config = fields.exp_config.fields;
|
|
114
|
+
}
|
|
100
115
|
// console.log(playground);
|
|
101
116
|
return playground;
|
|
102
117
|
});
|
|
@@ -105,14 +120,14 @@ function getPlaygrounds(provider, diceRegistry) {
|
|
|
105
120
|
});
|
|
106
121
|
});
|
|
107
122
|
}
|
|
108
|
-
function getHistory(provider, dicePackage, playgrounds) {
|
|
123
|
+
function getHistory(provider, dicePackage, module, playgrounds) {
|
|
109
124
|
return __awaiter(this, void 0, void 0, function () {
|
|
110
125
|
var eventFilter, result, history, nextPage;
|
|
111
126
|
return __generator(this, function (_a) {
|
|
112
127
|
switch (_a.label) {
|
|
113
128
|
case 0:
|
|
114
129
|
eventFilter = {
|
|
115
|
-
MoveEventType: "".concat(dicePackage, "::
|
|
130
|
+
MoveEventType: "".concat(dicePackage, "::").concat(module, "::Draw"),
|
|
116
131
|
};
|
|
117
132
|
return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending" })];
|
|
118
133
|
case 1:
|
|
@@ -136,26 +151,6 @@ function getHistory(provider, dicePackage, playgrounds) {
|
|
|
136
151
|
});
|
|
137
152
|
});
|
|
138
153
|
}
|
|
139
|
-
function waitHistory(provider, dicePackage, onMessage) {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
-
var eventFilter, unsubscribe;
|
|
142
|
-
return __generator(this, function (_a) {
|
|
143
|
-
switch (_a.label) {
|
|
144
|
-
case 0:
|
|
145
|
-
eventFilter = {
|
|
146
|
-
MoveEventType: "".concat(dicePackage, "::tails_exp::Draw"),
|
|
147
|
-
};
|
|
148
|
-
return [4 /*yield*/, provider.subscribeEvent({
|
|
149
|
-
filter: eventFilter,
|
|
150
|
-
onMessage: onMessage,
|
|
151
|
-
})];
|
|
152
|
-
case 1:
|
|
153
|
-
unsubscribe = _a.sent();
|
|
154
|
-
return [2 /*return*/, unsubscribe];
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
154
|
function parseHistory(datas, playgrounds) {
|
|
160
155
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
156
|
var result;
|
|
@@ -194,7 +189,15 @@ function parseHistory(datas, playgrounds) {
|
|
|
194
189
|
break;
|
|
195
190
|
}
|
|
196
191
|
var stake_amount = Number(drawEvent.stake_amount) / Math.pow(10, decimal);
|
|
197
|
-
var amount
|
|
192
|
+
var amount;
|
|
193
|
+
if (asset == "FUD") {
|
|
194
|
+
amount = "".concat(stake_amount / 1000000, "m");
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
amount = stake_amount;
|
|
198
|
+
}
|
|
199
|
+
var exp = Number(drawEvent.exp) | Number(drawEvent.exp_amount);
|
|
200
|
+
// console.log(drawEvent);
|
|
198
201
|
var display = {
|
|
199
202
|
game_id: drawEvent.game_id,
|
|
200
203
|
player: drawEvent.player,
|
|
@@ -203,52 +206,24 @@ function parseHistory(datas, playgrounds) {
|
|
|
203
206
|
result_1: result_1,
|
|
204
207
|
result_2: result_2,
|
|
205
208
|
bet_amount: "".concat(amount, " ").concat(asset),
|
|
206
|
-
exp: "".concat(
|
|
209
|
+
exp: "".concat(exp, " EXP"),
|
|
207
210
|
timestampMs: drawEvent.timestampMs,
|
|
208
211
|
};
|
|
212
|
+
if (drawEvent.reward) {
|
|
213
|
+
var reward = Number(drawEvent.reward) / Math.pow(10, decimal);
|
|
214
|
+
if (asset == "FUD") {
|
|
215
|
+
display.reward = "".concat(reward / 1000000, "m ").concat(asset);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
display.reward = "".concat(reward, " ").concat(asset);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
209
221
|
return display;
|
|
210
222
|
});
|
|
211
223
|
return [2 /*return*/, result];
|
|
212
224
|
});
|
|
213
225
|
});
|
|
214
226
|
}
|
|
215
|
-
function getLeaderBoard(drawDisplays) {
|
|
216
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
217
|
-
var leaderBoard, _loop_1, drawDisplays_1, drawDisplays_1_1, drawDisplay;
|
|
218
|
-
var e_1, _a;
|
|
219
|
-
return __generator(this, function (_b) {
|
|
220
|
-
leaderBoard = [];
|
|
221
|
-
_loop_1 = function (drawDisplay) {
|
|
222
|
-
var i = leaderBoard.findIndex(function (x) { return x.player == drawDisplay.player; });
|
|
223
|
-
if (i == -1) {
|
|
224
|
-
leaderBoard.push({
|
|
225
|
-
player: drawDisplay.player,
|
|
226
|
-
total_bet_amount: Number(drawDisplay.bet_amount.split(" ")[0]),
|
|
227
|
-
total_earn_exp: Number(drawDisplay.exp.split(" ")[0]),
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
leaderBoard[i].total_bet_amount += Number(drawDisplay.bet_amount.split(" ")[0]);
|
|
232
|
-
leaderBoard[i].total_earn_exp += Number(drawDisplay.exp.split(" ")[0]);
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
try {
|
|
236
|
-
for (drawDisplays_1 = __values(drawDisplays), drawDisplays_1_1 = drawDisplays_1.next(); !drawDisplays_1_1.done; drawDisplays_1_1 = drawDisplays_1.next()) {
|
|
237
|
-
drawDisplay = drawDisplays_1_1.value;
|
|
238
|
-
_loop_1(drawDisplay);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
242
|
-
finally {
|
|
243
|
-
try {
|
|
244
|
-
if (drawDisplays_1_1 && !drawDisplays_1_1.done && (_a = drawDisplays_1.return)) _a.call(drawDisplays_1);
|
|
245
|
-
}
|
|
246
|
-
finally { if (e_1) throw e_1.error; }
|
|
247
|
-
}
|
|
248
|
-
return [2 /*return*/, leaderBoard];
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
227
|
function getProfitSharing(provider, diceProfitSharing) {
|
|
253
228
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
229
|
var object, type, tokenType, result;
|
|
@@ -8,7 +8,7 @@ import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
|
8
8
|
ctx: &mut TxContext
|
|
9
9
|
)
|
|
10
10
|
*/
|
|
11
|
-
export declare function newGameTx(gasBudget: number, packageId: string, typeArguments: string[], // [TOKEN]
|
|
11
|
+
export declare function newGameTx(gasBudget: number, packageId: string, module: "tails_exp" | "combo_dice", typeArguments: string[], // [TOKEN]
|
|
12
12
|
registry: string, index: string, coins: string[], amount: string): Promise<TransactionBlock>;
|
|
13
13
|
/**
|
|
14
14
|
public(friend) entry fun play_guess(
|
|
@@ -22,9 +22,9 @@ registry: string, index: string, coins: string[], amount: string): Promise<Trans
|
|
|
22
22
|
ctx: &mut TxContext
|
|
23
23
|
)
|
|
24
24
|
*/
|
|
25
|
-
export declare function playGuessTx(gasBudget: number, packageId: string, registry: string, index: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
|
|
26
|
-
export declare function newGamePlayGuessTx(gasBudget: number, packageId: string, typeArguments: string[], // [TOKEN]
|
|
27
|
-
registry: string, index: string, coins: string[], amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
|
|
25
|
+
export declare function playGuessTx(gasBudget: number, packageId: string, module: "tails_exp" | "combo_dice", registry: string, index: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
|
|
26
|
+
export declare function newGamePlayGuessTx(gasBudget: number, packageId: string, module: "tails_exp" | "combo_dice", typeArguments: string[], // [TOKEN]
|
|
27
|
+
registry: string, expRegistry: string, index: string, coins: string[], amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean): Promise<TransactionBlock>;
|
|
28
28
|
/**
|
|
29
29
|
public fun consume_exp_coin_staked(
|
|
30
30
|
registry: &mut Registry,
|
|
@@ -67,14 +67,14 @@ var transactions_1 = require("@mysten/sui.js/transactions");
|
|
|
67
67
|
ctx: &mut TxContext
|
|
68
68
|
)
|
|
69
69
|
*/
|
|
70
|
-
function newGameTx(gasBudget, packageId, typeArguments, // [TOKEN]
|
|
70
|
+
function newGameTx(gasBudget, packageId, module, typeArguments, // [TOKEN]
|
|
71
71
|
registry, index, coins, amount) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
73
|
var tx;
|
|
74
74
|
return __generator(this, function (_a) {
|
|
75
75
|
tx = new transactions_1.TransactionBlock();
|
|
76
76
|
tx.moveCall({
|
|
77
|
-
target: "".concat(packageId, "::
|
|
77
|
+
target: "".concat(packageId, "::").concat(module, "::new_game"),
|
|
78
78
|
typeArguments: typeArguments,
|
|
79
79
|
arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(amount)],
|
|
80
80
|
});
|
|
@@ -95,13 +95,13 @@ registry, index, coins, amount) {
|
|
|
95
95
|
ctx: &mut TxContext
|
|
96
96
|
)
|
|
97
97
|
*/
|
|
98
|
-
function playGuessTx(gasBudget, packageId, registry, index, guess_1, larger_than_1, guess_2, larger_than_2) {
|
|
98
|
+
function playGuessTx(gasBudget, packageId, module, registry, index, guess_1, larger_than_1, guess_2, larger_than_2) {
|
|
99
99
|
return __awaiter(this, void 0, void 0, function () {
|
|
100
100
|
var tx;
|
|
101
101
|
return __generator(this, function (_a) {
|
|
102
102
|
tx = new transactions_1.TransactionBlock();
|
|
103
103
|
tx.moveCall({
|
|
104
|
-
target: "".concat(packageId, "::
|
|
104
|
+
target: "".concat(packageId, "::").concat(module, "::play_guess"),
|
|
105
105
|
typeArguments: [],
|
|
106
106
|
arguments: [
|
|
107
107
|
tx.object(registry),
|
|
@@ -117,8 +117,8 @@ function playGuessTx(gasBudget, packageId, registry, index, guess_1, larger_than
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
-
function newGamePlayGuessTx(gasBudget, packageId, typeArguments, // [TOKEN]
|
|
121
|
-
registry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2) {
|
|
120
|
+
function newGamePlayGuessTx(gasBudget, packageId, module, typeArguments, // [TOKEN]
|
|
121
|
+
registry, expRegistry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2) {
|
|
122
122
|
return __awaiter(this, void 0, void 0, function () {
|
|
123
123
|
var tx, _a, coin;
|
|
124
124
|
return __generator(this, function (_b) {
|
|
@@ -127,14 +127,16 @@ registry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2)
|
|
|
127
127
|
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
128
128
|
_a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
|
|
129
129
|
tx.moveCall({
|
|
130
|
-
target: "".concat(packageId, "::
|
|
130
|
+
target: "".concat(packageId, "::").concat(module, "::new_game"),
|
|
131
131
|
typeArguments: typeArguments,
|
|
132
|
-
arguments:
|
|
132
|
+
arguments: module == "combo_dice"
|
|
133
|
+
? [tx.object(registry), tx.object(expRegistry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(amount)]
|
|
134
|
+
: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(amount)],
|
|
133
135
|
});
|
|
134
136
|
}
|
|
135
137
|
else {
|
|
136
138
|
tx.moveCall({
|
|
137
|
-
target: "".concat(packageId, "::
|
|
139
|
+
target: "".concat(packageId, "::").concat(module, "::new_game"),
|
|
138
140
|
typeArguments: typeArguments,
|
|
139
141
|
arguments: [
|
|
140
142
|
tx.object(registry),
|
|
@@ -145,7 +147,7 @@ registry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2)
|
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
tx.moveCall({
|
|
148
|
-
target: "".concat(packageId, "::
|
|
150
|
+
target: "".concat(packageId, "::").concat(module, "::play_guess"),
|
|
149
151
|
typeArguments: [],
|
|
150
152
|
arguments: [
|
|
151
153
|
tx.object(registry),
|
|
@@ -154,9 +156,22 @@ registry, index, coins, amount, guess_1, larger_than_1, guess_2, larger_than_2)
|
|
|
154
156
|
tx.pure(larger_than_1),
|
|
155
157
|
tx.pure(guess_2),
|
|
156
158
|
tx.pure(larger_than_2),
|
|
157
|
-
// tx.object("0x8"), // TODO: waiting for upgrade
|
|
158
159
|
],
|
|
159
160
|
});
|
|
161
|
+
// TODO: waiting for upgrade
|
|
162
|
+
// tx.moveCall({
|
|
163
|
+
// target: `${packageId}::${module}::play_guess_with_random`,
|
|
164
|
+
// typeArguments: module == "combo_dice" ? typeArguments : [],
|
|
165
|
+
// arguments: [
|
|
166
|
+
// tx.object(registry),
|
|
167
|
+
// tx.pure(index),
|
|
168
|
+
// tx.pure(guess_1),
|
|
169
|
+
// tx.pure(larger_than_1),
|
|
170
|
+
// tx.pure(guess_2),
|
|
171
|
+
// tx.pure(larger_than_2),
|
|
172
|
+
// tx.object("0x8"),
|
|
173
|
+
// ],
|
|
174
|
+
// });
|
|
160
175
|
tx.setGasBudget(gasBudget);
|
|
161
176
|
return [2 /*return*/, tx];
|
|
162
177
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface DrawResult {
|
|
2
|
+
answer_1: string;
|
|
3
|
+
result_1: string;
|
|
4
|
+
answer_2: string;
|
|
5
|
+
result_2: string;
|
|
6
|
+
exp: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function simulateGame(network: "mainnet" | "testnet", packageId: string, module: "tails_exp" | "combo_dice", registry: string, index: string, amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean, vrf_input_1: number[], vrf_input_2: number[], drawKeys: any, sender?: string): Promise<DrawResult>;
|
|
@@ -44,8 +44,8 @@ var transactions_1 = require("@mysten/sui.js/transactions");
|
|
|
44
44
|
var client_1 = require("@mysten/sui.js/client");
|
|
45
45
|
var bcs_1 = require("@mysten/bcs");
|
|
46
46
|
var bls_signatures_1 = __importDefault(require("bls-signatures"));
|
|
47
|
-
function simulateGame(network_1, packageId_1, registry_1, index_1, amount_1, guess_1_1, larger_than_1_1, guess_2_1, larger_than_2_1, vrf_input_1_1, vrf_input_2_1, drawKeys_1) {
|
|
48
|
-
return __awaiter(this, arguments, void 0, function (network, packageId, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2, drawKeys, sender) {
|
|
47
|
+
function simulateGame(network_1, packageId_1, module_1, registry_1, index_1, amount_1, guess_1_1, larger_than_1_1, guess_2_1, larger_than_2_1, vrf_input_1_1, vrf_input_2_1, drawKeys_1) {
|
|
48
|
+
return __awaiter(this, arguments, void 0, function (network, packageId, module, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2, drawKeys, sender) {
|
|
49
49
|
var provider, transactionBlock, target, BLS, PRIVATE_KEY, draw_private_key, bls_signature_1, bls_signature_2, transactionBlockArguments, results, bytes, reader, answer_1, result_1, answer_2, result_2, exp, result;
|
|
50
50
|
if (sender === void 0) { sender = "0xb6c7e3b1c61ee81516a8317f221daa035f1503e0ac3ae7a50b61834bc7a3ead9"; }
|
|
51
51
|
return __generator(this, function (_a) {
|
|
@@ -53,7 +53,7 @@ function simulateGame(network_1, packageId_1, registry_1, index_1, amount_1, gue
|
|
|
53
53
|
case 0:
|
|
54
54
|
provider = new client_1.SuiClient({ url: (0, client_1.getFullnodeUrl)(network) });
|
|
55
55
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
56
|
-
target = "".concat(packageId, "::
|
|
56
|
+
target = "".concat(packageId, "::").concat(module, "::simulate_game");
|
|
57
57
|
return [4 /*yield*/, (0, bls_signatures_1.default)()];
|
|
58
58
|
case 1:
|
|
59
59
|
BLS = _a.sent();
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from "./airdrop";
|
|
|
2
2
|
export * from "./auto-bid";
|
|
3
3
|
export * from "./constants";
|
|
4
4
|
export * from "./leaderboard";
|
|
5
|
-
export * from "./
|
|
5
|
+
export * from "./dice";
|
|
6
6
|
export * from "./tails-staking";
|
|
7
7
|
export * from "./typus-dov-single-v2";
|
|
8
8
|
export * from "./typus-nft";
|
package/dist/src/index.js
CHANGED
|
@@ -18,7 +18,7 @@ __exportStar(require("./airdrop"), exports);
|
|
|
18
18
|
__exportStar(require("./auto-bid"), exports);
|
|
19
19
|
__exportStar(require("./constants"), exports);
|
|
20
20
|
__exportStar(require("./leaderboard"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
21
|
+
__exportStar(require("./dice"), exports);
|
|
22
22
|
__exportStar(require("./tails-staking"), exports);
|
|
23
23
|
__exportStar(require("./typus-dov-single-v2"), exports);
|
|
24
24
|
__exportStar(require("./typus-nft"), exports);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getDrawResult(network: "mainnet" | "testnet", packageId: string, registry: string, index: string, amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean, vrf_input_1: number[], vrf_input_2: number[]): Promise<any>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface DrawResult {
|
|
2
|
-
answer_1: string;
|
|
3
|
-
result_1: string;
|
|
4
|
-
answer_2: string;
|
|
5
|
-
result_2: string;
|
|
6
|
-
exp: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function simulateGame(network: "mainnet" | "testnet", packageId: string, registry: string, index: string, amount: string, guess_1: string, larger_than_1: boolean, guess_2: string, larger_than_2: boolean, vrf_input_1: number[], vrf_input_2: number[], drawKeys: any, sender?: string): Promise<DrawResult>;
|
|
File without changes
|
|
File without changes
|