@rolly-dev/wasm-signer 1.20.0 → 1.22.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.
@@ -12,6 +12,11 @@
12
12
  */
13
13
  export function amount_split(amount: bigint): Uint32Array;
14
14
 
15
+ /**
16
+ * Aviato RTP percent (99). Canonical source for backend/frontend.
17
+ */
18
+ export function aviato_rtp_percent(): number;
19
+
15
20
  /**
16
21
  * CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
17
22
  */
@@ -28,6 +33,14 @@ export function coinflip_rtp_percent(): number;
28
33
  */
29
34
  export function compute_address_hash(address_hex: string): BigUint64Array;
30
35
 
36
+ /**
37
+ * Extract aviato point (×100) from Poseidon2 random output.
38
+ *
39
+ * `random` must be exactly 4 elements.
40
+ * Returns the clamped aviato multiplier ×100 (100..=1_000_000, i.e. 1.00x..10000.00x).
41
+ */
42
+ export function compute_aviato_point(random: BigUint64Array): number;
43
+
31
44
  /**
32
45
  * Extract the 10 drawn numbers from Poseidon2 random output using
33
46
  * the combinatorial number system: `combo_index = random[0] % C(40,10)`.
@@ -45,6 +58,19 @@ export function compute_drawn_keno(random: BigUint64Array): Uint8Array;
45
58
  */
46
59
  export function compute_multi_dice(win_numbers: number): bigint;
47
60
 
61
+ /**
62
+ * Full aviato payout computation — pure integer arithmetic, zero floats.
63
+ *
64
+ * `random`: 4 Goldilocks field elements (Poseidon2 output of 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]`.
71
+ */
72
+ export function compute_payout_aviato(random: BigUint64Array, bet_atomic: bigint, cashout_x100: number): BigUint64Array;
73
+
48
74
  /**
49
75
  * Full coinflip payout computation — pure integer arithmetic, zero floats.
50
76
  *
@@ -26,6 +26,16 @@ function amount_split(amount) {
26
26
  }
27
27
  exports.amount_split = amount_split;
28
28
 
29
+ /**
30
+ * Aviato RTP percent (99). Canonical source for backend/frontend.
31
+ * @returns {number}
32
+ */
33
+ function aviato_rtp_percent() {
34
+ const ret = wasm.aviato_rtp_percent();
35
+ return ret >>> 0;
36
+ }
37
+ exports.aviato_rtp_percent = aviato_rtp_percent;
38
+
29
39
  /**
30
40
  * CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
31
41
  * @returns {number}
@@ -41,7 +51,7 @@ exports.coinflip_multiplier_x10000 = coinflip_multiplier_x10000;
41
51
  * @returns {number}
42
52
  */
43
53
  function coinflip_rtp_percent() {
44
- const ret = wasm.coinflip_rtp_percent();
54
+ const ret = wasm.aviato_rtp_percent();
45
55
  return ret >>> 0;
46
56
  }
47
57
  exports.coinflip_rtp_percent = coinflip_rtp_percent;
@@ -69,6 +79,22 @@ function compute_address_hash(address_hex) {
69
79
  }
70
80
  exports.compute_address_hash = compute_address_hash;
71
81
 
82
+ /**
83
+ * Extract aviato point (×100) from Poseidon2 random output.
84
+ *
85
+ * `random` must be exactly 4 elements.
86
+ * Returns the clamped aviato multiplier ×100 (100..=1_000_000, i.e. 1.00x..10000.00x).
87
+ * @param {BigUint64Array} random
88
+ * @returns {number}
89
+ */
90
+ function compute_aviato_point(random) {
91
+ const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
92
+ const len0 = WASM_VECTOR_LEN;
93
+ const ret = wasm.compute_aviato_point(ptr0, len0);
94
+ return ret >>> 0;
95
+ }
96
+ exports.compute_aviato_point = compute_aviato_point;
97
+
72
98
  /**
73
99
  * Extract the 10 drawn numbers from Poseidon2 random output using
74
100
  * the combinatorial number system: `combo_index = random[0] % C(40,10)`.
@@ -109,6 +135,38 @@ function compute_multi_dice(win_numbers) {
109
135
  }
110
136
  exports.compute_multi_dice = compute_multi_dice;
111
137
 
138
+ /**
139
+ * Full aviato payout computation — pure integer arithmetic, zero floats.
140
+ *
141
+ * `random`: 4 Goldilocks field elements (Poseidon2 output of 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]`.
148
+ * @param {BigUint64Array} random
149
+ * @param {bigint} bet_atomic
150
+ * @param {number} cashout_x100
151
+ * @returns {BigUint64Array}
152
+ */
153
+ function compute_payout_aviato(random, bet_atomic, cashout_x100) {
154
+ try {
155
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
156
+ const ptr0 = passArray64ToWasm0(random, wasm.__wbindgen_export3);
157
+ const len0 = WASM_VECTOR_LEN;
158
+ wasm.compute_payout_aviato(retptr, ptr0, len0, bet_atomic, cashout_x100);
159
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
160
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
161
+ var v2 = getArrayU64FromWasm0(r0, r1).slice();
162
+ wasm.__wbindgen_export2(r0, r1 * 8, 8);
163
+ return v2;
164
+ } finally {
165
+ wasm.__wbindgen_add_to_stack_pointer(16);
166
+ }
167
+ }
168
+ exports.compute_payout_aviato = compute_payout_aviato;
169
+
112
170
  /**
113
171
  * Full coinflip payout computation — pure integer arithmetic, zero floats.
114
172
  *
@@ -501,7 +559,7 @@ exports.derive_session_key = derive_session_key;
501
559
  * @returns {number}
502
560
  */
503
561
  function dice_rtp_percent() {
504
- const ret = wasm.coinflip_rtp_percent();
562
+ const ret = wasm.aviato_rtp_percent();
505
563
  return ret >>> 0;
506
564
  }
507
565
  exports.dice_rtp_percent = dice_rtp_percent;
@@ -770,7 +828,7 @@ exports.keno_rtp_x100 = keno_rtp_x100;
770
828
  * @returns {number}
771
829
  */
772
830
  function limbo_rtp_percent() {
773
- const ret = wasm.coinflip_rtp_percent();
831
+ const ret = wasm.limbo_rtp_percent();
774
832
  return ret >>> 0;
775
833
  }
776
834
  exports.limbo_rtp_percent = limbo_rtp_percent;
Binary file
@@ -2,11 +2,13 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const amount_split: (a: number, b: bigint) => void;
5
+ export const aviato_rtp_percent: () => number;
5
6
  export const coinflip_multiplier_x10000: () => number;
6
- export const coinflip_rtp_percent: () => number;
7
7
  export const compute_address_hash: (a: number, b: number, c: number) => void;
8
+ export const compute_aviato_point: (a: number, b: number) => number;
8
9
  export const compute_drawn_keno: (a: number, b: number, c: number) => void;
9
10
  export const compute_multi_dice: (a: number) => bigint;
11
+ export const compute_payout_aviato: (a: number, b: number, c: number, d: bigint, e: number) => void;
10
12
  export const compute_payout_coinflip: (a: number, b: number, c: number, d: bigint, e: number) => void;
11
13
  export const compute_payout_dice: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
12
14
  export const compute_payout_keno: (a: number, b: number, c: number, d: bigint, e: number, f: number, g: number) => void;
@@ -33,6 +35,7 @@ export const keno_is_valid_config: (a: number, b: number) => number;
33
35
  export const keno_multiplier_table: (a: number, b: number, c: number) => void;
34
36
  export const keno_numbers_range: () => number;
35
37
  export const keno_rtp_x100: (a: number, b: number) => bigint;
38
+ export const limbo_rtp_percent: () => number;
36
39
  export const make_main_leaf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
37
40
  export const plinko_all_rtp_x100: () => number;
38
41
  export const plinko_is_valid_config: (a: number, b: number, c: number) => number;
@@ -48,9 +51,9 @@ export const seed_hash_truncated: (a: number, b: number, c: number) => void;
48
51
  export const session_public_key: (a: number, b: number, c: number, d: bigint) => void;
49
52
  export const string_to_user_seed: (a: number, b: number, c: number) => void;
50
53
  export const string_to_user_seed_hex: (a: number, b: number, c: number) => void;
54
+ export const coinflip_rtp_percent: () => number;
51
55
  export const dice_rtp_percent: () => number;
52
56
  export const keno_max_picks: () => number;
53
- export const limbo_rtp_percent: () => number;
54
57
  export const goldilocks_modulus: () => bigint;
55
58
  export const __wbindgen_export: (a: number) => void;
56
59
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
@@ -12,6 +12,11 @@
12
12
  */
13
13
  export function amount_split(amount: bigint): Uint32Array;
14
14
 
15
+ /**
16
+ * Aviato RTP percent (99). Canonical source for backend/frontend.
17
+ */
18
+ export function aviato_rtp_percent(): number;
19
+
15
20
  /**
16
21
  * CoinFlip multiplier × 10000 (19800 = 1.98×). Canonical source for backend/frontend.
17
22
  */
@@ -28,6 +33,14 @@ export function coinflip_rtp_percent(): number;
28
33
  */
29
34
  export function compute_address_hash(address_hex: string): BigUint64Array;
30
35
 
36
+ /**
37
+ * Extract aviato point (×100) from Poseidon2 random output.
38
+ *
39
+ * `random` must be exactly 4 elements.
40
+ * Returns the clamped aviato multiplier ×100 (100..=1_000_000, i.e. 1.00x..10000.00x).
41
+ */
42
+ export function compute_aviato_point(random: BigUint64Array): number;
43
+
31
44
  /**
32
45
  * Extract the 10 drawn numbers from Poseidon2 random output using
33
46
  * the combinatorial number system: `combo_index = random[0] % C(40,10)`.
@@ -45,6 +58,19 @@ export function compute_drawn_keno(random: BigUint64Array): Uint8Array;
45
58
  */
46
59
  export function compute_multi_dice(win_numbers: number): bigint;
47
60
 
61
+ /**
62
+ * Full aviato payout computation — pure integer arithmetic, zero floats.
63
+ *
64
+ * `random`: 4 Goldilocks field elements (Poseidon2 output of 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]`.
71
+ */
72
+ export function compute_payout_aviato(random: BigUint64Array, bet_atomic: bigint, cashout_x100: number): BigUint64Array;
73
+
48
74
  /**
49
75
  * Full coinflip payout computation — pure integer arithmetic, zero floats.
50
76
  *