@orbitflare/sdk 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +120 -0
  2. package/dist/config.d.ts +0 -1
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/config.js +1 -9
  5. package/dist/config.js.map +1 -1
  6. package/dist/filters.d.ts +38 -0
  7. package/dist/filters.d.ts.map +1 -0
  8. package/dist/filters.js +42 -0
  9. package/dist/filters.js.map +1 -0
  10. package/dist/grpc.d.ts +91 -2
  11. package/dist/grpc.d.ts.map +1 -1
  12. package/dist/grpc.js +302 -4
  13. package/dist/grpc.js.map +1 -1
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/jetstream/filters.d.ts +16 -0
  19. package/dist/jetstream/filters.d.ts.map +1 -0
  20. package/dist/jetstream/filters.js +42 -0
  21. package/dist/jetstream/filters.js.map +1 -0
  22. package/dist/{jetstream.d.ts → jetstream/index.d.ts} +12 -6
  23. package/dist/jetstream/index.d.ts.map +1 -0
  24. package/dist/{jetstream.js → jetstream/index.js} +40 -10
  25. package/dist/jetstream/index.js.map +1 -0
  26. package/dist/jetstream/v2.d.ts +108 -0
  27. package/dist/jetstream/v2.d.ts.map +1 -0
  28. package/dist/jetstream/v2.js +575 -0
  29. package/dist/jetstream/v2.js.map +1 -0
  30. package/dist/logger.d.ts +23 -0
  31. package/dist/logger.d.ts.map +1 -0
  32. package/dist/logger.js +88 -0
  33. package/dist/logger.js.map +1 -0
  34. package/dist/proto/geyser.d.ts +41 -41
  35. package/dist/proto/geyser.d.ts.map +1 -1
  36. package/dist/proto/geyser.js +397 -287
  37. package/dist/proto/geyser.js.map +1 -1
  38. package/dist/proto/google/protobuf/timestamp.d.ts +2 -2
  39. package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -1
  40. package/dist/proto/google/protobuf/timestamp.js +10 -17
  41. package/dist/proto/google/protobuf/timestamp.js.map +1 -1
  42. package/dist/proto/jetstream.d.ts +33 -30
  43. package/dist/proto/jetstream.d.ts.map +1 -1
  44. package/dist/proto/jetstream.js +234 -175
  45. package/dist/proto/jetstream.js.map +1 -1
  46. package/dist/proto/jetstream_v2.d.ts +278 -0
  47. package/dist/proto/jetstream_v2.d.ts.map +1 -0
  48. package/dist/proto/jetstream_v2.js +2040 -0
  49. package/dist/proto/jetstream_v2.js.map +1 -0
  50. package/dist/proto/solana-storage.d.ts +12 -12
  51. package/dist/proto/solana-storage.d.ts.map +1 -1
  52. package/dist/proto/solana-storage.js +108 -87
  53. package/dist/proto/solana-storage.js.map +1 -1
  54. package/dist/proto.d.ts +1 -0
  55. package/dist/proto.d.ts.map +1 -1
  56. package/dist/proto.js +1 -0
  57. package/dist/proto.js.map +1 -1
  58. package/dist/rpc.d.ts +7 -0
  59. package/dist/rpc.d.ts.map +1 -1
  60. package/dist/rpc.js +19 -3
  61. package/dist/rpc.js.map +1 -1
  62. package/dist/ws.d.ts +7 -0
  63. package/dist/ws.d.ts.map +1 -1
  64. package/dist/ws.js +29 -4
  65. package/dist/ws.js.map +1 -1
  66. package/package.json +18 -6
  67. package/dist/jetstream.d.ts.map +0 -1
  68. package/dist/jetstream.js.map +0 -1
@@ -0,0 +1,2040 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.7
4
+ // protoc v4.23.4
5
+ // source: jetstream_v2.proto
6
+ /* eslint-disable */
7
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ import { makeGenericClientConstructor, } from "@grpc/grpc-js";
9
+ import { Timestamp } from "./google/protobuf/timestamp.js";
10
+ export const protobufPackage = "jetstream.v2";
11
+ export var SlotStatus;
12
+ (function (SlotStatus) {
13
+ SlotStatus[SlotStatus["SLOT_STATUS_UNSPECIFIED"] = 0] = "SLOT_STATUS_UNSPECIFIED";
14
+ /** SLOT_STATUS_ALIVE - first shred of this slot received */
15
+ SlotStatus[SlotStatus["SLOT_STATUS_ALIVE"] = 1] = "SLOT_STATUS_ALIVE";
16
+ /** SLOT_STATUS_COMPLETE - last shred of this slot received */
17
+ SlotStatus[SlotStatus["SLOT_STATUS_COMPLETE"] = 2] = "SLOT_STATUS_COMPLETE";
18
+ /** SLOT_STATUS_DEAD - slot skipped, or superseded by later slots without completing */
19
+ SlotStatus[SlotStatus["SLOT_STATUS_DEAD"] = 3] = "SLOT_STATUS_DEAD";
20
+ SlotStatus[SlotStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
21
+ })(SlotStatus || (SlotStatus = {}));
22
+ export function slotStatusFromJSON(object) {
23
+ switch (object) {
24
+ case 0:
25
+ case "SLOT_STATUS_UNSPECIFIED":
26
+ return SlotStatus.SLOT_STATUS_UNSPECIFIED;
27
+ case 1:
28
+ case "SLOT_STATUS_ALIVE":
29
+ return SlotStatus.SLOT_STATUS_ALIVE;
30
+ case 2:
31
+ case "SLOT_STATUS_COMPLETE":
32
+ return SlotStatus.SLOT_STATUS_COMPLETE;
33
+ case 3:
34
+ case "SLOT_STATUS_DEAD":
35
+ return SlotStatus.SLOT_STATUS_DEAD;
36
+ case -1:
37
+ case "UNRECOGNIZED":
38
+ default:
39
+ return SlotStatus.UNRECOGNIZED;
40
+ }
41
+ }
42
+ export function slotStatusToJSON(object) {
43
+ switch (object) {
44
+ case SlotStatus.SLOT_STATUS_UNSPECIFIED:
45
+ return "SLOT_STATUS_UNSPECIFIED";
46
+ case SlotStatus.SLOT_STATUS_ALIVE:
47
+ return "SLOT_STATUS_ALIVE";
48
+ case SlotStatus.SLOT_STATUS_COMPLETE:
49
+ return "SLOT_STATUS_COMPLETE";
50
+ case SlotStatus.SLOT_STATUS_DEAD:
51
+ return "SLOT_STATUS_DEAD";
52
+ case SlotStatus.UNRECOGNIZED:
53
+ default:
54
+ return "UNRECOGNIZED";
55
+ }
56
+ }
57
+ function createBaseSubscribeTransactionsRequest() {
58
+ return { ping: undefined, addFilters: undefined, removeFilters: undefined };
59
+ }
60
+ export const SubscribeTransactionsRequest = {
61
+ encode(message, writer = new BinaryWriter()) {
62
+ if (message.ping !== undefined) {
63
+ Ping.encode(message.ping, writer.uint32(10).fork()).join();
64
+ }
65
+ if (message.addFilters !== undefined) {
66
+ AddFilters.encode(message.addFilters, writer.uint32(18).fork()).join();
67
+ }
68
+ if (message.removeFilters !== undefined) {
69
+ RemoveFilters.encode(message.removeFilters, writer.uint32(26).fork()).join();
70
+ }
71
+ return writer;
72
+ },
73
+ decode(input, length) {
74
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
75
+ const end = length === undefined ? reader.len : reader.pos + length;
76
+ const message = createBaseSubscribeTransactionsRequest();
77
+ while (reader.pos < end) {
78
+ const tag = reader.uint32();
79
+ switch (tag >>> 3) {
80
+ case 1: {
81
+ if (tag !== 10) {
82
+ break;
83
+ }
84
+ message.ping = Ping.decode(reader, reader.uint32());
85
+ continue;
86
+ }
87
+ case 2: {
88
+ if (tag !== 18) {
89
+ break;
90
+ }
91
+ message.addFilters = AddFilters.decode(reader, reader.uint32());
92
+ continue;
93
+ }
94
+ case 3: {
95
+ if (tag !== 26) {
96
+ break;
97
+ }
98
+ message.removeFilters = RemoveFilters.decode(reader, reader.uint32());
99
+ continue;
100
+ }
101
+ }
102
+ if ((tag & 7) === 4 || tag === 0) {
103
+ break;
104
+ }
105
+ reader.skip(tag & 7);
106
+ }
107
+ return message;
108
+ },
109
+ fromJSON(object) {
110
+ return {
111
+ ping: isSet(object.ping) ? Ping.fromJSON(object.ping) : undefined,
112
+ addFilters: isSet(object.addFilters)
113
+ ? AddFilters.fromJSON(object.addFilters)
114
+ : isSet(object.add_filters)
115
+ ? AddFilters.fromJSON(object.add_filters)
116
+ : undefined,
117
+ removeFilters: isSet(object.removeFilters)
118
+ ? RemoveFilters.fromJSON(object.removeFilters)
119
+ : isSet(object.remove_filters)
120
+ ? RemoveFilters.fromJSON(object.remove_filters)
121
+ : undefined,
122
+ };
123
+ },
124
+ toJSON(message) {
125
+ const obj = {};
126
+ if (message.ping !== undefined) {
127
+ obj.ping = Ping.toJSON(message.ping);
128
+ }
129
+ if (message.addFilters !== undefined) {
130
+ obj.addFilters = AddFilters.toJSON(message.addFilters);
131
+ }
132
+ if (message.removeFilters !== undefined) {
133
+ obj.removeFilters = RemoveFilters.toJSON(message.removeFilters);
134
+ }
135
+ return obj;
136
+ },
137
+ create(base) {
138
+ return SubscribeTransactionsRequest.fromPartial(base ?? {});
139
+ },
140
+ fromPartial(object) {
141
+ const message = createBaseSubscribeTransactionsRequest();
142
+ message.ping = (object.ping !== undefined && object.ping !== null) ? Ping.fromPartial(object.ping) : undefined;
143
+ message.addFilters = (object.addFilters !== undefined && object.addFilters !== null)
144
+ ? AddFilters.fromPartial(object.addFilters)
145
+ : undefined;
146
+ message.removeFilters = (object.removeFilters !== undefined && object.removeFilters !== null)
147
+ ? RemoveFilters.fromPartial(object.removeFilters)
148
+ : undefined;
149
+ return message;
150
+ },
151
+ };
152
+ function createBasePing() {
153
+ return { pingId: 0 };
154
+ }
155
+ export const Ping = {
156
+ encode(message, writer = new BinaryWriter()) {
157
+ if (message.pingId !== 0) {
158
+ writer.uint32(8).int32(message.pingId);
159
+ }
160
+ return writer;
161
+ },
162
+ decode(input, length) {
163
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
164
+ const end = length === undefined ? reader.len : reader.pos + length;
165
+ const message = createBasePing();
166
+ while (reader.pos < end) {
167
+ const tag = reader.uint32();
168
+ switch (tag >>> 3) {
169
+ case 1: {
170
+ if (tag !== 8) {
171
+ break;
172
+ }
173
+ message.pingId = reader.int32();
174
+ continue;
175
+ }
176
+ }
177
+ if ((tag & 7) === 4 || tag === 0) {
178
+ break;
179
+ }
180
+ reader.skip(tag & 7);
181
+ }
182
+ return message;
183
+ },
184
+ fromJSON(object) {
185
+ return {
186
+ pingId: isSet(object.pingId)
187
+ ? globalThis.Number(object.pingId)
188
+ : isSet(object.ping_id)
189
+ ? globalThis.Number(object.ping_id)
190
+ : 0,
191
+ };
192
+ },
193
+ toJSON(message) {
194
+ const obj = {};
195
+ if (message.pingId !== 0) {
196
+ obj.pingId = Math.round(message.pingId);
197
+ }
198
+ return obj;
199
+ },
200
+ create(base) {
201
+ return Ping.fromPartial(base ?? {});
202
+ },
203
+ fromPartial(object) {
204
+ const message = createBasePing();
205
+ message.pingId = object.pingId ?? 0;
206
+ return message;
207
+ },
208
+ };
209
+ function createBaseAddFilters() {
210
+ return { filters: [] };
211
+ }
212
+ export const AddFilters = {
213
+ encode(message, writer = new BinaryWriter()) {
214
+ for (const v of message.filters) {
215
+ TxFilter.encode(v, writer.uint32(10).fork()).join();
216
+ }
217
+ return writer;
218
+ },
219
+ decode(input, length) {
220
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
221
+ const end = length === undefined ? reader.len : reader.pos + length;
222
+ const message = createBaseAddFilters();
223
+ while (reader.pos < end) {
224
+ const tag = reader.uint32();
225
+ switch (tag >>> 3) {
226
+ case 1: {
227
+ if (tag !== 10) {
228
+ break;
229
+ }
230
+ message.filters.push(TxFilter.decode(reader, reader.uint32()));
231
+ continue;
232
+ }
233
+ }
234
+ if ((tag & 7) === 4 || tag === 0) {
235
+ break;
236
+ }
237
+ reader.skip(tag & 7);
238
+ }
239
+ return message;
240
+ },
241
+ fromJSON(object) {
242
+ return {
243
+ filters: globalThis.Array.isArray(object?.filters) ? object.filters.map((e) => TxFilter.fromJSON(e)) : [],
244
+ };
245
+ },
246
+ toJSON(message) {
247
+ const obj = {};
248
+ if (message.filters?.length) {
249
+ obj.filters = message.filters.map((e) => TxFilter.toJSON(e));
250
+ }
251
+ return obj;
252
+ },
253
+ create(base) {
254
+ return AddFilters.fromPartial(base ?? {});
255
+ },
256
+ fromPartial(object) {
257
+ const message = createBaseAddFilters();
258
+ message.filters = object.filters?.map((e) => TxFilter.fromPartial(e)) || [];
259
+ return message;
260
+ },
261
+ };
262
+ function createBaseTxFilter() {
263
+ return { filterId: "", filter: undefined };
264
+ }
265
+ export const TxFilter = {
266
+ encode(message, writer = new BinaryWriter()) {
267
+ if (message.filterId !== "") {
268
+ writer.uint32(10).string(message.filterId);
269
+ }
270
+ if (message.filter !== undefined) {
271
+ SubscribeRequestFilterTransactions.encode(message.filter, writer.uint32(18).fork()).join();
272
+ }
273
+ return writer;
274
+ },
275
+ decode(input, length) {
276
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
277
+ const end = length === undefined ? reader.len : reader.pos + length;
278
+ const message = createBaseTxFilter();
279
+ while (reader.pos < end) {
280
+ const tag = reader.uint32();
281
+ switch (tag >>> 3) {
282
+ case 1: {
283
+ if (tag !== 10) {
284
+ break;
285
+ }
286
+ message.filterId = reader.string();
287
+ continue;
288
+ }
289
+ case 2: {
290
+ if (tag !== 18) {
291
+ break;
292
+ }
293
+ message.filter = SubscribeRequestFilterTransactions.decode(reader, reader.uint32());
294
+ continue;
295
+ }
296
+ }
297
+ if ((tag & 7) === 4 || tag === 0) {
298
+ break;
299
+ }
300
+ reader.skip(tag & 7);
301
+ }
302
+ return message;
303
+ },
304
+ fromJSON(object) {
305
+ return {
306
+ filterId: isSet(object.filterId)
307
+ ? globalThis.String(object.filterId)
308
+ : isSet(object.filter_id)
309
+ ? globalThis.String(object.filter_id)
310
+ : "",
311
+ filter: isSet(object.filter) ? SubscribeRequestFilterTransactions.fromJSON(object.filter) : undefined,
312
+ };
313
+ },
314
+ toJSON(message) {
315
+ const obj = {};
316
+ if (message.filterId !== "") {
317
+ obj.filterId = message.filterId;
318
+ }
319
+ if (message.filter !== undefined) {
320
+ obj.filter = SubscribeRequestFilterTransactions.toJSON(message.filter);
321
+ }
322
+ return obj;
323
+ },
324
+ create(base) {
325
+ return TxFilter.fromPartial(base ?? {});
326
+ },
327
+ fromPartial(object) {
328
+ const message = createBaseTxFilter();
329
+ message.filterId = object.filterId ?? "";
330
+ message.filter = (object.filter !== undefined && object.filter !== null)
331
+ ? SubscribeRequestFilterTransactions.fromPartial(object.filter)
332
+ : undefined;
333
+ return message;
334
+ },
335
+ };
336
+ function createBaseSubscribeRequestFilterTransactions() {
337
+ return { accountInclude: [], accountExclude: [], accountRequired: [], includeEnrichment: false };
338
+ }
339
+ export const SubscribeRequestFilterTransactions = {
340
+ encode(message, writer = new BinaryWriter()) {
341
+ for (const v of message.accountInclude) {
342
+ writer.uint32(10).string(v);
343
+ }
344
+ for (const v of message.accountExclude) {
345
+ writer.uint32(18).string(v);
346
+ }
347
+ for (const v of message.accountRequired) {
348
+ writer.uint32(26).string(v);
349
+ }
350
+ if (message.includeEnrichment !== false) {
351
+ writer.uint32(32).bool(message.includeEnrichment);
352
+ }
353
+ return writer;
354
+ },
355
+ decode(input, length) {
356
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
357
+ const end = length === undefined ? reader.len : reader.pos + length;
358
+ const message = createBaseSubscribeRequestFilterTransactions();
359
+ while (reader.pos < end) {
360
+ const tag = reader.uint32();
361
+ switch (tag >>> 3) {
362
+ case 1: {
363
+ if (tag !== 10) {
364
+ break;
365
+ }
366
+ message.accountInclude.push(reader.string());
367
+ continue;
368
+ }
369
+ case 2: {
370
+ if (tag !== 18) {
371
+ break;
372
+ }
373
+ message.accountExclude.push(reader.string());
374
+ continue;
375
+ }
376
+ case 3: {
377
+ if (tag !== 26) {
378
+ break;
379
+ }
380
+ message.accountRequired.push(reader.string());
381
+ continue;
382
+ }
383
+ case 4: {
384
+ if (tag !== 32) {
385
+ break;
386
+ }
387
+ message.includeEnrichment = reader.bool();
388
+ continue;
389
+ }
390
+ }
391
+ if ((tag & 7) === 4 || tag === 0) {
392
+ break;
393
+ }
394
+ reader.skip(tag & 7);
395
+ }
396
+ return message;
397
+ },
398
+ fromJSON(object) {
399
+ return {
400
+ accountInclude: globalThis.Array.isArray(object?.accountInclude)
401
+ ? object.accountInclude.map((e) => globalThis.String(e))
402
+ : globalThis.Array.isArray(object?.account_include)
403
+ ? object.account_include.map((e) => globalThis.String(e))
404
+ : [],
405
+ accountExclude: globalThis.Array.isArray(object?.accountExclude)
406
+ ? object.accountExclude.map((e) => globalThis.String(e))
407
+ : globalThis.Array.isArray(object?.account_exclude)
408
+ ? object.account_exclude.map((e) => globalThis.String(e))
409
+ : [],
410
+ accountRequired: globalThis.Array.isArray(object?.accountRequired)
411
+ ? object.accountRequired.map((e) => globalThis.String(e))
412
+ : globalThis.Array.isArray(object?.account_required)
413
+ ? object.account_required.map((e) => globalThis.String(e))
414
+ : [],
415
+ includeEnrichment: isSet(object.includeEnrichment)
416
+ ? globalThis.Boolean(object.includeEnrichment)
417
+ : isSet(object.include_enrichment)
418
+ ? globalThis.Boolean(object.include_enrichment)
419
+ : false,
420
+ };
421
+ },
422
+ toJSON(message) {
423
+ const obj = {};
424
+ if (message.accountInclude?.length) {
425
+ obj.accountInclude = message.accountInclude;
426
+ }
427
+ if (message.accountExclude?.length) {
428
+ obj.accountExclude = message.accountExclude;
429
+ }
430
+ if (message.accountRequired?.length) {
431
+ obj.accountRequired = message.accountRequired;
432
+ }
433
+ if (message.includeEnrichment !== false) {
434
+ obj.includeEnrichment = message.includeEnrichment;
435
+ }
436
+ return obj;
437
+ },
438
+ create(base) {
439
+ return SubscribeRequestFilterTransactions.fromPartial(base ?? {});
440
+ },
441
+ fromPartial(object) {
442
+ const message = createBaseSubscribeRequestFilterTransactions();
443
+ message.accountInclude = object.accountInclude?.map((e) => e) || [];
444
+ message.accountExclude = object.accountExclude?.map((e) => e) || [];
445
+ message.accountRequired = object.accountRequired?.map((e) => e) || [];
446
+ message.includeEnrichment = object.includeEnrichment ?? false;
447
+ return message;
448
+ },
449
+ };
450
+ function createBaseRemoveFilters() {
451
+ return { filterIds: [] };
452
+ }
453
+ export const RemoveFilters = {
454
+ encode(message, writer = new BinaryWriter()) {
455
+ for (const v of message.filterIds) {
456
+ writer.uint32(10).string(v);
457
+ }
458
+ return writer;
459
+ },
460
+ decode(input, length) {
461
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
462
+ const end = length === undefined ? reader.len : reader.pos + length;
463
+ const message = createBaseRemoveFilters();
464
+ while (reader.pos < end) {
465
+ const tag = reader.uint32();
466
+ switch (tag >>> 3) {
467
+ case 1: {
468
+ if (tag !== 10) {
469
+ break;
470
+ }
471
+ message.filterIds.push(reader.string());
472
+ continue;
473
+ }
474
+ }
475
+ if ((tag & 7) === 4 || tag === 0) {
476
+ break;
477
+ }
478
+ reader.skip(tag & 7);
479
+ }
480
+ return message;
481
+ },
482
+ fromJSON(object) {
483
+ return {
484
+ filterIds: globalThis.Array.isArray(object?.filterIds)
485
+ ? object.filterIds.map((e) => globalThis.String(e))
486
+ : globalThis.Array.isArray(object?.filter_ids)
487
+ ? object.filter_ids.map((e) => globalThis.String(e))
488
+ : [],
489
+ };
490
+ },
491
+ toJSON(message) {
492
+ const obj = {};
493
+ if (message.filterIds?.length) {
494
+ obj.filterIds = message.filterIds;
495
+ }
496
+ return obj;
497
+ },
498
+ create(base) {
499
+ return RemoveFilters.fromPartial(base ?? {});
500
+ },
501
+ fromPartial(object) {
502
+ const message = createBaseRemoveFilters();
503
+ message.filterIds = object.filterIds?.map((e) => e) || [];
504
+ return message;
505
+ },
506
+ };
507
+ function createBaseSubscribeTransactionsResponse() {
508
+ return {
509
+ createdAt: undefined,
510
+ transaction: undefined,
511
+ pong: undefined,
512
+ filterValidation: undefined,
513
+ heartbeat: undefined,
514
+ sequence: 0n,
515
+ };
516
+ }
517
+ export const SubscribeTransactionsResponse = {
518
+ encode(message, writer = new BinaryWriter()) {
519
+ if (message.createdAt !== undefined) {
520
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(10).fork()).join();
521
+ }
522
+ if (message.transaction !== undefined) {
523
+ FilteredTransaction.encode(message.transaction, writer.uint32(18).fork()).join();
524
+ }
525
+ if (message.pong !== undefined) {
526
+ Pong.encode(message.pong, writer.uint32(26).fork()).join();
527
+ }
528
+ if (message.filterValidation !== undefined) {
529
+ FilterResult.encode(message.filterValidation, writer.uint32(42).fork()).join();
530
+ }
531
+ if (message.heartbeat !== undefined) {
532
+ Heartbeat.encode(message.heartbeat, writer.uint32(50).fork()).join();
533
+ }
534
+ if (message.sequence !== 0n) {
535
+ if (BigInt.asUintN(64, message.sequence) !== message.sequence) {
536
+ throw new globalThis.Error("value provided for field message.sequence of type uint64 too large");
537
+ }
538
+ writer.uint32(32).uint64(message.sequence);
539
+ }
540
+ return writer;
541
+ },
542
+ decode(input, length) {
543
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
544
+ const end = length === undefined ? reader.len : reader.pos + length;
545
+ const message = createBaseSubscribeTransactionsResponse();
546
+ while (reader.pos < end) {
547
+ const tag = reader.uint32();
548
+ switch (tag >>> 3) {
549
+ case 1: {
550
+ if (tag !== 10) {
551
+ break;
552
+ }
553
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
554
+ continue;
555
+ }
556
+ case 2: {
557
+ if (tag !== 18) {
558
+ break;
559
+ }
560
+ message.transaction = FilteredTransaction.decode(reader, reader.uint32());
561
+ continue;
562
+ }
563
+ case 3: {
564
+ if (tag !== 26) {
565
+ break;
566
+ }
567
+ message.pong = Pong.decode(reader, reader.uint32());
568
+ continue;
569
+ }
570
+ case 5: {
571
+ if (tag !== 42) {
572
+ break;
573
+ }
574
+ message.filterValidation = FilterResult.decode(reader, reader.uint32());
575
+ continue;
576
+ }
577
+ case 6: {
578
+ if (tag !== 50) {
579
+ break;
580
+ }
581
+ message.heartbeat = Heartbeat.decode(reader, reader.uint32());
582
+ continue;
583
+ }
584
+ case 4: {
585
+ if (tag !== 32) {
586
+ break;
587
+ }
588
+ message.sequence = reader.uint64();
589
+ continue;
590
+ }
591
+ }
592
+ if ((tag & 7) === 4 || tag === 0) {
593
+ break;
594
+ }
595
+ reader.skip(tag & 7);
596
+ }
597
+ return message;
598
+ },
599
+ fromJSON(object) {
600
+ return {
601
+ createdAt: isSet(object.createdAt)
602
+ ? fromJsonTimestamp(object.createdAt)
603
+ : isSet(object.created_at)
604
+ ? fromJsonTimestamp(object.created_at)
605
+ : undefined,
606
+ transaction: isSet(object.transaction) ? FilteredTransaction.fromJSON(object.transaction) : undefined,
607
+ pong: isSet(object.pong) ? Pong.fromJSON(object.pong) : undefined,
608
+ filterValidation: isSet(object.filterValidation)
609
+ ? FilterResult.fromJSON(object.filterValidation)
610
+ : isSet(object.filter_validation)
611
+ ? FilterResult.fromJSON(object.filter_validation)
612
+ : undefined,
613
+ heartbeat: isSet(object.heartbeat) ? Heartbeat.fromJSON(object.heartbeat) : undefined,
614
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
615
+ };
616
+ },
617
+ toJSON(message) {
618
+ const obj = {};
619
+ if (message.createdAt !== undefined) {
620
+ obj.createdAt = message.createdAt.toISOString();
621
+ }
622
+ if (message.transaction !== undefined) {
623
+ obj.transaction = FilteredTransaction.toJSON(message.transaction);
624
+ }
625
+ if (message.pong !== undefined) {
626
+ obj.pong = Pong.toJSON(message.pong);
627
+ }
628
+ if (message.filterValidation !== undefined) {
629
+ obj.filterValidation = FilterResult.toJSON(message.filterValidation);
630
+ }
631
+ if (message.heartbeat !== undefined) {
632
+ obj.heartbeat = Heartbeat.toJSON(message.heartbeat);
633
+ }
634
+ if (message.sequence !== 0n) {
635
+ obj.sequence = message.sequence.toString();
636
+ }
637
+ return obj;
638
+ },
639
+ create(base) {
640
+ return SubscribeTransactionsResponse.fromPartial(base ?? {});
641
+ },
642
+ fromPartial(object) {
643
+ const message = createBaseSubscribeTransactionsResponse();
644
+ message.createdAt = object.createdAt ?? undefined;
645
+ message.transaction = (object.transaction !== undefined && object.transaction !== null)
646
+ ? FilteredTransaction.fromPartial(object.transaction)
647
+ : undefined;
648
+ message.pong = (object.pong !== undefined && object.pong !== null) ? Pong.fromPartial(object.pong) : undefined;
649
+ message.filterValidation = (object.filterValidation !== undefined && object.filterValidation !== null)
650
+ ? FilterResult.fromPartial(object.filterValidation)
651
+ : undefined;
652
+ message.heartbeat = (object.heartbeat !== undefined && object.heartbeat !== null)
653
+ ? Heartbeat.fromPartial(object.heartbeat)
654
+ : undefined;
655
+ message.sequence = object.sequence ?? 0n;
656
+ return message;
657
+ },
658
+ };
659
+ function createBasePong() {
660
+ return { pingId: 0 };
661
+ }
662
+ export const Pong = {
663
+ encode(message, writer = new BinaryWriter()) {
664
+ if (message.pingId !== 0) {
665
+ writer.uint32(8).int32(message.pingId);
666
+ }
667
+ return writer;
668
+ },
669
+ decode(input, length) {
670
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
671
+ const end = length === undefined ? reader.len : reader.pos + length;
672
+ const message = createBasePong();
673
+ while (reader.pos < end) {
674
+ const tag = reader.uint32();
675
+ switch (tag >>> 3) {
676
+ case 1: {
677
+ if (tag !== 8) {
678
+ break;
679
+ }
680
+ message.pingId = reader.int32();
681
+ continue;
682
+ }
683
+ }
684
+ if ((tag & 7) === 4 || tag === 0) {
685
+ break;
686
+ }
687
+ reader.skip(tag & 7);
688
+ }
689
+ return message;
690
+ },
691
+ fromJSON(object) {
692
+ return {
693
+ pingId: isSet(object.pingId)
694
+ ? globalThis.Number(object.pingId)
695
+ : isSet(object.ping_id)
696
+ ? globalThis.Number(object.ping_id)
697
+ : 0,
698
+ };
699
+ },
700
+ toJSON(message) {
701
+ const obj = {};
702
+ if (message.pingId !== 0) {
703
+ obj.pingId = Math.round(message.pingId);
704
+ }
705
+ return obj;
706
+ },
707
+ create(base) {
708
+ return Pong.fromPartial(base ?? {});
709
+ },
710
+ fromPartial(object) {
711
+ const message = createBasePong();
712
+ message.pingId = object.pingId ?? 0;
713
+ return message;
714
+ },
715
+ };
716
+ function createBaseFilterResult() {
717
+ return { filterId: "", accepted: false, rejectionReason: "" };
718
+ }
719
+ export const FilterResult = {
720
+ encode(message, writer = new BinaryWriter()) {
721
+ if (message.filterId !== "") {
722
+ writer.uint32(10).string(message.filterId);
723
+ }
724
+ if (message.accepted !== false) {
725
+ writer.uint32(16).bool(message.accepted);
726
+ }
727
+ if (message.rejectionReason !== "") {
728
+ writer.uint32(26).string(message.rejectionReason);
729
+ }
730
+ return writer;
731
+ },
732
+ decode(input, length) {
733
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
734
+ const end = length === undefined ? reader.len : reader.pos + length;
735
+ const message = createBaseFilterResult();
736
+ while (reader.pos < end) {
737
+ const tag = reader.uint32();
738
+ switch (tag >>> 3) {
739
+ case 1: {
740
+ if (tag !== 10) {
741
+ break;
742
+ }
743
+ message.filterId = reader.string();
744
+ continue;
745
+ }
746
+ case 2: {
747
+ if (tag !== 16) {
748
+ break;
749
+ }
750
+ message.accepted = reader.bool();
751
+ continue;
752
+ }
753
+ case 3: {
754
+ if (tag !== 26) {
755
+ break;
756
+ }
757
+ message.rejectionReason = reader.string();
758
+ continue;
759
+ }
760
+ }
761
+ if ((tag & 7) === 4 || tag === 0) {
762
+ break;
763
+ }
764
+ reader.skip(tag & 7);
765
+ }
766
+ return message;
767
+ },
768
+ fromJSON(object) {
769
+ return {
770
+ filterId: isSet(object.filterId)
771
+ ? globalThis.String(object.filterId)
772
+ : isSet(object.filter_id)
773
+ ? globalThis.String(object.filter_id)
774
+ : "",
775
+ accepted: isSet(object.accepted) ? globalThis.Boolean(object.accepted) : false,
776
+ rejectionReason: isSet(object.rejectionReason)
777
+ ? globalThis.String(object.rejectionReason)
778
+ : isSet(object.rejection_reason)
779
+ ? globalThis.String(object.rejection_reason)
780
+ : "",
781
+ };
782
+ },
783
+ toJSON(message) {
784
+ const obj = {};
785
+ if (message.filterId !== "") {
786
+ obj.filterId = message.filterId;
787
+ }
788
+ if (message.accepted !== false) {
789
+ obj.accepted = message.accepted;
790
+ }
791
+ if (message.rejectionReason !== "") {
792
+ obj.rejectionReason = message.rejectionReason;
793
+ }
794
+ return obj;
795
+ },
796
+ create(base) {
797
+ return FilterResult.fromPartial(base ?? {});
798
+ },
799
+ fromPartial(object) {
800
+ const message = createBaseFilterResult();
801
+ message.filterId = object.filterId ?? "";
802
+ message.accepted = object.accepted ?? false;
803
+ message.rejectionReason = object.rejectionReason ?? "";
804
+ return message;
805
+ },
806
+ };
807
+ function createBaseHeartbeat() {
808
+ return { serverTsMs: 0n };
809
+ }
810
+ export const Heartbeat = {
811
+ encode(message, writer = new BinaryWriter()) {
812
+ if (message.serverTsMs !== 0n) {
813
+ if (BigInt.asUintN(64, message.serverTsMs) !== message.serverTsMs) {
814
+ throw new globalThis.Error("value provided for field message.serverTsMs of type uint64 too large");
815
+ }
816
+ writer.uint32(8).uint64(message.serverTsMs);
817
+ }
818
+ return writer;
819
+ },
820
+ decode(input, length) {
821
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
822
+ const end = length === undefined ? reader.len : reader.pos + length;
823
+ const message = createBaseHeartbeat();
824
+ while (reader.pos < end) {
825
+ const tag = reader.uint32();
826
+ switch (tag >>> 3) {
827
+ case 1: {
828
+ if (tag !== 8) {
829
+ break;
830
+ }
831
+ message.serverTsMs = reader.uint64();
832
+ continue;
833
+ }
834
+ }
835
+ if ((tag & 7) === 4 || tag === 0) {
836
+ break;
837
+ }
838
+ reader.skip(tag & 7);
839
+ }
840
+ return message;
841
+ },
842
+ fromJSON(object) {
843
+ return {
844
+ serverTsMs: isSet(object.serverTsMs)
845
+ ? BigInt(object.serverTsMs)
846
+ : isSet(object.server_ts_ms)
847
+ ? BigInt(object.server_ts_ms)
848
+ : 0n,
849
+ };
850
+ },
851
+ toJSON(message) {
852
+ const obj = {};
853
+ if (message.serverTsMs !== 0n) {
854
+ obj.serverTsMs = message.serverTsMs.toString();
855
+ }
856
+ return obj;
857
+ },
858
+ create(base) {
859
+ return Heartbeat.fromPartial(base ?? {});
860
+ },
861
+ fromPartial(object) {
862
+ const message = createBaseHeartbeat();
863
+ message.serverTsMs = object.serverTsMs ?? 0n;
864
+ return message;
865
+ },
866
+ };
867
+ function createBaseFilteredTransaction() {
868
+ return { filterIds: [], transaction: undefined };
869
+ }
870
+ export const FilteredTransaction = {
871
+ encode(message, writer = new BinaryWriter()) {
872
+ for (const v of message.filterIds) {
873
+ writer.uint32(10).string(v);
874
+ }
875
+ if (message.transaction !== undefined) {
876
+ TransactionMessage.encode(message.transaction, writer.uint32(18).fork()).join();
877
+ }
878
+ return writer;
879
+ },
880
+ decode(input, length) {
881
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
882
+ const end = length === undefined ? reader.len : reader.pos + length;
883
+ const message = createBaseFilteredTransaction();
884
+ while (reader.pos < end) {
885
+ const tag = reader.uint32();
886
+ switch (tag >>> 3) {
887
+ case 1: {
888
+ if (tag !== 10) {
889
+ break;
890
+ }
891
+ message.filterIds.push(reader.string());
892
+ continue;
893
+ }
894
+ case 2: {
895
+ if (tag !== 18) {
896
+ break;
897
+ }
898
+ message.transaction = TransactionMessage.decode(reader, reader.uint32());
899
+ continue;
900
+ }
901
+ }
902
+ if ((tag & 7) === 4 || tag === 0) {
903
+ break;
904
+ }
905
+ reader.skip(tag & 7);
906
+ }
907
+ return message;
908
+ },
909
+ fromJSON(object) {
910
+ return {
911
+ filterIds: globalThis.Array.isArray(object?.filterIds)
912
+ ? object.filterIds.map((e) => globalThis.String(e))
913
+ : globalThis.Array.isArray(object?.filter_ids)
914
+ ? object.filter_ids.map((e) => globalThis.String(e))
915
+ : [],
916
+ transaction: isSet(object.transaction) ? TransactionMessage.fromJSON(object.transaction) : undefined,
917
+ };
918
+ },
919
+ toJSON(message) {
920
+ const obj = {};
921
+ if (message.filterIds?.length) {
922
+ obj.filterIds = message.filterIds;
923
+ }
924
+ if (message.transaction !== undefined) {
925
+ obj.transaction = TransactionMessage.toJSON(message.transaction);
926
+ }
927
+ return obj;
928
+ },
929
+ create(base) {
930
+ return FilteredTransaction.fromPartial(base ?? {});
931
+ },
932
+ fromPartial(object) {
933
+ const message = createBaseFilteredTransaction();
934
+ message.filterIds = object.filterIds?.map((e) => e) || [];
935
+ message.transaction = (object.transaction !== undefined && object.transaction !== null)
936
+ ? TransactionMessage.fromPartial(object.transaction)
937
+ : undefined;
938
+ return message;
939
+ },
940
+ };
941
+ function createBaseTransactionMessage() {
942
+ return {
943
+ slot: 0n,
944
+ signature: new Uint8Array(0),
945
+ txIndex: 0,
946
+ signatures: [],
947
+ isVote: false,
948
+ numRequiredSignatures: 0,
949
+ numReadonlySignedAccounts: 0,
950
+ numReadonlyUnsignedAccounts: 0,
951
+ recentBlockhash: new Uint8Array(0),
952
+ versioned: false,
953
+ accountKeys: [],
954
+ instructions: [],
955
+ addressTableLookups: [],
956
+ feePayer: new Uint8Array(0),
957
+ writableAccounts: [],
958
+ programIds: [],
959
+ computeUnitPrice: 0n,
960
+ computeLimit: 0,
961
+ txSize: 0,
962
+ loadedWritableAddresses: [],
963
+ loadedReadonlyAddresses: [],
964
+ altResolutionIncomplete: false,
965
+ };
966
+ }
967
+ export const TransactionMessage = {
968
+ encode(message, writer = new BinaryWriter()) {
969
+ if (message.slot !== 0n) {
970
+ if (BigInt.asUintN(64, message.slot) !== message.slot) {
971
+ throw new globalThis.Error("value provided for field message.slot of type uint64 too large");
972
+ }
973
+ writer.uint32(8).uint64(message.slot);
974
+ }
975
+ if (message.signature.length !== 0) {
976
+ writer.uint32(18).bytes(message.signature);
977
+ }
978
+ if (message.txIndex !== 0) {
979
+ writer.uint32(24).uint32(message.txIndex);
980
+ }
981
+ for (const v of message.signatures) {
982
+ writer.uint32(34).bytes(v);
983
+ }
984
+ if (message.isVote !== false) {
985
+ writer.uint32(40).bool(message.isVote);
986
+ }
987
+ if (message.numRequiredSignatures !== 0) {
988
+ writer.uint32(48).uint32(message.numRequiredSignatures);
989
+ }
990
+ if (message.numReadonlySignedAccounts !== 0) {
991
+ writer.uint32(56).uint32(message.numReadonlySignedAccounts);
992
+ }
993
+ if (message.numReadonlyUnsignedAccounts !== 0) {
994
+ writer.uint32(64).uint32(message.numReadonlyUnsignedAccounts);
995
+ }
996
+ if (message.recentBlockhash.length !== 0) {
997
+ writer.uint32(74).bytes(message.recentBlockhash);
998
+ }
999
+ if (message.versioned !== false) {
1000
+ writer.uint32(80).bool(message.versioned);
1001
+ }
1002
+ for (const v of message.accountKeys) {
1003
+ writer.uint32(90).bytes(v);
1004
+ }
1005
+ for (const v of message.instructions) {
1006
+ CompiledInstruction.encode(v, writer.uint32(98).fork()).join();
1007
+ }
1008
+ for (const v of message.addressTableLookups) {
1009
+ MessageAddressTableLookup.encode(v, writer.uint32(106).fork()).join();
1010
+ }
1011
+ if (message.feePayer.length !== 0) {
1012
+ writer.uint32(114).bytes(message.feePayer);
1013
+ }
1014
+ for (const v of message.writableAccounts) {
1015
+ writer.uint32(122).bytes(v);
1016
+ }
1017
+ for (const v of message.programIds) {
1018
+ writer.uint32(130).bytes(v);
1019
+ }
1020
+ if (message.computeUnitPrice !== 0n) {
1021
+ if (BigInt.asUintN(64, message.computeUnitPrice) !== message.computeUnitPrice) {
1022
+ throw new globalThis.Error("value provided for field message.computeUnitPrice of type uint64 too large");
1023
+ }
1024
+ writer.uint32(136).uint64(message.computeUnitPrice);
1025
+ }
1026
+ if (message.computeLimit !== 0) {
1027
+ writer.uint32(144).uint32(message.computeLimit);
1028
+ }
1029
+ if (message.txSize !== 0) {
1030
+ writer.uint32(152).uint32(message.txSize);
1031
+ }
1032
+ for (const v of message.loadedWritableAddresses) {
1033
+ writer.uint32(162).bytes(v);
1034
+ }
1035
+ for (const v of message.loadedReadonlyAddresses) {
1036
+ writer.uint32(170).bytes(v);
1037
+ }
1038
+ if (message.altResolutionIncomplete !== false) {
1039
+ writer.uint32(176).bool(message.altResolutionIncomplete);
1040
+ }
1041
+ return writer;
1042
+ },
1043
+ decode(input, length) {
1044
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1045
+ const end = length === undefined ? reader.len : reader.pos + length;
1046
+ const message = createBaseTransactionMessage();
1047
+ while (reader.pos < end) {
1048
+ const tag = reader.uint32();
1049
+ switch (tag >>> 3) {
1050
+ case 1: {
1051
+ if (tag !== 8) {
1052
+ break;
1053
+ }
1054
+ message.slot = reader.uint64();
1055
+ continue;
1056
+ }
1057
+ case 2: {
1058
+ if (tag !== 18) {
1059
+ break;
1060
+ }
1061
+ message.signature = reader.bytes();
1062
+ continue;
1063
+ }
1064
+ case 3: {
1065
+ if (tag !== 24) {
1066
+ break;
1067
+ }
1068
+ message.txIndex = reader.uint32();
1069
+ continue;
1070
+ }
1071
+ case 4: {
1072
+ if (tag !== 34) {
1073
+ break;
1074
+ }
1075
+ message.signatures.push(reader.bytes());
1076
+ continue;
1077
+ }
1078
+ case 5: {
1079
+ if (tag !== 40) {
1080
+ break;
1081
+ }
1082
+ message.isVote = reader.bool();
1083
+ continue;
1084
+ }
1085
+ case 6: {
1086
+ if (tag !== 48) {
1087
+ break;
1088
+ }
1089
+ message.numRequiredSignatures = reader.uint32();
1090
+ continue;
1091
+ }
1092
+ case 7: {
1093
+ if (tag !== 56) {
1094
+ break;
1095
+ }
1096
+ message.numReadonlySignedAccounts = reader.uint32();
1097
+ continue;
1098
+ }
1099
+ case 8: {
1100
+ if (tag !== 64) {
1101
+ break;
1102
+ }
1103
+ message.numReadonlyUnsignedAccounts = reader.uint32();
1104
+ continue;
1105
+ }
1106
+ case 9: {
1107
+ if (tag !== 74) {
1108
+ break;
1109
+ }
1110
+ message.recentBlockhash = reader.bytes();
1111
+ continue;
1112
+ }
1113
+ case 10: {
1114
+ if (tag !== 80) {
1115
+ break;
1116
+ }
1117
+ message.versioned = reader.bool();
1118
+ continue;
1119
+ }
1120
+ case 11: {
1121
+ if (tag !== 90) {
1122
+ break;
1123
+ }
1124
+ message.accountKeys.push(reader.bytes());
1125
+ continue;
1126
+ }
1127
+ case 12: {
1128
+ if (tag !== 98) {
1129
+ break;
1130
+ }
1131
+ message.instructions.push(CompiledInstruction.decode(reader, reader.uint32()));
1132
+ continue;
1133
+ }
1134
+ case 13: {
1135
+ if (tag !== 106) {
1136
+ break;
1137
+ }
1138
+ message.addressTableLookups.push(MessageAddressTableLookup.decode(reader, reader.uint32()));
1139
+ continue;
1140
+ }
1141
+ case 14: {
1142
+ if (tag !== 114) {
1143
+ break;
1144
+ }
1145
+ message.feePayer = reader.bytes();
1146
+ continue;
1147
+ }
1148
+ case 15: {
1149
+ if (tag !== 122) {
1150
+ break;
1151
+ }
1152
+ message.writableAccounts.push(reader.bytes());
1153
+ continue;
1154
+ }
1155
+ case 16: {
1156
+ if (tag !== 130) {
1157
+ break;
1158
+ }
1159
+ message.programIds.push(reader.bytes());
1160
+ continue;
1161
+ }
1162
+ case 17: {
1163
+ if (tag !== 136) {
1164
+ break;
1165
+ }
1166
+ message.computeUnitPrice = reader.uint64();
1167
+ continue;
1168
+ }
1169
+ case 18: {
1170
+ if (tag !== 144) {
1171
+ break;
1172
+ }
1173
+ message.computeLimit = reader.uint32();
1174
+ continue;
1175
+ }
1176
+ case 19: {
1177
+ if (tag !== 152) {
1178
+ break;
1179
+ }
1180
+ message.txSize = reader.uint32();
1181
+ continue;
1182
+ }
1183
+ case 20: {
1184
+ if (tag !== 162) {
1185
+ break;
1186
+ }
1187
+ message.loadedWritableAddresses.push(reader.bytes());
1188
+ continue;
1189
+ }
1190
+ case 21: {
1191
+ if (tag !== 170) {
1192
+ break;
1193
+ }
1194
+ message.loadedReadonlyAddresses.push(reader.bytes());
1195
+ continue;
1196
+ }
1197
+ case 22: {
1198
+ if (tag !== 176) {
1199
+ break;
1200
+ }
1201
+ message.altResolutionIncomplete = reader.bool();
1202
+ continue;
1203
+ }
1204
+ }
1205
+ if ((tag & 7) === 4 || tag === 0) {
1206
+ break;
1207
+ }
1208
+ reader.skip(tag & 7);
1209
+ }
1210
+ return message;
1211
+ },
1212
+ fromJSON(object) {
1213
+ return {
1214
+ slot: isSet(object.slot) ? BigInt(object.slot) : 0n,
1215
+ signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0),
1216
+ txIndex: isSet(object.txIndex)
1217
+ ? globalThis.Number(object.txIndex)
1218
+ : isSet(object.tx_index)
1219
+ ? globalThis.Number(object.tx_index)
1220
+ : 0,
1221
+ signatures: globalThis.Array.isArray(object?.signatures)
1222
+ ? object.signatures.map((e) => bytesFromBase64(e))
1223
+ : [],
1224
+ isVote: isSet(object.isVote)
1225
+ ? globalThis.Boolean(object.isVote)
1226
+ : isSet(object.is_vote)
1227
+ ? globalThis.Boolean(object.is_vote)
1228
+ : false,
1229
+ numRequiredSignatures: isSet(object.numRequiredSignatures)
1230
+ ? globalThis.Number(object.numRequiredSignatures)
1231
+ : isSet(object.num_required_signatures)
1232
+ ? globalThis.Number(object.num_required_signatures)
1233
+ : 0,
1234
+ numReadonlySignedAccounts: isSet(object.numReadonlySignedAccounts)
1235
+ ? globalThis.Number(object.numReadonlySignedAccounts)
1236
+ : isSet(object.num_readonly_signed_accounts)
1237
+ ? globalThis.Number(object.num_readonly_signed_accounts)
1238
+ : 0,
1239
+ numReadonlyUnsignedAccounts: isSet(object.numReadonlyUnsignedAccounts)
1240
+ ? globalThis.Number(object.numReadonlyUnsignedAccounts)
1241
+ : isSet(object.num_readonly_unsigned_accounts)
1242
+ ? globalThis.Number(object.num_readonly_unsigned_accounts)
1243
+ : 0,
1244
+ recentBlockhash: isSet(object.recentBlockhash)
1245
+ ? bytesFromBase64(object.recentBlockhash)
1246
+ : isSet(object.recent_blockhash)
1247
+ ? bytesFromBase64(object.recent_blockhash)
1248
+ : new Uint8Array(0),
1249
+ versioned: isSet(object.versioned) ? globalThis.Boolean(object.versioned) : false,
1250
+ accountKeys: globalThis.Array.isArray(object?.accountKeys)
1251
+ ? object.accountKeys.map((e) => bytesFromBase64(e))
1252
+ : globalThis.Array.isArray(object?.account_keys)
1253
+ ? object.account_keys.map((e) => bytesFromBase64(e))
1254
+ : [],
1255
+ instructions: globalThis.Array.isArray(object?.instructions)
1256
+ ? object.instructions.map((e) => CompiledInstruction.fromJSON(e))
1257
+ : [],
1258
+ addressTableLookups: globalThis.Array.isArray(object?.addressTableLookups)
1259
+ ? object.addressTableLookups.map((e) => MessageAddressTableLookup.fromJSON(e))
1260
+ : globalThis.Array.isArray(object?.address_table_lookups)
1261
+ ? object.address_table_lookups.map((e) => MessageAddressTableLookup.fromJSON(e))
1262
+ : [],
1263
+ feePayer: isSet(object.feePayer)
1264
+ ? bytesFromBase64(object.feePayer)
1265
+ : isSet(object.fee_payer)
1266
+ ? bytesFromBase64(object.fee_payer)
1267
+ : new Uint8Array(0),
1268
+ writableAccounts: globalThis.Array.isArray(object?.writableAccounts)
1269
+ ? object.writableAccounts.map((e) => bytesFromBase64(e))
1270
+ : globalThis.Array.isArray(object?.writable_accounts)
1271
+ ? object.writable_accounts.map((e) => bytesFromBase64(e))
1272
+ : [],
1273
+ programIds: globalThis.Array.isArray(object?.programIds)
1274
+ ? object.programIds.map((e) => bytesFromBase64(e))
1275
+ : globalThis.Array.isArray(object?.program_ids)
1276
+ ? object.program_ids.map((e) => bytesFromBase64(e))
1277
+ : [],
1278
+ computeUnitPrice: isSet(object.computeUnitPrice)
1279
+ ? BigInt(object.computeUnitPrice)
1280
+ : isSet(object.compute_unit_price)
1281
+ ? BigInt(object.compute_unit_price)
1282
+ : 0n,
1283
+ computeLimit: isSet(object.computeLimit)
1284
+ ? globalThis.Number(object.computeLimit)
1285
+ : isSet(object.compute_limit)
1286
+ ? globalThis.Number(object.compute_limit)
1287
+ : 0,
1288
+ txSize: isSet(object.txSize)
1289
+ ? globalThis.Number(object.txSize)
1290
+ : isSet(object.tx_size)
1291
+ ? globalThis.Number(object.tx_size)
1292
+ : 0,
1293
+ loadedWritableAddresses: globalThis.Array.isArray(object?.loadedWritableAddresses)
1294
+ ? object.loadedWritableAddresses.map((e) => bytesFromBase64(e))
1295
+ : globalThis.Array.isArray(object?.loaded_writable_addresses)
1296
+ ? object.loaded_writable_addresses.map((e) => bytesFromBase64(e))
1297
+ : [],
1298
+ loadedReadonlyAddresses: globalThis.Array.isArray(object?.loadedReadonlyAddresses)
1299
+ ? object.loadedReadonlyAddresses.map((e) => bytesFromBase64(e))
1300
+ : globalThis.Array.isArray(object?.loaded_readonly_addresses)
1301
+ ? object.loaded_readonly_addresses.map((e) => bytesFromBase64(e))
1302
+ : [],
1303
+ altResolutionIncomplete: isSet(object.altResolutionIncomplete)
1304
+ ? globalThis.Boolean(object.altResolutionIncomplete)
1305
+ : isSet(object.alt_resolution_incomplete)
1306
+ ? globalThis.Boolean(object.alt_resolution_incomplete)
1307
+ : false,
1308
+ };
1309
+ },
1310
+ toJSON(message) {
1311
+ const obj = {};
1312
+ if (message.slot !== 0n) {
1313
+ obj.slot = message.slot.toString();
1314
+ }
1315
+ if (message.signature.length !== 0) {
1316
+ obj.signature = base64FromBytes(message.signature);
1317
+ }
1318
+ if (message.txIndex !== 0) {
1319
+ obj.txIndex = Math.round(message.txIndex);
1320
+ }
1321
+ if (message.signatures?.length) {
1322
+ obj.signatures = message.signatures.map((e) => base64FromBytes(e));
1323
+ }
1324
+ if (message.isVote !== false) {
1325
+ obj.isVote = message.isVote;
1326
+ }
1327
+ if (message.numRequiredSignatures !== 0) {
1328
+ obj.numRequiredSignatures = Math.round(message.numRequiredSignatures);
1329
+ }
1330
+ if (message.numReadonlySignedAccounts !== 0) {
1331
+ obj.numReadonlySignedAccounts = Math.round(message.numReadonlySignedAccounts);
1332
+ }
1333
+ if (message.numReadonlyUnsignedAccounts !== 0) {
1334
+ obj.numReadonlyUnsignedAccounts = Math.round(message.numReadonlyUnsignedAccounts);
1335
+ }
1336
+ if (message.recentBlockhash.length !== 0) {
1337
+ obj.recentBlockhash = base64FromBytes(message.recentBlockhash);
1338
+ }
1339
+ if (message.versioned !== false) {
1340
+ obj.versioned = message.versioned;
1341
+ }
1342
+ if (message.accountKeys?.length) {
1343
+ obj.accountKeys = message.accountKeys.map((e) => base64FromBytes(e));
1344
+ }
1345
+ if (message.instructions?.length) {
1346
+ obj.instructions = message.instructions.map((e) => CompiledInstruction.toJSON(e));
1347
+ }
1348
+ if (message.addressTableLookups?.length) {
1349
+ obj.addressTableLookups = message.addressTableLookups.map((e) => MessageAddressTableLookup.toJSON(e));
1350
+ }
1351
+ if (message.feePayer.length !== 0) {
1352
+ obj.feePayer = base64FromBytes(message.feePayer);
1353
+ }
1354
+ if (message.writableAccounts?.length) {
1355
+ obj.writableAccounts = message.writableAccounts.map((e) => base64FromBytes(e));
1356
+ }
1357
+ if (message.programIds?.length) {
1358
+ obj.programIds = message.programIds.map((e) => base64FromBytes(e));
1359
+ }
1360
+ if (message.computeUnitPrice !== 0n) {
1361
+ obj.computeUnitPrice = message.computeUnitPrice.toString();
1362
+ }
1363
+ if (message.computeLimit !== 0) {
1364
+ obj.computeLimit = Math.round(message.computeLimit);
1365
+ }
1366
+ if (message.txSize !== 0) {
1367
+ obj.txSize = Math.round(message.txSize);
1368
+ }
1369
+ if (message.loadedWritableAddresses?.length) {
1370
+ obj.loadedWritableAddresses = message.loadedWritableAddresses.map((e) => base64FromBytes(e));
1371
+ }
1372
+ if (message.loadedReadonlyAddresses?.length) {
1373
+ obj.loadedReadonlyAddresses = message.loadedReadonlyAddresses.map((e) => base64FromBytes(e));
1374
+ }
1375
+ if (message.altResolutionIncomplete !== false) {
1376
+ obj.altResolutionIncomplete = message.altResolutionIncomplete;
1377
+ }
1378
+ return obj;
1379
+ },
1380
+ create(base) {
1381
+ return TransactionMessage.fromPartial(base ?? {});
1382
+ },
1383
+ fromPartial(object) {
1384
+ const message = createBaseTransactionMessage();
1385
+ message.slot = object.slot ?? 0n;
1386
+ message.signature = object.signature ?? new Uint8Array(0);
1387
+ message.txIndex = object.txIndex ?? 0;
1388
+ message.signatures = object.signatures?.map((e) => e) || [];
1389
+ message.isVote = object.isVote ?? false;
1390
+ message.numRequiredSignatures = object.numRequiredSignatures ?? 0;
1391
+ message.numReadonlySignedAccounts = object.numReadonlySignedAccounts ?? 0;
1392
+ message.numReadonlyUnsignedAccounts = object.numReadonlyUnsignedAccounts ?? 0;
1393
+ message.recentBlockhash = object.recentBlockhash ?? new Uint8Array(0);
1394
+ message.versioned = object.versioned ?? false;
1395
+ message.accountKeys = object.accountKeys?.map((e) => e) || [];
1396
+ message.instructions = object.instructions?.map((e) => CompiledInstruction.fromPartial(e)) || [];
1397
+ message.addressTableLookups = object.addressTableLookups?.map((e) => MessageAddressTableLookup.fromPartial(e)) ||
1398
+ [];
1399
+ message.feePayer = object.feePayer ?? new Uint8Array(0);
1400
+ message.writableAccounts = object.writableAccounts?.map((e) => e) || [];
1401
+ message.programIds = object.programIds?.map((e) => e) || [];
1402
+ message.computeUnitPrice = object.computeUnitPrice ?? 0n;
1403
+ message.computeLimit = object.computeLimit ?? 0;
1404
+ message.txSize = object.txSize ?? 0;
1405
+ message.loadedWritableAddresses = object.loadedWritableAddresses?.map((e) => e) || [];
1406
+ message.loadedReadonlyAddresses = object.loadedReadonlyAddresses?.map((e) => e) || [];
1407
+ message.altResolutionIncomplete = object.altResolutionIncomplete ?? false;
1408
+ return message;
1409
+ },
1410
+ };
1411
+ function createBaseCompiledInstruction() {
1412
+ return { programIdIndex: 0, accounts: new Uint8Array(0), data: new Uint8Array(0) };
1413
+ }
1414
+ export const CompiledInstruction = {
1415
+ encode(message, writer = new BinaryWriter()) {
1416
+ if (message.programIdIndex !== 0) {
1417
+ writer.uint32(8).uint32(message.programIdIndex);
1418
+ }
1419
+ if (message.accounts.length !== 0) {
1420
+ writer.uint32(18).bytes(message.accounts);
1421
+ }
1422
+ if (message.data.length !== 0) {
1423
+ writer.uint32(26).bytes(message.data);
1424
+ }
1425
+ return writer;
1426
+ },
1427
+ decode(input, length) {
1428
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1429
+ const end = length === undefined ? reader.len : reader.pos + length;
1430
+ const message = createBaseCompiledInstruction();
1431
+ while (reader.pos < end) {
1432
+ const tag = reader.uint32();
1433
+ switch (tag >>> 3) {
1434
+ case 1: {
1435
+ if (tag !== 8) {
1436
+ break;
1437
+ }
1438
+ message.programIdIndex = reader.uint32();
1439
+ continue;
1440
+ }
1441
+ case 2: {
1442
+ if (tag !== 18) {
1443
+ break;
1444
+ }
1445
+ message.accounts = reader.bytes();
1446
+ continue;
1447
+ }
1448
+ case 3: {
1449
+ if (tag !== 26) {
1450
+ break;
1451
+ }
1452
+ message.data = reader.bytes();
1453
+ continue;
1454
+ }
1455
+ }
1456
+ if ((tag & 7) === 4 || tag === 0) {
1457
+ break;
1458
+ }
1459
+ reader.skip(tag & 7);
1460
+ }
1461
+ return message;
1462
+ },
1463
+ fromJSON(object) {
1464
+ return {
1465
+ programIdIndex: isSet(object.programIdIndex)
1466
+ ? globalThis.Number(object.programIdIndex)
1467
+ : isSet(object.program_id_index)
1468
+ ? globalThis.Number(object.program_id_index)
1469
+ : 0,
1470
+ accounts: isSet(object.accounts) ? bytesFromBase64(object.accounts) : new Uint8Array(0),
1471
+ data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
1472
+ };
1473
+ },
1474
+ toJSON(message) {
1475
+ const obj = {};
1476
+ if (message.programIdIndex !== 0) {
1477
+ obj.programIdIndex = Math.round(message.programIdIndex);
1478
+ }
1479
+ if (message.accounts.length !== 0) {
1480
+ obj.accounts = base64FromBytes(message.accounts);
1481
+ }
1482
+ if (message.data.length !== 0) {
1483
+ obj.data = base64FromBytes(message.data);
1484
+ }
1485
+ return obj;
1486
+ },
1487
+ create(base) {
1488
+ return CompiledInstruction.fromPartial(base ?? {});
1489
+ },
1490
+ fromPartial(object) {
1491
+ const message = createBaseCompiledInstruction();
1492
+ message.programIdIndex = object.programIdIndex ?? 0;
1493
+ message.accounts = object.accounts ?? new Uint8Array(0);
1494
+ message.data = object.data ?? new Uint8Array(0);
1495
+ return message;
1496
+ },
1497
+ };
1498
+ function createBaseMessageAddressTableLookup() {
1499
+ return { accountKey: new Uint8Array(0), writableIndexes: new Uint8Array(0), readonlyIndexes: new Uint8Array(0) };
1500
+ }
1501
+ export const MessageAddressTableLookup = {
1502
+ encode(message, writer = new BinaryWriter()) {
1503
+ if (message.accountKey.length !== 0) {
1504
+ writer.uint32(10).bytes(message.accountKey);
1505
+ }
1506
+ if (message.writableIndexes.length !== 0) {
1507
+ writer.uint32(18).bytes(message.writableIndexes);
1508
+ }
1509
+ if (message.readonlyIndexes.length !== 0) {
1510
+ writer.uint32(26).bytes(message.readonlyIndexes);
1511
+ }
1512
+ return writer;
1513
+ },
1514
+ decode(input, length) {
1515
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1516
+ const end = length === undefined ? reader.len : reader.pos + length;
1517
+ const message = createBaseMessageAddressTableLookup();
1518
+ while (reader.pos < end) {
1519
+ const tag = reader.uint32();
1520
+ switch (tag >>> 3) {
1521
+ case 1: {
1522
+ if (tag !== 10) {
1523
+ break;
1524
+ }
1525
+ message.accountKey = reader.bytes();
1526
+ continue;
1527
+ }
1528
+ case 2: {
1529
+ if (tag !== 18) {
1530
+ break;
1531
+ }
1532
+ message.writableIndexes = reader.bytes();
1533
+ continue;
1534
+ }
1535
+ case 3: {
1536
+ if (tag !== 26) {
1537
+ break;
1538
+ }
1539
+ message.readonlyIndexes = reader.bytes();
1540
+ continue;
1541
+ }
1542
+ }
1543
+ if ((tag & 7) === 4 || tag === 0) {
1544
+ break;
1545
+ }
1546
+ reader.skip(tag & 7);
1547
+ }
1548
+ return message;
1549
+ },
1550
+ fromJSON(object) {
1551
+ return {
1552
+ accountKey: isSet(object.accountKey)
1553
+ ? bytesFromBase64(object.accountKey)
1554
+ : isSet(object.account_key)
1555
+ ? bytesFromBase64(object.account_key)
1556
+ : new Uint8Array(0),
1557
+ writableIndexes: isSet(object.writableIndexes)
1558
+ ? bytesFromBase64(object.writableIndexes)
1559
+ : isSet(object.writable_indexes)
1560
+ ? bytesFromBase64(object.writable_indexes)
1561
+ : new Uint8Array(0),
1562
+ readonlyIndexes: isSet(object.readonlyIndexes)
1563
+ ? bytesFromBase64(object.readonlyIndexes)
1564
+ : isSet(object.readonly_indexes)
1565
+ ? bytesFromBase64(object.readonly_indexes)
1566
+ : new Uint8Array(0),
1567
+ };
1568
+ },
1569
+ toJSON(message) {
1570
+ const obj = {};
1571
+ if (message.accountKey.length !== 0) {
1572
+ obj.accountKey = base64FromBytes(message.accountKey);
1573
+ }
1574
+ if (message.writableIndexes.length !== 0) {
1575
+ obj.writableIndexes = base64FromBytes(message.writableIndexes);
1576
+ }
1577
+ if (message.readonlyIndexes.length !== 0) {
1578
+ obj.readonlyIndexes = base64FromBytes(message.readonlyIndexes);
1579
+ }
1580
+ return obj;
1581
+ },
1582
+ create(base) {
1583
+ return MessageAddressTableLookup.fromPartial(base ?? {});
1584
+ },
1585
+ fromPartial(object) {
1586
+ const message = createBaseMessageAddressTableLookup();
1587
+ message.accountKey = object.accountKey ?? new Uint8Array(0);
1588
+ message.writableIndexes = object.writableIndexes ?? new Uint8Array(0);
1589
+ message.readonlyIndexes = object.readonlyIndexes ?? new Uint8Array(0);
1590
+ return message;
1591
+ },
1592
+ };
1593
+ function createBaseSubscribeSlotsRequest() {
1594
+ return {};
1595
+ }
1596
+ export const SubscribeSlotsRequest = {
1597
+ encode(_, writer = new BinaryWriter()) {
1598
+ return writer;
1599
+ },
1600
+ decode(input, length) {
1601
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1602
+ const end = length === undefined ? reader.len : reader.pos + length;
1603
+ const message = createBaseSubscribeSlotsRequest();
1604
+ while (reader.pos < end) {
1605
+ const tag = reader.uint32();
1606
+ switch (tag >>> 3) {
1607
+ }
1608
+ if ((tag & 7) === 4 || tag === 0) {
1609
+ break;
1610
+ }
1611
+ reader.skip(tag & 7);
1612
+ }
1613
+ return message;
1614
+ },
1615
+ fromJSON(_) {
1616
+ return {};
1617
+ },
1618
+ toJSON(_) {
1619
+ const obj = {};
1620
+ return obj;
1621
+ },
1622
+ create(base) {
1623
+ return SubscribeSlotsRequest.fromPartial(base ?? {});
1624
+ },
1625
+ fromPartial(_) {
1626
+ const message = createBaseSubscribeSlotsRequest();
1627
+ return message;
1628
+ },
1629
+ };
1630
+ function createBaseSlotEvent() {
1631
+ return { slot: 0n, status: 0, currentLeader: new Uint8Array(0), parentSlot: 0n, sequence: 0n };
1632
+ }
1633
+ export const SlotEvent = {
1634
+ encode(message, writer = new BinaryWriter()) {
1635
+ if (message.slot !== 0n) {
1636
+ if (BigInt.asUintN(64, message.slot) !== message.slot) {
1637
+ throw new globalThis.Error("value provided for field message.slot of type uint64 too large");
1638
+ }
1639
+ writer.uint32(8).uint64(message.slot);
1640
+ }
1641
+ if (message.status !== 0) {
1642
+ writer.uint32(16).int32(message.status);
1643
+ }
1644
+ if (message.currentLeader.length !== 0) {
1645
+ writer.uint32(26).bytes(message.currentLeader);
1646
+ }
1647
+ if (message.parentSlot !== 0n) {
1648
+ if (BigInt.asUintN(64, message.parentSlot) !== message.parentSlot) {
1649
+ throw new globalThis.Error("value provided for field message.parentSlot of type uint64 too large");
1650
+ }
1651
+ writer.uint32(32).uint64(message.parentSlot);
1652
+ }
1653
+ if (message.sequence !== 0n) {
1654
+ if (BigInt.asUintN(64, message.sequence) !== message.sequence) {
1655
+ throw new globalThis.Error("value provided for field message.sequence of type uint64 too large");
1656
+ }
1657
+ writer.uint32(40).uint64(message.sequence);
1658
+ }
1659
+ return writer;
1660
+ },
1661
+ decode(input, length) {
1662
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1663
+ const end = length === undefined ? reader.len : reader.pos + length;
1664
+ const message = createBaseSlotEvent();
1665
+ while (reader.pos < end) {
1666
+ const tag = reader.uint32();
1667
+ switch (tag >>> 3) {
1668
+ case 1: {
1669
+ if (tag !== 8) {
1670
+ break;
1671
+ }
1672
+ message.slot = reader.uint64();
1673
+ continue;
1674
+ }
1675
+ case 2: {
1676
+ if (tag !== 16) {
1677
+ break;
1678
+ }
1679
+ message.status = reader.int32();
1680
+ continue;
1681
+ }
1682
+ case 3: {
1683
+ if (tag !== 26) {
1684
+ break;
1685
+ }
1686
+ message.currentLeader = reader.bytes();
1687
+ continue;
1688
+ }
1689
+ case 4: {
1690
+ if (tag !== 32) {
1691
+ break;
1692
+ }
1693
+ message.parentSlot = reader.uint64();
1694
+ continue;
1695
+ }
1696
+ case 5: {
1697
+ if (tag !== 40) {
1698
+ break;
1699
+ }
1700
+ message.sequence = reader.uint64();
1701
+ continue;
1702
+ }
1703
+ }
1704
+ if ((tag & 7) === 4 || tag === 0) {
1705
+ break;
1706
+ }
1707
+ reader.skip(tag & 7);
1708
+ }
1709
+ return message;
1710
+ },
1711
+ fromJSON(object) {
1712
+ return {
1713
+ slot: isSet(object.slot) ? BigInt(object.slot) : 0n,
1714
+ status: isSet(object.status) ? slotStatusFromJSON(object.status) : 0,
1715
+ currentLeader: isSet(object.currentLeader)
1716
+ ? bytesFromBase64(object.currentLeader)
1717
+ : isSet(object.current_leader)
1718
+ ? bytesFromBase64(object.current_leader)
1719
+ : new Uint8Array(0),
1720
+ parentSlot: isSet(object.parentSlot)
1721
+ ? BigInt(object.parentSlot)
1722
+ : isSet(object.parent_slot)
1723
+ ? BigInt(object.parent_slot)
1724
+ : 0n,
1725
+ sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
1726
+ };
1727
+ },
1728
+ toJSON(message) {
1729
+ const obj = {};
1730
+ if (message.slot !== 0n) {
1731
+ obj.slot = message.slot.toString();
1732
+ }
1733
+ if (message.status !== 0) {
1734
+ obj.status = slotStatusToJSON(message.status);
1735
+ }
1736
+ if (message.currentLeader.length !== 0) {
1737
+ obj.currentLeader = base64FromBytes(message.currentLeader);
1738
+ }
1739
+ if (message.parentSlot !== 0n) {
1740
+ obj.parentSlot = message.parentSlot.toString();
1741
+ }
1742
+ if (message.sequence !== 0n) {
1743
+ obj.sequence = message.sequence.toString();
1744
+ }
1745
+ return obj;
1746
+ },
1747
+ create(base) {
1748
+ return SlotEvent.fromPartial(base ?? {});
1749
+ },
1750
+ fromPartial(object) {
1751
+ const message = createBaseSlotEvent();
1752
+ message.slot = object.slot ?? 0n;
1753
+ message.status = object.status ?? 0;
1754
+ message.currentLeader = object.currentLeader ?? new Uint8Array(0);
1755
+ message.parentSlot = object.parentSlot ?? 0n;
1756
+ message.sequence = object.sequence ?? 0n;
1757
+ return message;
1758
+ },
1759
+ };
1760
+ function createBasePingRequest() {
1761
+ return { count: 0 };
1762
+ }
1763
+ export const PingRequest = {
1764
+ encode(message, writer = new BinaryWriter()) {
1765
+ if (message.count !== 0) {
1766
+ writer.uint32(8).int32(message.count);
1767
+ }
1768
+ return writer;
1769
+ },
1770
+ decode(input, length) {
1771
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1772
+ const end = length === undefined ? reader.len : reader.pos + length;
1773
+ const message = createBasePingRequest();
1774
+ while (reader.pos < end) {
1775
+ const tag = reader.uint32();
1776
+ switch (tag >>> 3) {
1777
+ case 1: {
1778
+ if (tag !== 8) {
1779
+ break;
1780
+ }
1781
+ message.count = reader.int32();
1782
+ continue;
1783
+ }
1784
+ }
1785
+ if ((tag & 7) === 4 || tag === 0) {
1786
+ break;
1787
+ }
1788
+ reader.skip(tag & 7);
1789
+ }
1790
+ return message;
1791
+ },
1792
+ fromJSON(object) {
1793
+ return { count: isSet(object.count) ? globalThis.Number(object.count) : 0 };
1794
+ },
1795
+ toJSON(message) {
1796
+ const obj = {};
1797
+ if (message.count !== 0) {
1798
+ obj.count = Math.round(message.count);
1799
+ }
1800
+ return obj;
1801
+ },
1802
+ create(base) {
1803
+ return PingRequest.fromPartial(base ?? {});
1804
+ },
1805
+ fromPartial(object) {
1806
+ const message = createBasePingRequest();
1807
+ message.count = object.count ?? 0;
1808
+ return message;
1809
+ },
1810
+ };
1811
+ function createBasePongResponse() {
1812
+ return { count: 0 };
1813
+ }
1814
+ export const PongResponse = {
1815
+ encode(message, writer = new BinaryWriter()) {
1816
+ if (message.count !== 0) {
1817
+ writer.uint32(8).int32(message.count);
1818
+ }
1819
+ return writer;
1820
+ },
1821
+ decode(input, length) {
1822
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1823
+ const end = length === undefined ? reader.len : reader.pos + length;
1824
+ const message = createBasePongResponse();
1825
+ while (reader.pos < end) {
1826
+ const tag = reader.uint32();
1827
+ switch (tag >>> 3) {
1828
+ case 1: {
1829
+ if (tag !== 8) {
1830
+ break;
1831
+ }
1832
+ message.count = reader.int32();
1833
+ continue;
1834
+ }
1835
+ }
1836
+ if ((tag & 7) === 4 || tag === 0) {
1837
+ break;
1838
+ }
1839
+ reader.skip(tag & 7);
1840
+ }
1841
+ return message;
1842
+ },
1843
+ fromJSON(object) {
1844
+ return { count: isSet(object.count) ? globalThis.Number(object.count) : 0 };
1845
+ },
1846
+ toJSON(message) {
1847
+ const obj = {};
1848
+ if (message.count !== 0) {
1849
+ obj.count = Math.round(message.count);
1850
+ }
1851
+ return obj;
1852
+ },
1853
+ create(base) {
1854
+ return PongResponse.fromPartial(base ?? {});
1855
+ },
1856
+ fromPartial(object) {
1857
+ const message = createBasePongResponse();
1858
+ message.count = object.count ?? 0;
1859
+ return message;
1860
+ },
1861
+ };
1862
+ function createBaseGetVersionRequest() {
1863
+ return {};
1864
+ }
1865
+ export const GetVersionRequest = {
1866
+ encode(_, writer = new BinaryWriter()) {
1867
+ return writer;
1868
+ },
1869
+ decode(input, length) {
1870
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1871
+ const end = length === undefined ? reader.len : reader.pos + length;
1872
+ const message = createBaseGetVersionRequest();
1873
+ while (reader.pos < end) {
1874
+ const tag = reader.uint32();
1875
+ switch (tag >>> 3) {
1876
+ }
1877
+ if ((tag & 7) === 4 || tag === 0) {
1878
+ break;
1879
+ }
1880
+ reader.skip(tag & 7);
1881
+ }
1882
+ return message;
1883
+ },
1884
+ fromJSON(_) {
1885
+ return {};
1886
+ },
1887
+ toJSON(_) {
1888
+ const obj = {};
1889
+ return obj;
1890
+ },
1891
+ create(base) {
1892
+ return GetVersionRequest.fromPartial(base ?? {});
1893
+ },
1894
+ fromPartial(_) {
1895
+ const message = createBaseGetVersionRequest();
1896
+ return message;
1897
+ },
1898
+ };
1899
+ function createBaseGetVersionResponse() {
1900
+ return { version: "" };
1901
+ }
1902
+ export const GetVersionResponse = {
1903
+ encode(message, writer = new BinaryWriter()) {
1904
+ if (message.version !== "") {
1905
+ writer.uint32(10).string(message.version);
1906
+ }
1907
+ return writer;
1908
+ },
1909
+ decode(input, length) {
1910
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1911
+ const end = length === undefined ? reader.len : reader.pos + length;
1912
+ const message = createBaseGetVersionResponse();
1913
+ while (reader.pos < end) {
1914
+ const tag = reader.uint32();
1915
+ switch (tag >>> 3) {
1916
+ case 1: {
1917
+ if (tag !== 10) {
1918
+ break;
1919
+ }
1920
+ message.version = reader.string();
1921
+ continue;
1922
+ }
1923
+ }
1924
+ if ((tag & 7) === 4 || tag === 0) {
1925
+ break;
1926
+ }
1927
+ reader.skip(tag & 7);
1928
+ }
1929
+ return message;
1930
+ },
1931
+ fromJSON(object) {
1932
+ return { version: isSet(object.version) ? globalThis.String(object.version) : "" };
1933
+ },
1934
+ toJSON(message) {
1935
+ const obj = {};
1936
+ if (message.version !== "") {
1937
+ obj.version = message.version;
1938
+ }
1939
+ return obj;
1940
+ },
1941
+ create(base) {
1942
+ return GetVersionResponse.fromPartial(base ?? {});
1943
+ },
1944
+ fromPartial(object) {
1945
+ const message = createBaseGetVersionResponse();
1946
+ message.version = object.version ?? "";
1947
+ return message;
1948
+ },
1949
+ };
1950
+ export const JetstreamV2Service = {
1951
+ subscribeTransactions: {
1952
+ path: "/jetstream.v2.JetstreamV2/SubscribeTransactions",
1953
+ requestStream: true,
1954
+ responseStream: true,
1955
+ requestSerialize: (value) => Buffer.from(SubscribeTransactionsRequest.encode(value).finish()),
1956
+ requestDeserialize: (value) => SubscribeTransactionsRequest.decode(value),
1957
+ responseSerialize: (value) => Buffer.from(SubscribeTransactionsResponse.encode(value).finish()),
1958
+ responseDeserialize: (value) => SubscribeTransactionsResponse.decode(value),
1959
+ },
1960
+ /** Server-streaming slot lifecycle events. */
1961
+ subscribeSlots: {
1962
+ path: "/jetstream.v2.JetstreamV2/SubscribeSlots",
1963
+ requestStream: false,
1964
+ responseStream: true,
1965
+ requestSerialize: (value) => Buffer.from(SubscribeSlotsRequest.encode(value).finish()),
1966
+ requestDeserialize: (value) => SubscribeSlotsRequest.decode(value),
1967
+ responseSerialize: (value) => Buffer.from(SlotEvent.encode(value).finish()),
1968
+ responseDeserialize: (value) => SlotEvent.decode(value),
1969
+ },
1970
+ /** Unary health/version probes. */
1971
+ ping: {
1972
+ path: "/jetstream.v2.JetstreamV2/Ping",
1973
+ requestStream: false,
1974
+ responseStream: false,
1975
+ requestSerialize: (value) => Buffer.from(PingRequest.encode(value).finish()),
1976
+ requestDeserialize: (value) => PingRequest.decode(value),
1977
+ responseSerialize: (value) => Buffer.from(PongResponse.encode(value).finish()),
1978
+ responseDeserialize: (value) => PongResponse.decode(value),
1979
+ },
1980
+ getVersion: {
1981
+ path: "/jetstream.v2.JetstreamV2/GetVersion",
1982
+ requestStream: false,
1983
+ responseStream: false,
1984
+ requestSerialize: (value) => Buffer.from(GetVersionRequest.encode(value).finish()),
1985
+ requestDeserialize: (value) => GetVersionRequest.decode(value),
1986
+ responseSerialize: (value) => Buffer.from(GetVersionResponse.encode(value).finish()),
1987
+ responseDeserialize: (value) => GetVersionResponse.decode(value),
1988
+ },
1989
+ };
1990
+ export const JetstreamV2Client = makeGenericClientConstructor(JetstreamV2Service, "jetstream.v2.JetstreamV2");
1991
+ function bytesFromBase64(b64) {
1992
+ if (globalThis.Buffer) {
1993
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1994
+ }
1995
+ else {
1996
+ const bin = globalThis.atob(b64);
1997
+ const arr = new Uint8Array(bin.length);
1998
+ for (let i = 0; i < bin.length; ++i) {
1999
+ arr[i] = bin.charCodeAt(i);
2000
+ }
2001
+ return arr;
2002
+ }
2003
+ }
2004
+ function base64FromBytes(arr) {
2005
+ if (globalThis.Buffer) {
2006
+ return globalThis.Buffer.from(arr).toString("base64");
2007
+ }
2008
+ else {
2009
+ const bin = [];
2010
+ arr.forEach((byte) => {
2011
+ bin.push(globalThis.String.fromCharCode(byte));
2012
+ });
2013
+ return globalThis.btoa(bin.join(""));
2014
+ }
2015
+ }
2016
+ function toTimestamp(date) {
2017
+ const seconds = BigInt(Math.trunc(date.getTime() / 1_000));
2018
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
2019
+ return { seconds, nanos };
2020
+ }
2021
+ function fromTimestamp(t) {
2022
+ let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;
2023
+ millis += (t.nanos || 0) / 1_000_000;
2024
+ return new globalThis.Date(millis);
2025
+ }
2026
+ function fromJsonTimestamp(o) {
2027
+ if (o instanceof globalThis.Date) {
2028
+ return o;
2029
+ }
2030
+ else if (typeof o === "string") {
2031
+ return new globalThis.Date(o);
2032
+ }
2033
+ else {
2034
+ return fromTimestamp(Timestamp.fromJSON(o));
2035
+ }
2036
+ }
2037
+ function isSet(value) {
2038
+ return value !== null && value !== undefined;
2039
+ }
2040
+ //# sourceMappingURL=jetstream_v2.js.map