@rolly-dev/wasm-signer 1.13.0 → 1.15.0

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.
@@ -2,6 +2,8 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const amount_split: (a: number, b: bigint) => void;
5
+ export const coinflip_multiplier_x10000: () => number;
6
+ export const coinflip_rtp_percent: () => number;
5
7
  export const compute_address_hash: (a: number, b: number, c: number) => void;
6
8
  export const compute_drawn_keno: (a: number, b: number, c: number) => void;
7
9
  export const compute_multi_dice: (a: number) => bigint;
@@ -31,6 +33,8 @@ export const seed_hash_truncated: (a: number, b: number, c: number) => void;
31
33
  export const session_public_key: (a: number, b: number, c: number, d: bigint) => void;
32
34
  export const string_to_user_seed: (a: number, b: number, c: number) => void;
33
35
  export const string_to_user_seed_hex: (a: number, b: number, c: number) => void;
36
+ export const dice_rtp_percent: () => number;
37
+ export const limbo_rtp_percent: () => number;
34
38
  export const goldilocks_modulus: () => bigint;
35
39
  export const __wbindgen_export: (a: number) => void;
36
40
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
@@ -12,6 +12,16 @@
12
12
  */
13
13
  export function amount_split(amount: bigint): Uint32Array;
14
14
 
15
+ /**
16
+ * CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
17
+ */
18
+ export function coinflip_multiplier_x10000(): number;
19
+
20
+ /**
21
+ * CoinFlip RTP percent (99). Canonical source for backend/frontend.
22
+ */
23
+ export function coinflip_rtp_percent(): number;
24
+
15
25
  /**
16
26
  * Compute address_hash = Poseidon2(addr_byte_0, ..., addr_byte_19).
17
27
  * Takes a hex address string (with or without 0x prefix), returns [u64; 4].
@@ -193,6 +203,11 @@ export function compute_user_seed_binding(game_id: number, bet: bigint, pred_has
193
203
  */
194
204
  export function derive_session_key(sig_bytes: Uint8Array): BigUint64Array;
195
205
 
206
+ /**
207
+ * Dice RTP percent (99). Canonical source for backend/frontend.
208
+ */
209
+ export function dice_rtp_percent(): number;
210
+
196
211
  /**
197
212
  * Generate a cryptographically random user secret — 4 Goldilocks field elements.
198
213
  *
@@ -261,6 +276,11 @@ export function goldilocks_reduce(value: bigint): bigint;
261
276
  */
262
277
  export function hash_balance_leaf(raw: BigUint64Array): BigUint64Array;
263
278
 
279
+ /**
280
+ * Limbo RTP percent (99). Canonical source for backend/frontend.
281
+ */
282
+ export function limbo_rtp_percent(): number;
283
+
264
284
  /**
265
285
  * Build a main Merkle tree leaf from balance_hash, pk_hash, and address_hash.
266
286
  *
@@ -363,6 +383,8 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
363
383
  export interface InitOutput {
364
384
  readonly memory: WebAssembly.Memory;
365
385
  readonly amount_split: (a: number, b: bigint) => void;
386
+ readonly coinflip_multiplier_x10000: () => number;
387
+ readonly coinflip_rtp_percent: () => number;
366
388
  readonly compute_address_hash: (a: number, b: number, c: number) => void;
367
389
  readonly compute_drawn_keno: (a: number, b: number, c: number) => void;
368
390
  readonly compute_multi_dice: (a: number) => bigint;
@@ -392,6 +414,8 @@ export interface InitOutput {
392
414
  readonly session_public_key: (a: number, b: number, c: number, d: bigint) => void;
393
415
  readonly string_to_user_seed: (a: number, b: number, c: number) => void;
394
416
  readonly string_to_user_seed_hex: (a: number, b: number, c: number) => void;
417
+ readonly dice_rtp_percent: () => number;
418
+ readonly limbo_rtp_percent: () => number;
395
419
  readonly goldilocks_modulus: () => bigint;
396
420
  readonly __wbindgen_export: (a: number) => void;
397
421
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
@@ -25,6 +25,24 @@ export function amount_split(amount) {
25
25
  }
26
26
  }
27
27
 
28
+ /**
29
+ * CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
30
+ * @returns {number}
31
+ */
32
+ export function coinflip_multiplier_x10000() {
33
+ const ret = wasm.coinflip_multiplier_x10000();
34
+ return ret >>> 0;
35
+ }
36
+
37
+ /**
38
+ * CoinFlip RTP percent (99). Canonical source for backend/frontend.
39
+ * @returns {number}
40
+ */
41
+ export function coinflip_rtp_percent() {
42
+ const ret = wasm.coinflip_rtp_percent();
43
+ return ret >>> 0;
44
+ }
45
+
28
46
  /**
29
47
  * Compute address_hash = Poseidon2(addr_byte_0, ..., addr_byte_19).
30
48
  * Takes a hex address string (with or without 0x prefix), returns [u64; 4].
@@ -458,6 +476,15 @@ export function derive_session_key(sig_bytes) {
458
476
  }
459
477
  }
460
478
 
479
+ /**
480
+ * Dice RTP percent (99). Canonical source for backend/frontend.
481
+ * @returns {number}
482
+ */
483
+ export function dice_rtp_percent() {
484
+ const ret = wasm.coinflip_rtp_percent();
485
+ return ret >>> 0;
486
+ }
487
+
461
488
  /**
462
489
  * Generate a cryptographically random user secret — 4 Goldilocks field elements.
463
490
  *
@@ -599,6 +626,15 @@ export function hash_balance_leaf(raw) {
599
626
  }
600
627
  }
601
628
 
629
+ /**
630
+ * Limbo RTP percent (99). Canonical source for backend/frontend.
631
+ * @returns {number}
632
+ */
633
+ export function limbo_rtp_percent() {
634
+ const ret = wasm.coinflip_rtp_percent();
635
+ return ret >>> 0;
636
+ }
637
+
602
638
  /**
603
639
  * Build a main Merkle tree leaf from balance_hash, pk_hash, and address_hash.
604
640
  *
Binary file
@@ -2,6 +2,8 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const amount_split: (a: number, b: bigint) => void;
5
+ export const coinflip_multiplier_x10000: () => number;
6
+ export const coinflip_rtp_percent: () => number;
5
7
  export const compute_address_hash: (a: number, b: number, c: number) => void;
6
8
  export const compute_drawn_keno: (a: number, b: number, c: number) => void;
7
9
  export const compute_multi_dice: (a: number) => bigint;
@@ -31,6 +33,8 @@ export const seed_hash_truncated: (a: number, b: number, c: number) => void;
31
33
  export const session_public_key: (a: number, b: number, c: number, d: bigint) => void;
32
34
  export const string_to_user_seed: (a: number, b: number, c: number) => void;
33
35
  export const string_to_user_seed_hex: (a: number, b: number, c: number) => void;
36
+ export const dice_rtp_percent: () => number;
37
+ export const limbo_rtp_percent: () => number;
34
38
  export const goldilocks_modulus: () => bigint;
35
39
  export const __wbindgen_export: (a: number) => void;
36
40
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
package/js/browser.mjs CHANGED
@@ -2,6 +2,8 @@ export { default as init } from '../dist/web/rolly_wasm_signer.js';
2
2
 
3
3
  export {
4
4
  amount_split,
5
+ coinflip_multiplier_x10000,
6
+ coinflip_rtp_percent,
5
7
  compute_address_hash,
6
8
  compute_drawn_keno,
7
9
  compute_multi_dice,
@@ -19,12 +21,14 @@ export {
19
21
  compute_server_seed_hash,
20
22
  compute_user_seed_binding,
21
23
  derive_session_key,
24
+ dice_rtp_percent,
22
25
  generate_user_secret,
23
26
  generate_user_seed,
24
27
  goldilocks_fields_to_hex,
25
28
  goldilocks_modulus,
26
29
  goldilocks_reduce,
27
30
  hash_balance_leaf,
31
+ limbo_rtp_percent,
28
32
  make_main_leaf,
29
33
  poseidon2_hash,
30
34
  poseidon2_two_to_one,
package/js/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export {
2
2
  amount_split,
3
+ coinflip_multiplier_x10000,
4
+ coinflip_rtp_percent,
3
5
  compute_address_hash,
4
6
  compute_drawn_keno,
5
7
  compute_multi_dice,
@@ -17,12 +19,14 @@ export {
17
19
  compute_server_seed_hash,
18
20
  compute_user_seed_binding,
19
21
  derive_session_key,
22
+ dice_rtp_percent,
20
23
  generate_user_secret,
21
24
  generate_user_seed,
22
25
  goldilocks_fields_to_hex,
23
26
  goldilocks_modulus,
24
27
  goldilocks_reduce,
25
28
  hash_balance_leaf,
29
+ limbo_rtp_percent,
26
30
  make_main_leaf,
27
31
  poseidon2_hash,
28
32
  poseidon2_two_to_one,
@@ -4,6 +4,8 @@ const wasm = require('../dist/node-inline/rolly_wasm_signer.js');
4
4
 
5
5
  module.exports = {
6
6
  amount_split: wasm.amount_split,
7
+ coinflip_multiplier_x10000: wasm.coinflip_multiplier_x10000,
8
+ coinflip_rtp_percent: wasm.coinflip_rtp_percent,
7
9
  compute_address_hash: wasm.compute_address_hash,
8
10
  compute_drawn_keno: wasm.compute_drawn_keno,
9
11
  compute_multi_dice: wasm.compute_multi_dice,
@@ -21,12 +23,14 @@ module.exports = {
21
23
  compute_server_seed_hash: wasm.compute_server_seed_hash,
22
24
  compute_user_seed_binding: wasm.compute_user_seed_binding,
23
25
  derive_session_key: wasm.derive_session_key,
26
+ dice_rtp_percent: wasm.dice_rtp_percent,
24
27
  generate_user_secret: wasm.generate_user_secret,
25
28
  generate_user_seed: wasm.generate_user_seed,
26
29
  goldilocks_fields_to_hex: wasm.goldilocks_fields_to_hex,
27
30
  goldilocks_modulus: wasm.goldilocks_modulus,
28
31
  goldilocks_reduce: wasm.goldilocks_reduce,
29
32
  hash_balance_leaf: wasm.hash_balance_leaf,
33
+ limbo_rtp_percent: wasm.limbo_rtp_percent,
30
34
  make_main_leaf: wasm.make_main_leaf,
31
35
  poseidon2_hash: wasm.poseidon2_hash,
32
36
  poseidon2_two_to_one: wasm.poseidon2_two_to_one,
@@ -1,5 +1,7 @@
1
1
  export {
2
2
  amount_split,
3
+ coinflip_multiplier_x10000,
4
+ coinflip_rtp_percent,
3
5
  compute_address_hash,
4
6
  compute_drawn_keno,
5
7
  compute_multi_dice,
@@ -17,12 +19,14 @@ export {
17
19
  compute_server_seed_hash,
18
20
  compute_user_seed_binding,
19
21
  derive_session_key,
22
+ dice_rtp_percent,
20
23
  generate_user_secret,
21
24
  generate_user_seed,
22
25
  goldilocks_fields_to_hex,
23
26
  goldilocks_modulus,
24
27
  goldilocks_reduce,
25
28
  hash_balance_leaf,
29
+ limbo_rtp_percent,
26
30
  make_main_leaf,
27
31
  poseidon2_hash,
28
32
  poseidon2_two_to_one,
package/js/node.cjs CHANGED
@@ -4,6 +4,8 @@ const wasm = require('../dist/node/rolly_wasm_signer.js');
4
4
 
5
5
  module.exports = {
6
6
  amount_split: wasm.amount_split,
7
+ coinflip_multiplier_x10000: wasm.coinflip_multiplier_x10000,
8
+ coinflip_rtp_percent: wasm.coinflip_rtp_percent,
7
9
  compute_address_hash: wasm.compute_address_hash,
8
10
  compute_drawn_keno: wasm.compute_drawn_keno,
9
11
  compute_multi_dice: wasm.compute_multi_dice,
@@ -21,12 +23,14 @@ module.exports = {
21
23
  compute_server_seed_hash: wasm.compute_server_seed_hash,
22
24
  compute_user_seed_binding: wasm.compute_user_seed_binding,
23
25
  derive_session_key: wasm.derive_session_key,
26
+ dice_rtp_percent: wasm.dice_rtp_percent,
24
27
  generate_user_secret: wasm.generate_user_secret,
25
28
  generate_user_seed: wasm.generate_user_seed,
26
29
  goldilocks_fields_to_hex: wasm.goldilocks_fields_to_hex,
27
30
  goldilocks_modulus: wasm.goldilocks_modulus,
28
31
  goldilocks_reduce: wasm.goldilocks_reduce,
29
32
  hash_balance_leaf: wasm.hash_balance_leaf,
33
+ limbo_rtp_percent: wasm.limbo_rtp_percent,
30
34
  make_main_leaf: wasm.make_main_leaf,
31
35
  poseidon2_hash: wasm.poseidon2_hash,
32
36
  poseidon2_two_to_one: wasm.poseidon2_two_to_one,
package/js/node.mjs CHANGED
@@ -5,6 +5,8 @@ const wasm = require('../dist/node/rolly_wasm_signer.js');
5
5
 
6
6
  export const {
7
7
  amount_split,
8
+ coinflip_multiplier_x10000,
9
+ coinflip_rtp_percent,
8
10
  compute_address_hash,
9
11
  compute_drawn_keno,
10
12
  compute_multi_dice,
@@ -22,12 +24,14 @@ export const {
22
24
  compute_server_seed_hash,
23
25
  compute_user_seed_binding,
24
26
  derive_session_key,
27
+ dice_rtp_percent,
25
28
  generate_user_secret,
26
29
  generate_user_seed,
27
30
  goldilocks_fields_to_hex,
28
31
  goldilocks_modulus,
29
32
  goldilocks_reduce,
30
33
  hash_balance_leaf,
34
+ limbo_rtp_percent,
31
35
  make_main_leaf,
32
36
  poseidon2_hash,
33
37
  poseidon2_two_to_one,
package/js/react.d.mts CHANGED
@@ -1,25 +1,41 @@
1
1
  export interface RollyWasmResult {
2
2
  ready: boolean;
3
3
  error: Error | null;
4
- poseidon2_hash: (input: BigUint64Array) => BigUint64Array;
5
- poseidon2_two_to_one: (left: BigUint64Array, right: BigUint64Array) => BigUint64Array;
6
- derive_session_key: (sig_bytes: Uint8Array) => BigUint64Array;
7
- session_public_key: (session_key: BigUint64Array, session_expiry: bigint) => BigUint64Array;
8
- compute_server_seed_hash: (server_seed: BigUint64Array) => BigUint64Array;
9
- seed_hash_truncated: (server_seed: BigUint64Array) => BigUint64Array;
10
- string_to_user_seed: (input: string) => BigUint64Array;
11
- string_to_user_seed_hex: (input: string) => string;
12
- generate_user_seed: () => string;
13
- goldilocks_fields_to_hex: (fields: BigUint64Array) => string;
14
- goldilocks_modulus: () => bigint;
15
- goldilocks_reduce: (value: bigint) => bigint;
16
- amount_split: (amount: bigint) => Uint32Array;
17
- compute_address_hash: (address_hex: string) => BigUint64Array;
18
- hash_balance_leaf: (raw: BigUint64Array) => BigUint64Array;
19
- make_main_leaf: (balance_hash: BigUint64Array, pk_hash: BigUint64Array, address_hash: BigUint64Array) => BigUint64Array;
20
- compute_payout_dice: (random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number) => BigUint64Array;
21
- compute_roll_dice: (random: BigUint64Array) => number;
22
- compute_multi_dice: (win_numbers: number) => bigint;
4
+ poseidon2_hash: (input: BigUint64Array) => BigUint64Array;
5
+ poseidon2_two_to_one: (left: BigUint64Array, right: BigUint64Array) => BigUint64Array;
6
+ derive_session_key: (sig_bytes: Uint8Array) => BigUint64Array;
7
+ session_public_key: (session_key: BigUint64Array, session_expiry: bigint) => BigUint64Array;
8
+ compute_server_seed_hash: (server_seed: BigUint64Array) => BigUint64Array;
9
+ seed_hash_truncated: (server_seed: BigUint64Array) => BigUint64Array;
10
+ string_to_user_seed: (input: string) => BigUint64Array;
11
+ string_to_user_seed_hex: (input: string) => string;
12
+ generate_user_seed: () => string;
13
+ goldilocks_fields_to_hex: (fields: BigUint64Array) => string;
14
+ goldilocks_modulus: () => bigint;
15
+ goldilocks_reduce: (value: bigint) => bigint;
16
+ amount_split: (amount: bigint) => Uint32Array;
17
+ compute_address_hash: (address_hex: string) => BigUint64Array;
18
+ hash_balance_leaf: (raw: BigUint64Array) => BigUint64Array;
19
+ make_main_leaf: (balance_hash: BigUint64Array, pk_hash: BigUint64Array, address_hash: BigUint64Array) => BigUint64Array;
20
+ compute_prediction_hash: (game_id: number, p0: number, p1: number, p2: number) => BigUint64Array;
21
+ compute_prediction_hash_keno: (game_id: number, risk: number, pick_count: number, selected: Uint8Array) => BigUint64Array;
22
+ compute_user_seed_binding: (game_id: number, bet: bigint, pred_hash: BigUint64Array, secret: BigUint64Array) => BigUint64Array;
23
+ generate_user_secret: () => BigUint64Array;
24
+ compute_payout_dice: (random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number) => BigUint64Array;
25
+ compute_payout_limbo: (random: BigUint64Array, bet_atomic: bigint, prediction_x100: number) => BigUint64Array;
26
+ compute_payout_plinko: (random: BigUint64Array, bet_atomic: bigint, sector: number, rows: number, is_extreme: boolean) => BigUint64Array;
27
+ compute_payout_coinflip: (random: BigUint64Array, bet_atomic: bigint, prediction: number) => BigUint64Array;
28
+ compute_payout_keno: (random: BigUint64Array, bet_atomic: bigint, risk: number, selected: Uint8Array) => BigUint64Array;
29
+ compute_roll_dice: (random: BigUint64Array) => number;
30
+ compute_roll_limbo: (random: BigUint64Array) => number;
31
+ compute_roll_plinko: (random: BigUint64Array, rows: number) => number;
32
+ compute_roll_coinflip: (random: BigUint64Array) => number;
33
+ compute_drawn_keno: (random: BigUint64Array) => Uint8Array;
34
+ compute_multi_dice: (win_numbers: number) => bigint;
35
+ limbo_rtp_percent: () => number;
36
+ coinflip_rtp_percent: () => number;
37
+ coinflip_multiplier_x10000: () => number;
38
+ dice_rtp_percent: () => number;
23
39
  }
24
40
 
25
41
  export function useRollyWasm(): RollyWasmResult;
package/js/react.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import init, {
3
3
  amount_split,
4
+ coinflip_multiplier_x10000,
5
+ coinflip_rtp_percent,
4
6
  compute_address_hash,
5
7
  compute_drawn_keno,
6
8
  compute_multi_dice,
@@ -18,12 +20,14 @@ import init, {
18
20
  compute_server_seed_hash,
19
21
  compute_user_seed_binding,
20
22
  derive_session_key,
23
+ dice_rtp_percent,
21
24
  generate_user_secret,
22
25
  generate_user_seed,
23
26
  goldilocks_fields_to_hex,
24
27
  goldilocks_modulus,
25
28
  goldilocks_reduce,
26
29
  hash_balance_leaf,
30
+ limbo_rtp_percent,
27
31
  make_main_leaf,
28
32
  poseidon2_hash,
29
33
  poseidon2_two_to_one,
@@ -45,6 +49,8 @@ function guard(fn) {
45
49
 
46
50
  const fns = {
47
51
  amount_split: guard(amount_split),
52
+ coinflip_multiplier_x10000: guard(coinflip_multiplier_x10000),
53
+ coinflip_rtp_percent: guard(coinflip_rtp_percent),
48
54
  compute_address_hash: guard(compute_address_hash),
49
55
  compute_drawn_keno: guard(compute_drawn_keno),
50
56
  compute_multi_dice: guard(compute_multi_dice),
@@ -62,12 +68,14 @@ const fns = {
62
68
  compute_server_seed_hash: guard(compute_server_seed_hash),
63
69
  compute_user_seed_binding: guard(compute_user_seed_binding),
64
70
  derive_session_key: guard(derive_session_key),
71
+ dice_rtp_percent: guard(dice_rtp_percent),
65
72
  generate_user_secret: guard(generate_user_secret),
66
73
  generate_user_seed: guard(generate_user_seed),
67
74
  goldilocks_fields_to_hex: guard(goldilocks_fields_to_hex),
68
75
  goldilocks_modulus: guard(goldilocks_modulus),
69
76
  goldilocks_reduce: guard(goldilocks_reduce),
70
77
  hash_balance_leaf: guard(hash_balance_leaf),
78
+ limbo_rtp_percent: guard(limbo_rtp_percent),
71
79
  make_main_leaf: guard(make_main_leaf),
72
80
  poseidon2_hash: guard(poseidon2_hash),
73
81
  poseidon2_two_to_one: guard(poseidon2_two_to_one),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolly-dev/wasm-signer",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "Poseidon2 hashing & bet signing for Rolly ZK-Rollup (WASM, Goldilocks field)",
5
5
  "type": "module",
6
6
  "exports": {