@actuallyfair/verifier 0.0.6 → 0.0.8
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/cli/context-codec.js +18 -10
- package/dist/compute-wager.d.ts +17 -13
- package/dist/compute-wager.js +83 -44
- package/dist/generated/context/index.d.ts +162 -157
- package/dist/generated/context/index.js +63 -48
- package/package.json +1 -1
- package/protobuf/context/index.proto +10 -8
- package/src/cli/context-codec.ts +18 -10
- package/src/compute-wager.ts +116 -58
- package/src/generated/context/index.ts +68 -51
|
@@ -10,15 +10,16 @@ import { Plinko } from "./plinko";
|
|
|
10
10
|
import { Tower } from "./tower";
|
|
11
11
|
|
|
12
12
|
export interface Context {
|
|
13
|
+
compressedSeed: number;
|
|
14
|
+
init?: PosthashInit | undefined;
|
|
15
|
+
plinko?: Plinko | undefined;
|
|
16
|
+
crashDice?: CrashDice | undefined;
|
|
13
17
|
fairCoinToss?: FairCoinToss | undefined;
|
|
14
18
|
crash?: Crash | undefined;
|
|
15
19
|
hilo?: HiLo | undefined;
|
|
16
|
-
crashDice?: CrashDice | undefined;
|
|
17
20
|
multiRoulette?: MultiRoulette | undefined;
|
|
18
21
|
mines?: Mines | undefined;
|
|
19
22
|
tower?: Tower | undefined;
|
|
20
|
-
plinko?: Plinko | undefined;
|
|
21
|
-
init?: PosthashInit | undefined;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export interface PosthashInit {
|
|
@@ -26,46 +27,50 @@ export interface PosthashInit {
|
|
|
26
27
|
|
|
27
28
|
function createBaseContext(): Context {
|
|
28
29
|
return {
|
|
30
|
+
compressedSeed: 0,
|
|
31
|
+
init: undefined,
|
|
32
|
+
plinko: undefined,
|
|
33
|
+
crashDice: undefined,
|
|
29
34
|
fairCoinToss: undefined,
|
|
30
35
|
crash: undefined,
|
|
31
36
|
hilo: undefined,
|
|
32
|
-
crashDice: undefined,
|
|
33
37
|
multiRoulette: undefined,
|
|
34
38
|
mines: undefined,
|
|
35
39
|
tower: undefined,
|
|
36
|
-
plinko: undefined,
|
|
37
|
-
init: undefined,
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export const Context = {
|
|
42
44
|
encode(message: Context, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
43
|
-
if (message.
|
|
44
|
-
|
|
45
|
+
if (message.compressedSeed !== 0) {
|
|
46
|
+
writer.uint32(13).fixed32(message.compressedSeed);
|
|
45
47
|
}
|
|
46
|
-
if (message.
|
|
47
|
-
|
|
48
|
+
if (message.init !== undefined) {
|
|
49
|
+
PosthashInit.encode(message.init, writer.uint32(18).fork()).ldelim();
|
|
48
50
|
}
|
|
49
|
-
if (message.
|
|
50
|
-
|
|
51
|
+
if (message.plinko !== undefined) {
|
|
52
|
+
Plinko.encode(message.plinko, writer.uint32(26).fork()).ldelim();
|
|
51
53
|
}
|
|
52
54
|
if (message.crashDice !== undefined) {
|
|
53
55
|
CrashDice.encode(message.crashDice, writer.uint32(34).fork()).ldelim();
|
|
54
56
|
}
|
|
57
|
+
if (message.fairCoinToss !== undefined) {
|
|
58
|
+
FairCoinToss.encode(message.fairCoinToss, writer.uint32(42).fork()).ldelim();
|
|
59
|
+
}
|
|
60
|
+
if (message.crash !== undefined) {
|
|
61
|
+
Crash.encode(message.crash, writer.uint32(50).fork()).ldelim();
|
|
62
|
+
}
|
|
63
|
+
if (message.hilo !== undefined) {
|
|
64
|
+
HiLo.encode(message.hilo, writer.uint32(58).fork()).ldelim();
|
|
65
|
+
}
|
|
55
66
|
if (message.multiRoulette !== undefined) {
|
|
56
|
-
MultiRoulette.encode(message.multiRoulette, writer.uint32(
|
|
67
|
+
MultiRoulette.encode(message.multiRoulette, writer.uint32(66).fork()).ldelim();
|
|
57
68
|
}
|
|
58
69
|
if (message.mines !== undefined) {
|
|
59
|
-
Mines.encode(message.mines, writer.uint32(
|
|
70
|
+
Mines.encode(message.mines, writer.uint32(74).fork()).ldelim();
|
|
60
71
|
}
|
|
61
72
|
if (message.tower !== undefined) {
|
|
62
|
-
Tower.encode(message.tower, writer.uint32(
|
|
63
|
-
}
|
|
64
|
-
if (message.plinko !== undefined) {
|
|
65
|
-
Plinko.encode(message.plinko, writer.uint32(66).fork()).ldelim();
|
|
66
|
-
}
|
|
67
|
-
if (message.init !== undefined) {
|
|
68
|
-
PosthashInit.encode(message.init, writer.uint32(74).fork()).ldelim();
|
|
73
|
+
Tower.encode(message.tower, writer.uint32(82).fork()).ldelim();
|
|
69
74
|
}
|
|
70
75
|
return writer;
|
|
71
76
|
},
|
|
@@ -78,25 +83,25 @@ export const Context = {
|
|
|
78
83
|
const tag = reader.uint32();
|
|
79
84
|
switch (tag >>> 3) {
|
|
80
85
|
case 1:
|
|
81
|
-
if (tag !==
|
|
86
|
+
if (tag !== 13) {
|
|
82
87
|
break;
|
|
83
88
|
}
|
|
84
89
|
|
|
85
|
-
message.
|
|
90
|
+
message.compressedSeed = reader.fixed32();
|
|
86
91
|
continue;
|
|
87
92
|
case 2:
|
|
88
93
|
if (tag !== 18) {
|
|
89
94
|
break;
|
|
90
95
|
}
|
|
91
96
|
|
|
92
|
-
message.
|
|
97
|
+
message.init = PosthashInit.decode(reader, reader.uint32());
|
|
93
98
|
continue;
|
|
94
99
|
case 3:
|
|
95
100
|
if (tag !== 26) {
|
|
96
101
|
break;
|
|
97
102
|
}
|
|
98
103
|
|
|
99
|
-
message.
|
|
104
|
+
message.plinko = Plinko.decode(reader, reader.uint32());
|
|
100
105
|
continue;
|
|
101
106
|
case 4:
|
|
102
107
|
if (tag !== 34) {
|
|
@@ -110,35 +115,42 @@ export const Context = {
|
|
|
110
115
|
break;
|
|
111
116
|
}
|
|
112
117
|
|
|
113
|
-
message.
|
|
118
|
+
message.fairCoinToss = FairCoinToss.decode(reader, reader.uint32());
|
|
114
119
|
continue;
|
|
115
120
|
case 6:
|
|
116
121
|
if (tag !== 50) {
|
|
117
122
|
break;
|
|
118
123
|
}
|
|
119
124
|
|
|
120
|
-
message.
|
|
125
|
+
message.crash = Crash.decode(reader, reader.uint32());
|
|
121
126
|
continue;
|
|
122
127
|
case 7:
|
|
123
128
|
if (tag !== 58) {
|
|
124
129
|
break;
|
|
125
130
|
}
|
|
126
131
|
|
|
127
|
-
message.
|
|
132
|
+
message.hilo = HiLo.decode(reader, reader.uint32());
|
|
128
133
|
continue;
|
|
129
134
|
case 8:
|
|
130
135
|
if (tag !== 66) {
|
|
131
136
|
break;
|
|
132
137
|
}
|
|
133
138
|
|
|
134
|
-
message.
|
|
139
|
+
message.multiRoulette = MultiRoulette.decode(reader, reader.uint32());
|
|
135
140
|
continue;
|
|
136
141
|
case 9:
|
|
137
142
|
if (tag !== 74) {
|
|
138
143
|
break;
|
|
139
144
|
}
|
|
140
145
|
|
|
141
|
-
message.
|
|
146
|
+
message.mines = Mines.decode(reader, reader.uint32());
|
|
147
|
+
continue;
|
|
148
|
+
case 10:
|
|
149
|
+
if (tag !== 82) {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
message.tower = Tower.decode(reader, reader.uint32());
|
|
142
154
|
continue;
|
|
143
155
|
}
|
|
144
156
|
if ((tag & 7) === 4 || tag === 0) {
|
|
@@ -151,20 +163,33 @@ export const Context = {
|
|
|
151
163
|
|
|
152
164
|
fromJSON(object: any): Context {
|
|
153
165
|
return {
|
|
166
|
+
compressedSeed: isSet(object.compressedSeed) ? globalThis.Number(object.compressedSeed) : 0,
|
|
167
|
+
init: isSet(object.init) ? PosthashInit.fromJSON(object.init) : undefined,
|
|
168
|
+
plinko: isSet(object.plinko) ? Plinko.fromJSON(object.plinko) : undefined,
|
|
169
|
+
crashDice: isSet(object.crashDice) ? CrashDice.fromJSON(object.crashDice) : undefined,
|
|
154
170
|
fairCoinToss: isSet(object.fairCoinToss) ? FairCoinToss.fromJSON(object.fairCoinToss) : undefined,
|
|
155
171
|
crash: isSet(object.crash) ? Crash.fromJSON(object.crash) : undefined,
|
|
156
172
|
hilo: isSet(object.hilo) ? HiLo.fromJSON(object.hilo) : undefined,
|
|
157
|
-
crashDice: isSet(object.crashDice) ? CrashDice.fromJSON(object.crashDice) : undefined,
|
|
158
173
|
multiRoulette: isSet(object.multiRoulette) ? MultiRoulette.fromJSON(object.multiRoulette) : undefined,
|
|
159
174
|
mines: isSet(object.mines) ? Mines.fromJSON(object.mines) : undefined,
|
|
160
175
|
tower: isSet(object.tower) ? Tower.fromJSON(object.tower) : undefined,
|
|
161
|
-
plinko: isSet(object.plinko) ? Plinko.fromJSON(object.plinko) : undefined,
|
|
162
|
-
init: isSet(object.init) ? PosthashInit.fromJSON(object.init) : undefined,
|
|
163
176
|
};
|
|
164
177
|
},
|
|
165
178
|
|
|
166
179
|
toJSON(message: Context): unknown {
|
|
167
180
|
const obj: any = {};
|
|
181
|
+
if (message.compressedSeed !== 0) {
|
|
182
|
+
obj.compressedSeed = Math.round(message.compressedSeed);
|
|
183
|
+
}
|
|
184
|
+
if (message.init !== undefined) {
|
|
185
|
+
obj.init = PosthashInit.toJSON(message.init);
|
|
186
|
+
}
|
|
187
|
+
if (message.plinko !== undefined) {
|
|
188
|
+
obj.plinko = Plinko.toJSON(message.plinko);
|
|
189
|
+
}
|
|
190
|
+
if (message.crashDice !== undefined) {
|
|
191
|
+
obj.crashDice = CrashDice.toJSON(message.crashDice);
|
|
192
|
+
}
|
|
168
193
|
if (message.fairCoinToss !== undefined) {
|
|
169
194
|
obj.fairCoinToss = FairCoinToss.toJSON(message.fairCoinToss);
|
|
170
195
|
}
|
|
@@ -174,9 +199,6 @@ export const Context = {
|
|
|
174
199
|
if (message.hilo !== undefined) {
|
|
175
200
|
obj.hilo = HiLo.toJSON(message.hilo);
|
|
176
201
|
}
|
|
177
|
-
if (message.crashDice !== undefined) {
|
|
178
|
-
obj.crashDice = CrashDice.toJSON(message.crashDice);
|
|
179
|
-
}
|
|
180
202
|
if (message.multiRoulette !== undefined) {
|
|
181
203
|
obj.multiRoulette = MultiRoulette.toJSON(message.multiRoulette);
|
|
182
204
|
}
|
|
@@ -186,12 +208,6 @@ export const Context = {
|
|
|
186
208
|
if (message.tower !== undefined) {
|
|
187
209
|
obj.tower = Tower.toJSON(message.tower);
|
|
188
210
|
}
|
|
189
|
-
if (message.plinko !== undefined) {
|
|
190
|
-
obj.plinko = Plinko.toJSON(message.plinko);
|
|
191
|
-
}
|
|
192
|
-
if (message.init !== undefined) {
|
|
193
|
-
obj.init = PosthashInit.toJSON(message.init);
|
|
194
|
-
}
|
|
195
211
|
return obj;
|
|
196
212
|
},
|
|
197
213
|
|
|
@@ -200,25 +216,26 @@ export const Context = {
|
|
|
200
216
|
},
|
|
201
217
|
fromPartial<I extends Exact<DeepPartial<Context>, I>>(object: I): Context {
|
|
202
218
|
const message = createBaseContext();
|
|
219
|
+
message.compressedSeed = object.compressedSeed ?? 0;
|
|
220
|
+
message.init = (object.init !== undefined && object.init !== null)
|
|
221
|
+
? PosthashInit.fromPartial(object.init)
|
|
222
|
+
: undefined;
|
|
223
|
+
message.plinko = (object.plinko !== undefined && object.plinko !== null)
|
|
224
|
+
? Plinko.fromPartial(object.plinko)
|
|
225
|
+
: undefined;
|
|
226
|
+
message.crashDice = (object.crashDice !== undefined && object.crashDice !== null)
|
|
227
|
+
? CrashDice.fromPartial(object.crashDice)
|
|
228
|
+
: undefined;
|
|
203
229
|
message.fairCoinToss = (object.fairCoinToss !== undefined && object.fairCoinToss !== null)
|
|
204
230
|
? FairCoinToss.fromPartial(object.fairCoinToss)
|
|
205
231
|
: undefined;
|
|
206
232
|
message.crash = (object.crash !== undefined && object.crash !== null) ? Crash.fromPartial(object.crash) : undefined;
|
|
207
233
|
message.hilo = (object.hilo !== undefined && object.hilo !== null) ? HiLo.fromPartial(object.hilo) : undefined;
|
|
208
|
-
message.crashDice = (object.crashDice !== undefined && object.crashDice !== null)
|
|
209
|
-
? CrashDice.fromPartial(object.crashDice)
|
|
210
|
-
: undefined;
|
|
211
234
|
message.multiRoulette = (object.multiRoulette !== undefined && object.multiRoulette !== null)
|
|
212
235
|
? MultiRoulette.fromPartial(object.multiRoulette)
|
|
213
236
|
: undefined;
|
|
214
237
|
message.mines = (object.mines !== undefined && object.mines !== null) ? Mines.fromPartial(object.mines) : undefined;
|
|
215
238
|
message.tower = (object.tower !== undefined && object.tower !== null) ? Tower.fromPartial(object.tower) : undefined;
|
|
216
|
-
message.plinko = (object.plinko !== undefined && object.plinko !== null)
|
|
217
|
-
? Plinko.fromPartial(object.plinko)
|
|
218
|
-
: undefined;
|
|
219
|
-
message.init = (object.init !== undefined && object.init !== null)
|
|
220
|
-
? PosthashInit.fromPartial(object.init)
|
|
221
|
-
: undefined;
|
|
222
239
|
return message;
|
|
223
240
|
},
|
|
224
241
|
};
|