@rolly-dev/wasm-signer 1.12.0 → 1.14.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.
@@ -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].
@@ -75,12 +85,11 @@ export function compute_payout_keno(random: BigUint64Array, bet_atomic: bigint,
75
85
  *
76
86
  * `random`: 4 Goldilocks field elements (Poseidon2 output).
77
87
  * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
78
- * `prediction_x100`: target multiplier × 100 (101..999999, i.e. 1.01x9999.99x).
79
- * `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
88
+ * `prediction_x100`: target multiplier x 100 (101..999999, i.e. 1.01x-9999.99x).
80
89
  *
81
- * Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier×10000]`.
90
+ * Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier x10000]`.
82
91
  */
83
- export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number, rtp_numer: number): BigUint64Array;
92
+ export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number): BigUint64Array;
84
93
 
85
94
  /**
86
95
  * Full plinko payout computation — pure integer arithmetic, zero floats.
@@ -102,7 +111,7 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
102
111
  * and the in-circuit `build_prediction_hash`.
103
112
  *
104
113
  * Semantics of p0–p2 depend on the game:
105
- * Limbo: `(rtp_numer, prediction_x100, 0)`
114
+ * Limbo: `(99, prediction_x100, 0)` — RTP hardcoded at 99
106
115
  * Dice: `(mode, pred_lo, pred_hi)`
107
116
  * Plinko: `(sector, rows, is_extreme)`
108
117
  * CoinFlip: `(prediction, 0, 0)`
@@ -135,13 +144,12 @@ export function compute_roll_coinflip(random: BigUint64Array): number;
135
144
  export function compute_roll_dice(random: BigUint64Array): number;
136
145
 
137
146
  /**
138
- * Extract limbo result multiplier × 100 from Poseidon2 random output.
147
+ * Extract limbo result multiplier x 100 from Poseidon2 random output.
139
148
  *
140
149
  * `random` must be exactly 4 elements.
141
- * `rtp_numer` must be in [90, 99].
142
- * Returns the clamped multiplier × 100 (101..999999).
150
+ * Returns the clamped multiplier x 100 (101..999999).
143
151
  */
144
- export function compute_roll_limbo(random: BigUint64Array, rtp_numer: number): number;
152
+ export function compute_roll_limbo(random: BigUint64Array): number;
145
153
 
146
154
  /**
147
155
  * Extract plinko bucket index from Poseidon2 random output.
@@ -195,6 +203,11 @@ export function compute_user_seed_binding(game_id: number, bet: bigint, pred_has
195
203
  */
196
204
  export function derive_session_key(sig_bytes: Uint8Array): BigUint64Array;
197
205
 
206
+ /**
207
+ * Dice RTP percent (99). Canonical source for backend/frontend.
208
+ */
209
+ export function dice_rtp_percent(): number;
210
+
198
211
  /**
199
212
  * Generate a cryptographically random user secret — 4 Goldilocks field elements.
200
213
  *
@@ -263,6 +276,11 @@ export function goldilocks_reduce(value: bigint): bigint;
263
276
  */
264
277
  export function hash_balance_leaf(raw: BigUint64Array): BigUint64Array;
265
278
 
279
+ /**
280
+ * Limbo RTP percent (99). Canonical source for backend/frontend.
281
+ */
282
+ export function limbo_rtp_percent(): number;
283
+
266
284
  /**
267
285
  * Build a main Merkle tree leaf from balance_hash, pk_hash, and address_hash.
268
286
  *
@@ -26,6 +26,26 @@ function amount_split(amount) {
26
26
  }
27
27
  exports.amount_split = amount_split;
28
28
 
29
+ /**
30
+ * CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
31
+ * @returns {number}
32
+ */
33
+ function coinflip_multiplier_x10000() {
34
+ const ret = wasm.coinflip_multiplier_x10000();
35
+ return ret >>> 0;
36
+ }
37
+ exports.coinflip_multiplier_x10000 = coinflip_multiplier_x10000;
38
+
39
+ /**
40
+ * CoinFlip RTP percent (99). Canonical source for backend/frontend.
41
+ * @returns {number}
42
+ */
43
+ function coinflip_rtp_percent() {
44
+ const ret = wasm.coinflip_rtp_percent();
45
+ return ret >>> 0;
46
+ }
47
+ exports.coinflip_rtp_percent = coinflip_rtp_percent;
48
+
29
49
  /**
30
50
  * Compute address_hash = Poseidon2(addr_byte_0, ..., addr_byte_19).
31
51
  * Takes a hex address string (with or without 0x prefix), returns [u64; 4].
@@ -191,22 +211,20 @@ exports.compute_payout_keno = compute_payout_keno;
191
211
  *
192
212
  * `random`: 4 Goldilocks field elements (Poseidon2 output).
193
213
  * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
194
- * `prediction_x100`: target multiplier × 100 (101..999999, i.e. 1.01x9999.99x).
195
- * `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
214
+ * `prediction_x100`: target multiplier x 100 (101..999999, i.e. 1.01x-9999.99x).
196
215
  *
197
- * Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier×10000]`.
216
+ * Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier x10000]`.
198
217
  * @param {BigUint64Array} random
199
218
  * @param {bigint} bet_atomic
200
219
  * @param {number} prediction_x100
201
- * @param {number} rtp_numer
202
220
  * @returns {BigUint64Array}
203
221
  */
204
- function compute_payout_limbo(random, bet_atomic, prediction_x100, rtp_numer) {
222
+ function compute_payout_limbo(random, bet_atomic, prediction_x100) {
205
223
  try {
206
224
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
207
225
  const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
208
226
  const len0 = WASM_VECTOR_LEN;
209
- wasm.compute_payout_limbo(retptr, ptr0, len0, bet_atomic, prediction_x100, rtp_numer);
227
+ wasm.compute_payout_limbo(retptr, ptr0, len0, bet_atomic, prediction_x100);
210
228
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
211
229
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
212
230
  var v2 = getArrayU64FromWasm0(r0, r1).slice();
@@ -259,7 +277,7 @@ exports.compute_payout_plinko = compute_payout_plinko;
259
277
  * and the in-circuit `build_prediction_hash`.
260
278
  *
261
279
  * Semantics of p0–p2 depend on the game:
262
- * Limbo: `(rtp_numer, prediction_x100, 0)`
280
+ * Limbo: `(99, prediction_x100, 0)` — RTP hardcoded at 99
263
281
  * Dice: `(mode, pred_lo, pred_hi)`
264
282
  * Plinko: `(sector, rows, is_extreme)`
265
283
  * CoinFlip: `(prediction, 0, 0)`
@@ -346,19 +364,17 @@ function compute_roll_dice(random) {
346
364
  exports.compute_roll_dice = compute_roll_dice;
347
365
 
348
366
  /**
349
- * Extract limbo result multiplier × 100 from Poseidon2 random output.
367
+ * Extract limbo result multiplier x 100 from Poseidon2 random output.
350
368
  *
351
369
  * `random` must be exactly 4 elements.
352
- * `rtp_numer` must be in [90, 99].
353
- * Returns the clamped multiplier × 100 (101..999999).
370
+ * Returns the clamped multiplier x 100 (101..999999).
354
371
  * @param {BigUint64Array} random
355
- * @param {number} rtp_numer
356
372
  * @returns {number}
357
373
  */
358
- function compute_roll_limbo(random, rtp_numer) {
374
+ function compute_roll_limbo(random) {
359
375
  const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
360
376
  const len0 = WASM_VECTOR_LEN;
361
- const ret = wasm.compute_roll_limbo(ptr0, len0, rtp_numer);
377
+ const ret = wasm.compute_roll_limbo(ptr0, len0);
362
378
  return ret >>> 0;
363
379
  }
364
380
  exports.compute_roll_limbo = compute_roll_limbo;
@@ -480,6 +496,16 @@ function derive_session_key(sig_bytes) {
480
496
  }
481
497
  exports.derive_session_key = derive_session_key;
482
498
 
499
+ /**
500
+ * Dice RTP percent (99). Canonical source for backend/frontend.
501
+ * @returns {number}
502
+ */
503
+ function dice_rtp_percent() {
504
+ const ret = wasm.coinflip_rtp_percent();
505
+ return ret >>> 0;
506
+ }
507
+ exports.dice_rtp_percent = dice_rtp_percent;
508
+
483
509
  /**
484
510
  * Generate a cryptographically random user secret — 4 Goldilocks field elements.
485
511
  *
@@ -627,6 +653,16 @@ function hash_balance_leaf(raw) {
627
653
  }
628
654
  exports.hash_balance_leaf = hash_balance_leaf;
629
655
 
656
+ /**
657
+ * Limbo RTP percent (99). Canonical source for backend/frontend.
658
+ * @returns {number}
659
+ */
660
+ function limbo_rtp_percent() {
661
+ const ret = wasm.coinflip_rtp_percent();
662
+ return ret >>> 0;
663
+ }
664
+ exports.limbo_rtp_percent = limbo_rtp_percent;
665
+
630
666
  /**
631
667
  * Build a main Merkle tree leaf from balance_hash, pk_hash, and address_hash.
632
668
  *
Binary file
@@ -2,19 +2,21 @@
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;
8
10
  export const compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
9
11
  export const compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
10
12
  export const compute_payout_keno: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
11
- export const compute_payout_limbo: (a: number, b: number, c: number, d: bigint, e: number, f: number) => void;
13
+ export const compute_payout_limbo: (a: number, b: number, c: number, d: bigint, e: number) => void;
12
14
  export const compute_payout_plinko: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
13
15
  export const compute_prediction_hash: (a: number, b: number, c: number, d: number, e: number) => void;
14
16
  export const compute_prediction_hash_keno: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
15
17
  export const compute_roll_coinflip: (a: number, b: number) => number;
16
18
  export const compute_roll_dice: (a: number, b: number) => number;
17
- export const compute_roll_limbo: (a: number, b: number, c: number) => number;
19
+ export const compute_roll_limbo: (a: number, b: number) => number;
18
20
  export const compute_roll_plinko: (a: number, b: number, c: number) => number;
19
21
  export const compute_server_seed_hash: (a: number, b: number, c: number) => void;
20
22
  export const compute_user_seed_binding: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number) => void;
@@ -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].
@@ -75,12 +85,11 @@ export function compute_payout_keno(random: BigUint64Array, bet_atomic: bigint,
75
85
  *
76
86
  * `random`: 4 Goldilocks field elements (Poseidon2 output).
77
87
  * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
78
- * `prediction_x100`: target multiplier × 100 (101..999999, i.e. 1.01x9999.99x).
79
- * `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
88
+ * `prediction_x100`: target multiplier x 100 (101..999999, i.e. 1.01x-9999.99x).
80
89
  *
81
- * Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier×10000]`.
90
+ * Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier x10000]`.
82
91
  */
83
- export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number, rtp_numer: number): BigUint64Array;
92
+ export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number): BigUint64Array;
84
93
 
85
94
  /**
86
95
  * Full plinko payout computation — pure integer arithmetic, zero floats.
@@ -102,7 +111,7 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
102
111
  * and the in-circuit `build_prediction_hash`.
103
112
  *
104
113
  * Semantics of p0–p2 depend on the game:
105
- * Limbo: `(rtp_numer, prediction_x100, 0)`
114
+ * Limbo: `(99, prediction_x100, 0)` — RTP hardcoded at 99
106
115
  * Dice: `(mode, pred_lo, pred_hi)`
107
116
  * Plinko: `(sector, rows, is_extreme)`
108
117
  * CoinFlip: `(prediction, 0, 0)`
@@ -135,13 +144,12 @@ export function compute_roll_coinflip(random: BigUint64Array): number;
135
144
  export function compute_roll_dice(random: BigUint64Array): number;
136
145
 
137
146
  /**
138
- * Extract limbo result multiplier × 100 from Poseidon2 random output.
147
+ * Extract limbo result multiplier x 100 from Poseidon2 random output.
139
148
  *
140
149
  * `random` must be exactly 4 elements.
141
- * `rtp_numer` must be in [90, 99].
142
- * Returns the clamped multiplier × 100 (101..999999).
150
+ * Returns the clamped multiplier x 100 (101..999999).
143
151
  */
144
- export function compute_roll_limbo(random: BigUint64Array, rtp_numer: number): number;
152
+ export function compute_roll_limbo(random: BigUint64Array): number;
145
153
 
146
154
  /**
147
155
  * Extract plinko bucket index from Poseidon2 random output.
@@ -195,6 +203,11 @@ export function compute_user_seed_binding(game_id: number, bet: bigint, pred_has
195
203
  */
196
204
  export function derive_session_key(sig_bytes: Uint8Array): BigUint64Array;
197
205
 
206
+ /**
207
+ * Dice RTP percent (99). Canonical source for backend/frontend.
208
+ */
209
+ export function dice_rtp_percent(): number;
210
+
198
211
  /**
199
212
  * Generate a cryptographically random user secret — 4 Goldilocks field elements.
200
213
  *
@@ -263,6 +276,11 @@ export function goldilocks_reduce(value: bigint): bigint;
263
276
  */
264
277
  export function hash_balance_leaf(raw: BigUint64Array): BigUint64Array;
265
278
 
279
+ /**
280
+ * Limbo RTP percent (99). Canonical source for backend/frontend.
281
+ */
282
+ export function limbo_rtp_percent(): number;
283
+
266
284
  /**
267
285
  * Build a main Merkle tree leaf from balance_hash, pk_hash, and address_hash.
268
286
  *