@rolly-dev/wasm-signer 1.9.0 → 1.11.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.
@@ -49,6 +49,18 @@ export function compute_payout_coinflip(random: BigUint64Array, bet_atomic: bigi
49
49
  */
50
50
  export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number): BigUint64Array;
51
51
 
52
+ /**
53
+ * Full limbo payout computation — pure integer arithmetic, zero floats.
54
+ *
55
+ * `random`: 4 Goldilocks field elements (Poseidon2 output).
56
+ * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
57
+ * `prediction_x100`: target multiplier × 100 (101..999999, i.e. 1.01x–9999.99x).
58
+ * `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
59
+ *
60
+ * Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier×10000]`.
61
+ */
62
+ export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number, rtp_numer: number): BigUint64Array;
63
+
52
64
  /**
53
65
  * Full plinko payout computation — pure integer arithmetic, zero floats.
54
66
  *
@@ -69,6 +81,7 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
69
81
  * and the in-circuit `build_prediction_hash`.
70
82
  *
71
83
  * Semantics of p0–p2 depend on the game:
84
+ * Limbo: `(rtp_numer, prediction_x100, 0)`
72
85
  * Dice: `(mode, pred_lo, pred_hi)`
73
86
  * Plinko: `(sector, rows, is_extreme)`
74
87
  * CoinFlip: `(prediction, 0, 0)`
@@ -89,6 +102,15 @@ export function compute_roll_coinflip(random: BigUint64Array): number;
89
102
  */
90
103
  export function compute_roll_dice(random: BigUint64Array): number;
91
104
 
105
+ /**
106
+ * Extract limbo result multiplier × 100 from Poseidon2 random output.
107
+ *
108
+ * `random` must be exactly 4 elements.
109
+ * `rtp_numer` must be in [90, 99].
110
+ * Returns the clamped multiplier × 100 (101..999999).
111
+ */
112
+ export function compute_roll_limbo(random: BigUint64Array, rtp_numer: number): number;
113
+
92
114
  /**
93
115
  * Extract plinko bucket index from Poseidon2 random output.
94
116
  *
@@ -315,10 +337,12 @@ export interface InitOutput {
315
337
  readonly compute_multi_dice: (a: number) => bigint;
316
338
  readonly compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
317
339
  readonly compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
340
+ readonly compute_payout_limbo: (a: number, b: number, c: number, d: bigint, e: number, f: number) => void;
318
341
  readonly compute_payout_plinko: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
319
342
  readonly compute_prediction_hash: (a: number, b: number, c: number, d: number, e: number) => void;
320
343
  readonly compute_roll_coinflip: (a: number, b: number) => number;
321
344
  readonly compute_roll_dice: (a: number, b: number) => number;
345
+ readonly compute_roll_limbo: (a: number, b: number, c: number) => number;
322
346
  readonly compute_roll_plinko: (a: number, b: number, c: number) => number;
323
347
  readonly compute_server_seed_hash: (a: number, b: number, c: number) => void;
324
348
  readonly compute_user_seed_binding: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number) => void;
@@ -121,6 +121,37 @@ export function compute_payout_dice(random, bet_atomic, game_mode, prediction_lo
121
121
  }
122
122
  }
123
123
 
124
+ /**
125
+ * Full limbo payout computation — pure integer arithmetic, zero floats.
126
+ *
127
+ * `random`: 4 Goldilocks field elements (Poseidon2 output).
128
+ * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
129
+ * `prediction_x100`: target multiplier × 100 (101..999999, i.e. 1.01x–9999.99x).
130
+ * `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
131
+ *
132
+ * Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier×10000]`.
133
+ * @param {BigUint64Array} random
134
+ * @param {bigint} bet_atomic
135
+ * @param {number} prediction_x100
136
+ * @param {number} rtp_numer
137
+ * @returns {BigUint64Array}
138
+ */
139
+ export function compute_payout_limbo(random, bet_atomic, prediction_x100, rtp_numer) {
140
+ try {
141
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
142
+ const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
143
+ const len0 = WASM_VECTOR_LEN;
144
+ wasm.compute_payout_limbo(retptr, ptr0, len0, bet_atomic, prediction_x100, rtp_numer);
145
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
146
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
147
+ var v2 = getArrayU64FromWasm0(r0, r1).slice();
148
+ wasm.__wbindgen_export2(r0, r1 * 8, 8);
149
+ return v2;
150
+ } finally {
151
+ wasm.__wbindgen_add_to_stack_pointer(16);
152
+ }
153
+ }
154
+
124
155
  /**
125
156
  * Full plinko payout computation — pure integer arithmetic, zero floats.
126
157
  *
@@ -161,6 +192,7 @@ export function compute_payout_plinko(random, bet_atomic, sector, rows, is_extre
161
192
  * and the in-circuit `build_prediction_hash`.
162
193
  *
163
194
  * Semantics of p0–p2 depend on the game:
195
+ * Limbo: `(rtp_numer, prediction_x100, 0)`
164
196
  * Dice: `(mode, pred_lo, pred_hi)`
165
197
  * Plinko: `(sector, rows, is_extreme)`
166
198
  * CoinFlip: `(prediction, 0, 0)`
@@ -212,6 +244,23 @@ export function compute_roll_dice(random) {
212
244
  return ret >>> 0;
213
245
  }
214
246
 
247
+ /**
248
+ * Extract limbo result multiplier × 100 from Poseidon2 random output.
249
+ *
250
+ * `random` must be exactly 4 elements.
251
+ * `rtp_numer` must be in [90, 99].
252
+ * Returns the clamped multiplier × 100 (101..999999).
253
+ * @param {BigUint64Array} random
254
+ * @param {number} rtp_numer
255
+ * @returns {number}
256
+ */
257
+ export function compute_roll_limbo(random, rtp_numer) {
258
+ const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
259
+ const len0 = WASM_VECTOR_LEN;
260
+ const ret = wasm.compute_roll_limbo(ptr0, len0, rtp_numer);
261
+ return ret >>> 0;
262
+ }
263
+
215
264
  /**
216
265
  * Extract plinko bucket index from Poseidon2 random output.
217
266
  *
Binary file
@@ -6,10 +6,12 @@ export const compute_address_hash: (a: number, b: number, c: number) => void;
6
6
  export const compute_multi_dice: (a: number) => bigint;
7
7
  export const compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
8
8
  export const compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
9
+ export const compute_payout_limbo: (a: number, b: number, c: number, d: bigint, e: number, f: number) => void;
9
10
  export const compute_payout_plinko: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
10
11
  export const compute_prediction_hash: (a: number, b: number, c: number, d: number, e: number) => void;
11
12
  export const compute_roll_coinflip: (a: number, b: number) => number;
12
13
  export const compute_roll_dice: (a: number, b: number) => number;
14
+ export const compute_roll_limbo: (a: number, b: number, c: number) => number;
13
15
  export const compute_roll_plinko: (a: number, b: number, c: number) => number;
14
16
  export const compute_server_seed_hash: (a: number, b: number, c: number) => void;
15
17
  export const compute_user_seed_binding: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number) => void;
package/js/browser.mjs CHANGED
@@ -6,10 +6,12 @@ export {
6
6
  compute_multi_dice,
7
7
  compute_payout_coinflip,
8
8
  compute_payout_dice,
9
+ compute_payout_limbo,
9
10
  compute_payout_plinko,
10
11
  compute_prediction_hash,
11
12
  compute_roll_coinflip,
12
13
  compute_roll_dice,
14
+ compute_roll_limbo,
13
15
  compute_roll_plinko,
14
16
  compute_server_seed_hash,
15
17
  compute_user_seed_binding,
package/js/index.d.ts CHANGED
@@ -4,10 +4,12 @@ export {
4
4
  compute_multi_dice,
5
5
  compute_payout_coinflip,
6
6
  compute_payout_dice,
7
+ compute_payout_limbo,
7
8
  compute_payout_plinko,
8
9
  compute_prediction_hash,
9
10
  compute_roll_coinflip,
10
11
  compute_roll_dice,
12
+ compute_roll_limbo,
11
13
  compute_roll_plinko,
12
14
  compute_server_seed_hash,
13
15
  compute_user_seed_binding,
@@ -8,10 +8,12 @@ module.exports = {
8
8
  compute_multi_dice: wasm.compute_multi_dice,
9
9
  compute_payout_coinflip: wasm.compute_payout_coinflip,
10
10
  compute_payout_dice: wasm.compute_payout_dice,
11
+ compute_payout_limbo: wasm.compute_payout_limbo,
11
12
  compute_payout_plinko: wasm.compute_payout_plinko,
12
13
  compute_prediction_hash: wasm.compute_prediction_hash,
13
14
  compute_roll_coinflip: wasm.compute_roll_coinflip,
14
15
  compute_roll_dice: wasm.compute_roll_dice,
16
+ compute_roll_limbo: wasm.compute_roll_limbo,
15
17
  compute_roll_plinko: wasm.compute_roll_plinko,
16
18
  compute_server_seed_hash: wasm.compute_server_seed_hash,
17
19
  compute_user_seed_binding: wasm.compute_user_seed_binding,
@@ -4,10 +4,12 @@ export {
4
4
  compute_multi_dice,
5
5
  compute_payout_coinflip,
6
6
  compute_payout_dice,
7
+ compute_payout_limbo,
7
8
  compute_payout_plinko,
8
9
  compute_prediction_hash,
9
10
  compute_roll_coinflip,
10
11
  compute_roll_dice,
12
+ compute_roll_limbo,
11
13
  compute_roll_plinko,
12
14
  compute_server_seed_hash,
13
15
  compute_user_seed_binding,
package/js/node.cjs CHANGED
@@ -8,10 +8,12 @@ module.exports = {
8
8
  compute_multi_dice: wasm.compute_multi_dice,
9
9
  compute_payout_coinflip: wasm.compute_payout_coinflip,
10
10
  compute_payout_dice: wasm.compute_payout_dice,
11
+ compute_payout_limbo: wasm.compute_payout_limbo,
11
12
  compute_payout_plinko: wasm.compute_payout_plinko,
12
13
  compute_prediction_hash: wasm.compute_prediction_hash,
13
14
  compute_roll_coinflip: wasm.compute_roll_coinflip,
14
15
  compute_roll_dice: wasm.compute_roll_dice,
16
+ compute_roll_limbo: wasm.compute_roll_limbo,
15
17
  compute_roll_plinko: wasm.compute_roll_plinko,
16
18
  compute_server_seed_hash: wasm.compute_server_seed_hash,
17
19
  compute_user_seed_binding: wasm.compute_user_seed_binding,
package/js/node.mjs CHANGED
@@ -9,10 +9,12 @@ export const {
9
9
  compute_multi_dice,
10
10
  compute_payout_coinflip,
11
11
  compute_payout_dice,
12
+ compute_payout_limbo,
12
13
  compute_payout_plinko,
13
14
  compute_prediction_hash,
14
15
  compute_roll_coinflip,
15
16
  compute_roll_dice,
17
+ compute_roll_limbo,
16
18
  compute_roll_plinko,
17
19
  compute_server_seed_hash,
18
20
  compute_user_seed_binding,
package/js/react.mjs CHANGED
@@ -5,10 +5,12 @@ import init, {
5
5
  compute_multi_dice,
6
6
  compute_payout_coinflip,
7
7
  compute_payout_dice,
8
+ compute_payout_limbo,
8
9
  compute_payout_plinko,
9
10
  compute_prediction_hash,
10
11
  compute_roll_coinflip,
11
12
  compute_roll_dice,
13
+ compute_roll_limbo,
12
14
  compute_roll_plinko,
13
15
  compute_server_seed_hash,
14
16
  compute_user_seed_binding,
@@ -44,10 +46,12 @@ const fns = {
44
46
  compute_multi_dice: guard(compute_multi_dice),
45
47
  compute_payout_coinflip: guard(compute_payout_coinflip),
46
48
  compute_payout_dice: guard(compute_payout_dice),
49
+ compute_payout_limbo: guard(compute_payout_limbo),
47
50
  compute_payout_plinko: guard(compute_payout_plinko),
48
51
  compute_prediction_hash: guard(compute_prediction_hash),
49
52
  compute_roll_coinflip: guard(compute_roll_coinflip),
50
53
  compute_roll_dice: guard(compute_roll_dice),
54
+ compute_roll_limbo: guard(compute_roll_limbo),
51
55
  compute_roll_plinko: guard(compute_roll_plinko),
52
56
  compute_server_seed_hash: guard(compute_server_seed_hash),
53
57
  compute_user_seed_binding: guard(compute_user_seed_binding),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolly-dev/wasm-signer",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Poseidon2 hashing & bet signing for Rolly ZK-Rollup (WASM, Goldilocks field)",
5
5
  "type": "module",
6
6
  "exports": {