@rolly-dev/wasm-signer 1.18.0 → 1.19.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.
@@ -27,17 +27,21 @@ export const generate_user_seed: (a: number) => void;
27
27
  export const goldilocks_fields_to_hex: (a: number, b: number, c: number) => void;
28
28
  export const goldilocks_reduce: (a: bigint) => bigint;
29
29
  export const hash_balance_leaf: (a: number, b: number, c: number) => void;
30
+ export const keno_all_rtp_x100: () => number;
30
31
  export const keno_draw_count: () => number;
31
32
  export const keno_is_valid_config: (a: number, b: number) => number;
32
33
  export const keno_multiplier_table: (a: number, b: number, c: number) => void;
33
34
  export const keno_numbers_range: () => number;
35
+ export const keno_rtp_x100: (a: number, b: number) => bigint;
34
36
  export const make_main_leaf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
37
+ export const plinko_all_rtp_x100: () => number;
35
38
  export const plinko_is_valid_config: (a: number, b: number, c: number) => number;
36
39
  export const plinko_is_valid_rows: (a: number) => number;
37
40
  export const plinko_max_rows: () => number;
38
41
  export const plinko_min_rows: () => number;
39
42
  export const plinko_multiplier_table: (a: number, b: number, c: number, d: number) => void;
40
43
  export const plinko_num_sectors: () => number;
44
+ export const plinko_rtp_x100: (a: number, b: number, c: number) => bigint;
41
45
  export const poseidon2_hash: (a: number, b: number, c: number) => void;
42
46
  export const poseidon2_two_to_one: (a: number, b: number, c: number, d: number, e: number) => void;
43
47
  export const seed_hash_truncated: (a: number, b: number, c: number) => void;
@@ -285,6 +285,13 @@ export function goldilocks_reduce(value: bigint): bigint;
285
285
  */
286
286
  export function hash_balance_leaf(raw: BigUint64Array): BigUint64Array;
287
287
 
288
+ /**
289
+ * RTP × 100 for ALL valid Keno configs.
290
+ * Returns JS object: `{ "0_1": 9450, "0_2": 9712, ..., "2_10": 9580 }`
291
+ * Keys: `"{risk}_{pick_count}"`.
292
+ */
293
+ export function keno_all_rtp_x100(): any;
294
+
288
295
  export function keno_draw_count(): number;
289
296
 
290
297
  /**
@@ -303,6 +310,11 @@ export function keno_multiplier_table(risk: number, pick_count: number): BigUint
303
310
 
304
311
  export function keno_numbers_range(): number;
305
312
 
313
+ /**
314
+ * RTP × 100 for a Keno config (e.g. 9800 = 98.00%). Returns 0 for invalid combos.
315
+ */
316
+ export function keno_rtp_x100(risk: number, pick_count: number): bigint;
317
+
306
318
  /**
307
319
  * Limbo RTP percent (99). Canonical source for backend/frontend.
308
320
  */
@@ -326,6 +338,12 @@ export function limbo_rtp_percent(): number;
326
338
  */
327
339
  export function make_main_leaf(balance_hash: BigUint64Array, pk_hash: BigUint64Array, address_hash: BigUint64Array): BigUint64Array;
328
340
 
341
+ /**
342
+ * RTP × 100 for ALL valid Plinko configs.
343
+ * Returns JS object: `{ "0_8_normal": 9799, "1_12_extreme": 9881, ... }`
344
+ */
345
+ export function plinko_all_rtp_x100(): any;
346
+
329
347
  /**
330
348
  * Whether a (sector, rows, is_extreme) triple is a valid Plinko config.
331
349
  */
@@ -348,6 +366,11 @@ export function plinko_multiplier_table(sector: number, rows: number, is_extreme
348
366
 
349
367
  export function plinko_num_sectors(): number;
350
368
 
369
+ /**
370
+ * RTP × 100 for a Plinko config (e.g. 9799 = 97.99%). Returns 0 for invalid combos.
371
+ */
372
+ export function plinko_rtp_x100(sector: number, rows: number, is_extreme: boolean): bigint;
373
+
351
374
  /**
352
375
  * Poseidon2 hash of an arbitrary number of Goldilocks field elements.
353
376
  *
@@ -457,17 +480,21 @@ export interface InitOutput {
457
480
  readonly goldilocks_fields_to_hex: (a: number, b: number, c: number) => void;
458
481
  readonly goldilocks_reduce: (a: bigint) => bigint;
459
482
  readonly hash_balance_leaf: (a: number, b: number, c: number) => void;
483
+ readonly keno_all_rtp_x100: () => number;
460
484
  readonly keno_draw_count: () => number;
461
485
  readonly keno_is_valid_config: (a: number, b: number) => number;
462
486
  readonly keno_multiplier_table: (a: number, b: number, c: number) => void;
463
487
  readonly keno_numbers_range: () => number;
488
+ readonly keno_rtp_x100: (a: number, b: number) => bigint;
464
489
  readonly make_main_leaf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
490
+ readonly plinko_all_rtp_x100: () => number;
465
491
  readonly plinko_is_valid_config: (a: number, b: number, c: number) => number;
466
492
  readonly plinko_is_valid_rows: (a: number) => number;
467
493
  readonly plinko_max_rows: () => number;
468
494
  readonly plinko_min_rows: () => number;
469
495
  readonly plinko_multiplier_table: (a: number, b: number, c: number, d: number) => void;
470
496
  readonly plinko_num_sectors: () => number;
497
+ readonly plinko_rtp_x100: (a: number, b: number, c: number) => bigint;
471
498
  readonly poseidon2_hash: (a: number, b: number, c: number) => void;
472
499
  readonly poseidon2_two_to_one: (a: number, b: number, c: number, d: number, e: number) => void;
473
500
  readonly seed_hash_truncated: (a: number, b: number, c: number) => void;
@@ -651,6 +651,17 @@ export function hash_balance_leaf(raw) {
651
651
  }
652
652
  }
653
653
 
654
+ /**
655
+ * RTP × 100 for ALL valid Keno configs.
656
+ * Returns JS object: `{ "0_1": 9450, "0_2": 9712, ..., "2_10": 9580 }`
657
+ * Keys: `"{risk}_{pick_count}"`.
658
+ * @returns {any}
659
+ */
660
+ export function keno_all_rtp_x100() {
661
+ const ret = wasm.keno_all_rtp_x100();
662
+ return takeObject(ret);
663
+ }
664
+
654
665
  /**
655
666
  * @returns {number}
656
667
  */
@@ -708,6 +719,17 @@ export function keno_numbers_range() {
708
719
  return ret >>> 0;
709
720
  }
710
721
 
722
+ /**
723
+ * RTP × 100 for a Keno config (e.g. 9800 = 98.00%). Returns 0 for invalid combos.
724
+ * @param {number} risk
725
+ * @param {number} pick_count
726
+ * @returns {bigint}
727
+ */
728
+ export function keno_rtp_x100(risk, pick_count) {
729
+ const ret = wasm.keno_rtp_x100(risk, pick_count);
730
+ return BigInt.asUintN(64, ret);
731
+ }
732
+
711
733
  /**
712
734
  * Limbo RTP percent (99). Canonical source for backend/frontend.
713
735
  * @returns {number}
@@ -757,6 +779,16 @@ export function make_main_leaf(balance_hash, pk_hash, address_hash) {
757
779
  }
758
780
  }
759
781
 
782
+ /**
783
+ * RTP × 100 for ALL valid Plinko configs.
784
+ * Returns JS object: `{ "0_8_normal": 9799, "1_12_extreme": 9881, ... }`
785
+ * @returns {any}
786
+ */
787
+ export function plinko_all_rtp_x100() {
788
+ const ret = wasm.plinko_all_rtp_x100();
789
+ return takeObject(ret);
790
+ }
791
+
760
792
  /**
761
793
  * Whether a (sector, rows, is_extreme) triple is a valid Plinko config.
762
794
  * @param {number} sector
@@ -825,6 +857,18 @@ export function plinko_num_sectors() {
825
857
  return ret;
826
858
  }
827
859
 
860
+ /**
861
+ * RTP × 100 for a Plinko config (e.g. 9799 = 97.99%). Returns 0 for invalid combos.
862
+ * @param {number} sector
863
+ * @param {number} rows
864
+ * @param {boolean} is_extreme
865
+ * @returns {bigint}
866
+ */
867
+ export function plinko_rtp_x100(sector, rows, is_extreme) {
868
+ const ret = wasm.plinko_rtp_x100(sector, rows, is_extreme);
869
+ return BigInt.asUintN(64, ret);
870
+ }
871
+
828
872
  /**
829
873
  * Poseidon2 hash of an arbitrary number of Goldilocks field elements.
830
874
  *
@@ -1053,6 +1097,10 @@ function __wbg_get_imports() {
1053
1097
  const ret = getObject(arg0).msCrypto;
1054
1098
  return addHeapObject(ret);
1055
1099
  },
1100
+ __wbg_new_361308b2356cecd0: function() {
1101
+ const ret = new Object();
1102
+ return addHeapObject(ret);
1103
+ },
1056
1104
  __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
1057
1105
  const ret = new Function(getStringFromWasm0(arg0, arg1));
1058
1106
  return addHeapObject(ret);
@@ -1079,6 +1127,10 @@ function __wbg_get_imports() {
1079
1127
  const ret = module.require;
1080
1128
  return addHeapObject(ret);
1081
1129
  }, arguments); },
1130
+ __wbg_set_6cb8631f80447a67: function() { return handleError(function (arg0, arg1, arg2) {
1131
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1132
+ return ret;
1133
+ }, arguments); },
1082
1134
  __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
1083
1135
  const ret = typeof global === 'undefined' ? null : global;
1084
1136
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
@@ -1113,6 +1165,11 @@ function __wbg_get_imports() {
1113
1165
  const ret = getStringFromWasm0(arg0, arg1);
1114
1166
  return addHeapObject(ret);
1115
1167
  },
1168
+ __wbindgen_cast_0000000000000003: function(arg0) {
1169
+ // Cast intrinsic for `U64 -> Externref`.
1170
+ const ret = BigInt.asUintN(64, arg0);
1171
+ return addHeapObject(ret);
1172
+ },
1116
1173
  __wbindgen_object_clone_ref: function(arg0) {
1117
1174
  const ret = getObject(arg0);
1118
1175
  return addHeapObject(ret);
Binary file
@@ -27,17 +27,21 @@ export const generate_user_seed: (a: number) => void;
27
27
  export const goldilocks_fields_to_hex: (a: number, b: number, c: number) => void;
28
28
  export const goldilocks_reduce: (a: bigint) => bigint;
29
29
  export const hash_balance_leaf: (a: number, b: number, c: number) => void;
30
+ export const keno_all_rtp_x100: () => number;
30
31
  export const keno_draw_count: () => number;
31
32
  export const keno_is_valid_config: (a: number, b: number) => number;
32
33
  export const keno_multiplier_table: (a: number, b: number, c: number) => void;
33
34
  export const keno_numbers_range: () => number;
35
+ export const keno_rtp_x100: (a: number, b: number) => bigint;
34
36
  export const make_main_leaf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
37
+ export const plinko_all_rtp_x100: () => number;
35
38
  export const plinko_is_valid_config: (a: number, b: number, c: number) => number;
36
39
  export const plinko_is_valid_rows: (a: number) => number;
37
40
  export const plinko_max_rows: () => number;
38
41
  export const plinko_min_rows: () => number;
39
42
  export const plinko_multiplier_table: (a: number, b: number, c: number, d: number) => void;
40
43
  export const plinko_num_sectors: () => number;
44
+ export const plinko_rtp_x100: (a: number, b: number, c: number) => bigint;
41
45
  export const poseidon2_hash: (a: number, b: number, c: number) => void;
42
46
  export const poseidon2_two_to_one: (a: number, b: number, c: number, d: number, e: number) => void;
43
47
  export const seed_hash_truncated: (a: number, b: number, c: number) => void;
package/js/browser.d.mts CHANGED
@@ -24,11 +24,15 @@ export {
24
24
  plinko_multiplier_table,
25
25
  plinko_is_valid_config,
26
26
  plinko_is_valid_rows,
27
+ plinko_rtp_x100,
28
+ plinko_all_rtp_x100,
27
29
  keno_numbers_range,
28
30
  keno_draw_count,
29
31
  keno_max_picks,
30
32
  keno_multiplier_table,
31
33
  keno_is_valid_config,
34
+ keno_rtp_x100,
35
+ keno_all_rtp_x100,
32
36
  } from '../dist/web/rolly_wasm_signer.js';
33
37
 
34
38
  export { default as init } from '../dist/web/rolly_wasm_signer.js';
package/js/browser.mjs CHANGED
@@ -29,19 +29,23 @@ export {
29
29
  goldilocks_modulus,
30
30
  goldilocks_reduce,
31
31
  hash_balance_leaf,
32
+ keno_all_rtp_x100,
32
33
  keno_draw_count,
33
34
  keno_is_valid_config,
34
35
  keno_max_picks,
35
36
  keno_multiplier_table,
36
37
  keno_numbers_range,
38
+ keno_rtp_x100,
37
39
  limbo_rtp_percent,
38
40
  make_main_leaf,
41
+ plinko_all_rtp_x100,
39
42
  plinko_is_valid_config,
40
43
  plinko_is_valid_rows,
41
44
  plinko_max_rows,
42
45
  plinko_min_rows,
43
46
  plinko_multiplier_table,
44
47
  plinko_num_sectors,
48
+ plinko_rtp_x100,
45
49
  poseidon2_hash,
46
50
  poseidon2_two_to_one,
47
51
  seed_hash_truncated,
package/js/index.d.ts CHANGED
@@ -27,19 +27,23 @@ export {
27
27
  goldilocks_modulus,
28
28
  goldilocks_reduce,
29
29
  hash_balance_leaf,
30
+ keno_all_rtp_x100,
30
31
  keno_draw_count,
31
32
  keno_is_valid_config,
32
33
  keno_max_picks,
33
34
  keno_multiplier_table,
34
35
  keno_numbers_range,
36
+ keno_rtp_x100,
35
37
  limbo_rtp_percent,
36
38
  make_main_leaf,
39
+ plinko_all_rtp_x100,
37
40
  plinko_is_valid_config,
38
41
  plinko_is_valid_rows,
39
42
  plinko_max_rows,
40
43
  plinko_min_rows,
41
44
  plinko_multiplier_table,
42
45
  plinko_num_sectors,
46
+ plinko_rtp_x100,
43
47
  poseidon2_hash,
44
48
  poseidon2_two_to_one,
45
49
  seed_hash_truncated,
@@ -31,19 +31,23 @@ module.exports = {
31
31
  goldilocks_modulus: wasm.goldilocks_modulus,
32
32
  goldilocks_reduce: wasm.goldilocks_reduce,
33
33
  hash_balance_leaf: wasm.hash_balance_leaf,
34
+ keno_all_rtp_x100: wasm.keno_all_rtp_x100,
34
35
  keno_draw_count: wasm.keno_draw_count,
35
36
  keno_is_valid_config: wasm.keno_is_valid_config,
36
37
  keno_max_picks: wasm.keno_max_picks,
37
38
  keno_multiplier_table: wasm.keno_multiplier_table,
38
39
  keno_numbers_range: wasm.keno_numbers_range,
40
+ keno_rtp_x100: wasm.keno_rtp_x100,
39
41
  limbo_rtp_percent: wasm.limbo_rtp_percent,
40
42
  make_main_leaf: wasm.make_main_leaf,
43
+ plinko_all_rtp_x100: wasm.plinko_all_rtp_x100,
41
44
  plinko_is_valid_config: wasm.plinko_is_valid_config,
42
45
  plinko_is_valid_rows: wasm.plinko_is_valid_rows,
43
46
  plinko_max_rows: wasm.plinko_max_rows,
44
47
  plinko_min_rows: wasm.plinko_min_rows,
45
48
  plinko_multiplier_table: wasm.plinko_multiplier_table,
46
49
  plinko_num_sectors: wasm.plinko_num_sectors,
50
+ plinko_rtp_x100: wasm.plinko_rtp_x100,
47
51
  poseidon2_hash: wasm.poseidon2_hash,
48
52
  poseidon2_two_to_one: wasm.poseidon2_two_to_one,
49
53
  seed_hash_truncated: wasm.seed_hash_truncated,
@@ -27,19 +27,23 @@ export {
27
27
  goldilocks_modulus,
28
28
  goldilocks_reduce,
29
29
  hash_balance_leaf,
30
+ keno_all_rtp_x100,
30
31
  keno_draw_count,
31
32
  keno_is_valid_config,
32
33
  keno_max_picks,
33
34
  keno_multiplier_table,
34
35
  keno_numbers_range,
36
+ keno_rtp_x100,
35
37
  limbo_rtp_percent,
36
38
  make_main_leaf,
39
+ plinko_all_rtp_x100,
37
40
  plinko_is_valid_config,
38
41
  plinko_is_valid_rows,
39
42
  plinko_max_rows,
40
43
  plinko_min_rows,
41
44
  plinko_multiplier_table,
42
45
  plinko_num_sectors,
46
+ plinko_rtp_x100,
43
47
  poseidon2_hash,
44
48
  poseidon2_two_to_one,
45
49
  seed_hash_truncated,
package/js/node.cjs CHANGED
@@ -31,19 +31,23 @@ module.exports = {
31
31
  goldilocks_modulus: wasm.goldilocks_modulus,
32
32
  goldilocks_reduce: wasm.goldilocks_reduce,
33
33
  hash_balance_leaf: wasm.hash_balance_leaf,
34
+ keno_all_rtp_x100: wasm.keno_all_rtp_x100,
34
35
  keno_draw_count: wasm.keno_draw_count,
35
36
  keno_is_valid_config: wasm.keno_is_valid_config,
36
37
  keno_max_picks: wasm.keno_max_picks,
37
38
  keno_multiplier_table: wasm.keno_multiplier_table,
38
39
  keno_numbers_range: wasm.keno_numbers_range,
40
+ keno_rtp_x100: wasm.keno_rtp_x100,
39
41
  limbo_rtp_percent: wasm.limbo_rtp_percent,
40
42
  make_main_leaf: wasm.make_main_leaf,
43
+ plinko_all_rtp_x100: wasm.plinko_all_rtp_x100,
41
44
  plinko_is_valid_config: wasm.plinko_is_valid_config,
42
45
  plinko_is_valid_rows: wasm.plinko_is_valid_rows,
43
46
  plinko_max_rows: wasm.plinko_max_rows,
44
47
  plinko_min_rows: wasm.plinko_min_rows,
45
48
  plinko_multiplier_table: wasm.plinko_multiplier_table,
46
49
  plinko_num_sectors: wasm.plinko_num_sectors,
50
+ plinko_rtp_x100: wasm.plinko_rtp_x100,
47
51
  poseidon2_hash: wasm.poseidon2_hash,
48
52
  poseidon2_two_to_one: wasm.poseidon2_two_to_one,
49
53
  seed_hash_truncated: wasm.seed_hash_truncated,
package/js/node.mjs CHANGED
@@ -32,19 +32,23 @@ export const {
32
32
  goldilocks_modulus,
33
33
  goldilocks_reduce,
34
34
  hash_balance_leaf,
35
+ keno_all_rtp_x100,
35
36
  keno_draw_count,
36
37
  keno_is_valid_config,
37
38
  keno_max_picks,
38
39
  keno_multiplier_table,
39
40
  keno_numbers_range,
41
+ keno_rtp_x100,
40
42
  limbo_rtp_percent,
41
43
  make_main_leaf,
44
+ plinko_all_rtp_x100,
42
45
  plinko_is_valid_config,
43
46
  plinko_is_valid_rows,
44
47
  plinko_max_rows,
45
48
  plinko_min_rows,
46
49
  plinko_multiplier_table,
47
50
  plinko_num_sectors,
51
+ plinko_rtp_x100,
48
52
  poseidon2_hash,
49
53
  poseidon2_two_to_one,
50
54
  seed_hash_truncated,
package/js/react.d.mts CHANGED
@@ -42,11 +42,15 @@ export interface RollyWasmResult {
42
42
  plinko_multiplier_table: (sector: number, rows: number, is_extreme: boolean) => BigUint64Array;
43
43
  plinko_is_valid_config: (sector: number, rows: number, is_extreme: boolean) => boolean;
44
44
  plinko_is_valid_rows: (rows: number) => boolean;
45
+ plinko_rtp_x100: (sector: number, rows: number, is_extreme: boolean) => bigint;
46
+ plinko_all_rtp_x100: () => Record<string, bigint>;
45
47
  keno_numbers_range: () => number;
46
48
  keno_draw_count: () => number;
47
49
  keno_max_picks: () => number;
48
50
  keno_multiplier_table: (risk: number, pick_count: number) => BigUint64Array;
49
51
  keno_is_valid_config: (risk: number, pick_count: number) => boolean;
52
+ keno_rtp_x100: (risk: number, pick_count: number) => bigint;
53
+ keno_all_rtp_x100: () => Record<string, bigint>;
50
54
  }
51
55
 
52
56
  export function useRollyWasm(): RollyWasmResult;
package/js/react.mjs CHANGED
@@ -28,19 +28,23 @@ import init, {
28
28
  goldilocks_modulus,
29
29
  goldilocks_reduce,
30
30
  hash_balance_leaf,
31
+ keno_all_rtp_x100,
31
32
  keno_draw_count,
32
33
  keno_is_valid_config,
33
34
  keno_max_picks,
34
35
  keno_multiplier_table,
35
36
  keno_numbers_range,
37
+ keno_rtp_x100,
36
38
  limbo_rtp_percent,
37
39
  make_main_leaf,
40
+ plinko_all_rtp_x100,
38
41
  plinko_is_valid_config,
39
42
  plinko_is_valid_rows,
40
43
  plinko_max_rows,
41
44
  plinko_min_rows,
42
45
  plinko_multiplier_table,
43
46
  plinko_num_sectors,
47
+ plinko_rtp_x100,
44
48
  poseidon2_hash,
45
49
  poseidon2_two_to_one,
46
50
  seed_hash_truncated,
@@ -88,19 +92,23 @@ const fns = {
88
92
  goldilocks_modulus: guard(goldilocks_modulus),
89
93
  goldilocks_reduce: guard(goldilocks_reduce),
90
94
  hash_balance_leaf: guard(hash_balance_leaf),
95
+ keno_all_rtp_x100: guard(keno_all_rtp_x100),
91
96
  keno_draw_count: guard(keno_draw_count),
92
97
  keno_is_valid_config: guard(keno_is_valid_config),
93
98
  keno_max_picks: guard(keno_max_picks),
94
99
  keno_multiplier_table: guard(keno_multiplier_table),
95
100
  keno_numbers_range: guard(keno_numbers_range),
101
+ keno_rtp_x100: guard(keno_rtp_x100),
96
102
  limbo_rtp_percent: guard(limbo_rtp_percent),
97
103
  make_main_leaf: guard(make_main_leaf),
104
+ plinko_all_rtp_x100: guard(plinko_all_rtp_x100),
98
105
  plinko_is_valid_config: guard(plinko_is_valid_config),
99
106
  plinko_is_valid_rows: guard(plinko_is_valid_rows),
100
107
  plinko_max_rows: guard(plinko_max_rows),
101
108
  plinko_min_rows: guard(plinko_min_rows),
102
109
  plinko_multiplier_table: guard(plinko_multiplier_table),
103
110
  plinko_num_sectors: guard(plinko_num_sectors),
111
+ plinko_rtp_x100: guard(plinko_rtp_x100),
104
112
  poseidon2_hash: guard(poseidon2_hash),
105
113
  poseidon2_two_to_one: guard(poseidon2_two_to_one),
106
114
  seed_hash_truncated: guard(seed_hash_truncated),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolly-dev/wasm-signer",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "Poseidon2 hashing & bet signing for Rolly ZK-Rollup (WASM, Goldilocks field)",
5
5
  "type": "module",
6
6
  "exports": {