trac-msb 0.2.24 → 0.3.0-beta.1

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 (137) hide show
  1. package/SECURITY.md +2 -2
  2. package/cli/commandHandler.js +317 -20
  3. package/cli/handlers.js +9 -1
  4. package/cli/interactive.js +4 -3
  5. package/cli/tokenSupplyAudit.js +90 -0
  6. package/msb.mjs +1 -0
  7. package/package.json +15 -6
  8. package/rpc/create_server.js +12 -3
  9. package/rpc/handlers.js +103 -0
  10. package/rpc/routes/v1.js +8 -0
  11. package/src/codecs/apply/applyOperationCodec.js +334 -0
  12. package/src/codecs/apply/applyOperations.generated.cjs +6380 -0
  13. package/src/codecs/consensus/v1/consensusV1.generated.cjs +3508 -0
  14. package/src/codecs/consensus/v1/consensusV1OperationCodec.js +161 -0
  15. package/src/codecs/consensus/v1/vdfConfigCodec.js +83 -0
  16. package/src/{utils/protobuf → codecs/network/v1}/networkV1.generated.cjs +664 -393
  17. package/src/codecs/network/v1/networkV1OperationCodec.js +25 -0
  18. package/src/codecs/protobufRuntime.cjs +95 -0
  19. package/src/codecs/state/escrowEntryCodec.js +45 -0
  20. package/src/codecs/state/state.generated.cjs +659 -0
  21. package/src/config/args.js +0 -1
  22. package/src/config/config.js +46 -7
  23. package/src/config/env.js +33 -6
  24. package/src/core/consensus/epochAppenderSelection/EpochAppenderSelectionError.js +55 -0
  25. package/src/core/consensus/epochAppenderSelection/EpochAppenderSelectionOperations.js +118 -0
  26. package/src/core/consensus/epochAppenderSelection/EpochAppenderSelector.js +1042 -0
  27. package/src/core/consensus/epochAppenderSelection/createEpochAppenderSelector.js +23 -0
  28. package/src/core/consensus/epochAppenderSelection/epochAppenderSelectionLedgerReader.js +274 -0
  29. package/src/core/consensus/epochAppenderSelection/epochAppenderSelectionState.js +488 -0
  30. package/src/core/consensus/epochAppenderSelection/epochAppenderSelectionStorage.js +93 -0
  31. package/src/core/consensus/quorum.js +11 -0
  32. package/src/core/consensus/services/EpochCoordinationRound.js +839 -0
  33. package/src/core/consensus/services/EpochCoordinatorOperations.js +211 -0
  34. package/src/core/consensus/services/EpochCoordinatorService.js +335 -0
  35. package/src/core/consensus/services/EpochRoundListeners.js +116 -0
  36. package/src/core/consensus/services/EpochStateMachine.js +141 -0
  37. package/src/core/consensus/services/VDFBare.js +291 -0
  38. package/src/core/consensus/services/VDFNode.js +111 -0
  39. package/src/core/consensus/services/VDFProgressWatchdog.js +79 -0
  40. package/src/core/consensus/services/VDFService.js +87 -0
  41. package/src/core/consensus/services/VDFServiceManager.js +147 -0
  42. package/src/core/consensus/services/createVDFService.js +16 -0
  43. package/src/core/consensus/services/vdf-guardian.js +32 -0
  44. package/src/core/consensus/services/vdf-worker.js +90 -0
  45. package/src/core/network/Network.js +327 -238
  46. package/src/core/network/protocols/consensus/IndexerMessages.js +72 -0
  47. package/src/core/network/protocols/consensus/v1/ConsensusV1ConnectionPolicy.js +57 -0
  48. package/src/core/network/protocols/consensus/v1/ConsensusV1MessageRouter.js +147 -0
  49. package/src/core/network/protocols/consensus/v1/ConsensusV1Protocol.js +72 -0
  50. package/src/core/network/protocols/consensus/v1/IndexerPendingRequestService.js +108 -0
  51. package/src/core/network/protocols/consensus/v1/V1ConsensusProtocolError.js +29 -0
  52. package/src/core/network/protocols/consensus/v1/handlers/V1EpochAppendOperationHandler.js +68 -0
  53. package/src/core/network/protocols/consensus/v1/handlers/V1EpochProofProposalOperationHandler.js +226 -0
  54. package/src/core/network/protocols/consensus/v1/validators/ConsensusValidationSchema.js +192 -0
  55. package/src/core/network/protocols/consensus/v1/validators/V1BaseConsensusOperation.js +428 -0
  56. package/src/core/network/protocols/consensus/v1/validators/V1EpochAppendReply.js +47 -0
  57. package/src/core/network/protocols/consensus/v1/validators/V1EpochAppendRequest.js +17 -0
  58. package/src/core/network/protocols/consensus/v1/validators/V1EpochProofProposalApproval.js +116 -0
  59. package/src/core/network/protocols/consensus/v1/validators/V1EpochProofProposalRequest.js +152 -0
  60. package/src/core/network/protocols/consensus/v1/validators/consensusValidationSchemaHelpers.js +145 -0
  61. package/src/core/network/protocols/shared/ConnectionOperationHandler.js +27 -0
  62. package/src/core/network/protocols/{NetworkMessages.js → validators/ValidatorMessages.js} +24 -14
  63. package/src/core/network/protocols/{ProtocolSession.js → validators/ValidatorProtocolSession.js} +22 -25
  64. package/src/core/network/protocols/{legacy/NetworkMessageRouter.js → validators/legacy/ValidatorLegacyMessageRouter.js} +6 -6
  65. package/src/core/network/protocols/{LegacyProtocol.js → validators/legacy/ValidatorLegacyProtocol.js} +9 -7
  66. package/src/core/network/protocols/{legacy → validators/legacy}/handlers/BaseStateOperationHandler.js +1 -1
  67. package/src/core/network/protocols/{legacy → validators/legacy}/handlers/LegacyGetRequestHandler.js +5 -5
  68. package/src/core/network/protocols/{legacy → validators/legacy}/handlers/LegacyRoleOperationHandler.js +5 -5
  69. package/src/core/network/protocols/{legacy → validators/legacy}/handlers/LegacySubnetworkOperationHandler.js +5 -5
  70. package/src/core/network/protocols/{legacy → validators/legacy}/handlers/LegacyTransferOperationHandler.js +5 -5
  71. package/src/core/network/protocols/{ProtocolInterface.js → validators/shared/ValidatorProtocolInterface.js} +5 -5
  72. package/src/core/network/protocols/{shared → validators/shared}/validators/PartialBootstrapDeploymentValidator.js +1 -1
  73. package/src/core/network/protocols/validators/shared/validators/PartialHtlcValidator.js +325 -0
  74. package/src/core/network/protocols/{shared → validators/shared}/validators/PartialOperationValidator.js +44 -21
  75. package/src/core/network/protocols/{shared → validators/shared}/validators/PartialRoleAccessValidator.js +3 -3
  76. package/src/core/network/protocols/{shared → validators/shared}/validators/PartialTransactionValidator.js +3 -3
  77. package/src/core/network/protocols/{shared → validators/shared}/validators/PartialTransferValidator.js +4 -4
  78. package/src/core/network/protocols/{v1 → validators/v1}/V1ProtocolError.js +1 -1
  79. package/src/core/network/{services/PendingRequestService.js → protocols/validators/v1/ValidatorPendingRequestService.js} +19 -82
  80. package/src/core/network/protocols/{v1/NetworkMessageRouter.js → validators/v1/ValidatorV1MessageRouter.js} +9 -9
  81. package/src/core/network/protocols/{V1Protocol.js → validators/v1/ValidatorV1Protocol.js} +10 -8
  82. package/src/core/network/protocols/{connectionPolicies.js → validators/v1/connectionPolicies.js} +1 -1
  83. package/src/core/network/protocols/{v1 → validators/v1}/handlers/V1BaseOperationHandler.js +6 -23
  84. package/src/core/network/protocols/{v1 → validators/v1}/handlers/V1BroadcastTransactionOperationHandler.js +14 -9
  85. package/src/core/network/protocols/{v1 → validators/v1}/handlers/V1LivenessOperationHandler.js +5 -4
  86. package/src/core/network/protocols/{v1 → validators/v1}/handlers/broadcastTransaction/BroadcastTransactionErrorMapper.js +3 -3
  87. package/src/core/network/protocols/{v1 → validators/v1}/handlers/broadcastTransaction/BroadcastTransactionOperationStrategies.js +44 -1
  88. package/src/core/network/protocols/{v1 → validators/v1}/handlers/broadcastTransaction/BroadcastTransactionPayloadUtils.js +1 -1
  89. package/src/core/network/protocols/{v1 → validators/v1}/validators/V1BaseOperation.js +19 -15
  90. package/src/core/network/protocols/{v1 → validators/v1}/validators/V1BroadcastTransactionRequest.js +2 -2
  91. package/src/core/network/protocols/{v1 → validators/v1}/validators/V1BroadcastTransactionResponse.js +34 -18
  92. package/src/core/network/protocols/{v1 → validators/v1}/validators/V1ValidationSchema.js +3 -3
  93. package/src/core/network/services/IndexerConnectionManager.js +88 -0
  94. package/src/core/network/services/TransactionPoolService.js +11 -18
  95. package/src/core/network/services/TransactionRateLimiterService.js +1 -1
  96. package/src/core/network/services/ValidatorConnectionManager.js +163 -0
  97. package/src/core/network/services/{MessageOrchestrator.js → ValidatorMessageOrchestrator.js} +34 -42
  98. package/src/core/network/services/ValidatorObserverService.js +21 -36
  99. package/src/core/network/shared/BasePendingRequestService.js +67 -0
  100. package/src/core/network/shared/PeerConnectionManager.js +185 -0
  101. package/src/core/state/ConfirmationWatch.js +82 -0
  102. package/src/core/state/State.js +1794 -173
  103. package/src/core/state/StateEventQueue.js +69 -0
  104. package/src/core/state/utils/address.js +10 -6
  105. package/src/core/state/utils/epochProof.js +109 -0
  106. package/src/core/state/utils/escrowEntry.js +178 -0
  107. package/src/core/state/validators/StateValidationSchema.js +757 -0
  108. package/src/core/state/validators/stateValidationRules.js +312 -0
  109. package/src/index.js +255 -65
  110. package/src/messages/consensus/v1/ConsensusMessageBuilder.js +368 -0
  111. package/src/messages/consensus/v1/ConsensusMessageDirector.js +142 -0
  112. package/src/messages/consensus/v1/consensusMessageFactory.js +12 -0
  113. package/src/messages/consensus/v1/epochAppendMessage.js +58 -0
  114. package/src/messages/network/v1/NetworkMessageBuilder.js +15 -7
  115. package/src/messages/state/ApplyStateMessageBuilder.js +499 -13
  116. package/src/messages/state/ApplyStateMessageDirector.js +261 -2
  117. package/src/utils/StateMachine.js +125 -0
  118. package/src/utils/applyOperations.js +45 -2
  119. package/src/utils/buffer.js +239 -59
  120. package/src/utils/consensusConfig.js +76 -0
  121. package/src/utils/constants.js +174 -73
  122. package/src/utils/helpers.js +0 -25
  123. package/src/utils/htlcLock.js +122 -0
  124. package/src/utils/logger.js +10 -4
  125. package/src/utils/migrationUtils.js +2 -1
  126. package/src/utils/normalizers.js +113 -0
  127. package/src/utils/scheduler/SchedulableService.js +107 -0
  128. package/src/utils/{Scheduler.js → scheduler/Scheduler.js} +56 -17
  129. package/src/core/network/services/ConnectionManager.js +0 -406
  130. package/src/utils/check.js +0 -525
  131. package/src/utils/protobuf/applyOperations.cjs +0 -1373
  132. package/src/utils/protobuf/operationHelpers.js +0 -81
  133. /package/src/core/network/protocols/{legacy → validators/legacy}/handlers/LegacyResponseHandler.js +0 -0
  134. /package/src/core/network/protocols/{legacy → validators/legacy}/validators/ValidatorResponse.js +0 -0
  135. /package/src/core/network/protocols/{legacy → validators/legacy}/validators/base/BaseResponse.js +0 -0
  136. /package/src/core/network/protocols/{v1 → validators/v1}/validators/V1LivenessRequest.js +0 -0
  137. /package/src/core/network/protocols/{v1 → validators/v1}/validators/V1LivenessResponse.js +0 -0
@@ -0,0 +1,3508 @@
1
+ /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
2
+ "use strict";
3
+
4
+ /** @typedef {ReturnType<typeof import("b4a").alloc>} B4aBuffer */
5
+
6
+ var $protobuf = require("../../protobufRuntime.cjs");
7
+
8
+ // Common aliases
9
+ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
10
+
11
+ // Exported root namespace
12
+ var $root = $protobuf.roots["consensusV1"] || ($protobuf.roots["consensusV1"] = {});
13
+
14
+ $root.consensus = (function() {
15
+
16
+ /**
17
+ * Namespace consensus.
18
+ * @exports consensus
19
+ * @namespace
20
+ */
21
+ var consensus = {};
22
+
23
+ consensus.v1 = (function() {
24
+
25
+ /**
26
+ * Namespace v1.
27
+ * @memberof consensus
28
+ * @namespace
29
+ */
30
+ var v1 = {};
31
+
32
+ v1.ConsensusMessageHeader = (function() {
33
+
34
+ /**
35
+ * Properties of a ConsensusMessageHeader.
36
+ * @memberof consensus.v1
37
+ * @interface IConsensusMessageHeader
38
+ * @property {consensus.v1.MessageType|null} [type] ConsensusMessageHeader type
39
+ * @property {string|null} [session_id] ConsensusMessageHeader session_id
40
+ * @property {number|Long|null} [timestamp] ConsensusMessageHeader timestamp
41
+ * @property {consensus.v1.IProofProposal|null} [proof_proposal] ConsensusMessageHeader proof_proposal
42
+ * @property {consensus.v1.IProofProposalResponse|null} [proof_proposal_response] ConsensusMessageHeader proof_proposal_response
43
+ * @property {consensus.v1.IEpochAppendRequest|null} [request] ConsensusMessageHeader request
44
+ * @property {consensus.v1.IEpochAppendReply|null} [reply] ConsensusMessageHeader reply
45
+ */
46
+
47
+ /**
48
+ * Constructs a new ConsensusMessageHeader.
49
+ * @memberof consensus.v1
50
+ * @classdesc Represents a ConsensusMessageHeader.
51
+ * @implements IConsensusMessageHeader
52
+ * @constructor
53
+ * @param {consensus.v1.IConsensusMessageHeader=} [properties] Properties to set
54
+ */
55
+ function ConsensusMessageHeader(properties) {
56
+ if (properties)
57
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
58
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
59
+ this[keys[i]] = properties[keys[i]];
60
+ }
61
+
62
+ /**
63
+ * ConsensusMessageHeader type.
64
+ * @member {consensus.v1.MessageType} type
65
+ * @memberof consensus.v1.ConsensusMessageHeader
66
+ * @instance
67
+ */
68
+ ConsensusMessageHeader.prototype.type = 0;
69
+
70
+ /**
71
+ * ConsensusMessageHeader session_id.
72
+ * @member {string} session_id
73
+ * @memberof consensus.v1.ConsensusMessageHeader
74
+ * @instance
75
+ */
76
+ ConsensusMessageHeader.prototype.session_id = "";
77
+
78
+ /**
79
+ * ConsensusMessageHeader timestamp.
80
+ * @member {number|Long} timestamp
81
+ * @memberof consensus.v1.ConsensusMessageHeader
82
+ * @instance
83
+ */
84
+ ConsensusMessageHeader.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
85
+
86
+ /**
87
+ * ConsensusMessageHeader proof_proposal.
88
+ * @member {consensus.v1.IProofProposal|null|undefined} proof_proposal
89
+ * @memberof consensus.v1.ConsensusMessageHeader
90
+ * @instance
91
+ */
92
+ ConsensusMessageHeader.prototype.proof_proposal = null;
93
+
94
+ /**
95
+ * ConsensusMessageHeader proof_proposal_response.
96
+ * @member {consensus.v1.IProofProposalResponse|null|undefined} proof_proposal_response
97
+ * @memberof consensus.v1.ConsensusMessageHeader
98
+ * @instance
99
+ */
100
+ ConsensusMessageHeader.prototype.proof_proposal_response = null;
101
+
102
+ /**
103
+ * ConsensusMessageHeader request.
104
+ * @member {consensus.v1.IEpochAppendRequest|null|undefined} request
105
+ * @memberof consensus.v1.ConsensusMessageHeader
106
+ * @instance
107
+ */
108
+ ConsensusMessageHeader.prototype.request = null;
109
+
110
+ /**
111
+ * ConsensusMessageHeader reply.
112
+ * @member {consensus.v1.IEpochAppendReply|null|undefined} reply
113
+ * @memberof consensus.v1.ConsensusMessageHeader
114
+ * @instance
115
+ */
116
+ ConsensusMessageHeader.prototype.reply = null;
117
+
118
+ // OneOf field names bound to virtual getters and setters
119
+ var $oneOfFields;
120
+
121
+ /**
122
+ * ConsensusMessageHeader field.
123
+ * @member {"proof_proposal"|"proof_proposal_response"|"request"|"reply"|undefined} field
124
+ * @memberof consensus.v1.ConsensusMessageHeader
125
+ * @instance
126
+ */
127
+ Object.defineProperty(ConsensusMessageHeader.prototype, "field", {
128
+ get: $util.oneOfGetter($oneOfFields = ["proof_proposal", "proof_proposal_response", "request", "reply"]),
129
+ set: $util.oneOfSetter($oneOfFields)
130
+ });
131
+
132
+ /**
133
+ * Creates a new ConsensusMessageHeader instance using the specified properties.
134
+ * @function create
135
+ * @memberof consensus.v1.ConsensusMessageHeader
136
+ * @static
137
+ * @param {consensus.v1.IConsensusMessageHeader=} [properties] Properties to set
138
+ * @returns {consensus.v1.ConsensusMessageHeader} ConsensusMessageHeader instance
139
+ */
140
+ ConsensusMessageHeader.create = function create(properties) {
141
+ return new ConsensusMessageHeader(properties);
142
+ };
143
+
144
+ /**
145
+ * Encodes the specified ConsensusMessageHeader message. Does not implicitly {@link consensus.v1.ConsensusMessageHeader.verify|verify} messages.
146
+ * @function encode
147
+ * @memberof consensus.v1.ConsensusMessageHeader
148
+ * @static
149
+ * @param {consensus.v1.IConsensusMessageHeader} message ConsensusMessageHeader message or plain object to encode
150
+ * @param {$protobuf.Writer} [writer] Writer to encode to
151
+ * @returns {$protobuf.Writer} Writer
152
+ */
153
+ ConsensusMessageHeader.encode = function encode(message, writer, q) {
154
+ writer = $Writer.create(writer);
155
+ if (q === undefined)
156
+ q = 0;
157
+ if (q > $util.recursionLimit)
158
+ throw Error("max depth exceeded");
159
+ if (message.type != null && Object.hasOwnProperty.call(message, "type"))
160
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
161
+ if (message.session_id != null && Object.hasOwnProperty.call(message, "session_id"))
162
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.session_id);
163
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
164
+ writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.timestamp);
165
+ if (message.proof_proposal != null && Object.hasOwnProperty.call(message, "proof_proposal"))
166
+ $root.consensus.v1.ProofProposal.encode(message.proof_proposal, writer.uint32(/* id 4, wireType 2 =*/34).fork(), q + 1).ldelim();
167
+ if (message.proof_proposal_response != null && Object.hasOwnProperty.call(message, "proof_proposal_response"))
168
+ $root.consensus.v1.ProofProposalResponse.encode(message.proof_proposal_response, writer.uint32(/* id 5, wireType 2 =*/42).fork(), q + 1).ldelim();
169
+ if (message.request != null && Object.hasOwnProperty.call(message, "request"))
170
+ $root.consensus.v1.EpochAppendRequest.encode(message.request, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim();
171
+ if (message.reply != null && Object.hasOwnProperty.call(message, "reply"))
172
+ $root.consensus.v1.EpochAppendReply.encode(message.reply, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim();
173
+ return writer;
174
+ };
175
+
176
+ /**
177
+ * Encodes the specified ConsensusMessageHeader message, length delimited. Does not implicitly {@link consensus.v1.ConsensusMessageHeader.verify|verify} messages.
178
+ * @function encodeDelimited
179
+ * @memberof consensus.v1.ConsensusMessageHeader
180
+ * @static
181
+ * @param {consensus.v1.IConsensusMessageHeader} message ConsensusMessageHeader message or plain object to encode
182
+ * @param {$protobuf.Writer} [writer] Writer to encode to
183
+ * @returns {$protobuf.Writer} Writer
184
+ */
185
+ ConsensusMessageHeader.encodeDelimited = function encodeDelimited(message, writer) {
186
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
187
+ };
188
+
189
+ /**
190
+ * Decodes a ConsensusMessageHeader message from the specified reader or buffer.
191
+ * @function decode
192
+ * @memberof consensus.v1.ConsensusMessageHeader
193
+ * @static
194
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
195
+ * @param {number} [length] Message length if known beforehand
196
+ * @returns {consensus.v1.ConsensusMessageHeader} ConsensusMessageHeader
197
+ * @throws {Error} If the payload is not a reader or valid buffer
198
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
199
+ */
200
+ ConsensusMessageHeader.decode = function decode(reader, length, error, long) {
201
+ reader = $Reader.create(reader);
202
+ if (long === undefined)
203
+ long = 0;
204
+ if (long > $Reader.recursionLimit)
205
+ throw Error("maximum nesting depth exceeded");
206
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.consensus.v1.ConsensusMessageHeader();
207
+ while (reader.pos < end) {
208
+ var tag = reader.uint32();
209
+ if (tag === error)
210
+ break;
211
+ switch (tag >>> 3) {
212
+ case 1: {
213
+ message.type = reader.int32();
214
+ break;
215
+ }
216
+ case 2: {
217
+ message.session_id = reader.string();
218
+ break;
219
+ }
220
+ case 3: {
221
+ message.timestamp = reader.uint64();
222
+ break;
223
+ }
224
+ case 4: {
225
+ message.proof_proposal = $root.consensus.v1.ProofProposal.decode(reader, reader.uint32(), undefined, long + 1);
226
+ break;
227
+ }
228
+ case 5: {
229
+ message.proof_proposal_response = $root.consensus.v1.ProofProposalResponse.decode(reader, reader.uint32(), undefined, long + 1);
230
+ break;
231
+ }
232
+ case 6: {
233
+ message.request = $root.consensus.v1.EpochAppendRequest.decode(reader, reader.uint32(), undefined, long + 1);
234
+ break;
235
+ }
236
+ case 7: {
237
+ message.reply = $root.consensus.v1.EpochAppendReply.decode(reader, reader.uint32(), undefined, long + 1);
238
+ break;
239
+ }
240
+ default:
241
+ reader.skipType(tag & 7, long);
242
+ break;
243
+ }
244
+ }
245
+ return message;
246
+ };
247
+
248
+ /**
249
+ * Decodes a ConsensusMessageHeader message from the specified reader or buffer, length delimited.
250
+ * @function decodeDelimited
251
+ * @memberof consensus.v1.ConsensusMessageHeader
252
+ * @static
253
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
254
+ * @returns {consensus.v1.ConsensusMessageHeader} ConsensusMessageHeader
255
+ * @throws {Error} If the payload is not a reader or valid buffer
256
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
257
+ */
258
+ ConsensusMessageHeader.decodeDelimited = function decodeDelimited(reader) {
259
+ reader = $Reader.create(reader);
260
+ return this.decode(reader, reader.uint32());
261
+ };
262
+
263
+ /**
264
+ * Verifies a ConsensusMessageHeader message.
265
+ * @function verify
266
+ * @memberof consensus.v1.ConsensusMessageHeader
267
+ * @static
268
+ * @param {Object.<string,*>} message Plain object to verify
269
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
270
+ */
271
+ ConsensusMessageHeader.verify = function verify(message, long) {
272
+ if (typeof message !== "object" || message === null)
273
+ return "object expected";
274
+ if (long === undefined)
275
+ long = 0;
276
+ if (long > $util.recursionLimit)
277
+ return "maximum nesting depth exceeded";
278
+ var properties = {};
279
+ if (message.type != null && Object.hasOwnProperty.call(message, "type"))
280
+ switch (message.type) {
281
+ default:
282
+ return "type: enum value expected";
283
+ case 0:
284
+ case 1:
285
+ case 2:
286
+ case 3:
287
+ case 4:
288
+ break;
289
+ }
290
+ if (message.session_id != null && Object.hasOwnProperty.call(message, "session_id"))
291
+ if (!$util.isString(message.session_id))
292
+ return "session_id: string expected";
293
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
294
+ if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high)))
295
+ return "timestamp: integer|Long expected";
296
+ if (message.proof_proposal != null && Object.hasOwnProperty.call(message, "proof_proposal")) {
297
+ properties.field = 1;
298
+ {
299
+ var error = $root.consensus.v1.ProofProposal.verify(message.proof_proposal, long + 1);
300
+ if (error)
301
+ return "proof_proposal." + error;
302
+ }
303
+ }
304
+ if (message.proof_proposal_response != null && Object.hasOwnProperty.call(message, "proof_proposal_response")) {
305
+ if (properties.field === 1)
306
+ return "field: multiple values";
307
+ properties.field = 1;
308
+ {
309
+ var error = $root.consensus.v1.ProofProposalResponse.verify(message.proof_proposal_response, long + 1);
310
+ if (error)
311
+ return "proof_proposal_response." + error;
312
+ }
313
+ }
314
+ if (message.request != null && Object.hasOwnProperty.call(message, "request")) {
315
+ if (properties.field === 1)
316
+ return "field: multiple values";
317
+ properties.field = 1;
318
+ {
319
+ var error = $root.consensus.v1.EpochAppendRequest.verify(message.request, long + 1);
320
+ if (error)
321
+ return "request." + error;
322
+ }
323
+ }
324
+ if (message.reply != null && Object.hasOwnProperty.call(message, "reply")) {
325
+ if (properties.field === 1)
326
+ return "field: multiple values";
327
+ properties.field = 1;
328
+ {
329
+ var error = $root.consensus.v1.EpochAppendReply.verify(message.reply, long + 1);
330
+ if (error)
331
+ return "reply." + error;
332
+ }
333
+ }
334
+ return null;
335
+ };
336
+
337
+ /**
338
+ * Creates a ConsensusMessageHeader message from a plain object. Also converts values to their respective internal types.
339
+ * @function fromObject
340
+ * @memberof consensus.v1.ConsensusMessageHeader
341
+ * @static
342
+ * @param {Object.<string,*>} object Plain object
343
+ * @returns {consensus.v1.ConsensusMessageHeader} ConsensusMessageHeader
344
+ */
345
+ ConsensusMessageHeader.fromObject = function fromObject(object, long) {
346
+ if (object instanceof $root.consensus.v1.ConsensusMessageHeader)
347
+ object = Object.assign({}, object);
348
+ if (!$util.isObject(object))
349
+ throw TypeError(".consensus.v1.ConsensusMessageHeader: object expected");
350
+ if (long === undefined)
351
+ long = 0;
352
+ if (long > $util.recursionLimit)
353
+ throw Error("maximum nesting depth exceeded");
354
+ var message = new $root.consensus.v1.ConsensusMessageHeader();
355
+ switch (object.type) {
356
+ default:
357
+ if (typeof object.type === "number") {
358
+ message.type = object.type;
359
+ break;
360
+ }
361
+ break;
362
+ case "MESSAGE_TYPE_UNSPECIFIED":
363
+ case 0:
364
+ message.type = 0;
365
+ break;
366
+ case "MESSAGE_TYPE_PROOF_PROPOSAL":
367
+ case 1:
368
+ message.type = 1;
369
+ break;
370
+ case "MESSAGE_TYPE_PROOF_PROPOSAL_APPROVAL":
371
+ case 2:
372
+ message.type = 2;
373
+ break;
374
+ case "MESSAGE_TYPE_REQUEST":
375
+ case 3:
376
+ message.type = 3;
377
+ break;
378
+ case "MESSAGE_TYPE_REPLY":
379
+ case 4:
380
+ message.type = 4;
381
+ break;
382
+ }
383
+ if (object.session_id != null)
384
+ message.session_id = String(object.session_id);
385
+ if (object.timestamp != null)
386
+ if ($util.Long)
387
+ message.timestamp = $util.Long.fromValue(object.timestamp, true);
388
+ else if (typeof object.timestamp === "string")
389
+ message.timestamp = parseInt(object.timestamp, 10);
390
+ else if (typeof object.timestamp === "number")
391
+ message.timestamp = object.timestamp;
392
+ else if (typeof object.timestamp === "object")
393
+ message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true);
394
+ if (object.proof_proposal != null) {
395
+ if (!$util.isObject(object.proof_proposal))
396
+ throw TypeError(".consensus.v1.ConsensusMessageHeader.proof_proposal: object expected");
397
+ message.proof_proposal = $root.consensus.v1.ProofProposal.fromObject(object.proof_proposal, long + 1);
398
+ }
399
+ if (object.proof_proposal_response != null) {
400
+ if (!$util.isObject(object.proof_proposal_response))
401
+ throw TypeError(".consensus.v1.ConsensusMessageHeader.proof_proposal_response: object expected");
402
+ message.proof_proposal_response = $root.consensus.v1.ProofProposalResponse.fromObject(object.proof_proposal_response, long + 1);
403
+ }
404
+ if (object.request != null) {
405
+ if (!$util.isObject(object.request))
406
+ throw TypeError(".consensus.v1.ConsensusMessageHeader.request: object expected");
407
+ message.request = $root.consensus.v1.EpochAppendRequest.fromObject(object.request, long + 1);
408
+ }
409
+ if (object.reply != null) {
410
+ if (!$util.isObject(object.reply))
411
+ throw TypeError(".consensus.v1.ConsensusMessageHeader.reply: object expected");
412
+ message.reply = $root.consensus.v1.EpochAppendReply.fromObject(object.reply, long + 1);
413
+ }
414
+ return message;
415
+ };
416
+
417
+ /**
418
+ * Creates a plain object from a ConsensusMessageHeader message. Also converts values to other types if specified.
419
+ * @function toObject
420
+ * @memberof consensus.v1.ConsensusMessageHeader
421
+ * @static
422
+ * @param {consensus.v1.ConsensusMessageHeader} message ConsensusMessageHeader
423
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
424
+ * @returns {Object.<string,*>} Plain object
425
+ */
426
+ ConsensusMessageHeader.toObject = function toObject(message, options, q) {
427
+ if (!options)
428
+ options = {};
429
+ if (q === undefined)
430
+ q = 0;
431
+ if (q > $util.recursionLimit)
432
+ throw Error("max depth exceeded");
433
+ var object = {};
434
+ if (options.defaults) {
435
+ object.type = options.enums === String ? "MESSAGE_TYPE_UNSPECIFIED" : 0;
436
+ object.session_id = "";
437
+ if ($util.Long) {
438
+ var long = new $util.Long(0, 0, true);
439
+ object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : typeof BigInt !== "undefined" && options.longs === BigInt ? long.toBigInt() : long;
440
+ } else
441
+ object.timestamp = options.longs === String ? "0" : typeof BigInt !== "undefined" && options.longs === BigInt ? BigInt("0") : 0;
442
+ }
443
+ if (message.type != null && Object.hasOwnProperty.call(message, "type"))
444
+ object.type = options.enums === String ? $root.consensus.v1.MessageType[message.type] === undefined ? message.type : $root.consensus.v1.MessageType[message.type] : message.type;
445
+ if (message.session_id != null && Object.hasOwnProperty.call(message, "session_id"))
446
+ object.session_id = message.session_id;
447
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
448
+ if (typeof BigInt !== "undefined" && options.longs === BigInt)
449
+ object.timestamp = typeof message.timestamp === "number" ? BigInt(message.timestamp) : $util.Long.fromBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0, true).toBigInt();
450
+ else if (typeof message.timestamp === "number")
451
+ object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp;
452
+ else
453
+ object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber(true) : message.timestamp;
454
+ if (message.proof_proposal != null && Object.hasOwnProperty.call(message, "proof_proposal")) {
455
+ object.proof_proposal = $root.consensus.v1.ProofProposal.toObject(message.proof_proposal, options, q + 1);
456
+ if (options.oneofs)
457
+ object.field = "proof_proposal";
458
+ }
459
+ if (message.proof_proposal_response != null && Object.hasOwnProperty.call(message, "proof_proposal_response")) {
460
+ object.proof_proposal_response = $root.consensus.v1.ProofProposalResponse.toObject(message.proof_proposal_response, options, q + 1);
461
+ if (options.oneofs)
462
+ object.field = "proof_proposal_response";
463
+ }
464
+ if (message.request != null && Object.hasOwnProperty.call(message, "request")) {
465
+ object.request = $root.consensus.v1.EpochAppendRequest.toObject(message.request, options, q + 1);
466
+ if (options.oneofs)
467
+ object.field = "request";
468
+ }
469
+ if (message.reply != null && Object.hasOwnProperty.call(message, "reply")) {
470
+ object.reply = $root.consensus.v1.EpochAppendReply.toObject(message.reply, options, q + 1);
471
+ if (options.oneofs)
472
+ object.field = "reply";
473
+ }
474
+ return object;
475
+ };
476
+
477
+ /**
478
+ * Converts this ConsensusMessageHeader to JSON.
479
+ * @function toJSON
480
+ * @memberof consensus.v1.ConsensusMessageHeader
481
+ * @instance
482
+ * @returns {Object.<string,*>} JSON object
483
+ */
484
+ ConsensusMessageHeader.prototype.toJSON = function toJSON() {
485
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
486
+ };
487
+
488
+ /**
489
+ * Gets the default type url for ConsensusMessageHeader
490
+ * @function getTypeUrl
491
+ * @memberof consensus.v1.ConsensusMessageHeader
492
+ * @static
493
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
494
+ * @returns {string} The default type url
495
+ */
496
+ ConsensusMessageHeader.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
497
+ if (typeUrlPrefix === undefined) {
498
+ typeUrlPrefix = "type.googleapis.com";
499
+ }
500
+ return typeUrlPrefix + "/consensus.v1.ConsensusMessageHeader";
501
+ };
502
+
503
+ return ConsensusMessageHeader;
504
+ })();
505
+
506
+ /**
507
+ * MessageType enum.
508
+ * @name consensus.v1.MessageType
509
+ * @enum {number}
510
+ * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value
511
+ * @property {number} MESSAGE_TYPE_PROOF_PROPOSAL=1 MESSAGE_TYPE_PROOF_PROPOSAL value
512
+ * @property {number} MESSAGE_TYPE_PROOF_PROPOSAL_APPROVAL=2 MESSAGE_TYPE_PROOF_PROPOSAL_APPROVAL value
513
+ * @property {number} MESSAGE_TYPE_REQUEST=3 MESSAGE_TYPE_REQUEST value
514
+ * @property {number} MESSAGE_TYPE_REPLY=4 MESSAGE_TYPE_REPLY value
515
+ */
516
+ v1.MessageType = (function() {
517
+ var valuesById = {}, values = Object.create(valuesById);
518
+ values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0;
519
+ values[valuesById[1] = "MESSAGE_TYPE_PROOF_PROPOSAL"] = 1;
520
+ values[valuesById[2] = "MESSAGE_TYPE_PROOF_PROPOSAL_APPROVAL"] = 2;
521
+ values[valuesById[3] = "MESSAGE_TYPE_REQUEST"] = 3;
522
+ values[valuesById[4] = "MESSAGE_TYPE_REPLY"] = 4;
523
+ return values;
524
+ })();
525
+
526
+ v1.ProofProposal = (function() {
527
+
528
+ /**
529
+ * Properties of a ProofProposal.
530
+ * @memberof consensus.v1
531
+ * @interface IProofProposal
532
+ * @property {B4aBuffer|null} [network_id] ProofProposal network_id
533
+ * @property {B4aBuffer|null} [epoch] ProofProposal epoch
534
+ * @property {B4aBuffer|null} [previous_epoch_record_hash] ProofProposal previous_epoch_record_hash
535
+ * @property {B4aBuffer|null} [proposer] ProofProposal proposer
536
+ * @property {B4aBuffer|null} [difficulty] ProofProposal difficulty
537
+ * @property {B4aBuffer|null} [discriminant_bit_size] ProofProposal discriminant_bit_size
538
+ * @property {B4aBuffer|null} [proof] ProofProposal proof
539
+ * @property {B4aBuffer|null} [signature] ProofProposal signature
540
+ */
541
+
542
+ /**
543
+ * Constructs a new ProofProposal.
544
+ * @memberof consensus.v1
545
+ * @classdesc Represents a ProofProposal.
546
+ * @implements IProofProposal
547
+ * @constructor
548
+ * @param {consensus.v1.IProofProposal=} [properties] Properties to set
549
+ */
550
+ function ProofProposal(properties) {
551
+ if (properties)
552
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
553
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
554
+ this[keys[i]] = properties[keys[i]];
555
+ }
556
+
557
+ /**
558
+ * ProofProposal network_id.
559
+ * @member {B4aBuffer} network_id
560
+ * @memberof consensus.v1.ProofProposal
561
+ * @instance
562
+ */
563
+ ProofProposal.prototype.network_id = $util.newBuffer([]);
564
+
565
+ /**
566
+ * ProofProposal epoch.
567
+ * @member {B4aBuffer} epoch
568
+ * @memberof consensus.v1.ProofProposal
569
+ * @instance
570
+ */
571
+ ProofProposal.prototype.epoch = $util.newBuffer([]);
572
+
573
+ /**
574
+ * ProofProposal previous_epoch_record_hash.
575
+ * @member {B4aBuffer} previous_epoch_record_hash
576
+ * @memberof consensus.v1.ProofProposal
577
+ * @instance
578
+ */
579
+ ProofProposal.prototype.previous_epoch_record_hash = $util.newBuffer([]);
580
+
581
+ /**
582
+ * ProofProposal proposer.
583
+ * @member {B4aBuffer} proposer
584
+ * @memberof consensus.v1.ProofProposal
585
+ * @instance
586
+ */
587
+ ProofProposal.prototype.proposer = $util.newBuffer([]);
588
+
589
+ /**
590
+ * ProofProposal difficulty.
591
+ * @member {B4aBuffer} difficulty
592
+ * @memberof consensus.v1.ProofProposal
593
+ * @instance
594
+ */
595
+ ProofProposal.prototype.difficulty = $util.newBuffer([]);
596
+
597
+ /**
598
+ * ProofProposal discriminant_bit_size.
599
+ * @member {B4aBuffer} discriminant_bit_size
600
+ * @memberof consensus.v1.ProofProposal
601
+ * @instance
602
+ */
603
+ ProofProposal.prototype.discriminant_bit_size = $util.newBuffer([]);
604
+
605
+ /**
606
+ * ProofProposal proof.
607
+ * @member {B4aBuffer} proof
608
+ * @memberof consensus.v1.ProofProposal
609
+ * @instance
610
+ */
611
+ ProofProposal.prototype.proof = $util.newBuffer([]);
612
+
613
+ /**
614
+ * ProofProposal signature.
615
+ * @member {B4aBuffer} signature
616
+ * @memberof consensus.v1.ProofProposal
617
+ * @instance
618
+ */
619
+ ProofProposal.prototype.signature = $util.newBuffer([]);
620
+
621
+ /**
622
+ * Creates a new ProofProposal instance using the specified properties.
623
+ * @function create
624
+ * @memberof consensus.v1.ProofProposal
625
+ * @static
626
+ * @param {consensus.v1.IProofProposal=} [properties] Properties to set
627
+ * @returns {consensus.v1.ProofProposal} ProofProposal instance
628
+ */
629
+ ProofProposal.create = function create(properties) {
630
+ return new ProofProposal(properties);
631
+ };
632
+
633
+ /**
634
+ * Encodes the specified ProofProposal message. Does not implicitly {@link consensus.v1.ProofProposal.verify|verify} messages.
635
+ * @function encode
636
+ * @memberof consensus.v1.ProofProposal
637
+ * @static
638
+ * @param {consensus.v1.IProofProposal} message ProofProposal message or plain object to encode
639
+ * @param {$protobuf.Writer} [writer] Writer to encode to
640
+ * @returns {$protobuf.Writer} Writer
641
+ */
642
+ ProofProposal.encode = function encode(message, writer, q) {
643
+ writer = $Writer.create(writer);
644
+ if (q === undefined)
645
+ q = 0;
646
+ if (q > $util.recursionLimit)
647
+ throw Error("max depth exceeded");
648
+ if (message.network_id != null && Object.hasOwnProperty.call(message, "network_id"))
649
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.network_id);
650
+ if (message.epoch != null && Object.hasOwnProperty.call(message, "epoch"))
651
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.epoch);
652
+ if (message.previous_epoch_record_hash != null && Object.hasOwnProperty.call(message, "previous_epoch_record_hash"))
653
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.previous_epoch_record_hash);
654
+ if (message.proposer != null && Object.hasOwnProperty.call(message, "proposer"))
655
+ writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.proposer);
656
+ if (message.difficulty != null && Object.hasOwnProperty.call(message, "difficulty"))
657
+ writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.difficulty);
658
+ if (message.discriminant_bit_size != null && Object.hasOwnProperty.call(message, "discriminant_bit_size"))
659
+ writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.discriminant_bit_size);
660
+ if (message.proof != null && Object.hasOwnProperty.call(message, "proof"))
661
+ writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.proof);
662
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
663
+ writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.signature);
664
+ return writer;
665
+ };
666
+
667
+ /**
668
+ * Encodes the specified ProofProposal message, length delimited. Does not implicitly {@link consensus.v1.ProofProposal.verify|verify} messages.
669
+ * @function encodeDelimited
670
+ * @memberof consensus.v1.ProofProposal
671
+ * @static
672
+ * @param {consensus.v1.IProofProposal} message ProofProposal message or plain object to encode
673
+ * @param {$protobuf.Writer} [writer] Writer to encode to
674
+ * @returns {$protobuf.Writer} Writer
675
+ */
676
+ ProofProposal.encodeDelimited = function encodeDelimited(message, writer) {
677
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
678
+ };
679
+
680
+ /**
681
+ * Decodes a ProofProposal message from the specified reader or buffer.
682
+ * @function decode
683
+ * @memberof consensus.v1.ProofProposal
684
+ * @static
685
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
686
+ * @param {number} [length] Message length if known beforehand
687
+ * @returns {consensus.v1.ProofProposal} ProofProposal
688
+ * @throws {Error} If the payload is not a reader or valid buffer
689
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
690
+ */
691
+ ProofProposal.decode = function decode(reader, length, error, long) {
692
+ reader = $Reader.create(reader);
693
+ if (long === undefined)
694
+ long = 0;
695
+ if (long > $Reader.recursionLimit)
696
+ throw Error("maximum nesting depth exceeded");
697
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.consensus.v1.ProofProposal();
698
+ while (reader.pos < end) {
699
+ var tag = reader.uint32();
700
+ if (tag === error)
701
+ break;
702
+ switch (tag >>> 3) {
703
+ case 1: {
704
+ message.network_id = $util.bytesFrom(reader.bytes());
705
+ break;
706
+ }
707
+ case 2: {
708
+ message.epoch = $util.bytesFrom(reader.bytes());
709
+ break;
710
+ }
711
+ case 3: {
712
+ message.previous_epoch_record_hash = $util.bytesFrom(reader.bytes());
713
+ break;
714
+ }
715
+ case 4: {
716
+ message.proposer = $util.bytesFrom(reader.bytes());
717
+ break;
718
+ }
719
+ case 5: {
720
+ message.difficulty = $util.bytesFrom(reader.bytes());
721
+ break;
722
+ }
723
+ case 6: {
724
+ message.discriminant_bit_size = $util.bytesFrom(reader.bytes());
725
+ break;
726
+ }
727
+ case 7: {
728
+ message.proof = $util.bytesFrom(reader.bytes());
729
+ break;
730
+ }
731
+ case 8: {
732
+ message.signature = $util.bytesFrom(reader.bytes());
733
+ break;
734
+ }
735
+ default:
736
+ reader.skipType(tag & 7, long);
737
+ break;
738
+ }
739
+ }
740
+ return message;
741
+ };
742
+
743
+ /**
744
+ * Decodes a ProofProposal message from the specified reader or buffer, length delimited.
745
+ * @function decodeDelimited
746
+ * @memberof consensus.v1.ProofProposal
747
+ * @static
748
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
749
+ * @returns {consensus.v1.ProofProposal} ProofProposal
750
+ * @throws {Error} If the payload is not a reader or valid buffer
751
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
752
+ */
753
+ ProofProposal.decodeDelimited = function decodeDelimited(reader) {
754
+ reader = $Reader.create(reader);
755
+ return this.decode(reader, reader.uint32());
756
+ };
757
+
758
+ /**
759
+ * Verifies a ProofProposal message.
760
+ * @function verify
761
+ * @memberof consensus.v1.ProofProposal
762
+ * @static
763
+ * @param {Object.<string,*>} message Plain object to verify
764
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
765
+ */
766
+ ProofProposal.verify = function verify(message, long) {
767
+ if (typeof message !== "object" || message === null)
768
+ return "object expected";
769
+ if (long === undefined)
770
+ long = 0;
771
+ if (long > $util.recursionLimit)
772
+ return "maximum nesting depth exceeded";
773
+ if (message.network_id != null && Object.hasOwnProperty.call(message, "network_id"))
774
+ if (!$util.isBytes(message.network_id))
775
+ return "network_id: buffer expected";
776
+ if (message.epoch != null && Object.hasOwnProperty.call(message, "epoch"))
777
+ if (!$util.isBytes(message.epoch))
778
+ return "epoch: buffer expected";
779
+ if (message.previous_epoch_record_hash != null && Object.hasOwnProperty.call(message, "previous_epoch_record_hash"))
780
+ if (!$util.isBytes(message.previous_epoch_record_hash))
781
+ return "previous_epoch_record_hash: buffer expected";
782
+ if (message.proposer != null && Object.hasOwnProperty.call(message, "proposer"))
783
+ if (!$util.isBytes(message.proposer))
784
+ return "proposer: buffer expected";
785
+ if (message.difficulty != null && Object.hasOwnProperty.call(message, "difficulty"))
786
+ if (!$util.isBytes(message.difficulty))
787
+ return "difficulty: buffer expected";
788
+ if (message.discriminant_bit_size != null && Object.hasOwnProperty.call(message, "discriminant_bit_size"))
789
+ if (!$util.isBytes(message.discriminant_bit_size))
790
+ return "discriminant_bit_size: buffer expected";
791
+ if (message.proof != null && Object.hasOwnProperty.call(message, "proof"))
792
+ if (!$util.isBytes(message.proof))
793
+ return "proof: buffer expected";
794
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
795
+ if (!$util.isBytes(message.signature))
796
+ return "signature: buffer expected";
797
+ return null;
798
+ };
799
+
800
+ /**
801
+ * Creates a ProofProposal message from a plain object. Also converts values to their respective internal types.
802
+ * @function fromObject
803
+ * @memberof consensus.v1.ProofProposal
804
+ * @static
805
+ * @param {Object.<string,*>} object Plain object
806
+ * @returns {consensus.v1.ProofProposal} ProofProposal
807
+ */
808
+ ProofProposal.fromObject = function fromObject(object, long) {
809
+ if (object instanceof $root.consensus.v1.ProofProposal)
810
+ object = Object.assign({}, object);
811
+ if (!$util.isObject(object))
812
+ throw TypeError(".consensus.v1.ProofProposal: object expected");
813
+ if (long === undefined)
814
+ long = 0;
815
+ if (long > $util.recursionLimit)
816
+ throw Error("maximum nesting depth exceeded");
817
+ var message = new $root.consensus.v1.ProofProposal();
818
+ if (object.network_id != null)
819
+ message.network_id = $util.bytesFrom(object.network_id);
820
+ if (object.epoch != null)
821
+ message.epoch = $util.bytesFrom(object.epoch);
822
+ if (object.previous_epoch_record_hash != null)
823
+ message.previous_epoch_record_hash = $util.bytesFrom(object.previous_epoch_record_hash);
824
+ if (object.proposer != null)
825
+ message.proposer = $util.bytesFrom(object.proposer);
826
+ if (object.difficulty != null)
827
+ message.difficulty = $util.bytesFrom(object.difficulty);
828
+ if (object.discriminant_bit_size != null)
829
+ message.discriminant_bit_size = $util.bytesFrom(object.discriminant_bit_size);
830
+ if (object.proof != null)
831
+ message.proof = $util.bytesFrom(object.proof);
832
+ if (object.signature != null)
833
+ message.signature = $util.bytesFrom(object.signature);
834
+ return message;
835
+ };
836
+
837
+ /**
838
+ * Creates a plain object from a ProofProposal message. Also converts values to other types if specified.
839
+ * @function toObject
840
+ * @memberof consensus.v1.ProofProposal
841
+ * @static
842
+ * @param {consensus.v1.ProofProposal} message ProofProposal
843
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
844
+ * @returns {Object.<string,*>} Plain object
845
+ */
846
+ ProofProposal.toObject = function toObject(message, options, q) {
847
+ if (!options)
848
+ options = {};
849
+ if (q === undefined)
850
+ q = 0;
851
+ if (q > $util.recursionLimit)
852
+ throw Error("max depth exceeded");
853
+ var object = {};
854
+ if (options.defaults) {
855
+ if (options.bytes === String)
856
+ object.network_id = "";
857
+ else {
858
+ object.network_id = [];
859
+ if (options.bytes !== Array)
860
+ object.network_id = $util.newBuffer(object.network_id);
861
+ }
862
+ if (options.bytes === String)
863
+ object.epoch = "";
864
+ else {
865
+ object.epoch = [];
866
+ if (options.bytes !== Array)
867
+ object.epoch = $util.newBuffer(object.epoch);
868
+ }
869
+ if (options.bytes === String)
870
+ object.previous_epoch_record_hash = "";
871
+ else {
872
+ object.previous_epoch_record_hash = [];
873
+ if (options.bytes !== Array)
874
+ object.previous_epoch_record_hash = $util.newBuffer(object.previous_epoch_record_hash);
875
+ }
876
+ if (options.bytes === String)
877
+ object.proposer = "";
878
+ else {
879
+ object.proposer = [];
880
+ if (options.bytes !== Array)
881
+ object.proposer = $util.newBuffer(object.proposer);
882
+ }
883
+ if (options.bytes === String)
884
+ object.difficulty = "";
885
+ else {
886
+ object.difficulty = [];
887
+ if (options.bytes !== Array)
888
+ object.difficulty = $util.newBuffer(object.difficulty);
889
+ }
890
+ if (options.bytes === String)
891
+ object.discriminant_bit_size = "";
892
+ else {
893
+ object.discriminant_bit_size = [];
894
+ if (options.bytes !== Array)
895
+ object.discriminant_bit_size = $util.newBuffer(object.discriminant_bit_size);
896
+ }
897
+ if (options.bytes === String)
898
+ object.proof = "";
899
+ else {
900
+ object.proof = [];
901
+ if (options.bytes !== Array)
902
+ object.proof = $util.newBuffer(object.proof);
903
+ }
904
+ if (options.bytes === String)
905
+ object.signature = "";
906
+ else {
907
+ object.signature = [];
908
+ if (options.bytes !== Array)
909
+ object.signature = $util.newBuffer(object.signature);
910
+ }
911
+ }
912
+ if (message.network_id != null && Object.hasOwnProperty.call(message, "network_id"))
913
+ object.network_id = $util.bytesTo(message.network_id, options);
914
+ if (message.epoch != null && Object.hasOwnProperty.call(message, "epoch"))
915
+ object.epoch = $util.bytesTo(message.epoch, options);
916
+ if (message.previous_epoch_record_hash != null && Object.hasOwnProperty.call(message, "previous_epoch_record_hash"))
917
+ object.previous_epoch_record_hash = $util.bytesTo(message.previous_epoch_record_hash, options);
918
+ if (message.proposer != null && Object.hasOwnProperty.call(message, "proposer"))
919
+ object.proposer = $util.bytesTo(message.proposer, options);
920
+ if (message.difficulty != null && Object.hasOwnProperty.call(message, "difficulty"))
921
+ object.difficulty = $util.bytesTo(message.difficulty, options);
922
+ if (message.discriminant_bit_size != null && Object.hasOwnProperty.call(message, "discriminant_bit_size"))
923
+ object.discriminant_bit_size = $util.bytesTo(message.discriminant_bit_size, options);
924
+ if (message.proof != null && Object.hasOwnProperty.call(message, "proof"))
925
+ object.proof = $util.bytesTo(message.proof, options);
926
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
927
+ object.signature = $util.bytesTo(message.signature, options);
928
+ return object;
929
+ };
930
+
931
+ /**
932
+ * Converts this ProofProposal to JSON.
933
+ * @function toJSON
934
+ * @memberof consensus.v1.ProofProposal
935
+ * @instance
936
+ * @returns {Object.<string,*>} JSON object
937
+ */
938
+ ProofProposal.prototype.toJSON = function toJSON() {
939
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
940
+ };
941
+
942
+ /**
943
+ * Gets the default type url for ProofProposal
944
+ * @function getTypeUrl
945
+ * @memberof consensus.v1.ProofProposal
946
+ * @static
947
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
948
+ * @returns {string} The default type url
949
+ */
950
+ ProofProposal.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
951
+ if (typeUrlPrefix === undefined) {
952
+ typeUrlPrefix = "type.googleapis.com";
953
+ }
954
+ return typeUrlPrefix + "/consensus.v1.ProofProposal";
955
+ };
956
+
957
+ return ProofProposal;
958
+ })();
959
+
960
+ v1.ProofProposalResponse = (function() {
961
+
962
+ /**
963
+ * Properties of a ProofProposalResponse.
964
+ * @memberof consensus.v1
965
+ * @interface IProofProposalResponse
966
+ * @property {common.v1.ResultCode|null} [result] ProofProposalResponse result
967
+ * @property {consensus.v1.IProofProposalApproval|null} [approval] ProofProposalResponse approval
968
+ * @property {B4aBuffer|null} [response_sig] ProofProposalResponse response_sig
969
+ */
970
+
971
+ /**
972
+ * Constructs a new ProofProposalResponse.
973
+ * @memberof consensus.v1
974
+ * @classdesc Represents a ProofProposalResponse.
975
+ * @implements IProofProposalResponse
976
+ * @constructor
977
+ * @param {consensus.v1.IProofProposalResponse=} [properties] Properties to set
978
+ */
979
+ function ProofProposalResponse(properties) {
980
+ if (properties)
981
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
982
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
983
+ this[keys[i]] = properties[keys[i]];
984
+ }
985
+
986
+ /**
987
+ * ProofProposalResponse result.
988
+ * @member {common.v1.ResultCode} result
989
+ * @memberof consensus.v1.ProofProposalResponse
990
+ * @instance
991
+ */
992
+ ProofProposalResponse.prototype.result = 0;
993
+
994
+ /**
995
+ * ProofProposalResponse approval.
996
+ * @member {consensus.v1.IProofProposalApproval|null|undefined} approval
997
+ * @memberof consensus.v1.ProofProposalResponse
998
+ * @instance
999
+ */
1000
+ ProofProposalResponse.prototype.approval = null;
1001
+
1002
+ /**
1003
+ * ProofProposalResponse response_sig.
1004
+ * @member {B4aBuffer} response_sig
1005
+ * @memberof consensus.v1.ProofProposalResponse
1006
+ * @instance
1007
+ */
1008
+ ProofProposalResponse.prototype.response_sig = $util.newBuffer([]);
1009
+
1010
+ /**
1011
+ * Creates a new ProofProposalResponse instance using the specified properties.
1012
+ * @function create
1013
+ * @memberof consensus.v1.ProofProposalResponse
1014
+ * @static
1015
+ * @param {consensus.v1.IProofProposalResponse=} [properties] Properties to set
1016
+ * @returns {consensus.v1.ProofProposalResponse} ProofProposalResponse instance
1017
+ */
1018
+ ProofProposalResponse.create = function create(properties) {
1019
+ return new ProofProposalResponse(properties);
1020
+ };
1021
+
1022
+ /**
1023
+ * Encodes the specified ProofProposalResponse message. Does not implicitly {@link consensus.v1.ProofProposalResponse.verify|verify} messages.
1024
+ * @function encode
1025
+ * @memberof consensus.v1.ProofProposalResponse
1026
+ * @static
1027
+ * @param {consensus.v1.IProofProposalResponse} message ProofProposalResponse message or plain object to encode
1028
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1029
+ * @returns {$protobuf.Writer} Writer
1030
+ */
1031
+ ProofProposalResponse.encode = function encode(message, writer, q) {
1032
+ writer = $Writer.create(writer);
1033
+ if (q === undefined)
1034
+ q = 0;
1035
+ if (q > $util.recursionLimit)
1036
+ throw Error("max depth exceeded");
1037
+ if (message.result != null && Object.hasOwnProperty.call(message, "result"))
1038
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.result);
1039
+ if (message.approval != null && Object.hasOwnProperty.call(message, "approval"))
1040
+ $root.consensus.v1.ProofProposalApproval.encode(message.approval, writer.uint32(/* id 2, wireType 2 =*/18).fork(), q + 1).ldelim();
1041
+ if (message.response_sig != null && Object.hasOwnProperty.call(message, "response_sig"))
1042
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.response_sig);
1043
+ return writer;
1044
+ };
1045
+
1046
+ /**
1047
+ * Encodes the specified ProofProposalResponse message, length delimited. Does not implicitly {@link consensus.v1.ProofProposalResponse.verify|verify} messages.
1048
+ * @function encodeDelimited
1049
+ * @memberof consensus.v1.ProofProposalResponse
1050
+ * @static
1051
+ * @param {consensus.v1.IProofProposalResponse} message ProofProposalResponse message or plain object to encode
1052
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1053
+ * @returns {$protobuf.Writer} Writer
1054
+ */
1055
+ ProofProposalResponse.encodeDelimited = function encodeDelimited(message, writer) {
1056
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
1057
+ };
1058
+
1059
+ /**
1060
+ * Decodes a ProofProposalResponse message from the specified reader or buffer.
1061
+ * @function decode
1062
+ * @memberof consensus.v1.ProofProposalResponse
1063
+ * @static
1064
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
1065
+ * @param {number} [length] Message length if known beforehand
1066
+ * @returns {consensus.v1.ProofProposalResponse} ProofProposalResponse
1067
+ * @throws {Error} If the payload is not a reader or valid buffer
1068
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1069
+ */
1070
+ ProofProposalResponse.decode = function decode(reader, length, error, long) {
1071
+ reader = $Reader.create(reader);
1072
+ if (long === undefined)
1073
+ long = 0;
1074
+ if (long > $Reader.recursionLimit)
1075
+ throw Error("maximum nesting depth exceeded");
1076
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.consensus.v1.ProofProposalResponse();
1077
+ while (reader.pos < end) {
1078
+ var tag = reader.uint32();
1079
+ if (tag === error)
1080
+ break;
1081
+ switch (tag >>> 3) {
1082
+ case 1: {
1083
+ message.result = reader.int32();
1084
+ break;
1085
+ }
1086
+ case 2: {
1087
+ message.approval = $root.consensus.v1.ProofProposalApproval.decode(reader, reader.uint32(), undefined, long + 1);
1088
+ break;
1089
+ }
1090
+ case 3: {
1091
+ message.response_sig = $util.bytesFrom(reader.bytes());
1092
+ break;
1093
+ }
1094
+ default:
1095
+ reader.skipType(tag & 7, long);
1096
+ break;
1097
+ }
1098
+ }
1099
+ return message;
1100
+ };
1101
+
1102
+ /**
1103
+ * Decodes a ProofProposalResponse message from the specified reader or buffer, length delimited.
1104
+ * @function decodeDelimited
1105
+ * @memberof consensus.v1.ProofProposalResponse
1106
+ * @static
1107
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
1108
+ * @returns {consensus.v1.ProofProposalResponse} ProofProposalResponse
1109
+ * @throws {Error} If the payload is not a reader or valid buffer
1110
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1111
+ */
1112
+ ProofProposalResponse.decodeDelimited = function decodeDelimited(reader) {
1113
+ reader = $Reader.create(reader);
1114
+ return this.decode(reader, reader.uint32());
1115
+ };
1116
+
1117
+ /**
1118
+ * Verifies a ProofProposalResponse message.
1119
+ * @function verify
1120
+ * @memberof consensus.v1.ProofProposalResponse
1121
+ * @static
1122
+ * @param {Object.<string,*>} message Plain object to verify
1123
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1124
+ */
1125
+ ProofProposalResponse.verify = function verify(message, long) {
1126
+ if (typeof message !== "object" || message === null)
1127
+ return "object expected";
1128
+ if (long === undefined)
1129
+ long = 0;
1130
+ if (long > $util.recursionLimit)
1131
+ return "maximum nesting depth exceeded";
1132
+ if (message.result != null && Object.hasOwnProperty.call(message, "result"))
1133
+ switch (message.result) {
1134
+ default:
1135
+ return "result: enum value expected";
1136
+ case 0:
1137
+ case 1:
1138
+ case 2:
1139
+ case 3:
1140
+ case 4:
1141
+ case 5:
1142
+ case 6:
1143
+ case 7:
1144
+ case 8:
1145
+ case 9:
1146
+ case 10:
1147
+ case 11:
1148
+ case 12:
1149
+ case 13:
1150
+ case 14:
1151
+ case 15:
1152
+ case 16:
1153
+ case 17:
1154
+ case 18:
1155
+ case 19:
1156
+ case 20:
1157
+ case 21:
1158
+ case 22:
1159
+ case 23:
1160
+ case 24:
1161
+ case 25:
1162
+ case 26:
1163
+ case 27:
1164
+ case 28:
1165
+ case 29:
1166
+ case 30:
1167
+ case 31:
1168
+ case 32:
1169
+ case 33:
1170
+ case 34:
1171
+ case 35:
1172
+ case 36:
1173
+ case 37:
1174
+ case 38:
1175
+ case 39:
1176
+ case 40:
1177
+ case 41:
1178
+ case 42:
1179
+ case 43:
1180
+ case 44:
1181
+ case 45:
1182
+ case 46:
1183
+ case 47:
1184
+ case 48:
1185
+ case 49:
1186
+ case 50:
1187
+ case 51:
1188
+ case 52:
1189
+ case 53:
1190
+ case 54:
1191
+ case 55:
1192
+ case 56:
1193
+ case 57:
1194
+ case 58:
1195
+ case 59:
1196
+ case 60:
1197
+ case 61:
1198
+ case 100:
1199
+ case 101:
1200
+ case 102:
1201
+ case 103:
1202
+ case 104:
1203
+ case 105:
1204
+ case 106:
1205
+ case 107:
1206
+ case 108:
1207
+ case 109:
1208
+ case 110:
1209
+ case 111:
1210
+ case 112:
1211
+ case 113:
1212
+ case 114:
1213
+ break;
1214
+ }
1215
+ if (message.approval != null && Object.hasOwnProperty.call(message, "approval")) {
1216
+ var error = $root.consensus.v1.ProofProposalApproval.verify(message.approval, long + 1);
1217
+ if (error)
1218
+ return "approval." + error;
1219
+ }
1220
+ if (message.response_sig != null && Object.hasOwnProperty.call(message, "response_sig"))
1221
+ if (!$util.isBytes(message.response_sig))
1222
+ return "response_sig: buffer expected";
1223
+ return null;
1224
+ };
1225
+
1226
+ /**
1227
+ * Creates a ProofProposalResponse message from a plain object. Also converts values to their respective internal types.
1228
+ * @function fromObject
1229
+ * @memberof consensus.v1.ProofProposalResponse
1230
+ * @static
1231
+ * @param {Object.<string,*>} object Plain object
1232
+ * @returns {consensus.v1.ProofProposalResponse} ProofProposalResponse
1233
+ */
1234
+ ProofProposalResponse.fromObject = function fromObject(object, long) {
1235
+ if (object instanceof $root.consensus.v1.ProofProposalResponse)
1236
+ object = Object.assign({}, object);
1237
+ if (!$util.isObject(object))
1238
+ throw TypeError(".consensus.v1.ProofProposalResponse: object expected");
1239
+ if (long === undefined)
1240
+ long = 0;
1241
+ if (long > $util.recursionLimit)
1242
+ throw Error("maximum nesting depth exceeded");
1243
+ var message = new $root.consensus.v1.ProofProposalResponse();
1244
+ switch (object.result) {
1245
+ default:
1246
+ if (typeof object.result === "number") {
1247
+ message.result = object.result;
1248
+ break;
1249
+ }
1250
+ break;
1251
+ case "RESULT_CODE_UNSPECIFIED":
1252
+ case 0:
1253
+ message.result = 0;
1254
+ break;
1255
+ case "RESULT_CODE_OK":
1256
+ case 1:
1257
+ message.result = 1;
1258
+ break;
1259
+ case "RESULT_CODE_INVALID_PAYLOAD":
1260
+ case 2:
1261
+ message.result = 2;
1262
+ break;
1263
+ case "RESULT_CODE_RATE_LIMITED":
1264
+ case 3:
1265
+ message.result = 3;
1266
+ break;
1267
+ case "RESULT_CODE_SIGNATURE_INVALID":
1268
+ case 4:
1269
+ message.result = 4;
1270
+ break;
1271
+ case "RESULT_CODE_UNEXPECTED_ERROR":
1272
+ case 5:
1273
+ message.result = 5;
1274
+ break;
1275
+ case "RESULT_CODE_TIMEOUT":
1276
+ case 6:
1277
+ message.result = 6;
1278
+ break;
1279
+ case "RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS":
1280
+ case 7:
1281
+ message.result = 7;
1282
+ break;
1283
+ case "RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE":
1284
+ case 8:
1285
+ message.result = 8;
1286
+ break;
1287
+ case "RESULT_CODE_NODE_OVERLOADED":
1288
+ case 9:
1289
+ message.result = 9;
1290
+ break;
1291
+ case "RESULT_CODE_TX_ALREADY_PENDING":
1292
+ case 10:
1293
+ message.result = 10;
1294
+ break;
1295
+ case "RESULT_CODE_OPERATION_TYPE_UNKNOWN":
1296
+ case 11:
1297
+ message.result = 11;
1298
+ break;
1299
+ case "RESULT_CODE_SCHEMA_VALIDATION_FAILED":
1300
+ case 12:
1301
+ message.result = 12;
1302
+ break;
1303
+ case "RESULT_CODE_REQUESTER_ADDRESS_INVALID":
1304
+ case 13:
1305
+ message.result = 13;
1306
+ break;
1307
+ case "RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID":
1308
+ case 14:
1309
+ message.result = 14;
1310
+ break;
1311
+ case "RESULT_CODE_TX_HASH_MISMATCH":
1312
+ case 15:
1313
+ message.result = 15;
1314
+ break;
1315
+ case "RESULT_CODE_TX_SIGNATURE_INVALID":
1316
+ case 16:
1317
+ message.result = 16;
1318
+ break;
1319
+ case "RESULT_CODE_TX_EXPIRED":
1320
+ case 17:
1321
+ message.result = 17;
1322
+ break;
1323
+ case "RESULT_CODE_TX_ALREADY_EXISTS":
1324
+ case 18:
1325
+ message.result = 18;
1326
+ break;
1327
+ case "RESULT_CODE_OPERATION_ALREADY_COMPLETED":
1328
+ case 19:
1329
+ message.result = 19;
1330
+ break;
1331
+ case "RESULT_CODE_REQUESTER_NOT_FOUND":
1332
+ case 20:
1333
+ message.result = 20;
1334
+ break;
1335
+ case "RESULT_CODE_INSUFFICIENT_FEE_BALANCE":
1336
+ case 21:
1337
+ message.result = 21;
1338
+ break;
1339
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP":
1340
+ case 22:
1341
+ message.result = 22;
1342
+ break;
1343
+ case "RESULT_CODE_SELF_VALIDATION_FORBIDDEN":
1344
+ case 23:
1345
+ message.result = 23;
1346
+ break;
1347
+ case "RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND":
1348
+ case 24:
1349
+ message.result = 24;
1350
+ break;
1351
+ case "RESULT_CODE_ROLE_NODE_ALREADY_WRITER":
1352
+ case 25:
1353
+ message.result = 25;
1354
+ break;
1355
+ case "RESULT_CODE_ROLE_NODE_NOT_WHITELISTED":
1356
+ case 26:
1357
+ message.result = 26;
1358
+ break;
1359
+ case "RESULT_CODE_ROLE_NODE_NOT_WRITER":
1360
+ case 27:
1361
+ message.result = 27;
1362
+ break;
1363
+ case "RESULT_CODE_ROLE_NODE_IS_INDEXER":
1364
+ case 28:
1365
+ message.result = 28;
1366
+ break;
1367
+ case "RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING":
1368
+ case 29:
1369
+ message.result = 29;
1370
+ break;
1371
+ case "RESULT_CODE_ROLE_INVALID_RECOVERY_CASE":
1372
+ case 30:
1373
+ message.result = 30;
1374
+ break;
1375
+ case "RESULT_CODE_ROLE_UNKNOWN_OPERATION":
1376
+ case 31:
1377
+ message.result = 31;
1378
+ break;
1379
+ case "RESULT_CODE_ROLE_INVALID_WRITER_KEY":
1380
+ case 32:
1381
+ message.result = 32;
1382
+ break;
1383
+ case "RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE":
1384
+ case 33:
1385
+ message.result = 33;
1386
+ break;
1387
+ case "RESULT_CODE_MSB_BOOTSTRAP_MISMATCH":
1388
+ case 34:
1389
+ message.result = 34;
1390
+ break;
1391
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED":
1392
+ case 35:
1393
+ message.result = 35;
1394
+ break;
1395
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING":
1396
+ case 36:
1397
+ message.result = 36;
1398
+ break;
1399
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH":
1400
+ case 37:
1401
+ message.result = 37;
1402
+ break;
1403
+ case "RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS":
1404
+ case 38:
1405
+ message.result = 38;
1406
+ break;
1407
+ case "RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID":
1408
+ case 39:
1409
+ message.result = 39;
1410
+ break;
1411
+ case "RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID":
1412
+ case 40:
1413
+ message.result = 40;
1414
+ break;
1415
+ case "RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE":
1416
+ case 41:
1417
+ message.result = 41;
1418
+ break;
1419
+ case "RESULT_CODE_TRANSFER_SENDER_NOT_FOUND":
1420
+ case 42:
1421
+ message.result = 42;
1422
+ break;
1423
+ case "RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE":
1424
+ case 43:
1425
+ message.result = 43;
1426
+ break;
1427
+ case "RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW":
1428
+ case 44:
1429
+ message.result = 44;
1430
+ break;
1431
+ case "RESULT_CODE_TX_HASH_INVALID_FORMAT":
1432
+ case 45:
1433
+ message.result = 45;
1434
+ break;
1435
+ case "RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED":
1436
+ case 46:
1437
+ message.result = 46;
1438
+ break;
1439
+ case "RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING":
1440
+ case 47:
1441
+ message.result = 47;
1442
+ break;
1443
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID":
1444
+ case 48:
1445
+ message.result = 48;
1446
+ break;
1447
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN":
1448
+ case 49:
1449
+ message.result = 49;
1450
+ break;
1451
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED":
1452
+ case 50:
1453
+ message.result = 50;
1454
+ break;
1455
+ case "RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID":
1456
+ case 51:
1457
+ message.result = 51;
1458
+ break;
1459
+ case "RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA":
1460
+ case 52:
1461
+ message.result = 52;
1462
+ break;
1463
+ case "RESULT_CODE_PROOF_PAYLOAD_MISMATCH":
1464
+ case 53:
1465
+ message.result = 53;
1466
+ break;
1467
+ case "RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED":
1468
+ case 54:
1469
+ message.result = 54;
1470
+ break;
1471
+ case "RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH":
1472
+ case 55:
1473
+ message.result = 55;
1474
+ break;
1475
+ case "RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND":
1476
+ case 56:
1477
+ message.result = 56;
1478
+ break;
1479
+ case "RESULT_CODE_VALIDATOR_NODE_NOT_WRITER":
1480
+ case 57:
1481
+ message.result = 57;
1482
+ break;
1483
+ case "RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH":
1484
+ case 58:
1485
+ message.result = 58;
1486
+ break;
1487
+ case "RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID":
1488
+ case 59:
1489
+ message.result = 59;
1490
+ break;
1491
+ case "RESULT_CODE_VALIDATOR_VA_MISSING":
1492
+ case 60:
1493
+ message.result = 60;
1494
+ break;
1495
+ case "RESULT_CODE_TX_INVALID_PAYLOAD":
1496
+ case 61:
1497
+ message.result = 61;
1498
+ break;
1499
+ case "RESULT_CODE_CONSENSUS_SCHEMA_VALIDATION_FAILED":
1500
+ case 100:
1501
+ message.result = 100;
1502
+ break;
1503
+ case "RESULT_CODE_CONSENSUS_BAD_PROTOCOL_VERSION":
1504
+ case 101:
1505
+ message.result = 101;
1506
+ break;
1507
+ case "RESULT_CODE_CONSENSUS_WRONG_NETWORK_ID":
1508
+ case 102:
1509
+ message.result = 102;
1510
+ break;
1511
+ case "RESULT_CODE_CONSENSUS_CONFIG_MISMATCH":
1512
+ case 103:
1513
+ message.result = 103;
1514
+ break;
1515
+ case "RESULT_CODE_CONSENSUS_VDF_PROOF_INVALID":
1516
+ case 104:
1517
+ message.result = 104;
1518
+ break;
1519
+ case "RESULT_CODE_CONSENSUS_ADDRESS_INVALID":
1520
+ case 105:
1521
+ message.result = 105;
1522
+ break;
1523
+ case "RESULT_CODE_CONSENSUS_PUBLIC_KEY_MISMATCH":
1524
+ case 106:
1525
+ message.result = 106;
1526
+ break;
1527
+ case "RESULT_CODE_CONSENSUS_PROPOSAL_SIGNATURE_INVALID":
1528
+ case 107:
1529
+ message.result = 107;
1530
+ break;
1531
+ case "RESULT_CODE_CONSENSUS_RESPONSE_SIGNATURE_INVALID":
1532
+ case 108:
1533
+ message.result = 108;
1534
+ break;
1535
+ case "RESULT_CODE_CONSENSUS_APPROVAL_SIGNATURE_INVALID":
1536
+ case 109:
1537
+ message.result = 109;
1538
+ break;
1539
+ case "RESULT_CODE_CONSENSUS_OPERATION_TYPE_INVALID":
1540
+ case 110:
1541
+ message.result = 110;
1542
+ break;
1543
+ case "RESULT_CODE_CONSENSUS_RESPONSE_APPROVAL_INVALID":
1544
+ case 111:
1545
+ message.result = 111;
1546
+ break;
1547
+ case "RESULT_CODE_CONSENSUS_EPOCH_INVALID":
1548
+ case 112:
1549
+ message.result = 112;
1550
+ break;
1551
+ case "RESULT_CODE_CONSENSUS_PREVIOUS_EPOCH_RECORD_HASH_INVALID":
1552
+ case 113:
1553
+ message.result = 113;
1554
+ break;
1555
+ case "RESULT_CODE_CONSENSUS_INDEXER_ROLE_INVALID":
1556
+ case 114:
1557
+ message.result = 114;
1558
+ break;
1559
+ }
1560
+ if (object.approval != null) {
1561
+ if (!$util.isObject(object.approval))
1562
+ throw TypeError(".consensus.v1.ProofProposalResponse.approval: object expected");
1563
+ message.approval = $root.consensus.v1.ProofProposalApproval.fromObject(object.approval, long + 1);
1564
+ }
1565
+ if (object.response_sig != null)
1566
+ message.response_sig = $util.bytesFrom(object.response_sig);
1567
+ return message;
1568
+ };
1569
+
1570
+ /**
1571
+ * Creates a plain object from a ProofProposalResponse message. Also converts values to other types if specified.
1572
+ * @function toObject
1573
+ * @memberof consensus.v1.ProofProposalResponse
1574
+ * @static
1575
+ * @param {consensus.v1.ProofProposalResponse} message ProofProposalResponse
1576
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1577
+ * @returns {Object.<string,*>} Plain object
1578
+ */
1579
+ ProofProposalResponse.toObject = function toObject(message, options, q) {
1580
+ if (!options)
1581
+ options = {};
1582
+ if (q === undefined)
1583
+ q = 0;
1584
+ if (q > $util.recursionLimit)
1585
+ throw Error("max depth exceeded");
1586
+ var object = {};
1587
+ if (options.defaults) {
1588
+ object.result = options.enums === String ? "RESULT_CODE_UNSPECIFIED" : 0;
1589
+ object.approval = null;
1590
+ if (options.bytes === String)
1591
+ object.response_sig = "";
1592
+ else {
1593
+ object.response_sig = [];
1594
+ if (options.bytes !== Array)
1595
+ object.response_sig = $util.newBuffer(object.response_sig);
1596
+ }
1597
+ }
1598
+ if (message.result != null && Object.hasOwnProperty.call(message, "result"))
1599
+ object.result = options.enums === String ? $root.common.v1.ResultCode[message.result] === undefined ? message.result : $root.common.v1.ResultCode[message.result] : message.result;
1600
+ if (message.approval != null && Object.hasOwnProperty.call(message, "approval"))
1601
+ object.approval = $root.consensus.v1.ProofProposalApproval.toObject(message.approval, options, q + 1);
1602
+ if (message.response_sig != null && Object.hasOwnProperty.call(message, "response_sig"))
1603
+ object.response_sig = $util.bytesTo(message.response_sig, options);
1604
+ return object;
1605
+ };
1606
+
1607
+ /**
1608
+ * Converts this ProofProposalResponse to JSON.
1609
+ * @function toJSON
1610
+ * @memberof consensus.v1.ProofProposalResponse
1611
+ * @instance
1612
+ * @returns {Object.<string,*>} JSON object
1613
+ */
1614
+ ProofProposalResponse.prototype.toJSON = function toJSON() {
1615
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1616
+ };
1617
+
1618
+ /**
1619
+ * Gets the default type url for ProofProposalResponse
1620
+ * @function getTypeUrl
1621
+ * @memberof consensus.v1.ProofProposalResponse
1622
+ * @static
1623
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1624
+ * @returns {string} The default type url
1625
+ */
1626
+ ProofProposalResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1627
+ if (typeUrlPrefix === undefined) {
1628
+ typeUrlPrefix = "type.googleapis.com";
1629
+ }
1630
+ return typeUrlPrefix + "/consensus.v1.ProofProposalResponse";
1631
+ };
1632
+
1633
+ return ProofProposalResponse;
1634
+ })();
1635
+
1636
+ v1.ProofProposalApproval = (function() {
1637
+
1638
+ /**
1639
+ * Properties of a ProofProposalApproval.
1640
+ * @memberof consensus.v1
1641
+ * @interface IProofProposalApproval
1642
+ * @property {B4aBuffer|null} [approver] ProofProposalApproval approver
1643
+ * @property {B4aBuffer|null} [approval_sig] ProofProposalApproval approval_sig
1644
+ */
1645
+
1646
+ /**
1647
+ * Constructs a new ProofProposalApproval.
1648
+ * @memberof consensus.v1
1649
+ * @classdesc Represents a ProofProposalApproval.
1650
+ * @implements IProofProposalApproval
1651
+ * @constructor
1652
+ * @param {consensus.v1.IProofProposalApproval=} [properties] Properties to set
1653
+ */
1654
+ function ProofProposalApproval(properties) {
1655
+ if (properties)
1656
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1657
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
1658
+ this[keys[i]] = properties[keys[i]];
1659
+ }
1660
+
1661
+ /**
1662
+ * ProofProposalApproval approver.
1663
+ * @member {B4aBuffer} approver
1664
+ * @memberof consensus.v1.ProofProposalApproval
1665
+ * @instance
1666
+ */
1667
+ ProofProposalApproval.prototype.approver = $util.newBuffer([]);
1668
+
1669
+ /**
1670
+ * ProofProposalApproval approval_sig.
1671
+ * @member {B4aBuffer} approval_sig
1672
+ * @memberof consensus.v1.ProofProposalApproval
1673
+ * @instance
1674
+ */
1675
+ ProofProposalApproval.prototype.approval_sig = $util.newBuffer([]);
1676
+
1677
+ /**
1678
+ * Creates a new ProofProposalApproval instance using the specified properties.
1679
+ * @function create
1680
+ * @memberof consensus.v1.ProofProposalApproval
1681
+ * @static
1682
+ * @param {consensus.v1.IProofProposalApproval=} [properties] Properties to set
1683
+ * @returns {consensus.v1.ProofProposalApproval} ProofProposalApproval instance
1684
+ */
1685
+ ProofProposalApproval.create = function create(properties) {
1686
+ return new ProofProposalApproval(properties);
1687
+ };
1688
+
1689
+ /**
1690
+ * Encodes the specified ProofProposalApproval message. Does not implicitly {@link consensus.v1.ProofProposalApproval.verify|verify} messages.
1691
+ * @function encode
1692
+ * @memberof consensus.v1.ProofProposalApproval
1693
+ * @static
1694
+ * @param {consensus.v1.IProofProposalApproval} message ProofProposalApproval message or plain object to encode
1695
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1696
+ * @returns {$protobuf.Writer} Writer
1697
+ */
1698
+ ProofProposalApproval.encode = function encode(message, writer, q) {
1699
+ writer = $Writer.create(writer);
1700
+ if (q === undefined)
1701
+ q = 0;
1702
+ if (q > $util.recursionLimit)
1703
+ throw Error("max depth exceeded");
1704
+ if (message.approver != null && Object.hasOwnProperty.call(message, "approver"))
1705
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.approver);
1706
+ if (message.approval_sig != null && Object.hasOwnProperty.call(message, "approval_sig"))
1707
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.approval_sig);
1708
+ return writer;
1709
+ };
1710
+
1711
+ /**
1712
+ * Encodes the specified ProofProposalApproval message, length delimited. Does not implicitly {@link consensus.v1.ProofProposalApproval.verify|verify} messages.
1713
+ * @function encodeDelimited
1714
+ * @memberof consensus.v1.ProofProposalApproval
1715
+ * @static
1716
+ * @param {consensus.v1.IProofProposalApproval} message ProofProposalApproval message or plain object to encode
1717
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1718
+ * @returns {$protobuf.Writer} Writer
1719
+ */
1720
+ ProofProposalApproval.encodeDelimited = function encodeDelimited(message, writer) {
1721
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
1722
+ };
1723
+
1724
+ /**
1725
+ * Decodes a ProofProposalApproval message from the specified reader or buffer.
1726
+ * @function decode
1727
+ * @memberof consensus.v1.ProofProposalApproval
1728
+ * @static
1729
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
1730
+ * @param {number} [length] Message length if known beforehand
1731
+ * @returns {consensus.v1.ProofProposalApproval} ProofProposalApproval
1732
+ * @throws {Error} If the payload is not a reader or valid buffer
1733
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1734
+ */
1735
+ ProofProposalApproval.decode = function decode(reader, length, error, long) {
1736
+ reader = $Reader.create(reader);
1737
+ if (long === undefined)
1738
+ long = 0;
1739
+ if (long > $Reader.recursionLimit)
1740
+ throw Error("maximum nesting depth exceeded");
1741
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.consensus.v1.ProofProposalApproval();
1742
+ while (reader.pos < end) {
1743
+ var tag = reader.uint32();
1744
+ if (tag === error)
1745
+ break;
1746
+ switch (tag >>> 3) {
1747
+ case 1: {
1748
+ message.approver = $util.bytesFrom(reader.bytes());
1749
+ break;
1750
+ }
1751
+ case 2: {
1752
+ message.approval_sig = $util.bytesFrom(reader.bytes());
1753
+ break;
1754
+ }
1755
+ default:
1756
+ reader.skipType(tag & 7, long);
1757
+ break;
1758
+ }
1759
+ }
1760
+ return message;
1761
+ };
1762
+
1763
+ /**
1764
+ * Decodes a ProofProposalApproval message from the specified reader or buffer, length delimited.
1765
+ * @function decodeDelimited
1766
+ * @memberof consensus.v1.ProofProposalApproval
1767
+ * @static
1768
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
1769
+ * @returns {consensus.v1.ProofProposalApproval} ProofProposalApproval
1770
+ * @throws {Error} If the payload is not a reader or valid buffer
1771
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1772
+ */
1773
+ ProofProposalApproval.decodeDelimited = function decodeDelimited(reader) {
1774
+ reader = $Reader.create(reader);
1775
+ return this.decode(reader, reader.uint32());
1776
+ };
1777
+
1778
+ /**
1779
+ * Verifies a ProofProposalApproval message.
1780
+ * @function verify
1781
+ * @memberof consensus.v1.ProofProposalApproval
1782
+ * @static
1783
+ * @param {Object.<string,*>} message Plain object to verify
1784
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1785
+ */
1786
+ ProofProposalApproval.verify = function verify(message, long) {
1787
+ if (typeof message !== "object" || message === null)
1788
+ return "object expected";
1789
+ if (long === undefined)
1790
+ long = 0;
1791
+ if (long > $util.recursionLimit)
1792
+ return "maximum nesting depth exceeded";
1793
+ if (message.approver != null && Object.hasOwnProperty.call(message, "approver"))
1794
+ if (!$util.isBytes(message.approver))
1795
+ return "approver: buffer expected";
1796
+ if (message.approval_sig != null && Object.hasOwnProperty.call(message, "approval_sig"))
1797
+ if (!$util.isBytes(message.approval_sig))
1798
+ return "approval_sig: buffer expected";
1799
+ return null;
1800
+ };
1801
+
1802
+ /**
1803
+ * Creates a ProofProposalApproval message from a plain object. Also converts values to their respective internal types.
1804
+ * @function fromObject
1805
+ * @memberof consensus.v1.ProofProposalApproval
1806
+ * @static
1807
+ * @param {Object.<string,*>} object Plain object
1808
+ * @returns {consensus.v1.ProofProposalApproval} ProofProposalApproval
1809
+ */
1810
+ ProofProposalApproval.fromObject = function fromObject(object, long) {
1811
+ if (object instanceof $root.consensus.v1.ProofProposalApproval)
1812
+ object = Object.assign({}, object);
1813
+ if (!$util.isObject(object))
1814
+ throw TypeError(".consensus.v1.ProofProposalApproval: object expected");
1815
+ if (long === undefined)
1816
+ long = 0;
1817
+ if (long > $util.recursionLimit)
1818
+ throw Error("maximum nesting depth exceeded");
1819
+ var message = new $root.consensus.v1.ProofProposalApproval();
1820
+ if (object.approver != null)
1821
+ message.approver = $util.bytesFrom(object.approver);
1822
+ if (object.approval_sig != null)
1823
+ message.approval_sig = $util.bytesFrom(object.approval_sig);
1824
+ return message;
1825
+ };
1826
+
1827
+ /**
1828
+ * Creates a plain object from a ProofProposalApproval message. Also converts values to other types if specified.
1829
+ * @function toObject
1830
+ * @memberof consensus.v1.ProofProposalApproval
1831
+ * @static
1832
+ * @param {consensus.v1.ProofProposalApproval} message ProofProposalApproval
1833
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1834
+ * @returns {Object.<string,*>} Plain object
1835
+ */
1836
+ ProofProposalApproval.toObject = function toObject(message, options, q) {
1837
+ if (!options)
1838
+ options = {};
1839
+ if (q === undefined)
1840
+ q = 0;
1841
+ if (q > $util.recursionLimit)
1842
+ throw Error("max depth exceeded");
1843
+ var object = {};
1844
+ if (options.defaults) {
1845
+ if (options.bytes === String)
1846
+ object.approver = "";
1847
+ else {
1848
+ object.approver = [];
1849
+ if (options.bytes !== Array)
1850
+ object.approver = $util.newBuffer(object.approver);
1851
+ }
1852
+ if (options.bytes === String)
1853
+ object.approval_sig = "";
1854
+ else {
1855
+ object.approval_sig = [];
1856
+ if (options.bytes !== Array)
1857
+ object.approval_sig = $util.newBuffer(object.approval_sig);
1858
+ }
1859
+ }
1860
+ if (message.approver != null && Object.hasOwnProperty.call(message, "approver"))
1861
+ object.approver = $util.bytesTo(message.approver, options);
1862
+ if (message.approval_sig != null && Object.hasOwnProperty.call(message, "approval_sig"))
1863
+ object.approval_sig = $util.bytesTo(message.approval_sig, options);
1864
+ return object;
1865
+ };
1866
+
1867
+ /**
1868
+ * Converts this ProofProposalApproval to JSON.
1869
+ * @function toJSON
1870
+ * @memberof consensus.v1.ProofProposalApproval
1871
+ * @instance
1872
+ * @returns {Object.<string,*>} JSON object
1873
+ */
1874
+ ProofProposalApproval.prototype.toJSON = function toJSON() {
1875
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1876
+ };
1877
+
1878
+ /**
1879
+ * Gets the default type url for ProofProposalApproval
1880
+ * @function getTypeUrl
1881
+ * @memberof consensus.v1.ProofProposalApproval
1882
+ * @static
1883
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1884
+ * @returns {string} The default type url
1885
+ */
1886
+ ProofProposalApproval.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1887
+ if (typeUrlPrefix === undefined) {
1888
+ typeUrlPrefix = "type.googleapis.com";
1889
+ }
1890
+ return typeUrlPrefix + "/consensus.v1.ProofProposalApproval";
1891
+ };
1892
+
1893
+ return ProofProposalApproval;
1894
+ })();
1895
+
1896
+ v1.EpochAppendIntent = (function() {
1897
+
1898
+ /**
1899
+ * Properties of an EpochAppendIntent.
1900
+ * @memberof consensus.v1
1901
+ * @interface IEpochAppendIntent
1902
+ * @property {B4aBuffer|null} [network_id] EpochAppendIntent network_id
1903
+ * @property {B4aBuffer|null} [bootstrap] EpochAppendIntent bootstrap
1904
+ * @property {B4aBuffer|null} [epoch] EpochAppendIntent epoch
1905
+ * @property {B4aBuffer|null} [parent_hash] EpochAppendIntent parent_hash
1906
+ * @property {B4aBuffer|null} [membership_context] EpochAppendIntent membership_context
1907
+ * @property {B4aBuffer|null} [config_hash] EpochAppendIntent config_hash
1908
+ * @property {string|null} [request_id] EpochAppendIntent request_id
1909
+ * @property {B4aBuffer|null} [payload_hash] EpochAppendIntent payload_hash
1910
+ * @property {B4aBuffer|null} [logical_counter] EpochAppendIntent logical_counter
1911
+ * @property {B4aBuffer|null} [requester] EpochAppendIntent requester
1912
+ * @property {number|null} [selection_version] EpochAppendIntent selection_version
1913
+ */
1914
+
1915
+ /**
1916
+ * Constructs a new EpochAppendIntent.
1917
+ * @memberof consensus.v1
1918
+ * @classdesc Represents an EpochAppendIntent.
1919
+ * @implements IEpochAppendIntent
1920
+ * @constructor
1921
+ * @param {consensus.v1.IEpochAppendIntent=} [properties] Properties to set
1922
+ */
1923
+ function EpochAppendIntent(properties) {
1924
+ if (properties)
1925
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1926
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
1927
+ this[keys[i]] = properties[keys[i]];
1928
+ }
1929
+
1930
+ /**
1931
+ * EpochAppendIntent network_id.
1932
+ * @member {B4aBuffer} network_id
1933
+ * @memberof consensus.v1.EpochAppendIntent
1934
+ * @instance
1935
+ */
1936
+ EpochAppendIntent.prototype.network_id = $util.newBuffer([]);
1937
+
1938
+ /**
1939
+ * EpochAppendIntent bootstrap.
1940
+ * @member {B4aBuffer} bootstrap
1941
+ * @memberof consensus.v1.EpochAppendIntent
1942
+ * @instance
1943
+ */
1944
+ EpochAppendIntent.prototype.bootstrap = $util.newBuffer([]);
1945
+
1946
+ /**
1947
+ * EpochAppendIntent epoch.
1948
+ * @member {B4aBuffer} epoch
1949
+ * @memberof consensus.v1.EpochAppendIntent
1950
+ * @instance
1951
+ */
1952
+ EpochAppendIntent.prototype.epoch = $util.newBuffer([]);
1953
+
1954
+ /**
1955
+ * EpochAppendIntent parent_hash.
1956
+ * @member {B4aBuffer} parent_hash
1957
+ * @memberof consensus.v1.EpochAppendIntent
1958
+ * @instance
1959
+ */
1960
+ EpochAppendIntent.prototype.parent_hash = $util.newBuffer([]);
1961
+
1962
+ /**
1963
+ * EpochAppendIntent membership_context.
1964
+ * @member {B4aBuffer} membership_context
1965
+ * @memberof consensus.v1.EpochAppendIntent
1966
+ * @instance
1967
+ */
1968
+ EpochAppendIntent.prototype.membership_context = $util.newBuffer([]);
1969
+
1970
+ /**
1971
+ * EpochAppendIntent config_hash.
1972
+ * @member {B4aBuffer} config_hash
1973
+ * @memberof consensus.v1.EpochAppendIntent
1974
+ * @instance
1975
+ */
1976
+ EpochAppendIntent.prototype.config_hash = $util.newBuffer([]);
1977
+
1978
+ /**
1979
+ * EpochAppendIntent request_id.
1980
+ * @member {string} request_id
1981
+ * @memberof consensus.v1.EpochAppendIntent
1982
+ * @instance
1983
+ */
1984
+ EpochAppendIntent.prototype.request_id = "";
1985
+
1986
+ /**
1987
+ * EpochAppendIntent payload_hash.
1988
+ * @member {B4aBuffer} payload_hash
1989
+ * @memberof consensus.v1.EpochAppendIntent
1990
+ * @instance
1991
+ */
1992
+ EpochAppendIntent.prototype.payload_hash = $util.newBuffer([]);
1993
+
1994
+ /**
1995
+ * EpochAppendIntent logical_counter.
1996
+ * @member {B4aBuffer} logical_counter
1997
+ * @memberof consensus.v1.EpochAppendIntent
1998
+ * @instance
1999
+ */
2000
+ EpochAppendIntent.prototype.logical_counter = $util.newBuffer([]);
2001
+
2002
+ /**
2003
+ * EpochAppendIntent requester.
2004
+ * @member {B4aBuffer} requester
2005
+ * @memberof consensus.v1.EpochAppendIntent
2006
+ * @instance
2007
+ */
2008
+ EpochAppendIntent.prototype.requester = $util.newBuffer([]);
2009
+
2010
+ /**
2011
+ * EpochAppendIntent selection_version.
2012
+ * @member {number} selection_version
2013
+ * @memberof consensus.v1.EpochAppendIntent
2014
+ * @instance
2015
+ */
2016
+ EpochAppendIntent.prototype.selection_version = 0;
2017
+
2018
+ /**
2019
+ * Creates a new EpochAppendIntent instance using the specified properties.
2020
+ * @function create
2021
+ * @memberof consensus.v1.EpochAppendIntent
2022
+ * @static
2023
+ * @param {consensus.v1.IEpochAppendIntent=} [properties] Properties to set
2024
+ * @returns {consensus.v1.EpochAppendIntent} EpochAppendIntent instance
2025
+ */
2026
+ EpochAppendIntent.create = function create(properties) {
2027
+ return new EpochAppendIntent(properties);
2028
+ };
2029
+
2030
+ /**
2031
+ * Encodes the specified EpochAppendIntent message. Does not implicitly {@link consensus.v1.EpochAppendIntent.verify|verify} messages.
2032
+ * @function encode
2033
+ * @memberof consensus.v1.EpochAppendIntent
2034
+ * @static
2035
+ * @param {consensus.v1.IEpochAppendIntent} message EpochAppendIntent message or plain object to encode
2036
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2037
+ * @returns {$protobuf.Writer} Writer
2038
+ */
2039
+ EpochAppendIntent.encode = function encode(message, writer, q) {
2040
+ writer = $Writer.create(writer);
2041
+ if (q === undefined)
2042
+ q = 0;
2043
+ if (q > $util.recursionLimit)
2044
+ throw Error("max depth exceeded");
2045
+ if (message.network_id != null && Object.hasOwnProperty.call(message, "network_id"))
2046
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.network_id);
2047
+ if (message.bootstrap != null && Object.hasOwnProperty.call(message, "bootstrap"))
2048
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.bootstrap);
2049
+ if (message.epoch != null && Object.hasOwnProperty.call(message, "epoch"))
2050
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.epoch);
2051
+ if (message.parent_hash != null && Object.hasOwnProperty.call(message, "parent_hash"))
2052
+ writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.parent_hash);
2053
+ if (message.membership_context != null && Object.hasOwnProperty.call(message, "membership_context"))
2054
+ writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.membership_context);
2055
+ if (message.config_hash != null && Object.hasOwnProperty.call(message, "config_hash"))
2056
+ writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.config_hash);
2057
+ if (message.request_id != null && Object.hasOwnProperty.call(message, "request_id"))
2058
+ writer.uint32(/* id 7, wireType 2 =*/58).string(message.request_id);
2059
+ if (message.payload_hash != null && Object.hasOwnProperty.call(message, "payload_hash"))
2060
+ writer.uint32(/* id 8, wireType 2 =*/66).bytes(message.payload_hash);
2061
+ if (message.logical_counter != null && Object.hasOwnProperty.call(message, "logical_counter"))
2062
+ writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.logical_counter);
2063
+ if (message.requester != null && Object.hasOwnProperty.call(message, "requester"))
2064
+ writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.requester);
2065
+ if (message.selection_version != null && Object.hasOwnProperty.call(message, "selection_version"))
2066
+ writer.uint32(/* id 11, wireType 0 =*/88).uint32(message.selection_version);
2067
+ return writer;
2068
+ };
2069
+
2070
+ /**
2071
+ * Encodes the specified EpochAppendIntent message, length delimited. Does not implicitly {@link consensus.v1.EpochAppendIntent.verify|verify} messages.
2072
+ * @function encodeDelimited
2073
+ * @memberof consensus.v1.EpochAppendIntent
2074
+ * @static
2075
+ * @param {consensus.v1.IEpochAppendIntent} message EpochAppendIntent message or plain object to encode
2076
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2077
+ * @returns {$protobuf.Writer} Writer
2078
+ */
2079
+ EpochAppendIntent.encodeDelimited = function encodeDelimited(message, writer) {
2080
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
2081
+ };
2082
+
2083
+ /**
2084
+ * Decodes an EpochAppendIntent message from the specified reader or buffer.
2085
+ * @function decode
2086
+ * @memberof consensus.v1.EpochAppendIntent
2087
+ * @static
2088
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
2089
+ * @param {number} [length] Message length if known beforehand
2090
+ * @returns {consensus.v1.EpochAppendIntent} EpochAppendIntent
2091
+ * @throws {Error} If the payload is not a reader or valid buffer
2092
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2093
+ */
2094
+ EpochAppendIntent.decode = function decode(reader, length, error, long) {
2095
+ reader = $Reader.create(reader);
2096
+ if (long === undefined)
2097
+ long = 0;
2098
+ if (long > $Reader.recursionLimit)
2099
+ throw Error("maximum nesting depth exceeded");
2100
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.consensus.v1.EpochAppendIntent();
2101
+ while (reader.pos < end) {
2102
+ var tag = reader.uint32();
2103
+ if (tag === error)
2104
+ break;
2105
+ switch (tag >>> 3) {
2106
+ case 1: {
2107
+ message.network_id = $util.bytesFrom(reader.bytes());
2108
+ break;
2109
+ }
2110
+ case 2: {
2111
+ message.bootstrap = $util.bytesFrom(reader.bytes());
2112
+ break;
2113
+ }
2114
+ case 3: {
2115
+ message.epoch = $util.bytesFrom(reader.bytes());
2116
+ break;
2117
+ }
2118
+ case 4: {
2119
+ message.parent_hash = $util.bytesFrom(reader.bytes());
2120
+ break;
2121
+ }
2122
+ case 5: {
2123
+ message.membership_context = $util.bytesFrom(reader.bytes());
2124
+ break;
2125
+ }
2126
+ case 6: {
2127
+ message.config_hash = $util.bytesFrom(reader.bytes());
2128
+ break;
2129
+ }
2130
+ case 7: {
2131
+ message.request_id = reader.string();
2132
+ break;
2133
+ }
2134
+ case 8: {
2135
+ message.payload_hash = $util.bytesFrom(reader.bytes());
2136
+ break;
2137
+ }
2138
+ case 9: {
2139
+ message.logical_counter = $util.bytesFrom(reader.bytes());
2140
+ break;
2141
+ }
2142
+ case 10: {
2143
+ message.requester = $util.bytesFrom(reader.bytes());
2144
+ break;
2145
+ }
2146
+ case 11: {
2147
+ message.selection_version = reader.uint32();
2148
+ break;
2149
+ }
2150
+ default:
2151
+ reader.skipType(tag & 7, long);
2152
+ break;
2153
+ }
2154
+ }
2155
+ return message;
2156
+ };
2157
+
2158
+ /**
2159
+ * Decodes an EpochAppendIntent message from the specified reader or buffer, length delimited.
2160
+ * @function decodeDelimited
2161
+ * @memberof consensus.v1.EpochAppendIntent
2162
+ * @static
2163
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
2164
+ * @returns {consensus.v1.EpochAppendIntent} EpochAppendIntent
2165
+ * @throws {Error} If the payload is not a reader or valid buffer
2166
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2167
+ */
2168
+ EpochAppendIntent.decodeDelimited = function decodeDelimited(reader) {
2169
+ reader = $Reader.create(reader);
2170
+ return this.decode(reader, reader.uint32());
2171
+ };
2172
+
2173
+ /**
2174
+ * Verifies an EpochAppendIntent message.
2175
+ * @function verify
2176
+ * @memberof consensus.v1.EpochAppendIntent
2177
+ * @static
2178
+ * @param {Object.<string,*>} message Plain object to verify
2179
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2180
+ */
2181
+ EpochAppendIntent.verify = function verify(message, long) {
2182
+ if (typeof message !== "object" || message === null)
2183
+ return "object expected";
2184
+ if (long === undefined)
2185
+ long = 0;
2186
+ if (long > $util.recursionLimit)
2187
+ return "maximum nesting depth exceeded";
2188
+ if (message.network_id != null && Object.hasOwnProperty.call(message, "network_id"))
2189
+ if (!$util.isBytes(message.network_id))
2190
+ return "network_id: buffer expected";
2191
+ if (message.bootstrap != null && Object.hasOwnProperty.call(message, "bootstrap"))
2192
+ if (!$util.isBytes(message.bootstrap))
2193
+ return "bootstrap: buffer expected";
2194
+ if (message.epoch != null && Object.hasOwnProperty.call(message, "epoch"))
2195
+ if (!$util.isBytes(message.epoch))
2196
+ return "epoch: buffer expected";
2197
+ if (message.parent_hash != null && Object.hasOwnProperty.call(message, "parent_hash"))
2198
+ if (!$util.isBytes(message.parent_hash))
2199
+ return "parent_hash: buffer expected";
2200
+ if (message.membership_context != null && Object.hasOwnProperty.call(message, "membership_context"))
2201
+ if (!$util.isBytes(message.membership_context))
2202
+ return "membership_context: buffer expected";
2203
+ if (message.config_hash != null && Object.hasOwnProperty.call(message, "config_hash"))
2204
+ if (!$util.isBytes(message.config_hash))
2205
+ return "config_hash: buffer expected";
2206
+ if (message.request_id != null && Object.hasOwnProperty.call(message, "request_id"))
2207
+ if (!$util.isString(message.request_id))
2208
+ return "request_id: string expected";
2209
+ if (message.payload_hash != null && Object.hasOwnProperty.call(message, "payload_hash"))
2210
+ if (!$util.isBytes(message.payload_hash))
2211
+ return "payload_hash: buffer expected";
2212
+ if (message.logical_counter != null && Object.hasOwnProperty.call(message, "logical_counter"))
2213
+ if (!$util.isBytes(message.logical_counter))
2214
+ return "logical_counter: buffer expected";
2215
+ if (message.requester != null && Object.hasOwnProperty.call(message, "requester"))
2216
+ if (!$util.isBytes(message.requester))
2217
+ return "requester: buffer expected";
2218
+ if (message.selection_version != null && Object.hasOwnProperty.call(message, "selection_version"))
2219
+ if (!$util.isInteger(message.selection_version))
2220
+ return "selection_version: integer expected";
2221
+ return null;
2222
+ };
2223
+
2224
+ /**
2225
+ * Creates an EpochAppendIntent message from a plain object. Also converts values to their respective internal types.
2226
+ * @function fromObject
2227
+ * @memberof consensus.v1.EpochAppendIntent
2228
+ * @static
2229
+ * @param {Object.<string,*>} object Plain object
2230
+ * @returns {consensus.v1.EpochAppendIntent} EpochAppendIntent
2231
+ */
2232
+ EpochAppendIntent.fromObject = function fromObject(object, long) {
2233
+ if (object instanceof $root.consensus.v1.EpochAppendIntent)
2234
+ object = Object.assign({}, object);
2235
+ if (!$util.isObject(object))
2236
+ throw TypeError(".consensus.v1.EpochAppendIntent: object expected");
2237
+ if (long === undefined)
2238
+ long = 0;
2239
+ if (long > $util.recursionLimit)
2240
+ throw Error("maximum nesting depth exceeded");
2241
+ var message = new $root.consensus.v1.EpochAppendIntent();
2242
+ if (object.network_id != null)
2243
+ message.network_id = $util.bytesFrom(object.network_id);
2244
+ if (object.bootstrap != null)
2245
+ message.bootstrap = $util.bytesFrom(object.bootstrap);
2246
+ if (object.epoch != null)
2247
+ message.epoch = $util.bytesFrom(object.epoch);
2248
+ if (object.parent_hash != null)
2249
+ message.parent_hash = $util.bytesFrom(object.parent_hash);
2250
+ if (object.membership_context != null)
2251
+ message.membership_context = $util.bytesFrom(object.membership_context);
2252
+ if (object.config_hash != null)
2253
+ message.config_hash = $util.bytesFrom(object.config_hash);
2254
+ if (object.request_id != null)
2255
+ message.request_id = String(object.request_id);
2256
+ if (object.payload_hash != null)
2257
+ message.payload_hash = $util.bytesFrom(object.payload_hash);
2258
+ if (object.logical_counter != null)
2259
+ message.logical_counter = $util.bytesFrom(object.logical_counter);
2260
+ if (object.requester != null)
2261
+ message.requester = $util.bytesFrom(object.requester);
2262
+ if (object.selection_version != null)
2263
+ message.selection_version = object.selection_version >>> 0;
2264
+ return message;
2265
+ };
2266
+
2267
+ /**
2268
+ * Creates a plain object from an EpochAppendIntent message. Also converts values to other types if specified.
2269
+ * @function toObject
2270
+ * @memberof consensus.v1.EpochAppendIntent
2271
+ * @static
2272
+ * @param {consensus.v1.EpochAppendIntent} message EpochAppendIntent
2273
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2274
+ * @returns {Object.<string,*>} Plain object
2275
+ */
2276
+ EpochAppendIntent.toObject = function toObject(message, options, q) {
2277
+ if (!options)
2278
+ options = {};
2279
+ if (q === undefined)
2280
+ q = 0;
2281
+ if (q > $util.recursionLimit)
2282
+ throw Error("max depth exceeded");
2283
+ var object = {};
2284
+ if (options.defaults) {
2285
+ if (options.bytes === String)
2286
+ object.network_id = "";
2287
+ else {
2288
+ object.network_id = [];
2289
+ if (options.bytes !== Array)
2290
+ object.network_id = $util.newBuffer(object.network_id);
2291
+ }
2292
+ if (options.bytes === String)
2293
+ object.bootstrap = "";
2294
+ else {
2295
+ object.bootstrap = [];
2296
+ if (options.bytes !== Array)
2297
+ object.bootstrap = $util.newBuffer(object.bootstrap);
2298
+ }
2299
+ if (options.bytes === String)
2300
+ object.epoch = "";
2301
+ else {
2302
+ object.epoch = [];
2303
+ if (options.bytes !== Array)
2304
+ object.epoch = $util.newBuffer(object.epoch);
2305
+ }
2306
+ if (options.bytes === String)
2307
+ object.parent_hash = "";
2308
+ else {
2309
+ object.parent_hash = [];
2310
+ if (options.bytes !== Array)
2311
+ object.parent_hash = $util.newBuffer(object.parent_hash);
2312
+ }
2313
+ if (options.bytes === String)
2314
+ object.membership_context = "";
2315
+ else {
2316
+ object.membership_context = [];
2317
+ if (options.bytes !== Array)
2318
+ object.membership_context = $util.newBuffer(object.membership_context);
2319
+ }
2320
+ if (options.bytes === String)
2321
+ object.config_hash = "";
2322
+ else {
2323
+ object.config_hash = [];
2324
+ if (options.bytes !== Array)
2325
+ object.config_hash = $util.newBuffer(object.config_hash);
2326
+ }
2327
+ object.request_id = "";
2328
+ if (options.bytes === String)
2329
+ object.payload_hash = "";
2330
+ else {
2331
+ object.payload_hash = [];
2332
+ if (options.bytes !== Array)
2333
+ object.payload_hash = $util.newBuffer(object.payload_hash);
2334
+ }
2335
+ if (options.bytes === String)
2336
+ object.logical_counter = "";
2337
+ else {
2338
+ object.logical_counter = [];
2339
+ if (options.bytes !== Array)
2340
+ object.logical_counter = $util.newBuffer(object.logical_counter);
2341
+ }
2342
+ if (options.bytes === String)
2343
+ object.requester = "";
2344
+ else {
2345
+ object.requester = [];
2346
+ if (options.bytes !== Array)
2347
+ object.requester = $util.newBuffer(object.requester);
2348
+ }
2349
+ object.selection_version = 0;
2350
+ }
2351
+ if (message.network_id != null && Object.hasOwnProperty.call(message, "network_id"))
2352
+ object.network_id = $util.bytesTo(message.network_id, options);
2353
+ if (message.bootstrap != null && Object.hasOwnProperty.call(message, "bootstrap"))
2354
+ object.bootstrap = $util.bytesTo(message.bootstrap, options);
2355
+ if (message.epoch != null && Object.hasOwnProperty.call(message, "epoch"))
2356
+ object.epoch = $util.bytesTo(message.epoch, options);
2357
+ if (message.parent_hash != null && Object.hasOwnProperty.call(message, "parent_hash"))
2358
+ object.parent_hash = $util.bytesTo(message.parent_hash, options);
2359
+ if (message.membership_context != null && Object.hasOwnProperty.call(message, "membership_context"))
2360
+ object.membership_context = $util.bytesTo(message.membership_context, options);
2361
+ if (message.config_hash != null && Object.hasOwnProperty.call(message, "config_hash"))
2362
+ object.config_hash = $util.bytesTo(message.config_hash, options);
2363
+ if (message.request_id != null && Object.hasOwnProperty.call(message, "request_id"))
2364
+ object.request_id = message.request_id;
2365
+ if (message.payload_hash != null && Object.hasOwnProperty.call(message, "payload_hash"))
2366
+ object.payload_hash = $util.bytesTo(message.payload_hash, options);
2367
+ if (message.logical_counter != null && Object.hasOwnProperty.call(message, "logical_counter"))
2368
+ object.logical_counter = $util.bytesTo(message.logical_counter, options);
2369
+ if (message.requester != null && Object.hasOwnProperty.call(message, "requester"))
2370
+ object.requester = $util.bytesTo(message.requester, options);
2371
+ if (message.selection_version != null && Object.hasOwnProperty.call(message, "selection_version"))
2372
+ object.selection_version = message.selection_version;
2373
+ return object;
2374
+ };
2375
+
2376
+ /**
2377
+ * Converts this EpochAppendIntent to JSON.
2378
+ * @function toJSON
2379
+ * @memberof consensus.v1.EpochAppendIntent
2380
+ * @instance
2381
+ * @returns {Object.<string,*>} JSON object
2382
+ */
2383
+ EpochAppendIntent.prototype.toJSON = function toJSON() {
2384
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2385
+ };
2386
+
2387
+ /**
2388
+ * Gets the default type url for EpochAppendIntent
2389
+ * @function getTypeUrl
2390
+ * @memberof consensus.v1.EpochAppendIntent
2391
+ * @static
2392
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2393
+ * @returns {string} The default type url
2394
+ */
2395
+ EpochAppendIntent.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2396
+ if (typeUrlPrefix === undefined) {
2397
+ typeUrlPrefix = "type.googleapis.com";
2398
+ }
2399
+ return typeUrlPrefix + "/consensus.v1.EpochAppendIntent";
2400
+ };
2401
+
2402
+ return EpochAppendIntent;
2403
+ })();
2404
+
2405
+ v1.EpochAppendRequest = (function() {
2406
+
2407
+ /**
2408
+ * Properties of an EpochAppendRequest.
2409
+ * @memberof consensus.v1
2410
+ * @interface IEpochAppendRequest
2411
+ * @property {consensus.v1.IEpochAppendIntent|null} [intent] EpochAppendRequest intent
2412
+ * @property {B4aBuffer|null} [signature] EpochAppendRequest signature
2413
+ */
2414
+
2415
+ /**
2416
+ * Constructs a new EpochAppendRequest.
2417
+ * @memberof consensus.v1
2418
+ * @classdesc Represents an EpochAppendRequest.
2419
+ * @implements IEpochAppendRequest
2420
+ * @constructor
2421
+ * @param {consensus.v1.IEpochAppendRequest=} [properties] Properties to set
2422
+ */
2423
+ function EpochAppendRequest(properties) {
2424
+ if (properties)
2425
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2426
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
2427
+ this[keys[i]] = properties[keys[i]];
2428
+ }
2429
+
2430
+ /**
2431
+ * EpochAppendRequest intent.
2432
+ * @member {consensus.v1.IEpochAppendIntent|null|undefined} intent
2433
+ * @memberof consensus.v1.EpochAppendRequest
2434
+ * @instance
2435
+ */
2436
+ EpochAppendRequest.prototype.intent = null;
2437
+
2438
+ /**
2439
+ * EpochAppendRequest signature.
2440
+ * @member {B4aBuffer} signature
2441
+ * @memberof consensus.v1.EpochAppendRequest
2442
+ * @instance
2443
+ */
2444
+ EpochAppendRequest.prototype.signature = $util.newBuffer([]);
2445
+
2446
+ /**
2447
+ * Creates a new EpochAppendRequest instance using the specified properties.
2448
+ * @function create
2449
+ * @memberof consensus.v1.EpochAppendRequest
2450
+ * @static
2451
+ * @param {consensus.v1.IEpochAppendRequest=} [properties] Properties to set
2452
+ * @returns {consensus.v1.EpochAppendRequest} EpochAppendRequest instance
2453
+ */
2454
+ EpochAppendRequest.create = function create(properties) {
2455
+ return new EpochAppendRequest(properties);
2456
+ };
2457
+
2458
+ /**
2459
+ * Encodes the specified EpochAppendRequest message. Does not implicitly {@link consensus.v1.EpochAppendRequest.verify|verify} messages.
2460
+ * @function encode
2461
+ * @memberof consensus.v1.EpochAppendRequest
2462
+ * @static
2463
+ * @param {consensus.v1.IEpochAppendRequest} message EpochAppendRequest message or plain object to encode
2464
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2465
+ * @returns {$protobuf.Writer} Writer
2466
+ */
2467
+ EpochAppendRequest.encode = function encode(message, writer, q) {
2468
+ writer = $Writer.create(writer);
2469
+ if (q === undefined)
2470
+ q = 0;
2471
+ if (q > $util.recursionLimit)
2472
+ throw Error("max depth exceeded");
2473
+ if (message.intent != null && Object.hasOwnProperty.call(message, "intent"))
2474
+ $root.consensus.v1.EpochAppendIntent.encode(message.intent, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim();
2475
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
2476
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature);
2477
+ return writer;
2478
+ };
2479
+
2480
+ /**
2481
+ * Encodes the specified EpochAppendRequest message, length delimited. Does not implicitly {@link consensus.v1.EpochAppendRequest.verify|verify} messages.
2482
+ * @function encodeDelimited
2483
+ * @memberof consensus.v1.EpochAppendRequest
2484
+ * @static
2485
+ * @param {consensus.v1.IEpochAppendRequest} message EpochAppendRequest message or plain object to encode
2486
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2487
+ * @returns {$protobuf.Writer} Writer
2488
+ */
2489
+ EpochAppendRequest.encodeDelimited = function encodeDelimited(message, writer) {
2490
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
2491
+ };
2492
+
2493
+ /**
2494
+ * Decodes an EpochAppendRequest message from the specified reader or buffer.
2495
+ * @function decode
2496
+ * @memberof consensus.v1.EpochAppendRequest
2497
+ * @static
2498
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
2499
+ * @param {number} [length] Message length if known beforehand
2500
+ * @returns {consensus.v1.EpochAppendRequest} EpochAppendRequest
2501
+ * @throws {Error} If the payload is not a reader or valid buffer
2502
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2503
+ */
2504
+ EpochAppendRequest.decode = function decode(reader, length, error, long) {
2505
+ reader = $Reader.create(reader);
2506
+ if (long === undefined)
2507
+ long = 0;
2508
+ if (long > $Reader.recursionLimit)
2509
+ throw Error("maximum nesting depth exceeded");
2510
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.consensus.v1.EpochAppendRequest();
2511
+ while (reader.pos < end) {
2512
+ var tag = reader.uint32();
2513
+ if (tag === error)
2514
+ break;
2515
+ switch (tag >>> 3) {
2516
+ case 1: {
2517
+ message.intent = $root.consensus.v1.EpochAppendIntent.decode(reader, reader.uint32(), undefined, long + 1);
2518
+ break;
2519
+ }
2520
+ case 2: {
2521
+ message.signature = $util.bytesFrom(reader.bytes());
2522
+ break;
2523
+ }
2524
+ default:
2525
+ reader.skipType(tag & 7, long);
2526
+ break;
2527
+ }
2528
+ }
2529
+ return message;
2530
+ };
2531
+
2532
+ /**
2533
+ * Decodes an EpochAppendRequest message from the specified reader or buffer, length delimited.
2534
+ * @function decodeDelimited
2535
+ * @memberof consensus.v1.EpochAppendRequest
2536
+ * @static
2537
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
2538
+ * @returns {consensus.v1.EpochAppendRequest} EpochAppendRequest
2539
+ * @throws {Error} If the payload is not a reader or valid buffer
2540
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2541
+ */
2542
+ EpochAppendRequest.decodeDelimited = function decodeDelimited(reader) {
2543
+ reader = $Reader.create(reader);
2544
+ return this.decode(reader, reader.uint32());
2545
+ };
2546
+
2547
+ /**
2548
+ * Verifies an EpochAppendRequest message.
2549
+ * @function verify
2550
+ * @memberof consensus.v1.EpochAppendRequest
2551
+ * @static
2552
+ * @param {Object.<string,*>} message Plain object to verify
2553
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2554
+ */
2555
+ EpochAppendRequest.verify = function verify(message, long) {
2556
+ if (typeof message !== "object" || message === null)
2557
+ return "object expected";
2558
+ if (long === undefined)
2559
+ long = 0;
2560
+ if (long > $util.recursionLimit)
2561
+ return "maximum nesting depth exceeded";
2562
+ if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) {
2563
+ var error = $root.consensus.v1.EpochAppendIntent.verify(message.intent, long + 1);
2564
+ if (error)
2565
+ return "intent." + error;
2566
+ }
2567
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
2568
+ if (!$util.isBytes(message.signature))
2569
+ return "signature: buffer expected";
2570
+ return null;
2571
+ };
2572
+
2573
+ /**
2574
+ * Creates an EpochAppendRequest message from a plain object. Also converts values to their respective internal types.
2575
+ * @function fromObject
2576
+ * @memberof consensus.v1.EpochAppendRequest
2577
+ * @static
2578
+ * @param {Object.<string,*>} object Plain object
2579
+ * @returns {consensus.v1.EpochAppendRequest} EpochAppendRequest
2580
+ */
2581
+ EpochAppendRequest.fromObject = function fromObject(object, long) {
2582
+ if (object instanceof $root.consensus.v1.EpochAppendRequest)
2583
+ object = Object.assign({}, object);
2584
+ if (!$util.isObject(object))
2585
+ throw TypeError(".consensus.v1.EpochAppendRequest: object expected");
2586
+ if (long === undefined)
2587
+ long = 0;
2588
+ if (long > $util.recursionLimit)
2589
+ throw Error("maximum nesting depth exceeded");
2590
+ var message = new $root.consensus.v1.EpochAppendRequest();
2591
+ if (object.intent != null) {
2592
+ if (!$util.isObject(object.intent))
2593
+ throw TypeError(".consensus.v1.EpochAppendRequest.intent: object expected");
2594
+ message.intent = $root.consensus.v1.EpochAppendIntent.fromObject(object.intent, long + 1);
2595
+ }
2596
+ if (object.signature != null)
2597
+ message.signature = $util.bytesFrom(object.signature);
2598
+ return message;
2599
+ };
2600
+
2601
+ /**
2602
+ * Creates a plain object from an EpochAppendRequest message. Also converts values to other types if specified.
2603
+ * @function toObject
2604
+ * @memberof consensus.v1.EpochAppendRequest
2605
+ * @static
2606
+ * @param {consensus.v1.EpochAppendRequest} message EpochAppendRequest
2607
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2608
+ * @returns {Object.<string,*>} Plain object
2609
+ */
2610
+ EpochAppendRequest.toObject = function toObject(message, options, q) {
2611
+ if (!options)
2612
+ options = {};
2613
+ if (q === undefined)
2614
+ q = 0;
2615
+ if (q > $util.recursionLimit)
2616
+ throw Error("max depth exceeded");
2617
+ var object = {};
2618
+ if (options.defaults) {
2619
+ object.intent = null;
2620
+ if (options.bytes === String)
2621
+ object.signature = "";
2622
+ else {
2623
+ object.signature = [];
2624
+ if (options.bytes !== Array)
2625
+ object.signature = $util.newBuffer(object.signature);
2626
+ }
2627
+ }
2628
+ if (message.intent != null && Object.hasOwnProperty.call(message, "intent"))
2629
+ object.intent = $root.consensus.v1.EpochAppendIntent.toObject(message.intent, options, q + 1);
2630
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
2631
+ object.signature = $util.bytesTo(message.signature, options);
2632
+ return object;
2633
+ };
2634
+
2635
+ /**
2636
+ * Converts this EpochAppendRequest to JSON.
2637
+ * @function toJSON
2638
+ * @memberof consensus.v1.EpochAppendRequest
2639
+ * @instance
2640
+ * @returns {Object.<string,*>} JSON object
2641
+ */
2642
+ EpochAppendRequest.prototype.toJSON = function toJSON() {
2643
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2644
+ };
2645
+
2646
+ /**
2647
+ * Gets the default type url for EpochAppendRequest
2648
+ * @function getTypeUrl
2649
+ * @memberof consensus.v1.EpochAppendRequest
2650
+ * @static
2651
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2652
+ * @returns {string} The default type url
2653
+ */
2654
+ EpochAppendRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2655
+ if (typeUrlPrefix === undefined) {
2656
+ typeUrlPrefix = "type.googleapis.com";
2657
+ }
2658
+ return typeUrlPrefix + "/consensus.v1.EpochAppendRequest";
2659
+ };
2660
+
2661
+ return EpochAppendRequest;
2662
+ })();
2663
+
2664
+ v1.EpochAppendReply = (function() {
2665
+
2666
+ /**
2667
+ * Properties of an EpochAppendReply.
2668
+ * @memberof consensus.v1
2669
+ * @interface IEpochAppendReply
2670
+ * @property {consensus.v1.IEpochAppendIntent|null} [intent] EpochAppendReply intent
2671
+ * @property {B4aBuffer|null} [responder] EpochAppendReply responder
2672
+ * @property {B4aBuffer|null} [signature] EpochAppendReply signature
2673
+ * @property {number|null} [vote_status] EpochAppendReply vote_status
2674
+ * @property {B4aBuffer|null} [observed_counter] EpochAppendReply observed_counter
2675
+ * @property {consensus.v1.IEpochAppendIntent|null} [vote] EpochAppendReply vote
2676
+ */
2677
+
2678
+ /**
2679
+ * Constructs a new EpochAppendReply.
2680
+ * @memberof consensus.v1
2681
+ * @classdesc Represents an EpochAppendReply.
2682
+ * @implements IEpochAppendReply
2683
+ * @constructor
2684
+ * @param {consensus.v1.IEpochAppendReply=} [properties] Properties to set
2685
+ */
2686
+ function EpochAppendReply(properties) {
2687
+ if (properties)
2688
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2689
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
2690
+ this[keys[i]] = properties[keys[i]];
2691
+ }
2692
+
2693
+ /**
2694
+ * EpochAppendReply intent.
2695
+ * @member {consensus.v1.IEpochAppendIntent|null|undefined} intent
2696
+ * @memberof consensus.v1.EpochAppendReply
2697
+ * @instance
2698
+ */
2699
+ EpochAppendReply.prototype.intent = null;
2700
+
2701
+ /**
2702
+ * EpochAppendReply responder.
2703
+ * @member {B4aBuffer} responder
2704
+ * @memberof consensus.v1.EpochAppendReply
2705
+ * @instance
2706
+ */
2707
+ EpochAppendReply.prototype.responder = $util.newBuffer([]);
2708
+
2709
+ /**
2710
+ * EpochAppendReply signature.
2711
+ * @member {B4aBuffer} signature
2712
+ * @memberof consensus.v1.EpochAppendReply
2713
+ * @instance
2714
+ */
2715
+ EpochAppendReply.prototype.signature = $util.newBuffer([]);
2716
+
2717
+ /**
2718
+ * EpochAppendReply vote_status.
2719
+ * @member {number} vote_status
2720
+ * @memberof consensus.v1.EpochAppendReply
2721
+ * @instance
2722
+ */
2723
+ EpochAppendReply.prototype.vote_status = 0;
2724
+
2725
+ /**
2726
+ * EpochAppendReply observed_counter.
2727
+ * @member {B4aBuffer} observed_counter
2728
+ * @memberof consensus.v1.EpochAppendReply
2729
+ * @instance
2730
+ */
2731
+ EpochAppendReply.prototype.observed_counter = $util.newBuffer([]);
2732
+
2733
+ /**
2734
+ * EpochAppendReply vote.
2735
+ * @member {consensus.v1.IEpochAppendIntent|null|undefined} vote
2736
+ * @memberof consensus.v1.EpochAppendReply
2737
+ * @instance
2738
+ */
2739
+ EpochAppendReply.prototype.vote = null;
2740
+
2741
+ /**
2742
+ * Creates a new EpochAppendReply instance using the specified properties.
2743
+ * @function create
2744
+ * @memberof consensus.v1.EpochAppendReply
2745
+ * @static
2746
+ * @param {consensus.v1.IEpochAppendReply=} [properties] Properties to set
2747
+ * @returns {consensus.v1.EpochAppendReply} EpochAppendReply instance
2748
+ */
2749
+ EpochAppendReply.create = function create(properties) {
2750
+ return new EpochAppendReply(properties);
2751
+ };
2752
+
2753
+ /**
2754
+ * Encodes the specified EpochAppendReply message. Does not implicitly {@link consensus.v1.EpochAppendReply.verify|verify} messages.
2755
+ * @function encode
2756
+ * @memberof consensus.v1.EpochAppendReply
2757
+ * @static
2758
+ * @param {consensus.v1.IEpochAppendReply} message EpochAppendReply message or plain object to encode
2759
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2760
+ * @returns {$protobuf.Writer} Writer
2761
+ */
2762
+ EpochAppendReply.encode = function encode(message, writer, q) {
2763
+ writer = $Writer.create(writer);
2764
+ if (q === undefined)
2765
+ q = 0;
2766
+ if (q > $util.recursionLimit)
2767
+ throw Error("max depth exceeded");
2768
+ if (message.intent != null && Object.hasOwnProperty.call(message, "intent"))
2769
+ $root.consensus.v1.EpochAppendIntent.encode(message.intent, writer.uint32(/* id 1, wireType 2 =*/10).fork(), q + 1).ldelim();
2770
+ if (message.responder != null && Object.hasOwnProperty.call(message, "responder"))
2771
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.responder);
2772
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
2773
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.signature);
2774
+ if (message.vote_status != null && Object.hasOwnProperty.call(message, "vote_status"))
2775
+ writer.uint32(/* id 4, wireType 0 =*/32).uint32(message.vote_status);
2776
+ if (message.observed_counter != null && Object.hasOwnProperty.call(message, "observed_counter"))
2777
+ writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.observed_counter);
2778
+ if (message.vote != null && Object.hasOwnProperty.call(message, "vote"))
2779
+ $root.consensus.v1.EpochAppendIntent.encode(message.vote, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim();
2780
+ return writer;
2781
+ };
2782
+
2783
+ /**
2784
+ * Encodes the specified EpochAppendReply message, length delimited. Does not implicitly {@link consensus.v1.EpochAppendReply.verify|verify} messages.
2785
+ * @function encodeDelimited
2786
+ * @memberof consensus.v1.EpochAppendReply
2787
+ * @static
2788
+ * @param {consensus.v1.IEpochAppendReply} message EpochAppendReply message or plain object to encode
2789
+ * @param {$protobuf.Writer} [writer] Writer to encode to
2790
+ * @returns {$protobuf.Writer} Writer
2791
+ */
2792
+ EpochAppendReply.encodeDelimited = function encodeDelimited(message, writer) {
2793
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
2794
+ };
2795
+
2796
+ /**
2797
+ * Decodes an EpochAppendReply message from the specified reader or buffer.
2798
+ * @function decode
2799
+ * @memberof consensus.v1.EpochAppendReply
2800
+ * @static
2801
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
2802
+ * @param {number} [length] Message length if known beforehand
2803
+ * @returns {consensus.v1.EpochAppendReply} EpochAppendReply
2804
+ * @throws {Error} If the payload is not a reader or valid buffer
2805
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2806
+ */
2807
+ EpochAppendReply.decode = function decode(reader, length, error, long) {
2808
+ reader = $Reader.create(reader);
2809
+ if (long === undefined)
2810
+ long = 0;
2811
+ if (long > $Reader.recursionLimit)
2812
+ throw Error("maximum nesting depth exceeded");
2813
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.consensus.v1.EpochAppendReply();
2814
+ while (reader.pos < end) {
2815
+ var tag = reader.uint32();
2816
+ if (tag === error)
2817
+ break;
2818
+ switch (tag >>> 3) {
2819
+ case 1: {
2820
+ message.intent = $root.consensus.v1.EpochAppendIntent.decode(reader, reader.uint32(), undefined, long + 1);
2821
+ break;
2822
+ }
2823
+ case 2: {
2824
+ message.responder = $util.bytesFrom(reader.bytes());
2825
+ break;
2826
+ }
2827
+ case 3: {
2828
+ message.signature = $util.bytesFrom(reader.bytes());
2829
+ break;
2830
+ }
2831
+ case 4: {
2832
+ message.vote_status = reader.uint32();
2833
+ break;
2834
+ }
2835
+ case 5: {
2836
+ message.observed_counter = $util.bytesFrom(reader.bytes());
2837
+ break;
2838
+ }
2839
+ case 6: {
2840
+ message.vote = $root.consensus.v1.EpochAppendIntent.decode(reader, reader.uint32(), undefined, long + 1);
2841
+ break;
2842
+ }
2843
+ default:
2844
+ reader.skipType(tag & 7, long);
2845
+ break;
2846
+ }
2847
+ }
2848
+ return message;
2849
+ };
2850
+
2851
+ /**
2852
+ * Decodes an EpochAppendReply message from the specified reader or buffer, length delimited.
2853
+ * @function decodeDelimited
2854
+ * @memberof consensus.v1.EpochAppendReply
2855
+ * @static
2856
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
2857
+ * @returns {consensus.v1.EpochAppendReply} EpochAppendReply
2858
+ * @throws {Error} If the payload is not a reader or valid buffer
2859
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
2860
+ */
2861
+ EpochAppendReply.decodeDelimited = function decodeDelimited(reader) {
2862
+ reader = $Reader.create(reader);
2863
+ return this.decode(reader, reader.uint32());
2864
+ };
2865
+
2866
+ /**
2867
+ * Verifies an EpochAppendReply message.
2868
+ * @function verify
2869
+ * @memberof consensus.v1.EpochAppendReply
2870
+ * @static
2871
+ * @param {Object.<string,*>} message Plain object to verify
2872
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
2873
+ */
2874
+ EpochAppendReply.verify = function verify(message, long) {
2875
+ if (typeof message !== "object" || message === null)
2876
+ return "object expected";
2877
+ if (long === undefined)
2878
+ long = 0;
2879
+ if (long > $util.recursionLimit)
2880
+ return "maximum nesting depth exceeded";
2881
+ if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) {
2882
+ var error = $root.consensus.v1.EpochAppendIntent.verify(message.intent, long + 1);
2883
+ if (error)
2884
+ return "intent." + error;
2885
+ }
2886
+ if (message.responder != null && Object.hasOwnProperty.call(message, "responder"))
2887
+ if (!$util.isBytes(message.responder))
2888
+ return "responder: buffer expected";
2889
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
2890
+ if (!$util.isBytes(message.signature))
2891
+ return "signature: buffer expected";
2892
+ if (message.vote_status != null && Object.hasOwnProperty.call(message, "vote_status"))
2893
+ if (!$util.isInteger(message.vote_status))
2894
+ return "vote_status: integer expected";
2895
+ if (message.observed_counter != null && Object.hasOwnProperty.call(message, "observed_counter"))
2896
+ if (!$util.isBytes(message.observed_counter))
2897
+ return "observed_counter: buffer expected";
2898
+ if (message.vote != null && Object.hasOwnProperty.call(message, "vote")) {
2899
+ var error = $root.consensus.v1.EpochAppendIntent.verify(message.vote, long + 1);
2900
+ if (error)
2901
+ return "vote." + error;
2902
+ }
2903
+ return null;
2904
+ };
2905
+
2906
+ /**
2907
+ * Creates an EpochAppendReply message from a plain object. Also converts values to their respective internal types.
2908
+ * @function fromObject
2909
+ * @memberof consensus.v1.EpochAppendReply
2910
+ * @static
2911
+ * @param {Object.<string,*>} object Plain object
2912
+ * @returns {consensus.v1.EpochAppendReply} EpochAppendReply
2913
+ */
2914
+ EpochAppendReply.fromObject = function fromObject(object, long) {
2915
+ if (object instanceof $root.consensus.v1.EpochAppendReply)
2916
+ object = Object.assign({}, object);
2917
+ if (!$util.isObject(object))
2918
+ throw TypeError(".consensus.v1.EpochAppendReply: object expected");
2919
+ if (long === undefined)
2920
+ long = 0;
2921
+ if (long > $util.recursionLimit)
2922
+ throw Error("maximum nesting depth exceeded");
2923
+ var message = new $root.consensus.v1.EpochAppendReply();
2924
+ if (object.intent != null) {
2925
+ if (!$util.isObject(object.intent))
2926
+ throw TypeError(".consensus.v1.EpochAppendReply.intent: object expected");
2927
+ message.intent = $root.consensus.v1.EpochAppendIntent.fromObject(object.intent, long + 1);
2928
+ }
2929
+ if (object.responder != null)
2930
+ message.responder = $util.bytesFrom(object.responder);
2931
+ if (object.signature != null)
2932
+ message.signature = $util.bytesFrom(object.signature);
2933
+ if (object.vote_status != null)
2934
+ message.vote_status = object.vote_status >>> 0;
2935
+ if (object.observed_counter != null)
2936
+ message.observed_counter = $util.bytesFrom(object.observed_counter);
2937
+ if (object.vote != null) {
2938
+ if (!$util.isObject(object.vote))
2939
+ throw TypeError(".consensus.v1.EpochAppendReply.vote: object expected");
2940
+ message.vote = $root.consensus.v1.EpochAppendIntent.fromObject(object.vote, long + 1);
2941
+ }
2942
+ return message;
2943
+ };
2944
+
2945
+ /**
2946
+ * Creates a plain object from an EpochAppendReply message. Also converts values to other types if specified.
2947
+ * @function toObject
2948
+ * @memberof consensus.v1.EpochAppendReply
2949
+ * @static
2950
+ * @param {consensus.v1.EpochAppendReply} message EpochAppendReply
2951
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2952
+ * @returns {Object.<string,*>} Plain object
2953
+ */
2954
+ EpochAppendReply.toObject = function toObject(message, options, q) {
2955
+ if (!options)
2956
+ options = {};
2957
+ if (q === undefined)
2958
+ q = 0;
2959
+ if (q > $util.recursionLimit)
2960
+ throw Error("max depth exceeded");
2961
+ var object = {};
2962
+ if (options.defaults) {
2963
+ object.intent = null;
2964
+ if (options.bytes === String)
2965
+ object.responder = "";
2966
+ else {
2967
+ object.responder = [];
2968
+ if (options.bytes !== Array)
2969
+ object.responder = $util.newBuffer(object.responder);
2970
+ }
2971
+ if (options.bytes === String)
2972
+ object.signature = "";
2973
+ else {
2974
+ object.signature = [];
2975
+ if (options.bytes !== Array)
2976
+ object.signature = $util.newBuffer(object.signature);
2977
+ }
2978
+ object.vote_status = 0;
2979
+ if (options.bytes === String)
2980
+ object.observed_counter = "";
2981
+ else {
2982
+ object.observed_counter = [];
2983
+ if (options.bytes !== Array)
2984
+ object.observed_counter = $util.newBuffer(object.observed_counter);
2985
+ }
2986
+ object.vote = null;
2987
+ }
2988
+ if (message.intent != null && Object.hasOwnProperty.call(message, "intent"))
2989
+ object.intent = $root.consensus.v1.EpochAppendIntent.toObject(message.intent, options, q + 1);
2990
+ if (message.responder != null && Object.hasOwnProperty.call(message, "responder"))
2991
+ object.responder = $util.bytesTo(message.responder, options);
2992
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
2993
+ object.signature = $util.bytesTo(message.signature, options);
2994
+ if (message.vote_status != null && Object.hasOwnProperty.call(message, "vote_status"))
2995
+ object.vote_status = message.vote_status;
2996
+ if (message.observed_counter != null && Object.hasOwnProperty.call(message, "observed_counter"))
2997
+ object.observed_counter = $util.bytesTo(message.observed_counter, options);
2998
+ if (message.vote != null && Object.hasOwnProperty.call(message, "vote"))
2999
+ object.vote = $root.consensus.v1.EpochAppendIntent.toObject(message.vote, options, q + 1);
3000
+ return object;
3001
+ };
3002
+
3003
+ /**
3004
+ * Converts this EpochAppendReply to JSON.
3005
+ * @function toJSON
3006
+ * @memberof consensus.v1.EpochAppendReply
3007
+ * @instance
3008
+ * @returns {Object.<string,*>} JSON object
3009
+ */
3010
+ EpochAppendReply.prototype.toJSON = function toJSON() {
3011
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3012
+ };
3013
+
3014
+ /**
3015
+ * Gets the default type url for EpochAppendReply
3016
+ * @function getTypeUrl
3017
+ * @memberof consensus.v1.EpochAppendReply
3018
+ * @static
3019
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3020
+ * @returns {string} The default type url
3021
+ */
3022
+ EpochAppendReply.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3023
+ if (typeUrlPrefix === undefined) {
3024
+ typeUrlPrefix = "type.googleapis.com";
3025
+ }
3026
+ return typeUrlPrefix + "/consensus.v1.EpochAppendReply";
3027
+ };
3028
+
3029
+ return EpochAppendReply;
3030
+ })();
3031
+
3032
+ return v1;
3033
+ })();
3034
+
3035
+ return consensus;
3036
+ })();
3037
+
3038
+ $root.common = (function() {
3039
+
3040
+ /**
3041
+ * Namespace common.
3042
+ * @exports common
3043
+ * @namespace
3044
+ */
3045
+ var common = {};
3046
+
3047
+ common.v1 = (function() {
3048
+
3049
+ /**
3050
+ * Namespace v1.
3051
+ * @memberof common
3052
+ * @namespace
3053
+ */
3054
+ var v1 = {};
3055
+
3056
+ /**
3057
+ * ResultCode enum.
3058
+ * @name common.v1.ResultCode
3059
+ * @enum {number}
3060
+ * @property {number} RESULT_CODE_UNSPECIFIED=0 RESULT_CODE_UNSPECIFIED value
3061
+ * @property {number} RESULT_CODE_OK=1 RESULT_CODE_OK value
3062
+ * @property {number} RESULT_CODE_INVALID_PAYLOAD=2 RESULT_CODE_INVALID_PAYLOAD value
3063
+ * @property {number} RESULT_CODE_RATE_LIMITED=3 RESULT_CODE_RATE_LIMITED value
3064
+ * @property {number} RESULT_CODE_SIGNATURE_INVALID=4 RESULT_CODE_SIGNATURE_INVALID value
3065
+ * @property {number} RESULT_CODE_UNEXPECTED_ERROR=5 RESULT_CODE_UNEXPECTED_ERROR value
3066
+ * @property {number} RESULT_CODE_TIMEOUT=6 RESULT_CODE_TIMEOUT value
3067
+ * @property {number} RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS=7 RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS value
3068
+ * @property {number} RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE=8 RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE value
3069
+ * @property {number} RESULT_CODE_NODE_OVERLOADED=9 RESULT_CODE_NODE_OVERLOADED value
3070
+ * @property {number} RESULT_CODE_TX_ALREADY_PENDING=10 RESULT_CODE_TX_ALREADY_PENDING value
3071
+ * @property {number} RESULT_CODE_OPERATION_TYPE_UNKNOWN=11 RESULT_CODE_OPERATION_TYPE_UNKNOWN value
3072
+ * @property {number} RESULT_CODE_SCHEMA_VALIDATION_FAILED=12 RESULT_CODE_SCHEMA_VALIDATION_FAILED value
3073
+ * @property {number} RESULT_CODE_REQUESTER_ADDRESS_INVALID=13 RESULT_CODE_REQUESTER_ADDRESS_INVALID value
3074
+ * @property {number} RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID=14 RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID value
3075
+ * @property {number} RESULT_CODE_TX_HASH_MISMATCH=15 RESULT_CODE_TX_HASH_MISMATCH value
3076
+ * @property {number} RESULT_CODE_TX_SIGNATURE_INVALID=16 RESULT_CODE_TX_SIGNATURE_INVALID value
3077
+ * @property {number} RESULT_CODE_TX_EXPIRED=17 RESULT_CODE_TX_EXPIRED value
3078
+ * @property {number} RESULT_CODE_TX_ALREADY_EXISTS=18 RESULT_CODE_TX_ALREADY_EXISTS value
3079
+ * @property {number} RESULT_CODE_OPERATION_ALREADY_COMPLETED=19 RESULT_CODE_OPERATION_ALREADY_COMPLETED value
3080
+ * @property {number} RESULT_CODE_REQUESTER_NOT_FOUND=20 RESULT_CODE_REQUESTER_NOT_FOUND value
3081
+ * @property {number} RESULT_CODE_INSUFFICIENT_FEE_BALANCE=21 RESULT_CODE_INSUFFICIENT_FEE_BALANCE value
3082
+ * @property {number} RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP=22 RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP value
3083
+ * @property {number} RESULT_CODE_SELF_VALIDATION_FORBIDDEN=23 RESULT_CODE_SELF_VALIDATION_FORBIDDEN value
3084
+ * @property {number} RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND=24 RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND value
3085
+ * @property {number} RESULT_CODE_ROLE_NODE_ALREADY_WRITER=25 RESULT_CODE_ROLE_NODE_ALREADY_WRITER value
3086
+ * @property {number} RESULT_CODE_ROLE_NODE_NOT_WHITELISTED=26 RESULT_CODE_ROLE_NODE_NOT_WHITELISTED value
3087
+ * @property {number} RESULT_CODE_ROLE_NODE_NOT_WRITER=27 RESULT_CODE_ROLE_NODE_NOT_WRITER value
3088
+ * @property {number} RESULT_CODE_ROLE_NODE_IS_INDEXER=28 RESULT_CODE_ROLE_NODE_IS_INDEXER value
3089
+ * @property {number} RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING=29 RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING value
3090
+ * @property {number} RESULT_CODE_ROLE_INVALID_RECOVERY_CASE=30 RESULT_CODE_ROLE_INVALID_RECOVERY_CASE value
3091
+ * @property {number} RESULT_CODE_ROLE_UNKNOWN_OPERATION=31 RESULT_CODE_ROLE_UNKNOWN_OPERATION value
3092
+ * @property {number} RESULT_CODE_ROLE_INVALID_WRITER_KEY=32 RESULT_CODE_ROLE_INVALID_WRITER_KEY value
3093
+ * @property {number} RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE=33 RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE value
3094
+ * @property {number} RESULT_CODE_MSB_BOOTSTRAP_MISMATCH=34 RESULT_CODE_MSB_BOOTSTRAP_MISMATCH value
3095
+ * @property {number} RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED=35 RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED value
3096
+ * @property {number} RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING=36 RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING value
3097
+ * @property {number} RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH=37 RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH value
3098
+ * @property {number} RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS=38 RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS value
3099
+ * @property {number} RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID=39 RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID value
3100
+ * @property {number} RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID=40 RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID value
3101
+ * @property {number} RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE=41 RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE value
3102
+ * @property {number} RESULT_CODE_TRANSFER_SENDER_NOT_FOUND=42 RESULT_CODE_TRANSFER_SENDER_NOT_FOUND value
3103
+ * @property {number} RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE=43 RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE value
3104
+ * @property {number} RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW=44 RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW value
3105
+ * @property {number} RESULT_CODE_TX_HASH_INVALID_FORMAT=45 RESULT_CODE_TX_HASH_INVALID_FORMAT value
3106
+ * @property {number} RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED=46 RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED value
3107
+ * @property {number} RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING=47 RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING value
3108
+ * @property {number} RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID=48 RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID value
3109
+ * @property {number} RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN=49 RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN value
3110
+ * @property {number} RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED=50 RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED value
3111
+ * @property {number} RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID=51 RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID value
3112
+ * @property {number} RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA=52 RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA value
3113
+ * @property {number} RESULT_CODE_PROOF_PAYLOAD_MISMATCH=53 RESULT_CODE_PROOF_PAYLOAD_MISMATCH value
3114
+ * @property {number} RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED=54 RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED value
3115
+ * @property {number} RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH=55 RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH value
3116
+ * @property {number} RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND=56 RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND value
3117
+ * @property {number} RESULT_CODE_VALIDATOR_NODE_NOT_WRITER=57 RESULT_CODE_VALIDATOR_NODE_NOT_WRITER value
3118
+ * @property {number} RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH=58 RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH value
3119
+ * @property {number} RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID=59 RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID value
3120
+ * @property {number} RESULT_CODE_VALIDATOR_VA_MISSING=60 RESULT_CODE_VALIDATOR_VA_MISSING value
3121
+ * @property {number} RESULT_CODE_TX_INVALID_PAYLOAD=61 RESULT_CODE_TX_INVALID_PAYLOAD value
3122
+ * @property {number} RESULT_CODE_CONSENSUS_SCHEMA_VALIDATION_FAILED=100 RESULT_CODE_CONSENSUS_SCHEMA_VALIDATION_FAILED value
3123
+ * @property {number} RESULT_CODE_CONSENSUS_BAD_PROTOCOL_VERSION=101 RESULT_CODE_CONSENSUS_BAD_PROTOCOL_VERSION value
3124
+ * @property {number} RESULT_CODE_CONSENSUS_WRONG_NETWORK_ID=102 RESULT_CODE_CONSENSUS_WRONG_NETWORK_ID value
3125
+ * @property {number} RESULT_CODE_CONSENSUS_CONFIG_MISMATCH=103 RESULT_CODE_CONSENSUS_CONFIG_MISMATCH value
3126
+ * @property {number} RESULT_CODE_CONSENSUS_VDF_PROOF_INVALID=104 RESULT_CODE_CONSENSUS_VDF_PROOF_INVALID value
3127
+ * @property {number} RESULT_CODE_CONSENSUS_ADDRESS_INVALID=105 RESULT_CODE_CONSENSUS_ADDRESS_INVALID value
3128
+ * @property {number} RESULT_CODE_CONSENSUS_PUBLIC_KEY_MISMATCH=106 RESULT_CODE_CONSENSUS_PUBLIC_KEY_MISMATCH value
3129
+ * @property {number} RESULT_CODE_CONSENSUS_PROPOSAL_SIGNATURE_INVALID=107 RESULT_CODE_CONSENSUS_PROPOSAL_SIGNATURE_INVALID value
3130
+ * @property {number} RESULT_CODE_CONSENSUS_RESPONSE_SIGNATURE_INVALID=108 RESULT_CODE_CONSENSUS_RESPONSE_SIGNATURE_INVALID value
3131
+ * @property {number} RESULT_CODE_CONSENSUS_APPROVAL_SIGNATURE_INVALID=109 RESULT_CODE_CONSENSUS_APPROVAL_SIGNATURE_INVALID value
3132
+ * @property {number} RESULT_CODE_CONSENSUS_OPERATION_TYPE_INVALID=110 RESULT_CODE_CONSENSUS_OPERATION_TYPE_INVALID value
3133
+ * @property {number} RESULT_CODE_CONSENSUS_RESPONSE_APPROVAL_INVALID=111 RESULT_CODE_CONSENSUS_RESPONSE_APPROVAL_INVALID value
3134
+ * @property {number} RESULT_CODE_CONSENSUS_EPOCH_INVALID=112 RESULT_CODE_CONSENSUS_EPOCH_INVALID value
3135
+ * @property {number} RESULT_CODE_CONSENSUS_PREVIOUS_EPOCH_RECORD_HASH_INVALID=113 RESULT_CODE_CONSENSUS_PREVIOUS_EPOCH_RECORD_HASH_INVALID value
3136
+ * @property {number} RESULT_CODE_CONSENSUS_INDEXER_ROLE_INVALID=114 RESULT_CODE_CONSENSUS_INDEXER_ROLE_INVALID value
3137
+ */
3138
+ v1.ResultCode = (function() {
3139
+ var valuesById = {}, values = Object.create(valuesById);
3140
+ values[valuesById[0] = "RESULT_CODE_UNSPECIFIED"] = 0;
3141
+ values[valuesById[1] = "RESULT_CODE_OK"] = 1;
3142
+ values[valuesById[2] = "RESULT_CODE_INVALID_PAYLOAD"] = 2;
3143
+ values[valuesById[3] = "RESULT_CODE_RATE_LIMITED"] = 3;
3144
+ values[valuesById[4] = "RESULT_CODE_SIGNATURE_INVALID"] = 4;
3145
+ values[valuesById[5] = "RESULT_CODE_UNEXPECTED_ERROR"] = 5;
3146
+ values[valuesById[6] = "RESULT_CODE_TIMEOUT"] = 6;
3147
+ values[valuesById[7] = "RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS"] = 7;
3148
+ values[valuesById[8] = "RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE"] = 8;
3149
+ values[valuesById[9] = "RESULT_CODE_NODE_OVERLOADED"] = 9;
3150
+ values[valuesById[10] = "RESULT_CODE_TX_ALREADY_PENDING"] = 10;
3151
+ values[valuesById[11] = "RESULT_CODE_OPERATION_TYPE_UNKNOWN"] = 11;
3152
+ values[valuesById[12] = "RESULT_CODE_SCHEMA_VALIDATION_FAILED"] = 12;
3153
+ values[valuesById[13] = "RESULT_CODE_REQUESTER_ADDRESS_INVALID"] = 13;
3154
+ values[valuesById[14] = "RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID"] = 14;
3155
+ values[valuesById[15] = "RESULT_CODE_TX_HASH_MISMATCH"] = 15;
3156
+ values[valuesById[16] = "RESULT_CODE_TX_SIGNATURE_INVALID"] = 16;
3157
+ values[valuesById[17] = "RESULT_CODE_TX_EXPIRED"] = 17;
3158
+ values[valuesById[18] = "RESULT_CODE_TX_ALREADY_EXISTS"] = 18;
3159
+ values[valuesById[19] = "RESULT_CODE_OPERATION_ALREADY_COMPLETED"] = 19;
3160
+ values[valuesById[20] = "RESULT_CODE_REQUESTER_NOT_FOUND"] = 20;
3161
+ values[valuesById[21] = "RESULT_CODE_INSUFFICIENT_FEE_BALANCE"] = 21;
3162
+ values[valuesById[22] = "RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP"] = 22;
3163
+ values[valuesById[23] = "RESULT_CODE_SELF_VALIDATION_FORBIDDEN"] = 23;
3164
+ values[valuesById[24] = "RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND"] = 24;
3165
+ values[valuesById[25] = "RESULT_CODE_ROLE_NODE_ALREADY_WRITER"] = 25;
3166
+ values[valuesById[26] = "RESULT_CODE_ROLE_NODE_NOT_WHITELISTED"] = 26;
3167
+ values[valuesById[27] = "RESULT_CODE_ROLE_NODE_NOT_WRITER"] = 27;
3168
+ values[valuesById[28] = "RESULT_CODE_ROLE_NODE_IS_INDEXER"] = 28;
3169
+ values[valuesById[29] = "RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING"] = 29;
3170
+ values[valuesById[30] = "RESULT_CODE_ROLE_INVALID_RECOVERY_CASE"] = 30;
3171
+ values[valuesById[31] = "RESULT_CODE_ROLE_UNKNOWN_OPERATION"] = 31;
3172
+ values[valuesById[32] = "RESULT_CODE_ROLE_INVALID_WRITER_KEY"] = 32;
3173
+ values[valuesById[33] = "RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE"] = 33;
3174
+ values[valuesById[34] = "RESULT_CODE_MSB_BOOTSTRAP_MISMATCH"] = 34;
3175
+ values[valuesById[35] = "RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED"] = 35;
3176
+ values[valuesById[36] = "RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING"] = 36;
3177
+ values[valuesById[37] = "RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH"] = 37;
3178
+ values[valuesById[38] = "RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS"] = 38;
3179
+ values[valuesById[39] = "RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID"] = 39;
3180
+ values[valuesById[40] = "RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID"] = 40;
3181
+ values[valuesById[41] = "RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE"] = 41;
3182
+ values[valuesById[42] = "RESULT_CODE_TRANSFER_SENDER_NOT_FOUND"] = 42;
3183
+ values[valuesById[43] = "RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE"] = 43;
3184
+ values[valuesById[44] = "RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW"] = 44;
3185
+ values[valuesById[45] = "RESULT_CODE_TX_HASH_INVALID_FORMAT"] = 45;
3186
+ values[valuesById[46] = "RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED"] = 46;
3187
+ values[valuesById[47] = "RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING"] = 47;
3188
+ values[valuesById[48] = "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID"] = 48;
3189
+ values[valuesById[49] = "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN"] = 49;
3190
+ values[valuesById[50] = "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED"] = 50;
3191
+ values[valuesById[51] = "RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID"] = 51;
3192
+ values[valuesById[52] = "RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA"] = 52;
3193
+ values[valuesById[53] = "RESULT_CODE_PROOF_PAYLOAD_MISMATCH"] = 53;
3194
+ values[valuesById[54] = "RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED"] = 54;
3195
+ values[valuesById[55] = "RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH"] = 55;
3196
+ values[valuesById[56] = "RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND"] = 56;
3197
+ values[valuesById[57] = "RESULT_CODE_VALIDATOR_NODE_NOT_WRITER"] = 57;
3198
+ values[valuesById[58] = "RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH"] = 58;
3199
+ values[valuesById[59] = "RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID"] = 59;
3200
+ values[valuesById[60] = "RESULT_CODE_VALIDATOR_VA_MISSING"] = 60;
3201
+ values[valuesById[61] = "RESULT_CODE_TX_INVALID_PAYLOAD"] = 61;
3202
+ values[valuesById[100] = "RESULT_CODE_CONSENSUS_SCHEMA_VALIDATION_FAILED"] = 100;
3203
+ values[valuesById[101] = "RESULT_CODE_CONSENSUS_BAD_PROTOCOL_VERSION"] = 101;
3204
+ values[valuesById[102] = "RESULT_CODE_CONSENSUS_WRONG_NETWORK_ID"] = 102;
3205
+ values[valuesById[103] = "RESULT_CODE_CONSENSUS_CONFIG_MISMATCH"] = 103;
3206
+ values[valuesById[104] = "RESULT_CODE_CONSENSUS_VDF_PROOF_INVALID"] = 104;
3207
+ values[valuesById[105] = "RESULT_CODE_CONSENSUS_ADDRESS_INVALID"] = 105;
3208
+ values[valuesById[106] = "RESULT_CODE_CONSENSUS_PUBLIC_KEY_MISMATCH"] = 106;
3209
+ values[valuesById[107] = "RESULT_CODE_CONSENSUS_PROPOSAL_SIGNATURE_INVALID"] = 107;
3210
+ values[valuesById[108] = "RESULT_CODE_CONSENSUS_RESPONSE_SIGNATURE_INVALID"] = 108;
3211
+ values[valuesById[109] = "RESULT_CODE_CONSENSUS_APPROVAL_SIGNATURE_INVALID"] = 109;
3212
+ values[valuesById[110] = "RESULT_CODE_CONSENSUS_OPERATION_TYPE_INVALID"] = 110;
3213
+ values[valuesById[111] = "RESULT_CODE_CONSENSUS_RESPONSE_APPROVAL_INVALID"] = 111;
3214
+ values[valuesById[112] = "RESULT_CODE_CONSENSUS_EPOCH_INVALID"] = 112;
3215
+ values[valuesById[113] = "RESULT_CODE_CONSENSUS_PREVIOUS_EPOCH_RECORD_HASH_INVALID"] = 113;
3216
+ values[valuesById[114] = "RESULT_CODE_CONSENSUS_INDEXER_ROLE_INVALID"] = 114;
3217
+ return values;
3218
+ })();
3219
+
3220
+ return v1;
3221
+ })();
3222
+
3223
+ common.consensus = (function() {
3224
+
3225
+ /**
3226
+ * Namespace consensus.
3227
+ * @memberof common
3228
+ * @namespace
3229
+ */
3230
+ var consensus = {};
3231
+
3232
+ consensus.EpochProofV1 = (function() {
3233
+
3234
+ /**
3235
+ * Properties of an EpochProofV1.
3236
+ * @memberof common.consensus
3237
+ * @interface IEpochProofV1
3238
+ * @property {B4aBuffer|null} [pd] EpochProofV1 pd
3239
+ * @property {Array.<B4aBuffer>|null} [app] EpochProofV1 app
3240
+ */
3241
+
3242
+ /**
3243
+ * Constructs a new EpochProofV1.
3244
+ * @memberof common.consensus
3245
+ * @classdesc Represents an EpochProofV1.
3246
+ * @implements IEpochProofV1
3247
+ * @constructor
3248
+ * @param {common.consensus.IEpochProofV1=} [properties] Properties to set
3249
+ */
3250
+ function EpochProofV1(properties) {
3251
+ this.app = [];
3252
+ if (properties)
3253
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3254
+ if (properties[keys[i]] != null && keys[i] !== "__proto__")
3255
+ this[keys[i]] = properties[keys[i]];
3256
+ }
3257
+
3258
+ /**
3259
+ * EpochProofV1 pd.
3260
+ * @member {B4aBuffer} pd
3261
+ * @memberof common.consensus.EpochProofV1
3262
+ * @instance
3263
+ */
3264
+ EpochProofV1.prototype.pd = $util.newBuffer([]);
3265
+
3266
+ /**
3267
+ * EpochProofV1 app.
3268
+ * @member {Array.<B4aBuffer>} app
3269
+ * @memberof common.consensus.EpochProofV1
3270
+ * @instance
3271
+ */
3272
+ EpochProofV1.prototype.app = $util.emptyArray;
3273
+
3274
+ /**
3275
+ * Creates a new EpochProofV1 instance using the specified properties.
3276
+ * @function create
3277
+ * @memberof common.consensus.EpochProofV1
3278
+ * @static
3279
+ * @param {common.consensus.IEpochProofV1=} [properties] Properties to set
3280
+ * @returns {common.consensus.EpochProofV1} EpochProofV1 instance
3281
+ */
3282
+ EpochProofV1.create = function create(properties) {
3283
+ return new EpochProofV1(properties);
3284
+ };
3285
+
3286
+ /**
3287
+ * Encodes the specified EpochProofV1 message. Does not implicitly {@link common.consensus.EpochProofV1.verify|verify} messages.
3288
+ * @function encode
3289
+ * @memberof common.consensus.EpochProofV1
3290
+ * @static
3291
+ * @param {common.consensus.IEpochProofV1} message EpochProofV1 message or plain object to encode
3292
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3293
+ * @returns {$protobuf.Writer} Writer
3294
+ */
3295
+ EpochProofV1.encode = function encode(message, writer, q) {
3296
+ writer = $Writer.create(writer);
3297
+ if (q === undefined)
3298
+ q = 0;
3299
+ if (q > $util.recursionLimit)
3300
+ throw Error("max depth exceeded");
3301
+ if (message.pd != null && Object.hasOwnProperty.call(message, "pd"))
3302
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.pd);
3303
+ if (message.app != null && message.app.length)
3304
+ for (var i = 0; i < message.app.length; ++i)
3305
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.app[i]);
3306
+ return writer;
3307
+ };
3308
+
3309
+ /**
3310
+ * Encodes the specified EpochProofV1 message, length delimited. Does not implicitly {@link common.consensus.EpochProofV1.verify|verify} messages.
3311
+ * @function encodeDelimited
3312
+ * @memberof common.consensus.EpochProofV1
3313
+ * @static
3314
+ * @param {common.consensus.IEpochProofV1} message EpochProofV1 message or plain object to encode
3315
+ * @param {$protobuf.Writer} [writer] Writer to encode to
3316
+ * @returns {$protobuf.Writer} Writer
3317
+ */
3318
+ EpochProofV1.encodeDelimited = function encodeDelimited(message, writer) {
3319
+ return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
3320
+ };
3321
+
3322
+ /**
3323
+ * Decodes an EpochProofV1 message from the specified reader or buffer.
3324
+ * @function decode
3325
+ * @memberof common.consensus.EpochProofV1
3326
+ * @static
3327
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
3328
+ * @param {number} [length] Message length if known beforehand
3329
+ * @returns {common.consensus.EpochProofV1} EpochProofV1
3330
+ * @throws {Error} If the payload is not a reader or valid buffer
3331
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3332
+ */
3333
+ EpochProofV1.decode = function decode(reader, length, error, long) {
3334
+ reader = $Reader.create(reader);
3335
+ if (long === undefined)
3336
+ long = 0;
3337
+ if (long > $Reader.recursionLimit)
3338
+ throw Error("maximum nesting depth exceeded");
3339
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.common.consensus.EpochProofV1();
3340
+ while (reader.pos < end) {
3341
+ var tag = reader.uint32();
3342
+ if (tag === error)
3343
+ break;
3344
+ switch (tag >>> 3) {
3345
+ case 1: {
3346
+ message.pd = $util.bytesFrom(reader.bytes());
3347
+ break;
3348
+ }
3349
+ case 2: {
3350
+ if (!(message.app && message.app.length))
3351
+ message.app = [];
3352
+ message.app.push($util.bytesFrom(reader.bytes()));
3353
+ break;
3354
+ }
3355
+ default:
3356
+ reader.skipType(tag & 7, long);
3357
+ break;
3358
+ }
3359
+ }
3360
+ return message;
3361
+ };
3362
+
3363
+ /**
3364
+ * Decodes an EpochProofV1 message from the specified reader or buffer, length delimited.
3365
+ * @function decodeDelimited
3366
+ * @memberof common.consensus.EpochProofV1
3367
+ * @static
3368
+ * @param {$protobuf.Reader|B4aBuffer} reader Reader or buffer to decode from
3369
+ * @returns {common.consensus.EpochProofV1} EpochProofV1
3370
+ * @throws {Error} If the payload is not a reader or valid buffer
3371
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
3372
+ */
3373
+ EpochProofV1.decodeDelimited = function decodeDelimited(reader) {
3374
+ reader = $Reader.create(reader);
3375
+ return this.decode(reader, reader.uint32());
3376
+ };
3377
+
3378
+ /**
3379
+ * Verifies an EpochProofV1 message.
3380
+ * @function verify
3381
+ * @memberof common.consensus.EpochProofV1
3382
+ * @static
3383
+ * @param {Object.<string,*>} message Plain object to verify
3384
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
3385
+ */
3386
+ EpochProofV1.verify = function verify(message, long) {
3387
+ if (typeof message !== "object" || message === null)
3388
+ return "object expected";
3389
+ if (long === undefined)
3390
+ long = 0;
3391
+ if (long > $util.recursionLimit)
3392
+ return "maximum nesting depth exceeded";
3393
+ if (message.pd != null && Object.hasOwnProperty.call(message, "pd"))
3394
+ if (!$util.isBytes(message.pd))
3395
+ return "pd: buffer expected";
3396
+ if (message.app != null && Object.hasOwnProperty.call(message, "app")) {
3397
+ if (!Array.isArray(message.app))
3398
+ return "app: array expected";
3399
+ for (var i = 0; i < message.app.length; ++i)
3400
+ if (!$util.isBytes(message.app[i]))
3401
+ return "app: buffer[] expected";
3402
+ }
3403
+ return null;
3404
+ };
3405
+
3406
+ /**
3407
+ * Creates an EpochProofV1 message from a plain object. Also converts values to their respective internal types.
3408
+ * @function fromObject
3409
+ * @memberof common.consensus.EpochProofV1
3410
+ * @static
3411
+ * @param {Object.<string,*>} object Plain object
3412
+ * @returns {common.consensus.EpochProofV1} EpochProofV1
3413
+ */
3414
+ EpochProofV1.fromObject = function fromObject(object, long) {
3415
+ if (object instanceof $root.common.consensus.EpochProofV1)
3416
+ object = Object.assign({}, object);
3417
+ if (!$util.isObject(object))
3418
+ throw TypeError(".common.consensus.EpochProofV1: object expected");
3419
+ if (long === undefined)
3420
+ long = 0;
3421
+ if (long > $util.recursionLimit)
3422
+ throw Error("maximum nesting depth exceeded");
3423
+ var message = new $root.common.consensus.EpochProofV1();
3424
+ if (object.pd != null)
3425
+ message.pd = $util.bytesFrom(object.pd);
3426
+ if (object.app) {
3427
+ if (!Array.isArray(object.app))
3428
+ throw TypeError(".common.consensus.EpochProofV1.app: array expected");
3429
+ message.app = [];
3430
+ for (var i = 0; i < object.app.length; ++i)
3431
+ message.app[i] = $util.bytesFrom(object.app[i]);
3432
+ }
3433
+ return message;
3434
+ };
3435
+
3436
+ /**
3437
+ * Creates a plain object from an EpochProofV1 message. Also converts values to other types if specified.
3438
+ * @function toObject
3439
+ * @memberof common.consensus.EpochProofV1
3440
+ * @static
3441
+ * @param {common.consensus.EpochProofV1} message EpochProofV1
3442
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
3443
+ * @returns {Object.<string,*>} Plain object
3444
+ */
3445
+ EpochProofV1.toObject = function toObject(message, options, q) {
3446
+ if (!options)
3447
+ options = {};
3448
+ if (q === undefined)
3449
+ q = 0;
3450
+ if (q > $util.recursionLimit)
3451
+ throw Error("max depth exceeded");
3452
+ var object = {};
3453
+ if (options.arrays || options.defaults)
3454
+ object.app = [];
3455
+ if (options.defaults)
3456
+ if (options.bytes === String)
3457
+ object.pd = "";
3458
+ else {
3459
+ object.pd = [];
3460
+ if (options.bytes !== Array)
3461
+ object.pd = $util.newBuffer(object.pd);
3462
+ }
3463
+ if (message.pd != null && Object.hasOwnProperty.call(message, "pd"))
3464
+ object.pd = $util.bytesTo(message.pd, options);
3465
+ if (message.app && message.app.length) {
3466
+ object.app = [];
3467
+ for (var j = 0; j < message.app.length; ++j)
3468
+ object.app[j] = $util.bytesTo(message.app[j], options);
3469
+ }
3470
+ return object;
3471
+ };
3472
+
3473
+ /**
3474
+ * Converts this EpochProofV1 to JSON.
3475
+ * @function toJSON
3476
+ * @memberof common.consensus.EpochProofV1
3477
+ * @instance
3478
+ * @returns {Object.<string,*>} JSON object
3479
+ */
3480
+ EpochProofV1.prototype.toJSON = function toJSON() {
3481
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3482
+ };
3483
+
3484
+ /**
3485
+ * Gets the default type url for EpochProofV1
3486
+ * @function getTypeUrl
3487
+ * @memberof common.consensus.EpochProofV1
3488
+ * @static
3489
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
3490
+ * @returns {string} The default type url
3491
+ */
3492
+ EpochProofV1.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
3493
+ if (typeUrlPrefix === undefined) {
3494
+ typeUrlPrefix = "type.googleapis.com";
3495
+ }
3496
+ return typeUrlPrefix + "/common.consensus.EpochProofV1";
3497
+ };
3498
+
3499
+ return EpochProofV1;
3500
+ })();
3501
+
3502
+ return consensus;
3503
+ })();
3504
+
3505
+ return common;
3506
+ })();
3507
+
3508
+ module.exports = $root;