@actuallyfair/verifier 0.0.3 → 0.0.5
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/compute-wager.js +15 -1
- package/dist/duel-plinko-payouts.d.ts +14 -0
- package/dist/duel-plinko-payouts.js +478 -0
- package/dist/generated/context/index.d.ts +107 -33
- package/dist/generated/context/plinko.d.ts +171 -7
- package/dist/generated/context/plinko.js +252 -17
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/protobuf/context/plinko.proto +25 -2
- package/src/compute-wager.ts +16 -1
- package/src/duel-plinko-payouts.ts +495 -0
- package/src/generated/context/plinko.ts +292 -20
- package/src/index.ts +1 -0
package/dist/compute-wager.js
CHANGED
|
@@ -7,6 +7,7 @@ const utils_1 = require("@noble/curves/abstract/utils");
|
|
|
7
7
|
const currency_1 = require("./generated/currency");
|
|
8
8
|
const fair_coin_toss_1 = require("./generated/context/fair-coin-toss");
|
|
9
9
|
const utils_2 = require("@noble/hashes/utils");
|
|
10
|
+
const duel_plinko_payouts_1 = require("./duel-plinko-payouts");
|
|
10
11
|
function computeFairCoinTossResult(sig) {
|
|
11
12
|
// We're going to hash the signature just to really be sure its fairly distributed
|
|
12
13
|
const hash = (0, sha256_1.sha256)(sig);
|
|
@@ -202,7 +203,7 @@ function computePlinkoHouseEdge(possibilities) {
|
|
|
202
203
|
}
|
|
203
204
|
exports.computePlinkoHouseEdge = computePlinkoHouseEdge;
|
|
204
205
|
function computePlinkoResult(hash, clientSeed, bet) {
|
|
205
|
-
const possibilities = bet
|
|
206
|
+
const possibilities = resolvePlinkoPayouts(bet);
|
|
206
207
|
if (possibilities.length < 2) {
|
|
207
208
|
throw new Error("invalid possibilities ");
|
|
208
209
|
}
|
|
@@ -218,6 +219,19 @@ function computePlinkoResult(hash, clientSeed, bet) {
|
|
|
218
219
|
};
|
|
219
220
|
}
|
|
220
221
|
exports.computePlinkoResult = computePlinkoResult;
|
|
222
|
+
function resolvePlinkoPayouts(bet) {
|
|
223
|
+
const payouts = bet.payouts;
|
|
224
|
+
if (!payouts) {
|
|
225
|
+
return [];
|
|
226
|
+
}
|
|
227
|
+
if (payouts.duel) {
|
|
228
|
+
return (0, duel_plinko_payouts_1.getDuelPlinkoPayoutsFromEnum)(payouts.duel.rows, payouts.duel.risk);
|
|
229
|
+
}
|
|
230
|
+
if (payouts.custom) {
|
|
231
|
+
return payouts.custom.possibilities;
|
|
232
|
+
}
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
221
235
|
function hmacSha256(key, message) {
|
|
222
236
|
const data = new TextEncoder().encode(message);
|
|
223
237
|
return (0, hmac_1.hmac)(sha256_1.sha256, key, data);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DuelPlinkoRisk } from "./generated/context/plinko";
|
|
2
|
+
export declare const DUEL_PLINKO_RISK_KEYS: readonly ["low", "medium", "high"];
|
|
3
|
+
export type DuelPlinkoRiskKey = (typeof DUEL_PLINKO_RISK_KEYS)[number];
|
|
4
|
+
export declare const DUEL_PLINKO_PAYOUTS: Record<number, Record<DuelPlinkoRiskKey, number[]>>;
|
|
5
|
+
export declare const DUEL_PLINKO_ROWS: {
|
|
6
|
+
readonly min: number;
|
|
7
|
+
readonly max: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function getDuelPlinkoPayouts(rows: number, risk: DuelPlinkoRiskKey): number[];
|
|
10
|
+
export declare function isDuelPlinkoRiskKey(value: string): value is DuelPlinkoRiskKey;
|
|
11
|
+
export declare function isDuelPlinkoRows(rows: number): boolean;
|
|
12
|
+
export declare function duelPlinkoRiskToEnum(value: DuelPlinkoRiskKey): DuelPlinkoRisk;
|
|
13
|
+
export declare function duelPlinkoRiskFromEnum(value: DuelPlinkoRisk): DuelPlinkoRiskKey | null;
|
|
14
|
+
export declare function getDuelPlinkoPayoutsFromEnum(rows: number, risk: DuelPlinkoRisk): number[];
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDuelPlinkoPayoutsFromEnum = exports.duelPlinkoRiskFromEnum = exports.duelPlinkoRiskToEnum = exports.isDuelPlinkoRows = exports.isDuelPlinkoRiskKey = exports.getDuelPlinkoPayouts = exports.DUEL_PLINKO_ROWS = exports.DUEL_PLINKO_PAYOUTS = exports.DUEL_PLINKO_RISK_KEYS = void 0;
|
|
4
|
+
const plinko_1 = require("./generated/context/plinko");
|
|
5
|
+
exports.DUEL_PLINKO_RISK_KEYS = ["low", "medium", "high"];
|
|
6
|
+
const DUEL_PLINKO_RISK_ENUM_BY_KEY = {
|
|
7
|
+
low: plinko_1.DuelPlinkoRisk.DUEL_PLINKO_RISK_LOW,
|
|
8
|
+
medium: plinko_1.DuelPlinkoRisk.DUEL_PLINKO_RISK_MEDIUM,
|
|
9
|
+
high: plinko_1.DuelPlinkoRisk.DUEL_PLINKO_RISK_HIGH,
|
|
10
|
+
};
|
|
11
|
+
const DUEL_PLINKO_RISK_KEY_BY_ENUM = {
|
|
12
|
+
[plinko_1.DuelPlinkoRisk.DUEL_PLINKO_RISK_LOW]: "low",
|
|
13
|
+
[plinko_1.DuelPlinkoRisk.DUEL_PLINKO_RISK_MEDIUM]: "medium",
|
|
14
|
+
[plinko_1.DuelPlinkoRisk.DUEL_PLINKO_RISK_HIGH]: "high",
|
|
15
|
+
};
|
|
16
|
+
exports.DUEL_PLINKO_PAYOUTS = {
|
|
17
|
+
"8": {
|
|
18
|
+
"low": [
|
|
19
|
+
5.6518011,
|
|
20
|
+
2.11942541,
|
|
21
|
+
1.11017522,
|
|
22
|
+
1.0092502,
|
|
23
|
+
0.5046251,
|
|
24
|
+
1.0092502,
|
|
25
|
+
1.11017522,
|
|
26
|
+
2.11942541,
|
|
27
|
+
5.6518011
|
|
28
|
+
],
|
|
29
|
+
"medium": [
|
|
30
|
+
13.13061611,
|
|
31
|
+
3.03014218,
|
|
32
|
+
1.31306161,
|
|
33
|
+
0.70703318,
|
|
34
|
+
0.40401896,
|
|
35
|
+
0.70703318,
|
|
36
|
+
1.31306161,
|
|
37
|
+
3.03014218,
|
|
38
|
+
13.13061611
|
|
39
|
+
],
|
|
40
|
+
"high": [
|
|
41
|
+
29.2451735,
|
|
42
|
+
4.03381703,
|
|
43
|
+
1.51268139,
|
|
44
|
+
0.30253628,
|
|
45
|
+
0.20169085,
|
|
46
|
+
0.30253628,
|
|
47
|
+
1.51268139,
|
|
48
|
+
4.03381703,
|
|
49
|
+
29.2451735
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"9": {
|
|
53
|
+
"low": [
|
|
54
|
+
5.6518011,
|
|
55
|
+
2.01850039,
|
|
56
|
+
1.61480032,
|
|
57
|
+
1.0092502,
|
|
58
|
+
0.70647514,
|
|
59
|
+
0.70647514,
|
|
60
|
+
1.0092502,
|
|
61
|
+
1.61480032,
|
|
62
|
+
2.01850039,
|
|
63
|
+
5.6518011
|
|
64
|
+
],
|
|
65
|
+
"medium": [
|
|
66
|
+
18.13787234,
|
|
67
|
+
4.0306383,
|
|
68
|
+
1.71302128,
|
|
69
|
+
0.90689362,
|
|
70
|
+
0.50382979,
|
|
71
|
+
0.50382979,
|
|
72
|
+
0.90689362,
|
|
73
|
+
1.71302128,
|
|
74
|
+
4.0306383,
|
|
75
|
+
18.13787234
|
|
76
|
+
],
|
|
77
|
+
"high": [
|
|
78
|
+
43.36353312,
|
|
79
|
+
7.05917981,
|
|
80
|
+
2.01690852,
|
|
81
|
+
0.60507256,
|
|
82
|
+
0.20169085,
|
|
83
|
+
0.20169085,
|
|
84
|
+
0.60507256,
|
|
85
|
+
2.01690852,
|
|
86
|
+
7.05917981,
|
|
87
|
+
43.36353312
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"10": {
|
|
91
|
+
"low": [
|
|
92
|
+
8.98055474,
|
|
93
|
+
3.02715328,
|
|
94
|
+
1.41267153,
|
|
95
|
+
1.1099562,
|
|
96
|
+
1.00905109,
|
|
97
|
+
0.50452555,
|
|
98
|
+
1.00905109,
|
|
99
|
+
1.1099562,
|
|
100
|
+
1.41267153,
|
|
101
|
+
3.02715328,
|
|
102
|
+
8.98055474
|
|
103
|
+
],
|
|
104
|
+
"medium": [
|
|
105
|
+
22.22104265,
|
|
106
|
+
5.05023697,
|
|
107
|
+
2.02009479,
|
|
108
|
+
1.41406635,
|
|
109
|
+
0.60602844,
|
|
110
|
+
0.40401896,
|
|
111
|
+
0.60602844,
|
|
112
|
+
1.41406635,
|
|
113
|
+
2.02009479,
|
|
114
|
+
5.05023697,
|
|
115
|
+
22.22104265
|
|
116
|
+
],
|
|
117
|
+
"high": [
|
|
118
|
+
76.64252366,
|
|
119
|
+
10.08454259,
|
|
120
|
+
3.02536278,
|
|
121
|
+
0.90760883,
|
|
122
|
+
0.30253628,
|
|
123
|
+
0.20169085,
|
|
124
|
+
0.30253628,
|
|
125
|
+
0.90760883,
|
|
126
|
+
3.02536278,
|
|
127
|
+
10.08454259,
|
|
128
|
+
76.64252366
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"11": {
|
|
132
|
+
"low": [
|
|
133
|
+
8.4760292,
|
|
134
|
+
3.02715328,
|
|
135
|
+
1.91719708,
|
|
136
|
+
1.31176642,
|
|
137
|
+
1.00905109,
|
|
138
|
+
0.70633577,
|
|
139
|
+
0.70633577,
|
|
140
|
+
1.00905109,
|
|
141
|
+
1.31176642,
|
|
142
|
+
1.91719708,
|
|
143
|
+
3.02715328,
|
|
144
|
+
8.4760292
|
|
145
|
+
],
|
|
146
|
+
"medium": [
|
|
147
|
+
24.2124497,
|
|
148
|
+
6.05311243,
|
|
149
|
+
3.02655621,
|
|
150
|
+
1.81593373,
|
|
151
|
+
0.70619645,
|
|
152
|
+
0.50442604,
|
|
153
|
+
0.50442604,
|
|
154
|
+
0.70619645,
|
|
155
|
+
1.81593373,
|
|
156
|
+
3.02655621,
|
|
157
|
+
6.05311243,
|
|
158
|
+
24.2124497
|
|
159
|
+
],
|
|
160
|
+
"high": [
|
|
161
|
+
120.89533189,
|
|
162
|
+
14.10445539,
|
|
163
|
+
5.23879772,
|
|
164
|
+
1.41044554,
|
|
165
|
+
0.40298444,
|
|
166
|
+
0.20149222,
|
|
167
|
+
0.20149222,
|
|
168
|
+
0.40298444,
|
|
169
|
+
1.41044554,
|
|
170
|
+
5.23879772,
|
|
171
|
+
14.10445539,
|
|
172
|
+
120.89533189
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
"12": {
|
|
176
|
+
"low": [
|
|
177
|
+
10.09299985,
|
|
178
|
+
3.02789996,
|
|
179
|
+
1.61487998,
|
|
180
|
+
1.41301998,
|
|
181
|
+
1.11022998,
|
|
182
|
+
1.00929999,
|
|
183
|
+
0.50464999,
|
|
184
|
+
1.00929999,
|
|
185
|
+
1.11022998,
|
|
186
|
+
1.41301998,
|
|
187
|
+
1.61487998,
|
|
188
|
+
3.02789996,
|
|
189
|
+
10.09299985
|
|
190
|
+
],
|
|
191
|
+
"medium": [
|
|
192
|
+
33.30361367,
|
|
193
|
+
11.10120456,
|
|
194
|
+
4.03680166,
|
|
195
|
+
2.01840083,
|
|
196
|
+
1.11012046,
|
|
197
|
+
0.60552025,
|
|
198
|
+
0.30276012,
|
|
199
|
+
0.60552025,
|
|
200
|
+
1.11012046,
|
|
201
|
+
2.01840083,
|
|
202
|
+
4.03680166,
|
|
203
|
+
11.10120456,
|
|
204
|
+
33.30361367
|
|
205
|
+
],
|
|
206
|
+
"high": [
|
|
207
|
+
171.34432238,
|
|
208
|
+
24.18978669,
|
|
209
|
+
8.16405301,
|
|
210
|
+
2.01581556,
|
|
211
|
+
0.70553545,
|
|
212
|
+
0.20158156,
|
|
213
|
+
0.20158156,
|
|
214
|
+
0.20158156,
|
|
215
|
+
0.70553545,
|
|
216
|
+
2.01581556,
|
|
217
|
+
8.16405301,
|
|
218
|
+
24.18978669,
|
|
219
|
+
171.34432238
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
"13": {
|
|
223
|
+
"low": [
|
|
224
|
+
8.17371699,
|
|
225
|
+
4.03640345,
|
|
226
|
+
3.02730259,
|
|
227
|
+
1.91729164,
|
|
228
|
+
1.21092104,
|
|
229
|
+
0.90819078,
|
|
230
|
+
0.7063706,
|
|
231
|
+
0.7063706,
|
|
232
|
+
0.90819078,
|
|
233
|
+
1.21092104,
|
|
234
|
+
1.91729164,
|
|
235
|
+
3.02730259,
|
|
236
|
+
4.03640345,
|
|
237
|
+
8.17371699
|
|
238
|
+
],
|
|
239
|
+
"medium": [
|
|
240
|
+
43.39347736,
|
|
241
|
+
13.11895827,
|
|
242
|
+
6.05490382,
|
|
243
|
+
3.02745191,
|
|
244
|
+
1.31189583,
|
|
245
|
+
0.70640545,
|
|
246
|
+
0.40366025,
|
|
247
|
+
0.40366025,
|
|
248
|
+
0.70640545,
|
|
249
|
+
1.31189583,
|
|
250
|
+
3.02745191,
|
|
251
|
+
6.05490382,
|
|
252
|
+
13.11895827,
|
|
253
|
+
43.39347736
|
|
254
|
+
],
|
|
255
|
+
"high": [
|
|
256
|
+
262.13350416,
|
|
257
|
+
37.30361405,
|
|
258
|
+
11.09026364,
|
|
259
|
+
4.03282314,
|
|
260
|
+
1.00820579,
|
|
261
|
+
0.20164116,
|
|
262
|
+
0.20164116,
|
|
263
|
+
0.20164116,
|
|
264
|
+
0.20164116,
|
|
265
|
+
1.00820579,
|
|
266
|
+
4.03282314,
|
|
267
|
+
11.09026364,
|
|
268
|
+
37.30361405,
|
|
269
|
+
262.13350416
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
"14": {
|
|
273
|
+
"low": [
|
|
274
|
+
7.16452779,
|
|
275
|
+
4.03635368,
|
|
276
|
+
1.917268,
|
|
277
|
+
1.41272379,
|
|
278
|
+
1.31181495,
|
|
279
|
+
1.10999726,
|
|
280
|
+
1.00908842,
|
|
281
|
+
0.50454421,
|
|
282
|
+
1.00908842,
|
|
283
|
+
1.10999726,
|
|
284
|
+
1.31181495,
|
|
285
|
+
1.41272379,
|
|
286
|
+
1.917268,
|
|
287
|
+
4.03635368,
|
|
288
|
+
7.16452779
|
|
289
|
+
],
|
|
290
|
+
"medium": [
|
|
291
|
+
58.5307369,
|
|
292
|
+
15.13725954,
|
|
293
|
+
7.06405445,
|
|
294
|
+
4.03660255,
|
|
295
|
+
1.91738621,
|
|
296
|
+
1.00915064,
|
|
297
|
+
0.50457532,
|
|
298
|
+
0.20183013,
|
|
299
|
+
0.50457532,
|
|
300
|
+
1.00915064,
|
|
301
|
+
1.91738621,
|
|
302
|
+
4.03660255,
|
|
303
|
+
7.06405445,
|
|
304
|
+
15.13725954,
|
|
305
|
+
58.5307369
|
|
306
|
+
],
|
|
307
|
+
"high": [
|
|
308
|
+
423.91122183,
|
|
309
|
+
56.52149624,
|
|
310
|
+
18.16762379,
|
|
311
|
+
5.04656216,
|
|
312
|
+
1.91769362,
|
|
313
|
+
0.30279373,
|
|
314
|
+
0.20186249,
|
|
315
|
+
0.20186249,
|
|
316
|
+
0.20186249,
|
|
317
|
+
0.30279373,
|
|
318
|
+
1.91769362,
|
|
319
|
+
5.04656216,
|
|
320
|
+
18.16762379,
|
|
321
|
+
56.52149624,
|
|
322
|
+
423.91122183
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
"15": {
|
|
326
|
+
"low": [
|
|
327
|
+
15.13623299,
|
|
328
|
+
8.0726576,
|
|
329
|
+
3.0272466,
|
|
330
|
+
2.0181644,
|
|
331
|
+
1.5136233,
|
|
332
|
+
1.10999042,
|
|
333
|
+
1.0090822,
|
|
334
|
+
0.70635754,
|
|
335
|
+
0.70635754,
|
|
336
|
+
1.0090822,
|
|
337
|
+
1.10999042,
|
|
338
|
+
1.5136233,
|
|
339
|
+
2.0181644,
|
|
340
|
+
3.0272466,
|
|
341
|
+
8.0726576,
|
|
342
|
+
15.13623299
|
|
343
|
+
],
|
|
344
|
+
"medium": [
|
|
345
|
+
88.80142344,
|
|
346
|
+
18.16392752,
|
|
347
|
+
11.10017793,
|
|
348
|
+
5.04553542,
|
|
349
|
+
3.02732125,
|
|
350
|
+
1.31183921,
|
|
351
|
+
0.50455354,
|
|
352
|
+
0.30273213,
|
|
353
|
+
0.30273213,
|
|
354
|
+
0.50455354,
|
|
355
|
+
1.31183921,
|
|
356
|
+
3.02732125,
|
|
357
|
+
5.04553542,
|
|
358
|
+
11.10017793,
|
|
359
|
+
18.16392752,
|
|
360
|
+
88.80142344
|
|
361
|
+
],
|
|
362
|
+
"high": [
|
|
363
|
+
625.46900798,
|
|
364
|
+
83.73214139,
|
|
365
|
+
27.23816648,
|
|
366
|
+
8.07056784,
|
|
367
|
+
3.02646294,
|
|
368
|
+
0.50441049,
|
|
369
|
+
0.2017642,
|
|
370
|
+
0.2017642,
|
|
371
|
+
0.2017642,
|
|
372
|
+
0.2017642,
|
|
373
|
+
0.50441049,
|
|
374
|
+
3.02646294,
|
|
375
|
+
8.07056784,
|
|
376
|
+
27.23816648,
|
|
377
|
+
83.73214139,
|
|
378
|
+
625.46900798
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
"16": {
|
|
382
|
+
"low": [
|
|
383
|
+
16.14566358,
|
|
384
|
+
9.08193576,
|
|
385
|
+
2.01820795,
|
|
386
|
+
1.41274556,
|
|
387
|
+
1.41274556,
|
|
388
|
+
1.21092477,
|
|
389
|
+
1.11001437,
|
|
390
|
+
1.00910397,
|
|
391
|
+
0.50455199,
|
|
392
|
+
1.00910397,
|
|
393
|
+
1.11001437,
|
|
394
|
+
1.21092477,
|
|
395
|
+
1.41274556,
|
|
396
|
+
1.41274556,
|
|
397
|
+
2.01820795,
|
|
398
|
+
9.08193576,
|
|
399
|
+
16.14566358
|
|
400
|
+
],
|
|
401
|
+
"medium": [
|
|
402
|
+
111.01307231,
|
|
403
|
+
41.37759968,
|
|
404
|
+
10.09209748,
|
|
405
|
+
5.04604874,
|
|
406
|
+
3.02762924,
|
|
407
|
+
1.51381462,
|
|
408
|
+
1.00920975,
|
|
409
|
+
0.50460487,
|
|
410
|
+
0.30276292,
|
|
411
|
+
0.50460487,
|
|
412
|
+
1.00920975,
|
|
413
|
+
1.51381462,
|
|
414
|
+
3.02762924,
|
|
415
|
+
5.04604874,
|
|
416
|
+
10.09209748,
|
|
417
|
+
41.37759968,
|
|
418
|
+
111.01307231
|
|
419
|
+
],
|
|
420
|
+
"high": [
|
|
421
|
+
1009.33110512,
|
|
422
|
+
131.21304367,
|
|
423
|
+
26.24260873,
|
|
424
|
+
9.08397995,
|
|
425
|
+
4.03732442,
|
|
426
|
+
2.01866221,
|
|
427
|
+
0.20186622,
|
|
428
|
+
0.20186622,
|
|
429
|
+
0.20186622,
|
|
430
|
+
0.20186622,
|
|
431
|
+
0.20186622,
|
|
432
|
+
2.01866221,
|
|
433
|
+
4.03732442,
|
|
434
|
+
9.08397995,
|
|
435
|
+
26.24260873,
|
|
436
|
+
131.21304367,
|
|
437
|
+
1009.33110512
|
|
438
|
+
]
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
const DUEL_PLINKO_ROW_VALUES = Object.keys(exports.DUEL_PLINKO_PAYOUTS)
|
|
442
|
+
.map((value) => Number.parseInt(value, 10))
|
|
443
|
+
.filter((value) => Number.isFinite(value))
|
|
444
|
+
.sort((a, b) => a - b);
|
|
445
|
+
exports.DUEL_PLINKO_ROWS = {
|
|
446
|
+
min: DUEL_PLINKO_ROW_VALUES[0] ?? 0,
|
|
447
|
+
max: DUEL_PLINKO_ROW_VALUES[DUEL_PLINKO_ROW_VALUES.length - 1] ?? 0,
|
|
448
|
+
};
|
|
449
|
+
function getDuelPlinkoPayouts(rows, risk) {
|
|
450
|
+
return exports.DUEL_PLINKO_PAYOUTS[rows]?.[risk] ?? [];
|
|
451
|
+
}
|
|
452
|
+
exports.getDuelPlinkoPayouts = getDuelPlinkoPayouts;
|
|
453
|
+
function isDuelPlinkoRiskKey(value) {
|
|
454
|
+
return exports.DUEL_PLINKO_RISK_KEYS.includes(value);
|
|
455
|
+
}
|
|
456
|
+
exports.isDuelPlinkoRiskKey = isDuelPlinkoRiskKey;
|
|
457
|
+
function isDuelPlinkoRows(rows) {
|
|
458
|
+
return (Number.isInteger(rows) &&
|
|
459
|
+
rows >= exports.DUEL_PLINKO_ROWS.min &&
|
|
460
|
+
rows <= exports.DUEL_PLINKO_ROWS.max);
|
|
461
|
+
}
|
|
462
|
+
exports.isDuelPlinkoRows = isDuelPlinkoRows;
|
|
463
|
+
function duelPlinkoRiskToEnum(value) {
|
|
464
|
+
return DUEL_PLINKO_RISK_ENUM_BY_KEY[value];
|
|
465
|
+
}
|
|
466
|
+
exports.duelPlinkoRiskToEnum = duelPlinkoRiskToEnum;
|
|
467
|
+
function duelPlinkoRiskFromEnum(value) {
|
|
468
|
+
return DUEL_PLINKO_RISK_KEY_BY_ENUM[value] ?? null;
|
|
469
|
+
}
|
|
470
|
+
exports.duelPlinkoRiskFromEnum = duelPlinkoRiskFromEnum;
|
|
471
|
+
function getDuelPlinkoPayoutsFromEnum(rows, risk) {
|
|
472
|
+
const key = duelPlinkoRiskFromEnum(risk);
|
|
473
|
+
if (!key) {
|
|
474
|
+
return [];
|
|
475
|
+
}
|
|
476
|
+
return getDuelPlinkoPayouts(rows, key);
|
|
477
|
+
}
|
|
478
|
+
exports.getDuelPlinkoPayoutsFromEnum = getDuelPlinkoPayoutsFromEnum;
|