@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
|
@@ -2,13 +2,72 @@
|
|
|
2
2
|
import _m0 from "protobufjs/minimal";
|
|
3
3
|
import { Amount } from "../amount";
|
|
4
4
|
|
|
5
|
+
export enum DuelPlinkoRisk {
|
|
6
|
+
DUEL_PLINKO_RISK_UNSPECIFIED = 0,
|
|
7
|
+
DUEL_PLINKO_RISK_LOW = 1,
|
|
8
|
+
DUEL_PLINKO_RISK_MEDIUM = 2,
|
|
9
|
+
DUEL_PLINKO_RISK_HIGH = 3,
|
|
10
|
+
UNRECOGNIZED = -1,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function duelPlinkoRiskFromJSON(object: any): DuelPlinkoRisk {
|
|
14
|
+
switch (object) {
|
|
15
|
+
case 0:
|
|
16
|
+
case "DUEL_PLINKO_RISK_UNSPECIFIED":
|
|
17
|
+
return DuelPlinkoRisk.DUEL_PLINKO_RISK_UNSPECIFIED;
|
|
18
|
+
case 1:
|
|
19
|
+
case "DUEL_PLINKO_RISK_LOW":
|
|
20
|
+
return DuelPlinkoRisk.DUEL_PLINKO_RISK_LOW;
|
|
21
|
+
case 2:
|
|
22
|
+
case "DUEL_PLINKO_RISK_MEDIUM":
|
|
23
|
+
return DuelPlinkoRisk.DUEL_PLINKO_RISK_MEDIUM;
|
|
24
|
+
case 3:
|
|
25
|
+
case "DUEL_PLINKO_RISK_HIGH":
|
|
26
|
+
return DuelPlinkoRisk.DUEL_PLINKO_RISK_HIGH;
|
|
27
|
+
case -1:
|
|
28
|
+
case "UNRECOGNIZED":
|
|
29
|
+
default:
|
|
30
|
+
return DuelPlinkoRisk.UNRECOGNIZED;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function duelPlinkoRiskToJSON(object: DuelPlinkoRisk): string {
|
|
35
|
+
switch (object) {
|
|
36
|
+
case DuelPlinkoRisk.DUEL_PLINKO_RISK_UNSPECIFIED:
|
|
37
|
+
return "DUEL_PLINKO_RISK_UNSPECIFIED";
|
|
38
|
+
case DuelPlinkoRisk.DUEL_PLINKO_RISK_LOW:
|
|
39
|
+
return "DUEL_PLINKO_RISK_LOW";
|
|
40
|
+
case DuelPlinkoRisk.DUEL_PLINKO_RISK_MEDIUM:
|
|
41
|
+
return "DUEL_PLINKO_RISK_MEDIUM";
|
|
42
|
+
case DuelPlinkoRisk.DUEL_PLINKO_RISK_HIGH:
|
|
43
|
+
return "DUEL_PLINKO_RISK_HIGH";
|
|
44
|
+
case DuelPlinkoRisk.UNRECOGNIZED:
|
|
45
|
+
default:
|
|
46
|
+
return "UNRECOGNIZED";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
5
50
|
export interface Plinko {
|
|
6
51
|
amount: Amount | undefined;
|
|
52
|
+
payouts: PlinkoPayouts | undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface PlinkoPayouts {
|
|
56
|
+
custom?: CustomPlinkoPayouts | undefined;
|
|
57
|
+
duel?: DuelPlinkoPayouts | undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface DuelPlinkoPayouts {
|
|
61
|
+
rows: number;
|
|
62
|
+
risk: DuelPlinkoRisk;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface CustomPlinkoPayouts {
|
|
7
66
|
possibilities: number[];
|
|
8
67
|
}
|
|
9
68
|
|
|
10
69
|
function createBasePlinko(): Plinko {
|
|
11
|
-
return { amount: undefined,
|
|
70
|
+
return { amount: undefined, payouts: undefined };
|
|
12
71
|
}
|
|
13
72
|
|
|
14
73
|
export const Plinko = {
|
|
@@ -16,11 +75,9 @@ export const Plinko = {
|
|
|
16
75
|
if (message.amount !== undefined) {
|
|
17
76
|
Amount.encode(message.amount, writer.uint32(10).fork()).ldelim();
|
|
18
77
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
writer.double(v);
|
|
78
|
+
if (message.payouts !== undefined) {
|
|
79
|
+
PlinkoPayouts.encode(message.payouts, writer.uint32(18).fork()).ldelim();
|
|
22
80
|
}
|
|
23
|
-
writer.ldelim();
|
|
24
81
|
return writer;
|
|
25
82
|
},
|
|
26
83
|
|
|
@@ -39,13 +96,235 @@ export const Plinko = {
|
|
|
39
96
|
message.amount = Amount.decode(reader, reader.uint32());
|
|
40
97
|
continue;
|
|
41
98
|
case 2:
|
|
42
|
-
if (tag
|
|
99
|
+
if (tag !== 18) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
message.payouts = PlinkoPayouts.decode(reader, reader.uint32());
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
reader.skipType(tag & 7);
|
|
110
|
+
}
|
|
111
|
+
return message;
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
fromJSON(object: any): Plinko {
|
|
115
|
+
return {
|
|
116
|
+
amount: isSet(object.amount) ? Amount.fromJSON(object.amount) : undefined,
|
|
117
|
+
payouts: isSet(object.payouts) ? PlinkoPayouts.fromJSON(object.payouts) : undefined,
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
toJSON(message: Plinko): unknown {
|
|
122
|
+
const obj: any = {};
|
|
123
|
+
if (message.amount !== undefined) {
|
|
124
|
+
obj.amount = Amount.toJSON(message.amount);
|
|
125
|
+
}
|
|
126
|
+
if (message.payouts !== undefined) {
|
|
127
|
+
obj.payouts = PlinkoPayouts.toJSON(message.payouts);
|
|
128
|
+
}
|
|
129
|
+
return obj;
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
create<I extends Exact<DeepPartial<Plinko>, I>>(base?: I): Plinko {
|
|
133
|
+
return Plinko.fromPartial(base ?? ({} as any));
|
|
134
|
+
},
|
|
135
|
+
fromPartial<I extends Exact<DeepPartial<Plinko>, I>>(object: I): Plinko {
|
|
136
|
+
const message = createBasePlinko();
|
|
137
|
+
message.amount = (object.amount !== undefined && object.amount !== null)
|
|
138
|
+
? Amount.fromPartial(object.amount)
|
|
139
|
+
: undefined;
|
|
140
|
+
message.payouts = (object.payouts !== undefined && object.payouts !== null)
|
|
141
|
+
? PlinkoPayouts.fromPartial(object.payouts)
|
|
142
|
+
: undefined;
|
|
143
|
+
return message;
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
function createBasePlinkoPayouts(): PlinkoPayouts {
|
|
148
|
+
return { custom: undefined, duel: undefined };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const PlinkoPayouts = {
|
|
152
|
+
encode(message: PlinkoPayouts, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
153
|
+
if (message.custom !== undefined) {
|
|
154
|
+
CustomPlinkoPayouts.encode(message.custom, writer.uint32(10).fork()).ldelim();
|
|
155
|
+
}
|
|
156
|
+
if (message.duel !== undefined) {
|
|
157
|
+
DuelPlinkoPayouts.encode(message.duel, writer.uint32(18).fork()).ldelim();
|
|
158
|
+
}
|
|
159
|
+
return writer;
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): PlinkoPayouts {
|
|
163
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
164
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
165
|
+
const message = createBasePlinkoPayouts();
|
|
166
|
+
while (reader.pos < end) {
|
|
167
|
+
const tag = reader.uint32();
|
|
168
|
+
switch (tag >>> 3) {
|
|
169
|
+
case 1:
|
|
170
|
+
if (tag !== 10) {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
message.custom = CustomPlinkoPayouts.decode(reader, reader.uint32());
|
|
175
|
+
continue;
|
|
176
|
+
case 2:
|
|
177
|
+
if (tag !== 18) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
message.duel = DuelPlinkoPayouts.decode(reader, reader.uint32());
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
reader.skipType(tag & 7);
|
|
188
|
+
}
|
|
189
|
+
return message;
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
fromJSON(object: any): PlinkoPayouts {
|
|
193
|
+
return {
|
|
194
|
+
custom: isSet(object.custom) ? CustomPlinkoPayouts.fromJSON(object.custom) : undefined,
|
|
195
|
+
duel: isSet(object.duel) ? DuelPlinkoPayouts.fromJSON(object.duel) : undefined,
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
toJSON(message: PlinkoPayouts): unknown {
|
|
200
|
+
const obj: any = {};
|
|
201
|
+
if (message.custom !== undefined) {
|
|
202
|
+
obj.custom = CustomPlinkoPayouts.toJSON(message.custom);
|
|
203
|
+
}
|
|
204
|
+
if (message.duel !== undefined) {
|
|
205
|
+
obj.duel = DuelPlinkoPayouts.toJSON(message.duel);
|
|
206
|
+
}
|
|
207
|
+
return obj;
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
create<I extends Exact<DeepPartial<PlinkoPayouts>, I>>(base?: I): PlinkoPayouts {
|
|
211
|
+
return PlinkoPayouts.fromPartial(base ?? ({} as any));
|
|
212
|
+
},
|
|
213
|
+
fromPartial<I extends Exact<DeepPartial<PlinkoPayouts>, I>>(object: I): PlinkoPayouts {
|
|
214
|
+
const message = createBasePlinkoPayouts();
|
|
215
|
+
message.custom = (object.custom !== undefined && object.custom !== null)
|
|
216
|
+
? CustomPlinkoPayouts.fromPartial(object.custom)
|
|
217
|
+
: undefined;
|
|
218
|
+
message.duel = (object.duel !== undefined && object.duel !== null)
|
|
219
|
+
? DuelPlinkoPayouts.fromPartial(object.duel)
|
|
220
|
+
: undefined;
|
|
221
|
+
return message;
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
function createBaseDuelPlinkoPayouts(): DuelPlinkoPayouts {
|
|
226
|
+
return { rows: 0, risk: 0 };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export const DuelPlinkoPayouts = {
|
|
230
|
+
encode(message: DuelPlinkoPayouts, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
231
|
+
if (message.rows !== 0) {
|
|
232
|
+
writer.uint32(8).uint32(message.rows);
|
|
233
|
+
}
|
|
234
|
+
if (message.risk !== 0) {
|
|
235
|
+
writer.uint32(16).int32(message.risk);
|
|
236
|
+
}
|
|
237
|
+
return writer;
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): DuelPlinkoPayouts {
|
|
241
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
242
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
243
|
+
const message = createBaseDuelPlinkoPayouts();
|
|
244
|
+
while (reader.pos < end) {
|
|
245
|
+
const tag = reader.uint32();
|
|
246
|
+
switch (tag >>> 3) {
|
|
247
|
+
case 1:
|
|
248
|
+
if (tag !== 8) {
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
message.rows = reader.uint32();
|
|
253
|
+
continue;
|
|
254
|
+
case 2:
|
|
255
|
+
if (tag !== 16) {
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
message.risk = reader.int32() as any;
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
reader.skipType(tag & 7);
|
|
266
|
+
}
|
|
267
|
+
return message;
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
fromJSON(object: any): DuelPlinkoPayouts {
|
|
271
|
+
return {
|
|
272
|
+
rows: isSet(object.rows) ? globalThis.Number(object.rows) : 0,
|
|
273
|
+
risk: isSet(object.risk) ? duelPlinkoRiskFromJSON(object.risk) : 0,
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
toJSON(message: DuelPlinkoPayouts): unknown {
|
|
278
|
+
const obj: any = {};
|
|
279
|
+
if (message.rows !== 0) {
|
|
280
|
+
obj.rows = Math.round(message.rows);
|
|
281
|
+
}
|
|
282
|
+
if (message.risk !== 0) {
|
|
283
|
+
obj.risk = duelPlinkoRiskToJSON(message.risk);
|
|
284
|
+
}
|
|
285
|
+
return obj;
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
create<I extends Exact<DeepPartial<DuelPlinkoPayouts>, I>>(base?: I): DuelPlinkoPayouts {
|
|
289
|
+
return DuelPlinkoPayouts.fromPartial(base ?? ({} as any));
|
|
290
|
+
},
|
|
291
|
+
fromPartial<I extends Exact<DeepPartial<DuelPlinkoPayouts>, I>>(object: I): DuelPlinkoPayouts {
|
|
292
|
+
const message = createBaseDuelPlinkoPayouts();
|
|
293
|
+
message.rows = object.rows ?? 0;
|
|
294
|
+
message.risk = object.risk ?? 0;
|
|
295
|
+
return message;
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
function createBaseCustomPlinkoPayouts(): CustomPlinkoPayouts {
|
|
300
|
+
return { possibilities: [] };
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export const CustomPlinkoPayouts = {
|
|
304
|
+
encode(message: CustomPlinkoPayouts, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
305
|
+
writer.uint32(10).fork();
|
|
306
|
+
for (const v of message.possibilities) {
|
|
307
|
+
writer.double(v);
|
|
308
|
+
}
|
|
309
|
+
writer.ldelim();
|
|
310
|
+
return writer;
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CustomPlinkoPayouts {
|
|
314
|
+
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
315
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
316
|
+
const message = createBaseCustomPlinkoPayouts();
|
|
317
|
+
while (reader.pos < end) {
|
|
318
|
+
const tag = reader.uint32();
|
|
319
|
+
switch (tag >>> 3) {
|
|
320
|
+
case 1:
|
|
321
|
+
if (tag === 9) {
|
|
43
322
|
message.possibilities.push(reader.double());
|
|
44
323
|
|
|
45
324
|
continue;
|
|
46
325
|
}
|
|
47
326
|
|
|
48
|
-
if (tag ===
|
|
327
|
+
if (tag === 10) {
|
|
49
328
|
const end2 = reader.uint32() + reader.pos;
|
|
50
329
|
while (reader.pos < end2) {
|
|
51
330
|
message.possibilities.push(reader.double());
|
|
@@ -64,34 +343,27 @@ export const Plinko = {
|
|
|
64
343
|
return message;
|
|
65
344
|
},
|
|
66
345
|
|
|
67
|
-
fromJSON(object: any):
|
|
346
|
+
fromJSON(object: any): CustomPlinkoPayouts {
|
|
68
347
|
return {
|
|
69
|
-
amount: isSet(object.amount) ? Amount.fromJSON(object.amount) : undefined,
|
|
70
348
|
possibilities: globalThis.Array.isArray(object?.possibilities)
|
|
71
349
|
? object.possibilities.map((e: any) => globalThis.Number(e))
|
|
72
350
|
: [],
|
|
73
351
|
};
|
|
74
352
|
},
|
|
75
353
|
|
|
76
|
-
toJSON(message:
|
|
354
|
+
toJSON(message: CustomPlinkoPayouts): unknown {
|
|
77
355
|
const obj: any = {};
|
|
78
|
-
if (message.amount !== undefined) {
|
|
79
|
-
obj.amount = Amount.toJSON(message.amount);
|
|
80
|
-
}
|
|
81
356
|
if (message.possibilities?.length) {
|
|
82
357
|
obj.possibilities = message.possibilities;
|
|
83
358
|
}
|
|
84
359
|
return obj;
|
|
85
360
|
},
|
|
86
361
|
|
|
87
|
-
create<I extends Exact<DeepPartial<
|
|
88
|
-
return
|
|
362
|
+
create<I extends Exact<DeepPartial<CustomPlinkoPayouts>, I>>(base?: I): CustomPlinkoPayouts {
|
|
363
|
+
return CustomPlinkoPayouts.fromPartial(base ?? ({} as any));
|
|
89
364
|
},
|
|
90
|
-
fromPartial<I extends Exact<DeepPartial<
|
|
91
|
-
const message =
|
|
92
|
-
message.amount = (object.amount !== undefined && object.amount !== null)
|
|
93
|
-
? Amount.fromPartial(object.amount)
|
|
94
|
-
: undefined;
|
|
365
|
+
fromPartial<I extends Exact<DeepPartial<CustomPlinkoPayouts>, I>>(object: I): CustomPlinkoPayouts {
|
|
366
|
+
const message = createBaseCustomPlinkoPayouts();
|
|
95
367
|
message.possibilities = object.possibilities?.map((e) => e) || [];
|
|
96
368
|
return message;
|
|
97
369
|
},
|
package/src/index.ts
CHANGED