@typus/typus-sdk 1.4.6 → 1.4.7-a
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 +1 -8
- package/dist/src/{tails-exp-dice → dice}/fetch.js +24 -69
- 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/dist/src/typus-dov-single-v2/history/user-history.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,8 @@
|
|
|
14
14
|
"PACKAGE": {
|
|
15
15
|
"DOV_SINGLE": "0xf7ef57f3bd98455262417886b17eb4d5af1a18d2dec19c5b34e512bf4fc10acf",
|
|
16
16
|
"FRAMEWORK": "0x5c6648fb219c046256488486d23d4af7bc562d5ab5c382e1f4b558066a327fe8",
|
|
17
|
-
"
|
|
17
|
+
"DICE": "0xda804c7136e8fda3c9abb25e028fdc006c0adf2be1e58d8f0cce77e743373fca",
|
|
18
|
+
"DICE_0x8": "0xb1cc7379a7375808eaf4cda927a6f3a14363b6d131c020f4828119b87731fe03",
|
|
18
19
|
"MFUD": "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d",
|
|
19
20
|
"NFT": "0xba06aae31d9b7c9f651e783272c7e4f776fb5ae17e89d525b75a17b099f58202",
|
|
20
21
|
"ORACLE": "0x978f65df8570a075298598a9965c18de9087f9e888eb3430fe20334f5c554cfd",
|
|
@@ -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",
|
|
@@ -29,8 +29,7 @@ export interface Game {
|
|
|
29
29
|
larger_than_2: boolean | null;
|
|
30
30
|
vrf_input_2: number[] | null;
|
|
31
31
|
}
|
|
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>;
|
|
32
|
+
export declare function getHistory(provider: SuiClient, dicePackage: string, module: "tails_exp" | "combo_dice", playgrounds: Playground[]): Promise<DrawDisplay[]>;
|
|
34
33
|
export declare function parseHistory(datas: any, playgrounds: Playground[]): Promise<DrawDisplay[]>;
|
|
35
34
|
export interface DrawEvent {
|
|
36
35
|
answer_1: string;
|
|
@@ -63,12 +62,6 @@ export interface DrawDisplay {
|
|
|
63
62
|
exp: string;
|
|
64
63
|
timestampMs: string;
|
|
65
64
|
}
|
|
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
65
|
export interface ProfitSharing {
|
|
73
66
|
level_profits: string[];
|
|
74
67
|
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,
|
|
@@ -105,14 +117,14 @@ function getPlaygrounds(provider, diceRegistry) {
|
|
|
105
117
|
});
|
|
106
118
|
});
|
|
107
119
|
}
|
|
108
|
-
function getHistory(provider, dicePackage, playgrounds) {
|
|
120
|
+
function getHistory(provider, dicePackage, module, playgrounds) {
|
|
109
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
110
122
|
var eventFilter, result, history, nextPage;
|
|
111
123
|
return __generator(this, function (_a) {
|
|
112
124
|
switch (_a.label) {
|
|
113
125
|
case 0:
|
|
114
126
|
eventFilter = {
|
|
115
|
-
MoveEventType: "".concat(dicePackage, "::
|
|
127
|
+
MoveEventType: "".concat(dicePackage, "::").concat(module, "::Draw"),
|
|
116
128
|
};
|
|
117
129
|
return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending" })];
|
|
118
130
|
case 1:
|
|
@@ -136,26 +148,6 @@ function getHistory(provider, dicePackage, playgrounds) {
|
|
|
136
148
|
});
|
|
137
149
|
});
|
|
138
150
|
}
|
|
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
151
|
function parseHistory(datas, playgrounds) {
|
|
160
152
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
153
|
var result;
|
|
@@ -194,7 +186,7 @@ function parseHistory(datas, playgrounds) {
|
|
|
194
186
|
break;
|
|
195
187
|
}
|
|
196
188
|
var stake_amount = Number(drawEvent.stake_amount) / Math.pow(10, decimal);
|
|
197
|
-
var amount = stake_amount > 1000000 ? "".concat(stake_amount / 1000000, "m") : stake_amount;
|
|
189
|
+
var amount = stake_amount > 1000000 ? "".concat(stake_amount / 1000000, " m") : stake_amount;
|
|
198
190
|
var display = {
|
|
199
191
|
game_id: drawEvent.game_id,
|
|
200
192
|
player: drawEvent.player,
|
|
@@ -212,43 +204,6 @@ function parseHistory(datas, playgrounds) {
|
|
|
212
204
|
});
|
|
213
205
|
});
|
|
214
206
|
}
|
|
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
207
|
function getProfitSharing(provider, diceProfitSharing) {
|
|
253
208
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
209
|
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
|