@typus/typus-sdk 1.2.8 → 1.2.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.
|
@@ -5,4 +5,4 @@ export interface DrawResult {
|
|
|
5
5
|
result_2: string;
|
|
6
6
|
exp: string;
|
|
7
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[], sender?: string): Promise<DrawResult>;
|
|
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>;
|
|
@@ -43,9 +43,8 @@ exports.simulateGame = void 0;
|
|
|
43
43
|
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
|
-
var drawKeys_json_1 = __importDefault(require("../../drawKeys.json"));
|
|
47
46
|
var bls_signatures_1 = __importDefault(require("bls-signatures"));
|
|
48
|
-
function simulateGame(network, packageId, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2, sender) {
|
|
47
|
+
function simulateGame(network, packageId, registry, index, amount, guess_1, larger_than_1, guess_2, larger_than_2, vrf_input_1, vrf_input_2, drawKeys, sender) {
|
|
49
48
|
if (sender === void 0) { sender = "0xb6c7e3b1c61ee81516a8317f221daa035f1503e0ac3ae7a50b61834bc7a3ead9"; }
|
|
50
49
|
return __awaiter(this, void 0, void 0, function () {
|
|
51
50
|
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;
|
|
@@ -58,7 +57,7 @@ function simulateGame(network, packageId, registry, index, amount, guess_1, larg
|
|
|
58
57
|
return [4 /*yield*/, (0, bls_signatures_1.default)()];
|
|
59
58
|
case 1:
|
|
60
59
|
BLS = _a.sent();
|
|
61
|
-
PRIVATE_KEY = Uint8Array.from(
|
|
60
|
+
PRIVATE_KEY = Uint8Array.from(drawKeys[network][index]);
|
|
62
61
|
draw_private_key = BLS.PrivateKey.from_bytes(PRIVATE_KEY, true);
|
|
63
62
|
bls_signature_1 = BLS.BasicSchemeMPL.sign(draw_private_key, Uint8Array.from(vrf_input_1)).serialize();
|
|
64
63
|
bls_signature_2 = BLS.BasicSchemeMPL.sign(draw_private_key, Uint8Array.from(vrf_input_2)).serialize();
|
package/package.json
CHANGED
package/lib/drawKeys.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"testnet": {
|
|
3
|
-
"0": [
|
|
4
|
-
93, 132, 146, 197, 57, 202, 76, 226, 113, 152, 138, 226, 107, 104, 160, 161, 76, 148, 232, 122, 45, 151, 104, 149, 96, 50, 66,
|
|
5
|
-
12, 153, 151, 173, 26
|
|
6
|
-
],
|
|
7
|
-
"1": [
|
|
8
|
-
9, 192, 158, 189, 157, 42, 3, 15, 174, 56, 107, 243, 2, 186, 181, 127, 168, 208, 174, 73, 95, 155, 102, 39, 31, 29, 70, 157, 66,
|
|
9
|
-
126, 157, 9
|
|
10
|
-
],
|
|
11
|
-
"2": [
|
|
12
|
-
26, 70, 126, 242, 209, 221, 124, 49, 182, 47, 139, 38, 110, 110, 123, 174, 162, 143, 227, 230, 73, 115, 21, 100, 254, 121, 20,
|
|
13
|
-
23, 148, 230, 29, 59
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"mainnet": {
|
|
17
|
-
"0": [
|
|
18
|
-
10, 47, 42, 168, 27, 251, 153, 127, 134, 85, 136, 209, 37, 228, 74, 46, 104, 58, 1, 149, 30, 190, 84, 96, 234, 105, 189, 195,
|
|
19
|
-
229, 31, 206, 77
|
|
20
|
-
],
|
|
21
|
-
"1": [
|
|
22
|
-
16, 130, 107, 16, 145, 19, 201, 184, 83, 11, 126, 138, 151, 199, 58, 126, 115, 143, 135, 238, 251, 9, 42, 15, 19, 115, 48, 36,
|
|
23
|
-
30, 242, 186, 182
|
|
24
|
-
],
|
|
25
|
-
"2": [
|
|
26
|
-
15, 140, 142, 72, 98, 166, 126, 59, 253, 238, 222, 186, 158, 182, 245, 3, 196, 134, 177, 150, 129, 185, 47, 20, 45, 148, 107,
|
|
27
|
-
133, 167, 216, 42, 246
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
}
|