@rolly-dev/wasm-signer 1.28.1 → 1.29.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 +63 -13
- package/dist/node/rolly_wasm_signer.js +133 -14
- package/dist/node/rolly_wasm_signer_bg.wasm +0 -0
- package/dist/node/rolly_wasm_signer_bg.wasm.d.ts +5 -0
- package/dist/node-inline/rolly_wasm_signer.d.ts +63 -13
- package/dist/node-inline/rolly_wasm_signer.js +134 -15
- package/dist/node-inline/rolly_wasm_signer.mjs +130 -16
- package/dist/node-inline/rolly_wasm_signer_bg.wasm.d.ts +5 -0
- package/dist/web/rolly_wasm_signer.d.ts +68 -13
- package/dist/web/rolly_wasm_signer.js +128 -14
- package/dist/web/rolly_wasm_signer_bg.wasm +0 -0
- package/dist/web/rolly_wasm_signer_bg.wasm.d.ts +5 -0
- package/js/browser.mjs +5 -0
- package/js/index.d.ts +5 -0
- package/js/node-inline.cjs +5 -0
- package/js/node-inline.mjs +5 -0
- package/js/node.cjs +5 -0
- package/js/node.mjs +5 -0
- package/js/react.mjs +10 -0
- package/package.json +1 -1
|
@@ -13,10 +13,45 @@
|
|
|
13
13
|
export function amount_split(amount: bigint): Uint32Array;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Backward-compatible alias for `crash_rtp_percent`.
|
|
17
17
|
*/
|
|
18
18
|
export function aviato_rtp_percent(): number;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Reconstruct the 30 dealt Blackjack rank codes from the fairness seeds.
|
|
22
|
+
*
|
|
23
|
+
* This is the SINGLE client/backend-side mirror of the native shoe unfold in
|
|
24
|
+
* `tx_validator::blackjack::unfold_shoe` and the in-circuit shuffle: it computes
|
|
25
|
+
* `mix = Poseidon2(server_seed ‖ user_secret_random)` and the per-step swap
|
|
26
|
+
* randomness `low32(Poseidon2(mix ‖ k))`, then defers the deterministic
|
|
27
|
+
* 30-swap partial Fisher–Yates over the fixed 416-card layout to the pure
|
|
28
|
+
* `rolly_game_core::blackjack::deal_shoe`. Mixing the player-chosen
|
|
29
|
+
* `user_secret_random` into the seed makes the shuffle a mutual commit–reveal,
|
|
30
|
+
* so neither the operator nor the player can pre-grind a shoe.
|
|
31
|
+
*
|
|
32
|
+
* `server_seed` must be 8 elements (the full fairness preimage); `user_secret_random`
|
|
33
|
+
* must be 4 elements (`string_to_user_seed(user_seed_source)`).
|
|
34
|
+
*
|
|
35
|
+
* **Output**: `Uint8Array` of length 30 — rank codes `0..=12` (Ace=0, 2..9=1..8,
|
|
36
|
+
* 10/J/Q/K=9..12). Suits are cosmetic and restored off-engine.
|
|
37
|
+
*
|
|
38
|
+
* ```js
|
|
39
|
+
* const shoe = blackjack_deal_shoe(serverSeed8, userSecret4); // length 30
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function blackjack_deal_shoe(server_seed: BigUint64Array, user_secret_random: BigUint64Array): Uint8Array;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Pack a Blackjack action sequence into the two base-8 halves the rollup records
|
|
46
|
+
* as `prediction_lo` / `prediction_hi` (`actions[0..10]` → lo, `actions[10..20]`
|
|
47
|
+
* → hi). Single-sources `rolly_game_core::blackjack::pack_actions` so the
|
|
48
|
+
* backend feeds the WitnessEngine exactly what the circuit re-derives.
|
|
49
|
+
*
|
|
50
|
+
* `actions` are the `ACTION_*` codes (1..=6). **Output**: `Uint32Array` of
|
|
51
|
+
* length 2 = `[prediction_lo, prediction_hi]`.
|
|
52
|
+
*/
|
|
53
|
+
export function blackjack_pack_actions(actions: Uint8Array): Uint32Array;
|
|
54
|
+
|
|
20
55
|
/**
|
|
21
56
|
* CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
|
|
22
57
|
*/
|
|
@@ -34,12 +69,17 @@ export function coinflip_rtp_percent(): number;
|
|
|
34
69
|
export function compute_address_hash(address_hex: string): BigUint64Array;
|
|
35
70
|
|
|
36
71
|
/**
|
|
37
|
-
*
|
|
72
|
+
* Backward-compatible alias for `compute_crash_point`.
|
|
73
|
+
*/
|
|
74
|
+
export function compute_aviato_point(random: BigUint64Array): number;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Extract crash point (×100) from raw server seed fields.
|
|
38
78
|
*
|
|
39
79
|
* `random` must be exactly 4 elements (first 4 fields of server_seed).
|
|
40
|
-
* Returns the clamped
|
|
80
|
+
* Returns the clamped crash multiplier ×100 (100..=1_000_000, i.e. 1.00x..10000.00x).
|
|
41
81
|
*/
|
|
42
|
-
export function
|
|
82
|
+
export function compute_crash_point(random: BigUint64Array): number;
|
|
43
83
|
|
|
44
84
|
/**
|
|
45
85
|
* Extract the 10 drawn numbers from Poseidon2 random output using
|
|
@@ -59,15 +99,7 @@ export function compute_drawn_keno(random: BigUint64Array): Uint8Array;
|
|
|
59
99
|
export function compute_multi_dice(win_numbers: number): bigint;
|
|
60
100
|
|
|
61
101
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* `random`: 4 Goldilocks field elements (first 4 fields of raw server_seed).
|
|
65
|
-
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
66
|
-
* `cashout_x100`: multiplier at which the user cashed out (×100).
|
|
67
|
-
* - 0 = user did NOT cash out (loss).
|
|
68
|
-
* - 100..=1_000_000 = user stopped at this multiplier.
|
|
69
|
-
*
|
|
70
|
-
* Returns `BigUint64Array[4]`: `[win_amount, aviato_x100, is_win (0|1), multiplier×10000]`.
|
|
102
|
+
* Backward-compatible alias for `compute_payout_crash`.
|
|
71
103
|
*/
|
|
72
104
|
export function compute_payout_aviato(random: BigUint64Array, bet_atomic: bigint, cashout_x100: number): BigUint64Array;
|
|
73
105
|
|
|
@@ -82,6 +114,19 @@ export function compute_payout_aviato(random: BigUint64Array, bet_atomic: bigint
|
|
|
82
114
|
*/
|
|
83
115
|
export function compute_payout_coinflip(random: BigUint64Array, bet_atomic: bigint, prediction: number): BigUint64Array;
|
|
84
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Full crash payout computation — pure integer arithmetic, zero floats.
|
|
119
|
+
*
|
|
120
|
+
* `random`: 4 Goldilocks field elements (first 4 fields of raw server_seed).
|
|
121
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
122
|
+
* `cashout_x100`: multiplier at which the user cashed out (×100).
|
|
123
|
+
* - 0 = user did NOT cash out (loss).
|
|
124
|
+
* - 100..=1_000_000 = user stopped at this multiplier.
|
|
125
|
+
*
|
|
126
|
+
* Returns `BigUint64Array[4]`: `[win_amount, crash_x100, is_win (0|1), multiplier×10000]`.
|
|
127
|
+
*/
|
|
128
|
+
export function compute_payout_crash(random: BigUint64Array, bet_atomic: bigint, cashout_x100: number): BigUint64Array;
|
|
129
|
+
|
|
85
130
|
/**
|
|
86
131
|
* Full dice payout computation — pure integer arithmetic, zero floats.
|
|
87
132
|
*
|
|
@@ -211,6 +256,11 @@ export function compute_server_seed_hash(server_seed: BigUint64Array): BigUint64
|
|
|
211
256
|
*/
|
|
212
257
|
export function compute_user_seed_binding(game_id: number, bet: bigint, pred_hash: BigUint64Array, secret: BigUint64Array): BigUint64Array;
|
|
213
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Crash RTP percent (99). Canonical source for backend/frontend.
|
|
261
|
+
*/
|
|
262
|
+
export function crash_rtp_percent(): number;
|
|
263
|
+
|
|
214
264
|
/**
|
|
215
265
|
* Derive a session key from 32 bytes of entropy (e.g. MetaMask signature).
|
|
216
266
|
*
|
|
@@ -27,7 +27,7 @@ function amount_split(amount) {
|
|
|
27
27
|
exports.amount_split = amount_split;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Backward-compatible alias for `crash_rtp_percent`.
|
|
31
31
|
* @returns {number}
|
|
32
32
|
*/
|
|
33
33
|
function aviato_rtp_percent() {
|
|
@@ -36,6 +36,78 @@ function aviato_rtp_percent() {
|
|
|
36
36
|
}
|
|
37
37
|
exports.aviato_rtp_percent = aviato_rtp_percent;
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Reconstruct the 30 dealt Blackjack rank codes from the fairness seeds.
|
|
41
|
+
*
|
|
42
|
+
* This is the SINGLE client/backend-side mirror of the native shoe unfold in
|
|
43
|
+
* `tx_validator::blackjack::unfold_shoe` and the in-circuit shuffle: it computes
|
|
44
|
+
* `mix = Poseidon2(server_seed ‖ user_secret_random)` and the per-step swap
|
|
45
|
+
* randomness `low32(Poseidon2(mix ‖ k))`, then defers the deterministic
|
|
46
|
+
* 30-swap partial Fisher–Yates over the fixed 416-card layout to the pure
|
|
47
|
+
* `rolly_game_core::blackjack::deal_shoe`. Mixing the player-chosen
|
|
48
|
+
* `user_secret_random` into the seed makes the shuffle a mutual commit–reveal,
|
|
49
|
+
* so neither the operator nor the player can pre-grind a shoe.
|
|
50
|
+
*
|
|
51
|
+
* `server_seed` must be 8 elements (the full fairness preimage); `user_secret_random`
|
|
52
|
+
* must be 4 elements (`string_to_user_seed(user_seed_source)`).
|
|
53
|
+
*
|
|
54
|
+
* **Output**: `Uint8Array` of length 30 — rank codes `0..=12` (Ace=0, 2..9=1..8,
|
|
55
|
+
* 10/J/Q/K=9..12). Suits are cosmetic and restored off-engine.
|
|
56
|
+
*
|
|
57
|
+
* ```js
|
|
58
|
+
* const shoe = blackjack_deal_shoe(serverSeed8, userSecret4); // length 30
|
|
59
|
+
* ```
|
|
60
|
+
* @param {BigUint64Array} server_seed
|
|
61
|
+
* @param {BigUint64Array} user_secret_random
|
|
62
|
+
* @returns {Uint8Array}
|
|
63
|
+
*/
|
|
64
|
+
function blackjack_deal_shoe(server_seed, user_secret_random) {
|
|
65
|
+
try {
|
|
66
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
67
|
+
const ptr0 = passArray64ToWasm0(server_seed, wasm.__wbindgen_export);
|
|
68
|
+
const len0 = WASM_VECTOR_LEN;
|
|
69
|
+
const ptr1 = passArray64ToWasm0(user_secret_random, wasm.__wbindgen_export);
|
|
70
|
+
const len1 = WASM_VECTOR_LEN;
|
|
71
|
+
wasm.blackjack_deal_shoe(retptr, ptr0, len0, ptr1, len1);
|
|
72
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
73
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
74
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
75
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
76
|
+
return v3;
|
|
77
|
+
} finally {
|
|
78
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.blackjack_deal_shoe = blackjack_deal_shoe;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Pack a Blackjack action sequence into the two base-8 halves the rollup records
|
|
85
|
+
* as `prediction_lo` / `prediction_hi` (`actions[0..10]` → lo, `actions[10..20]`
|
|
86
|
+
* → hi). Single-sources `rolly_game_core::blackjack::pack_actions` so the
|
|
87
|
+
* backend feeds the WitnessEngine exactly what the circuit re-derives.
|
|
88
|
+
*
|
|
89
|
+
* `actions` are the `ACTION_*` codes (1..=6). **Output**: `Uint32Array` of
|
|
90
|
+
* length 2 = `[prediction_lo, prediction_hi]`.
|
|
91
|
+
* @param {Uint8Array} actions
|
|
92
|
+
* @returns {Uint32Array}
|
|
93
|
+
*/
|
|
94
|
+
function blackjack_pack_actions(actions) {
|
|
95
|
+
try {
|
|
96
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
97
|
+
const ptr0 = passArray8ToWasm0(actions, wasm.__wbindgen_export);
|
|
98
|
+
const len0 = WASM_VECTOR_LEN;
|
|
99
|
+
wasm.blackjack_pack_actions(retptr, ptr0, len0);
|
|
100
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
101
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
102
|
+
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
103
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
104
|
+
return v2;
|
|
105
|
+
} finally {
|
|
106
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.blackjack_pack_actions = blackjack_pack_actions;
|
|
110
|
+
|
|
39
111
|
/**
|
|
40
112
|
* CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
|
|
41
113
|
* @returns {number}
|
|
@@ -80,10 +152,7 @@ function compute_address_hash(address_hex) {
|
|
|
80
152
|
exports.compute_address_hash = compute_address_hash;
|
|
81
153
|
|
|
82
154
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* `random` must be exactly 4 elements (first 4 fields of server_seed).
|
|
86
|
-
* Returns the clamped aviato multiplier ×100 (100..=1_000_000, i.e. 1.00x..10000.00x).
|
|
155
|
+
* Backward-compatible alias for `compute_crash_point`.
|
|
87
156
|
* @param {BigUint64Array} random
|
|
88
157
|
* @returns {number}
|
|
89
158
|
*/
|
|
@@ -95,6 +164,22 @@ function compute_aviato_point(random) {
|
|
|
95
164
|
}
|
|
96
165
|
exports.compute_aviato_point = compute_aviato_point;
|
|
97
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Extract crash point (×100) from raw server seed fields.
|
|
169
|
+
*
|
|
170
|
+
* `random` must be exactly 4 elements (first 4 fields of server_seed).
|
|
171
|
+
* Returns the clamped crash multiplier ×100 (100..=1_000_000, i.e. 1.00x..10000.00x).
|
|
172
|
+
* @param {BigUint64Array} random
|
|
173
|
+
* @returns {number}
|
|
174
|
+
*/
|
|
175
|
+
function compute_crash_point(random) {
|
|
176
|
+
const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export);
|
|
177
|
+
const len0 = WASM_VECTOR_LEN;
|
|
178
|
+
const ret = wasm.compute_crash_point(ptr0, len0);
|
|
179
|
+
return ret >>> 0;
|
|
180
|
+
}
|
|
181
|
+
exports.compute_crash_point = compute_crash_point;
|
|
182
|
+
|
|
98
183
|
/**
|
|
99
184
|
* Extract the 10 drawn numbers from Poseidon2 random output using
|
|
100
185
|
* the combinatorial number system: `combo_index = random[0] % C(40,10)`.
|
|
@@ -136,15 +221,7 @@ function compute_multi_dice(win_numbers) {
|
|
|
136
221
|
exports.compute_multi_dice = compute_multi_dice;
|
|
137
222
|
|
|
138
223
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* `random`: 4 Goldilocks field elements (first 4 fields of raw server_seed).
|
|
142
|
-
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
143
|
-
* `cashout_x100`: multiplier at which the user cashed out (×100).
|
|
144
|
-
* - 0 = user did NOT cash out (loss).
|
|
145
|
-
* - 100..=1_000_000 = user stopped at this multiplier.
|
|
146
|
-
*
|
|
147
|
-
* Returns `BigUint64Array[4]`: `[win_amount, aviato_x100, is_win (0|1), multiplier×10000]`.
|
|
224
|
+
* Backward-compatible alias for `compute_payout_crash`.
|
|
148
225
|
* @param {BigUint64Array} random
|
|
149
226
|
* @param {bigint} bet_atomic
|
|
150
227
|
* @param {number} cashout_x100
|
|
@@ -197,6 +274,38 @@ function compute_payout_coinflip(random, bet_atomic, prediction) {
|
|
|
197
274
|
}
|
|
198
275
|
exports.compute_payout_coinflip = compute_payout_coinflip;
|
|
199
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Full crash payout computation — pure integer arithmetic, zero floats.
|
|
279
|
+
*
|
|
280
|
+
* `random`: 4 Goldilocks field elements (first 4 fields of raw server_seed).
|
|
281
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
282
|
+
* `cashout_x100`: multiplier at which the user cashed out (×100).
|
|
283
|
+
* - 0 = user did NOT cash out (loss).
|
|
284
|
+
* - 100..=1_000_000 = user stopped at this multiplier.
|
|
285
|
+
*
|
|
286
|
+
* Returns `BigUint64Array[4]`: `[win_amount, crash_x100, is_win (0|1), multiplier×10000]`.
|
|
287
|
+
* @param {BigUint64Array} random
|
|
288
|
+
* @param {bigint} bet_atomic
|
|
289
|
+
* @param {number} cashout_x100
|
|
290
|
+
* @returns {BigUint64Array}
|
|
291
|
+
*/
|
|
292
|
+
function compute_payout_crash(random, bet_atomic, cashout_x100) {
|
|
293
|
+
try {
|
|
294
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
295
|
+
const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export);
|
|
296
|
+
const len0 = WASM_VECTOR_LEN;
|
|
297
|
+
wasm.compute_payout_crash(retptr, ptr0, len0, bet_atomic, cashout_x100);
|
|
298
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
299
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
300
|
+
var v2 = getArrayU64FromWasm0(r0, r1).slice();
|
|
301
|
+
wasm.__wbindgen_export4(r0, r1 * 8, 8);
|
|
302
|
+
return v2;
|
|
303
|
+
} finally {
|
|
304
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
exports.compute_payout_crash = compute_payout_crash;
|
|
308
|
+
|
|
200
309
|
/**
|
|
201
310
|
* Full dice payout computation — pure integer arithmetic, zero floats.
|
|
202
311
|
*
|
|
@@ -519,6 +628,16 @@ function compute_user_seed_binding(game_id, bet, pred_hash, secret) {
|
|
|
519
628
|
}
|
|
520
629
|
exports.compute_user_seed_binding = compute_user_seed_binding;
|
|
521
630
|
|
|
631
|
+
/**
|
|
632
|
+
* Crash RTP percent (99). Canonical source for backend/frontend.
|
|
633
|
+
* @returns {number}
|
|
634
|
+
*/
|
|
635
|
+
function crash_rtp_percent() {
|
|
636
|
+
const ret = wasm.aviato_rtp_percent();
|
|
637
|
+
return ret >>> 0;
|
|
638
|
+
}
|
|
639
|
+
exports.crash_rtp_percent = crash_rtp_percent;
|
|
640
|
+
|
|
522
641
|
/**
|
|
523
642
|
* Derive a session key from 32 bytes of entropy (e.g. MetaMask signature).
|
|
524
643
|
*
|
|
Binary file
|
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const amount_split: (a: number, b: bigint) => void;
|
|
5
5
|
export const aviato_rtp_percent: () => number;
|
|
6
|
+
export const blackjack_deal_shoe: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
7
|
+
export const blackjack_pack_actions: (a: number, b: number, c: number) => void;
|
|
6
8
|
export const coinflip_multiplier_x10000: () => number;
|
|
7
9
|
export const compute_address_hash: (a: number, b: number, c: number) => void;
|
|
8
10
|
export const compute_aviato_point: (a: number, b: number) => number;
|
|
11
|
+
export const compute_crash_point: (a: number, b: number) => number;
|
|
9
12
|
export const compute_drawn_keno: (a: number, b: number, c: number) => void;
|
|
10
13
|
export const compute_multi_dice: (a: number) => bigint;
|
|
11
14
|
export const compute_payout_aviato: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
12
15
|
export const compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
16
|
+
export const compute_payout_crash: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
13
17
|
export const compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
|
|
14
18
|
export const compute_payout_keno: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
|
|
15
19
|
export const compute_payout_limbo: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
@@ -53,6 +57,7 @@ export const string_to_user_seed: (a: number, b: number, c: number) => void;
|
|
|
53
57
|
export const string_to_user_seed_hex: (a: number, b: number, c: number) => void;
|
|
54
58
|
export const validate_slot: (a: number, b: number) => void;
|
|
55
59
|
export const coinflip_rtp_percent: () => number;
|
|
60
|
+
export const crash_rtp_percent: () => number;
|
|
56
61
|
export const dice_rtp_percent: () => number;
|
|
57
62
|
export const keno_max_picks: () => number;
|
|
58
63
|
export const goldilocks_modulus: () => bigint;
|
|
@@ -13,10 +13,45 @@
|
|
|
13
13
|
export function amount_split(amount: bigint): Uint32Array;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Backward-compatible alias for `crash_rtp_percent`.
|
|
17
17
|
*/
|
|
18
18
|
export function aviato_rtp_percent(): number;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Reconstruct the 30 dealt Blackjack rank codes from the fairness seeds.
|
|
22
|
+
*
|
|
23
|
+
* This is the SINGLE client/backend-side mirror of the native shoe unfold in
|
|
24
|
+
* `tx_validator::blackjack::unfold_shoe` and the in-circuit shuffle: it computes
|
|
25
|
+
* `mix = Poseidon2(server_seed ‖ user_secret_random)` and the per-step swap
|
|
26
|
+
* randomness `low32(Poseidon2(mix ‖ k))`, then defers the deterministic
|
|
27
|
+
* 30-swap partial Fisher–Yates over the fixed 416-card layout to the pure
|
|
28
|
+
* `rolly_game_core::blackjack::deal_shoe`. Mixing the player-chosen
|
|
29
|
+
* `user_secret_random` into the seed makes the shuffle a mutual commit–reveal,
|
|
30
|
+
* so neither the operator nor the player can pre-grind a shoe.
|
|
31
|
+
*
|
|
32
|
+
* `server_seed` must be 8 elements (the full fairness preimage); `user_secret_random`
|
|
33
|
+
* must be 4 elements (`string_to_user_seed(user_seed_source)`).
|
|
34
|
+
*
|
|
35
|
+
* **Output**: `Uint8Array` of length 30 — rank codes `0..=12` (Ace=0, 2..9=1..8,
|
|
36
|
+
* 10/J/Q/K=9..12). Suits are cosmetic and restored off-engine.
|
|
37
|
+
*
|
|
38
|
+
* ```js
|
|
39
|
+
* const shoe = blackjack_deal_shoe(serverSeed8, userSecret4); // length 30
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function blackjack_deal_shoe(server_seed: BigUint64Array, user_secret_random: BigUint64Array): Uint8Array;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Pack a Blackjack action sequence into the two base-8 halves the rollup records
|
|
46
|
+
* as `prediction_lo` / `prediction_hi` (`actions[0..10]` → lo, `actions[10..20]`
|
|
47
|
+
* → hi). Single-sources `rolly_game_core::blackjack::pack_actions` so the
|
|
48
|
+
* backend feeds the WitnessEngine exactly what the circuit re-derives.
|
|
49
|
+
*
|
|
50
|
+
* `actions` are the `ACTION_*` codes (1..=6). **Output**: `Uint32Array` of
|
|
51
|
+
* length 2 = `[prediction_lo, prediction_hi]`.
|
|
52
|
+
*/
|
|
53
|
+
export function blackjack_pack_actions(actions: Uint8Array): Uint32Array;
|
|
54
|
+
|
|
20
55
|
/**
|
|
21
56
|
* CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
|
|
22
57
|
*/
|
|
@@ -34,12 +69,17 @@ export function coinflip_rtp_percent(): number;
|
|
|
34
69
|
export function compute_address_hash(address_hex: string): BigUint64Array;
|
|
35
70
|
|
|
36
71
|
/**
|
|
37
|
-
*
|
|
72
|
+
* Backward-compatible alias for `compute_crash_point`.
|
|
73
|
+
*/
|
|
74
|
+
export function compute_aviato_point(random: BigUint64Array): number;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Extract crash point (×100) from raw server seed fields.
|
|
38
78
|
*
|
|
39
79
|
* `random` must be exactly 4 elements (first 4 fields of server_seed).
|
|
40
|
-
* Returns the clamped
|
|
80
|
+
* Returns the clamped crash multiplier ×100 (100..=1_000_000, i.e. 1.00x..10000.00x).
|
|
41
81
|
*/
|
|
42
|
-
export function
|
|
82
|
+
export function compute_crash_point(random: BigUint64Array): number;
|
|
43
83
|
|
|
44
84
|
/**
|
|
45
85
|
* Extract the 10 drawn numbers from Poseidon2 random output using
|
|
@@ -59,15 +99,7 @@ export function compute_drawn_keno(random: BigUint64Array): Uint8Array;
|
|
|
59
99
|
export function compute_multi_dice(win_numbers: number): bigint;
|
|
60
100
|
|
|
61
101
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* `random`: 4 Goldilocks field elements (first 4 fields of raw server_seed).
|
|
65
|
-
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
66
|
-
* `cashout_x100`: multiplier at which the user cashed out (×100).
|
|
67
|
-
* - 0 = user did NOT cash out (loss).
|
|
68
|
-
* - 100..=1_000_000 = user stopped at this multiplier.
|
|
69
|
-
*
|
|
70
|
-
* Returns `BigUint64Array[4]`: `[win_amount, aviato_x100, is_win (0|1), multiplier×10000]`.
|
|
102
|
+
* Backward-compatible alias for `compute_payout_crash`.
|
|
71
103
|
*/
|
|
72
104
|
export function compute_payout_aviato(random: BigUint64Array, bet_atomic: bigint, cashout_x100: number): BigUint64Array;
|
|
73
105
|
|
|
@@ -82,6 +114,19 @@ export function compute_payout_aviato(random: BigUint64Array, bet_atomic: bigint
|
|
|
82
114
|
*/
|
|
83
115
|
export function compute_payout_coinflip(random: BigUint64Array, bet_atomic: bigint, prediction: number): BigUint64Array;
|
|
84
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Full crash payout computation — pure integer arithmetic, zero floats.
|
|
119
|
+
*
|
|
120
|
+
* `random`: 4 Goldilocks field elements (first 4 fields of raw server_seed).
|
|
121
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
122
|
+
* `cashout_x100`: multiplier at which the user cashed out (×100).
|
|
123
|
+
* - 0 = user did NOT cash out (loss).
|
|
124
|
+
* - 100..=1_000_000 = user stopped at this multiplier.
|
|
125
|
+
*
|
|
126
|
+
* Returns `BigUint64Array[4]`: `[win_amount, crash_x100, is_win (0|1), multiplier×10000]`.
|
|
127
|
+
*/
|
|
128
|
+
export function compute_payout_crash(random: BigUint64Array, bet_atomic: bigint, cashout_x100: number): BigUint64Array;
|
|
129
|
+
|
|
85
130
|
/**
|
|
86
131
|
* Full dice payout computation — pure integer arithmetic, zero floats.
|
|
87
132
|
*
|
|
@@ -211,6 +256,11 @@ export function compute_server_seed_hash(server_seed: BigUint64Array): BigUint64
|
|
|
211
256
|
*/
|
|
212
257
|
export function compute_user_seed_binding(game_id: number, bet: bigint, pred_hash: BigUint64Array, secret: BigUint64Array): BigUint64Array;
|
|
213
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Crash RTP percent (99). Canonical source for backend/frontend.
|
|
261
|
+
*/
|
|
262
|
+
export function crash_rtp_percent(): number;
|
|
263
|
+
|
|
214
264
|
/**
|
|
215
265
|
* Derive a session key from 32 bytes of entropy (e.g. MetaMask signature).
|
|
216
266
|
*
|