@rolly-dev/wasm-signer 1.29.0 → 1.31.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.
@@ -103,6 +103,34 @@ export function compute_multi_dice(win_numbers: number): bigint;
103
103
  */
104
104
  export function compute_payout_aviato(random: BigUint64Array, bet_atomic: bigint, cashout_x100: number): BigUint64Array;
105
105
 
106
+ /**
107
+ * Client-side provably-fair verification of a full Blackjack round.
108
+ *
109
+ * Reconstructs the fair shoe from `(server_seed ‖ user_secret_random)` (see
110
+ * [`blackjack_deal_shoe`]), decodes the base-8 `prediction_lo` / `prediction_hi`
111
+ * action halves, and replays the exact same state machine the circuit and the
112
+ * tx-validator run (`rolly_game_core::blackjack::replay_full`). This lets a
113
+ * player independently confirm the settled `win`/`bet` off-chain; it is NOT on
114
+ * the tx/settlement path.
115
+ *
116
+ * `server_seed` must be 8 elements (the revealed fairness preimage);
117
+ * `user_secret_random` must be 4 elements (`string_to_user_seed(...)`).
118
+ * `base_bet` is the base stake in atomic units. The returned `total_staked`
119
+ * grows with double/split/insurance exactly as the engine books them.
120
+ *
121
+ * **Output**: a JS object matching [`BlackjackVerifyResult`].
122
+ *
123
+ * Returns an error if the decoded action list contains an invalid code
124
+ * (outside `1..=6`), mirroring the tx-validator's typed rejection.
125
+ *
126
+ * ```js
127
+ * const res = compute_payout_blackjack(serverSeed8, userSecret4, lo, hi, betAtomic);
128
+ * // res.win_amount, res.total_staked, res.shoe (length 30),
129
+ * // res.first_cards / res.second_cards / res.dealer_cards (rank codes), ...
130
+ * ```
131
+ */
132
+ export function compute_payout_blackjack(server_seed: BigUint64Array, user_secret_random: BigUint64Array, prediction_lo: number, prediction_hi: number, base_bet: bigint): any;
133
+
106
134
  /**
107
135
  * Full coinflip payout computation — pure integer arithmetic, zero floats.
108
136
  *
@@ -244,6 +244,59 @@ function compute_payout_aviato(random, bet_atomic, cashout_x100) {
244
244
  }
245
245
  exports.compute_payout_aviato = compute_payout_aviato;
246
246
 
247
+ /**
248
+ * Client-side provably-fair verification of a full Blackjack round.
249
+ *
250
+ * Reconstructs the fair shoe from `(server_seed ‖ user_secret_random)` (see
251
+ * [`blackjack_deal_shoe`]), decodes the base-8 `prediction_lo` / `prediction_hi`
252
+ * action halves, and replays the exact same state machine the circuit and the
253
+ * tx-validator run (`rolly_game_core::blackjack::replay_full`). This lets a
254
+ * player independently confirm the settled `win`/`bet` off-chain; it is NOT on
255
+ * the tx/settlement path.
256
+ *
257
+ * `server_seed` must be 8 elements (the revealed fairness preimage);
258
+ * `user_secret_random` must be 4 elements (`string_to_user_seed(...)`).
259
+ * `base_bet` is the base stake in atomic units. The returned `total_staked`
260
+ * grows with double/split/insurance exactly as the engine books them.
261
+ *
262
+ * **Output**: a JS object matching [`BlackjackVerifyResult`].
263
+ *
264
+ * Returns an error if the decoded action list contains an invalid code
265
+ * (outside `1..=6`), mirroring the tx-validator's typed rejection.
266
+ *
267
+ * ```js
268
+ * const res = compute_payout_blackjack(serverSeed8, userSecret4, lo, hi, betAtomic);
269
+ * // res.win_amount, res.total_staked, res.shoe (length 30),
270
+ * // res.first_cards / res.second_cards / res.dealer_cards (rank codes), ...
271
+ * ```
272
+ * @param {BigUint64Array} server_seed
273
+ * @param {BigUint64Array} user_secret_random
274
+ * @param {number} prediction_lo
275
+ * @param {number} prediction_hi
276
+ * @param {bigint} base_bet
277
+ * @returns {any}
278
+ */
279
+ function compute_payout_blackjack(server_seed, user_secret_random, prediction_lo, prediction_hi, base_bet) {
280
+ try {
281
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
282
+ const ptr0 = passArray64ToWasm0(server_seed, wasm.__wbindgen_export);
283
+ const len0 = WASM_VECTOR_LEN;
284
+ const ptr1 = passArray64ToWasm0(user_secret_random, wasm.__wbindgen_export);
285
+ const len1 = WASM_VECTOR_LEN;
286
+ wasm.compute_payout_blackjack(retptr, ptr0, len0, ptr1, len1, prediction_lo, prediction_hi, base_bet);
287
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
288
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
289
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
290
+ if (r2) {
291
+ throw takeObject(r1);
292
+ }
293
+ return takeObject(r0);
294
+ } finally {
295
+ wasm.__wbindgen_add_to_stack_pointer(16);
296
+ }
297
+ }
298
+ exports.compute_payout_blackjack = compute_payout_blackjack;
299
+
247
300
  /**
248
301
  * Full coinflip payout computation — pure integer arithmetic, zero floats.
249
302
  *
Binary file
@@ -12,6 +12,7 @@ export const compute_crash_point: (a: number, b: number) => number;
12
12
  export const compute_drawn_keno: (a: number, b: number, c: number) => void;
13
13
  export const compute_multi_dice: (a: number) => bigint;
14
14
  export const compute_payout_aviato: (a: number, b: number, c: number, d: bigint, e: number) => void;
15
+ export const compute_payout_blackjack: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint) => void;
15
16
  export const compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
16
17
  export const compute_payout_crash: (a: number, b: number, c: number, d: bigint, e: number) => void;
17
18
  export const compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
@@ -103,6 +103,34 @@ export function compute_multi_dice(win_numbers: number): bigint;
103
103
  */
104
104
  export function compute_payout_aviato(random: BigUint64Array, bet_atomic: bigint, cashout_x100: number): BigUint64Array;
105
105
 
106
+ /**
107
+ * Client-side provably-fair verification of a full Blackjack round.
108
+ *
109
+ * Reconstructs the fair shoe from `(server_seed ‖ user_secret_random)` (see
110
+ * [`blackjack_deal_shoe`]), decodes the base-8 `prediction_lo` / `prediction_hi`
111
+ * action halves, and replays the exact same state machine the circuit and the
112
+ * tx-validator run (`rolly_game_core::blackjack::replay_full`). This lets a
113
+ * player independently confirm the settled `win`/`bet` off-chain; it is NOT on
114
+ * the tx/settlement path.
115
+ *
116
+ * `server_seed` must be 8 elements (the revealed fairness preimage);
117
+ * `user_secret_random` must be 4 elements (`string_to_user_seed(...)`).
118
+ * `base_bet` is the base stake in atomic units. The returned `total_staked`
119
+ * grows with double/split/insurance exactly as the engine books them.
120
+ *
121
+ * **Output**: a JS object matching [`BlackjackVerifyResult`].
122
+ *
123
+ * Returns an error if the decoded action list contains an invalid code
124
+ * (outside `1..=6`), mirroring the tx-validator's typed rejection.
125
+ *
126
+ * ```js
127
+ * const res = compute_payout_blackjack(serverSeed8, userSecret4, lo, hi, betAtomic);
128
+ * // res.win_amount, res.total_staked, res.shoe (length 30),
129
+ * // res.first_cards / res.second_cards / res.dealer_cards (rank codes), ...
130
+ * ```
131
+ */
132
+ export function compute_payout_blackjack(server_seed: BigUint64Array, user_secret_random: BigUint64Array, prediction_lo: number, prediction_hi: number, base_bet: bigint): any;
133
+
106
134
  /**
107
135
  * Full coinflip payout computation — pure integer arithmetic, zero floats.
108
136
  *