@rolly-dev/wasm-signer 1.5.0 → 1.5.1
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/js/browser.mjs +14 -12
- package/js/index.d.ts +14 -12
- package/js/node-inline.cjs +21 -19
- package/js/node-inline.mjs +14 -12
- package/js/node.cjs +21 -19
- package/js/node.mjs +14 -12
- package/js/react.mjs +35 -37
- package/package.json +1 -1
package/js/browser.mjs
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
export { default as init } from '../dist/web/rolly_wasm_signer.js';
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
amount_split,
|
|
5
|
+
compute_address_hash,
|
|
6
|
+
compute_multi_dice,
|
|
7
|
+
compute_payout_dice,
|
|
8
|
+
compute_payout_plinko,
|
|
9
|
+
compute_roll_dice,
|
|
10
|
+
compute_roll_plinko,
|
|
8
11
|
compute_server_seed_hash,
|
|
9
|
-
|
|
10
|
-
string_to_user_seed,
|
|
11
|
-
string_to_user_seed_hex,
|
|
12
|
+
derive_session_key,
|
|
12
13
|
generate_user_seed,
|
|
13
14
|
goldilocks_fields_to_hex,
|
|
14
15
|
goldilocks_modulus,
|
|
15
16
|
goldilocks_reduce,
|
|
16
|
-
amount_split,
|
|
17
|
-
compute_address_hash,
|
|
18
17
|
hash_balance_leaf,
|
|
19
18
|
make_main_leaf,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
poseidon2_hash,
|
|
20
|
+
poseidon2_two_to_one,
|
|
21
|
+
seed_hash_truncated,
|
|
22
|
+
session_public_key,
|
|
23
|
+
string_to_user_seed,
|
|
24
|
+
string_to_user_seed_hex,
|
|
23
25
|
} from '../dist/web/rolly_wasm_signer.js';
|
package/js/index.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
amount_split,
|
|
3
|
+
compute_address_hash,
|
|
4
|
+
compute_multi_dice,
|
|
5
|
+
compute_payout_dice,
|
|
6
|
+
compute_payout_plinko,
|
|
7
|
+
compute_roll_dice,
|
|
8
|
+
compute_roll_plinko,
|
|
6
9
|
compute_server_seed_hash,
|
|
7
|
-
|
|
8
|
-
string_to_user_seed,
|
|
9
|
-
string_to_user_seed_hex,
|
|
10
|
+
derive_session_key,
|
|
10
11
|
generate_user_seed,
|
|
11
12
|
goldilocks_fields_to_hex,
|
|
12
13
|
goldilocks_modulus,
|
|
13
14
|
goldilocks_reduce,
|
|
14
|
-
amount_split,
|
|
15
|
-
compute_address_hash,
|
|
16
15
|
hash_balance_leaf,
|
|
17
16
|
make_main_leaf,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
poseidon2_hash,
|
|
18
|
+
poseidon2_two_to_one,
|
|
19
|
+
seed_hash_truncated,
|
|
20
|
+
session_public_key,
|
|
21
|
+
string_to_user_seed,
|
|
22
|
+
string_to_user_seed_hex,
|
|
21
23
|
} from '../dist/node-inline/rolly_wasm_signer.js';
|
package/js/node-inline.cjs
CHANGED
|
@@ -3,23 +3,25 @@
|
|
|
3
3
|
const wasm = require('../dist/node-inline/rolly_wasm_signer.js');
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
amount_split: wasm.amount_split,
|
|
7
|
+
compute_address_hash: wasm.compute_address_hash,
|
|
8
|
+
compute_multi_dice: wasm.compute_multi_dice,
|
|
9
|
+
compute_payout_dice: wasm.compute_payout_dice,
|
|
10
|
+
compute_payout_plinko: wasm.compute_payout_plinko,
|
|
11
|
+
compute_roll_dice: wasm.compute_roll_dice,
|
|
12
|
+
compute_roll_plinko: wasm.compute_roll_plinko,
|
|
13
|
+
compute_server_seed_hash: wasm.compute_server_seed_hash,
|
|
14
|
+
derive_session_key: wasm.derive_session_key,
|
|
15
|
+
generate_user_seed: wasm.generate_user_seed,
|
|
16
|
+
goldilocks_fields_to_hex: wasm.goldilocks_fields_to_hex,
|
|
17
|
+
goldilocks_modulus: wasm.goldilocks_modulus,
|
|
18
|
+
goldilocks_reduce: wasm.goldilocks_reduce,
|
|
19
|
+
hash_balance_leaf: wasm.hash_balance_leaf,
|
|
20
|
+
make_main_leaf: wasm.make_main_leaf,
|
|
21
|
+
poseidon2_hash: wasm.poseidon2_hash,
|
|
22
|
+
poseidon2_two_to_one: wasm.poseidon2_two_to_one,
|
|
23
|
+
seed_hash_truncated: wasm.seed_hash_truncated,
|
|
24
|
+
session_public_key: wasm.session_public_key,
|
|
25
|
+
string_to_user_seed: wasm.string_to_user_seed,
|
|
26
|
+
string_to_user_seed_hex: wasm.string_to_user_seed_hex,
|
|
25
27
|
};
|
package/js/node-inline.mjs
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
amount_split,
|
|
3
|
+
compute_address_hash,
|
|
4
|
+
compute_multi_dice,
|
|
5
|
+
compute_payout_dice,
|
|
6
|
+
compute_payout_plinko,
|
|
7
|
+
compute_roll_dice,
|
|
8
|
+
compute_roll_plinko,
|
|
6
9
|
compute_server_seed_hash,
|
|
7
|
-
|
|
8
|
-
string_to_user_seed,
|
|
9
|
-
string_to_user_seed_hex,
|
|
10
|
+
derive_session_key,
|
|
10
11
|
generate_user_seed,
|
|
11
12
|
goldilocks_fields_to_hex,
|
|
12
13
|
goldilocks_modulus,
|
|
13
14
|
goldilocks_reduce,
|
|
14
|
-
amount_split,
|
|
15
|
-
compute_address_hash,
|
|
16
15
|
hash_balance_leaf,
|
|
17
16
|
make_main_leaf,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
poseidon2_hash,
|
|
18
|
+
poseidon2_two_to_one,
|
|
19
|
+
seed_hash_truncated,
|
|
20
|
+
session_public_key,
|
|
21
|
+
string_to_user_seed,
|
|
22
|
+
string_to_user_seed_hex,
|
|
21
23
|
} from '../dist/node-inline/rolly_wasm_signer.mjs';
|
package/js/node.cjs
CHANGED
|
@@ -3,23 +3,25 @@
|
|
|
3
3
|
const wasm = require('../dist/node/rolly_wasm_signer.js');
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
amount_split: wasm.amount_split,
|
|
7
|
+
compute_address_hash: wasm.compute_address_hash,
|
|
8
|
+
compute_multi_dice: wasm.compute_multi_dice,
|
|
9
|
+
compute_payout_dice: wasm.compute_payout_dice,
|
|
10
|
+
compute_payout_plinko: wasm.compute_payout_plinko,
|
|
11
|
+
compute_roll_dice: wasm.compute_roll_dice,
|
|
12
|
+
compute_roll_plinko: wasm.compute_roll_plinko,
|
|
13
|
+
compute_server_seed_hash: wasm.compute_server_seed_hash,
|
|
14
|
+
derive_session_key: wasm.derive_session_key,
|
|
15
|
+
generate_user_seed: wasm.generate_user_seed,
|
|
16
|
+
goldilocks_fields_to_hex: wasm.goldilocks_fields_to_hex,
|
|
17
|
+
goldilocks_modulus: wasm.goldilocks_modulus,
|
|
18
|
+
goldilocks_reduce: wasm.goldilocks_reduce,
|
|
19
|
+
hash_balance_leaf: wasm.hash_balance_leaf,
|
|
20
|
+
make_main_leaf: wasm.make_main_leaf,
|
|
21
|
+
poseidon2_hash: wasm.poseidon2_hash,
|
|
22
|
+
poseidon2_two_to_one: wasm.poseidon2_two_to_one,
|
|
23
|
+
seed_hash_truncated: wasm.seed_hash_truncated,
|
|
24
|
+
session_public_key: wasm.session_public_key,
|
|
25
|
+
string_to_user_seed: wasm.string_to_user_seed,
|
|
26
|
+
string_to_user_seed_hex: wasm.string_to_user_seed_hex,
|
|
25
27
|
};
|
package/js/node.mjs
CHANGED
|
@@ -4,23 +4,25 @@ const require = createRequire(import.meta.url);
|
|
|
4
4
|
const wasm = require('../dist/node/rolly_wasm_signer.js');
|
|
5
5
|
|
|
6
6
|
export const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
amount_split,
|
|
8
|
+
compute_address_hash,
|
|
9
|
+
compute_multi_dice,
|
|
10
|
+
compute_payout_dice,
|
|
11
|
+
compute_payout_plinko,
|
|
12
|
+
compute_roll_dice,
|
|
13
|
+
compute_roll_plinko,
|
|
11
14
|
compute_server_seed_hash,
|
|
12
|
-
|
|
13
|
-
string_to_user_seed,
|
|
14
|
-
string_to_user_seed_hex,
|
|
15
|
+
derive_session_key,
|
|
15
16
|
generate_user_seed,
|
|
16
17
|
goldilocks_fields_to_hex,
|
|
17
18
|
goldilocks_modulus,
|
|
18
19
|
goldilocks_reduce,
|
|
19
|
-
amount_split,
|
|
20
|
-
compute_address_hash,
|
|
21
20
|
hash_balance_leaf,
|
|
22
21
|
make_main_leaf,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
poseidon2_hash,
|
|
23
|
+
poseidon2_two_to_one,
|
|
24
|
+
seed_hash_truncated,
|
|
25
|
+
session_public_key,
|
|
26
|
+
string_to_user_seed,
|
|
27
|
+
string_to_user_seed_hex,
|
|
26
28
|
} = wasm;
|
package/js/react.mjs
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
2
|
import init, {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
amount_split,
|
|
4
|
+
compute_address_hash,
|
|
5
|
+
compute_multi_dice,
|
|
6
|
+
compute_payout_dice,
|
|
7
|
+
compute_payout_plinko,
|
|
8
|
+
compute_roll_dice,
|
|
9
|
+
compute_roll_plinko,
|
|
7
10
|
compute_server_seed_hash,
|
|
8
|
-
|
|
9
|
-
string_to_user_seed,
|
|
10
|
-
string_to_user_seed_hex,
|
|
11
|
+
derive_session_key,
|
|
11
12
|
generate_user_seed,
|
|
12
13
|
goldilocks_fields_to_hex,
|
|
13
14
|
goldilocks_modulus,
|
|
14
15
|
goldilocks_reduce,
|
|
15
|
-
amount_split,
|
|
16
|
-
compute_address_hash,
|
|
17
16
|
hash_balance_leaf,
|
|
18
17
|
make_main_leaf,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
poseidon2_hash,
|
|
19
|
+
poseidon2_two_to_one,
|
|
20
|
+
seed_hash_truncated,
|
|
21
|
+
session_public_key,
|
|
22
|
+
string_to_user_seed,
|
|
23
|
+
string_to_user_seed_hex,
|
|
22
24
|
} from '../dist/web/rolly_wasm_signer.js';
|
|
23
25
|
|
|
24
26
|
let _ready = false;
|
|
@@ -32,25 +34,27 @@ function guard(fn) {
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
const fns = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
amount_split: guard(amount_split),
|
|
38
|
+
compute_address_hash: guard(compute_address_hash),
|
|
39
|
+
compute_multi_dice: guard(compute_multi_dice),
|
|
40
|
+
compute_payout_dice: guard(compute_payout_dice),
|
|
41
|
+
compute_payout_plinko: guard(compute_payout_plinko),
|
|
42
|
+
compute_roll_dice: guard(compute_roll_dice),
|
|
43
|
+
compute_roll_plinko: guard(compute_roll_plinko),
|
|
44
|
+
compute_server_seed_hash: guard(compute_server_seed_hash),
|
|
45
|
+
derive_session_key: guard(derive_session_key),
|
|
46
|
+
generate_user_seed: guard(generate_user_seed),
|
|
47
|
+
goldilocks_fields_to_hex: guard(goldilocks_fields_to_hex),
|
|
48
|
+
goldilocks_modulus: guard(goldilocks_modulus),
|
|
49
|
+
goldilocks_reduce: guard(goldilocks_reduce),
|
|
50
|
+
hash_balance_leaf: guard(hash_balance_leaf),
|
|
51
|
+
make_main_leaf: guard(make_main_leaf),
|
|
52
|
+
poseidon2_hash: guard(poseidon2_hash),
|
|
53
|
+
poseidon2_two_to_one: guard(poseidon2_two_to_one),
|
|
54
|
+
seed_hash_truncated: guard(seed_hash_truncated),
|
|
55
|
+
session_public_key: guard(session_public_key),
|
|
56
|
+
string_to_user_seed: guard(string_to_user_seed),
|
|
57
|
+
string_to_user_seed_hex: guard(string_to_user_seed_hex),
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
/**
|
|
@@ -58,12 +62,6 @@ const fns = {
|
|
|
58
62
|
* returns `{ ready, error, ...wasmFunctions }`.
|
|
59
63
|
*
|
|
60
64
|
* Functions are always available but will throw if called before `ready === true`.
|
|
61
|
-
*
|
|
62
|
-
* ```jsx
|
|
63
|
-
* const { ready, poseidon2_hash } = useRollyWasm();
|
|
64
|
-
* if (!ready) return <Spinner />;
|
|
65
|
-
* const h = poseidon2_hash(BigUint64Array.from([1n, 2n]));
|
|
66
|
-
* ```
|
|
67
65
|
*/
|
|
68
66
|
export function useRollyWasm() {
|
|
69
67
|
const [ready, setReady] = useState(_ready);
|