@rolly-dev/wasm-signer 1.7.0 → 1.11.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 +43 -2
- package/dist/node/rolly_wasm_signer.js +99 -2
- package/dist/node/rolly_wasm_signer_bg.wasm +0 -0
- package/dist/node/rolly_wasm_signer_bg.wasm.d.ts +4 -0
- package/dist/node-inline/rolly_wasm_signer.d.ts +43 -2
- package/dist/node-inline/rolly_wasm_signer.js +100 -3
- package/dist/node-inline/rolly_wasm_signer.mjs +97 -4
- package/dist/node-inline/rolly_wasm_signer_bg.wasm.d.ts +4 -0
- package/dist/web/rolly_wasm_signer.d.ts +47 -2
- package/dist/web/rolly_wasm_signer.js +95 -2
- package/dist/web/rolly_wasm_signer_bg.wasm +0 -0
- package/dist/web/rolly_wasm_signer_bg.wasm.d.ts +4 -0
- package/js/browser.mjs +4 -0
- package/js/index.d.ts +4 -0
- package/js/node-inline.cjs +4 -0
- package/js/node-inline.mjs +4 -0
- package/js/node.cjs +4 -0
- package/js/node.mjs +4 -0
- package/js/react.mjs +8 -0
- package/package.json +1 -1
|
@@ -26,6 +26,17 @@ export function compute_address_hash(address_hex: string): BigUint64Array;
|
|
|
26
26
|
*/
|
|
27
27
|
export function compute_multi_dice(win_numbers: number): bigint;
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Full coinflip payout computation — pure integer arithmetic, zero floats.
|
|
31
|
+
*
|
|
32
|
+
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
33
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
34
|
+
* `prediction`: 0 or 1.
|
|
35
|
+
*
|
|
36
|
+
* Returns `BigUint64Array[4]`: `[win_amount, roll (0|1), is_win (0|1), multiplier×10000]`.
|
|
37
|
+
*/
|
|
38
|
+
export function compute_payout_coinflip(random: BigUint64Array, bet_atomic: bigint, prediction: number): BigUint64Array;
|
|
39
|
+
|
|
29
40
|
/**
|
|
30
41
|
* Full dice payout computation — pure integer arithmetic, zero floats.
|
|
31
42
|
*
|
|
@@ -38,6 +49,18 @@ export function compute_multi_dice(win_numbers: number): bigint;
|
|
|
38
49
|
*/
|
|
39
50
|
export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number): BigUint64Array;
|
|
40
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Full limbo payout computation — pure integer arithmetic, zero floats.
|
|
54
|
+
*
|
|
55
|
+
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
56
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
57
|
+
* `prediction_x100`: target multiplier × 100 (101..999999, i.e. 1.01x–9999.99x).
|
|
58
|
+
* `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
|
|
59
|
+
*
|
|
60
|
+
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier×10000]`.
|
|
61
|
+
*/
|
|
62
|
+
export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number, rtp_numer: number): BigUint64Array;
|
|
63
|
+
|
|
41
64
|
/**
|
|
42
65
|
* Full plinko payout computation — pure integer arithmetic, zero floats.
|
|
43
66
|
*
|
|
@@ -58,11 +81,20 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
|
|
|
58
81
|
* and the in-circuit `build_prediction_hash`.
|
|
59
82
|
*
|
|
60
83
|
* Semantics of p0–p2 depend on the game:
|
|
61
|
-
*
|
|
62
|
-
*
|
|
84
|
+
* Limbo: `(rtp_numer, prediction_x100, 0)`
|
|
85
|
+
* Dice: `(mode, pred_lo, pred_hi)`
|
|
86
|
+
* Plinko: `(sector, rows, is_extreme)`
|
|
87
|
+
* CoinFlip: `(prediction, 0, 0)`
|
|
63
88
|
*/
|
|
64
89
|
export function compute_prediction_hash(game_id: number, p0: number, p1: number, p2: number): BigUint64Array;
|
|
65
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Extract coinflip roll (0 or 1) from Poseidon2 random output.
|
|
93
|
+
*
|
|
94
|
+
* `random` must be exactly 4 elements. Returns `random[0] % 2`.
|
|
95
|
+
*/
|
|
96
|
+
export function compute_roll_coinflip(random: BigUint64Array): number;
|
|
97
|
+
|
|
66
98
|
/**
|
|
67
99
|
* Extract dice roll number [0, 1000) from Poseidon2 random output.
|
|
68
100
|
*
|
|
@@ -70,6 +102,15 @@ export function compute_prediction_hash(game_id: number, p0: number, p1: number,
|
|
|
70
102
|
*/
|
|
71
103
|
export function compute_roll_dice(random: BigUint64Array): number;
|
|
72
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Extract limbo result multiplier × 100 from Poseidon2 random output.
|
|
107
|
+
*
|
|
108
|
+
* `random` must be exactly 4 elements.
|
|
109
|
+
* `rtp_numer` must be in [90, 99].
|
|
110
|
+
* Returns the clamped multiplier × 100 (101..999999).
|
|
111
|
+
*/
|
|
112
|
+
export function compute_roll_limbo(random: BigUint64Array, rtp_numer: number): number;
|
|
113
|
+
|
|
73
114
|
/**
|
|
74
115
|
* Extract plinko bucket index from Poseidon2 random output.
|
|
75
116
|
*
|
|
@@ -63,6 +63,36 @@ function compute_multi_dice(win_numbers) {
|
|
|
63
63
|
}
|
|
64
64
|
exports.compute_multi_dice = compute_multi_dice;
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Full coinflip payout computation — pure integer arithmetic, zero floats.
|
|
68
|
+
*
|
|
69
|
+
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
70
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
71
|
+
* `prediction`: 0 or 1.
|
|
72
|
+
*
|
|
73
|
+
* Returns `BigUint64Array[4]`: `[win_amount, roll (0|1), is_win (0|1), multiplier×10000]`.
|
|
74
|
+
* @param {BigUint64Array} random
|
|
75
|
+
* @param {bigint} bet_atomic
|
|
76
|
+
* @param {number} prediction
|
|
77
|
+
* @returns {BigUint64Array}
|
|
78
|
+
*/
|
|
79
|
+
function compute_payout_coinflip(random, bet_atomic, prediction) {
|
|
80
|
+
try {
|
|
81
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
82
|
+
const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
|
|
83
|
+
const len0 = WASM_VECTOR_LEN;
|
|
84
|
+
wasm.compute_payout_coinflip(retptr, ptr0, len0, bet_atomic, prediction);
|
|
85
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
86
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
87
|
+
var v2 = getArrayU64FromWasm0(r0, r1).slice();
|
|
88
|
+
wasm.__wbindgen_export2(r0, r1 * 8, 8);
|
|
89
|
+
return v2;
|
|
90
|
+
} finally {
|
|
91
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.compute_payout_coinflip = compute_payout_coinflip;
|
|
95
|
+
|
|
66
96
|
/**
|
|
67
97
|
* Full dice payout computation — pure integer arithmetic, zero floats.
|
|
68
98
|
*
|
|
@@ -96,6 +126,38 @@ function compute_payout_dice(random, bet_atomic, game_mode, prediction_lo, predi
|
|
|
96
126
|
}
|
|
97
127
|
exports.compute_payout_dice = compute_payout_dice;
|
|
98
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Full limbo payout computation — pure integer arithmetic, zero floats.
|
|
131
|
+
*
|
|
132
|
+
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
133
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
134
|
+
* `prediction_x100`: target multiplier × 100 (101..999999, i.e. 1.01x–9999.99x).
|
|
135
|
+
* `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
|
|
136
|
+
*
|
|
137
|
+
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier×10000]`.
|
|
138
|
+
* @param {BigUint64Array} random
|
|
139
|
+
* @param {bigint} bet_atomic
|
|
140
|
+
* @param {number} prediction_x100
|
|
141
|
+
* @param {number} rtp_numer
|
|
142
|
+
* @returns {BigUint64Array}
|
|
143
|
+
*/
|
|
144
|
+
function compute_payout_limbo(random, bet_atomic, prediction_x100, rtp_numer) {
|
|
145
|
+
try {
|
|
146
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
147
|
+
const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
|
|
148
|
+
const len0 = WASM_VECTOR_LEN;
|
|
149
|
+
wasm.compute_payout_limbo(retptr, ptr0, len0, bet_atomic, prediction_x100, rtp_numer);
|
|
150
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
151
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
152
|
+
var v2 = getArrayU64FromWasm0(r0, r1).slice();
|
|
153
|
+
wasm.__wbindgen_export2(r0, r1 * 8, 8);
|
|
154
|
+
return v2;
|
|
155
|
+
} finally {
|
|
156
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.compute_payout_limbo = compute_payout_limbo;
|
|
160
|
+
|
|
99
161
|
/**
|
|
100
162
|
* Full plinko payout computation — pure integer arithmetic, zero floats.
|
|
101
163
|
*
|
|
@@ -137,8 +199,10 @@ exports.compute_payout_plinko = compute_payout_plinko;
|
|
|
137
199
|
* and the in-circuit `build_prediction_hash`.
|
|
138
200
|
*
|
|
139
201
|
* Semantics of p0–p2 depend on the game:
|
|
140
|
-
*
|
|
141
|
-
*
|
|
202
|
+
* Limbo: `(rtp_numer, prediction_x100, 0)`
|
|
203
|
+
* Dice: `(mode, pred_lo, pred_hi)`
|
|
204
|
+
* Plinko: `(sector, rows, is_extreme)`
|
|
205
|
+
* CoinFlip: `(prediction, 0, 0)`
|
|
142
206
|
* @param {number} game_id
|
|
143
207
|
* @param {number} p0
|
|
144
208
|
* @param {number} p1
|
|
@@ -160,6 +224,21 @@ function compute_prediction_hash(game_id, p0, p1, p2) {
|
|
|
160
224
|
}
|
|
161
225
|
exports.compute_prediction_hash = compute_prediction_hash;
|
|
162
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Extract coinflip roll (0 or 1) from Poseidon2 random output.
|
|
229
|
+
*
|
|
230
|
+
* `random` must be exactly 4 elements. Returns `random[0] % 2`.
|
|
231
|
+
* @param {BigUint64Array} random
|
|
232
|
+
* @returns {number}
|
|
233
|
+
*/
|
|
234
|
+
function compute_roll_coinflip(random) {
|
|
235
|
+
const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
|
|
236
|
+
const len0 = WASM_VECTOR_LEN;
|
|
237
|
+
const ret = wasm.compute_roll_coinflip(ptr0, len0);
|
|
238
|
+
return ret >>> 0;
|
|
239
|
+
}
|
|
240
|
+
exports.compute_roll_coinflip = compute_roll_coinflip;
|
|
241
|
+
|
|
163
242
|
/**
|
|
164
243
|
* Extract dice roll number [0, 1000) from Poseidon2 random output.
|
|
165
244
|
*
|
|
@@ -175,6 +254,24 @@ function compute_roll_dice(random) {
|
|
|
175
254
|
}
|
|
176
255
|
exports.compute_roll_dice = compute_roll_dice;
|
|
177
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Extract limbo result multiplier × 100 from Poseidon2 random output.
|
|
259
|
+
*
|
|
260
|
+
* `random` must be exactly 4 elements.
|
|
261
|
+
* `rtp_numer` must be in [90, 99].
|
|
262
|
+
* Returns the clamped multiplier × 100 (101..999999).
|
|
263
|
+
* @param {BigUint64Array} random
|
|
264
|
+
* @param {number} rtp_numer
|
|
265
|
+
* @returns {number}
|
|
266
|
+
*/
|
|
267
|
+
function compute_roll_limbo(random, rtp_numer) {
|
|
268
|
+
const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
270
|
+
const ret = wasm.compute_roll_limbo(ptr0, len0, rtp_numer);
|
|
271
|
+
return ret >>> 0;
|
|
272
|
+
}
|
|
273
|
+
exports.compute_roll_limbo = compute_roll_limbo;
|
|
274
|
+
|
|
178
275
|
/**
|
|
179
276
|
* Extract plinko bucket index from Poseidon2 random output.
|
|
180
277
|
*
|
|
Binary file
|
|
@@ -4,10 +4,14 @@ 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
6
|
export const compute_multi_dice: (a: number) => bigint;
|
|
7
|
+
export const compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
|
|
7
8
|
export const compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
|
|
9
|
+
export const compute_payout_limbo: (a: number, b: number, c: number, d: bigint, e: number, f: number) => void;
|
|
8
10
|
export const compute_payout_plinko: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
|
|
9
11
|
export const compute_prediction_hash: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
12
|
+
export const compute_roll_coinflip: (a: number, b: number) => number;
|
|
10
13
|
export const compute_roll_dice: (a: number, b: number) => number;
|
|
14
|
+
export const compute_roll_limbo: (a: number, b: number, c: number) => number;
|
|
11
15
|
export const compute_roll_plinko: (a: number, b: number, c: number) => number;
|
|
12
16
|
export const compute_server_seed_hash: (a: number, b: number, c: number) => void;
|
|
13
17
|
export const compute_user_seed_binding: (a: number, b: number, c: bigint, d: number, e: number, f: number, g: number) => void;
|
|
@@ -26,6 +26,17 @@ export function compute_address_hash(address_hex: string): BigUint64Array;
|
|
|
26
26
|
*/
|
|
27
27
|
export function compute_multi_dice(win_numbers: number): bigint;
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Full coinflip payout computation — pure integer arithmetic, zero floats.
|
|
31
|
+
*
|
|
32
|
+
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
33
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
34
|
+
* `prediction`: 0 or 1.
|
|
35
|
+
*
|
|
36
|
+
* Returns `BigUint64Array[4]`: `[win_amount, roll (0|1), is_win (0|1), multiplier×10000]`.
|
|
37
|
+
*/
|
|
38
|
+
export function compute_payout_coinflip(random: BigUint64Array, bet_atomic: bigint, prediction: number): BigUint64Array;
|
|
39
|
+
|
|
29
40
|
/**
|
|
30
41
|
* Full dice payout computation — pure integer arithmetic, zero floats.
|
|
31
42
|
*
|
|
@@ -38,6 +49,18 @@ export function compute_multi_dice(win_numbers: number): bigint;
|
|
|
38
49
|
*/
|
|
39
50
|
export function compute_payout_dice(random: BigUint64Array, bet_atomic: bigint, game_mode: number, prediction_lo: number, prediction_hi: number): BigUint64Array;
|
|
40
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Full limbo payout computation — pure integer arithmetic, zero floats.
|
|
54
|
+
*
|
|
55
|
+
* `random`: 4 Goldilocks field elements (Poseidon2 output).
|
|
56
|
+
* `bet_atomic`: bet in atomic units (1 USDT = 1_000_000).
|
|
57
|
+
* `prediction_x100`: target multiplier × 100 (101..999999, i.e. 1.01x–9999.99x).
|
|
58
|
+
* `rtp_numer`: RTP numerator for this bet (90–99). Stored per-bet, included in prediction_hash.
|
|
59
|
+
*
|
|
60
|
+
* Returns `BigUint64Array[4]`: `[win_amount, multiplier_x100, is_win (0|1), payout_multiplier×10000]`.
|
|
61
|
+
*/
|
|
62
|
+
export function compute_payout_limbo(random: BigUint64Array, bet_atomic: bigint, prediction_x100: number, rtp_numer: number): BigUint64Array;
|
|
63
|
+
|
|
41
64
|
/**
|
|
42
65
|
* Full plinko payout computation — pure integer arithmetic, zero floats.
|
|
43
66
|
*
|
|
@@ -58,11 +81,20 @@ export function compute_payout_plinko(random: BigUint64Array, bet_atomic: bigint
|
|
|
58
81
|
* and the in-circuit `build_prediction_hash`.
|
|
59
82
|
*
|
|
60
83
|
* Semantics of p0–p2 depend on the game:
|
|
61
|
-
*
|
|
62
|
-
*
|
|
84
|
+
* Limbo: `(rtp_numer, prediction_x100, 0)`
|
|
85
|
+
* Dice: `(mode, pred_lo, pred_hi)`
|
|
86
|
+
* Plinko: `(sector, rows, is_extreme)`
|
|
87
|
+
* CoinFlip: `(prediction, 0, 0)`
|
|
63
88
|
*/
|
|
64
89
|
export function compute_prediction_hash(game_id: number, p0: number, p1: number, p2: number): BigUint64Array;
|
|
65
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Extract coinflip roll (0 or 1) from Poseidon2 random output.
|
|
93
|
+
*
|
|
94
|
+
* `random` must be exactly 4 elements. Returns `random[0] % 2`.
|
|
95
|
+
*/
|
|
96
|
+
export function compute_roll_coinflip(random: BigUint64Array): number;
|
|
97
|
+
|
|
66
98
|
/**
|
|
67
99
|
* Extract dice roll number [0, 1000) from Poseidon2 random output.
|
|
68
100
|
*
|
|
@@ -70,6 +102,15 @@ export function compute_prediction_hash(game_id: number, p0: number, p1: number,
|
|
|
70
102
|
*/
|
|
71
103
|
export function compute_roll_dice(random: BigUint64Array): number;
|
|
72
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Extract limbo result multiplier × 100 from Poseidon2 random output.
|
|
107
|
+
*
|
|
108
|
+
* `random` must be exactly 4 elements.
|
|
109
|
+
* `rtp_numer` must be in [90, 99].
|
|
110
|
+
* Returns the clamped multiplier × 100 (101..999999).
|
|
111
|
+
*/
|
|
112
|
+
export function compute_roll_limbo(random: BigUint64Array, rtp_numer: number): number;
|
|
113
|
+
|
|
73
114
|
/**
|
|
74
115
|
* Extract plinko bucket index from Poseidon2 random output.
|
|
75
116
|
*
|