@rolly-dev/wasm-signer 1.11.0 → 1.12.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.
@@ -18,6 +18,15 @@ export function amount_split(amount: bigint): Uint32Array;
18
18
  */
19
19
  export function compute_address_hash(address_hex: string): BigUint64Array;
20
20
 
21
+ /**
22
+ * Extract the 10 drawn numbers from Poseidon2 random output using
23
+ * the combinatorial number system: `combo_index = random[0] % C(40,10)`.
24
+ *
25
+ * `random` must be exactly 4 elements.
26
+ * Returns `Uint8Array` of length 10 (sorted ascending, each in [0, 39]).
27
+ */
28
+ export function compute_drawn_keno(random: BigUint64Array): Uint8Array;
29
+
21
30
  /**
22
31
  * Compute dice multiplier × 10000 from win_numbers count.
23
32
  *
@@ -49,6 +58,18 @@ export function compute_payout_coinflip(random: BigUint64Array, bet_atomic: bigi
49
58
  */
50
59
  export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number): BigUint64Array;
51
60
 
61
+ /**
62
+ * Full keno payout computation — pure integer arithmetic, zero floats.
63
+ *
64
+ * `random`: 4 Goldilocks field elements (Poseidon2 output).
65
+ * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
66
+ * `risk`: 0=low, 1=medium, 2=high.
67
+ * `selected`: player-chosen numbers (0-indexed, each in [0, 39]).
68
+ *
69
+ * Returns `BigUint64Array[4]`: `[win_amount, match_count, is_win (0|1), multiplier×10000]`.
70
+ */
71
+ export function compute_payout_keno(random: BigUint64Array, bet_atomic: bigint, risk: number, selected: Uint8Array): BigUint64Array;
72
+
52
73
  /**
53
74
  * Full limbo payout computation — pure integer arithmetic, zero floats.
54
75
  *
@@ -88,6 +109,17 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
88
109
  */
89
110
  export function compute_prediction_hash(game_id: number, p0: number, p1: number, p2: number): BigUint64Array;
90
111
 
112
+ /**
113
+ * Compute Keno prediction hash with extended 13-input format:
114
+ * `Poseidon2(game_id, risk, pick_count, selected[0], …, selected[9])`.
115
+ *
116
+ * Selected numbers are sorted internally for deterministic output.
117
+ * Unused slots (when pick_count < 10) are filled with 0.
118
+ *
119
+ * Returns `BigUint64Array` of length 4 (one `HashOut`).
120
+ */
121
+ export function compute_prediction_hash_keno(game_id: number, risk: number, pick_count: number, selected: Uint8Array): BigUint64Array;
122
+
91
123
  /**
92
124
  * Extract coinflip roll (0 or 1) from Poseidon2 random output.
93
125
  *
@@ -49,6 +49,32 @@ function compute_address_hash(address_hex) {
49
49
  }
50
50
  exports.compute_address_hash = compute_address_hash;
51
51
 
52
+ /**
53
+ * Extract the 10 drawn numbers from Poseidon2 random output using
54
+ * the combinatorial number system: `combo_index = random[0] % C(40,10)`.
55
+ *
56
+ * `random` must be exactly 4 elements.
57
+ * Returns `Uint8Array` of length 10 (sorted ascending, each in [0, 39]).
58
+ * @param {BigUint64Array} random
59
+ * @returns {Uint8Array}
60
+ */
61
+ function compute_drawn_keno(random) {
62
+ try {
63
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
64
+ const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
65
+ const len0 = WASM_VECTOR_LEN;
66
+ wasm.compute_drawn_keno(retptr, ptr0, len0);
67
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
68
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
69
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
70
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
71
+ return v2;
72
+ } finally {
73
+ wasm.__wbindgen_add_to_stack_pointer(16);
74
+ }
75
+ }
76
+ exports.compute_drawn_keno = compute_drawn_keno;
77
+
52
78
  /**
53
79
  * Compute dice multiplier × 10000 from win_numbers count.
54
80
  *
@@ -126,6 +152,40 @@ function compute_payout_dice(random, bet_atomic, game_mode, prediction_lo, predi
126
152
  }
127
153
  exports.compute_payout_dice = compute_payout_dice;
128
154
 
155
+ /**
156
+ * Full keno payout computation — pure integer arithmetic, zero floats.
157
+ *
158
+ * `random`: 4 Goldilocks field elements (Poseidon2 output).
159
+ * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
160
+ * `risk`: 0=low, 1=medium, 2=high.
161
+ * `selected`: player-chosen numbers (0-indexed, each in [0, 39]).
162
+ *
163
+ * Returns `BigUint64Array[4]`: `[win_amount, match_count, is_win (0|1), multiplier×10000]`.
164
+ * @param {BigUint64Array} random
165
+ * @param {bigint} bet_atomic
166
+ * @param {number} risk
167
+ * @param {Uint8Array} selected
168
+ * @returns {BigUint64Array}
169
+ */
170
+ function compute_payout_keno(random, bet_atomic, risk, selected) {
171
+ try {
172
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
173
+ const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
174
+ const len0 = WASM_VECTOR_LEN;
175
+ const ptr1 = passArray8ToWasm0(selected, wasm.__wbindgen_export3);
176
+ const len1 = WASM_VECTOR_LEN;
177
+ wasm.compute_payout_keno(retptr, ptr0, len0, bet_atomic, risk, ptr1, len1);
178
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
179
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
180
+ var v3 = getArrayU64FromWasm0(r0, r1).slice();
181
+ wasm.__wbindgen_export2(r0, r1 * 8, 8);
182
+ return v3;
183
+ } finally {
184
+ wasm.__wbindgen_add_to_stack_pointer(16);
185
+ }
186
+ }
187
+ exports.compute_payout_keno = compute_payout_keno;
188
+
129
189
  /**
130
190
  * Full limbo payout computation — pure integer arithmetic, zero floats.
131
191
  *
@@ -224,6 +284,37 @@ function compute_prediction_hash(game_id, p0, p1, p2) {
224
284
  }
225
285
  exports.compute_prediction_hash = compute_prediction_hash;
226
286
 
287
+ /**
288
+ * Compute Keno prediction hash with extended 13-input format:
289
+ * `Poseidon2(game_id, risk, pick_count, selected[0], …, selected[9])`.
290
+ *
291
+ * Selected numbers are sorted internally for deterministic output.
292
+ * Unused slots (when pick_count < 10) are filled with 0.
293
+ *
294
+ * Returns `BigUint64Array` of length 4 (one `HashOut`).
295
+ * @param {number} game_id
296
+ * @param {number} risk
297
+ * @param {number} pick_count
298
+ * @param {Uint8Array} selected
299
+ * @returns {BigUint64Array}
300
+ */
301
+ function compute_prediction_hash_keno(game_id, risk, pick_count, selected) {
302
+ try {
303
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
304
+ const ptr0 = passArray8ToWasm0(selected, wasm.__wbindgen_export3);
305
+ const len0 = WASM_VECTOR_LEN;
306
+ wasm.compute_prediction_hash_keno(retptr, game_id, risk, pick_count, ptr0, len0);
307
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
308
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
309
+ var v2 = getArrayU64FromWasm0(r0, r1).slice();
310
+ wasm.__wbindgen_export2(r0, r1 * 8, 8);
311
+ return v2;
312
+ } finally {
313
+ wasm.__wbindgen_add_to_stack_pointer(16);
314
+ }
315
+ }
316
+ exports.compute_prediction_hash_keno = compute_prediction_hash_keno;
317
+
227
318
  /**
228
319
  * Extract coinflip roll (0 or 1) from Poseidon2 random output.
229
320
  *
Binary file
@@ -3,12 +3,15 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const amount_split: (a: number, b: bigint) => void;
5
5
  export const compute_address_hash: (a: number, b: number, c: number) => void;
6
+ export const compute_drawn_keno: (a: number, b: number, c: number) => void;
6
7
  export const compute_multi_dice: (a: number) => bigint;
7
8
  export const compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
8
9
  export const compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
10
+ export const compute_payout_keno: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
9
11
  export const compute_payout_limbo: (a: number, b: number, c: number, d: bigint, e: number, f: number) => void;
10
12
  export const compute_payout_plinko: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
11
13
  export const compute_prediction_hash: (a: number, b: number, c: number, d: number, e: number) => void;
14
+ export const compute_prediction_hash_keno: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
15
  export const compute_roll_coinflip: (a: number, b: number) => number;
13
16
  export const compute_roll_dice: (a: number, b: number) => number;
14
17
  export const compute_roll_limbo: (a: number, b: number, c: number) => number;
@@ -18,6 +18,15 @@ export function amount_split(amount: bigint): Uint32Array;
18
18
  */
19
19
  export function compute_address_hash(address_hex: string): BigUint64Array;
20
20
 
21
+ /**
22
+ * Extract the 10 drawn numbers from Poseidon2 random output using
23
+ * the combinatorial number system: `combo_index = random[0] % C(40,10)`.
24
+ *
25
+ * `random` must be exactly 4 elements.
26
+ * Returns `Uint8Array` of length 10 (sorted ascending, each in [0, 39]).
27
+ */
28
+ export function compute_drawn_keno(random: BigUint64Array): Uint8Array;
29
+
21
30
  /**
22
31
  * Compute dice multiplier × 10000 from win_numbers count.
23
32
  *
@@ -49,6 +58,18 @@ export function compute_payout_coinflip(random: BigUint64Array, bet_atomic: bigi
49
58
  */
50
59
  export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number): BigUint64Array;
51
60
 
61
+ /**
62
+ * Full keno payout computation — pure integer arithmetic, zero floats.
63
+ *
64
+ * `random`: 4 Goldilocks field elements (Poseidon2 output).
65
+ * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
66
+ * `risk`: 0=low, 1=medium, 2=high.
67
+ * `selected`: player-chosen numbers (0-indexed, each in [0, 39]).
68
+ *
69
+ * Returns `BigUint64Array[4]`: `[win_amount, match_count, is_win (0|1), multiplier×10000]`.
70
+ */
71
+ export function compute_payout_keno(random: BigUint64Array, bet_atomic: bigint, risk: number, selected: Uint8Array): BigUint64Array;
72
+
52
73
  /**
53
74
  * Full limbo payout computation — pure integer arithmetic, zero floats.
54
75
  *
@@ -88,6 +109,17 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
88
109
  */
89
110
  export function compute_prediction_hash(game_id: number, p0: number, p1: number, p2: number): BigUint64Array;
90
111
 
112
+ /**
113
+ * Compute Keno prediction hash with extended 13-input format:
114
+ * `Poseidon2(game_id, risk, pick_count, selected[0], …, selected[9])`.
115
+ *
116
+ * Selected numbers are sorted internally for deterministic output.
117
+ * Unused slots (when pick_count < 10) are filled with 0.
118
+ *
119
+ * Returns `BigUint64Array` of length 4 (one `HashOut`).
120
+ */
121
+ export function compute_prediction_hash_keno(game_id: number, risk: number, pick_count: number, selected: Uint8Array): BigUint64Array;
122
+
91
123
  /**
92
124
  * Extract coinflip roll (0 or 1) from Poseidon2 random output.
93
125
  *