@orbitflare/sdk 0.5.1 → 0.6.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 (40) hide show
  1. package/README.md +116 -3
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +1 -0
  4. package/dist/config.js.map +1 -1
  5. package/dist/error.d.ts.map +1 -1
  6. package/dist/error.js +14 -1
  7. package/dist/error.js.map +1 -1
  8. package/dist/events.d.ts +45 -0
  9. package/dist/events.d.ts.map +1 -0
  10. package/dist/events.js +98 -0
  11. package/dist/events.js.map +1 -0
  12. package/dist/grpc.d.ts +49 -20
  13. package/dist/grpc.d.ts.map +1 -1
  14. package/dist/grpc.js +205 -121
  15. package/dist/grpc.js.map +1 -1
  16. package/dist/jetstream/index.d.ts +12 -19
  17. package/dist/jetstream/index.d.ts.map +1 -1
  18. package/dist/jetstream/index.js +61 -108
  19. package/dist/jetstream/index.js.map +1 -1
  20. package/dist/jetstream/v2.d.ts +21 -29
  21. package/dist/jetstream/v2.d.ts.map +1 -1
  22. package/dist/jetstream/v2.js +107 -198
  23. package/dist/jetstream/v2.js.map +1 -1
  24. package/dist/proto/geyser.d.ts +245 -2
  25. package/dist/proto/geyser.d.ts.map +1 -1
  26. package/dist/proto/geyser.js +2969 -311
  27. package/dist/proto/geyser.js.map +1 -1
  28. package/dist/proto/jetstream_v2.d.ts +168 -25
  29. package/dist/proto/jetstream_v2.d.ts.map +1 -1
  30. package/dist/proto/jetstream_v2.js +754 -34
  31. package/dist/proto/jetstream_v2.js.map +1 -1
  32. package/dist/proto/solana-storage.d.ts +19 -0
  33. package/dist/proto/solana-storage.d.ts.map +1 -1
  34. package/dist/proto/solana-storage.js +6 -0
  35. package/dist/proto/solana-storage.js.map +1 -1
  36. package/dist/streaming.d.ts +58 -0
  37. package/dist/streaming.d.ts.map +1 -0
  38. package/dist/streaming.js +169 -0
  39. package/dist/streaming.js.map +1 -0
  40. package/package.json +4 -2
@@ -18,6 +18,15 @@ export var SlotStatus;
18
18
  SlotStatus[SlotStatus["SLOT_STATUS_COMPLETE"] = 2] = "SLOT_STATUS_COMPLETE";
19
19
  /** SLOT_STATUS_DEAD - slot skipped, or superseded by later slots without completing */
20
20
  SlotStatus[SlotStatus["SLOT_STATUS_DEAD"] = 3] = "SLOT_STATUS_DEAD";
21
+ /**
22
+ * SLOT_STATUS_BLOCK_FOOTER - The slot's block footer; SlotEvent.block_footer is set. Sent only to
23
+ * streams that set include_block_footer, at most once per slot. It usually
24
+ * arrives right around COMPLETE, before or after it (the two are not
25
+ * ordered), and can also follow DEAD or arrive for a slot that never gets
26
+ * COMPLETE. It does not change the slot's status and is not a terminal
27
+ * event. A slot without a footer gets no such event.
28
+ */
29
+ SlotStatus[SlotStatus["SLOT_STATUS_BLOCK_FOOTER"] = 4] = "SLOT_STATUS_BLOCK_FOOTER";
21
30
  SlotStatus[SlotStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
22
31
  })(SlotStatus || (SlotStatus = {}));
23
32
  export function slotStatusFromJSON(object) {
@@ -34,6 +43,9 @@ export function slotStatusFromJSON(object) {
34
43
  case 3:
35
44
  case "SLOT_STATUS_DEAD":
36
45
  return SlotStatus.SLOT_STATUS_DEAD;
46
+ case 4:
47
+ case "SLOT_STATUS_BLOCK_FOOTER":
48
+ return SlotStatus.SLOT_STATUS_BLOCK_FOOTER;
37
49
  case -1:
38
50
  case "UNRECOGNIZED":
39
51
  default:
@@ -50,11 +62,38 @@ export function slotStatusToJSON(object) {
50
62
  return "SLOT_STATUS_COMPLETE";
51
63
  case SlotStatus.SLOT_STATUS_DEAD:
52
64
  return "SLOT_STATUS_DEAD";
65
+ case SlotStatus.SLOT_STATUS_BLOCK_FOOTER:
66
+ return "SLOT_STATUS_BLOCK_FOOTER";
53
67
  case SlotStatus.UNRECOGNIZED:
54
68
  default:
55
69
  return "UNRECOGNIZED";
56
70
  }
57
71
  }
72
+ export var BlockFooterSignatureKind;
73
+ (function (BlockFooterSignatureKind) {
74
+ BlockFooterSignatureKind[BlockFooterSignatureKind["COMPRESSED_BLS12_381_G2"] = 0] = "COMPRESSED_BLS12_381_G2";
75
+ BlockFooterSignatureKind[BlockFooterSignatureKind["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
76
+ })(BlockFooterSignatureKind || (BlockFooterSignatureKind = {}));
77
+ export function blockFooterSignatureKindFromJSON(object) {
78
+ switch (object) {
79
+ case 0:
80
+ case "COMPRESSED_BLS12_381_G2":
81
+ return BlockFooterSignatureKind.COMPRESSED_BLS12_381_G2;
82
+ case -1:
83
+ case "UNRECOGNIZED":
84
+ default:
85
+ return BlockFooterSignatureKind.UNRECOGNIZED;
86
+ }
87
+ }
88
+ export function blockFooterSignatureKindToJSON(object) {
89
+ switch (object) {
90
+ case BlockFooterSignatureKind.COMPRESSED_BLS12_381_G2:
91
+ return "COMPRESSED_BLS12_381_G2";
92
+ case BlockFooterSignatureKind.UNRECOGNIZED:
93
+ default:
94
+ return "UNRECOGNIZED";
95
+ }
96
+ }
58
97
  function createBaseSubscribeTransactionsRequest() {
59
98
  return { ping: undefined, addFilters: undefined, removeFilters: undefined };
60
99
  }
@@ -1076,7 +1115,7 @@ function createBaseTransactionMessage() {
1076
1115
  loadedReadonlyAddresses: [],
1077
1116
  altResolutionIncomplete: false,
1078
1117
  config: undefined,
1079
- priorityFeeLamports: undefined,
1118
+ priorityFeeLamports: 0n,
1080
1119
  };
1081
1120
  }
1082
1121
  export const TransactionMessage = {
@@ -1156,7 +1195,7 @@ export const TransactionMessage = {
1156
1195
  if (message.config !== undefined) {
1157
1196
  TransactionConfig.encode(message.config, writer.uint32(186).fork()).join();
1158
1197
  }
1159
- if (message.priorityFeeLamports !== undefined) {
1198
+ if (message.priorityFeeLamports !== 0n) {
1160
1199
  if (BigInt.asUintN(64, message.priorityFeeLamports) !== message.priorityFeeLamports) {
1161
1200
  throw new globalThis.Error("value provided for field message.priorityFeeLamports of type uint64 too large");
1162
1201
  }
@@ -1458,7 +1497,7 @@ export const TransactionMessage = {
1458
1497
  ? BigInt(object.priorityFeeLamports)
1459
1498
  : isSet(object.priority_fee_lamports)
1460
1499
  ? BigInt(object.priority_fee_lamports)
1461
- : undefined,
1500
+ : 0n,
1462
1501
  };
1463
1502
  },
1464
1503
  toJSON(message) {
@@ -1532,7 +1571,7 @@ export const TransactionMessage = {
1532
1571
  if (message.config !== undefined) {
1533
1572
  obj.config = TransactionConfig.toJSON(message.config);
1534
1573
  }
1535
- if (message.priorityFeeLamports !== undefined) {
1574
+ if (message.priorityFeeLamports !== 0n) {
1536
1575
  obj.priorityFeeLamports = message.priorityFeeLamports.toString();
1537
1576
  }
1538
1577
  return obj;
@@ -1572,35 +1611,33 @@ export const TransactionMessage = {
1572
1611
  : undefined;
1573
1612
  message.priorityFeeLamports = (object.priorityFeeLamports !== undefined && object.priorityFeeLamports !== null)
1574
1613
  ? BigInt(object.priorityFeeLamports)
1575
- : undefined;
1614
+ : 0n;
1576
1615
  return message;
1577
1616
  },
1578
1617
  };
1579
1618
  function createBaseTransactionConfig() {
1580
- return {
1581
- priorityFee: undefined,
1582
- computeUnitLimit: undefined,
1583
- loadedAccountsDataSizeLimit: undefined,
1584
- heapSize: undefined,
1585
- };
1619
+ return { priorityFee: 0n, computeUnitLimit: 0, loadedAccountsDataSizeLimit: 0, heapSize: 0, configMask: 0 };
1586
1620
  }
1587
1621
  export const TransactionConfig = {
1588
1622
  encode(message, writer = new BinaryWriter()) {
1589
- if (message.priorityFee !== undefined) {
1623
+ if (message.priorityFee !== 0n) {
1590
1624
  if (BigInt.asUintN(64, message.priorityFee) !== message.priorityFee) {
1591
1625
  throw new globalThis.Error("value provided for field message.priorityFee of type uint64 too large");
1592
1626
  }
1593
1627
  writer.uint32(8).uint64(message.priorityFee);
1594
1628
  }
1595
- if (message.computeUnitLimit !== undefined) {
1629
+ if (message.computeUnitLimit !== 0) {
1596
1630
  writer.uint32(16).uint32(message.computeUnitLimit);
1597
1631
  }
1598
- if (message.loadedAccountsDataSizeLimit !== undefined) {
1632
+ if (message.loadedAccountsDataSizeLimit !== 0) {
1599
1633
  writer.uint32(24).uint32(message.loadedAccountsDataSizeLimit);
1600
1634
  }
1601
- if (message.heapSize !== undefined) {
1635
+ if (message.heapSize !== 0) {
1602
1636
  writer.uint32(32).uint32(message.heapSize);
1603
1637
  }
1638
+ if (message.configMask !== 0) {
1639
+ writer.uint32(40).uint32(message.configMask);
1640
+ }
1604
1641
  return writer;
1605
1642
  },
1606
1643
  decode(input, length) {
@@ -1644,6 +1681,13 @@ export const TransactionConfig = {
1644
1681
  message.heapSize = reader.uint32();
1645
1682
  continue;
1646
1683
  }
1684
+ case 5: {
1685
+ if (tag !== 40) {
1686
+ break;
1687
+ }
1688
+ message.configMask = reader.uint32();
1689
+ continue;
1690
+ }
1647
1691
  }
1648
1692
  if ((tag & 7) === 4 || tag === 0) {
1649
1693
  break;
@@ -1662,38 +1706,46 @@ export const TransactionConfig = {
1662
1706
  ? BigInt(object.priorityFee)
1663
1707
  : isSet(object.priority_fee)
1664
1708
  ? BigInt(object.priority_fee)
1665
- : undefined,
1709
+ : 0n,
1666
1710
  computeUnitLimit: isSet(object.computeUnitLimit)
1667
1711
  ? globalThis.Number(object.computeUnitLimit)
1668
1712
  : isSet(object.compute_unit_limit)
1669
1713
  ? globalThis.Number(object.compute_unit_limit)
1670
- : undefined,
1714
+ : 0,
1671
1715
  loadedAccountsDataSizeLimit: isSet(object.loadedAccountsDataSizeLimit)
1672
1716
  ? globalThis.Number(object.loadedAccountsDataSizeLimit)
1673
1717
  : isSet(object.loaded_accounts_data_size_limit)
1674
1718
  ? globalThis.Number(object.loaded_accounts_data_size_limit)
1675
- : undefined,
1719
+ : 0,
1676
1720
  heapSize: isSet(object.heapSize)
1677
1721
  ? globalThis.Number(object.heapSize)
1678
1722
  : isSet(object.heap_size)
1679
1723
  ? globalThis.Number(object.heap_size)
1680
- : undefined,
1724
+ : 0,
1725
+ configMask: isSet(object.configMask)
1726
+ ? globalThis.Number(object.configMask)
1727
+ : isSet(object.config_mask)
1728
+ ? globalThis.Number(object.config_mask)
1729
+ : 0,
1681
1730
  };
1682
1731
  },
1683
1732
  toJSON(message) {
1684
1733
  const obj = {};
1685
- if (message.priorityFee !== undefined) {
1734
+ if (message.priorityFee !== 0n) {
1686
1735
  obj.priorityFee = message.priorityFee.toString();
1687
1736
  }
1688
- if (message.computeUnitLimit !== undefined) {
1737
+ if (message.computeUnitLimit !== 0) {
1689
1738
  obj.computeUnitLimit = Math.round(message.computeUnitLimit);
1690
1739
  }
1691
- if (message.loadedAccountsDataSizeLimit !== undefined) {
1740
+ if (message.loadedAccountsDataSizeLimit !== 0) {
1692
1741
  obj.loadedAccountsDataSizeLimit = Math.round(message.loadedAccountsDataSizeLimit);
1693
1742
  }
1694
- if (message.heapSize !== undefined) {
1743
+ if (message.heapSize !== 0) {
1695
1744
  obj.heapSize = Math.round(message.heapSize);
1696
1745
  }
1746
+ if (message.configMask !== 0) {
1747
+ obj.configMask = Math.round(message.configMask);
1748
+ }
1697
1749
  return obj;
1698
1750
  },
1699
1751
  create(base) {
@@ -1703,10 +1755,11 @@ export const TransactionConfig = {
1703
1755
  const message = createBaseTransactionConfig();
1704
1756
  message.priorityFee = (object.priorityFee !== undefined && object.priorityFee !== null)
1705
1757
  ? BigInt(object.priorityFee)
1706
- : undefined;
1707
- message.computeUnitLimit = object.computeUnitLimit ?? undefined;
1708
- message.loadedAccountsDataSizeLimit = object.loadedAccountsDataSizeLimit ?? undefined;
1709
- message.heapSize = object.heapSize ?? undefined;
1758
+ : 0n;
1759
+ message.computeUnitLimit = object.computeUnitLimit ?? 0;
1760
+ message.loadedAccountsDataSizeLimit = object.loadedAccountsDataSizeLimit ?? 0;
1761
+ message.heapSize = object.heapSize ?? 0;
1762
+ message.configMask = object.configMask ?? 0;
1710
1763
  return message;
1711
1764
  },
1712
1765
  };
@@ -1913,10 +1966,13 @@ export const MessageAddressTableLookup = {
1913
1966
  },
1914
1967
  };
1915
1968
  function createBaseSubscribeSlotsRequest() {
1916
- return {};
1969
+ return { includeBlockFooter: false };
1917
1970
  }
1918
1971
  export const SubscribeSlotsRequest = {
1919
- encode(_, writer = new BinaryWriter()) {
1972
+ encode(message, writer = new BinaryWriter()) {
1973
+ if (message.includeBlockFooter !== false) {
1974
+ writer.uint32(8).bool(message.includeBlockFooter);
1975
+ }
1920
1976
  return writer;
1921
1977
  },
1922
1978
  decode(input, length) {
@@ -1932,6 +1988,13 @@ export const SubscribeSlotsRequest = {
1932
1988
  while (reader.pos < end) {
1933
1989
  const tag = reader.uint32();
1934
1990
  switch (tag >>> 3) {
1991
+ case 1: {
1992
+ if (tag !== 8) {
1993
+ break;
1994
+ }
1995
+ message.includeBlockFooter = reader.bool();
1996
+ continue;
1997
+ }
1935
1998
  }
1936
1999
  if ((tag & 7) === 4 || tag === 0) {
1937
2000
  break;
@@ -1944,23 +2007,40 @@ export const SubscribeSlotsRequest = {
1944
2007
  reader.__tsProtoDecodeDepth = previousRecursionDepth;
1945
2008
  }
1946
2009
  },
1947
- fromJSON(_) {
1948
- return {};
2010
+ fromJSON(object) {
2011
+ return {
2012
+ includeBlockFooter: isSet(object.includeBlockFooter)
2013
+ ? globalThis.Boolean(object.includeBlockFooter)
2014
+ : isSet(object.include_block_footer)
2015
+ ? globalThis.Boolean(object.include_block_footer)
2016
+ : false,
2017
+ };
1949
2018
  },
1950
- toJSON(_) {
2019
+ toJSON(message) {
1951
2020
  const obj = {};
2021
+ if (message.includeBlockFooter !== false) {
2022
+ obj.includeBlockFooter = message.includeBlockFooter;
2023
+ }
1952
2024
  return obj;
1953
2025
  },
1954
2026
  create(base) {
1955
2027
  return SubscribeSlotsRequest.fromPartial(base ?? {});
1956
2028
  },
1957
- fromPartial(_) {
2029
+ fromPartial(object) {
1958
2030
  const message = createBaseSubscribeSlotsRequest();
2031
+ message.includeBlockFooter = object.includeBlockFooter ?? false;
1959
2032
  return message;
1960
2033
  },
1961
2034
  };
1962
2035
  function createBaseSlotEvent() {
1963
- return { slot: 0n, status: 0, currentLeader: new Uint8Array(0), parentSlot: 0n, sequence: 0n };
2036
+ return {
2037
+ slot: 0n,
2038
+ status: 0,
2039
+ currentLeader: new Uint8Array(0),
2040
+ parentSlot: 0n,
2041
+ sequence: 0n,
2042
+ blockFooter: undefined,
2043
+ };
1964
2044
  }
1965
2045
  export const SlotEvent = {
1966
2046
  encode(message, writer = new BinaryWriter()) {
@@ -1988,6 +2068,9 @@ export const SlotEvent = {
1988
2068
  }
1989
2069
  writer.uint32(40).uint64(message.sequence);
1990
2070
  }
2071
+ if (message.blockFooter !== undefined) {
2072
+ BlockFooter.encode(message.blockFooter, writer.uint32(50).fork()).join();
2073
+ }
1991
2074
  return writer;
1992
2075
  },
1993
2076
  decode(input, length) {
@@ -2038,6 +2121,13 @@ export const SlotEvent = {
2038
2121
  message.sequence = reader.uint64();
2039
2122
  continue;
2040
2123
  }
2124
+ case 6: {
2125
+ if (tag !== 50) {
2126
+ break;
2127
+ }
2128
+ message.blockFooter = BlockFooter.decode(reader, reader.uint32());
2129
+ continue;
2130
+ }
2041
2131
  }
2042
2132
  if ((tag & 7) === 4 || tag === 0) {
2043
2133
  break;
@@ -2065,6 +2155,11 @@ export const SlotEvent = {
2065
2155
  ? BigInt(object.parent_slot)
2066
2156
  : 0n,
2067
2157
  sequence: isSet(object.sequence) ? BigInt(object.sequence) : 0n,
2158
+ blockFooter: isSet(object.blockFooter)
2159
+ ? BlockFooter.fromJSON(object.blockFooter)
2160
+ : isSet(object.block_footer)
2161
+ ? BlockFooter.fromJSON(object.block_footer)
2162
+ : undefined,
2068
2163
  };
2069
2164
  },
2070
2165
  toJSON(message) {
@@ -2084,6 +2179,9 @@ export const SlotEvent = {
2084
2179
  if (message.sequence !== 0n) {
2085
2180
  obj.sequence = message.sequence.toString();
2086
2181
  }
2182
+ if (message.blockFooter !== undefined) {
2183
+ obj.blockFooter = BlockFooter.toJSON(message.blockFooter);
2184
+ }
2087
2185
  return obj;
2088
2186
  },
2089
2187
  create(base) {
@@ -2098,6 +2196,628 @@ export const SlotEvent = {
2098
2196
  ? BigInt(object.parentSlot)
2099
2197
  : 0n;
2100
2198
  message.sequence = (object.sequence !== undefined && object.sequence !== null) ? BigInt(object.sequence) : 0n;
2199
+ message.blockFooter = (object.blockFooter !== undefined && object.blockFooter !== null)
2200
+ ? BlockFooter.fromPartial(object.blockFooter)
2201
+ : undefined;
2202
+ return message;
2203
+ },
2204
+ };
2205
+ function createBaseBlockFooter() {
2206
+ return {
2207
+ slot: 0n,
2208
+ bankHash: new Uint8Array(0),
2209
+ blockProducerTimeNanos: 0n,
2210
+ blockUserAgent: new Uint8Array(0),
2211
+ blockFinalCert: undefined,
2212
+ skipRewardCert: undefined,
2213
+ notarRewardCert: undefined,
2214
+ blockId: new Uint8Array(0),
2215
+ };
2216
+ }
2217
+ export const BlockFooter = {
2218
+ encode(message, writer = new BinaryWriter()) {
2219
+ if (message.slot !== 0n) {
2220
+ if (BigInt.asUintN(64, message.slot) !== message.slot) {
2221
+ throw new globalThis.Error("value provided for field message.slot of type uint64 too large");
2222
+ }
2223
+ writer.uint32(8).uint64(message.slot);
2224
+ }
2225
+ if (message.bankHash.length !== 0) {
2226
+ writer.uint32(26).bytes(message.bankHash);
2227
+ }
2228
+ if (message.blockProducerTimeNanos !== 0n) {
2229
+ if (BigInt.asUintN(64, message.blockProducerTimeNanos) !== message.blockProducerTimeNanos) {
2230
+ throw new globalThis.Error("value provided for field message.blockProducerTimeNanos of type uint64 too large");
2231
+ }
2232
+ writer.uint32(32).uint64(message.blockProducerTimeNanos);
2233
+ }
2234
+ if (message.blockUserAgent.length !== 0) {
2235
+ writer.uint32(42).bytes(message.blockUserAgent);
2236
+ }
2237
+ if (message.blockFinalCert !== undefined) {
2238
+ BlockFooterFinalCert.encode(message.blockFinalCert, writer.uint32(74).fork()).join();
2239
+ }
2240
+ if (message.skipRewardCert !== undefined) {
2241
+ BlockFooterSkipRewardCert.encode(message.skipRewardCert, writer.uint32(82).fork()).join();
2242
+ }
2243
+ if (message.notarRewardCert !== undefined) {
2244
+ BlockFooterNotarRewardCert.encode(message.notarRewardCert, writer.uint32(90).fork()).join();
2245
+ }
2246
+ if (message.blockId.length !== 0) {
2247
+ writer.uint32(802).bytes(message.blockId);
2248
+ }
2249
+ return writer;
2250
+ },
2251
+ decode(input, length) {
2252
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2253
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2254
+ if (previousRecursionDepth >= 100) {
2255
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2256
+ }
2257
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2258
+ try {
2259
+ const end = length === undefined ? reader.len : reader.pos + length;
2260
+ const message = createBaseBlockFooter();
2261
+ while (reader.pos < end) {
2262
+ const tag = reader.uint32();
2263
+ switch (tag >>> 3) {
2264
+ case 1: {
2265
+ if (tag !== 8) {
2266
+ break;
2267
+ }
2268
+ message.slot = reader.uint64();
2269
+ continue;
2270
+ }
2271
+ case 3: {
2272
+ if (tag !== 26) {
2273
+ break;
2274
+ }
2275
+ message.bankHash = reader.bytes();
2276
+ continue;
2277
+ }
2278
+ case 4: {
2279
+ if (tag !== 32) {
2280
+ break;
2281
+ }
2282
+ message.blockProducerTimeNanos = reader.uint64();
2283
+ continue;
2284
+ }
2285
+ case 5: {
2286
+ if (tag !== 42) {
2287
+ break;
2288
+ }
2289
+ message.blockUserAgent = reader.bytes();
2290
+ continue;
2291
+ }
2292
+ case 9: {
2293
+ if (tag !== 74) {
2294
+ break;
2295
+ }
2296
+ message.blockFinalCert = BlockFooterFinalCert.decode(reader, reader.uint32());
2297
+ continue;
2298
+ }
2299
+ case 10: {
2300
+ if (tag !== 82) {
2301
+ break;
2302
+ }
2303
+ message.skipRewardCert = BlockFooterSkipRewardCert.decode(reader, reader.uint32());
2304
+ continue;
2305
+ }
2306
+ case 11: {
2307
+ if (tag !== 90) {
2308
+ break;
2309
+ }
2310
+ message.notarRewardCert = BlockFooterNotarRewardCert.decode(reader, reader.uint32());
2311
+ continue;
2312
+ }
2313
+ case 100: {
2314
+ if (tag !== 802) {
2315
+ break;
2316
+ }
2317
+ message.blockId = reader.bytes();
2318
+ continue;
2319
+ }
2320
+ }
2321
+ if ((tag & 7) === 4 || tag === 0) {
2322
+ break;
2323
+ }
2324
+ reader.skip(tag & 7);
2325
+ }
2326
+ return message;
2327
+ }
2328
+ finally {
2329
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2330
+ }
2331
+ },
2332
+ fromJSON(object) {
2333
+ return {
2334
+ slot: isSet(object.slot) ? BigInt(object.slot) : 0n,
2335
+ bankHash: isSet(object.bankHash)
2336
+ ? bytesFromBase64(object.bankHash)
2337
+ : isSet(object.bank_hash)
2338
+ ? bytesFromBase64(object.bank_hash)
2339
+ : new Uint8Array(0),
2340
+ blockProducerTimeNanos: isSet(object.blockProducerTimeNanos)
2341
+ ? BigInt(object.blockProducerTimeNanos)
2342
+ : isSet(object.block_producer_time_nanos)
2343
+ ? BigInt(object.block_producer_time_nanos)
2344
+ : 0n,
2345
+ blockUserAgent: isSet(object.blockUserAgent)
2346
+ ? bytesFromBase64(object.blockUserAgent)
2347
+ : isSet(object.block_user_agent)
2348
+ ? bytesFromBase64(object.block_user_agent)
2349
+ : new Uint8Array(0),
2350
+ blockFinalCert: isSet(object.blockFinalCert)
2351
+ ? BlockFooterFinalCert.fromJSON(object.blockFinalCert)
2352
+ : isSet(object.block_final_cert)
2353
+ ? BlockFooterFinalCert.fromJSON(object.block_final_cert)
2354
+ : undefined,
2355
+ skipRewardCert: isSet(object.skipRewardCert)
2356
+ ? BlockFooterSkipRewardCert.fromJSON(object.skipRewardCert)
2357
+ : isSet(object.skip_reward_cert)
2358
+ ? BlockFooterSkipRewardCert.fromJSON(object.skip_reward_cert)
2359
+ : undefined,
2360
+ notarRewardCert: isSet(object.notarRewardCert)
2361
+ ? BlockFooterNotarRewardCert.fromJSON(object.notarRewardCert)
2362
+ : isSet(object.notar_reward_cert)
2363
+ ? BlockFooterNotarRewardCert.fromJSON(object.notar_reward_cert)
2364
+ : undefined,
2365
+ blockId: isSet(object.blockId)
2366
+ ? bytesFromBase64(object.blockId)
2367
+ : isSet(object.block_id)
2368
+ ? bytesFromBase64(object.block_id)
2369
+ : new Uint8Array(0),
2370
+ };
2371
+ },
2372
+ toJSON(message) {
2373
+ const obj = {};
2374
+ if (message.slot !== 0n) {
2375
+ obj.slot = message.slot.toString();
2376
+ }
2377
+ if (message.bankHash.length !== 0) {
2378
+ obj.bankHash = base64FromBytes(message.bankHash);
2379
+ }
2380
+ if (message.blockProducerTimeNanos !== 0n) {
2381
+ obj.blockProducerTimeNanos = message.blockProducerTimeNanos.toString();
2382
+ }
2383
+ if (message.blockUserAgent.length !== 0) {
2384
+ obj.blockUserAgent = base64FromBytes(message.blockUserAgent);
2385
+ }
2386
+ if (message.blockFinalCert !== undefined) {
2387
+ obj.blockFinalCert = BlockFooterFinalCert.toJSON(message.blockFinalCert);
2388
+ }
2389
+ if (message.skipRewardCert !== undefined) {
2390
+ obj.skipRewardCert = BlockFooterSkipRewardCert.toJSON(message.skipRewardCert);
2391
+ }
2392
+ if (message.notarRewardCert !== undefined) {
2393
+ obj.notarRewardCert = BlockFooterNotarRewardCert.toJSON(message.notarRewardCert);
2394
+ }
2395
+ if (message.blockId.length !== 0) {
2396
+ obj.blockId = base64FromBytes(message.blockId);
2397
+ }
2398
+ return obj;
2399
+ },
2400
+ create(base) {
2401
+ return BlockFooter.fromPartial(base ?? {});
2402
+ },
2403
+ fromPartial(object) {
2404
+ const message = createBaseBlockFooter();
2405
+ message.slot = (object.slot !== undefined && object.slot !== null) ? BigInt(object.slot) : 0n;
2406
+ message.bankHash = object.bankHash ?? new Uint8Array(0);
2407
+ message.blockProducerTimeNanos =
2408
+ (object.blockProducerTimeNanos !== undefined && object.blockProducerTimeNanos !== null)
2409
+ ? BigInt(object.blockProducerTimeNanos)
2410
+ : 0n;
2411
+ message.blockUserAgent = object.blockUserAgent ?? new Uint8Array(0);
2412
+ message.blockFinalCert = (object.blockFinalCert !== undefined && object.blockFinalCert !== null)
2413
+ ? BlockFooterFinalCert.fromPartial(object.blockFinalCert)
2414
+ : undefined;
2415
+ message.skipRewardCert = (object.skipRewardCert !== undefined && object.skipRewardCert !== null)
2416
+ ? BlockFooterSkipRewardCert.fromPartial(object.skipRewardCert)
2417
+ : undefined;
2418
+ message.notarRewardCert = (object.notarRewardCert !== undefined && object.notarRewardCert !== null)
2419
+ ? BlockFooterNotarRewardCert.fromPartial(object.notarRewardCert)
2420
+ : undefined;
2421
+ message.blockId = object.blockId ?? new Uint8Array(0);
2422
+ return message;
2423
+ },
2424
+ };
2425
+ function createBaseBlockFooterVotesAggregate() {
2426
+ return {
2427
+ signatureKind: 0,
2428
+ signature: new Uint8Array(0),
2429
+ blockId: new Uint8Array(0),
2430
+ signerBitmap: new Uint8Array(0),
2431
+ };
2432
+ }
2433
+ export const BlockFooterVotesAggregate = {
2434
+ encode(message, writer = new BinaryWriter()) {
2435
+ if (message.signatureKind !== 0) {
2436
+ writer.uint32(8).int32(message.signatureKind);
2437
+ }
2438
+ if (message.signature.length !== 0) {
2439
+ writer.uint32(18).bytes(message.signature);
2440
+ }
2441
+ if (message.blockId.length !== 0) {
2442
+ writer.uint32(26).bytes(message.blockId);
2443
+ }
2444
+ if (message.signerBitmap.length !== 0) {
2445
+ writer.uint32(34).bytes(message.signerBitmap);
2446
+ }
2447
+ return writer;
2448
+ },
2449
+ decode(input, length) {
2450
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2451
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2452
+ if (previousRecursionDepth >= 100) {
2453
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2454
+ }
2455
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2456
+ try {
2457
+ const end = length === undefined ? reader.len : reader.pos + length;
2458
+ const message = createBaseBlockFooterVotesAggregate();
2459
+ while (reader.pos < end) {
2460
+ const tag = reader.uint32();
2461
+ switch (tag >>> 3) {
2462
+ case 1: {
2463
+ if (tag !== 8) {
2464
+ break;
2465
+ }
2466
+ message.signatureKind = reader.int32();
2467
+ continue;
2468
+ }
2469
+ case 2: {
2470
+ if (tag !== 18) {
2471
+ break;
2472
+ }
2473
+ message.signature = reader.bytes();
2474
+ continue;
2475
+ }
2476
+ case 3: {
2477
+ if (tag !== 26) {
2478
+ break;
2479
+ }
2480
+ message.blockId = reader.bytes();
2481
+ continue;
2482
+ }
2483
+ case 4: {
2484
+ if (tag !== 34) {
2485
+ break;
2486
+ }
2487
+ message.signerBitmap = reader.bytes();
2488
+ continue;
2489
+ }
2490
+ }
2491
+ if ((tag & 7) === 4 || tag === 0) {
2492
+ break;
2493
+ }
2494
+ reader.skip(tag & 7);
2495
+ }
2496
+ return message;
2497
+ }
2498
+ finally {
2499
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2500
+ }
2501
+ },
2502
+ fromJSON(object) {
2503
+ return {
2504
+ signatureKind: isSet(object.signatureKind)
2505
+ ? blockFooterSignatureKindFromJSON(object.signatureKind)
2506
+ : isSet(object.signature_kind)
2507
+ ? blockFooterSignatureKindFromJSON(object.signature_kind)
2508
+ : 0,
2509
+ signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0),
2510
+ blockId: isSet(object.blockId)
2511
+ ? bytesFromBase64(object.blockId)
2512
+ : isSet(object.block_id)
2513
+ ? bytesFromBase64(object.block_id)
2514
+ : new Uint8Array(0),
2515
+ signerBitmap: isSet(object.signerBitmap)
2516
+ ? bytesFromBase64(object.signerBitmap)
2517
+ : isSet(object.signer_bitmap)
2518
+ ? bytesFromBase64(object.signer_bitmap)
2519
+ : new Uint8Array(0),
2520
+ };
2521
+ },
2522
+ toJSON(message) {
2523
+ const obj = {};
2524
+ if (message.signatureKind !== 0) {
2525
+ obj.signatureKind = blockFooterSignatureKindToJSON(message.signatureKind);
2526
+ }
2527
+ if (message.signature.length !== 0) {
2528
+ obj.signature = base64FromBytes(message.signature);
2529
+ }
2530
+ if (message.blockId.length !== 0) {
2531
+ obj.blockId = base64FromBytes(message.blockId);
2532
+ }
2533
+ if (message.signerBitmap.length !== 0) {
2534
+ obj.signerBitmap = base64FromBytes(message.signerBitmap);
2535
+ }
2536
+ return obj;
2537
+ },
2538
+ create(base) {
2539
+ return BlockFooterVotesAggregate.fromPartial(base ?? {});
2540
+ },
2541
+ fromPartial(object) {
2542
+ const message = createBaseBlockFooterVotesAggregate();
2543
+ message.signatureKind = object.signatureKind ?? 0;
2544
+ message.signature = object.signature ?? new Uint8Array(0);
2545
+ message.blockId = object.blockId ?? new Uint8Array(0);
2546
+ message.signerBitmap = object.signerBitmap ?? new Uint8Array(0);
2547
+ return message;
2548
+ },
2549
+ };
2550
+ function createBaseBlockFooterFinalCert() {
2551
+ return { slot: 0n, finalAggregate: undefined, notarAggregate: undefined };
2552
+ }
2553
+ export const BlockFooterFinalCert = {
2554
+ encode(message, writer = new BinaryWriter()) {
2555
+ if (message.slot !== 0n) {
2556
+ if (BigInt.asUintN(64, message.slot) !== message.slot) {
2557
+ throw new globalThis.Error("value provided for field message.slot of type uint64 too large");
2558
+ }
2559
+ writer.uint32(8).uint64(message.slot);
2560
+ }
2561
+ if (message.finalAggregate !== undefined) {
2562
+ BlockFooterVotesAggregate.encode(message.finalAggregate, writer.uint32(18).fork()).join();
2563
+ }
2564
+ if (message.notarAggregate !== undefined) {
2565
+ BlockFooterVotesAggregate.encode(message.notarAggregate, writer.uint32(26).fork()).join();
2566
+ }
2567
+ return writer;
2568
+ },
2569
+ decode(input, length) {
2570
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2571
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2572
+ if (previousRecursionDepth >= 100) {
2573
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2574
+ }
2575
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2576
+ try {
2577
+ const end = length === undefined ? reader.len : reader.pos + length;
2578
+ const message = createBaseBlockFooterFinalCert();
2579
+ while (reader.pos < end) {
2580
+ const tag = reader.uint32();
2581
+ switch (tag >>> 3) {
2582
+ case 1: {
2583
+ if (tag !== 8) {
2584
+ break;
2585
+ }
2586
+ message.slot = reader.uint64();
2587
+ continue;
2588
+ }
2589
+ case 2: {
2590
+ if (tag !== 18) {
2591
+ break;
2592
+ }
2593
+ message.finalAggregate = BlockFooterVotesAggregate.decode(reader, reader.uint32());
2594
+ continue;
2595
+ }
2596
+ case 3: {
2597
+ if (tag !== 26) {
2598
+ break;
2599
+ }
2600
+ message.notarAggregate = BlockFooterVotesAggregate.decode(reader, reader.uint32());
2601
+ continue;
2602
+ }
2603
+ }
2604
+ if ((tag & 7) === 4 || tag === 0) {
2605
+ break;
2606
+ }
2607
+ reader.skip(tag & 7);
2608
+ }
2609
+ return message;
2610
+ }
2611
+ finally {
2612
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2613
+ }
2614
+ },
2615
+ fromJSON(object) {
2616
+ return {
2617
+ slot: isSet(object.slot) ? BigInt(object.slot) : 0n,
2618
+ finalAggregate: isSet(object.finalAggregate)
2619
+ ? BlockFooterVotesAggregate.fromJSON(object.finalAggregate)
2620
+ : isSet(object.final_aggregate)
2621
+ ? BlockFooterVotesAggregate.fromJSON(object.final_aggregate)
2622
+ : undefined,
2623
+ notarAggregate: isSet(object.notarAggregate)
2624
+ ? BlockFooterVotesAggregate.fromJSON(object.notarAggregate)
2625
+ : isSet(object.notar_aggregate)
2626
+ ? BlockFooterVotesAggregate.fromJSON(object.notar_aggregate)
2627
+ : undefined,
2628
+ };
2629
+ },
2630
+ toJSON(message) {
2631
+ const obj = {};
2632
+ if (message.slot !== 0n) {
2633
+ obj.slot = message.slot.toString();
2634
+ }
2635
+ if (message.finalAggregate !== undefined) {
2636
+ obj.finalAggregate = BlockFooterVotesAggregate.toJSON(message.finalAggregate);
2637
+ }
2638
+ if (message.notarAggregate !== undefined) {
2639
+ obj.notarAggregate = BlockFooterVotesAggregate.toJSON(message.notarAggregate);
2640
+ }
2641
+ return obj;
2642
+ },
2643
+ create(base) {
2644
+ return BlockFooterFinalCert.fromPartial(base ?? {});
2645
+ },
2646
+ fromPartial(object) {
2647
+ const message = createBaseBlockFooterFinalCert();
2648
+ message.slot = (object.slot !== undefined && object.slot !== null) ? BigInt(object.slot) : 0n;
2649
+ message.finalAggregate = (object.finalAggregate !== undefined && object.finalAggregate !== null)
2650
+ ? BlockFooterVotesAggregate.fromPartial(object.finalAggregate)
2651
+ : undefined;
2652
+ message.notarAggregate = (object.notarAggregate !== undefined && object.notarAggregate !== null)
2653
+ ? BlockFooterVotesAggregate.fromPartial(object.notarAggregate)
2654
+ : undefined;
2655
+ return message;
2656
+ },
2657
+ };
2658
+ function createBaseBlockFooterSkipRewardCert() {
2659
+ return { slot: 0n, aggregate: undefined };
2660
+ }
2661
+ export const BlockFooterSkipRewardCert = {
2662
+ encode(message, writer = new BinaryWriter()) {
2663
+ if (message.slot !== 0n) {
2664
+ if (BigInt.asUintN(64, message.slot) !== message.slot) {
2665
+ throw new globalThis.Error("value provided for field message.slot of type uint64 too large");
2666
+ }
2667
+ writer.uint32(8).uint64(message.slot);
2668
+ }
2669
+ if (message.aggregate !== undefined) {
2670
+ BlockFooterVotesAggregate.encode(message.aggregate, writer.uint32(18).fork()).join();
2671
+ }
2672
+ return writer;
2673
+ },
2674
+ decode(input, length) {
2675
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2676
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2677
+ if (previousRecursionDepth >= 100) {
2678
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2679
+ }
2680
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2681
+ try {
2682
+ const end = length === undefined ? reader.len : reader.pos + length;
2683
+ const message = createBaseBlockFooterSkipRewardCert();
2684
+ while (reader.pos < end) {
2685
+ const tag = reader.uint32();
2686
+ switch (tag >>> 3) {
2687
+ case 1: {
2688
+ if (tag !== 8) {
2689
+ break;
2690
+ }
2691
+ message.slot = reader.uint64();
2692
+ continue;
2693
+ }
2694
+ case 2: {
2695
+ if (tag !== 18) {
2696
+ break;
2697
+ }
2698
+ message.aggregate = BlockFooterVotesAggregate.decode(reader, reader.uint32());
2699
+ continue;
2700
+ }
2701
+ }
2702
+ if ((tag & 7) === 4 || tag === 0) {
2703
+ break;
2704
+ }
2705
+ reader.skip(tag & 7);
2706
+ }
2707
+ return message;
2708
+ }
2709
+ finally {
2710
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2711
+ }
2712
+ },
2713
+ fromJSON(object) {
2714
+ return {
2715
+ slot: isSet(object.slot) ? BigInt(object.slot) : 0n,
2716
+ aggregate: isSet(object.aggregate) ? BlockFooterVotesAggregate.fromJSON(object.aggregate) : undefined,
2717
+ };
2718
+ },
2719
+ toJSON(message) {
2720
+ const obj = {};
2721
+ if (message.slot !== 0n) {
2722
+ obj.slot = message.slot.toString();
2723
+ }
2724
+ if (message.aggregate !== undefined) {
2725
+ obj.aggregate = BlockFooterVotesAggregate.toJSON(message.aggregate);
2726
+ }
2727
+ return obj;
2728
+ },
2729
+ create(base) {
2730
+ return BlockFooterSkipRewardCert.fromPartial(base ?? {});
2731
+ },
2732
+ fromPartial(object) {
2733
+ const message = createBaseBlockFooterSkipRewardCert();
2734
+ message.slot = (object.slot !== undefined && object.slot !== null) ? BigInt(object.slot) : 0n;
2735
+ message.aggregate = (object.aggregate !== undefined && object.aggregate !== null)
2736
+ ? BlockFooterVotesAggregate.fromPartial(object.aggregate)
2737
+ : undefined;
2738
+ return message;
2739
+ },
2740
+ };
2741
+ function createBaseBlockFooterNotarRewardCert() {
2742
+ return { slot: 0n, aggregate: undefined };
2743
+ }
2744
+ export const BlockFooterNotarRewardCert = {
2745
+ encode(message, writer = new BinaryWriter()) {
2746
+ if (message.slot !== 0n) {
2747
+ if (BigInt.asUintN(64, message.slot) !== message.slot) {
2748
+ throw new globalThis.Error("value provided for field message.slot of type uint64 too large");
2749
+ }
2750
+ writer.uint32(8).uint64(message.slot);
2751
+ }
2752
+ if (message.aggregate !== undefined) {
2753
+ BlockFooterVotesAggregate.encode(message.aggregate, writer.uint32(18).fork()).join();
2754
+ }
2755
+ return writer;
2756
+ },
2757
+ decode(input, length) {
2758
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2759
+ const previousRecursionDepth = reader.__tsProtoDecodeDepth ?? 0;
2760
+ if (previousRecursionDepth >= 100) {
2761
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2762
+ }
2763
+ reader.__tsProtoDecodeDepth = previousRecursionDepth + 1;
2764
+ try {
2765
+ const end = length === undefined ? reader.len : reader.pos + length;
2766
+ const message = createBaseBlockFooterNotarRewardCert();
2767
+ while (reader.pos < end) {
2768
+ const tag = reader.uint32();
2769
+ switch (tag >>> 3) {
2770
+ case 1: {
2771
+ if (tag !== 8) {
2772
+ break;
2773
+ }
2774
+ message.slot = reader.uint64();
2775
+ continue;
2776
+ }
2777
+ case 2: {
2778
+ if (tag !== 18) {
2779
+ break;
2780
+ }
2781
+ message.aggregate = BlockFooterVotesAggregate.decode(reader, reader.uint32());
2782
+ continue;
2783
+ }
2784
+ }
2785
+ if ((tag & 7) === 4 || tag === 0) {
2786
+ break;
2787
+ }
2788
+ reader.skip(tag & 7);
2789
+ }
2790
+ return message;
2791
+ }
2792
+ finally {
2793
+ reader.__tsProtoDecodeDepth = previousRecursionDepth;
2794
+ }
2795
+ },
2796
+ fromJSON(object) {
2797
+ return {
2798
+ slot: isSet(object.slot) ? BigInt(object.slot) : 0n,
2799
+ aggregate: isSet(object.aggregate) ? BlockFooterVotesAggregate.fromJSON(object.aggregate) : undefined,
2800
+ };
2801
+ },
2802
+ toJSON(message) {
2803
+ const obj = {};
2804
+ if (message.slot !== 0n) {
2805
+ obj.slot = message.slot.toString();
2806
+ }
2807
+ if (message.aggregate !== undefined) {
2808
+ obj.aggregate = BlockFooterVotesAggregate.toJSON(message.aggregate);
2809
+ }
2810
+ return obj;
2811
+ },
2812
+ create(base) {
2813
+ return BlockFooterNotarRewardCert.fromPartial(base ?? {});
2814
+ },
2815
+ fromPartial(object) {
2816
+ const message = createBaseBlockFooterNotarRewardCert();
2817
+ message.slot = (object.slot !== undefined && object.slot !== null) ? BigInt(object.slot) : 0n;
2818
+ message.aggregate = (object.aggregate !== undefined && object.aggregate !== null)
2819
+ ? BlockFooterVotesAggregate.fromPartial(object.aggregate)
2820
+ : undefined;
2101
2821
  return message;
2102
2822
  },
2103
2823
  };