@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.
- package/dist/node/rolly_wasm_signer.d.ts +28 -0
- package/dist/node/rolly_wasm_signer.js +53 -0
- package/dist/node/rolly_wasm_signer_bg.wasm +0 -0
- package/dist/node/rolly_wasm_signer_bg.wasm.d.ts +1 -0
- package/dist/node-inline/rolly_wasm_signer.d.ts +28 -0
- package/dist/node-inline/rolly_wasm_signer.js +54 -1
- package/dist/node-inline/rolly_wasm_signer.mjs +54 -2
- package/dist/node-inline/rolly_wasm_signer_bg.wasm.d.ts +1 -0
- package/dist/web/rolly_wasm_signer.d.ts +29 -0
- package/dist/web/rolly_wasm_signer.js +52 -0
- package/dist/web/rolly_wasm_signer_bg.wasm +0 -0
- package/dist/web/rolly_wasm_signer_bg.wasm.d.ts +1 -0
- package/js/browser.mjs +1 -0
- package/js/index.d.ts +1 -0
- package/js/node-inline.cjs +1 -0
- package/js/node-inline.mjs +1 -0
- package/js/node.cjs +1 -0
- package/js/node.mjs +1 -0
- package/js/react.mjs +2 -0
- package/package.json +1 -1
|
@@ -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
|
*
|
|
@@ -551,6 +579,7 @@ export interface InitOutput {
|
|
|
551
579
|
readonly compute_drawn_keno: (a: number, b: number, c: number) => void;
|
|
552
580
|
readonly compute_multi_dice: (a: number) => bigint;
|
|
553
581
|
readonly compute_payout_aviato: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
582
|
+
readonly compute_payout_blackjack: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint) => void;
|
|
554
583
|
readonly compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
555
584
|
readonly compute_payout_crash: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
556
585
|
readonly compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
|
|
@@ -232,6 +232,58 @@ export function compute_payout_aviato(random, bet_atomic, cashout_x100) {
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Client-side provably-fair verification of a full Blackjack round.
|
|
237
|
+
*
|
|
238
|
+
* Reconstructs the fair shoe from `(server_seed ‖ user_secret_random)` (see
|
|
239
|
+
* [`blackjack_deal_shoe`]), decodes the base-8 `prediction_lo` / `prediction_hi`
|
|
240
|
+
* action halves, and replays the exact same state machine the circuit and the
|
|
241
|
+
* tx-validator run (`rolly_game_core::blackjack::replay_full`). This lets a
|
|
242
|
+
* player independently confirm the settled `win`/`bet` off-chain; it is NOT on
|
|
243
|
+
* the tx/settlement path.
|
|
244
|
+
*
|
|
245
|
+
* `server_seed` must be 8 elements (the revealed fairness preimage);
|
|
246
|
+
* `user_secret_random` must be 4 elements (`string_to_user_seed(...)`).
|
|
247
|
+
* `base_bet` is the base stake in atomic units. The returned `total_staked`
|
|
248
|
+
* grows with double/split/insurance exactly as the engine books them.
|
|
249
|
+
*
|
|
250
|
+
* **Output**: a JS object matching [`BlackjackVerifyResult`].
|
|
251
|
+
*
|
|
252
|
+
* Returns an error if the decoded action list contains an invalid code
|
|
253
|
+
* (outside `1..=6`), mirroring the tx-validator's typed rejection.
|
|
254
|
+
*
|
|
255
|
+
* ```js
|
|
256
|
+
* const res = compute_payout_blackjack(serverSeed8, userSecret4, lo, hi, betAtomic);
|
|
257
|
+
* // res.win_amount, res.total_staked, res.shoe (length 30),
|
|
258
|
+
* // res.first_cards / res.second_cards / res.dealer_cards (rank codes), ...
|
|
259
|
+
* ```
|
|
260
|
+
* @param {BigUint64Array} server_seed
|
|
261
|
+
* @param {BigUint64Array} user_secret_random
|
|
262
|
+
* @param {number} prediction_lo
|
|
263
|
+
* @param {number} prediction_hi
|
|
264
|
+
* @param {bigint} base_bet
|
|
265
|
+
* @returns {any}
|
|
266
|
+
*/
|
|
267
|
+
export function compute_payout_blackjack(server_seed, user_secret_random, prediction_lo, prediction_hi, base_bet) {
|
|
268
|
+
try {
|
|
269
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
270
|
+
const ptr0 = passArray64ToWasm0(server_seed, wasm.__wbindgen_export);
|
|
271
|
+
const len0 = WASM_VECTOR_LEN;
|
|
272
|
+
const ptr1 = passArray64ToWasm0(user_secret_random, wasm.__wbindgen_export);
|
|
273
|
+
const len1 = WASM_VECTOR_LEN;
|
|
274
|
+
wasm.compute_payout_blackjack(retptr, ptr0, len0, ptr1, len1, prediction_lo, prediction_hi, base_bet);
|
|
275
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
276
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
277
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
278
|
+
if (r2) {
|
|
279
|
+
throw takeObject(r1);
|
|
280
|
+
}
|
|
281
|
+
return takeObject(r0);
|
|
282
|
+
} finally {
|
|
283
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
235
287
|
/**
|
|
236
288
|
* Full coinflip payout computation — pure integer arithmetic, zero floats.
|
|
237
289
|
*
|
|
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;
|
package/js/browser.mjs
CHANGED
package/js/index.d.ts
CHANGED
package/js/node-inline.cjs
CHANGED
|
@@ -15,6 +15,7 @@ module.exports = {
|
|
|
15
15
|
compute_drawn_keno: wasm.compute_drawn_keno,
|
|
16
16
|
compute_multi_dice: wasm.compute_multi_dice,
|
|
17
17
|
compute_payout_aviato: wasm.compute_payout_aviato,
|
|
18
|
+
compute_payout_blackjack: wasm.compute_payout_blackjack,
|
|
18
19
|
compute_payout_coinflip: wasm.compute_payout_coinflip,
|
|
19
20
|
compute_payout_crash: wasm.compute_payout_crash,
|
|
20
21
|
compute_payout_dice: wasm.compute_payout_dice,
|
package/js/node-inline.mjs
CHANGED
package/js/node.cjs
CHANGED
|
@@ -15,6 +15,7 @@ module.exports = {
|
|
|
15
15
|
compute_drawn_keno: wasm.compute_drawn_keno,
|
|
16
16
|
compute_multi_dice: wasm.compute_multi_dice,
|
|
17
17
|
compute_payout_aviato: wasm.compute_payout_aviato,
|
|
18
|
+
compute_payout_blackjack: wasm.compute_payout_blackjack,
|
|
18
19
|
compute_payout_coinflip: wasm.compute_payout_coinflip,
|
|
19
20
|
compute_payout_crash: wasm.compute_payout_crash,
|
|
20
21
|
compute_payout_dice: wasm.compute_payout_dice,
|
package/js/node.mjs
CHANGED
package/js/react.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import init, {
|
|
|
12
12
|
compute_drawn_keno,
|
|
13
13
|
compute_multi_dice,
|
|
14
14
|
compute_payout_aviato,
|
|
15
|
+
compute_payout_blackjack,
|
|
15
16
|
compute_payout_coinflip,
|
|
16
17
|
compute_payout_crash,
|
|
17
18
|
compute_payout_dice,
|
|
@@ -85,6 +86,7 @@ const fns = {
|
|
|
85
86
|
compute_drawn_keno: guard(compute_drawn_keno),
|
|
86
87
|
compute_multi_dice: guard(compute_multi_dice),
|
|
87
88
|
compute_payout_aviato: guard(compute_payout_aviato),
|
|
89
|
+
compute_payout_blackjack: guard(compute_payout_blackjack),
|
|
88
90
|
compute_payout_coinflip: guard(compute_payout_coinflip),
|
|
89
91
|
compute_payout_crash: guard(compute_payout_crash),
|
|
90
92
|
compute_payout_dice: guard(compute_payout_dice),
|