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