decentralcardgame-cardchain-client-ts 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/DecentralCardGame.cardchain.cardchain/module.js +311 -309
  2. package/DecentralCardGame.cardchain.cardchain/module.ts +469 -467
  3. package/DecentralCardGame.cardchain.cardchain/registry.js +58 -58
  4. package/DecentralCardGame.cardchain.cardchain/registry.ts +58 -58
  5. package/DecentralCardGame.cardchain.cardchain/rest.ts +3 -0
  6. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.js +41 -0
  7. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.ts +51 -0
  8. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/genesis.js +14 -1
  9. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/genesis.ts +16 -2
  10. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.js +10 -0
  11. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.ts +11 -0
  12. package/DecentralCardGame.cardchain.cardchain/types.js +2 -1
  13. package/DecentralCardGame.cardchain.cardchain/types.ts +2 -0
  14. package/client.js +1 -2
  15. package/package.json +1 -1
  16. package/DecentralCardGame.cardchain.cardchain/types/cardchain/card.js +0 -491
  17. package/DecentralCardGame.cardchain.cardchain/types/cardchain/card.ts +0 -556
  18. package/DecentralCardGame.cardchain.cardchain/types/cardchain/collection.js +0 -365
  19. package/DecentralCardGame.cardchain.cardchain/types/cardchain/collection.ts +0 -416
  20. package/DecentralCardGame.cardchain.cardchain/types/cardchain/collection_proposal.js +0 -93
  21. package/DecentralCardGame.cardchain.cardchain/types/cardchain/collection_proposal.ts +0 -124
  22. package/DecentralCardGame.cardchain.cardchain/types/cardchain/copyright_proposal.js +0 -102
  23. package/DecentralCardGame.cardchain.cardchain/types/cardchain/copyright_proposal.ts +0 -134
  24. package/DecentralCardGame.cardchain.cardchain/types/cardchain/council.js +0 -350
  25. package/DecentralCardGame.cardchain.cardchain/types/cardchain/council.ts +0 -409
  26. package/DecentralCardGame.cardchain.cardchain/types/cardchain/genesis.js +0 -241
  27. package/DecentralCardGame.cardchain.cardchain/types/cardchain/genesis.ts +0 -267
  28. package/DecentralCardGame.cardchain.cardchain/types/cardchain/image.js +0 -88
  29. package/DecentralCardGame.cardchain.cardchain/types/cardchain/image.ts +0 -115
  30. package/DecentralCardGame.cardchain.cardchain/types/cardchain/match.js +0 -210
  31. package/DecentralCardGame.cardchain.cardchain/types/cardchain/match.ts +0 -255
  32. package/DecentralCardGame.cardchain.cardchain/types/cardchain/match_reporter_proposal.js +0 -67
  33. package/DecentralCardGame.cardchain.cardchain/types/cardchain/match_reporter_proposal.ts +0 -92
  34. package/DecentralCardGame.cardchain.cardchain/types/cardchain/num.js +0 -73
  35. package/DecentralCardGame.cardchain.cardchain/types/cardchain/num.ts +0 -102
  36. package/DecentralCardGame.cardchain.cardchain/types/cardchain/params.js +0 -275
  37. package/DecentralCardGame.cardchain.cardchain/types/cardchain/params.ts +0 -324
  38. package/DecentralCardGame.cardchain.cardchain/types/cardchain/query.js +0 -1970
  39. package/DecentralCardGame.cardchain.cardchain/types/cardchain/query.ts +0 -2366
  40. package/DecentralCardGame.cardchain.cardchain/types/cardchain/running_average.js +0 -85
  41. package/DecentralCardGame.cardchain.cardchain/types/cardchain/running_average.ts +0 -111
  42. package/DecentralCardGame.cardchain.cardchain/types/cardchain/sell_offer.js +0 -148
  43. package/DecentralCardGame.cardchain.cardchain/types/cardchain/sell_offer.ts +0 -183
  44. package/DecentralCardGame.cardchain.cardchain/types/cardchain/server.js +0 -93
  45. package/DecentralCardGame.cardchain.cardchain/types/cardchain/server.ts +0 -124
  46. package/DecentralCardGame.cardchain.cardchain/types/cardchain/tx.js +0 -4137
  47. package/DecentralCardGame.cardchain.cardchain/types/cardchain/tx.ts +0 -5125
  48. package/DecentralCardGame.cardchain.cardchain/types/cardchain/user.js +0 -496
  49. package/DecentralCardGame.cardchain.cardchain/types/cardchain/user.ts +0 -556
  50. package/DecentralCardGame.cardchain.cardchain/types/cardchain/vote_right.js +0 -84
  51. package/DecentralCardGame.cardchain.cardchain/types/cardchain/vote_right.ts +0 -114
  52. package/DecentralCardGame.cardchain.cardchain/types/cardchain/voting_result.js +0 -127
  53. package/DecentralCardGame.cardchain.cardchain/types/cardchain/voting_result.ts +0 -161
  54. package/DecentralCardGame.cardchain.cardchain/types/cardchain/voting_results.js +0 -148
  55. package/DecentralCardGame.cardchain.cardchain/types/cardchain/voting_results.ts +0 -182
  56. package/cosmos.authz.v1beta1/types/cosmos/base/abci/v1beta1/abci.js +0 -773
  57. package/cosmos.authz.v1beta1/types/cosmos/base/abci/v1beta1/abci.ts +0 -989
  58. package/cosmos.authz.v1beta1/types/google/protobuf/duration.js +0 -84
  59. package/cosmos.authz.v1beta1/types/google/protobuf/duration.ts +0 -187
  60. package/cosmos.authz.v1beta1/types/tendermint/abci/types.js +0 -3447
  61. package/cosmos.authz.v1beta1/types/tendermint/abci/types.ts +0 -4107
  62. package/cosmos.authz.v1beta1/types/tendermint/crypto/keys.js +0 -100
  63. package/cosmos.authz.v1beta1/types/tendermint/crypto/keys.ts +0 -129
  64. package/cosmos.authz.v1beta1/types/tendermint/crypto/proof.js +0 -356
  65. package/cosmos.authz.v1beta1/types/tendermint/crypto/proof.ts +0 -439
  66. package/cosmos.authz.v1beta1/types/tendermint/types/params.js +0 -378
  67. package/cosmos.authz.v1beta1/types/tendermint/types/params.ts +0 -514
  68. package/cosmos.authz.v1beta1/types/tendermint/types/types.js +0 -1207
  69. package/cosmos.authz.v1beta1/types/tendermint/types/types.ts +0 -1452
  70. package/cosmos.authz.v1beta1/types/tendermint/types/validator.js +0 -254
  71. package/cosmos.authz.v1beta1/types/tendermint/types/validator.ts +0 -308
  72. package/cosmos.authz.v1beta1/types/tendermint/version/types.js +0 -133
  73. package/cosmos.authz.v1beta1/types/tendermint/version/types.ts +0 -184
  74. package/ibc.core.connection.v1/types/confio/proofs.js +0 -1120
  75. package/ibc.core.connection.v1/types/confio/proofs.ts +0 -1402
@@ -1,1207 +0,0 @@
1
- /* eslint-disable */
2
- import Long from "long";
3
- import _m0 from "protobufjs/minimal";
4
- import { Timestamp } from "../../google/protobuf/timestamp";
5
- import { Proof } from "../crypto/proof";
6
- import { Consensus } from "../version/types";
7
- import { ValidatorSet } from "./validator";
8
- export const protobufPackage = "tendermint.types";
9
- /** BlockIdFlag indicates which BlcokID the signature is for */
10
- export var BlockIDFlag;
11
- (function (BlockIDFlag) {
12
- BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_UNKNOWN"] = 0] = "BLOCK_ID_FLAG_UNKNOWN";
13
- BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_ABSENT"] = 1] = "BLOCK_ID_FLAG_ABSENT";
14
- BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_COMMIT"] = 2] = "BLOCK_ID_FLAG_COMMIT";
15
- BlockIDFlag[BlockIDFlag["BLOCK_ID_FLAG_NIL"] = 3] = "BLOCK_ID_FLAG_NIL";
16
- BlockIDFlag[BlockIDFlag["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
17
- })(BlockIDFlag || (BlockIDFlag = {}));
18
- export function blockIDFlagFromJSON(object) {
19
- switch (object) {
20
- case 0:
21
- case "BLOCK_ID_FLAG_UNKNOWN":
22
- return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN;
23
- case 1:
24
- case "BLOCK_ID_FLAG_ABSENT":
25
- return BlockIDFlag.BLOCK_ID_FLAG_ABSENT;
26
- case 2:
27
- case "BLOCK_ID_FLAG_COMMIT":
28
- return BlockIDFlag.BLOCK_ID_FLAG_COMMIT;
29
- case 3:
30
- case "BLOCK_ID_FLAG_NIL":
31
- return BlockIDFlag.BLOCK_ID_FLAG_NIL;
32
- case -1:
33
- case "UNRECOGNIZED":
34
- default:
35
- return BlockIDFlag.UNRECOGNIZED;
36
- }
37
- }
38
- export function blockIDFlagToJSON(object) {
39
- switch (object) {
40
- case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN:
41
- return "BLOCK_ID_FLAG_UNKNOWN";
42
- case BlockIDFlag.BLOCK_ID_FLAG_ABSENT:
43
- return "BLOCK_ID_FLAG_ABSENT";
44
- case BlockIDFlag.BLOCK_ID_FLAG_COMMIT:
45
- return "BLOCK_ID_FLAG_COMMIT";
46
- case BlockIDFlag.BLOCK_ID_FLAG_NIL:
47
- return "BLOCK_ID_FLAG_NIL";
48
- case BlockIDFlag.UNRECOGNIZED:
49
- default:
50
- return "UNRECOGNIZED";
51
- }
52
- }
53
- /** SignedMsgType is a type of signed message in the consensus. */
54
- export var SignedMsgType;
55
- (function (SignedMsgType) {
56
- SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_UNKNOWN"] = 0] = "SIGNED_MSG_TYPE_UNKNOWN";
57
- /** SIGNED_MSG_TYPE_PREVOTE - Votes */
58
- SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PREVOTE"] = 1] = "SIGNED_MSG_TYPE_PREVOTE";
59
- SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PRECOMMIT"] = 2] = "SIGNED_MSG_TYPE_PRECOMMIT";
60
- /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */
61
- SignedMsgType[SignedMsgType["SIGNED_MSG_TYPE_PROPOSAL"] = 32] = "SIGNED_MSG_TYPE_PROPOSAL";
62
- SignedMsgType[SignedMsgType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
63
- })(SignedMsgType || (SignedMsgType = {}));
64
- export function signedMsgTypeFromJSON(object) {
65
- switch (object) {
66
- case 0:
67
- case "SIGNED_MSG_TYPE_UNKNOWN":
68
- return SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN;
69
- case 1:
70
- case "SIGNED_MSG_TYPE_PREVOTE":
71
- return SignedMsgType.SIGNED_MSG_TYPE_PREVOTE;
72
- case 2:
73
- case "SIGNED_MSG_TYPE_PRECOMMIT":
74
- return SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT;
75
- case 32:
76
- case "SIGNED_MSG_TYPE_PROPOSAL":
77
- return SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL;
78
- case -1:
79
- case "UNRECOGNIZED":
80
- default:
81
- return SignedMsgType.UNRECOGNIZED;
82
- }
83
- }
84
- export function signedMsgTypeToJSON(object) {
85
- switch (object) {
86
- case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN:
87
- return "SIGNED_MSG_TYPE_UNKNOWN";
88
- case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE:
89
- return "SIGNED_MSG_TYPE_PREVOTE";
90
- case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT:
91
- return "SIGNED_MSG_TYPE_PRECOMMIT";
92
- case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL:
93
- return "SIGNED_MSG_TYPE_PROPOSAL";
94
- case SignedMsgType.UNRECOGNIZED:
95
- default:
96
- return "UNRECOGNIZED";
97
- }
98
- }
99
- function createBasePartSetHeader() {
100
- return { total: 0, hash: new Uint8Array() };
101
- }
102
- export const PartSetHeader = {
103
- encode(message, writer = _m0.Writer.create()) {
104
- if (message.total !== 0) {
105
- writer.uint32(8).uint32(message.total);
106
- }
107
- if (message.hash.length !== 0) {
108
- writer.uint32(18).bytes(message.hash);
109
- }
110
- return writer;
111
- },
112
- decode(input, length) {
113
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
114
- let end = length === undefined ? reader.len : reader.pos + length;
115
- const message = createBasePartSetHeader();
116
- while (reader.pos < end) {
117
- const tag = reader.uint32();
118
- switch (tag >>> 3) {
119
- case 1:
120
- message.total = reader.uint32();
121
- break;
122
- case 2:
123
- message.hash = reader.bytes();
124
- break;
125
- default:
126
- reader.skipType(tag & 7);
127
- break;
128
- }
129
- }
130
- return message;
131
- },
132
- fromJSON(object) {
133
- return {
134
- total: isSet(object.total) ? Number(object.total) : 0,
135
- hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(),
136
- };
137
- },
138
- toJSON(message) {
139
- const obj = {};
140
- message.total !== undefined && (obj.total = Math.round(message.total));
141
- message.hash !== undefined
142
- && (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array()));
143
- return obj;
144
- },
145
- fromPartial(object) {
146
- const message = createBasePartSetHeader();
147
- message.total = object.total ?? 0;
148
- message.hash = object.hash ?? new Uint8Array();
149
- return message;
150
- },
151
- };
152
- function createBasePart() {
153
- return { index: 0, bytes: new Uint8Array(), proof: undefined };
154
- }
155
- export const Part = {
156
- encode(message, writer = _m0.Writer.create()) {
157
- if (message.index !== 0) {
158
- writer.uint32(8).uint32(message.index);
159
- }
160
- if (message.bytes.length !== 0) {
161
- writer.uint32(18).bytes(message.bytes);
162
- }
163
- if (message.proof !== undefined) {
164
- Proof.encode(message.proof, writer.uint32(26).fork()).ldelim();
165
- }
166
- return writer;
167
- },
168
- decode(input, length) {
169
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
170
- let end = length === undefined ? reader.len : reader.pos + length;
171
- const message = createBasePart();
172
- while (reader.pos < end) {
173
- const tag = reader.uint32();
174
- switch (tag >>> 3) {
175
- case 1:
176
- message.index = reader.uint32();
177
- break;
178
- case 2:
179
- message.bytes = reader.bytes();
180
- break;
181
- case 3:
182
- message.proof = Proof.decode(reader, reader.uint32());
183
- break;
184
- default:
185
- reader.skipType(tag & 7);
186
- break;
187
- }
188
- }
189
- return message;
190
- },
191
- fromJSON(object) {
192
- return {
193
- index: isSet(object.index) ? Number(object.index) : 0,
194
- bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(),
195
- proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined,
196
- };
197
- },
198
- toJSON(message) {
199
- const obj = {};
200
- message.index !== undefined && (obj.index = Math.round(message.index));
201
- message.bytes !== undefined
202
- && (obj.bytes = base64FromBytes(message.bytes !== undefined ? message.bytes : new Uint8Array()));
203
- message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined);
204
- return obj;
205
- },
206
- fromPartial(object) {
207
- const message = createBasePart();
208
- message.index = object.index ?? 0;
209
- message.bytes = object.bytes ?? new Uint8Array();
210
- message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined;
211
- return message;
212
- },
213
- };
214
- function createBaseBlockID() {
215
- return { hash: new Uint8Array(), partSetHeader: undefined };
216
- }
217
- export const BlockID = {
218
- encode(message, writer = _m0.Writer.create()) {
219
- if (message.hash.length !== 0) {
220
- writer.uint32(10).bytes(message.hash);
221
- }
222
- if (message.partSetHeader !== undefined) {
223
- PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim();
224
- }
225
- return writer;
226
- },
227
- decode(input, length) {
228
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
229
- let end = length === undefined ? reader.len : reader.pos + length;
230
- const message = createBaseBlockID();
231
- while (reader.pos < end) {
232
- const tag = reader.uint32();
233
- switch (tag >>> 3) {
234
- case 1:
235
- message.hash = reader.bytes();
236
- break;
237
- case 2:
238
- message.partSetHeader = PartSetHeader.decode(reader, reader.uint32());
239
- break;
240
- default:
241
- reader.skipType(tag & 7);
242
- break;
243
- }
244
- }
245
- return message;
246
- },
247
- fromJSON(object) {
248
- return {
249
- hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(),
250
- partSetHeader: isSet(object.partSetHeader) ? PartSetHeader.fromJSON(object.partSetHeader) : undefined,
251
- };
252
- },
253
- toJSON(message) {
254
- const obj = {};
255
- message.hash !== undefined
256
- && (obj.hash = base64FromBytes(message.hash !== undefined ? message.hash : new Uint8Array()));
257
- message.partSetHeader !== undefined
258
- && (obj.partSetHeader = message.partSetHeader ? PartSetHeader.toJSON(message.partSetHeader) : undefined);
259
- return obj;
260
- },
261
- fromPartial(object) {
262
- const message = createBaseBlockID();
263
- message.hash = object.hash ?? new Uint8Array();
264
- message.partSetHeader = (object.partSetHeader !== undefined && object.partSetHeader !== null)
265
- ? PartSetHeader.fromPartial(object.partSetHeader)
266
- : undefined;
267
- return message;
268
- },
269
- };
270
- function createBaseHeader() {
271
- return {
272
- version: undefined,
273
- chainId: "",
274
- height: 0,
275
- time: undefined,
276
- lastBlockId: undefined,
277
- lastCommitHash: new Uint8Array(),
278
- dataHash: new Uint8Array(),
279
- validatorsHash: new Uint8Array(),
280
- nextValidatorsHash: new Uint8Array(),
281
- consensusHash: new Uint8Array(),
282
- appHash: new Uint8Array(),
283
- lastResultsHash: new Uint8Array(),
284
- evidenceHash: new Uint8Array(),
285
- proposerAddress: new Uint8Array(),
286
- };
287
- }
288
- export const Header = {
289
- encode(message, writer = _m0.Writer.create()) {
290
- if (message.version !== undefined) {
291
- Consensus.encode(message.version, writer.uint32(10).fork()).ldelim();
292
- }
293
- if (message.chainId !== "") {
294
- writer.uint32(18).string(message.chainId);
295
- }
296
- if (message.height !== 0) {
297
- writer.uint32(24).int64(message.height);
298
- }
299
- if (message.time !== undefined) {
300
- Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim();
301
- }
302
- if (message.lastBlockId !== undefined) {
303
- BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim();
304
- }
305
- if (message.lastCommitHash.length !== 0) {
306
- writer.uint32(50).bytes(message.lastCommitHash);
307
- }
308
- if (message.dataHash.length !== 0) {
309
- writer.uint32(58).bytes(message.dataHash);
310
- }
311
- if (message.validatorsHash.length !== 0) {
312
- writer.uint32(66).bytes(message.validatorsHash);
313
- }
314
- if (message.nextValidatorsHash.length !== 0) {
315
- writer.uint32(74).bytes(message.nextValidatorsHash);
316
- }
317
- if (message.consensusHash.length !== 0) {
318
- writer.uint32(82).bytes(message.consensusHash);
319
- }
320
- if (message.appHash.length !== 0) {
321
- writer.uint32(90).bytes(message.appHash);
322
- }
323
- if (message.lastResultsHash.length !== 0) {
324
- writer.uint32(98).bytes(message.lastResultsHash);
325
- }
326
- if (message.evidenceHash.length !== 0) {
327
- writer.uint32(106).bytes(message.evidenceHash);
328
- }
329
- if (message.proposerAddress.length !== 0) {
330
- writer.uint32(114).bytes(message.proposerAddress);
331
- }
332
- return writer;
333
- },
334
- decode(input, length) {
335
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
336
- let end = length === undefined ? reader.len : reader.pos + length;
337
- const message = createBaseHeader();
338
- while (reader.pos < end) {
339
- const tag = reader.uint32();
340
- switch (tag >>> 3) {
341
- case 1:
342
- message.version = Consensus.decode(reader, reader.uint32());
343
- break;
344
- case 2:
345
- message.chainId = reader.string();
346
- break;
347
- case 3:
348
- message.height = longToNumber(reader.int64());
349
- break;
350
- case 4:
351
- message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
352
- break;
353
- case 5:
354
- message.lastBlockId = BlockID.decode(reader, reader.uint32());
355
- break;
356
- case 6:
357
- message.lastCommitHash = reader.bytes();
358
- break;
359
- case 7:
360
- message.dataHash = reader.bytes();
361
- break;
362
- case 8:
363
- message.validatorsHash = reader.bytes();
364
- break;
365
- case 9:
366
- message.nextValidatorsHash = reader.bytes();
367
- break;
368
- case 10:
369
- message.consensusHash = reader.bytes();
370
- break;
371
- case 11:
372
- message.appHash = reader.bytes();
373
- break;
374
- case 12:
375
- message.lastResultsHash = reader.bytes();
376
- break;
377
- case 13:
378
- message.evidenceHash = reader.bytes();
379
- break;
380
- case 14:
381
- message.proposerAddress = reader.bytes();
382
- break;
383
- default:
384
- reader.skipType(tag & 7);
385
- break;
386
- }
387
- }
388
- return message;
389
- },
390
- fromJSON(object) {
391
- return {
392
- version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined,
393
- chainId: isSet(object.chainId) ? String(object.chainId) : "",
394
- height: isSet(object.height) ? Number(object.height) : 0,
395
- time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined,
396
- lastBlockId: isSet(object.lastBlockId) ? BlockID.fromJSON(object.lastBlockId) : undefined,
397
- lastCommitHash: isSet(object.lastCommitHash) ? bytesFromBase64(object.lastCommitHash) : new Uint8Array(),
398
- dataHash: isSet(object.dataHash) ? bytesFromBase64(object.dataHash) : new Uint8Array(),
399
- validatorsHash: isSet(object.validatorsHash) ? bytesFromBase64(object.validatorsHash) : new Uint8Array(),
400
- nextValidatorsHash: isSet(object.nextValidatorsHash)
401
- ? bytesFromBase64(object.nextValidatorsHash)
402
- : new Uint8Array(),
403
- consensusHash: isSet(object.consensusHash) ? bytesFromBase64(object.consensusHash) : new Uint8Array(),
404
- appHash: isSet(object.appHash) ? bytesFromBase64(object.appHash) : new Uint8Array(),
405
- lastResultsHash: isSet(object.lastResultsHash) ? bytesFromBase64(object.lastResultsHash) : new Uint8Array(),
406
- evidenceHash: isSet(object.evidenceHash) ? bytesFromBase64(object.evidenceHash) : new Uint8Array(),
407
- proposerAddress: isSet(object.proposerAddress) ? bytesFromBase64(object.proposerAddress) : new Uint8Array(),
408
- };
409
- },
410
- toJSON(message) {
411
- const obj = {};
412
- message.version !== undefined && (obj.version = message.version ? Consensus.toJSON(message.version) : undefined);
413
- message.chainId !== undefined && (obj.chainId = message.chainId);
414
- message.height !== undefined && (obj.height = Math.round(message.height));
415
- message.time !== undefined && (obj.time = message.time.toISOString());
416
- message.lastBlockId !== undefined
417
- && (obj.lastBlockId = message.lastBlockId ? BlockID.toJSON(message.lastBlockId) : undefined);
418
- message.lastCommitHash !== undefined
419
- && (obj.lastCommitHash = base64FromBytes(message.lastCommitHash !== undefined ? message.lastCommitHash : new Uint8Array()));
420
- message.dataHash !== undefined
421
- && (obj.dataHash = base64FromBytes(message.dataHash !== undefined ? message.dataHash : new Uint8Array()));
422
- message.validatorsHash !== undefined
423
- && (obj.validatorsHash = base64FromBytes(message.validatorsHash !== undefined ? message.validatorsHash : new Uint8Array()));
424
- message.nextValidatorsHash !== undefined
425
- && (obj.nextValidatorsHash = base64FromBytes(message.nextValidatorsHash !== undefined ? message.nextValidatorsHash : new Uint8Array()));
426
- message.consensusHash !== undefined
427
- && (obj.consensusHash = base64FromBytes(message.consensusHash !== undefined ? message.consensusHash : new Uint8Array()));
428
- message.appHash !== undefined
429
- && (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array()));
430
- message.lastResultsHash !== undefined
431
- && (obj.lastResultsHash = base64FromBytes(message.lastResultsHash !== undefined ? message.lastResultsHash : new Uint8Array()));
432
- message.evidenceHash !== undefined
433
- && (obj.evidenceHash = base64FromBytes(message.evidenceHash !== undefined ? message.evidenceHash : new Uint8Array()));
434
- message.proposerAddress !== undefined
435
- && (obj.proposerAddress = base64FromBytes(message.proposerAddress !== undefined ? message.proposerAddress : new Uint8Array()));
436
- return obj;
437
- },
438
- fromPartial(object) {
439
- const message = createBaseHeader();
440
- message.version = (object.version !== undefined && object.version !== null)
441
- ? Consensus.fromPartial(object.version)
442
- : undefined;
443
- message.chainId = object.chainId ?? "";
444
- message.height = object.height ?? 0;
445
- message.time = object.time ?? undefined;
446
- message.lastBlockId = (object.lastBlockId !== undefined && object.lastBlockId !== null)
447
- ? BlockID.fromPartial(object.lastBlockId)
448
- : undefined;
449
- message.lastCommitHash = object.lastCommitHash ?? new Uint8Array();
450
- message.dataHash = object.dataHash ?? new Uint8Array();
451
- message.validatorsHash = object.validatorsHash ?? new Uint8Array();
452
- message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array();
453
- message.consensusHash = object.consensusHash ?? new Uint8Array();
454
- message.appHash = object.appHash ?? new Uint8Array();
455
- message.lastResultsHash = object.lastResultsHash ?? new Uint8Array();
456
- message.evidenceHash = object.evidenceHash ?? new Uint8Array();
457
- message.proposerAddress = object.proposerAddress ?? new Uint8Array();
458
- return message;
459
- },
460
- };
461
- function createBaseData() {
462
- return { txs: [] };
463
- }
464
- export const Data = {
465
- encode(message, writer = _m0.Writer.create()) {
466
- for (const v of message.txs) {
467
- writer.uint32(10).bytes(v);
468
- }
469
- return writer;
470
- },
471
- decode(input, length) {
472
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
473
- let end = length === undefined ? reader.len : reader.pos + length;
474
- const message = createBaseData();
475
- while (reader.pos < end) {
476
- const tag = reader.uint32();
477
- switch (tag >>> 3) {
478
- case 1:
479
- message.txs.push(reader.bytes());
480
- break;
481
- default:
482
- reader.skipType(tag & 7);
483
- break;
484
- }
485
- }
486
- return message;
487
- },
488
- fromJSON(object) {
489
- return { txs: Array.isArray(object?.txs) ? object.txs.map((e) => bytesFromBase64(e)) : [] };
490
- },
491
- toJSON(message) {
492
- const obj = {};
493
- if (message.txs) {
494
- obj.txs = message.txs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array()));
495
- }
496
- else {
497
- obj.txs = [];
498
- }
499
- return obj;
500
- },
501
- fromPartial(object) {
502
- const message = createBaseData();
503
- message.txs = object.txs?.map((e) => e) || [];
504
- return message;
505
- },
506
- };
507
- function createBaseVote() {
508
- return {
509
- type: 0,
510
- height: 0,
511
- round: 0,
512
- blockId: undefined,
513
- timestamp: undefined,
514
- validatorAddress: new Uint8Array(),
515
- validatorIndex: 0,
516
- signature: new Uint8Array(),
517
- };
518
- }
519
- export const Vote = {
520
- encode(message, writer = _m0.Writer.create()) {
521
- if (message.type !== 0) {
522
- writer.uint32(8).int32(message.type);
523
- }
524
- if (message.height !== 0) {
525
- writer.uint32(16).int64(message.height);
526
- }
527
- if (message.round !== 0) {
528
- writer.uint32(24).int32(message.round);
529
- }
530
- if (message.blockId !== undefined) {
531
- BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim();
532
- }
533
- if (message.timestamp !== undefined) {
534
- Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim();
535
- }
536
- if (message.validatorAddress.length !== 0) {
537
- writer.uint32(50).bytes(message.validatorAddress);
538
- }
539
- if (message.validatorIndex !== 0) {
540
- writer.uint32(56).int32(message.validatorIndex);
541
- }
542
- if (message.signature.length !== 0) {
543
- writer.uint32(66).bytes(message.signature);
544
- }
545
- return writer;
546
- },
547
- decode(input, length) {
548
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
549
- let end = length === undefined ? reader.len : reader.pos + length;
550
- const message = createBaseVote();
551
- while (reader.pos < end) {
552
- const tag = reader.uint32();
553
- switch (tag >>> 3) {
554
- case 1:
555
- message.type = reader.int32();
556
- break;
557
- case 2:
558
- message.height = longToNumber(reader.int64());
559
- break;
560
- case 3:
561
- message.round = reader.int32();
562
- break;
563
- case 4:
564
- message.blockId = BlockID.decode(reader, reader.uint32());
565
- break;
566
- case 5:
567
- message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
568
- break;
569
- case 6:
570
- message.validatorAddress = reader.bytes();
571
- break;
572
- case 7:
573
- message.validatorIndex = reader.int32();
574
- break;
575
- case 8:
576
- message.signature = reader.bytes();
577
- break;
578
- default:
579
- reader.skipType(tag & 7);
580
- break;
581
- }
582
- }
583
- return message;
584
- },
585
- fromJSON(object) {
586
- return {
587
- type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0,
588
- height: isSet(object.height) ? Number(object.height) : 0,
589
- round: isSet(object.round) ? Number(object.round) : 0,
590
- blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined,
591
- timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
592
- validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(),
593
- validatorIndex: isSet(object.validatorIndex) ? Number(object.validatorIndex) : 0,
594
- signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(),
595
- };
596
- },
597
- toJSON(message) {
598
- const obj = {};
599
- message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type));
600
- message.height !== undefined && (obj.height = Math.round(message.height));
601
- message.round !== undefined && (obj.round = Math.round(message.round));
602
- message.blockId !== undefined && (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined);
603
- message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
604
- message.validatorAddress !== undefined
605
- && (obj.validatorAddress = base64FromBytes(message.validatorAddress !== undefined ? message.validatorAddress : new Uint8Array()));
606
- message.validatorIndex !== undefined && (obj.validatorIndex = Math.round(message.validatorIndex));
607
- message.signature !== undefined
608
- && (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array()));
609
- return obj;
610
- },
611
- fromPartial(object) {
612
- const message = createBaseVote();
613
- message.type = object.type ?? 0;
614
- message.height = object.height ?? 0;
615
- message.round = object.round ?? 0;
616
- message.blockId = (object.blockId !== undefined && object.blockId !== null)
617
- ? BlockID.fromPartial(object.blockId)
618
- : undefined;
619
- message.timestamp = object.timestamp ?? undefined;
620
- message.validatorAddress = object.validatorAddress ?? new Uint8Array();
621
- message.validatorIndex = object.validatorIndex ?? 0;
622
- message.signature = object.signature ?? new Uint8Array();
623
- return message;
624
- },
625
- };
626
- function createBaseCommit() {
627
- return { height: 0, round: 0, blockId: undefined, signatures: [] };
628
- }
629
- export const Commit = {
630
- encode(message, writer = _m0.Writer.create()) {
631
- if (message.height !== 0) {
632
- writer.uint32(8).int64(message.height);
633
- }
634
- if (message.round !== 0) {
635
- writer.uint32(16).int32(message.round);
636
- }
637
- if (message.blockId !== undefined) {
638
- BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim();
639
- }
640
- for (const v of message.signatures) {
641
- CommitSig.encode(v, writer.uint32(34).fork()).ldelim();
642
- }
643
- return writer;
644
- },
645
- decode(input, length) {
646
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
647
- let end = length === undefined ? reader.len : reader.pos + length;
648
- const message = createBaseCommit();
649
- while (reader.pos < end) {
650
- const tag = reader.uint32();
651
- switch (tag >>> 3) {
652
- case 1:
653
- message.height = longToNumber(reader.int64());
654
- break;
655
- case 2:
656
- message.round = reader.int32();
657
- break;
658
- case 3:
659
- message.blockId = BlockID.decode(reader, reader.uint32());
660
- break;
661
- case 4:
662
- message.signatures.push(CommitSig.decode(reader, reader.uint32()));
663
- break;
664
- default:
665
- reader.skipType(tag & 7);
666
- break;
667
- }
668
- }
669
- return message;
670
- },
671
- fromJSON(object) {
672
- return {
673
- height: isSet(object.height) ? Number(object.height) : 0,
674
- round: isSet(object.round) ? Number(object.round) : 0,
675
- blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined,
676
- signatures: Array.isArray(object?.signatures) ? object.signatures.map((e) => CommitSig.fromJSON(e)) : [],
677
- };
678
- },
679
- toJSON(message) {
680
- const obj = {};
681
- message.height !== undefined && (obj.height = Math.round(message.height));
682
- message.round !== undefined && (obj.round = Math.round(message.round));
683
- message.blockId !== undefined && (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined);
684
- if (message.signatures) {
685
- obj.signatures = message.signatures.map((e) => e ? CommitSig.toJSON(e) : undefined);
686
- }
687
- else {
688
- obj.signatures = [];
689
- }
690
- return obj;
691
- },
692
- fromPartial(object) {
693
- const message = createBaseCommit();
694
- message.height = object.height ?? 0;
695
- message.round = object.round ?? 0;
696
- message.blockId = (object.blockId !== undefined && object.blockId !== null)
697
- ? BlockID.fromPartial(object.blockId)
698
- : undefined;
699
- message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || [];
700
- return message;
701
- },
702
- };
703
- function createBaseCommitSig() {
704
- return { blockIdFlag: 0, validatorAddress: new Uint8Array(), timestamp: undefined, signature: new Uint8Array() };
705
- }
706
- export const CommitSig = {
707
- encode(message, writer = _m0.Writer.create()) {
708
- if (message.blockIdFlag !== 0) {
709
- writer.uint32(8).int32(message.blockIdFlag);
710
- }
711
- if (message.validatorAddress.length !== 0) {
712
- writer.uint32(18).bytes(message.validatorAddress);
713
- }
714
- if (message.timestamp !== undefined) {
715
- Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim();
716
- }
717
- if (message.signature.length !== 0) {
718
- writer.uint32(34).bytes(message.signature);
719
- }
720
- return writer;
721
- },
722
- decode(input, length) {
723
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
724
- let end = length === undefined ? reader.len : reader.pos + length;
725
- const message = createBaseCommitSig();
726
- while (reader.pos < end) {
727
- const tag = reader.uint32();
728
- switch (tag >>> 3) {
729
- case 1:
730
- message.blockIdFlag = reader.int32();
731
- break;
732
- case 2:
733
- message.validatorAddress = reader.bytes();
734
- break;
735
- case 3:
736
- message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
737
- break;
738
- case 4:
739
- message.signature = reader.bytes();
740
- break;
741
- default:
742
- reader.skipType(tag & 7);
743
- break;
744
- }
745
- }
746
- return message;
747
- },
748
- fromJSON(object) {
749
- return {
750
- blockIdFlag: isSet(object.blockIdFlag) ? blockIDFlagFromJSON(object.blockIdFlag) : 0,
751
- validatorAddress: isSet(object.validatorAddress) ? bytesFromBase64(object.validatorAddress) : new Uint8Array(),
752
- timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
753
- signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(),
754
- };
755
- },
756
- toJSON(message) {
757
- const obj = {};
758
- message.blockIdFlag !== undefined && (obj.blockIdFlag = blockIDFlagToJSON(message.blockIdFlag));
759
- message.validatorAddress !== undefined
760
- && (obj.validatorAddress = base64FromBytes(message.validatorAddress !== undefined ? message.validatorAddress : new Uint8Array()));
761
- message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
762
- message.signature !== undefined
763
- && (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array()));
764
- return obj;
765
- },
766
- fromPartial(object) {
767
- const message = createBaseCommitSig();
768
- message.blockIdFlag = object.blockIdFlag ?? 0;
769
- message.validatorAddress = object.validatorAddress ?? new Uint8Array();
770
- message.timestamp = object.timestamp ?? undefined;
771
- message.signature = object.signature ?? new Uint8Array();
772
- return message;
773
- },
774
- };
775
- function createBaseProposal() {
776
- return {
777
- type: 0,
778
- height: 0,
779
- round: 0,
780
- polRound: 0,
781
- blockId: undefined,
782
- timestamp: undefined,
783
- signature: new Uint8Array(),
784
- };
785
- }
786
- export const Proposal = {
787
- encode(message, writer = _m0.Writer.create()) {
788
- if (message.type !== 0) {
789
- writer.uint32(8).int32(message.type);
790
- }
791
- if (message.height !== 0) {
792
- writer.uint32(16).int64(message.height);
793
- }
794
- if (message.round !== 0) {
795
- writer.uint32(24).int32(message.round);
796
- }
797
- if (message.polRound !== 0) {
798
- writer.uint32(32).int32(message.polRound);
799
- }
800
- if (message.blockId !== undefined) {
801
- BlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim();
802
- }
803
- if (message.timestamp !== undefined) {
804
- Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).ldelim();
805
- }
806
- if (message.signature.length !== 0) {
807
- writer.uint32(58).bytes(message.signature);
808
- }
809
- return writer;
810
- },
811
- decode(input, length) {
812
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
813
- let end = length === undefined ? reader.len : reader.pos + length;
814
- const message = createBaseProposal();
815
- while (reader.pos < end) {
816
- const tag = reader.uint32();
817
- switch (tag >>> 3) {
818
- case 1:
819
- message.type = reader.int32();
820
- break;
821
- case 2:
822
- message.height = longToNumber(reader.int64());
823
- break;
824
- case 3:
825
- message.round = reader.int32();
826
- break;
827
- case 4:
828
- message.polRound = reader.int32();
829
- break;
830
- case 5:
831
- message.blockId = BlockID.decode(reader, reader.uint32());
832
- break;
833
- case 6:
834
- message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
835
- break;
836
- case 7:
837
- message.signature = reader.bytes();
838
- break;
839
- default:
840
- reader.skipType(tag & 7);
841
- break;
842
- }
843
- }
844
- return message;
845
- },
846
- fromJSON(object) {
847
- return {
848
- type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0,
849
- height: isSet(object.height) ? Number(object.height) : 0,
850
- round: isSet(object.round) ? Number(object.round) : 0,
851
- polRound: isSet(object.polRound) ? Number(object.polRound) : 0,
852
- blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined,
853
- timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
854
- signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(),
855
- };
856
- },
857
- toJSON(message) {
858
- const obj = {};
859
- message.type !== undefined && (obj.type = signedMsgTypeToJSON(message.type));
860
- message.height !== undefined && (obj.height = Math.round(message.height));
861
- message.round !== undefined && (obj.round = Math.round(message.round));
862
- message.polRound !== undefined && (obj.polRound = Math.round(message.polRound));
863
- message.blockId !== undefined && (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined);
864
- message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
865
- message.signature !== undefined
866
- && (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array()));
867
- return obj;
868
- },
869
- fromPartial(object) {
870
- const message = createBaseProposal();
871
- message.type = object.type ?? 0;
872
- message.height = object.height ?? 0;
873
- message.round = object.round ?? 0;
874
- message.polRound = object.polRound ?? 0;
875
- message.blockId = (object.blockId !== undefined && object.blockId !== null)
876
- ? BlockID.fromPartial(object.blockId)
877
- : undefined;
878
- message.timestamp = object.timestamp ?? undefined;
879
- message.signature = object.signature ?? new Uint8Array();
880
- return message;
881
- },
882
- };
883
- function createBaseSignedHeader() {
884
- return { header: undefined, commit: undefined };
885
- }
886
- export const SignedHeader = {
887
- encode(message, writer = _m0.Writer.create()) {
888
- if (message.header !== undefined) {
889
- Header.encode(message.header, writer.uint32(10).fork()).ldelim();
890
- }
891
- if (message.commit !== undefined) {
892
- Commit.encode(message.commit, writer.uint32(18).fork()).ldelim();
893
- }
894
- return writer;
895
- },
896
- decode(input, length) {
897
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
898
- let end = length === undefined ? reader.len : reader.pos + length;
899
- const message = createBaseSignedHeader();
900
- while (reader.pos < end) {
901
- const tag = reader.uint32();
902
- switch (tag >>> 3) {
903
- case 1:
904
- message.header = Header.decode(reader, reader.uint32());
905
- break;
906
- case 2:
907
- message.commit = Commit.decode(reader, reader.uint32());
908
- break;
909
- default:
910
- reader.skipType(tag & 7);
911
- break;
912
- }
913
- }
914
- return message;
915
- },
916
- fromJSON(object) {
917
- return {
918
- header: isSet(object.header) ? Header.fromJSON(object.header) : undefined,
919
- commit: isSet(object.commit) ? Commit.fromJSON(object.commit) : undefined,
920
- };
921
- },
922
- toJSON(message) {
923
- const obj = {};
924
- message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined);
925
- message.commit !== undefined && (obj.commit = message.commit ? Commit.toJSON(message.commit) : undefined);
926
- return obj;
927
- },
928
- fromPartial(object) {
929
- const message = createBaseSignedHeader();
930
- message.header = (object.header !== undefined && object.header !== null)
931
- ? Header.fromPartial(object.header)
932
- : undefined;
933
- message.commit = (object.commit !== undefined && object.commit !== null)
934
- ? Commit.fromPartial(object.commit)
935
- : undefined;
936
- return message;
937
- },
938
- };
939
- function createBaseLightBlock() {
940
- return { signedHeader: undefined, validatorSet: undefined };
941
- }
942
- export const LightBlock = {
943
- encode(message, writer = _m0.Writer.create()) {
944
- if (message.signedHeader !== undefined) {
945
- SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim();
946
- }
947
- if (message.validatorSet !== undefined) {
948
- ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim();
949
- }
950
- return writer;
951
- },
952
- decode(input, length) {
953
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
954
- let end = length === undefined ? reader.len : reader.pos + length;
955
- const message = createBaseLightBlock();
956
- while (reader.pos < end) {
957
- const tag = reader.uint32();
958
- switch (tag >>> 3) {
959
- case 1:
960
- message.signedHeader = SignedHeader.decode(reader, reader.uint32());
961
- break;
962
- case 2:
963
- message.validatorSet = ValidatorSet.decode(reader, reader.uint32());
964
- break;
965
- default:
966
- reader.skipType(tag & 7);
967
- break;
968
- }
969
- }
970
- return message;
971
- },
972
- fromJSON(object) {
973
- return {
974
- signedHeader: isSet(object.signedHeader) ? SignedHeader.fromJSON(object.signedHeader) : undefined,
975
- validatorSet: isSet(object.validatorSet) ? ValidatorSet.fromJSON(object.validatorSet) : undefined,
976
- };
977
- },
978
- toJSON(message) {
979
- const obj = {};
980
- message.signedHeader !== undefined
981
- && (obj.signedHeader = message.signedHeader ? SignedHeader.toJSON(message.signedHeader) : undefined);
982
- message.validatorSet !== undefined
983
- && (obj.validatorSet = message.validatorSet ? ValidatorSet.toJSON(message.validatorSet) : undefined);
984
- return obj;
985
- },
986
- fromPartial(object) {
987
- const message = createBaseLightBlock();
988
- message.signedHeader = (object.signedHeader !== undefined && object.signedHeader !== null)
989
- ? SignedHeader.fromPartial(object.signedHeader)
990
- : undefined;
991
- message.validatorSet = (object.validatorSet !== undefined && object.validatorSet !== null)
992
- ? ValidatorSet.fromPartial(object.validatorSet)
993
- : undefined;
994
- return message;
995
- },
996
- };
997
- function createBaseBlockMeta() {
998
- return { blockId: undefined, blockSize: 0, header: undefined, numTxs: 0 };
999
- }
1000
- export const BlockMeta = {
1001
- encode(message, writer = _m0.Writer.create()) {
1002
- if (message.blockId !== undefined) {
1003
- BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim();
1004
- }
1005
- if (message.blockSize !== 0) {
1006
- writer.uint32(16).int64(message.blockSize);
1007
- }
1008
- if (message.header !== undefined) {
1009
- Header.encode(message.header, writer.uint32(26).fork()).ldelim();
1010
- }
1011
- if (message.numTxs !== 0) {
1012
- writer.uint32(32).int64(message.numTxs);
1013
- }
1014
- return writer;
1015
- },
1016
- decode(input, length) {
1017
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1018
- let end = length === undefined ? reader.len : reader.pos + length;
1019
- const message = createBaseBlockMeta();
1020
- while (reader.pos < end) {
1021
- const tag = reader.uint32();
1022
- switch (tag >>> 3) {
1023
- case 1:
1024
- message.blockId = BlockID.decode(reader, reader.uint32());
1025
- break;
1026
- case 2:
1027
- message.blockSize = longToNumber(reader.int64());
1028
- break;
1029
- case 3:
1030
- message.header = Header.decode(reader, reader.uint32());
1031
- break;
1032
- case 4:
1033
- message.numTxs = longToNumber(reader.int64());
1034
- break;
1035
- default:
1036
- reader.skipType(tag & 7);
1037
- break;
1038
- }
1039
- }
1040
- return message;
1041
- },
1042
- fromJSON(object) {
1043
- return {
1044
- blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined,
1045
- blockSize: isSet(object.blockSize) ? Number(object.blockSize) : 0,
1046
- header: isSet(object.header) ? Header.fromJSON(object.header) : undefined,
1047
- numTxs: isSet(object.numTxs) ? Number(object.numTxs) : 0,
1048
- };
1049
- },
1050
- toJSON(message) {
1051
- const obj = {};
1052
- message.blockId !== undefined && (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined);
1053
- message.blockSize !== undefined && (obj.blockSize = Math.round(message.blockSize));
1054
- message.header !== undefined && (obj.header = message.header ? Header.toJSON(message.header) : undefined);
1055
- message.numTxs !== undefined && (obj.numTxs = Math.round(message.numTxs));
1056
- return obj;
1057
- },
1058
- fromPartial(object) {
1059
- const message = createBaseBlockMeta();
1060
- message.blockId = (object.blockId !== undefined && object.blockId !== null)
1061
- ? BlockID.fromPartial(object.blockId)
1062
- : undefined;
1063
- message.blockSize = object.blockSize ?? 0;
1064
- message.header = (object.header !== undefined && object.header !== null)
1065
- ? Header.fromPartial(object.header)
1066
- : undefined;
1067
- message.numTxs = object.numTxs ?? 0;
1068
- return message;
1069
- },
1070
- };
1071
- function createBaseTxProof() {
1072
- return { rootHash: new Uint8Array(), data: new Uint8Array(), proof: undefined };
1073
- }
1074
- export const TxProof = {
1075
- encode(message, writer = _m0.Writer.create()) {
1076
- if (message.rootHash.length !== 0) {
1077
- writer.uint32(10).bytes(message.rootHash);
1078
- }
1079
- if (message.data.length !== 0) {
1080
- writer.uint32(18).bytes(message.data);
1081
- }
1082
- if (message.proof !== undefined) {
1083
- Proof.encode(message.proof, writer.uint32(26).fork()).ldelim();
1084
- }
1085
- return writer;
1086
- },
1087
- decode(input, length) {
1088
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1089
- let end = length === undefined ? reader.len : reader.pos + length;
1090
- const message = createBaseTxProof();
1091
- while (reader.pos < end) {
1092
- const tag = reader.uint32();
1093
- switch (tag >>> 3) {
1094
- case 1:
1095
- message.rootHash = reader.bytes();
1096
- break;
1097
- case 2:
1098
- message.data = reader.bytes();
1099
- break;
1100
- case 3:
1101
- message.proof = Proof.decode(reader, reader.uint32());
1102
- break;
1103
- default:
1104
- reader.skipType(tag & 7);
1105
- break;
1106
- }
1107
- }
1108
- return message;
1109
- },
1110
- fromJSON(object) {
1111
- return {
1112
- rootHash: isSet(object.rootHash) ? bytesFromBase64(object.rootHash) : new Uint8Array(),
1113
- data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(),
1114
- proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined,
1115
- };
1116
- },
1117
- toJSON(message) {
1118
- const obj = {};
1119
- message.rootHash !== undefined
1120
- && (obj.rootHash = base64FromBytes(message.rootHash !== undefined ? message.rootHash : new Uint8Array()));
1121
- message.data !== undefined
1122
- && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
1123
- message.proof !== undefined && (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined);
1124
- return obj;
1125
- },
1126
- fromPartial(object) {
1127
- const message = createBaseTxProof();
1128
- message.rootHash = object.rootHash ?? new Uint8Array();
1129
- message.data = object.data ?? new Uint8Array();
1130
- message.proof = (object.proof !== undefined && object.proof !== null) ? Proof.fromPartial(object.proof) : undefined;
1131
- return message;
1132
- },
1133
- };
1134
- var globalThis = (() => {
1135
- if (typeof globalThis !== "undefined") {
1136
- return globalThis;
1137
- }
1138
- if (typeof self !== "undefined") {
1139
- return self;
1140
- }
1141
- if (typeof window !== "undefined") {
1142
- return window;
1143
- }
1144
- if (typeof global !== "undefined") {
1145
- return global;
1146
- }
1147
- throw "Unable to locate global object";
1148
- })();
1149
- function bytesFromBase64(b64) {
1150
- if (globalThis.Buffer) {
1151
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1152
- }
1153
- else {
1154
- const bin = globalThis.atob(b64);
1155
- const arr = new Uint8Array(bin.length);
1156
- for (let i = 0; i < bin.length; ++i) {
1157
- arr[i] = bin.charCodeAt(i);
1158
- }
1159
- return arr;
1160
- }
1161
- }
1162
- function base64FromBytes(arr) {
1163
- if (globalThis.Buffer) {
1164
- return globalThis.Buffer.from(arr).toString("base64");
1165
- }
1166
- else {
1167
- const bin = [];
1168
- arr.forEach((byte) => {
1169
- bin.push(String.fromCharCode(byte));
1170
- });
1171
- return globalThis.btoa(bin.join(""));
1172
- }
1173
- }
1174
- function toTimestamp(date) {
1175
- const seconds = date.getTime() / 1000;
1176
- const nanos = (date.getTime() % 1000) * 1000000;
1177
- return { seconds, nanos };
1178
- }
1179
- function fromTimestamp(t) {
1180
- let millis = t.seconds * 1000;
1181
- millis += t.nanos / 1000000;
1182
- return new Date(millis);
1183
- }
1184
- function fromJsonTimestamp(o) {
1185
- if (o instanceof Date) {
1186
- return o;
1187
- }
1188
- else if (typeof o === "string") {
1189
- return new Date(o);
1190
- }
1191
- else {
1192
- return fromTimestamp(Timestamp.fromJSON(o));
1193
- }
1194
- }
1195
- function longToNumber(long) {
1196
- if (long.gt(Number.MAX_SAFE_INTEGER)) {
1197
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1198
- }
1199
- return long.toNumber();
1200
- }
1201
- if (_m0.util.Long !== Long) {
1202
- _m0.util.Long = Long;
1203
- _m0.configure();
1204
- }
1205
- function isSet(value) {
1206
- return value !== null && value !== undefined;
1207
- }