@apibara/beaconchain 2.0.0-beta.4 → 2.0.0-beta.6

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/index.cjs ADDED
@@ -0,0 +1,2848 @@
1
+ 'use strict';
2
+
3
+ const protocol = require('@apibara/protocol');
4
+ const evm = require('@apibara/evm');
5
+ const schema = require('@effect/schema');
6
+ const viem = require('viem');
7
+ const Long = require('long');
8
+ const _m0 = require('protobufjs/minimal');
9
+
10
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
+
12
+ const Long__default = /*#__PURE__*/_interopDefaultCompat(Long);
13
+ const _m0__default = /*#__PURE__*/_interopDefaultCompat(_m0);
14
+
15
+ const protobufPackage$2 = "beaconchain.v2";
16
+ var ValidatorStatus$1 = /* @__PURE__ */ ((ValidatorStatus2) => {
17
+ ValidatorStatus2[ValidatorStatus2["UNKNOWN"] = 0] = "UNKNOWN";
18
+ ValidatorStatus2[ValidatorStatus2["PENDING_INITIALIZED"] = 1] = "PENDING_INITIALIZED";
19
+ ValidatorStatus2[ValidatorStatus2["PENDING_QUEUED"] = 2] = "PENDING_QUEUED";
20
+ ValidatorStatus2[ValidatorStatus2["ACTIVE_ONGOING"] = 3] = "ACTIVE_ONGOING";
21
+ ValidatorStatus2[ValidatorStatus2["ACTIVE_EXITING"] = 4] = "ACTIVE_EXITING";
22
+ ValidatorStatus2[ValidatorStatus2["ACTIVE_SLASHED"] = 5] = "ACTIVE_SLASHED";
23
+ ValidatorStatus2[ValidatorStatus2["EXITED_UNSLASHED"] = 6] = "EXITED_UNSLASHED";
24
+ ValidatorStatus2[ValidatorStatus2["EXITED_SLASHED"] = 7] = "EXITED_SLASHED";
25
+ ValidatorStatus2[ValidatorStatus2["WITHDRAWAL_POSSIBLE"] = 8] = "WITHDRAWAL_POSSIBLE";
26
+ ValidatorStatus2[ValidatorStatus2["WITHDRAWAL_DONE"] = 9] = "WITHDRAWAL_DONE";
27
+ ValidatorStatus2[ValidatorStatus2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
28
+ return ValidatorStatus2;
29
+ })(ValidatorStatus$1 || {});
30
+ function validatorStatusFromJSON(object) {
31
+ switch (object) {
32
+ case 0:
33
+ case "VALIDATOR_STATUS_UNKNOWN":
34
+ return 0 /* UNKNOWN */;
35
+ case 1:
36
+ case "VALIDATOR_STATUS_PENDING_INITIALIZED":
37
+ return 1 /* PENDING_INITIALIZED */;
38
+ case 2:
39
+ case "VALIDATOR_STATUS_PENDING_QUEUED":
40
+ return 2 /* PENDING_QUEUED */;
41
+ case 3:
42
+ case "VALIDATOR_STATUS_ACTIVE_ONGOING":
43
+ return 3 /* ACTIVE_ONGOING */;
44
+ case 4:
45
+ case "VALIDATOR_STATUS_ACTIVE_EXITING":
46
+ return 4 /* ACTIVE_EXITING */;
47
+ case 5:
48
+ case "VALIDATOR_STATUS_ACTIVE_SLASHED":
49
+ return 5 /* ACTIVE_SLASHED */;
50
+ case 6:
51
+ case "VALIDATOR_STATUS_EXITED_UNSLASHED":
52
+ return 6 /* EXITED_UNSLASHED */;
53
+ case 7:
54
+ case "VALIDATOR_STATUS_EXITED_SLASHED":
55
+ return 7 /* EXITED_SLASHED */;
56
+ case 8:
57
+ case "VALIDATOR_STATUS_WITHDRAWAL_POSSIBLE":
58
+ return 8 /* WITHDRAWAL_POSSIBLE */;
59
+ case 9:
60
+ case "VALIDATOR_STATUS_WITHDRAWAL_DONE":
61
+ return 9 /* WITHDRAWAL_DONE */;
62
+ case -1:
63
+ case "UNRECOGNIZED":
64
+ default:
65
+ return -1 /* UNRECOGNIZED */;
66
+ }
67
+ }
68
+ function validatorStatusToJSON(object) {
69
+ switch (object) {
70
+ case 0 /* UNKNOWN */:
71
+ return "VALIDATOR_STATUS_UNKNOWN";
72
+ case 1 /* PENDING_INITIALIZED */:
73
+ return "VALIDATOR_STATUS_PENDING_INITIALIZED";
74
+ case 2 /* PENDING_QUEUED */:
75
+ return "VALIDATOR_STATUS_PENDING_QUEUED";
76
+ case 3 /* ACTIVE_ONGOING */:
77
+ return "VALIDATOR_STATUS_ACTIVE_ONGOING";
78
+ case 4 /* ACTIVE_EXITING */:
79
+ return "VALIDATOR_STATUS_ACTIVE_EXITING";
80
+ case 5 /* ACTIVE_SLASHED */:
81
+ return "VALIDATOR_STATUS_ACTIVE_SLASHED";
82
+ case 6 /* EXITED_UNSLASHED */:
83
+ return "VALIDATOR_STATUS_EXITED_UNSLASHED";
84
+ case 7 /* EXITED_SLASHED */:
85
+ return "VALIDATOR_STATUS_EXITED_SLASHED";
86
+ case 8 /* WITHDRAWAL_POSSIBLE */:
87
+ return "VALIDATOR_STATUS_WITHDRAWAL_POSSIBLE";
88
+ case 9 /* WITHDRAWAL_DONE */:
89
+ return "VALIDATOR_STATUS_WITHDRAWAL_DONE";
90
+ case -1 /* UNRECOGNIZED */:
91
+ default:
92
+ return "UNRECOGNIZED";
93
+ }
94
+ }
95
+ function createBaseAddress() {
96
+ return { x0: BigInt("0"), x1: BigInt("0"), x2: 0 };
97
+ }
98
+ const Address = {
99
+ encode(message, writer = _m0__default.Writer.create()) {
100
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
101
+ if (BigInt.asUintN(64, message.x0) !== message.x0) {
102
+ throw new globalThis.Error("value provided for field message.x0 of type fixed64 too large");
103
+ }
104
+ writer.uint32(9).fixed64(message.x0.toString());
105
+ }
106
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
107
+ if (BigInt.asUintN(64, message.x1) !== message.x1) {
108
+ throw new globalThis.Error("value provided for field message.x1 of type fixed64 too large");
109
+ }
110
+ writer.uint32(17).fixed64(message.x1.toString());
111
+ }
112
+ if (message.x2 !== void 0 && message.x2 !== 0) {
113
+ writer.uint32(29).fixed32(message.x2);
114
+ }
115
+ return writer;
116
+ },
117
+ decode(input, length) {
118
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
119
+ let end = length === void 0 ? reader.len : reader.pos + length;
120
+ const message = createBaseAddress();
121
+ while (reader.pos < end) {
122
+ const tag = reader.uint32();
123
+ switch (tag >>> 3) {
124
+ case 1:
125
+ if (tag !== 9) {
126
+ break;
127
+ }
128
+ message.x0 = longToBigint$2(reader.fixed64());
129
+ continue;
130
+ case 2:
131
+ if (tag !== 17) {
132
+ break;
133
+ }
134
+ message.x1 = longToBigint$2(reader.fixed64());
135
+ continue;
136
+ case 3:
137
+ if (tag !== 29) {
138
+ break;
139
+ }
140
+ message.x2 = reader.fixed32();
141
+ continue;
142
+ }
143
+ if ((tag & 7) === 4 || tag === 0) {
144
+ break;
145
+ }
146
+ reader.skipType(tag & 7);
147
+ }
148
+ return message;
149
+ },
150
+ fromJSON(object) {
151
+ return {
152
+ x0: isSet$3(object.x0) ? BigInt(object.x0) : BigInt("0"),
153
+ x1: isSet$3(object.x1) ? BigInt(object.x1) : BigInt("0"),
154
+ x2: isSet$3(object.x2) ? globalThis.Number(object.x2) : 0
155
+ };
156
+ },
157
+ toJSON(message) {
158
+ const obj = {};
159
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
160
+ obj.x0 = message.x0.toString();
161
+ }
162
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
163
+ obj.x1 = message.x1.toString();
164
+ }
165
+ if (message.x2 !== void 0 && message.x2 !== 0) {
166
+ obj.x2 = Math.round(message.x2);
167
+ }
168
+ return obj;
169
+ },
170
+ create(base) {
171
+ return Address.fromPartial(base ?? {});
172
+ },
173
+ fromPartial(object) {
174
+ const message = createBaseAddress();
175
+ message.x0 = object.x0 ?? BigInt("0");
176
+ message.x1 = object.x1 ?? BigInt("0");
177
+ message.x2 = object.x2 ?? 0;
178
+ return message;
179
+ }
180
+ };
181
+ function createBaseU256() {
182
+ return { x0: BigInt("0"), x1: BigInt("0"), x2: BigInt("0"), x3: BigInt("0") };
183
+ }
184
+ const U256 = {
185
+ encode(message, writer = _m0__default.Writer.create()) {
186
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
187
+ if (BigInt.asUintN(64, message.x0) !== message.x0) {
188
+ throw new globalThis.Error("value provided for field message.x0 of type fixed64 too large");
189
+ }
190
+ writer.uint32(9).fixed64(message.x0.toString());
191
+ }
192
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
193
+ if (BigInt.asUintN(64, message.x1) !== message.x1) {
194
+ throw new globalThis.Error("value provided for field message.x1 of type fixed64 too large");
195
+ }
196
+ writer.uint32(17).fixed64(message.x1.toString());
197
+ }
198
+ if (message.x2 !== void 0 && message.x2 !== BigInt("0")) {
199
+ if (BigInt.asUintN(64, message.x2) !== message.x2) {
200
+ throw new globalThis.Error("value provided for field message.x2 of type fixed64 too large");
201
+ }
202
+ writer.uint32(25).fixed64(message.x2.toString());
203
+ }
204
+ if (message.x3 !== void 0 && message.x3 !== BigInt("0")) {
205
+ if (BigInt.asUintN(64, message.x3) !== message.x3) {
206
+ throw new globalThis.Error("value provided for field message.x3 of type fixed64 too large");
207
+ }
208
+ writer.uint32(33).fixed64(message.x3.toString());
209
+ }
210
+ return writer;
211
+ },
212
+ decode(input, length) {
213
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
214
+ let end = length === void 0 ? reader.len : reader.pos + length;
215
+ const message = createBaseU256();
216
+ while (reader.pos < end) {
217
+ const tag = reader.uint32();
218
+ switch (tag >>> 3) {
219
+ case 1:
220
+ if (tag !== 9) {
221
+ break;
222
+ }
223
+ message.x0 = longToBigint$2(reader.fixed64());
224
+ continue;
225
+ case 2:
226
+ if (tag !== 17) {
227
+ break;
228
+ }
229
+ message.x1 = longToBigint$2(reader.fixed64());
230
+ continue;
231
+ case 3:
232
+ if (tag !== 25) {
233
+ break;
234
+ }
235
+ message.x2 = longToBigint$2(reader.fixed64());
236
+ continue;
237
+ case 4:
238
+ if (tag !== 33) {
239
+ break;
240
+ }
241
+ message.x3 = longToBigint$2(reader.fixed64());
242
+ continue;
243
+ }
244
+ if ((tag & 7) === 4 || tag === 0) {
245
+ break;
246
+ }
247
+ reader.skipType(tag & 7);
248
+ }
249
+ return message;
250
+ },
251
+ fromJSON(object) {
252
+ return {
253
+ x0: isSet$3(object.x0) ? BigInt(object.x0) : BigInt("0"),
254
+ x1: isSet$3(object.x1) ? BigInt(object.x1) : BigInt("0"),
255
+ x2: isSet$3(object.x2) ? BigInt(object.x2) : BigInt("0"),
256
+ x3: isSet$3(object.x3) ? BigInt(object.x3) : BigInt("0")
257
+ };
258
+ },
259
+ toJSON(message) {
260
+ const obj = {};
261
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
262
+ obj.x0 = message.x0.toString();
263
+ }
264
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
265
+ obj.x1 = message.x1.toString();
266
+ }
267
+ if (message.x2 !== void 0 && message.x2 !== BigInt("0")) {
268
+ obj.x2 = message.x2.toString();
269
+ }
270
+ if (message.x3 !== void 0 && message.x3 !== BigInt("0")) {
271
+ obj.x3 = message.x3.toString();
272
+ }
273
+ return obj;
274
+ },
275
+ create(base) {
276
+ return U256.fromPartial(base ?? {});
277
+ },
278
+ fromPartial(object) {
279
+ const message = createBaseU256();
280
+ message.x0 = object.x0 ?? BigInt("0");
281
+ message.x1 = object.x1 ?? BigInt("0");
282
+ message.x2 = object.x2 ?? BigInt("0");
283
+ message.x3 = object.x3 ?? BigInt("0");
284
+ return message;
285
+ }
286
+ };
287
+ function createBaseB256() {
288
+ return { x0: BigInt("0"), x1: BigInt("0"), x2: BigInt("0"), x3: BigInt("0") };
289
+ }
290
+ const B256 = {
291
+ encode(message, writer = _m0__default.Writer.create()) {
292
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
293
+ if (BigInt.asUintN(64, message.x0) !== message.x0) {
294
+ throw new globalThis.Error("value provided for field message.x0 of type fixed64 too large");
295
+ }
296
+ writer.uint32(9).fixed64(message.x0.toString());
297
+ }
298
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
299
+ if (BigInt.asUintN(64, message.x1) !== message.x1) {
300
+ throw new globalThis.Error("value provided for field message.x1 of type fixed64 too large");
301
+ }
302
+ writer.uint32(17).fixed64(message.x1.toString());
303
+ }
304
+ if (message.x2 !== void 0 && message.x2 !== BigInt("0")) {
305
+ if (BigInt.asUintN(64, message.x2) !== message.x2) {
306
+ throw new globalThis.Error("value provided for field message.x2 of type fixed64 too large");
307
+ }
308
+ writer.uint32(25).fixed64(message.x2.toString());
309
+ }
310
+ if (message.x3 !== void 0 && message.x3 !== BigInt("0")) {
311
+ if (BigInt.asUintN(64, message.x3) !== message.x3) {
312
+ throw new globalThis.Error("value provided for field message.x3 of type fixed64 too large");
313
+ }
314
+ writer.uint32(33).fixed64(message.x3.toString());
315
+ }
316
+ return writer;
317
+ },
318
+ decode(input, length) {
319
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
320
+ let end = length === void 0 ? reader.len : reader.pos + length;
321
+ const message = createBaseB256();
322
+ while (reader.pos < end) {
323
+ const tag = reader.uint32();
324
+ switch (tag >>> 3) {
325
+ case 1:
326
+ if (tag !== 9) {
327
+ break;
328
+ }
329
+ message.x0 = longToBigint$2(reader.fixed64());
330
+ continue;
331
+ case 2:
332
+ if (tag !== 17) {
333
+ break;
334
+ }
335
+ message.x1 = longToBigint$2(reader.fixed64());
336
+ continue;
337
+ case 3:
338
+ if (tag !== 25) {
339
+ break;
340
+ }
341
+ message.x2 = longToBigint$2(reader.fixed64());
342
+ continue;
343
+ case 4:
344
+ if (tag !== 33) {
345
+ break;
346
+ }
347
+ message.x3 = longToBigint$2(reader.fixed64());
348
+ continue;
349
+ }
350
+ if ((tag & 7) === 4 || tag === 0) {
351
+ break;
352
+ }
353
+ reader.skipType(tag & 7);
354
+ }
355
+ return message;
356
+ },
357
+ fromJSON(object) {
358
+ return {
359
+ x0: isSet$3(object.x0) ? BigInt(object.x0) : BigInt("0"),
360
+ x1: isSet$3(object.x1) ? BigInt(object.x1) : BigInt("0"),
361
+ x2: isSet$3(object.x2) ? BigInt(object.x2) : BigInt("0"),
362
+ x3: isSet$3(object.x3) ? BigInt(object.x3) : BigInt("0")
363
+ };
364
+ },
365
+ toJSON(message) {
366
+ const obj = {};
367
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
368
+ obj.x0 = message.x0.toString();
369
+ }
370
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
371
+ obj.x1 = message.x1.toString();
372
+ }
373
+ if (message.x2 !== void 0 && message.x2 !== BigInt("0")) {
374
+ obj.x2 = message.x2.toString();
375
+ }
376
+ if (message.x3 !== void 0 && message.x3 !== BigInt("0")) {
377
+ obj.x3 = message.x3.toString();
378
+ }
379
+ return obj;
380
+ },
381
+ create(base) {
382
+ return B256.fromPartial(base ?? {});
383
+ },
384
+ fromPartial(object) {
385
+ const message = createBaseB256();
386
+ message.x0 = object.x0 ?? BigInt("0");
387
+ message.x1 = object.x1 ?? BigInt("0");
388
+ message.x2 = object.x2 ?? BigInt("0");
389
+ message.x3 = object.x3 ?? BigInt("0");
390
+ return message;
391
+ }
392
+ };
393
+ function createBaseB384() {
394
+ return { x0: BigInt("0"), x1: BigInt("0"), x2: BigInt("0"), x3: BigInt("0"), x4: BigInt("0"), x5: BigInt("0") };
395
+ }
396
+ const B384$1 = {
397
+ encode(message, writer = _m0__default.Writer.create()) {
398
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
399
+ if (BigInt.asUintN(64, message.x0) !== message.x0) {
400
+ throw new globalThis.Error("value provided for field message.x0 of type fixed64 too large");
401
+ }
402
+ writer.uint32(9).fixed64(message.x0.toString());
403
+ }
404
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
405
+ if (BigInt.asUintN(64, message.x1) !== message.x1) {
406
+ throw new globalThis.Error("value provided for field message.x1 of type fixed64 too large");
407
+ }
408
+ writer.uint32(17).fixed64(message.x1.toString());
409
+ }
410
+ if (message.x2 !== void 0 && message.x2 !== BigInt("0")) {
411
+ if (BigInt.asUintN(64, message.x2) !== message.x2) {
412
+ throw new globalThis.Error("value provided for field message.x2 of type fixed64 too large");
413
+ }
414
+ writer.uint32(25).fixed64(message.x2.toString());
415
+ }
416
+ if (message.x3 !== void 0 && message.x3 !== BigInt("0")) {
417
+ if (BigInt.asUintN(64, message.x3) !== message.x3) {
418
+ throw new globalThis.Error("value provided for field message.x3 of type fixed64 too large");
419
+ }
420
+ writer.uint32(33).fixed64(message.x3.toString());
421
+ }
422
+ if (message.x4 !== void 0 && message.x4 !== BigInt("0")) {
423
+ if (BigInt.asUintN(64, message.x4) !== message.x4) {
424
+ throw new globalThis.Error("value provided for field message.x4 of type fixed64 too large");
425
+ }
426
+ writer.uint32(41).fixed64(message.x4.toString());
427
+ }
428
+ if (message.x5 !== void 0 && message.x5 !== BigInt("0")) {
429
+ if (BigInt.asUintN(64, message.x5) !== message.x5) {
430
+ throw new globalThis.Error("value provided for field message.x5 of type fixed64 too large");
431
+ }
432
+ writer.uint32(49).fixed64(message.x5.toString());
433
+ }
434
+ return writer;
435
+ },
436
+ decode(input, length) {
437
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
438
+ let end = length === void 0 ? reader.len : reader.pos + length;
439
+ const message = createBaseB384();
440
+ while (reader.pos < end) {
441
+ const tag = reader.uint32();
442
+ switch (tag >>> 3) {
443
+ case 1:
444
+ if (tag !== 9) {
445
+ break;
446
+ }
447
+ message.x0 = longToBigint$2(reader.fixed64());
448
+ continue;
449
+ case 2:
450
+ if (tag !== 17) {
451
+ break;
452
+ }
453
+ message.x1 = longToBigint$2(reader.fixed64());
454
+ continue;
455
+ case 3:
456
+ if (tag !== 25) {
457
+ break;
458
+ }
459
+ message.x2 = longToBigint$2(reader.fixed64());
460
+ continue;
461
+ case 4:
462
+ if (tag !== 33) {
463
+ break;
464
+ }
465
+ message.x3 = longToBigint$2(reader.fixed64());
466
+ continue;
467
+ case 5:
468
+ if (tag !== 41) {
469
+ break;
470
+ }
471
+ message.x4 = longToBigint$2(reader.fixed64());
472
+ continue;
473
+ case 6:
474
+ if (tag !== 49) {
475
+ break;
476
+ }
477
+ message.x5 = longToBigint$2(reader.fixed64());
478
+ continue;
479
+ }
480
+ if ((tag & 7) === 4 || tag === 0) {
481
+ break;
482
+ }
483
+ reader.skipType(tag & 7);
484
+ }
485
+ return message;
486
+ },
487
+ fromJSON(object) {
488
+ return {
489
+ x0: isSet$3(object.x0) ? BigInt(object.x0) : BigInt("0"),
490
+ x1: isSet$3(object.x1) ? BigInt(object.x1) : BigInt("0"),
491
+ x2: isSet$3(object.x2) ? BigInt(object.x2) : BigInt("0"),
492
+ x3: isSet$3(object.x3) ? BigInt(object.x3) : BigInt("0"),
493
+ x4: isSet$3(object.x4) ? BigInt(object.x4) : BigInt("0"),
494
+ x5: isSet$3(object.x5) ? BigInt(object.x5) : BigInt("0")
495
+ };
496
+ },
497
+ toJSON(message) {
498
+ const obj = {};
499
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
500
+ obj.x0 = message.x0.toString();
501
+ }
502
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
503
+ obj.x1 = message.x1.toString();
504
+ }
505
+ if (message.x2 !== void 0 && message.x2 !== BigInt("0")) {
506
+ obj.x2 = message.x2.toString();
507
+ }
508
+ if (message.x3 !== void 0 && message.x3 !== BigInt("0")) {
509
+ obj.x3 = message.x3.toString();
510
+ }
511
+ if (message.x4 !== void 0 && message.x4 !== BigInt("0")) {
512
+ obj.x4 = message.x4.toString();
513
+ }
514
+ if (message.x5 !== void 0 && message.x5 !== BigInt("0")) {
515
+ obj.x5 = message.x5.toString();
516
+ }
517
+ return obj;
518
+ },
519
+ create(base) {
520
+ return B384$1.fromPartial(base ?? {});
521
+ },
522
+ fromPartial(object) {
523
+ const message = createBaseB384();
524
+ message.x0 = object.x0 ?? BigInt("0");
525
+ message.x1 = object.x1 ?? BigInt("0");
526
+ message.x2 = object.x2 ?? BigInt("0");
527
+ message.x3 = object.x3 ?? BigInt("0");
528
+ message.x4 = object.x4 ?? BigInt("0");
529
+ message.x5 = object.x5 ?? BigInt("0");
530
+ return message;
531
+ }
532
+ };
533
+ function createBaseU128() {
534
+ return { x0: BigInt("0"), x1: BigInt("0") };
535
+ }
536
+ const U128 = {
537
+ encode(message, writer = _m0__default.Writer.create()) {
538
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
539
+ if (BigInt.asUintN(64, message.x0) !== message.x0) {
540
+ throw new globalThis.Error("value provided for field message.x0 of type fixed64 too large");
541
+ }
542
+ writer.uint32(9).fixed64(message.x0.toString());
543
+ }
544
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
545
+ if (BigInt.asUintN(64, message.x1) !== message.x1) {
546
+ throw new globalThis.Error("value provided for field message.x1 of type fixed64 too large");
547
+ }
548
+ writer.uint32(17).fixed64(message.x1.toString());
549
+ }
550
+ return writer;
551
+ },
552
+ decode(input, length) {
553
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
554
+ let end = length === void 0 ? reader.len : reader.pos + length;
555
+ const message = createBaseU128();
556
+ while (reader.pos < end) {
557
+ const tag = reader.uint32();
558
+ switch (tag >>> 3) {
559
+ case 1:
560
+ if (tag !== 9) {
561
+ break;
562
+ }
563
+ message.x0 = longToBigint$2(reader.fixed64());
564
+ continue;
565
+ case 2:
566
+ if (tag !== 17) {
567
+ break;
568
+ }
569
+ message.x1 = longToBigint$2(reader.fixed64());
570
+ continue;
571
+ }
572
+ if ((tag & 7) === 4 || tag === 0) {
573
+ break;
574
+ }
575
+ reader.skipType(tag & 7);
576
+ }
577
+ return message;
578
+ },
579
+ fromJSON(object) {
580
+ return {
581
+ x0: isSet$3(object.x0) ? BigInt(object.x0) : BigInt("0"),
582
+ x1: isSet$3(object.x1) ? BigInt(object.x1) : BigInt("0")
583
+ };
584
+ },
585
+ toJSON(message) {
586
+ const obj = {};
587
+ if (message.x0 !== void 0 && message.x0 !== BigInt("0")) {
588
+ obj.x0 = message.x0.toString();
589
+ }
590
+ if (message.x1 !== void 0 && message.x1 !== BigInt("0")) {
591
+ obj.x1 = message.x1.toString();
592
+ }
593
+ return obj;
594
+ },
595
+ create(base) {
596
+ return U128.fromPartial(base ?? {});
597
+ },
598
+ fromPartial(object) {
599
+ const message = createBaseU128();
600
+ message.x0 = object.x0 ?? BigInt("0");
601
+ message.x1 = object.x1 ?? BigInt("0");
602
+ return message;
603
+ }
604
+ };
605
+ function longToBigint$2(long) {
606
+ return BigInt(long.toString());
607
+ }
608
+ if (_m0__default.util.Long !== Long__default) {
609
+ _m0__default.util.Long = Long__default;
610
+ _m0__default.configure();
611
+ }
612
+ function isSet$3(value) {
613
+ return value !== null && value !== void 0;
614
+ }
615
+
616
+ const common = {
617
+ __proto__: null,
618
+ Address: Address,
619
+ B256: B256,
620
+ B384: B384$1,
621
+ U128: U128,
622
+ U256: U256,
623
+ ValidatorStatus: ValidatorStatus$1,
624
+ protobufPackage: protobufPackage$2,
625
+ validatorStatusFromJSON: validatorStatusFromJSON,
626
+ validatorStatusToJSON: validatorStatusToJSON
627
+ };
628
+
629
+ function createBaseTimestamp() {
630
+ return { seconds: BigInt("0"), nanos: 0 };
631
+ }
632
+ const Timestamp = {
633
+ encode(message, writer = _m0__default.Writer.create()) {
634
+ if (message.seconds !== void 0 && message.seconds !== BigInt("0")) {
635
+ if (BigInt.asIntN(64, message.seconds) !== message.seconds) {
636
+ throw new globalThis.Error("value provided for field message.seconds of type int64 too large");
637
+ }
638
+ writer.uint32(8).int64(message.seconds.toString());
639
+ }
640
+ if (message.nanos !== void 0 && message.nanos !== 0) {
641
+ writer.uint32(16).int32(message.nanos);
642
+ }
643
+ return writer;
644
+ },
645
+ decode(input, length) {
646
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
647
+ let end = length === void 0 ? reader.len : reader.pos + length;
648
+ const message = createBaseTimestamp();
649
+ while (reader.pos < end) {
650
+ const tag = reader.uint32();
651
+ switch (tag >>> 3) {
652
+ case 1:
653
+ if (tag !== 8) {
654
+ break;
655
+ }
656
+ message.seconds = longToBigint$1(reader.int64());
657
+ continue;
658
+ case 2:
659
+ if (tag !== 16) {
660
+ break;
661
+ }
662
+ message.nanos = reader.int32();
663
+ continue;
664
+ }
665
+ if ((tag & 7) === 4 || tag === 0) {
666
+ break;
667
+ }
668
+ reader.skipType(tag & 7);
669
+ }
670
+ return message;
671
+ },
672
+ fromJSON(object) {
673
+ return {
674
+ seconds: isSet$2(object.seconds) ? BigInt(object.seconds) : BigInt("0"),
675
+ nanos: isSet$2(object.nanos) ? globalThis.Number(object.nanos) : 0
676
+ };
677
+ },
678
+ toJSON(message) {
679
+ const obj = {};
680
+ if (message.seconds !== void 0 && message.seconds !== BigInt("0")) {
681
+ obj.seconds = message.seconds.toString();
682
+ }
683
+ if (message.nanos !== void 0 && message.nanos !== 0) {
684
+ obj.nanos = Math.round(message.nanos);
685
+ }
686
+ return obj;
687
+ },
688
+ create(base) {
689
+ return Timestamp.fromPartial(base ?? {});
690
+ },
691
+ fromPartial(object) {
692
+ const message = createBaseTimestamp();
693
+ message.seconds = object.seconds ?? BigInt("0");
694
+ message.nanos = object.nanos ?? 0;
695
+ return message;
696
+ }
697
+ };
698
+ function longToBigint$1(long) {
699
+ return BigInt(long.toString());
700
+ }
701
+ if (_m0__default.util.Long !== Long__default) {
702
+ _m0__default.util.Long = Long__default;
703
+ _m0__default.configure();
704
+ }
705
+ function isSet$2(value) {
706
+ return value !== null && value !== void 0;
707
+ }
708
+
709
+ const protobufPackage$1 = "beaconchain.v2";
710
+ function createBaseBlock() {
711
+ return { header: void 0, transactions: [], validators: [], blobs: [] };
712
+ }
713
+ const Block$1 = {
714
+ encode(message, writer = _m0__default.Writer.create()) {
715
+ if (message.header !== void 0) {
716
+ BlockHeader$1.encode(message.header, writer.uint32(10).fork()).ldelim();
717
+ }
718
+ if (message.transactions !== void 0 && message.transactions.length !== 0) {
719
+ for (const v of message.transactions) {
720
+ Transaction$1.encode(v, writer.uint32(18).fork()).ldelim();
721
+ }
722
+ }
723
+ if (message.validators !== void 0 && message.validators.length !== 0) {
724
+ for (const v of message.validators) {
725
+ Validator$1.encode(v, writer.uint32(26).fork()).ldelim();
726
+ }
727
+ }
728
+ if (message.blobs !== void 0 && message.blobs.length !== 0) {
729
+ for (const v of message.blobs) {
730
+ Blob$1.encode(v, writer.uint32(34).fork()).ldelim();
731
+ }
732
+ }
733
+ return writer;
734
+ },
735
+ decode(input, length) {
736
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
737
+ let end = length === void 0 ? reader.len : reader.pos + length;
738
+ const message = createBaseBlock();
739
+ while (reader.pos < end) {
740
+ const tag = reader.uint32();
741
+ switch (tag >>> 3) {
742
+ case 1:
743
+ if (tag !== 10) {
744
+ break;
745
+ }
746
+ message.header = BlockHeader$1.decode(reader, reader.uint32());
747
+ continue;
748
+ case 2:
749
+ if (tag !== 18) {
750
+ break;
751
+ }
752
+ message.transactions.push(Transaction$1.decode(reader, reader.uint32()));
753
+ continue;
754
+ case 3:
755
+ if (tag !== 26) {
756
+ break;
757
+ }
758
+ message.validators.push(Validator$1.decode(reader, reader.uint32()));
759
+ continue;
760
+ case 4:
761
+ if (tag !== 34) {
762
+ break;
763
+ }
764
+ message.blobs.push(Blob$1.decode(reader, reader.uint32()));
765
+ continue;
766
+ }
767
+ if ((tag & 7) === 4 || tag === 0) {
768
+ break;
769
+ }
770
+ reader.skipType(tag & 7);
771
+ }
772
+ return message;
773
+ },
774
+ fromJSON(object) {
775
+ return {
776
+ header: isSet$1(object.header) ? BlockHeader$1.fromJSON(object.header) : void 0,
777
+ transactions: globalThis.Array.isArray(object?.transactions) ? object.transactions.map((e) => Transaction$1.fromJSON(e)) : [],
778
+ validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e) => Validator$1.fromJSON(e)) : [],
779
+ blobs: globalThis.Array.isArray(object?.blobs) ? object.blobs.map((e) => Blob$1.fromJSON(e)) : []
780
+ };
781
+ },
782
+ toJSON(message) {
783
+ const obj = {};
784
+ if (message.header !== void 0) {
785
+ obj.header = BlockHeader$1.toJSON(message.header);
786
+ }
787
+ if (message.transactions?.length) {
788
+ obj.transactions = message.transactions.map((e) => Transaction$1.toJSON(e));
789
+ }
790
+ if (message.validators?.length) {
791
+ obj.validators = message.validators.map((e) => Validator$1.toJSON(e));
792
+ }
793
+ if (message.blobs?.length) {
794
+ obj.blobs = message.blobs.map((e) => Blob$1.toJSON(e));
795
+ }
796
+ return obj;
797
+ },
798
+ create(base) {
799
+ return Block$1.fromPartial(base ?? {});
800
+ },
801
+ fromPartial(object) {
802
+ const message = createBaseBlock();
803
+ message.header = object.header !== void 0 && object.header !== null ? BlockHeader$1.fromPartial(object.header) : void 0;
804
+ message.transactions = object.transactions?.map((e) => Transaction$1.fromPartial(e)) || [];
805
+ message.validators = object.validators?.map((e) => Validator$1.fromPartial(e)) || [];
806
+ message.blobs = object.blobs?.map((e) => Blob$1.fromPartial(e)) || [];
807
+ return message;
808
+ }
809
+ };
810
+ function createBaseBlockHeader() {
811
+ return {
812
+ slot: BigInt("0"),
813
+ proposerIndex: 0,
814
+ parentRoot: void 0,
815
+ stateRoot: void 0,
816
+ randaoReveal: new Uint8Array(0),
817
+ depositCount: BigInt("0"),
818
+ depositRoot: void 0,
819
+ blockHash: void 0,
820
+ graffiti: void 0,
821
+ executionPayload: void 0,
822
+ blobKzgCommitments: []
823
+ };
824
+ }
825
+ const BlockHeader$1 = {
826
+ encode(message, writer = _m0__default.Writer.create()) {
827
+ if (message.slot !== void 0 && message.slot !== BigInt("0")) {
828
+ if (BigInt.asUintN(64, message.slot) !== message.slot) {
829
+ throw new globalThis.Error("value provided for field message.slot of type uint64 too large");
830
+ }
831
+ writer.uint32(8).uint64(message.slot.toString());
832
+ }
833
+ if (message.proposerIndex !== void 0 && message.proposerIndex !== 0) {
834
+ writer.uint32(16).uint32(message.proposerIndex);
835
+ }
836
+ if (message.parentRoot !== void 0) {
837
+ B256.encode(message.parentRoot, writer.uint32(26).fork()).ldelim();
838
+ }
839
+ if (message.stateRoot !== void 0) {
840
+ B256.encode(message.stateRoot, writer.uint32(34).fork()).ldelim();
841
+ }
842
+ if (message.randaoReveal !== void 0 && message.randaoReveal.length !== 0) {
843
+ writer.uint32(42).bytes(message.randaoReveal);
844
+ }
845
+ if (message.depositCount !== void 0 && message.depositCount !== BigInt("0")) {
846
+ if (BigInt.asUintN(64, message.depositCount) !== message.depositCount) {
847
+ throw new globalThis.Error("value provided for field message.depositCount of type uint64 too large");
848
+ }
849
+ writer.uint32(48).uint64(message.depositCount.toString());
850
+ }
851
+ if (message.depositRoot !== void 0) {
852
+ B256.encode(message.depositRoot, writer.uint32(58).fork()).ldelim();
853
+ }
854
+ if (message.blockHash !== void 0) {
855
+ B256.encode(message.blockHash, writer.uint32(66).fork()).ldelim();
856
+ }
857
+ if (message.graffiti !== void 0) {
858
+ B256.encode(message.graffiti, writer.uint32(74).fork()).ldelim();
859
+ }
860
+ if (message.executionPayload !== void 0) {
861
+ ExecutionPayload$1.encode(message.executionPayload, writer.uint32(82).fork()).ldelim();
862
+ }
863
+ if (message.blobKzgCommitments !== void 0 && message.blobKzgCommitments.length !== 0) {
864
+ for (const v of message.blobKzgCommitments) {
865
+ B384$1.encode(v, writer.uint32(90).fork()).ldelim();
866
+ }
867
+ }
868
+ return writer;
869
+ },
870
+ decode(input, length) {
871
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
872
+ let end = length === void 0 ? reader.len : reader.pos + length;
873
+ const message = createBaseBlockHeader();
874
+ while (reader.pos < end) {
875
+ const tag = reader.uint32();
876
+ switch (tag >>> 3) {
877
+ case 1:
878
+ if (tag !== 8) {
879
+ break;
880
+ }
881
+ message.slot = longToBigint(reader.uint64());
882
+ continue;
883
+ case 2:
884
+ if (tag !== 16) {
885
+ break;
886
+ }
887
+ message.proposerIndex = reader.uint32();
888
+ continue;
889
+ case 3:
890
+ if (tag !== 26) {
891
+ break;
892
+ }
893
+ message.parentRoot = B256.decode(reader, reader.uint32());
894
+ continue;
895
+ case 4:
896
+ if (tag !== 34) {
897
+ break;
898
+ }
899
+ message.stateRoot = B256.decode(reader, reader.uint32());
900
+ continue;
901
+ case 5:
902
+ if (tag !== 42) {
903
+ break;
904
+ }
905
+ message.randaoReveal = reader.bytes();
906
+ continue;
907
+ case 6:
908
+ if (tag !== 48) {
909
+ break;
910
+ }
911
+ message.depositCount = longToBigint(reader.uint64());
912
+ continue;
913
+ case 7:
914
+ if (tag !== 58) {
915
+ break;
916
+ }
917
+ message.depositRoot = B256.decode(reader, reader.uint32());
918
+ continue;
919
+ case 8:
920
+ if (tag !== 66) {
921
+ break;
922
+ }
923
+ message.blockHash = B256.decode(reader, reader.uint32());
924
+ continue;
925
+ case 9:
926
+ if (tag !== 74) {
927
+ break;
928
+ }
929
+ message.graffiti = B256.decode(reader, reader.uint32());
930
+ continue;
931
+ case 10:
932
+ if (tag !== 82) {
933
+ break;
934
+ }
935
+ message.executionPayload = ExecutionPayload$1.decode(reader, reader.uint32());
936
+ continue;
937
+ case 11:
938
+ if (tag !== 90) {
939
+ break;
940
+ }
941
+ message.blobKzgCommitments.push(B384$1.decode(reader, reader.uint32()));
942
+ continue;
943
+ }
944
+ if ((tag & 7) === 4 || tag === 0) {
945
+ break;
946
+ }
947
+ reader.skipType(tag & 7);
948
+ }
949
+ return message;
950
+ },
951
+ fromJSON(object) {
952
+ return {
953
+ slot: isSet$1(object.slot) ? BigInt(object.slot) : BigInt("0"),
954
+ proposerIndex: isSet$1(object.proposerIndex) ? globalThis.Number(object.proposerIndex) : 0,
955
+ parentRoot: isSet$1(object.parentRoot) ? B256.fromJSON(object.parentRoot) : void 0,
956
+ stateRoot: isSet$1(object.stateRoot) ? B256.fromJSON(object.stateRoot) : void 0,
957
+ randaoReveal: isSet$1(object.randaoReveal) ? bytesFromBase64(object.randaoReveal) : new Uint8Array(0),
958
+ depositCount: isSet$1(object.depositCount) ? BigInt(object.depositCount) : BigInt("0"),
959
+ depositRoot: isSet$1(object.depositRoot) ? B256.fromJSON(object.depositRoot) : void 0,
960
+ blockHash: isSet$1(object.blockHash) ? B256.fromJSON(object.blockHash) : void 0,
961
+ graffiti: isSet$1(object.graffiti) ? B256.fromJSON(object.graffiti) : void 0,
962
+ executionPayload: isSet$1(object.executionPayload) ? ExecutionPayload$1.fromJSON(object.executionPayload) : void 0,
963
+ blobKzgCommitments: globalThis.Array.isArray(object?.blobKzgCommitments) ? object.blobKzgCommitments.map((e) => B384$1.fromJSON(e)) : []
964
+ };
965
+ },
966
+ toJSON(message) {
967
+ const obj = {};
968
+ if (message.slot !== void 0 && message.slot !== BigInt("0")) {
969
+ obj.slot = message.slot.toString();
970
+ }
971
+ if (message.proposerIndex !== void 0 && message.proposerIndex !== 0) {
972
+ obj.proposerIndex = Math.round(message.proposerIndex);
973
+ }
974
+ if (message.parentRoot !== void 0) {
975
+ obj.parentRoot = B256.toJSON(message.parentRoot);
976
+ }
977
+ if (message.stateRoot !== void 0) {
978
+ obj.stateRoot = B256.toJSON(message.stateRoot);
979
+ }
980
+ if (message.randaoReveal !== void 0 && message.randaoReveal.length !== 0) {
981
+ obj.randaoReveal = base64FromBytes(message.randaoReveal);
982
+ }
983
+ if (message.depositCount !== void 0 && message.depositCount !== BigInt("0")) {
984
+ obj.depositCount = message.depositCount.toString();
985
+ }
986
+ if (message.depositRoot !== void 0) {
987
+ obj.depositRoot = B256.toJSON(message.depositRoot);
988
+ }
989
+ if (message.blockHash !== void 0) {
990
+ obj.blockHash = B256.toJSON(message.blockHash);
991
+ }
992
+ if (message.graffiti !== void 0) {
993
+ obj.graffiti = B256.toJSON(message.graffiti);
994
+ }
995
+ if (message.executionPayload !== void 0) {
996
+ obj.executionPayload = ExecutionPayload$1.toJSON(message.executionPayload);
997
+ }
998
+ if (message.blobKzgCommitments?.length) {
999
+ obj.blobKzgCommitments = message.blobKzgCommitments.map((e) => B384$1.toJSON(e));
1000
+ }
1001
+ return obj;
1002
+ },
1003
+ create(base) {
1004
+ return BlockHeader$1.fromPartial(base ?? {});
1005
+ },
1006
+ fromPartial(object) {
1007
+ const message = createBaseBlockHeader();
1008
+ message.slot = object.slot ?? BigInt("0");
1009
+ message.proposerIndex = object.proposerIndex ?? 0;
1010
+ message.parentRoot = object.parentRoot !== void 0 && object.parentRoot !== null ? B256.fromPartial(object.parentRoot) : void 0;
1011
+ message.stateRoot = object.stateRoot !== void 0 && object.stateRoot !== null ? B256.fromPartial(object.stateRoot) : void 0;
1012
+ message.randaoReveal = object.randaoReveal ?? new Uint8Array(0);
1013
+ message.depositCount = object.depositCount ?? BigInt("0");
1014
+ message.depositRoot = object.depositRoot !== void 0 && object.depositRoot !== null ? B256.fromPartial(object.depositRoot) : void 0;
1015
+ message.blockHash = object.blockHash !== void 0 && object.blockHash !== null ? B256.fromPartial(object.blockHash) : void 0;
1016
+ message.graffiti = object.graffiti !== void 0 && object.graffiti !== null ? B256.fromPartial(object.graffiti) : void 0;
1017
+ message.executionPayload = object.executionPayload !== void 0 && object.executionPayload !== null ? ExecutionPayload$1.fromPartial(object.executionPayload) : void 0;
1018
+ message.blobKzgCommitments = object.blobKzgCommitments?.map((e) => B384$1.fromPartial(e)) || [];
1019
+ return message;
1020
+ }
1021
+ };
1022
+ function createBaseTransaction() {
1023
+ return {
1024
+ filterIds: [],
1025
+ transactionHash: void 0,
1026
+ nonce: BigInt("0"),
1027
+ transactionIndex: 0,
1028
+ from: void 0,
1029
+ to: void 0,
1030
+ value: void 0,
1031
+ gasPrice: void 0,
1032
+ gasLimit: void 0,
1033
+ maxFeePerGas: void 0,
1034
+ maxPriorityFeePerGas: void 0,
1035
+ input: new Uint8Array(0),
1036
+ signature: void 0,
1037
+ chainId: void 0,
1038
+ accessList: [],
1039
+ transactionType: BigInt("0"),
1040
+ maxFeePerBlobGas: void 0,
1041
+ blobVersionedHashes: []
1042
+ };
1043
+ }
1044
+ const Transaction$1 = {
1045
+ encode(message, writer = _m0__default.Writer.create()) {
1046
+ if (message.filterIds !== void 0 && message.filterIds.length !== 0) {
1047
+ writer.uint32(10).fork();
1048
+ for (const v of message.filterIds) {
1049
+ writer.uint32(v);
1050
+ }
1051
+ writer.ldelim();
1052
+ }
1053
+ if (message.transactionHash !== void 0) {
1054
+ B256.encode(message.transactionHash, writer.uint32(18).fork()).ldelim();
1055
+ }
1056
+ if (message.nonce !== void 0 && message.nonce !== BigInt("0")) {
1057
+ if (BigInt.asUintN(64, message.nonce) !== message.nonce) {
1058
+ throw new globalThis.Error("value provided for field message.nonce of type uint64 too large");
1059
+ }
1060
+ writer.uint32(24).uint64(message.nonce.toString());
1061
+ }
1062
+ if (message.transactionIndex !== void 0 && message.transactionIndex !== 0) {
1063
+ writer.uint32(32).uint32(message.transactionIndex);
1064
+ }
1065
+ if (message.from !== void 0) {
1066
+ Address.encode(message.from, writer.uint32(42).fork()).ldelim();
1067
+ }
1068
+ if (message.to !== void 0) {
1069
+ Address.encode(message.to, writer.uint32(50).fork()).ldelim();
1070
+ }
1071
+ if (message.value !== void 0) {
1072
+ U256.encode(message.value, writer.uint32(58).fork()).ldelim();
1073
+ }
1074
+ if (message.gasPrice !== void 0) {
1075
+ U128.encode(message.gasPrice, writer.uint32(66).fork()).ldelim();
1076
+ }
1077
+ if (message.gasLimit !== void 0) {
1078
+ U128.encode(message.gasLimit, writer.uint32(74).fork()).ldelim();
1079
+ }
1080
+ if (message.maxFeePerGas !== void 0) {
1081
+ U128.encode(message.maxFeePerGas, writer.uint32(82).fork()).ldelim();
1082
+ }
1083
+ if (message.maxPriorityFeePerGas !== void 0) {
1084
+ U128.encode(message.maxPriorityFeePerGas, writer.uint32(90).fork()).ldelim();
1085
+ }
1086
+ if (message.input !== void 0 && message.input.length !== 0) {
1087
+ writer.uint32(98).bytes(message.input);
1088
+ }
1089
+ if (message.signature !== void 0) {
1090
+ Signature.encode(message.signature, writer.uint32(106).fork()).ldelim();
1091
+ }
1092
+ if (message.chainId !== void 0) {
1093
+ if (BigInt.asUintN(64, message.chainId) !== message.chainId) {
1094
+ throw new globalThis.Error("value provided for field message.chainId of type uint64 too large");
1095
+ }
1096
+ writer.uint32(112).uint64(message.chainId.toString());
1097
+ }
1098
+ if (message.accessList !== void 0 && message.accessList.length !== 0) {
1099
+ for (const v of message.accessList) {
1100
+ AccessListItem.encode(v, writer.uint32(122).fork()).ldelim();
1101
+ }
1102
+ }
1103
+ if (message.transactionType !== void 0 && message.transactionType !== BigInt("0")) {
1104
+ if (BigInt.asUintN(64, message.transactionType) !== message.transactionType) {
1105
+ throw new globalThis.Error("value provided for field message.transactionType of type uint64 too large");
1106
+ }
1107
+ writer.uint32(128).uint64(message.transactionType.toString());
1108
+ }
1109
+ if (message.maxFeePerBlobGas !== void 0) {
1110
+ U128.encode(message.maxFeePerBlobGas, writer.uint32(138).fork()).ldelim();
1111
+ }
1112
+ if (message.blobVersionedHashes !== void 0 && message.blobVersionedHashes.length !== 0) {
1113
+ for (const v of message.blobVersionedHashes) {
1114
+ B256.encode(v, writer.uint32(146).fork()).ldelim();
1115
+ }
1116
+ }
1117
+ return writer;
1118
+ },
1119
+ decode(input, length) {
1120
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
1121
+ let end = length === void 0 ? reader.len : reader.pos + length;
1122
+ const message = createBaseTransaction();
1123
+ while (reader.pos < end) {
1124
+ const tag = reader.uint32();
1125
+ switch (tag >>> 3) {
1126
+ case 1:
1127
+ if (tag === 8) {
1128
+ message.filterIds.push(reader.uint32());
1129
+ continue;
1130
+ }
1131
+ if (tag === 10) {
1132
+ const end2 = reader.uint32() + reader.pos;
1133
+ while (reader.pos < end2) {
1134
+ message.filterIds.push(reader.uint32());
1135
+ }
1136
+ continue;
1137
+ }
1138
+ break;
1139
+ case 2:
1140
+ if (tag !== 18) {
1141
+ break;
1142
+ }
1143
+ message.transactionHash = B256.decode(reader, reader.uint32());
1144
+ continue;
1145
+ case 3:
1146
+ if (tag !== 24) {
1147
+ break;
1148
+ }
1149
+ message.nonce = longToBigint(reader.uint64());
1150
+ continue;
1151
+ case 4:
1152
+ if (tag !== 32) {
1153
+ break;
1154
+ }
1155
+ message.transactionIndex = reader.uint32();
1156
+ continue;
1157
+ case 5:
1158
+ if (tag !== 42) {
1159
+ break;
1160
+ }
1161
+ message.from = Address.decode(reader, reader.uint32());
1162
+ continue;
1163
+ case 6:
1164
+ if (tag !== 50) {
1165
+ break;
1166
+ }
1167
+ message.to = Address.decode(reader, reader.uint32());
1168
+ continue;
1169
+ case 7:
1170
+ if (tag !== 58) {
1171
+ break;
1172
+ }
1173
+ message.value = U256.decode(reader, reader.uint32());
1174
+ continue;
1175
+ case 8:
1176
+ if (tag !== 66) {
1177
+ break;
1178
+ }
1179
+ message.gasPrice = U128.decode(reader, reader.uint32());
1180
+ continue;
1181
+ case 9:
1182
+ if (tag !== 74) {
1183
+ break;
1184
+ }
1185
+ message.gasLimit = U128.decode(reader, reader.uint32());
1186
+ continue;
1187
+ case 10:
1188
+ if (tag !== 82) {
1189
+ break;
1190
+ }
1191
+ message.maxFeePerGas = U128.decode(reader, reader.uint32());
1192
+ continue;
1193
+ case 11:
1194
+ if (tag !== 90) {
1195
+ break;
1196
+ }
1197
+ message.maxPriorityFeePerGas = U128.decode(reader, reader.uint32());
1198
+ continue;
1199
+ case 12:
1200
+ if (tag !== 98) {
1201
+ break;
1202
+ }
1203
+ message.input = reader.bytes();
1204
+ continue;
1205
+ case 13:
1206
+ if (tag !== 106) {
1207
+ break;
1208
+ }
1209
+ message.signature = Signature.decode(reader, reader.uint32());
1210
+ continue;
1211
+ case 14:
1212
+ if (tag !== 112) {
1213
+ break;
1214
+ }
1215
+ message.chainId = longToBigint(reader.uint64());
1216
+ continue;
1217
+ case 15:
1218
+ if (tag !== 122) {
1219
+ break;
1220
+ }
1221
+ message.accessList.push(AccessListItem.decode(reader, reader.uint32()));
1222
+ continue;
1223
+ case 16:
1224
+ if (tag !== 128) {
1225
+ break;
1226
+ }
1227
+ message.transactionType = longToBigint(reader.uint64());
1228
+ continue;
1229
+ case 17:
1230
+ if (tag !== 138) {
1231
+ break;
1232
+ }
1233
+ message.maxFeePerBlobGas = U128.decode(reader, reader.uint32());
1234
+ continue;
1235
+ case 18:
1236
+ if (tag !== 146) {
1237
+ break;
1238
+ }
1239
+ message.blobVersionedHashes.push(B256.decode(reader, reader.uint32()));
1240
+ continue;
1241
+ }
1242
+ if ((tag & 7) === 4 || tag === 0) {
1243
+ break;
1244
+ }
1245
+ reader.skipType(tag & 7);
1246
+ }
1247
+ return message;
1248
+ },
1249
+ fromJSON(object) {
1250
+ return {
1251
+ filterIds: globalThis.Array.isArray(object?.filterIds) ? object.filterIds.map((e) => globalThis.Number(e)) : [],
1252
+ transactionHash: isSet$1(object.transactionHash) ? B256.fromJSON(object.transactionHash) : void 0,
1253
+ nonce: isSet$1(object.nonce) ? BigInt(object.nonce) : BigInt("0"),
1254
+ transactionIndex: isSet$1(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
1255
+ from: isSet$1(object.from) ? Address.fromJSON(object.from) : void 0,
1256
+ to: isSet$1(object.to) ? Address.fromJSON(object.to) : void 0,
1257
+ value: isSet$1(object.value) ? U256.fromJSON(object.value) : void 0,
1258
+ gasPrice: isSet$1(object.gasPrice) ? U128.fromJSON(object.gasPrice) : void 0,
1259
+ gasLimit: isSet$1(object.gasLimit) ? U128.fromJSON(object.gasLimit) : void 0,
1260
+ maxFeePerGas: isSet$1(object.maxFeePerGas) ? U128.fromJSON(object.maxFeePerGas) : void 0,
1261
+ maxPriorityFeePerGas: isSet$1(object.maxPriorityFeePerGas) ? U128.fromJSON(object.maxPriorityFeePerGas) : void 0,
1262
+ input: isSet$1(object.input) ? bytesFromBase64(object.input) : new Uint8Array(0),
1263
+ signature: isSet$1(object.signature) ? Signature.fromJSON(object.signature) : void 0,
1264
+ chainId: isSet$1(object.chainId) ? BigInt(object.chainId) : void 0,
1265
+ accessList: globalThis.Array.isArray(object?.accessList) ? object.accessList.map((e) => AccessListItem.fromJSON(e)) : [],
1266
+ transactionType: isSet$1(object.transactionType) ? BigInt(object.transactionType) : BigInt("0"),
1267
+ maxFeePerBlobGas: isSet$1(object.maxFeePerBlobGas) ? U128.fromJSON(object.maxFeePerBlobGas) : void 0,
1268
+ blobVersionedHashes: globalThis.Array.isArray(object?.blobVersionedHashes) ? object.blobVersionedHashes.map((e) => B256.fromJSON(e)) : []
1269
+ };
1270
+ },
1271
+ toJSON(message) {
1272
+ const obj = {};
1273
+ if (message.filterIds?.length) {
1274
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
1275
+ }
1276
+ if (message.transactionHash !== void 0) {
1277
+ obj.transactionHash = B256.toJSON(message.transactionHash);
1278
+ }
1279
+ if (message.nonce !== void 0 && message.nonce !== BigInt("0")) {
1280
+ obj.nonce = message.nonce.toString();
1281
+ }
1282
+ if (message.transactionIndex !== void 0 && message.transactionIndex !== 0) {
1283
+ obj.transactionIndex = Math.round(message.transactionIndex);
1284
+ }
1285
+ if (message.from !== void 0) {
1286
+ obj.from = Address.toJSON(message.from);
1287
+ }
1288
+ if (message.to !== void 0) {
1289
+ obj.to = Address.toJSON(message.to);
1290
+ }
1291
+ if (message.value !== void 0) {
1292
+ obj.value = U256.toJSON(message.value);
1293
+ }
1294
+ if (message.gasPrice !== void 0) {
1295
+ obj.gasPrice = U128.toJSON(message.gasPrice);
1296
+ }
1297
+ if (message.gasLimit !== void 0) {
1298
+ obj.gasLimit = U128.toJSON(message.gasLimit);
1299
+ }
1300
+ if (message.maxFeePerGas !== void 0) {
1301
+ obj.maxFeePerGas = U128.toJSON(message.maxFeePerGas);
1302
+ }
1303
+ if (message.maxPriorityFeePerGas !== void 0) {
1304
+ obj.maxPriorityFeePerGas = U128.toJSON(message.maxPriorityFeePerGas);
1305
+ }
1306
+ if (message.input !== void 0 && message.input.length !== 0) {
1307
+ obj.input = base64FromBytes(message.input);
1308
+ }
1309
+ if (message.signature !== void 0) {
1310
+ obj.signature = Signature.toJSON(message.signature);
1311
+ }
1312
+ if (message.chainId !== void 0) {
1313
+ obj.chainId = message.chainId.toString();
1314
+ }
1315
+ if (message.accessList?.length) {
1316
+ obj.accessList = message.accessList.map((e) => AccessListItem.toJSON(e));
1317
+ }
1318
+ if (message.transactionType !== void 0 && message.transactionType !== BigInt("0")) {
1319
+ obj.transactionType = message.transactionType.toString();
1320
+ }
1321
+ if (message.maxFeePerBlobGas !== void 0) {
1322
+ obj.maxFeePerBlobGas = U128.toJSON(message.maxFeePerBlobGas);
1323
+ }
1324
+ if (message.blobVersionedHashes?.length) {
1325
+ obj.blobVersionedHashes = message.blobVersionedHashes.map((e) => B256.toJSON(e));
1326
+ }
1327
+ return obj;
1328
+ },
1329
+ create(base) {
1330
+ return Transaction$1.fromPartial(base ?? {});
1331
+ },
1332
+ fromPartial(object) {
1333
+ const message = createBaseTransaction();
1334
+ message.filterIds = object.filterIds?.map((e) => e) || [];
1335
+ message.transactionHash = object.transactionHash !== void 0 && object.transactionHash !== null ? B256.fromPartial(object.transactionHash) : void 0;
1336
+ message.nonce = object.nonce ?? BigInt("0");
1337
+ message.transactionIndex = object.transactionIndex ?? 0;
1338
+ message.from = object.from !== void 0 && object.from !== null ? Address.fromPartial(object.from) : void 0;
1339
+ message.to = object.to !== void 0 && object.to !== null ? Address.fromPartial(object.to) : void 0;
1340
+ message.value = object.value !== void 0 && object.value !== null ? U256.fromPartial(object.value) : void 0;
1341
+ message.gasPrice = object.gasPrice !== void 0 && object.gasPrice !== null ? U128.fromPartial(object.gasPrice) : void 0;
1342
+ message.gasLimit = object.gasLimit !== void 0 && object.gasLimit !== null ? U128.fromPartial(object.gasLimit) : void 0;
1343
+ message.maxFeePerGas = object.maxFeePerGas !== void 0 && object.maxFeePerGas !== null ? U128.fromPartial(object.maxFeePerGas) : void 0;
1344
+ message.maxPriorityFeePerGas = object.maxPriorityFeePerGas !== void 0 && object.maxPriorityFeePerGas !== null ? U128.fromPartial(object.maxPriorityFeePerGas) : void 0;
1345
+ message.input = object.input ?? new Uint8Array(0);
1346
+ message.signature = object.signature !== void 0 && object.signature !== null ? Signature.fromPartial(object.signature) : void 0;
1347
+ message.chainId = object.chainId ?? void 0;
1348
+ message.accessList = object.accessList?.map((e) => AccessListItem.fromPartial(e)) || [];
1349
+ message.transactionType = object.transactionType ?? BigInt("0");
1350
+ message.maxFeePerBlobGas = object.maxFeePerBlobGas !== void 0 && object.maxFeePerBlobGas !== null ? U128.fromPartial(object.maxFeePerBlobGas) : void 0;
1351
+ message.blobVersionedHashes = object.blobVersionedHashes?.map((e) => B256.fromPartial(e)) || [];
1352
+ return message;
1353
+ }
1354
+ };
1355
+ function createBaseValidator() {
1356
+ return {
1357
+ filterIds: [],
1358
+ validatorIndex: 0,
1359
+ balance: BigInt("0"),
1360
+ status: 0,
1361
+ pubkey: void 0,
1362
+ withdrawalCredentials: void 0,
1363
+ effectiveBalance: BigInt("0"),
1364
+ slashed: false,
1365
+ activationEligibilityEpoch: BigInt("0"),
1366
+ activationEpoch: BigInt("0"),
1367
+ exitEpoch: BigInt("0"),
1368
+ withdrawableEpoch: BigInt("0")
1369
+ };
1370
+ }
1371
+ const Validator$1 = {
1372
+ encode(message, writer = _m0__default.Writer.create()) {
1373
+ if (message.filterIds !== void 0 && message.filterIds.length !== 0) {
1374
+ writer.uint32(10).fork();
1375
+ for (const v of message.filterIds) {
1376
+ writer.uint32(v);
1377
+ }
1378
+ writer.ldelim();
1379
+ }
1380
+ if (message.validatorIndex !== void 0 && message.validatorIndex !== 0) {
1381
+ writer.uint32(16).uint32(message.validatorIndex);
1382
+ }
1383
+ if (message.balance !== void 0 && message.balance !== BigInt("0")) {
1384
+ if (BigInt.asUintN(64, message.balance) !== message.balance) {
1385
+ throw new globalThis.Error("value provided for field message.balance of type uint64 too large");
1386
+ }
1387
+ writer.uint32(24).uint64(message.balance.toString());
1388
+ }
1389
+ if (message.status !== void 0 && message.status !== 0) {
1390
+ writer.uint32(32).int32(message.status);
1391
+ }
1392
+ if (message.pubkey !== void 0) {
1393
+ B384$1.encode(message.pubkey, writer.uint32(42).fork()).ldelim();
1394
+ }
1395
+ if (message.withdrawalCredentials !== void 0) {
1396
+ B256.encode(message.withdrawalCredentials, writer.uint32(50).fork()).ldelim();
1397
+ }
1398
+ if (message.effectiveBalance !== void 0 && message.effectiveBalance !== BigInt("0")) {
1399
+ if (BigInt.asUintN(64, message.effectiveBalance) !== message.effectiveBalance) {
1400
+ throw new globalThis.Error("value provided for field message.effectiveBalance of type uint64 too large");
1401
+ }
1402
+ writer.uint32(56).uint64(message.effectiveBalance.toString());
1403
+ }
1404
+ if (message.slashed !== void 0 && message.slashed !== false) {
1405
+ writer.uint32(64).bool(message.slashed);
1406
+ }
1407
+ if (message.activationEligibilityEpoch !== void 0 && message.activationEligibilityEpoch !== BigInt("0")) {
1408
+ if (BigInt.asUintN(64, message.activationEligibilityEpoch) !== message.activationEligibilityEpoch) {
1409
+ throw new globalThis.Error(
1410
+ "value provided for field message.activationEligibilityEpoch of type uint64 too large"
1411
+ );
1412
+ }
1413
+ writer.uint32(72).uint64(message.activationEligibilityEpoch.toString());
1414
+ }
1415
+ if (message.activationEpoch !== void 0 && message.activationEpoch !== BigInt("0")) {
1416
+ if (BigInt.asUintN(64, message.activationEpoch) !== message.activationEpoch) {
1417
+ throw new globalThis.Error("value provided for field message.activationEpoch of type uint64 too large");
1418
+ }
1419
+ writer.uint32(80).uint64(message.activationEpoch.toString());
1420
+ }
1421
+ if (message.exitEpoch !== void 0 && message.exitEpoch !== BigInt("0")) {
1422
+ if (BigInt.asUintN(64, message.exitEpoch) !== message.exitEpoch) {
1423
+ throw new globalThis.Error("value provided for field message.exitEpoch of type uint64 too large");
1424
+ }
1425
+ writer.uint32(88).uint64(message.exitEpoch.toString());
1426
+ }
1427
+ if (message.withdrawableEpoch !== void 0 && message.withdrawableEpoch !== BigInt("0")) {
1428
+ if (BigInt.asUintN(64, message.withdrawableEpoch) !== message.withdrawableEpoch) {
1429
+ throw new globalThis.Error("value provided for field message.withdrawableEpoch of type uint64 too large");
1430
+ }
1431
+ writer.uint32(96).uint64(message.withdrawableEpoch.toString());
1432
+ }
1433
+ return writer;
1434
+ },
1435
+ decode(input, length) {
1436
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
1437
+ let end = length === void 0 ? reader.len : reader.pos + length;
1438
+ const message = createBaseValidator();
1439
+ while (reader.pos < end) {
1440
+ const tag = reader.uint32();
1441
+ switch (tag >>> 3) {
1442
+ case 1:
1443
+ if (tag === 8) {
1444
+ message.filterIds.push(reader.uint32());
1445
+ continue;
1446
+ }
1447
+ if (tag === 10) {
1448
+ const end2 = reader.uint32() + reader.pos;
1449
+ while (reader.pos < end2) {
1450
+ message.filterIds.push(reader.uint32());
1451
+ }
1452
+ continue;
1453
+ }
1454
+ break;
1455
+ case 2:
1456
+ if (tag !== 16) {
1457
+ break;
1458
+ }
1459
+ message.validatorIndex = reader.uint32();
1460
+ continue;
1461
+ case 3:
1462
+ if (tag !== 24) {
1463
+ break;
1464
+ }
1465
+ message.balance = longToBigint(reader.uint64());
1466
+ continue;
1467
+ case 4:
1468
+ if (tag !== 32) {
1469
+ break;
1470
+ }
1471
+ message.status = reader.int32();
1472
+ continue;
1473
+ case 5:
1474
+ if (tag !== 42) {
1475
+ break;
1476
+ }
1477
+ message.pubkey = B384$1.decode(reader, reader.uint32());
1478
+ continue;
1479
+ case 6:
1480
+ if (tag !== 50) {
1481
+ break;
1482
+ }
1483
+ message.withdrawalCredentials = B256.decode(reader, reader.uint32());
1484
+ continue;
1485
+ case 7:
1486
+ if (tag !== 56) {
1487
+ break;
1488
+ }
1489
+ message.effectiveBalance = longToBigint(reader.uint64());
1490
+ continue;
1491
+ case 8:
1492
+ if (tag !== 64) {
1493
+ break;
1494
+ }
1495
+ message.slashed = reader.bool();
1496
+ continue;
1497
+ case 9:
1498
+ if (tag !== 72) {
1499
+ break;
1500
+ }
1501
+ message.activationEligibilityEpoch = longToBigint(reader.uint64());
1502
+ continue;
1503
+ case 10:
1504
+ if (tag !== 80) {
1505
+ break;
1506
+ }
1507
+ message.activationEpoch = longToBigint(reader.uint64());
1508
+ continue;
1509
+ case 11:
1510
+ if (tag !== 88) {
1511
+ break;
1512
+ }
1513
+ message.exitEpoch = longToBigint(reader.uint64());
1514
+ continue;
1515
+ case 12:
1516
+ if (tag !== 96) {
1517
+ break;
1518
+ }
1519
+ message.withdrawableEpoch = longToBigint(reader.uint64());
1520
+ continue;
1521
+ }
1522
+ if ((tag & 7) === 4 || tag === 0) {
1523
+ break;
1524
+ }
1525
+ reader.skipType(tag & 7);
1526
+ }
1527
+ return message;
1528
+ },
1529
+ fromJSON(object) {
1530
+ return {
1531
+ filterIds: globalThis.Array.isArray(object?.filterIds) ? object.filterIds.map((e) => globalThis.Number(e)) : [],
1532
+ validatorIndex: isSet$1(object.validatorIndex) ? globalThis.Number(object.validatorIndex) : 0,
1533
+ balance: isSet$1(object.balance) ? BigInt(object.balance) : BigInt("0"),
1534
+ status: isSet$1(object.status) ? validatorStatusFromJSON(object.status) : 0,
1535
+ pubkey: isSet$1(object.pubkey) ? B384$1.fromJSON(object.pubkey) : void 0,
1536
+ withdrawalCredentials: isSet$1(object.withdrawalCredentials) ? B256.fromJSON(object.withdrawalCredentials) : void 0,
1537
+ effectiveBalance: isSet$1(object.effectiveBalance) ? BigInt(object.effectiveBalance) : BigInt("0"),
1538
+ slashed: isSet$1(object.slashed) ? globalThis.Boolean(object.slashed) : false,
1539
+ activationEligibilityEpoch: isSet$1(object.activationEligibilityEpoch) ? BigInt(object.activationEligibilityEpoch) : BigInt("0"),
1540
+ activationEpoch: isSet$1(object.activationEpoch) ? BigInt(object.activationEpoch) : BigInt("0"),
1541
+ exitEpoch: isSet$1(object.exitEpoch) ? BigInt(object.exitEpoch) : BigInt("0"),
1542
+ withdrawableEpoch: isSet$1(object.withdrawableEpoch) ? BigInt(object.withdrawableEpoch) : BigInt("0")
1543
+ };
1544
+ },
1545
+ toJSON(message) {
1546
+ const obj = {};
1547
+ if (message.filterIds?.length) {
1548
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
1549
+ }
1550
+ if (message.validatorIndex !== void 0 && message.validatorIndex !== 0) {
1551
+ obj.validatorIndex = Math.round(message.validatorIndex);
1552
+ }
1553
+ if (message.balance !== void 0 && message.balance !== BigInt("0")) {
1554
+ obj.balance = message.balance.toString();
1555
+ }
1556
+ if (message.status !== void 0 && message.status !== 0) {
1557
+ obj.status = validatorStatusToJSON(message.status);
1558
+ }
1559
+ if (message.pubkey !== void 0) {
1560
+ obj.pubkey = B384$1.toJSON(message.pubkey);
1561
+ }
1562
+ if (message.withdrawalCredentials !== void 0) {
1563
+ obj.withdrawalCredentials = B256.toJSON(message.withdrawalCredentials);
1564
+ }
1565
+ if (message.effectiveBalance !== void 0 && message.effectiveBalance !== BigInt("0")) {
1566
+ obj.effectiveBalance = message.effectiveBalance.toString();
1567
+ }
1568
+ if (message.slashed !== void 0 && message.slashed !== false) {
1569
+ obj.slashed = message.slashed;
1570
+ }
1571
+ if (message.activationEligibilityEpoch !== void 0 && message.activationEligibilityEpoch !== BigInt("0")) {
1572
+ obj.activationEligibilityEpoch = message.activationEligibilityEpoch.toString();
1573
+ }
1574
+ if (message.activationEpoch !== void 0 && message.activationEpoch !== BigInt("0")) {
1575
+ obj.activationEpoch = message.activationEpoch.toString();
1576
+ }
1577
+ if (message.exitEpoch !== void 0 && message.exitEpoch !== BigInt("0")) {
1578
+ obj.exitEpoch = message.exitEpoch.toString();
1579
+ }
1580
+ if (message.withdrawableEpoch !== void 0 && message.withdrawableEpoch !== BigInt("0")) {
1581
+ obj.withdrawableEpoch = message.withdrawableEpoch.toString();
1582
+ }
1583
+ return obj;
1584
+ },
1585
+ create(base) {
1586
+ return Validator$1.fromPartial(base ?? {});
1587
+ },
1588
+ fromPartial(object) {
1589
+ const message = createBaseValidator();
1590
+ message.filterIds = object.filterIds?.map((e) => e) || [];
1591
+ message.validatorIndex = object.validatorIndex ?? 0;
1592
+ message.balance = object.balance ?? BigInt("0");
1593
+ message.status = object.status ?? 0;
1594
+ message.pubkey = object.pubkey !== void 0 && object.pubkey !== null ? B384$1.fromPartial(object.pubkey) : void 0;
1595
+ message.withdrawalCredentials = object.withdrawalCredentials !== void 0 && object.withdrawalCredentials !== null ? B256.fromPartial(object.withdrawalCredentials) : void 0;
1596
+ message.effectiveBalance = object.effectiveBalance ?? BigInt("0");
1597
+ message.slashed = object.slashed ?? false;
1598
+ message.activationEligibilityEpoch = object.activationEligibilityEpoch ?? BigInt("0");
1599
+ message.activationEpoch = object.activationEpoch ?? BigInt("0");
1600
+ message.exitEpoch = object.exitEpoch ?? BigInt("0");
1601
+ message.withdrawableEpoch = object.withdrawableEpoch ?? BigInt("0");
1602
+ return message;
1603
+ }
1604
+ };
1605
+ function createBaseBlob() {
1606
+ return {
1607
+ filterIds: [],
1608
+ blobIndex: 0,
1609
+ blob: new Uint8Array(0),
1610
+ kzgCommitment: void 0,
1611
+ kzgProof: void 0,
1612
+ kzgCommitmentInclusionProof: [],
1613
+ blobHash: void 0,
1614
+ transactionIndex: 0,
1615
+ transactionHash: void 0
1616
+ };
1617
+ }
1618
+ const Blob$1 = {
1619
+ encode(message, writer = _m0__default.Writer.create()) {
1620
+ if (message.filterIds !== void 0 && message.filterIds.length !== 0) {
1621
+ writer.uint32(10).fork();
1622
+ for (const v of message.filterIds) {
1623
+ writer.uint32(v);
1624
+ }
1625
+ writer.ldelim();
1626
+ }
1627
+ if (message.blobIndex !== void 0 && message.blobIndex !== 0) {
1628
+ writer.uint32(16).uint32(message.blobIndex);
1629
+ }
1630
+ if (message.blob !== void 0 && message.blob.length !== 0) {
1631
+ writer.uint32(26).bytes(message.blob);
1632
+ }
1633
+ if (message.kzgCommitment !== void 0) {
1634
+ B384$1.encode(message.kzgCommitment, writer.uint32(34).fork()).ldelim();
1635
+ }
1636
+ if (message.kzgProof !== void 0) {
1637
+ B384$1.encode(message.kzgProof, writer.uint32(42).fork()).ldelim();
1638
+ }
1639
+ if (message.kzgCommitmentInclusionProof !== void 0 && message.kzgCommitmentInclusionProof.length !== 0) {
1640
+ for (const v of message.kzgCommitmentInclusionProof) {
1641
+ B256.encode(v, writer.uint32(50).fork()).ldelim();
1642
+ }
1643
+ }
1644
+ if (message.blobHash !== void 0) {
1645
+ B256.encode(message.blobHash, writer.uint32(58).fork()).ldelim();
1646
+ }
1647
+ if (message.transactionIndex !== void 0 && message.transactionIndex !== 0) {
1648
+ writer.uint32(64).uint32(message.transactionIndex);
1649
+ }
1650
+ if (message.transactionHash !== void 0) {
1651
+ B256.encode(message.transactionHash, writer.uint32(74).fork()).ldelim();
1652
+ }
1653
+ return writer;
1654
+ },
1655
+ decode(input, length) {
1656
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
1657
+ let end = length === void 0 ? reader.len : reader.pos + length;
1658
+ const message = createBaseBlob();
1659
+ while (reader.pos < end) {
1660
+ const tag = reader.uint32();
1661
+ switch (tag >>> 3) {
1662
+ case 1:
1663
+ if (tag === 8) {
1664
+ message.filterIds.push(reader.uint32());
1665
+ continue;
1666
+ }
1667
+ if (tag === 10) {
1668
+ const end2 = reader.uint32() + reader.pos;
1669
+ while (reader.pos < end2) {
1670
+ message.filterIds.push(reader.uint32());
1671
+ }
1672
+ continue;
1673
+ }
1674
+ break;
1675
+ case 2:
1676
+ if (tag !== 16) {
1677
+ break;
1678
+ }
1679
+ message.blobIndex = reader.uint32();
1680
+ continue;
1681
+ case 3:
1682
+ if (tag !== 26) {
1683
+ break;
1684
+ }
1685
+ message.blob = reader.bytes();
1686
+ continue;
1687
+ case 4:
1688
+ if (tag !== 34) {
1689
+ break;
1690
+ }
1691
+ message.kzgCommitment = B384$1.decode(reader, reader.uint32());
1692
+ continue;
1693
+ case 5:
1694
+ if (tag !== 42) {
1695
+ break;
1696
+ }
1697
+ message.kzgProof = B384$1.decode(reader, reader.uint32());
1698
+ continue;
1699
+ case 6:
1700
+ if (tag !== 50) {
1701
+ break;
1702
+ }
1703
+ message.kzgCommitmentInclusionProof.push(B256.decode(reader, reader.uint32()));
1704
+ continue;
1705
+ case 7:
1706
+ if (tag !== 58) {
1707
+ break;
1708
+ }
1709
+ message.blobHash = B256.decode(reader, reader.uint32());
1710
+ continue;
1711
+ case 8:
1712
+ if (tag !== 64) {
1713
+ break;
1714
+ }
1715
+ message.transactionIndex = reader.uint32();
1716
+ continue;
1717
+ case 9:
1718
+ if (tag !== 74) {
1719
+ break;
1720
+ }
1721
+ message.transactionHash = B256.decode(reader, reader.uint32());
1722
+ continue;
1723
+ }
1724
+ if ((tag & 7) === 4 || tag === 0) {
1725
+ break;
1726
+ }
1727
+ reader.skipType(tag & 7);
1728
+ }
1729
+ return message;
1730
+ },
1731
+ fromJSON(object) {
1732
+ return {
1733
+ filterIds: globalThis.Array.isArray(object?.filterIds) ? object.filterIds.map((e) => globalThis.Number(e)) : [],
1734
+ blobIndex: isSet$1(object.blobIndex) ? globalThis.Number(object.blobIndex) : 0,
1735
+ blob: isSet$1(object.blob) ? bytesFromBase64(object.blob) : new Uint8Array(0),
1736
+ kzgCommitment: isSet$1(object.kzgCommitment) ? B384$1.fromJSON(object.kzgCommitment) : void 0,
1737
+ kzgProof: isSet$1(object.kzgProof) ? B384$1.fromJSON(object.kzgProof) : void 0,
1738
+ kzgCommitmentInclusionProof: globalThis.Array.isArray(object?.kzgCommitmentInclusionProof) ? object.kzgCommitmentInclusionProof.map((e) => B256.fromJSON(e)) : [],
1739
+ blobHash: isSet$1(object.blobHash) ? B256.fromJSON(object.blobHash) : void 0,
1740
+ transactionIndex: isSet$1(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
1741
+ transactionHash: isSet$1(object.transactionHash) ? B256.fromJSON(object.transactionHash) : void 0
1742
+ };
1743
+ },
1744
+ toJSON(message) {
1745
+ const obj = {};
1746
+ if (message.filterIds?.length) {
1747
+ obj.filterIds = message.filterIds.map((e) => Math.round(e));
1748
+ }
1749
+ if (message.blobIndex !== void 0 && message.blobIndex !== 0) {
1750
+ obj.blobIndex = Math.round(message.blobIndex);
1751
+ }
1752
+ if (message.blob !== void 0 && message.blob.length !== 0) {
1753
+ obj.blob = base64FromBytes(message.blob);
1754
+ }
1755
+ if (message.kzgCommitment !== void 0) {
1756
+ obj.kzgCommitment = B384$1.toJSON(message.kzgCommitment);
1757
+ }
1758
+ if (message.kzgProof !== void 0) {
1759
+ obj.kzgProof = B384$1.toJSON(message.kzgProof);
1760
+ }
1761
+ if (message.kzgCommitmentInclusionProof?.length) {
1762
+ obj.kzgCommitmentInclusionProof = message.kzgCommitmentInclusionProof.map((e) => B256.toJSON(e));
1763
+ }
1764
+ if (message.blobHash !== void 0) {
1765
+ obj.blobHash = B256.toJSON(message.blobHash);
1766
+ }
1767
+ if (message.transactionIndex !== void 0 && message.transactionIndex !== 0) {
1768
+ obj.transactionIndex = Math.round(message.transactionIndex);
1769
+ }
1770
+ if (message.transactionHash !== void 0) {
1771
+ obj.transactionHash = B256.toJSON(message.transactionHash);
1772
+ }
1773
+ return obj;
1774
+ },
1775
+ create(base) {
1776
+ return Blob$1.fromPartial(base ?? {});
1777
+ },
1778
+ fromPartial(object) {
1779
+ const message = createBaseBlob();
1780
+ message.filterIds = object.filterIds?.map((e) => e) || [];
1781
+ message.blobIndex = object.blobIndex ?? 0;
1782
+ message.blob = object.blob ?? new Uint8Array(0);
1783
+ message.kzgCommitment = object.kzgCommitment !== void 0 && object.kzgCommitment !== null ? B384$1.fromPartial(object.kzgCommitment) : void 0;
1784
+ message.kzgProof = object.kzgProof !== void 0 && object.kzgProof !== null ? B384$1.fromPartial(object.kzgProof) : void 0;
1785
+ message.kzgCommitmentInclusionProof = object.kzgCommitmentInclusionProof?.map((e) => B256.fromPartial(e)) || [];
1786
+ message.blobHash = object.blobHash !== void 0 && object.blobHash !== null ? B256.fromPartial(object.blobHash) : void 0;
1787
+ message.transactionIndex = object.transactionIndex ?? 0;
1788
+ message.transactionHash = object.transactionHash !== void 0 && object.transactionHash !== null ? B256.fromPartial(object.transactionHash) : void 0;
1789
+ return message;
1790
+ }
1791
+ };
1792
+ function createBaseExecutionPayload() {
1793
+ return {
1794
+ parentHash: void 0,
1795
+ feeRecipient: void 0,
1796
+ stateRoot: void 0,
1797
+ receiptsRoot: void 0,
1798
+ logsBloom: new Uint8Array(0),
1799
+ prevRandao: void 0,
1800
+ blockNumber: BigInt("0"),
1801
+ timestamp: void 0
1802
+ };
1803
+ }
1804
+ const ExecutionPayload$1 = {
1805
+ encode(message, writer = _m0__default.Writer.create()) {
1806
+ if (message.parentHash !== void 0) {
1807
+ B256.encode(message.parentHash, writer.uint32(10).fork()).ldelim();
1808
+ }
1809
+ if (message.feeRecipient !== void 0) {
1810
+ Address.encode(message.feeRecipient, writer.uint32(18).fork()).ldelim();
1811
+ }
1812
+ if (message.stateRoot !== void 0) {
1813
+ B256.encode(message.stateRoot, writer.uint32(26).fork()).ldelim();
1814
+ }
1815
+ if (message.receiptsRoot !== void 0) {
1816
+ B256.encode(message.receiptsRoot, writer.uint32(34).fork()).ldelim();
1817
+ }
1818
+ if (message.logsBloom !== void 0 && message.logsBloom.length !== 0) {
1819
+ writer.uint32(42).bytes(message.logsBloom);
1820
+ }
1821
+ if (message.prevRandao !== void 0) {
1822
+ B256.encode(message.prevRandao, writer.uint32(50).fork()).ldelim();
1823
+ }
1824
+ if (message.blockNumber !== void 0 && message.blockNumber !== BigInt("0")) {
1825
+ if (BigInt.asUintN(64, message.blockNumber) !== message.blockNumber) {
1826
+ throw new globalThis.Error("value provided for field message.blockNumber of type uint64 too large");
1827
+ }
1828
+ writer.uint32(56).uint64(message.blockNumber.toString());
1829
+ }
1830
+ if (message.timestamp !== void 0) {
1831
+ Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(66).fork()).ldelim();
1832
+ }
1833
+ return writer;
1834
+ },
1835
+ decode(input, length) {
1836
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
1837
+ let end = length === void 0 ? reader.len : reader.pos + length;
1838
+ const message = createBaseExecutionPayload();
1839
+ while (reader.pos < end) {
1840
+ const tag = reader.uint32();
1841
+ switch (tag >>> 3) {
1842
+ case 1:
1843
+ if (tag !== 10) {
1844
+ break;
1845
+ }
1846
+ message.parentHash = B256.decode(reader, reader.uint32());
1847
+ continue;
1848
+ case 2:
1849
+ if (tag !== 18) {
1850
+ break;
1851
+ }
1852
+ message.feeRecipient = Address.decode(reader, reader.uint32());
1853
+ continue;
1854
+ case 3:
1855
+ if (tag !== 26) {
1856
+ break;
1857
+ }
1858
+ message.stateRoot = B256.decode(reader, reader.uint32());
1859
+ continue;
1860
+ case 4:
1861
+ if (tag !== 34) {
1862
+ break;
1863
+ }
1864
+ message.receiptsRoot = B256.decode(reader, reader.uint32());
1865
+ continue;
1866
+ case 5:
1867
+ if (tag !== 42) {
1868
+ break;
1869
+ }
1870
+ message.logsBloom = reader.bytes();
1871
+ continue;
1872
+ case 6:
1873
+ if (tag !== 50) {
1874
+ break;
1875
+ }
1876
+ message.prevRandao = B256.decode(reader, reader.uint32());
1877
+ continue;
1878
+ case 7:
1879
+ if (tag !== 56) {
1880
+ break;
1881
+ }
1882
+ message.blockNumber = longToBigint(reader.uint64());
1883
+ continue;
1884
+ case 8:
1885
+ if (tag !== 66) {
1886
+ break;
1887
+ }
1888
+ message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1889
+ continue;
1890
+ }
1891
+ if ((tag & 7) === 4 || tag === 0) {
1892
+ break;
1893
+ }
1894
+ reader.skipType(tag & 7);
1895
+ }
1896
+ return message;
1897
+ },
1898
+ fromJSON(object) {
1899
+ return {
1900
+ parentHash: isSet$1(object.parentHash) ? B256.fromJSON(object.parentHash) : void 0,
1901
+ feeRecipient: isSet$1(object.feeRecipient) ? Address.fromJSON(object.feeRecipient) : void 0,
1902
+ stateRoot: isSet$1(object.stateRoot) ? B256.fromJSON(object.stateRoot) : void 0,
1903
+ receiptsRoot: isSet$1(object.receiptsRoot) ? B256.fromJSON(object.receiptsRoot) : void 0,
1904
+ logsBloom: isSet$1(object.logsBloom) ? bytesFromBase64(object.logsBloom) : new Uint8Array(0),
1905
+ prevRandao: isSet$1(object.prevRandao) ? B256.fromJSON(object.prevRandao) : void 0,
1906
+ blockNumber: isSet$1(object.blockNumber) ? BigInt(object.blockNumber) : BigInt("0"),
1907
+ timestamp: isSet$1(object.timestamp) ? fromJsonTimestamp(object.timestamp) : void 0
1908
+ };
1909
+ },
1910
+ toJSON(message) {
1911
+ const obj = {};
1912
+ if (message.parentHash !== void 0) {
1913
+ obj.parentHash = B256.toJSON(message.parentHash);
1914
+ }
1915
+ if (message.feeRecipient !== void 0) {
1916
+ obj.feeRecipient = Address.toJSON(message.feeRecipient);
1917
+ }
1918
+ if (message.stateRoot !== void 0) {
1919
+ obj.stateRoot = B256.toJSON(message.stateRoot);
1920
+ }
1921
+ if (message.receiptsRoot !== void 0) {
1922
+ obj.receiptsRoot = B256.toJSON(message.receiptsRoot);
1923
+ }
1924
+ if (message.logsBloom !== void 0 && message.logsBloom.length !== 0) {
1925
+ obj.logsBloom = base64FromBytes(message.logsBloom);
1926
+ }
1927
+ if (message.prevRandao !== void 0) {
1928
+ obj.prevRandao = B256.toJSON(message.prevRandao);
1929
+ }
1930
+ if (message.blockNumber !== void 0 && message.blockNumber !== BigInt("0")) {
1931
+ obj.blockNumber = message.blockNumber.toString();
1932
+ }
1933
+ if (message.timestamp !== void 0) {
1934
+ obj.timestamp = message.timestamp.toISOString();
1935
+ }
1936
+ return obj;
1937
+ },
1938
+ create(base) {
1939
+ return ExecutionPayload$1.fromPartial(base ?? {});
1940
+ },
1941
+ fromPartial(object) {
1942
+ const message = createBaseExecutionPayload();
1943
+ message.parentHash = object.parentHash !== void 0 && object.parentHash !== null ? B256.fromPartial(object.parentHash) : void 0;
1944
+ message.feeRecipient = object.feeRecipient !== void 0 && object.feeRecipient !== null ? Address.fromPartial(object.feeRecipient) : void 0;
1945
+ message.stateRoot = object.stateRoot !== void 0 && object.stateRoot !== null ? B256.fromPartial(object.stateRoot) : void 0;
1946
+ message.receiptsRoot = object.receiptsRoot !== void 0 && object.receiptsRoot !== null ? B256.fromPartial(object.receiptsRoot) : void 0;
1947
+ message.logsBloom = object.logsBloom ?? new Uint8Array(0);
1948
+ message.prevRandao = object.prevRandao !== void 0 && object.prevRandao !== null ? B256.fromPartial(object.prevRandao) : void 0;
1949
+ message.blockNumber = object.blockNumber ?? BigInt("0");
1950
+ message.timestamp = object.timestamp ?? void 0;
1951
+ return message;
1952
+ }
1953
+ };
1954
+ function createBaseSignature() {
1955
+ return { r: void 0, s: void 0 };
1956
+ }
1957
+ const Signature = {
1958
+ encode(message, writer = _m0__default.Writer.create()) {
1959
+ if (message.r !== void 0) {
1960
+ U256.encode(message.r, writer.uint32(10).fork()).ldelim();
1961
+ }
1962
+ if (message.s !== void 0) {
1963
+ U256.encode(message.s, writer.uint32(18).fork()).ldelim();
1964
+ }
1965
+ return writer;
1966
+ },
1967
+ decode(input, length) {
1968
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
1969
+ let end = length === void 0 ? reader.len : reader.pos + length;
1970
+ const message = createBaseSignature();
1971
+ while (reader.pos < end) {
1972
+ const tag = reader.uint32();
1973
+ switch (tag >>> 3) {
1974
+ case 1:
1975
+ if (tag !== 10) {
1976
+ break;
1977
+ }
1978
+ message.r = U256.decode(reader, reader.uint32());
1979
+ continue;
1980
+ case 2:
1981
+ if (tag !== 18) {
1982
+ break;
1983
+ }
1984
+ message.s = U256.decode(reader, reader.uint32());
1985
+ continue;
1986
+ }
1987
+ if ((tag & 7) === 4 || tag === 0) {
1988
+ break;
1989
+ }
1990
+ reader.skipType(tag & 7);
1991
+ }
1992
+ return message;
1993
+ },
1994
+ fromJSON(object) {
1995
+ return {
1996
+ r: isSet$1(object.r) ? U256.fromJSON(object.r) : void 0,
1997
+ s: isSet$1(object.s) ? U256.fromJSON(object.s) : void 0
1998
+ };
1999
+ },
2000
+ toJSON(message) {
2001
+ const obj = {};
2002
+ if (message.r !== void 0) {
2003
+ obj.r = U256.toJSON(message.r);
2004
+ }
2005
+ if (message.s !== void 0) {
2006
+ obj.s = U256.toJSON(message.s);
2007
+ }
2008
+ return obj;
2009
+ },
2010
+ create(base) {
2011
+ return Signature.fromPartial(base ?? {});
2012
+ },
2013
+ fromPartial(object) {
2014
+ const message = createBaseSignature();
2015
+ message.r = object.r !== void 0 && object.r !== null ? U256.fromPartial(object.r) : void 0;
2016
+ message.s = object.s !== void 0 && object.s !== null ? U256.fromPartial(object.s) : void 0;
2017
+ return message;
2018
+ }
2019
+ };
2020
+ function createBaseAccessListItem() {
2021
+ return { address: void 0, storageKeys: [] };
2022
+ }
2023
+ const AccessListItem = {
2024
+ encode(message, writer = _m0__default.Writer.create()) {
2025
+ if (message.address !== void 0) {
2026
+ Address.encode(message.address, writer.uint32(10).fork()).ldelim();
2027
+ }
2028
+ if (message.storageKeys !== void 0 && message.storageKeys.length !== 0) {
2029
+ for (const v of message.storageKeys) {
2030
+ B256.encode(v, writer.uint32(18).fork()).ldelim();
2031
+ }
2032
+ }
2033
+ return writer;
2034
+ },
2035
+ decode(input, length) {
2036
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
2037
+ let end = length === void 0 ? reader.len : reader.pos + length;
2038
+ const message = createBaseAccessListItem();
2039
+ while (reader.pos < end) {
2040
+ const tag = reader.uint32();
2041
+ switch (tag >>> 3) {
2042
+ case 1:
2043
+ if (tag !== 10) {
2044
+ break;
2045
+ }
2046
+ message.address = Address.decode(reader, reader.uint32());
2047
+ continue;
2048
+ case 2:
2049
+ if (tag !== 18) {
2050
+ break;
2051
+ }
2052
+ message.storageKeys.push(B256.decode(reader, reader.uint32()));
2053
+ continue;
2054
+ }
2055
+ if ((tag & 7) === 4 || tag === 0) {
2056
+ break;
2057
+ }
2058
+ reader.skipType(tag & 7);
2059
+ }
2060
+ return message;
2061
+ },
2062
+ fromJSON(object) {
2063
+ return {
2064
+ address: isSet$1(object.address) ? Address.fromJSON(object.address) : void 0,
2065
+ storageKeys: globalThis.Array.isArray(object?.storageKeys) ? object.storageKeys.map((e) => B256.fromJSON(e)) : []
2066
+ };
2067
+ },
2068
+ toJSON(message) {
2069
+ const obj = {};
2070
+ if (message.address !== void 0) {
2071
+ obj.address = Address.toJSON(message.address);
2072
+ }
2073
+ if (message.storageKeys?.length) {
2074
+ obj.storageKeys = message.storageKeys.map((e) => B256.toJSON(e));
2075
+ }
2076
+ return obj;
2077
+ },
2078
+ create(base) {
2079
+ return AccessListItem.fromPartial(base ?? {});
2080
+ },
2081
+ fromPartial(object) {
2082
+ const message = createBaseAccessListItem();
2083
+ message.address = object.address !== void 0 && object.address !== null ? Address.fromPartial(object.address) : void 0;
2084
+ message.storageKeys = object.storageKeys?.map((e) => B256.fromPartial(e)) || [];
2085
+ return message;
2086
+ }
2087
+ };
2088
+ function bytesFromBase64(b64) {
2089
+ if (globalThis.Buffer) {
2090
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
2091
+ } else {
2092
+ const bin = globalThis.atob(b64);
2093
+ const arr = new Uint8Array(bin.length);
2094
+ for (let i = 0; i < bin.length; ++i) {
2095
+ arr[i] = bin.charCodeAt(i);
2096
+ }
2097
+ return arr;
2098
+ }
2099
+ }
2100
+ function base64FromBytes(arr) {
2101
+ if (globalThis.Buffer) {
2102
+ return globalThis.Buffer.from(arr).toString("base64");
2103
+ } else {
2104
+ const bin = [];
2105
+ arr.forEach((byte) => {
2106
+ bin.push(globalThis.String.fromCharCode(byte));
2107
+ });
2108
+ return globalThis.btoa(bin.join(""));
2109
+ }
2110
+ }
2111
+ function toTimestamp(date) {
2112
+ const seconds = BigInt(Math.trunc(date.getTime() / 1e3));
2113
+ const nanos = date.getTime() % 1e3 * 1e6;
2114
+ return { seconds, nanos };
2115
+ }
2116
+ function fromTimestamp(t) {
2117
+ let millis = (globalThis.Number(t.seconds?.toString()) || 0) * 1e3;
2118
+ millis += (t.nanos || 0) / 1e6;
2119
+ return new globalThis.Date(millis);
2120
+ }
2121
+ function fromJsonTimestamp(o) {
2122
+ if (o instanceof globalThis.Date) {
2123
+ return o;
2124
+ } else if (typeof o === "string") {
2125
+ return new globalThis.Date(o);
2126
+ } else {
2127
+ return fromTimestamp(Timestamp.fromJSON(o));
2128
+ }
2129
+ }
2130
+ function longToBigint(long) {
2131
+ return BigInt(long.toString());
2132
+ }
2133
+ if (_m0__default.util.Long !== Long__default) {
2134
+ _m0__default.util.Long = Long__default;
2135
+ _m0__default.configure();
2136
+ }
2137
+ function isSet$1(value) {
2138
+ return value !== null && value !== void 0;
2139
+ }
2140
+
2141
+ const data = {
2142
+ __proto__: null,
2143
+ AccessListItem: AccessListItem,
2144
+ Blob: Blob$1,
2145
+ Block: Block$1,
2146
+ BlockHeader: BlockHeader$1,
2147
+ ExecutionPayload: ExecutionPayload$1,
2148
+ Signature: Signature,
2149
+ Transaction: Transaction$1,
2150
+ Validator: Validator$1,
2151
+ protobufPackage: protobufPackage$1
2152
+ };
2153
+
2154
+ const protobufPackage = "beaconchain.v2";
2155
+ function createBaseFilter() {
2156
+ return { header: void 0, transactions: [], validators: [], blobs: [] };
2157
+ }
2158
+ const Filter$1 = {
2159
+ encode(message, writer = _m0__default.Writer.create()) {
2160
+ if (message.header !== void 0) {
2161
+ HeaderFilter$1.encode(message.header, writer.uint32(10).fork()).ldelim();
2162
+ }
2163
+ if (message.transactions !== void 0 && message.transactions.length !== 0) {
2164
+ for (const v of message.transactions) {
2165
+ TransactionFilter$1.encode(v, writer.uint32(18).fork()).ldelim();
2166
+ }
2167
+ }
2168
+ if (message.validators !== void 0 && message.validators.length !== 0) {
2169
+ for (const v of message.validators) {
2170
+ ValidatorFilter$1.encode(v, writer.uint32(26).fork()).ldelim();
2171
+ }
2172
+ }
2173
+ if (message.blobs !== void 0 && message.blobs.length !== 0) {
2174
+ for (const v of message.blobs) {
2175
+ BlobFilter$1.encode(v, writer.uint32(34).fork()).ldelim();
2176
+ }
2177
+ }
2178
+ return writer;
2179
+ },
2180
+ decode(input, length) {
2181
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
2182
+ let end = length === void 0 ? reader.len : reader.pos + length;
2183
+ const message = createBaseFilter();
2184
+ while (reader.pos < end) {
2185
+ const tag = reader.uint32();
2186
+ switch (tag >>> 3) {
2187
+ case 1:
2188
+ if (tag !== 10) {
2189
+ break;
2190
+ }
2191
+ message.header = HeaderFilter$1.decode(reader, reader.uint32());
2192
+ continue;
2193
+ case 2:
2194
+ if (tag !== 18) {
2195
+ break;
2196
+ }
2197
+ message.transactions.push(TransactionFilter$1.decode(reader, reader.uint32()));
2198
+ continue;
2199
+ case 3:
2200
+ if (tag !== 26) {
2201
+ break;
2202
+ }
2203
+ message.validators.push(ValidatorFilter$1.decode(reader, reader.uint32()));
2204
+ continue;
2205
+ case 4:
2206
+ if (tag !== 34) {
2207
+ break;
2208
+ }
2209
+ message.blobs.push(BlobFilter$1.decode(reader, reader.uint32()));
2210
+ continue;
2211
+ }
2212
+ if ((tag & 7) === 4 || tag === 0) {
2213
+ break;
2214
+ }
2215
+ reader.skipType(tag & 7);
2216
+ }
2217
+ return message;
2218
+ },
2219
+ fromJSON(object) {
2220
+ return {
2221
+ header: isSet(object.header) ? HeaderFilter$1.fromJSON(object.header) : void 0,
2222
+ transactions: globalThis.Array.isArray(object?.transactions) ? object.transactions.map((e) => TransactionFilter$1.fromJSON(e)) : [],
2223
+ validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e) => ValidatorFilter$1.fromJSON(e)) : [],
2224
+ blobs: globalThis.Array.isArray(object?.blobs) ? object.blobs.map((e) => BlobFilter$1.fromJSON(e)) : []
2225
+ };
2226
+ },
2227
+ toJSON(message) {
2228
+ const obj = {};
2229
+ if (message.header !== void 0) {
2230
+ obj.header = HeaderFilter$1.toJSON(message.header);
2231
+ }
2232
+ if (message.transactions?.length) {
2233
+ obj.transactions = message.transactions.map((e) => TransactionFilter$1.toJSON(e));
2234
+ }
2235
+ if (message.validators?.length) {
2236
+ obj.validators = message.validators.map((e) => ValidatorFilter$1.toJSON(e));
2237
+ }
2238
+ if (message.blobs?.length) {
2239
+ obj.blobs = message.blobs.map((e) => BlobFilter$1.toJSON(e));
2240
+ }
2241
+ return obj;
2242
+ },
2243
+ create(base) {
2244
+ return Filter$1.fromPartial(base ?? {});
2245
+ },
2246
+ fromPartial(object) {
2247
+ const message = createBaseFilter();
2248
+ message.header = object.header !== void 0 && object.header !== null ? HeaderFilter$1.fromPartial(object.header) : void 0;
2249
+ message.transactions = object.transactions?.map((e) => TransactionFilter$1.fromPartial(e)) || [];
2250
+ message.validators = object.validators?.map((e) => ValidatorFilter$1.fromPartial(e)) || [];
2251
+ message.blobs = object.blobs?.map((e) => BlobFilter$1.fromPartial(e)) || [];
2252
+ return message;
2253
+ }
2254
+ };
2255
+ function createBaseHeaderFilter() {
2256
+ return { always: void 0 };
2257
+ }
2258
+ const HeaderFilter$1 = {
2259
+ encode(message, writer = _m0__default.Writer.create()) {
2260
+ if (message.always !== void 0) {
2261
+ writer.uint32(8).bool(message.always);
2262
+ }
2263
+ return writer;
2264
+ },
2265
+ decode(input, length) {
2266
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
2267
+ let end = length === void 0 ? reader.len : reader.pos + length;
2268
+ const message = createBaseHeaderFilter();
2269
+ while (reader.pos < end) {
2270
+ const tag = reader.uint32();
2271
+ switch (tag >>> 3) {
2272
+ case 1:
2273
+ if (tag !== 8) {
2274
+ break;
2275
+ }
2276
+ message.always = reader.bool();
2277
+ continue;
2278
+ }
2279
+ if ((tag & 7) === 4 || tag === 0) {
2280
+ break;
2281
+ }
2282
+ reader.skipType(tag & 7);
2283
+ }
2284
+ return message;
2285
+ },
2286
+ fromJSON(object) {
2287
+ return { always: isSet(object.always) ? globalThis.Boolean(object.always) : void 0 };
2288
+ },
2289
+ toJSON(message) {
2290
+ const obj = {};
2291
+ if (message.always !== void 0) {
2292
+ obj.always = message.always;
2293
+ }
2294
+ return obj;
2295
+ },
2296
+ create(base) {
2297
+ return HeaderFilter$1.fromPartial(base ?? {});
2298
+ },
2299
+ fromPartial(object) {
2300
+ const message = createBaseHeaderFilter();
2301
+ message.always = object.always ?? void 0;
2302
+ return message;
2303
+ }
2304
+ };
2305
+ function createBaseTransactionFilter() {
2306
+ return { id: 0, from: void 0, to: void 0, create: void 0, includeBlob: void 0 };
2307
+ }
2308
+ const TransactionFilter$1 = {
2309
+ encode(message, writer = _m0__default.Writer.create()) {
2310
+ if (message.id !== void 0 && message.id !== 0) {
2311
+ writer.uint32(8).uint32(message.id);
2312
+ }
2313
+ if (message.from !== void 0) {
2314
+ Address.encode(message.from, writer.uint32(18).fork()).ldelim();
2315
+ }
2316
+ if (message.to !== void 0) {
2317
+ Address.encode(message.to, writer.uint32(26).fork()).ldelim();
2318
+ }
2319
+ if (message.create !== void 0) {
2320
+ writer.uint32(32).bool(message.create);
2321
+ }
2322
+ if (message.includeBlob !== void 0) {
2323
+ writer.uint32(40).bool(message.includeBlob);
2324
+ }
2325
+ return writer;
2326
+ },
2327
+ decode(input, length) {
2328
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
2329
+ let end = length === void 0 ? reader.len : reader.pos + length;
2330
+ const message = createBaseTransactionFilter();
2331
+ while (reader.pos < end) {
2332
+ const tag = reader.uint32();
2333
+ switch (tag >>> 3) {
2334
+ case 1:
2335
+ if (tag !== 8) {
2336
+ break;
2337
+ }
2338
+ message.id = reader.uint32();
2339
+ continue;
2340
+ case 2:
2341
+ if (tag !== 18) {
2342
+ break;
2343
+ }
2344
+ message.from = Address.decode(reader, reader.uint32());
2345
+ continue;
2346
+ case 3:
2347
+ if (tag !== 26) {
2348
+ break;
2349
+ }
2350
+ message.to = Address.decode(reader, reader.uint32());
2351
+ continue;
2352
+ case 4:
2353
+ if (tag !== 32) {
2354
+ break;
2355
+ }
2356
+ message.create = reader.bool();
2357
+ continue;
2358
+ case 5:
2359
+ if (tag !== 40) {
2360
+ break;
2361
+ }
2362
+ message.includeBlob = reader.bool();
2363
+ continue;
2364
+ }
2365
+ if ((tag & 7) === 4 || tag === 0) {
2366
+ break;
2367
+ }
2368
+ reader.skipType(tag & 7);
2369
+ }
2370
+ return message;
2371
+ },
2372
+ fromJSON(object) {
2373
+ return {
2374
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
2375
+ from: isSet(object.from) ? Address.fromJSON(object.from) : void 0,
2376
+ to: isSet(object.to) ? Address.fromJSON(object.to) : void 0,
2377
+ create: isSet(object.create) ? globalThis.Boolean(object.create) : void 0,
2378
+ includeBlob: isSet(object.includeBlob) ? globalThis.Boolean(object.includeBlob) : void 0
2379
+ };
2380
+ },
2381
+ toJSON(message) {
2382
+ const obj = {};
2383
+ if (message.id !== void 0 && message.id !== 0) {
2384
+ obj.id = Math.round(message.id);
2385
+ }
2386
+ if (message.from !== void 0) {
2387
+ obj.from = Address.toJSON(message.from);
2388
+ }
2389
+ if (message.to !== void 0) {
2390
+ obj.to = Address.toJSON(message.to);
2391
+ }
2392
+ if (message.create !== void 0) {
2393
+ obj.create = message.create;
2394
+ }
2395
+ if (message.includeBlob !== void 0) {
2396
+ obj.includeBlob = message.includeBlob;
2397
+ }
2398
+ return obj;
2399
+ },
2400
+ create(base) {
2401
+ return TransactionFilter$1.fromPartial(base ?? {});
2402
+ },
2403
+ fromPartial(object) {
2404
+ const message = createBaseTransactionFilter();
2405
+ message.id = object.id ?? 0;
2406
+ message.from = object.from !== void 0 && object.from !== null ? Address.fromPartial(object.from) : void 0;
2407
+ message.to = object.to !== void 0 && object.to !== null ? Address.fromPartial(object.to) : void 0;
2408
+ message.create = object.create ?? void 0;
2409
+ message.includeBlob = object.includeBlob ?? void 0;
2410
+ return message;
2411
+ }
2412
+ };
2413
+ function createBaseValidatorFilter() {
2414
+ return { id: 0, validatorIndex: void 0, status: void 0 };
2415
+ }
2416
+ const ValidatorFilter$1 = {
2417
+ encode(message, writer = _m0__default.Writer.create()) {
2418
+ if (message.id !== void 0 && message.id !== 0) {
2419
+ writer.uint32(8).uint32(message.id);
2420
+ }
2421
+ if (message.validatorIndex !== void 0) {
2422
+ writer.uint32(16).uint32(message.validatorIndex);
2423
+ }
2424
+ if (message.status !== void 0) {
2425
+ writer.uint32(24).int32(message.status);
2426
+ }
2427
+ return writer;
2428
+ },
2429
+ decode(input, length) {
2430
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
2431
+ let end = length === void 0 ? reader.len : reader.pos + length;
2432
+ const message = createBaseValidatorFilter();
2433
+ while (reader.pos < end) {
2434
+ const tag = reader.uint32();
2435
+ switch (tag >>> 3) {
2436
+ case 1:
2437
+ if (tag !== 8) {
2438
+ break;
2439
+ }
2440
+ message.id = reader.uint32();
2441
+ continue;
2442
+ case 2:
2443
+ if (tag !== 16) {
2444
+ break;
2445
+ }
2446
+ message.validatorIndex = reader.uint32();
2447
+ continue;
2448
+ case 3:
2449
+ if (tag !== 24) {
2450
+ break;
2451
+ }
2452
+ message.status = reader.int32();
2453
+ continue;
2454
+ }
2455
+ if ((tag & 7) === 4 || tag === 0) {
2456
+ break;
2457
+ }
2458
+ reader.skipType(tag & 7);
2459
+ }
2460
+ return message;
2461
+ },
2462
+ fromJSON(object) {
2463
+ return {
2464
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
2465
+ validatorIndex: isSet(object.validatorIndex) ? globalThis.Number(object.validatorIndex) : void 0,
2466
+ status: isSet(object.status) ? validatorStatusFromJSON(object.status) : void 0
2467
+ };
2468
+ },
2469
+ toJSON(message) {
2470
+ const obj = {};
2471
+ if (message.id !== void 0 && message.id !== 0) {
2472
+ obj.id = Math.round(message.id);
2473
+ }
2474
+ if (message.validatorIndex !== void 0) {
2475
+ obj.validatorIndex = Math.round(message.validatorIndex);
2476
+ }
2477
+ if (message.status !== void 0) {
2478
+ obj.status = validatorStatusToJSON(message.status);
2479
+ }
2480
+ return obj;
2481
+ },
2482
+ create(base) {
2483
+ return ValidatorFilter$1.fromPartial(base ?? {});
2484
+ },
2485
+ fromPartial(object) {
2486
+ const message = createBaseValidatorFilter();
2487
+ message.id = object.id ?? 0;
2488
+ message.validatorIndex = object.validatorIndex ?? void 0;
2489
+ message.status = object.status ?? void 0;
2490
+ return message;
2491
+ }
2492
+ };
2493
+ function createBaseBlobFilter() {
2494
+ return { id: 0, includeTransaction: void 0 };
2495
+ }
2496
+ const BlobFilter$1 = {
2497
+ encode(message, writer = _m0__default.Writer.create()) {
2498
+ if (message.id !== void 0 && message.id !== 0) {
2499
+ writer.uint32(8).uint32(message.id);
2500
+ }
2501
+ if (message.includeTransaction !== void 0) {
2502
+ writer.uint32(16).bool(message.includeTransaction);
2503
+ }
2504
+ return writer;
2505
+ },
2506
+ decode(input, length) {
2507
+ const reader = input instanceof _m0__default.Reader ? input : _m0__default.Reader.create(input);
2508
+ let end = length === void 0 ? reader.len : reader.pos + length;
2509
+ const message = createBaseBlobFilter();
2510
+ while (reader.pos < end) {
2511
+ const tag = reader.uint32();
2512
+ switch (tag >>> 3) {
2513
+ case 1:
2514
+ if (tag !== 8) {
2515
+ break;
2516
+ }
2517
+ message.id = reader.uint32();
2518
+ continue;
2519
+ case 2:
2520
+ if (tag !== 16) {
2521
+ break;
2522
+ }
2523
+ message.includeTransaction = reader.bool();
2524
+ continue;
2525
+ }
2526
+ if ((tag & 7) === 4 || tag === 0) {
2527
+ break;
2528
+ }
2529
+ reader.skipType(tag & 7);
2530
+ }
2531
+ return message;
2532
+ },
2533
+ fromJSON(object) {
2534
+ return {
2535
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
2536
+ includeTransaction: isSet(object.includeTransaction) ? globalThis.Boolean(object.includeTransaction) : void 0
2537
+ };
2538
+ },
2539
+ toJSON(message) {
2540
+ const obj = {};
2541
+ if (message.id !== void 0 && message.id !== 0) {
2542
+ obj.id = Math.round(message.id);
2543
+ }
2544
+ if (message.includeTransaction !== void 0) {
2545
+ obj.includeTransaction = message.includeTransaction;
2546
+ }
2547
+ return obj;
2548
+ },
2549
+ create(base) {
2550
+ return BlobFilter$1.fromPartial(base ?? {});
2551
+ },
2552
+ fromPartial(object) {
2553
+ const message = createBaseBlobFilter();
2554
+ message.id = object.id ?? 0;
2555
+ message.includeTransaction = object.includeTransaction ?? void 0;
2556
+ return message;
2557
+ }
2558
+ };
2559
+ function isSet(value) {
2560
+ return value !== null && value !== void 0;
2561
+ }
2562
+
2563
+ const filter = {
2564
+ __proto__: null,
2565
+ BlobFilter: BlobFilter$1,
2566
+ Filter: Filter$1,
2567
+ HeaderFilter: HeaderFilter$1,
2568
+ TransactionFilter: TransactionFilter$1,
2569
+ ValidatorFilter: ValidatorFilter$1,
2570
+ protobufPackage: protobufPackage
2571
+ };
2572
+
2573
+ const index = {
2574
+ __proto__: null,
2575
+ common: common,
2576
+ data: data,
2577
+ filter: filter
2578
+ };
2579
+
2580
+ const ValidatorStatus = schema.Schema.transform(
2581
+ schema.Schema.Enums(ValidatorStatus$1),
2582
+ schema.Schema.Literal(
2583
+ "pending_initialized",
2584
+ "pending_queued",
2585
+ "active_ongoing",
2586
+ "active_exiting",
2587
+ "active_slashed",
2588
+ "exited_unslashed",
2589
+ "exited_slashed",
2590
+ "withdrawal_possible",
2591
+ "withdrawal_done",
2592
+ "unknown"
2593
+ ),
2594
+ {
2595
+ decode(value) {
2596
+ const enumMap = {
2597
+ [ValidatorStatus$1.PENDING_INITIALIZED]: "pending_initialized",
2598
+ [ValidatorStatus$1.PENDING_QUEUED]: "pending_queued",
2599
+ [ValidatorStatus$1.ACTIVE_ONGOING]: "active_ongoing",
2600
+ [ValidatorStatus$1.ACTIVE_EXITING]: "active_exiting",
2601
+ [ValidatorStatus$1.ACTIVE_SLASHED]: "active_slashed",
2602
+ [ValidatorStatus$1.EXITED_UNSLASHED]: "exited_unslashed",
2603
+ [ValidatorStatus$1.EXITED_SLASHED]: "exited_slashed",
2604
+ [ValidatorStatus$1.WITHDRAWAL_POSSIBLE]: "withdrawal_possible",
2605
+ [ValidatorStatus$1.WITHDRAWAL_DONE]: "withdrawal_done",
2606
+ [ValidatorStatus$1.UNKNOWN]: "unknown",
2607
+ [ValidatorStatus$1.UNRECOGNIZED]: "unknown"
2608
+ };
2609
+ return enumMap[value] ?? "unknown";
2610
+ },
2611
+ encode(value) {
2612
+ const enumMap = {
2613
+ pending_initialized: ValidatorStatus$1.PENDING_INITIALIZED,
2614
+ pending_queued: ValidatorStatus$1.PENDING_QUEUED,
2615
+ active_ongoing: ValidatorStatus$1.ACTIVE_ONGOING,
2616
+ active_exiting: ValidatorStatus$1.ACTIVE_EXITING,
2617
+ active_slashed: ValidatorStatus$1.ACTIVE_SLASHED,
2618
+ exited_unslashed: ValidatorStatus$1.EXITED_UNSLASHED,
2619
+ exited_slashed: ValidatorStatus$1.EXITED_SLASHED,
2620
+ withdrawal_possible: ValidatorStatus$1.WITHDRAWAL_POSSIBLE,
2621
+ withdrawal_done: ValidatorStatus$1.WITHDRAWAL_DONE,
2622
+ unknown: ValidatorStatus$1.UNKNOWN
2623
+ };
2624
+ return enumMap[value] ?? ValidatorStatus$1.UNKNOWN;
2625
+ }
2626
+ }
2627
+ );
2628
+ const _B384 = schema.Schema.TemplateLiteral(schema.Schema.Literal("0x"), schema.Schema.String);
2629
+ const B384Proto = schema.Schema.Struct({
2630
+ x0: schema.Schema.BigIntFromSelf,
2631
+ x1: schema.Schema.BigIntFromSelf,
2632
+ x2: schema.Schema.BigIntFromSelf,
2633
+ x3: schema.Schema.BigIntFromSelf,
2634
+ x4: schema.Schema.BigIntFromSelf,
2635
+ x5: schema.Schema.BigIntFromSelf
2636
+ });
2637
+ const B384 = schema.Schema.transform(B384Proto, _B384, {
2638
+ decode(value) {
2639
+ const x0 = value.x0.toString(16).padStart(16, "0");
2640
+ const x1 = value.x1.toString(16).padStart(16, "0");
2641
+ const x2 = value.x2.toString(16).padStart(16, "0");
2642
+ const x3 = value.x3.toString(16).padStart(16, "0");
2643
+ const x4 = value.x4.toString(16).padStart(16, "0");
2644
+ const x5 = value.x5.toString(16).padStart(16, "0");
2645
+ return `0x${x0}${x1}${x2}${x3}${x4}${x5}`;
2646
+ },
2647
+ encode(value) {
2648
+ const bytes = viem.hexToBytes(viem.pad(value, { size: 48, dir: "left" }));
2649
+ const dv = new DataView(bytes.buffer);
2650
+ const x0 = dv.getBigUint64(0);
2651
+ const x1 = dv.getBigUint64(8);
2652
+ const x2 = dv.getBigUint64(16);
2653
+ const x3 = dv.getBigUint64(24);
2654
+ const x4 = dv.getBigUint64(32);
2655
+ const x5 = dv.getBigUint64(40);
2656
+ return { x0, x1, x2, x3, x4, x5 };
2657
+ }
2658
+ });
2659
+
2660
+ const ExecutionPayload = schema.Schema.Struct({
2661
+ parentHash: schema.Schema.optional(evm.B256),
2662
+ feeRecipient: schema.Schema.optional(evm.Address),
2663
+ stateRoot: schema.Schema.optional(evm.B256),
2664
+ receiptsRoot: schema.Schema.optional(evm.B256),
2665
+ logsBloom: protocol.BytesFromUint8Array,
2666
+ prevRandao: schema.Schema.optional(evm.B256),
2667
+ blockNumber: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2668
+ timestamp: schema.Schema.optional(schema.Schema.DateFromSelf)
2669
+ });
2670
+ const BlockHeader = schema.Schema.Struct({
2671
+ slot: schema.Schema.BigIntFromSelf,
2672
+ proposerIndex: schema.Schema.Number,
2673
+ parentRoot: schema.Schema.optional(evm.B256),
2674
+ stateRoot: schema.Schema.optional(evm.B256),
2675
+ randaoReveal: protocol.BytesFromUint8Array,
2676
+ depositCount: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2677
+ depositRoot: schema.Schema.optional(evm.B256),
2678
+ blockHash: schema.Schema.optional(evm.B256),
2679
+ graffiti: schema.Schema.optional(evm.B256),
2680
+ executionPayload: schema.Schema.optional(ExecutionPayload),
2681
+ blobKzgCommitments: schema.Schema.optional(schema.Schema.Array(B384))
2682
+ });
2683
+ const Validator = schema.Schema.Struct({
2684
+ filterIds: schema.Schema.optional(schema.Schema.Array(schema.Schema.Number)),
2685
+ validatorIndex: schema.Schema.optional(schema.Schema.Number),
2686
+ balance: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2687
+ status: schema.Schema.optional(ValidatorStatus),
2688
+ pubkey: schema.Schema.optional(B384),
2689
+ withdrawalCredentials: schema.Schema.optional(evm.B256),
2690
+ effectiveBalance: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2691
+ slashed: schema.Schema.optional(schema.Schema.Boolean),
2692
+ activationEligibilityEpoch: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2693
+ activationEpoch: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2694
+ exitEpoch: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2695
+ withdrawableEpoch: schema.Schema.optional(schema.Schema.BigIntFromSelf)
2696
+ });
2697
+ const Blob = schema.Schema.Struct({
2698
+ filterIds: schema.Schema.optional(schema.Schema.Array(schema.Schema.Number)),
2699
+ blobIndex: schema.Schema.optional(schema.Schema.Number),
2700
+ blob: schema.Schema.optional(schema.Schema.Uint8ArrayFromSelf),
2701
+ kzgCommitment: schema.Schema.optional(B384),
2702
+ kzgProof: schema.Schema.optional(B384),
2703
+ kzgCommitmentInclusionProof: schema.Schema.optional(schema.Schema.Array(evm.B256)),
2704
+ blobHash: schema.Schema.optional(evm.B256),
2705
+ transactionIndex: schema.Schema.optional(schema.Schema.Number),
2706
+ transactionHash: schema.Schema.optional(evm.B256)
2707
+ });
2708
+ const Transaction = schema.Schema.Struct({
2709
+ filterIds: schema.Schema.optional(schema.Schema.Array(schema.Schema.Number)),
2710
+ transactionHash: schema.Schema.optional(evm.B256),
2711
+ nonce: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2712
+ transactionIndex: schema.Schema.optional(schema.Schema.Number),
2713
+ from: schema.Schema.optional(evm.Address),
2714
+ to: schema.Schema.optional(evm.Address),
2715
+ value: schema.Schema.optional(evm.U256),
2716
+ gasPrice: schema.Schema.optional(evm.U128),
2717
+ gasLimit: schema.Schema.optional(evm.U128),
2718
+ maxFeePerGas: schema.Schema.optional(evm.U128),
2719
+ maxPriorityFeePerGas: schema.Schema.optional(evm.U128),
2720
+ input: schema.Schema.optional(schema.Schema.Uint8ArrayFromSelf),
2721
+ signature: schema.Schema.optional(evm.Signature),
2722
+ chainId: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2723
+ accessList: schema.Schema.optional(schema.Schema.Array(evm.AccessListItem)),
2724
+ transactionType: schema.Schema.optional(schema.Schema.BigIntFromSelf),
2725
+ maxFeePerBlobGas: schema.Schema.optional(evm.U128),
2726
+ blobVersionedHashes: schema.Schema.optional(schema.Schema.Array(evm.B256))
2727
+ });
2728
+ const Block = schema.Schema.Struct({
2729
+ header: schema.Schema.optional(BlockHeader),
2730
+ validators: schema.Schema.Array(Validator),
2731
+ blobs: schema.Schema.Array(Blob),
2732
+ transactions: schema.Schema.Array(Transaction)
2733
+ });
2734
+ const BlockFromBytes = schema.Schema.transform(
2735
+ schema.Schema.Uint8ArrayFromSelf,
2736
+ schema.Schema.NullOr(Block),
2737
+ {
2738
+ strict: false,
2739
+ decode(value) {
2740
+ if (value.length === 0) {
2741
+ return null;
2742
+ }
2743
+ return Block$1.decode(value);
2744
+ },
2745
+ encode(value) {
2746
+ if (value === null) {
2747
+ return new Uint8Array();
2748
+ }
2749
+ return Block$1.encode(value).finish();
2750
+ }
2751
+ }
2752
+ );
2753
+
2754
+ const HeaderFilter = schema.Schema.Struct({
2755
+ always: schema.Schema.optional(schema.Schema.Boolean)
2756
+ });
2757
+ const TransactionFilter = schema.Schema.Struct({
2758
+ id: schema.Schema.optional(schema.Schema.Number),
2759
+ from: schema.Schema.optional(evm.Address),
2760
+ to: schema.Schema.optional(evm.Address),
2761
+ create: schema.Schema.optional(schema.Schema.Boolean),
2762
+ includeBlob: schema.Schema.optional(schema.Schema.Boolean)
2763
+ });
2764
+ const ValidatorFilter = schema.Schema.Struct({
2765
+ id: schema.Schema.optional(schema.Schema.Number),
2766
+ validatorIndex: schema.Schema.optional(schema.Schema.Number),
2767
+ status: schema.Schema.optional(ValidatorStatus)
2768
+ });
2769
+ const BlobFilter = schema.Schema.Struct({
2770
+ id: schema.Schema.optional(schema.Schema.Number),
2771
+ includeTransaction: schema.Schema.optional(schema.Schema.Boolean)
2772
+ });
2773
+ const Filter = schema.Schema.Struct({
2774
+ header: schema.Schema.optional(HeaderFilter),
2775
+ transactions: schema.Schema.optional(schema.Schema.Array(TransactionFilter)),
2776
+ validators: schema.Schema.optional(schema.Schema.Array(ValidatorFilter)),
2777
+ blobs: schema.Schema.optional(schema.Schema.Array(BlobFilter))
2778
+ });
2779
+ const filterToProto = schema.Schema.encodeSync(Filter);
2780
+ const filterFromProto = schema.Schema.decodeSync(Filter);
2781
+ const FilterFromBytes = schema.Schema.transform(
2782
+ schema.Schema.Uint8ArrayFromSelf,
2783
+ Filter,
2784
+ {
2785
+ strict: false,
2786
+ decode(value) {
2787
+ return Filter$1.decode(value);
2788
+ },
2789
+ encode(value) {
2790
+ return Filter$1.encode(value).finish();
2791
+ }
2792
+ }
2793
+ );
2794
+ const filterToBytes = schema.Schema.encodeSync(FilterFromBytes);
2795
+ const filterFromBytes = schema.Schema.decodeSync(FilterFromBytes);
2796
+ function mergeFilter(a, b) {
2797
+ const header = mergeHeaderFilter(a.header, b.header);
2798
+ return {
2799
+ header,
2800
+ transactions: [...a.transactions ?? [], ...b.transactions ?? []],
2801
+ validators: [...a.validators ?? [], ...b.validators ?? []],
2802
+ blobs: [...a.blobs ?? [], ...b.blobs ?? []]
2803
+ };
2804
+ }
2805
+ function mergeHeaderFilter(a, b) {
2806
+ if (a === void 0) {
2807
+ return b;
2808
+ }
2809
+ if (b === void 0) {
2810
+ return a;
2811
+ }
2812
+ return {
2813
+ always: a.always || b.always
2814
+ };
2815
+ }
2816
+
2817
+ const BeaconChainStream = new protocol.StreamConfig(
2818
+ FilterFromBytes,
2819
+ BlockFromBytes,
2820
+ mergeFilter
2821
+ );
2822
+
2823
+ exports.Address = evm.Address;
2824
+ exports.B256 = evm.B256;
2825
+ exports.U128 = evm.U128;
2826
+ exports.U256 = evm.U256;
2827
+ exports.B384 = B384;
2828
+ exports.BeaconChainStream = BeaconChainStream;
2829
+ exports.Blob = Blob;
2830
+ exports.BlobFilter = BlobFilter;
2831
+ exports.Block = Block;
2832
+ exports.BlockFromBytes = BlockFromBytes;
2833
+ exports.BlockHeader = BlockHeader;
2834
+ exports.ExecutionPayload = ExecutionPayload;
2835
+ exports.Filter = Filter;
2836
+ exports.FilterFromBytes = FilterFromBytes;
2837
+ exports.HeaderFilter = HeaderFilter;
2838
+ exports.Transaction = Transaction;
2839
+ exports.TransactionFilter = TransactionFilter;
2840
+ exports.Validator = Validator;
2841
+ exports.ValidatorFilter = ValidatorFilter;
2842
+ exports.ValidatorStatus = ValidatorStatus;
2843
+ exports.filterFromBytes = filterFromBytes;
2844
+ exports.filterFromProto = filterFromProto;
2845
+ exports.filterToBytes = filterToBytes;
2846
+ exports.filterToProto = filterToProto;
2847
+ exports.mergeFilter = mergeFilter;
2848
+ exports.proto = index;