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