@rolly-dev/wasm-signer 1.1.0 → 1.5.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.
@@ -38,6 +38,19 @@ export function compute_multi_dice(win_numbers: number): bigint;
38
38
  */
39
39
  export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number): BigUint64Array;
40
40
 
41
+ /**
42
+ * Full plinko payout computation — pure integer arithmetic, zero floats.
43
+ *
44
+ * `random`: 4 Goldilocks field elements (Poseidon2 output).
45
+ * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
46
+ * `sector`: risk profile (0=low, 1=medium, 2=high).
47
+ * `rows`: number of pin rows (8..16).
48
+ * `is_extreme`: whether extreme mode is active.
49
+ *
50
+ * Returns `BigUint64Array[4]`: `[win_amount, bucket_index, is_win (0|1), multiplier×10000]`.
51
+ */
52
+ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint, sector: number, rows: number, is_extreme: boolean): BigUint64Array;
53
+
41
54
  /**
42
55
  * Extract dice roll number [0, 1000) from Poseidon2 random output.
43
56
  *
@@ -45,6 +58,15 @@ export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint,
45
58
  */
46
59
  export function compute_roll_dice(random: BigUint64Array): number;
47
60
 
61
+ /**
62
+ * Extract plinko bucket index from Poseidon2 random output.
63
+ *
64
+ * `random` must be exactly 4 elements.
65
+ * `rows` must be in [8, 16].
66
+ * Returns the bucket index (0..=rows) = popcount of first `rows` bits of random[0].
67
+ */
68
+ export function compute_roll_plinko(random: BigUint64Array, rows: number): number;
69
+
48
70
  /**
49
71
  * Full Poseidon2 hash of an 8-element server seed.
50
72
  *
@@ -96,6 +96,40 @@ function compute_payout_dice(random, bet_atomic, game_mode, prediction_lo, predi
96
96
  }
97
97
  exports.compute_payout_dice = compute_payout_dice;
98
98
 
99
+ /**
100
+ * Full plinko payout computation — pure integer arithmetic, zero floats.
101
+ *
102
+ * `random`: 4 Goldilocks field elements (Poseidon2 output).
103
+ * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
104
+ * `sector`: risk profile (0=low, 1=medium, 2=high).
105
+ * `rows`: number of pin rows (8..16).
106
+ * `is_extreme`: whether extreme mode is active.
107
+ *
108
+ * Returns `BigUint64Array[4]`: `[win_amount, bucket_index, is_win (0|1), multiplier×10000]`.
109
+ * @param {BigUint64Array} random
110
+ * @param {bigint} bet_atomic
111
+ * @param {number} sector
112
+ * @param {number} rows
113
+ * @param {boolean} is_extreme
114
+ * @returns {BigUint64Array}
115
+ */
116
+ function compute_payout_plinko(random, bet_atomic, sector, rows, is_extreme) {
117
+ try {
118
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
119
+ const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
120
+ const len0 = WASM_VECTOR_LEN;
121
+ wasm.compute_payout_plinko(retptr, ptr0, len0, bet_atomic, sector, rows, is_extreme);
122
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
123
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
124
+ var v2 = getArrayU64FromWasm0(r0, r1).slice();
125
+ wasm.__wbindgen_export2(r0, r1 * 8, 8);
126
+ return v2;
127
+ } finally {
128
+ wasm.__wbindgen_add_to_stack_pointer(16);
129
+ }
130
+ }
131
+ exports.compute_payout_plinko = compute_payout_plinko;
132
+
99
133
  /**
100
134
  * Extract dice roll number [0, 1000) from Poseidon2 random output.
101
135
  *
@@ -111,6 +145,24 @@ function compute_roll_dice(random) {
111
145
  }
112
146
  exports.compute_roll_dice = compute_roll_dice;
113
147
 
148
+ /**
149
+ * Extract plinko bucket index from Poseidon2 random output.
150
+ *
151
+ * `random` must be exactly 4 elements.
152
+ * `rows` must be in [8, 16].
153
+ * Returns the bucket index (0..=rows) = popcount of first `rows` bits of random[0].
154
+ * @param {BigUint64Array} random
155
+ * @param {number} rows
156
+ * @returns {number}
157
+ */
158
+ function compute_roll_plinko(random, rows) {
159
+ const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
160
+ const len0 = WASM_VECTOR_LEN;
161
+ const ret = wasm.compute_roll_plinko(ptr0, len0, rows);
162
+ return ret >>> 0;
163
+ }
164
+ exports.compute_roll_plinko = compute_roll_plinko;
165
+
114
166
  /**
115
167
  * Full Poseidon2 hash of an 8-element server seed.
116
168
  *
Binary file
@@ -5,7 +5,9 @@ export const amount_split: (a: number, b: bigint) => void;
5
5
  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_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
8
+ export const compute_payout_plinko: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
8
9
  export const compute_roll_dice: (a: number, b: number) => number;
10
+ export const compute_roll_plinko: (a: number, b: number, c: number) => number;
9
11
  export const compute_server_seed_hash: (a: number, b: number, c: number) => void;
10
12
  export const derive_session_key: (a: number, b: number, c: number) => void;
11
13
  export const generate_user_seed: (a: number) => void;
@@ -38,6 +38,19 @@ export function compute_multi_dice(win_numbers: number): bigint;
38
38
  */
39
39
  export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number): BigUint64Array;
40
40
 
41
+ /**
42
+ * Full plinko payout computation — pure integer arithmetic, zero floats.
43
+ *
44
+ * `random`: 4 Goldilocks field elements (Poseidon2 output).
45
+ * `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
46
+ * `sector`: risk profile (0=low, 1=medium, 2=high).
47
+ * `rows`: number of pin rows (8..16).
48
+ * `is_extreme`: whether extreme mode is active.
49
+ *
50
+ * Returns `BigUint64Array[4]`: `[win_amount, bucket_index, is_win (0|1), multiplier×10000]`.
51
+ */
52
+ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint, sector: number, rows: number, is_extreme: boolean): BigUint64Array;
53
+
41
54
  /**
42
55
  * Extract dice roll number [0, 1000) from Poseidon2 random output.
43
56
  *
@@ -45,6 +58,15 @@ export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint,
45
58
  */
46
59
  export function compute_roll_dice(random: BigUint64Array): number;
47
60
 
61
+ /**
62
+ * Extract plinko bucket index from Poseidon2 random output.
63
+ *
64
+ * `random` must be exactly 4 elements.
65
+ * `rows` must be in [8, 16].
66
+ * Returns the bucket index (0..=rows) = popcount of first `rows` bits of random[0].
67
+ */
68
+ export function compute_roll_plinko(random: BigUint64Array, rows: number): number;
69
+
48
70
  /**
49
71
  * Full Poseidon2 hash of an 8-element server seed.
50
72
  *