@rolly-dev/wasm-signer 1.11.0 → 1.13.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.
- package/dist/node/rolly_wasm_signer.d.ts +39 -9
- package/dist/node/rolly_wasm_signer.js +100 -13
- package/dist/node/rolly_wasm_signer_bg.wasm +0 -0
- package/dist/node/rolly_wasm_signer_bg.wasm.d.ts +5 -2
- package/dist/node-inline/rolly_wasm_signer.d.ts +39 -9
- package/dist/node-inline/rolly_wasm_signer.js +101 -14
- package/dist/node-inline/rolly_wasm_signer.mjs +99 -15
- package/dist/node-inline/rolly_wasm_signer_bg.wasm.d.ts +5 -2
- package/dist/web/rolly_wasm_signer.d.ts +44 -11
- package/dist/web/rolly_wasm_signer.js +97 -13
- package/dist/web/rolly_wasm_signer_bg.wasm +0 -0
- package/dist/web/rolly_wasm_signer_bg.wasm.d.ts +5 -2
- package/js/browser.mjs +3 -0
- package/js/index.d.ts +3 -0
- package/js/node-inline.cjs +3 -0
- package/js/node-inline.mjs +3 -0
- package/js/node.cjs +3 -0
- package/js/node.mjs +3 -0
- package/js/react.mjs +6 -0
- package/package.json +1 -1
|
@@ -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,17 +58,28 @@ 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
|
*
|
|
55
76
|
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
56
77
|
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
57
|
-
* `prediction_x100`: target multiplier
|
|
58
|
-
* `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
|
|
78
|
+
* `prediction_x100`: target multiplier x 100 (101..999999, i.e. 1.01x-9999.99x).
|
|
59
79
|
*
|
|
60
|
-
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier
|
|
80
|
+
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier x10000]`.
|
|
61
81
|
*/
|
|
62
|
-
export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number
|
|
82
|
+
export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number): BigUint64Array;
|
|
63
83
|
|
|
64
84
|
/**
|
|
65
85
|
* Full plinko payout computation — pure integer arithmetic, zero floats.
|
|
@@ -81,13 +101,24 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
|
|
|
81
101
|
* and the in-circuit `build_prediction_hash`.
|
|
82
102
|
*
|
|
83
103
|
* Semantics of p0–p2 depend on the game:
|
|
84
|
-
* Limbo: `(
|
|
104
|
+
* Limbo: `(99, prediction_x100, 0)` — RTP hardcoded at 99
|
|
85
105
|
* Dice: `(mode, pred_lo, pred_hi)`
|
|
86
106
|
* Plinko: `(sector, rows, is_extreme)`
|
|
87
107
|
* CoinFlip: `(prediction, 0, 0)`
|
|
88
108
|
*/
|
|
89
109
|
export function compute_prediction_hash(game_id: number, p0: number, p1: number, p2: number): BigUint64Array;
|
|
90
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Compute Keno prediction hash with extended 13-input format:
|
|
113
|
+
* `Poseidon2(game_id, risk, pick_count, selected[0], …, selected[9])`.
|
|
114
|
+
*
|
|
115
|
+
* Selected numbers are sorted internally for deterministic output.
|
|
116
|
+
* Unused slots (when pick_count < 10) are filled with 0.
|
|
117
|
+
*
|
|
118
|
+
* Returns `BigUint64Array` of length 4 (one `HashOut`).
|
|
119
|
+
*/
|
|
120
|
+
export function compute_prediction_hash_keno(game_id: number, risk: number, pick_count: number, selected: Uint8Array): BigUint64Array;
|
|
121
|
+
|
|
91
122
|
/**
|
|
92
123
|
* Extract coinflip roll (0 or 1) from Poseidon2 random output.
|
|
93
124
|
*
|
|
@@ -103,13 +134,12 @@ export function compute_roll_coinflip(random: BigUint64Array): number;
|
|
|
103
134
|
export function compute_roll_dice(random: BigUint64Array): number;
|
|
104
135
|
|
|
105
136
|
/**
|
|
106
|
-
* Extract limbo result multiplier
|
|
137
|
+
* Extract limbo result multiplier x 100 from Poseidon2 random output.
|
|
107
138
|
*
|
|
108
139
|
* `random` must be exactly 4 elements.
|
|
109
|
-
*
|
|
110
|
-
* Returns the clamped multiplier × 100 (101..999999).
|
|
140
|
+
* Returns the clamped multiplier x 100 (101..999999).
|
|
111
141
|
*/
|
|
112
|
-
export function compute_roll_limbo(random: BigUint64Array
|
|
142
|
+
export function compute_roll_limbo(random: BigUint64Array): number;
|
|
113
143
|
|
|
114
144
|
/**
|
|
115
145
|
* Extract plinko bucket index from Poseidon2 random output.
|
|
@@ -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,27 +152,59 @@ 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
|
*
|
|
132
192
|
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
133
193
|
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
134
|
-
* `prediction_x100`: target multiplier
|
|
135
|
-
* `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
|
|
194
|
+
* `prediction_x100`: target multiplier x 100 (101..999999, i.e. 1.01x-9999.99x).
|
|
136
195
|
*
|
|
137
|
-
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier
|
|
196
|
+
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier x10000]`.
|
|
138
197
|
* @param {BigUint64Array} random
|
|
139
198
|
* @param {bigint} bet_atomic
|
|
140
199
|
* @param {number} prediction_x100
|
|
141
|
-
* @param {number} rtp_numer
|
|
142
200
|
* @returns {BigUint64Array}
|
|
143
201
|
*/
|
|
144
|
-
function compute_payout_limbo(random, bet_atomic, prediction_x100
|
|
202
|
+
function compute_payout_limbo(random, bet_atomic, prediction_x100) {
|
|
145
203
|
try {
|
|
146
204
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
147
205
|
const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
|
|
148
206
|
const len0 = WASM_VECTOR_LEN;
|
|
149
|
-
wasm.compute_payout_limbo(retptr, ptr0, len0, bet_atomic, prediction_x100
|
|
207
|
+
wasm.compute_payout_limbo(retptr, ptr0, len0, bet_atomic, prediction_x100);
|
|
150
208
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
151
209
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
152
210
|
var v2 = getArrayU64FromWasm0(r0, r1).slice();
|
|
@@ -199,7 +257,7 @@ exports.compute_payout_plinko = compute_payout_plinko;
|
|
|
199
257
|
* and the in-circuit `build_prediction_hash`.
|
|
200
258
|
*
|
|
201
259
|
* Semantics of p0–p2 depend on the game:
|
|
202
|
-
* Limbo: `(
|
|
260
|
+
* Limbo: `(99, prediction_x100, 0)` — RTP hardcoded at 99
|
|
203
261
|
* Dice: `(mode, pred_lo, pred_hi)`
|
|
204
262
|
* Plinko: `(sector, rows, is_extreme)`
|
|
205
263
|
* CoinFlip: `(prediction, 0, 0)`
|
|
@@ -224,6 +282,37 @@ function compute_prediction_hash(game_id, p0, p1, p2) {
|
|
|
224
282
|
}
|
|
225
283
|
exports.compute_prediction_hash = compute_prediction_hash;
|
|
226
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Compute Keno prediction hash with extended 13-input format:
|
|
287
|
+
* `Poseidon2(game_id, risk, pick_count, selected[0], …, selected[9])`.
|
|
288
|
+
*
|
|
289
|
+
* Selected numbers are sorted internally for deterministic output.
|
|
290
|
+
* Unused slots (when pick_count < 10) are filled with 0.
|
|
291
|
+
*
|
|
292
|
+
* Returns `BigUint64Array` of length 4 (one `HashOut`).
|
|
293
|
+
* @param {number} game_id
|
|
294
|
+
* @param {number} risk
|
|
295
|
+
* @param {number} pick_count
|
|
296
|
+
* @param {Uint8Array} selected
|
|
297
|
+
* @returns {BigUint64Array}
|
|
298
|
+
*/
|
|
299
|
+
function compute_prediction_hash_keno(game_id, risk, pick_count, selected) {
|
|
300
|
+
try {
|
|
301
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
302
|
+
const ptr0 = passArray8ToWasm0(selected, wasm.__wbindgen_export3);
|
|
303
|
+
const len0 = WASM_VECTOR_LEN;
|
|
304
|
+
wasm.compute_prediction_hash_keno(retptr, game_id, risk, pick_count, ptr0, len0);
|
|
305
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
306
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
307
|
+
var v2 = getArrayU64FromWasm0(r0, r1).slice();
|
|
308
|
+
wasm.__wbindgen_export2(r0, r1 * 8, 8);
|
|
309
|
+
return v2;
|
|
310
|
+
} finally {
|
|
311
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
exports.compute_prediction_hash_keno = compute_prediction_hash_keno;
|
|
315
|
+
|
|
227
316
|
/**
|
|
228
317
|
* Extract coinflip roll (0 or 1) from Poseidon2 random output.
|
|
229
318
|
*
|
|
@@ -255,19 +344,17 @@ function compute_roll_dice(random) {
|
|
|
255
344
|
exports.compute_roll_dice = compute_roll_dice;
|
|
256
345
|
|
|
257
346
|
/**
|
|
258
|
-
* Extract limbo result multiplier
|
|
347
|
+
* Extract limbo result multiplier x 100 from Poseidon2 random output.
|
|
259
348
|
*
|
|
260
349
|
* `random` must be exactly 4 elements.
|
|
261
|
-
*
|
|
262
|
-
* Returns the clamped multiplier × 100 (101..999999).
|
|
350
|
+
* Returns the clamped multiplier x 100 (101..999999).
|
|
263
351
|
* @param {BigUint64Array} random
|
|
264
|
-
* @param {number} rtp_numer
|
|
265
352
|
* @returns {number}
|
|
266
353
|
*/
|
|
267
|
-
function compute_roll_limbo(random
|
|
354
|
+
function compute_roll_limbo(random) {
|
|
268
355
|
const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
|
|
269
356
|
const len0 = WASM_VECTOR_LEN;
|
|
270
|
-
const ret = wasm.compute_roll_limbo(ptr0, len0
|
|
357
|
+
const ret = wasm.compute_roll_limbo(ptr0, len0);
|
|
271
358
|
return ret >>> 0;
|
|
272
359
|
}
|
|
273
360
|
exports.compute_roll_limbo = compute_roll_limbo;
|
|
Binary file
|
|
@@ -3,15 +3,18 @@
|
|
|
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;
|
|
9
|
-
export const
|
|
10
|
+
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) => 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
|
-
export const compute_roll_limbo: (a: number, b: number
|
|
17
|
+
export const compute_roll_limbo: (a: number, b: number) => number;
|
|
15
18
|
export const compute_roll_plinko: (a: number, b: number, c: number) => number;
|
|
16
19
|
export const compute_server_seed_hash: (a: number, b: number, c: number) => void;
|
|
17
20
|
export const compute_user_seed_binding: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number) => void;
|
|
@@ -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,17 +58,28 @@ 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
|
*
|
|
55
76
|
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
56
77
|
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
57
|
-
* `prediction_x100`: target multiplier
|
|
58
|
-
* `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
|
|
78
|
+
* `prediction_x100`: target multiplier x 100 (101..999999, i.e. 1.01x-9999.99x).
|
|
59
79
|
*
|
|
60
|
-
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier
|
|
80
|
+
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier x10000]`.
|
|
61
81
|
*/
|
|
62
|
-
export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number
|
|
82
|
+
export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number): BigUint64Array;
|
|
63
83
|
|
|
64
84
|
/**
|
|
65
85
|
* Full plinko payout computation — pure integer arithmetic, zero floats.
|
|
@@ -81,13 +101,24 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
|
|
|
81
101
|
* and the in-circuit `build_prediction_hash`.
|
|
82
102
|
*
|
|
83
103
|
* Semantics of p0–p2 depend on the game:
|
|
84
|
-
* Limbo: `(
|
|
104
|
+
* Limbo: `(99, prediction_x100, 0)` — RTP hardcoded at 99
|
|
85
105
|
* Dice: `(mode, pred_lo, pred_hi)`
|
|
86
106
|
* Plinko: `(sector, rows, is_extreme)`
|
|
87
107
|
* CoinFlip: `(prediction, 0, 0)`
|
|
88
108
|
*/
|
|
89
109
|
export function compute_prediction_hash(game_id: number, p0: number, p1: number, p2: number): BigUint64Array;
|
|
90
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Compute Keno prediction hash with extended 13-input format:
|
|
113
|
+
* `Poseidon2(game_id, risk, pick_count, selected[0], …, selected[9])`.
|
|
114
|
+
*
|
|
115
|
+
* Selected numbers are sorted internally for deterministic output.
|
|
116
|
+
* Unused slots (when pick_count < 10) are filled with 0.
|
|
117
|
+
*
|
|
118
|
+
* Returns `BigUint64Array` of length 4 (one `HashOut`).
|
|
119
|
+
*/
|
|
120
|
+
export function compute_prediction_hash_keno(game_id: number, risk: number, pick_count: number, selected: Uint8Array): BigUint64Array;
|
|
121
|
+
|
|
91
122
|
/**
|
|
92
123
|
* Extract coinflip roll (0 or 1) from Poseidon2 random output.
|
|
93
124
|
*
|
|
@@ -103,13 +134,12 @@ export function compute_roll_coinflip(random: BigUint64Array): number;
|
|
|
103
134
|
export function compute_roll_dice(random: BigUint64Array): number;
|
|
104
135
|
|
|
105
136
|
/**
|
|
106
|
-
* Extract limbo result multiplier
|
|
137
|
+
* Extract limbo result multiplier x 100 from Poseidon2 random output.
|
|
107
138
|
*
|
|
108
139
|
* `random` must be exactly 4 elements.
|
|
109
|
-
*
|
|
110
|
-
* Returns the clamped multiplier × 100 (101..999999).
|
|
140
|
+
* Returns the clamped multiplier x 100 (101..999999).
|
|
111
141
|
*/
|
|
112
|
-
export function compute_roll_limbo(random: BigUint64Array
|
|
142
|
+
export function compute_roll_limbo(random: BigUint64Array): number;
|
|
113
143
|
|
|
114
144
|
/**
|
|
115
145
|
* Extract plinko bucket index from Poseidon2 random output.
|