trac-msb 0.2.12 → 0.2.13

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 (114) hide show
  1. package/package.json +9 -4
  2. package/proto/network/v1/enums/message_type.proto +16 -0
  3. package/proto/network/v1/enums/result_code.proto +84 -0
  4. package/proto/network/v1/messages/broadcast_transaction_request.proto +9 -0
  5. package/proto/network/v1/messages/broadcast_transaction_response.proto +13 -0
  6. package/proto/network/v1/messages/liveness_request.proto +8 -0
  7. package/proto/network/v1/messages/liveness_response.proto +11 -0
  8. package/proto/network/v1/network_message.proto +22 -0
  9. package/rpc/rpc_services.js +22 -4
  10. package/scripts/generate-protobufs.js +37 -12
  11. package/src/config/config.js +26 -5
  12. package/src/config/env.js +25 -11
  13. package/src/core/network/Network.js +73 -36
  14. package/src/core/network/protocols/LegacyProtocol.js +21 -11
  15. package/src/core/network/protocols/NetworkMessages.js +38 -17
  16. package/src/core/network/protocols/ProtocolInterface.js +14 -2
  17. package/src/core/network/protocols/ProtocolSession.js +144 -17
  18. package/src/core/network/protocols/V1Protocol.js +37 -18
  19. package/src/core/network/protocols/connectionPolicies.js +88 -0
  20. package/src/core/network/protocols/legacy/NetworkMessageRouter.js +25 -19
  21. package/src/core/network/protocols/{shared/handlers/base/BaseOperationHandler.js → legacy/handlers/BaseStateOperationHandler.js} +23 -12
  22. package/src/core/network/protocols/legacy/handlers/{GetRequestHandler.js → LegacyGetRequestHandler.js} +6 -6
  23. package/src/core/network/protocols/legacy/handlers/LegacyResponseHandler.js +23 -0
  24. package/src/core/network/protocols/{shared/handlers/RoleOperationHandler.js → legacy/handlers/LegacyRoleOperationHandler.js} +18 -11
  25. package/src/core/network/protocols/{shared/handlers/SubnetworkOperationHandler.js → legacy/handlers/LegacySubnetworkOperationHandler.js} +28 -17
  26. package/src/core/network/protocols/{shared/handlers/TransferOperationHandler.js → legacy/handlers/LegacyTransferOperationHandler.js} +17 -11
  27. package/src/core/network/protocols/shared/errors/SharedValidatorRejectionError.js +27 -0
  28. package/src/core/network/protocols/shared/validators/{PartialBootstrapDeployment.js → PartialBootstrapDeploymentValidator.js} +9 -4
  29. package/src/core/network/protocols/shared/validators/{base/PartialOperation.js → PartialOperationValidator.js} +47 -25
  30. package/src/core/network/protocols/shared/validators/{PartialRoleAccess.js → PartialRoleAccessValidator.js} +51 -17
  31. package/src/core/network/protocols/shared/validators/{PartialTransaction.js → PartialTransactionValidator.js} +21 -7
  32. package/src/core/network/protocols/shared/validators/{PartialTransfer.js → PartialTransferValidator.js} +26 -9
  33. package/src/core/network/protocols/v1/NetworkMessageRouter.js +91 -7
  34. package/src/core/network/protocols/v1/V1ProtocolError.js +91 -0
  35. package/src/core/network/protocols/v1/handlers/V1BaseOperationHandler.js +65 -0
  36. package/src/core/network/protocols/v1/handlers/V1BroadcastTransactionOperationHandler.js +389 -0
  37. package/src/core/network/protocols/v1/handlers/V1LivenessOperationHandler.js +87 -0
  38. package/src/core/network/protocols/v1/validators/V1BaseOperation.js +211 -0
  39. package/src/core/network/protocols/v1/validators/V1BroadcastTransactionRequest.js +26 -0
  40. package/src/core/network/protocols/v1/validators/V1BroadcastTransactionResponse.js +276 -0
  41. package/src/core/network/protocols/v1/validators/V1LivenessRequest.js +15 -0
  42. package/src/core/network/protocols/v1/validators/V1LivenessResponse.js +17 -0
  43. package/src/core/network/protocols/v1/validators/V1ValidationSchema.js +210 -0
  44. package/src/core/network/services/ConnectionManager.js +146 -94
  45. package/src/core/network/services/MessageOrchestrator.js +151 -27
  46. package/src/core/network/services/PendingRequestService.js +172 -0
  47. package/src/core/network/services/TransactionCommitService.js +149 -0
  48. package/src/core/network/services/TransactionPoolService.js +129 -18
  49. package/src/core/network/services/TransactionRateLimiterService.js +52 -34
  50. package/src/core/network/services/ValidatorHealthCheckService.js +127 -0
  51. package/src/core/network/services/ValidatorObserverService.js +18 -26
  52. package/src/core/state/State.js +70 -19
  53. package/src/index.js +5 -4
  54. package/src/messages/network/v1/NetworkMessageBuilder.js +59 -79
  55. package/src/messages/network/v1/NetworkMessageDirector.js +16 -50
  56. package/src/utils/Scheduler.js +0 -8
  57. package/src/utils/constants.js +71 -5
  58. package/src/utils/deepEqualApplyPayload.js +40 -0
  59. package/src/utils/helpers.js +10 -1
  60. package/src/utils/logger.js +25 -0
  61. package/src/utils/normalizers.js +38 -0
  62. package/src/utils/protobuf/networkV1.generated.cjs +2460 -0
  63. package/src/utils/protobuf/operationHelpers.js +24 -3
  64. package/tests/acceptance/v1/account/account.test.mjs +8 -2
  65. package/tests/acceptance/v1/tx/tx.test.mjs +23 -1
  66. package/tests/acceptance/v1/tx-details/tx-details.test.mjs +34 -6
  67. package/tests/fixtures/networkV1.fixtures.js +2 -28
  68. package/tests/helpers/transactionPayloads.mjs +2 -2
  69. package/tests/unit/messages/network/NetworkMessageBuilder.test.js +239 -79
  70. package/tests/unit/messages/network/NetworkMessageDirector.test.js +223 -77
  71. package/tests/unit/network/LegacyNetworkMessageRouter.test.js +54 -0
  72. package/tests/unit/network/ProtocolSession.test.js +127 -0
  73. package/tests/unit/network/networkModule.test.js +4 -1
  74. package/tests/unit/network/services/ConnectionManager.test.js +450 -0
  75. package/tests/unit/network/services/MessageOrchestrator.test.js +445 -0
  76. package/tests/unit/network/services/PendingRequestService.test.js +431 -0
  77. package/tests/unit/network/services/TransactionCommitService.test.js +246 -0
  78. package/tests/unit/network/services/TransactionPoolService.test.js +489 -0
  79. package/tests/unit/network/services/TransactionRateLimiterService.test.js +139 -0
  80. package/tests/unit/network/services/ValidatorHealthCheckService.test.js +115 -0
  81. package/tests/unit/network/services/services.test.js +17 -0
  82. package/tests/unit/network/utils/v1TestUtils.js +153 -0
  83. package/tests/unit/network/v1/NetworkMessageRouterV1.test.js +151 -0
  84. package/tests/unit/network/v1/V1BaseOperation.test.js +356 -0
  85. package/tests/unit/network/v1/V1BroadcastTransactionOperationHandler.test.js +129 -0
  86. package/tests/unit/network/v1/V1BroadcastTransactionRequest.test.js +53 -0
  87. package/tests/unit/network/v1/V1BroadcastTransactionResponse.test.js +512 -0
  88. package/tests/unit/network/v1/V1LivenessRequest.test.js +32 -0
  89. package/tests/unit/network/v1/V1LivenessResponse.test.js +45 -0
  90. package/tests/unit/network/v1/V1ResultCode.test.js +84 -0
  91. package/tests/unit/network/v1/V1ValidationSchema.test.js +13 -0
  92. package/tests/unit/network/v1/connectionPolicies.test.js +49 -0
  93. package/tests/unit/network/v1/handlers/V1BaseOperationHandler.test.js +284 -0
  94. package/tests/unit/network/v1/handlers/V1BroadcastTransactionOperationHandler.test.js +794 -0
  95. package/tests/unit/network/v1/handlers/V1LivenessOperationHandler.test.js +193 -0
  96. package/tests/unit/network/v1/v1.handlers.test.js +15 -0
  97. package/tests/unit/network/v1/v1.test.js +19 -0
  98. package/tests/unit/network/v1/v1ValidationSchema/broadcastTransactionRequest.test.js +119 -0
  99. package/tests/unit/network/v1/v1ValidationSchema/broadcastTransactionResponse.test.js +136 -0
  100. package/tests/unit/network/v1/v1ValidationSchema/common.test.js +308 -0
  101. package/tests/unit/network/v1/v1ValidationSchema/livenessRequest.test.js +90 -0
  102. package/tests/unit/network/v1/v1ValidationSchema/livenessResponse.test.js +133 -0
  103. package/tests/unit/unit.test.js +2 -2
  104. package/tests/unit/utils/deepEqualApplyPayload/deepEqualApplyPayload.test.js +102 -0
  105. package/tests/unit/utils/protobuf/operationHelpers.test.js +2 -4
  106. package/tests/unit/utils/utils.test.js +1 -0
  107. package/.github/workflows/acceptance-tests.yml +0 -38
  108. package/.github/workflows/lint-pr-title.yml +0 -26
  109. package/.github/workflows/publish.yml +0 -33
  110. package/.github/workflows/unit-tests.yml +0 -34
  111. package/proto/network.proto +0 -74
  112. package/src/core/network/protocols/legacy/handlers/ResponseHandler.js +0 -37
  113. package/src/utils/protobuf/network.cjs +0 -840
  114. package/tests/unit/network/ConnectionManager.test.js +0 -191
@@ -0,0 +1,2460 @@
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
+ if (typeof globalThis !== 'undefined' && typeof globalThis.self === 'undefined') {
4
+ globalThis.self = globalThis;
5
+ }
6
+
7
+
8
+ var $protobuf = require("protobufjs/minimal");
9
+
10
+ // Common aliases
11
+ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
12
+
13
+ // Exported root namespace
14
+ var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
15
+
16
+ $root.network = (function() {
17
+
18
+ /**
19
+ * Namespace network.
20
+ * @exports network
21
+ * @namespace
22
+ */
23
+ var network = {};
24
+
25
+ network.v1 = (function() {
26
+
27
+ /**
28
+ * Namespace v1.
29
+ * @memberof network
30
+ * @namespace
31
+ */
32
+ var v1 = {};
33
+
34
+ v1.MessageHeader = (function() {
35
+
36
+ /**
37
+ * Properties of a MessageHeader.
38
+ * @memberof network.v1
39
+ * @interface IMessageHeader
40
+ * @property {network.v1.MessageType|null} [type] MessageHeader type
41
+ * @property {string|null} [id] MessageHeader id
42
+ * @property {number|Long|null} [timestamp] MessageHeader timestamp
43
+ * @property {network.v1.ILivenessRequest|null} [liveness_request] MessageHeader liveness_request
44
+ * @property {network.v1.ILivenessResponse|null} [liveness_response] MessageHeader liveness_response
45
+ * @property {network.v1.IBroadcastTransactionRequest|null} [broadcast_transaction_request] MessageHeader broadcast_transaction_request
46
+ * @property {network.v1.IBroadcastTransactionResponse|null} [broadcast_transaction_response] MessageHeader broadcast_transaction_response
47
+ * @property {Array.<string>|null} [capabilities] MessageHeader capabilities
48
+ */
49
+
50
+ /**
51
+ * Constructs a new MessageHeader.
52
+ * @memberof network.v1
53
+ * @classdesc Represents a MessageHeader.
54
+ * @implements IMessageHeader
55
+ * @constructor
56
+ * @param {network.v1.IMessageHeader=} [properties] Properties to set
57
+ */
58
+ function MessageHeader(properties) {
59
+ this.capabilities = [];
60
+ if (properties)
61
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
62
+ if (properties[keys[i]] != null)
63
+ this[keys[i]] = properties[keys[i]];
64
+ }
65
+
66
+ /**
67
+ * MessageHeader type.
68
+ * @member {network.v1.MessageType} type
69
+ * @memberof network.v1.MessageHeader
70
+ * @instance
71
+ */
72
+ MessageHeader.prototype.type = 0;
73
+
74
+ /**
75
+ * MessageHeader id.
76
+ * @member {string} id
77
+ * @memberof network.v1.MessageHeader
78
+ * @instance
79
+ */
80
+ MessageHeader.prototype.id = "";
81
+
82
+ /**
83
+ * MessageHeader timestamp.
84
+ * @member {number|Long} timestamp
85
+ * @memberof network.v1.MessageHeader
86
+ * @instance
87
+ */
88
+ MessageHeader.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
89
+
90
+ /**
91
+ * MessageHeader liveness_request.
92
+ * @member {network.v1.ILivenessRequest|null|undefined} liveness_request
93
+ * @memberof network.v1.MessageHeader
94
+ * @instance
95
+ */
96
+ MessageHeader.prototype.liveness_request = null;
97
+
98
+ /**
99
+ * MessageHeader liveness_response.
100
+ * @member {network.v1.ILivenessResponse|null|undefined} liveness_response
101
+ * @memberof network.v1.MessageHeader
102
+ * @instance
103
+ */
104
+ MessageHeader.prototype.liveness_response = null;
105
+
106
+ /**
107
+ * MessageHeader broadcast_transaction_request.
108
+ * @member {network.v1.IBroadcastTransactionRequest|null|undefined} broadcast_transaction_request
109
+ * @memberof network.v1.MessageHeader
110
+ * @instance
111
+ */
112
+ MessageHeader.prototype.broadcast_transaction_request = null;
113
+
114
+ /**
115
+ * MessageHeader broadcast_transaction_response.
116
+ * @member {network.v1.IBroadcastTransactionResponse|null|undefined} broadcast_transaction_response
117
+ * @memberof network.v1.MessageHeader
118
+ * @instance
119
+ */
120
+ MessageHeader.prototype.broadcast_transaction_response = null;
121
+
122
+ /**
123
+ * MessageHeader capabilities.
124
+ * @member {Array.<string>} capabilities
125
+ * @memberof network.v1.MessageHeader
126
+ * @instance
127
+ */
128
+ MessageHeader.prototype.capabilities = $util.emptyArray;
129
+
130
+ // OneOf field names bound to virtual getters and setters
131
+ var $oneOfFields;
132
+
133
+ /**
134
+ * MessageHeader field.
135
+ * @member {"liveness_request"|"liveness_response"|"broadcast_transaction_request"|"broadcast_transaction_response"|undefined} field
136
+ * @memberof network.v1.MessageHeader
137
+ * @instance
138
+ */
139
+ Object.defineProperty(MessageHeader.prototype, "field", {
140
+ get: $util.oneOfGetter($oneOfFields = ["liveness_request", "liveness_response", "broadcast_transaction_request", "broadcast_transaction_response"]),
141
+ set: $util.oneOfSetter($oneOfFields)
142
+ });
143
+
144
+ /**
145
+ * Creates a new MessageHeader instance using the specified properties.
146
+ * @function create
147
+ * @memberof network.v1.MessageHeader
148
+ * @static
149
+ * @param {network.v1.IMessageHeader=} [properties] Properties to set
150
+ * @returns {network.v1.MessageHeader} MessageHeader instance
151
+ */
152
+ MessageHeader.create = function create(properties) {
153
+ return new MessageHeader(properties);
154
+ };
155
+
156
+ /**
157
+ * Encodes the specified MessageHeader message. Does not implicitly {@link network.v1.MessageHeader.verify|verify} messages.
158
+ * @function encode
159
+ * @memberof network.v1.MessageHeader
160
+ * @static
161
+ * @param {network.v1.IMessageHeader} message MessageHeader message or plain object to encode
162
+ * @param {$protobuf.Writer} [writer] Writer to encode to
163
+ * @returns {$protobuf.Writer} Writer
164
+ */
165
+ MessageHeader.encode = function encode(message, writer) {
166
+ if (!writer)
167
+ writer = $Writer.create();
168
+ if (message.type != null && Object.hasOwnProperty.call(message, "type"))
169
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
170
+ if (message.id != null && Object.hasOwnProperty.call(message, "id"))
171
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.id);
172
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
173
+ writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.timestamp);
174
+ if (message.liveness_request != null && Object.hasOwnProperty.call(message, "liveness_request"))
175
+ $root.network.v1.LivenessRequest.encode(message.liveness_request, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
176
+ if (message.liveness_response != null && Object.hasOwnProperty.call(message, "liveness_response"))
177
+ $root.network.v1.LivenessResponse.encode(message.liveness_response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
178
+ if (message.broadcast_transaction_request != null && Object.hasOwnProperty.call(message, "broadcast_transaction_request"))
179
+ $root.network.v1.BroadcastTransactionRequest.encode(message.broadcast_transaction_request, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
180
+ if (message.broadcast_transaction_response != null && Object.hasOwnProperty.call(message, "broadcast_transaction_response"))
181
+ $root.network.v1.BroadcastTransactionResponse.encode(message.broadcast_transaction_response, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
182
+ if (message.capabilities != null && message.capabilities.length)
183
+ for (var i = 0; i < message.capabilities.length; ++i)
184
+ writer.uint32(/* id 8, wireType 2 =*/66).string(message.capabilities[i]);
185
+ return writer;
186
+ };
187
+
188
+ /**
189
+ * Encodes the specified MessageHeader message, length delimited. Does not implicitly {@link network.v1.MessageHeader.verify|verify} messages.
190
+ * @function encodeDelimited
191
+ * @memberof network.v1.MessageHeader
192
+ * @static
193
+ * @param {network.v1.IMessageHeader} message MessageHeader message or plain object to encode
194
+ * @param {$protobuf.Writer} [writer] Writer to encode to
195
+ * @returns {$protobuf.Writer} Writer
196
+ */
197
+ MessageHeader.encodeDelimited = function encodeDelimited(message, writer) {
198
+ return this.encode(message, writer).ldelim();
199
+ };
200
+
201
+ /**
202
+ * Decodes a MessageHeader message from the specified reader or buffer.
203
+ * @function decode
204
+ * @memberof network.v1.MessageHeader
205
+ * @static
206
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
207
+ * @param {number} [length] Message length if known beforehand
208
+ * @returns {network.v1.MessageHeader} MessageHeader
209
+ * @throws {Error} If the payload is not a reader or valid buffer
210
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
211
+ */
212
+ MessageHeader.decode = function decode(reader, length, error) {
213
+ if (!(reader instanceof $Reader))
214
+ reader = $Reader.create(reader);
215
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.network.v1.MessageHeader();
216
+ while (reader.pos < end) {
217
+ var tag = reader.uint32();
218
+ if (tag === error)
219
+ break;
220
+ switch (tag >>> 3) {
221
+ case 1: {
222
+ message.type = reader.int32();
223
+ break;
224
+ }
225
+ case 2: {
226
+ message.id = reader.string();
227
+ break;
228
+ }
229
+ case 3: {
230
+ message.timestamp = reader.uint64();
231
+ break;
232
+ }
233
+ case 4: {
234
+ message.liveness_request = $root.network.v1.LivenessRequest.decode(reader, reader.uint32());
235
+ break;
236
+ }
237
+ case 5: {
238
+ message.liveness_response = $root.network.v1.LivenessResponse.decode(reader, reader.uint32());
239
+ break;
240
+ }
241
+ case 6: {
242
+ message.broadcast_transaction_request = $root.network.v1.BroadcastTransactionRequest.decode(reader, reader.uint32());
243
+ break;
244
+ }
245
+ case 7: {
246
+ message.broadcast_transaction_response = $root.network.v1.BroadcastTransactionResponse.decode(reader, reader.uint32());
247
+ break;
248
+ }
249
+ case 8: {
250
+ if (!(message.capabilities && message.capabilities.length))
251
+ message.capabilities = [];
252
+ message.capabilities.push(reader.string());
253
+ break;
254
+ }
255
+ default:
256
+ reader.skipType(tag & 7);
257
+ break;
258
+ }
259
+ }
260
+ return message;
261
+ };
262
+
263
+ /**
264
+ * Decodes a MessageHeader message from the specified reader or buffer, length delimited.
265
+ * @function decodeDelimited
266
+ * @memberof network.v1.MessageHeader
267
+ * @static
268
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
269
+ * @returns {network.v1.MessageHeader} MessageHeader
270
+ * @throws {Error} If the payload is not a reader or valid buffer
271
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
272
+ */
273
+ MessageHeader.decodeDelimited = function decodeDelimited(reader) {
274
+ if (!(reader instanceof $Reader))
275
+ reader = new $Reader(reader);
276
+ return this.decode(reader, reader.uint32());
277
+ };
278
+
279
+ /**
280
+ * Verifies a MessageHeader message.
281
+ * @function verify
282
+ * @memberof network.v1.MessageHeader
283
+ * @static
284
+ * @param {Object.<string,*>} message Plain object to verify
285
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
286
+ */
287
+ MessageHeader.verify = function verify(message) {
288
+ if (typeof message !== "object" || message === null)
289
+ return "object expected";
290
+ var properties = {};
291
+ if (message.type != null && message.hasOwnProperty("type"))
292
+ switch (message.type) {
293
+ default:
294
+ return "type: enum value expected";
295
+ case 0:
296
+ case 1:
297
+ case 2:
298
+ case 3:
299
+ case 4:
300
+ break;
301
+ }
302
+ if (message.id != null && message.hasOwnProperty("id"))
303
+ if (!$util.isString(message.id))
304
+ return "id: string expected";
305
+ if (message.timestamp != null && message.hasOwnProperty("timestamp"))
306
+ if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high)))
307
+ return "timestamp: integer|Long expected";
308
+ if (message.liveness_request != null && message.hasOwnProperty("liveness_request")) {
309
+ properties.field = 1;
310
+ {
311
+ var error = $root.network.v1.LivenessRequest.verify(message.liveness_request);
312
+ if (error)
313
+ return "liveness_request." + error;
314
+ }
315
+ }
316
+ if (message.liveness_response != null && message.hasOwnProperty("liveness_response")) {
317
+ if (properties.field === 1)
318
+ return "field: multiple values";
319
+ properties.field = 1;
320
+ {
321
+ var error = $root.network.v1.LivenessResponse.verify(message.liveness_response);
322
+ if (error)
323
+ return "liveness_response." + error;
324
+ }
325
+ }
326
+ if (message.broadcast_transaction_request != null && message.hasOwnProperty("broadcast_transaction_request")) {
327
+ if (properties.field === 1)
328
+ return "field: multiple values";
329
+ properties.field = 1;
330
+ {
331
+ var error = $root.network.v1.BroadcastTransactionRequest.verify(message.broadcast_transaction_request);
332
+ if (error)
333
+ return "broadcast_transaction_request." + error;
334
+ }
335
+ }
336
+ if (message.broadcast_transaction_response != null && message.hasOwnProperty("broadcast_transaction_response")) {
337
+ if (properties.field === 1)
338
+ return "field: multiple values";
339
+ properties.field = 1;
340
+ {
341
+ var error = $root.network.v1.BroadcastTransactionResponse.verify(message.broadcast_transaction_response);
342
+ if (error)
343
+ return "broadcast_transaction_response." + error;
344
+ }
345
+ }
346
+ if (message.capabilities != null && message.hasOwnProperty("capabilities")) {
347
+ if (!Array.isArray(message.capabilities))
348
+ return "capabilities: array expected";
349
+ for (var i = 0; i < message.capabilities.length; ++i)
350
+ if (!$util.isString(message.capabilities[i]))
351
+ return "capabilities: string[] expected";
352
+ }
353
+ return null;
354
+ };
355
+
356
+ /**
357
+ * Creates a MessageHeader message from a plain object. Also converts values to their respective internal types.
358
+ * @function fromObject
359
+ * @memberof network.v1.MessageHeader
360
+ * @static
361
+ * @param {Object.<string,*>} object Plain object
362
+ * @returns {network.v1.MessageHeader} MessageHeader
363
+ */
364
+ MessageHeader.fromObject = function fromObject(object) {
365
+ if (object instanceof $root.network.v1.MessageHeader)
366
+ return object;
367
+ var message = new $root.network.v1.MessageHeader();
368
+ switch (object.type) {
369
+ default:
370
+ if (typeof object.type === "number") {
371
+ message.type = object.type;
372
+ break;
373
+ }
374
+ break;
375
+ case "MESSAGE_TYPE_UNSPECIFIED":
376
+ case 0:
377
+ message.type = 0;
378
+ break;
379
+ case "MESSAGE_TYPE_LIVENESS_REQUEST":
380
+ case 1:
381
+ message.type = 1;
382
+ break;
383
+ case "MESSAGE_TYPE_LIVENESS_RESPONSE":
384
+ case 2:
385
+ message.type = 2;
386
+ break;
387
+ case "MESSAGE_TYPE_BROADCAST_TRANSACTION_REQUEST":
388
+ case 3:
389
+ message.type = 3;
390
+ break;
391
+ case "MESSAGE_TYPE_BROADCAST_TRANSACTION_RESPONSE":
392
+ case 4:
393
+ message.type = 4;
394
+ break;
395
+ }
396
+ if (object.id != null)
397
+ message.id = String(object.id);
398
+ if (object.timestamp != null)
399
+ if ($util.Long)
400
+ (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true;
401
+ else if (typeof object.timestamp === "string")
402
+ message.timestamp = parseInt(object.timestamp, 10);
403
+ else if (typeof object.timestamp === "number")
404
+ message.timestamp = object.timestamp;
405
+ else if (typeof object.timestamp === "object")
406
+ message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true);
407
+ if (object.liveness_request != null) {
408
+ if (typeof object.liveness_request !== "object")
409
+ throw TypeError(".network.v1.MessageHeader.liveness_request: object expected");
410
+ message.liveness_request = $root.network.v1.LivenessRequest.fromObject(object.liveness_request);
411
+ }
412
+ if (object.liveness_response != null) {
413
+ if (typeof object.liveness_response !== "object")
414
+ throw TypeError(".network.v1.MessageHeader.liveness_response: object expected");
415
+ message.liveness_response = $root.network.v1.LivenessResponse.fromObject(object.liveness_response);
416
+ }
417
+ if (object.broadcast_transaction_request != null) {
418
+ if (typeof object.broadcast_transaction_request !== "object")
419
+ throw TypeError(".network.v1.MessageHeader.broadcast_transaction_request: object expected");
420
+ message.broadcast_transaction_request = $root.network.v1.BroadcastTransactionRequest.fromObject(object.broadcast_transaction_request);
421
+ }
422
+ if (object.broadcast_transaction_response != null) {
423
+ if (typeof object.broadcast_transaction_response !== "object")
424
+ throw TypeError(".network.v1.MessageHeader.broadcast_transaction_response: object expected");
425
+ message.broadcast_transaction_response = $root.network.v1.BroadcastTransactionResponse.fromObject(object.broadcast_transaction_response);
426
+ }
427
+ if (object.capabilities) {
428
+ if (!Array.isArray(object.capabilities))
429
+ throw TypeError(".network.v1.MessageHeader.capabilities: array expected");
430
+ message.capabilities = [];
431
+ for (var i = 0; i < object.capabilities.length; ++i)
432
+ message.capabilities[i] = String(object.capabilities[i]);
433
+ }
434
+ return message;
435
+ };
436
+
437
+ /**
438
+ * Creates a plain object from a MessageHeader message. Also converts values to other types if specified.
439
+ * @function toObject
440
+ * @memberof network.v1.MessageHeader
441
+ * @static
442
+ * @param {network.v1.MessageHeader} message MessageHeader
443
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
444
+ * @returns {Object.<string,*>} Plain object
445
+ */
446
+ MessageHeader.toObject = function toObject(message, options) {
447
+ if (!options)
448
+ options = {};
449
+ var object = {};
450
+ if (options.arrays || options.defaults)
451
+ object.capabilities = [];
452
+ if (options.defaults) {
453
+ object.type = options.enums === String ? "MESSAGE_TYPE_UNSPECIFIED" : 0;
454
+ object.id = "";
455
+ if ($util.Long) {
456
+ var long = new $util.Long(0, 0, true);
457
+ object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
458
+ } else
459
+ object.timestamp = options.longs === String ? "0" : 0;
460
+ }
461
+ if (message.type != null && message.hasOwnProperty("type"))
462
+ object.type = options.enums === String ? $root.network.v1.MessageType[message.type] === undefined ? message.type : $root.network.v1.MessageType[message.type] : message.type;
463
+ if (message.id != null && message.hasOwnProperty("id"))
464
+ object.id = message.id;
465
+ if (message.timestamp != null && message.hasOwnProperty("timestamp"))
466
+ if (typeof message.timestamp === "number")
467
+ object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp;
468
+ else
469
+ 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;
470
+ if (message.liveness_request != null && message.hasOwnProperty("liveness_request")) {
471
+ object.liveness_request = $root.network.v1.LivenessRequest.toObject(message.liveness_request, options);
472
+ if (options.oneofs)
473
+ object.field = "liveness_request";
474
+ }
475
+ if (message.liveness_response != null && message.hasOwnProperty("liveness_response")) {
476
+ object.liveness_response = $root.network.v1.LivenessResponse.toObject(message.liveness_response, options);
477
+ if (options.oneofs)
478
+ object.field = "liveness_response";
479
+ }
480
+ if (message.broadcast_transaction_request != null && message.hasOwnProperty("broadcast_transaction_request")) {
481
+ object.broadcast_transaction_request = $root.network.v1.BroadcastTransactionRequest.toObject(message.broadcast_transaction_request, options);
482
+ if (options.oneofs)
483
+ object.field = "broadcast_transaction_request";
484
+ }
485
+ if (message.broadcast_transaction_response != null && message.hasOwnProperty("broadcast_transaction_response")) {
486
+ object.broadcast_transaction_response = $root.network.v1.BroadcastTransactionResponse.toObject(message.broadcast_transaction_response, options);
487
+ if (options.oneofs)
488
+ object.field = "broadcast_transaction_response";
489
+ }
490
+ if (message.capabilities && message.capabilities.length) {
491
+ object.capabilities = [];
492
+ for (var j = 0; j < message.capabilities.length; ++j)
493
+ object.capabilities[j] = message.capabilities[j];
494
+ }
495
+ return object;
496
+ };
497
+
498
+ /**
499
+ * Converts this MessageHeader to JSON.
500
+ * @function toJSON
501
+ * @memberof network.v1.MessageHeader
502
+ * @instance
503
+ * @returns {Object.<string,*>} JSON object
504
+ */
505
+ MessageHeader.prototype.toJSON = function toJSON() {
506
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
507
+ };
508
+
509
+ /**
510
+ * Gets the default type url for MessageHeader
511
+ * @function getTypeUrl
512
+ * @memberof network.v1.MessageHeader
513
+ * @static
514
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
515
+ * @returns {string} The default type url
516
+ */
517
+ MessageHeader.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
518
+ if (typeUrlPrefix === undefined) {
519
+ typeUrlPrefix = "type.googleapis.com";
520
+ }
521
+ return typeUrlPrefix + "/network.v1.MessageHeader";
522
+ };
523
+
524
+ return MessageHeader;
525
+ })();
526
+
527
+ /**
528
+ * MessageType enum.
529
+ * @name network.v1.MessageType
530
+ * @enum {number}
531
+ * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value
532
+ * @property {number} MESSAGE_TYPE_LIVENESS_REQUEST=1 MESSAGE_TYPE_LIVENESS_REQUEST value
533
+ * @property {number} MESSAGE_TYPE_LIVENESS_RESPONSE=2 MESSAGE_TYPE_LIVENESS_RESPONSE value
534
+ * @property {number} MESSAGE_TYPE_BROADCAST_TRANSACTION_REQUEST=3 MESSAGE_TYPE_BROADCAST_TRANSACTION_REQUEST value
535
+ * @property {number} MESSAGE_TYPE_BROADCAST_TRANSACTION_RESPONSE=4 MESSAGE_TYPE_BROADCAST_TRANSACTION_RESPONSE value
536
+ */
537
+ v1.MessageType = (function() {
538
+ var valuesById = {}, values = Object.create(valuesById);
539
+ values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0;
540
+ values[valuesById[1] = "MESSAGE_TYPE_LIVENESS_REQUEST"] = 1;
541
+ values[valuesById[2] = "MESSAGE_TYPE_LIVENESS_RESPONSE"] = 2;
542
+ values[valuesById[3] = "MESSAGE_TYPE_BROADCAST_TRANSACTION_REQUEST"] = 3;
543
+ values[valuesById[4] = "MESSAGE_TYPE_BROADCAST_TRANSACTION_RESPONSE"] = 4;
544
+ return values;
545
+ })();
546
+
547
+ v1.LivenessRequest = (function() {
548
+
549
+ /**
550
+ * Properties of a LivenessRequest.
551
+ * @memberof network.v1
552
+ * @interface ILivenessRequest
553
+ * @property {Uint8Array|null} [nonce] LivenessRequest nonce
554
+ * @property {Uint8Array|null} [signature] LivenessRequest signature
555
+ */
556
+
557
+ /**
558
+ * Constructs a new LivenessRequest.
559
+ * @memberof network.v1
560
+ * @classdesc Represents a LivenessRequest.
561
+ * @implements ILivenessRequest
562
+ * @constructor
563
+ * @param {network.v1.ILivenessRequest=} [properties] Properties to set
564
+ */
565
+ function LivenessRequest(properties) {
566
+ if (properties)
567
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
568
+ if (properties[keys[i]] != null)
569
+ this[keys[i]] = properties[keys[i]];
570
+ }
571
+
572
+ /**
573
+ * LivenessRequest nonce.
574
+ * @member {Uint8Array} nonce
575
+ * @memberof network.v1.LivenessRequest
576
+ * @instance
577
+ */
578
+ LivenessRequest.prototype.nonce = $util.newBuffer([]);
579
+
580
+ /**
581
+ * LivenessRequest signature.
582
+ * @member {Uint8Array} signature
583
+ * @memberof network.v1.LivenessRequest
584
+ * @instance
585
+ */
586
+ LivenessRequest.prototype.signature = $util.newBuffer([]);
587
+
588
+ /**
589
+ * Creates a new LivenessRequest instance using the specified properties.
590
+ * @function create
591
+ * @memberof network.v1.LivenessRequest
592
+ * @static
593
+ * @param {network.v1.ILivenessRequest=} [properties] Properties to set
594
+ * @returns {network.v1.LivenessRequest} LivenessRequest instance
595
+ */
596
+ LivenessRequest.create = function create(properties) {
597
+ return new LivenessRequest(properties);
598
+ };
599
+
600
+ /**
601
+ * Encodes the specified LivenessRequest message. Does not implicitly {@link network.v1.LivenessRequest.verify|verify} messages.
602
+ * @function encode
603
+ * @memberof network.v1.LivenessRequest
604
+ * @static
605
+ * @param {network.v1.ILivenessRequest} message LivenessRequest message or plain object to encode
606
+ * @param {$protobuf.Writer} [writer] Writer to encode to
607
+ * @returns {$protobuf.Writer} Writer
608
+ */
609
+ LivenessRequest.encode = function encode(message, writer) {
610
+ if (!writer)
611
+ writer = $Writer.create();
612
+ if (message.nonce != null && Object.hasOwnProperty.call(message, "nonce"))
613
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.nonce);
614
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
615
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature);
616
+ return writer;
617
+ };
618
+
619
+ /**
620
+ * Encodes the specified LivenessRequest message, length delimited. Does not implicitly {@link network.v1.LivenessRequest.verify|verify} messages.
621
+ * @function encodeDelimited
622
+ * @memberof network.v1.LivenessRequest
623
+ * @static
624
+ * @param {network.v1.ILivenessRequest} message LivenessRequest message or plain object to encode
625
+ * @param {$protobuf.Writer} [writer] Writer to encode to
626
+ * @returns {$protobuf.Writer} Writer
627
+ */
628
+ LivenessRequest.encodeDelimited = function encodeDelimited(message, writer) {
629
+ return this.encode(message, writer).ldelim();
630
+ };
631
+
632
+ /**
633
+ * Decodes a LivenessRequest message from the specified reader or buffer.
634
+ * @function decode
635
+ * @memberof network.v1.LivenessRequest
636
+ * @static
637
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
638
+ * @param {number} [length] Message length if known beforehand
639
+ * @returns {network.v1.LivenessRequest} LivenessRequest
640
+ * @throws {Error} If the payload is not a reader or valid buffer
641
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
642
+ */
643
+ LivenessRequest.decode = function decode(reader, length, error) {
644
+ if (!(reader instanceof $Reader))
645
+ reader = $Reader.create(reader);
646
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.network.v1.LivenessRequest();
647
+ while (reader.pos < end) {
648
+ var tag = reader.uint32();
649
+ if (tag === error)
650
+ break;
651
+ switch (tag >>> 3) {
652
+ case 1: {
653
+ message.nonce = reader.bytes();
654
+ break;
655
+ }
656
+ case 2: {
657
+ message.signature = reader.bytes();
658
+ break;
659
+ }
660
+ default:
661
+ reader.skipType(tag & 7);
662
+ break;
663
+ }
664
+ }
665
+ return message;
666
+ };
667
+
668
+ /**
669
+ * Decodes a LivenessRequest message from the specified reader or buffer, length delimited.
670
+ * @function decodeDelimited
671
+ * @memberof network.v1.LivenessRequest
672
+ * @static
673
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
674
+ * @returns {network.v1.LivenessRequest} LivenessRequest
675
+ * @throws {Error} If the payload is not a reader or valid buffer
676
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
677
+ */
678
+ LivenessRequest.decodeDelimited = function decodeDelimited(reader) {
679
+ if (!(reader instanceof $Reader))
680
+ reader = new $Reader(reader);
681
+ return this.decode(reader, reader.uint32());
682
+ };
683
+
684
+ /**
685
+ * Verifies a LivenessRequest message.
686
+ * @function verify
687
+ * @memberof network.v1.LivenessRequest
688
+ * @static
689
+ * @param {Object.<string,*>} message Plain object to verify
690
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
691
+ */
692
+ LivenessRequest.verify = function verify(message) {
693
+ if (typeof message !== "object" || message === null)
694
+ return "object expected";
695
+ if (message.nonce != null && message.hasOwnProperty("nonce"))
696
+ if (!(message.nonce && typeof message.nonce.length === "number" || $util.isString(message.nonce)))
697
+ return "nonce: buffer expected";
698
+ if (message.signature != null && message.hasOwnProperty("signature"))
699
+ if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature)))
700
+ return "signature: buffer expected";
701
+ return null;
702
+ };
703
+
704
+ /**
705
+ * Creates a LivenessRequest message from a plain object. Also converts values to their respective internal types.
706
+ * @function fromObject
707
+ * @memberof network.v1.LivenessRequest
708
+ * @static
709
+ * @param {Object.<string,*>} object Plain object
710
+ * @returns {network.v1.LivenessRequest} LivenessRequest
711
+ */
712
+ LivenessRequest.fromObject = function fromObject(object) {
713
+ if (object instanceof $root.network.v1.LivenessRequest)
714
+ return object;
715
+ var message = new $root.network.v1.LivenessRequest();
716
+ if (object.nonce != null)
717
+ if (typeof object.nonce === "string")
718
+ $util.base64.decode(object.nonce, message.nonce = $util.newBuffer($util.base64.length(object.nonce)), 0);
719
+ else if (object.nonce.length >= 0)
720
+ message.nonce = object.nonce;
721
+ if (object.signature != null)
722
+ if (typeof object.signature === "string")
723
+ $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0);
724
+ else if (object.signature.length >= 0)
725
+ message.signature = object.signature;
726
+ return message;
727
+ };
728
+
729
+ /**
730
+ * Creates a plain object from a LivenessRequest message. Also converts values to other types if specified.
731
+ * @function toObject
732
+ * @memberof network.v1.LivenessRequest
733
+ * @static
734
+ * @param {network.v1.LivenessRequest} message LivenessRequest
735
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
736
+ * @returns {Object.<string,*>} Plain object
737
+ */
738
+ LivenessRequest.toObject = function toObject(message, options) {
739
+ if (!options)
740
+ options = {};
741
+ var object = {};
742
+ if (options.defaults) {
743
+ if (options.bytes === String)
744
+ object.nonce = "";
745
+ else {
746
+ object.nonce = [];
747
+ if (options.bytes !== Array)
748
+ object.nonce = $util.newBuffer(object.nonce);
749
+ }
750
+ if (options.bytes === String)
751
+ object.signature = "";
752
+ else {
753
+ object.signature = [];
754
+ if (options.bytes !== Array)
755
+ object.signature = $util.newBuffer(object.signature);
756
+ }
757
+ }
758
+ if (message.nonce != null && message.hasOwnProperty("nonce"))
759
+ object.nonce = options.bytes === String ? $util.base64.encode(message.nonce, 0, message.nonce.length) : options.bytes === Array ? Array.prototype.slice.call(message.nonce) : message.nonce;
760
+ if (message.signature != null && message.hasOwnProperty("signature"))
761
+ object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature;
762
+ return object;
763
+ };
764
+
765
+ /**
766
+ * Converts this LivenessRequest to JSON.
767
+ * @function toJSON
768
+ * @memberof network.v1.LivenessRequest
769
+ * @instance
770
+ * @returns {Object.<string,*>} JSON object
771
+ */
772
+ LivenessRequest.prototype.toJSON = function toJSON() {
773
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
774
+ };
775
+
776
+ /**
777
+ * Gets the default type url for LivenessRequest
778
+ * @function getTypeUrl
779
+ * @memberof network.v1.LivenessRequest
780
+ * @static
781
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
782
+ * @returns {string} The default type url
783
+ */
784
+ LivenessRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
785
+ if (typeUrlPrefix === undefined) {
786
+ typeUrlPrefix = "type.googleapis.com";
787
+ }
788
+ return typeUrlPrefix + "/network.v1.LivenessRequest";
789
+ };
790
+
791
+ return LivenessRequest;
792
+ })();
793
+
794
+ v1.LivenessResponse = (function() {
795
+
796
+ /**
797
+ * Properties of a LivenessResponse.
798
+ * @memberof network.v1
799
+ * @interface ILivenessResponse
800
+ * @property {Uint8Array|null} [nonce] LivenessResponse nonce
801
+ * @property {Uint8Array|null} [signature] LivenessResponse signature
802
+ * @property {network.v1.ResultCode|null} [result] LivenessResponse result
803
+ */
804
+
805
+ /**
806
+ * Constructs a new LivenessResponse.
807
+ * @memberof network.v1
808
+ * @classdesc Represents a LivenessResponse.
809
+ * @implements ILivenessResponse
810
+ * @constructor
811
+ * @param {network.v1.ILivenessResponse=} [properties] Properties to set
812
+ */
813
+ function LivenessResponse(properties) {
814
+ if (properties)
815
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
816
+ if (properties[keys[i]] != null)
817
+ this[keys[i]] = properties[keys[i]];
818
+ }
819
+
820
+ /**
821
+ * LivenessResponse nonce.
822
+ * @member {Uint8Array} nonce
823
+ * @memberof network.v1.LivenessResponse
824
+ * @instance
825
+ */
826
+ LivenessResponse.prototype.nonce = $util.newBuffer([]);
827
+
828
+ /**
829
+ * LivenessResponse signature.
830
+ * @member {Uint8Array} signature
831
+ * @memberof network.v1.LivenessResponse
832
+ * @instance
833
+ */
834
+ LivenessResponse.prototype.signature = $util.newBuffer([]);
835
+
836
+ /**
837
+ * LivenessResponse result.
838
+ * @member {network.v1.ResultCode} result
839
+ * @memberof network.v1.LivenessResponse
840
+ * @instance
841
+ */
842
+ LivenessResponse.prototype.result = 0;
843
+
844
+ /**
845
+ * Creates a new LivenessResponse instance using the specified properties.
846
+ * @function create
847
+ * @memberof network.v1.LivenessResponse
848
+ * @static
849
+ * @param {network.v1.ILivenessResponse=} [properties] Properties to set
850
+ * @returns {network.v1.LivenessResponse} LivenessResponse instance
851
+ */
852
+ LivenessResponse.create = function create(properties) {
853
+ return new LivenessResponse(properties);
854
+ };
855
+
856
+ /**
857
+ * Encodes the specified LivenessResponse message. Does not implicitly {@link network.v1.LivenessResponse.verify|verify} messages.
858
+ * @function encode
859
+ * @memberof network.v1.LivenessResponse
860
+ * @static
861
+ * @param {network.v1.ILivenessResponse} message LivenessResponse message or plain object to encode
862
+ * @param {$protobuf.Writer} [writer] Writer to encode to
863
+ * @returns {$protobuf.Writer} Writer
864
+ */
865
+ LivenessResponse.encode = function encode(message, writer) {
866
+ if (!writer)
867
+ writer = $Writer.create();
868
+ if (message.nonce != null && Object.hasOwnProperty.call(message, "nonce"))
869
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.nonce);
870
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
871
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature);
872
+ if (message.result != null && Object.hasOwnProperty.call(message, "result"))
873
+ writer.uint32(/* id 3, wireType 0 =*/24).int32(message.result);
874
+ return writer;
875
+ };
876
+
877
+ /**
878
+ * Encodes the specified LivenessResponse message, length delimited. Does not implicitly {@link network.v1.LivenessResponse.verify|verify} messages.
879
+ * @function encodeDelimited
880
+ * @memberof network.v1.LivenessResponse
881
+ * @static
882
+ * @param {network.v1.ILivenessResponse} message LivenessResponse message or plain object to encode
883
+ * @param {$protobuf.Writer} [writer] Writer to encode to
884
+ * @returns {$protobuf.Writer} Writer
885
+ */
886
+ LivenessResponse.encodeDelimited = function encodeDelimited(message, writer) {
887
+ return this.encode(message, writer).ldelim();
888
+ };
889
+
890
+ /**
891
+ * Decodes a LivenessResponse message from the specified reader or buffer.
892
+ * @function decode
893
+ * @memberof network.v1.LivenessResponse
894
+ * @static
895
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
896
+ * @param {number} [length] Message length if known beforehand
897
+ * @returns {network.v1.LivenessResponse} LivenessResponse
898
+ * @throws {Error} If the payload is not a reader or valid buffer
899
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
900
+ */
901
+ LivenessResponse.decode = function decode(reader, length, error) {
902
+ if (!(reader instanceof $Reader))
903
+ reader = $Reader.create(reader);
904
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.network.v1.LivenessResponse();
905
+ while (reader.pos < end) {
906
+ var tag = reader.uint32();
907
+ if (tag === error)
908
+ break;
909
+ switch (tag >>> 3) {
910
+ case 1: {
911
+ message.nonce = reader.bytes();
912
+ break;
913
+ }
914
+ case 2: {
915
+ message.signature = reader.bytes();
916
+ break;
917
+ }
918
+ case 3: {
919
+ message.result = reader.int32();
920
+ break;
921
+ }
922
+ default:
923
+ reader.skipType(tag & 7);
924
+ break;
925
+ }
926
+ }
927
+ return message;
928
+ };
929
+
930
+ /**
931
+ * Decodes a LivenessResponse message from the specified reader or buffer, length delimited.
932
+ * @function decodeDelimited
933
+ * @memberof network.v1.LivenessResponse
934
+ * @static
935
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
936
+ * @returns {network.v1.LivenessResponse} LivenessResponse
937
+ * @throws {Error} If the payload is not a reader or valid buffer
938
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
939
+ */
940
+ LivenessResponse.decodeDelimited = function decodeDelimited(reader) {
941
+ if (!(reader instanceof $Reader))
942
+ reader = new $Reader(reader);
943
+ return this.decode(reader, reader.uint32());
944
+ };
945
+
946
+ /**
947
+ * Verifies a LivenessResponse message.
948
+ * @function verify
949
+ * @memberof network.v1.LivenessResponse
950
+ * @static
951
+ * @param {Object.<string,*>} message Plain object to verify
952
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
953
+ */
954
+ LivenessResponse.verify = function verify(message) {
955
+ if (typeof message !== "object" || message === null)
956
+ return "object expected";
957
+ if (message.nonce != null && message.hasOwnProperty("nonce"))
958
+ if (!(message.nonce && typeof message.nonce.length === "number" || $util.isString(message.nonce)))
959
+ return "nonce: buffer expected";
960
+ if (message.signature != null && message.hasOwnProperty("signature"))
961
+ if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature)))
962
+ return "signature: buffer expected";
963
+ if (message.result != null && message.hasOwnProperty("result"))
964
+ switch (message.result) {
965
+ default:
966
+ return "result: enum value expected";
967
+ case 0:
968
+ case 1:
969
+ case 2:
970
+ case 3:
971
+ case 4:
972
+ case 5:
973
+ case 6:
974
+ case 7:
975
+ case 8:
976
+ case 9:
977
+ case 10:
978
+ case 11:
979
+ case 12:
980
+ case 13:
981
+ case 14:
982
+ case 15:
983
+ case 16:
984
+ case 17:
985
+ case 18:
986
+ case 19:
987
+ case 20:
988
+ case 21:
989
+ case 22:
990
+ case 23:
991
+ case 24:
992
+ case 25:
993
+ case 26:
994
+ case 27:
995
+ case 28:
996
+ case 29:
997
+ case 30:
998
+ case 31:
999
+ case 32:
1000
+ case 33:
1001
+ case 34:
1002
+ case 35:
1003
+ case 36:
1004
+ case 37:
1005
+ case 38:
1006
+ case 39:
1007
+ case 40:
1008
+ case 41:
1009
+ case 42:
1010
+ case 43:
1011
+ case 44:
1012
+ case 45:
1013
+ case 46:
1014
+ case 47:
1015
+ case 48:
1016
+ case 49:
1017
+ case 50:
1018
+ case 51:
1019
+ case 52:
1020
+ case 53:
1021
+ case 54:
1022
+ case 55:
1023
+ case 56:
1024
+ case 57:
1025
+ case 58:
1026
+ case 59:
1027
+ case 60:
1028
+ case 61:
1029
+ break;
1030
+ }
1031
+ return null;
1032
+ };
1033
+
1034
+ /**
1035
+ * Creates a LivenessResponse message from a plain object. Also converts values to their respective internal types.
1036
+ * @function fromObject
1037
+ * @memberof network.v1.LivenessResponse
1038
+ * @static
1039
+ * @param {Object.<string,*>} object Plain object
1040
+ * @returns {network.v1.LivenessResponse} LivenessResponse
1041
+ */
1042
+ LivenessResponse.fromObject = function fromObject(object) {
1043
+ if (object instanceof $root.network.v1.LivenessResponse)
1044
+ return object;
1045
+ var message = new $root.network.v1.LivenessResponse();
1046
+ if (object.nonce != null)
1047
+ if (typeof object.nonce === "string")
1048
+ $util.base64.decode(object.nonce, message.nonce = $util.newBuffer($util.base64.length(object.nonce)), 0);
1049
+ else if (object.nonce.length >= 0)
1050
+ message.nonce = object.nonce;
1051
+ if (object.signature != null)
1052
+ if (typeof object.signature === "string")
1053
+ $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0);
1054
+ else if (object.signature.length >= 0)
1055
+ message.signature = object.signature;
1056
+ switch (object.result) {
1057
+ default:
1058
+ if (typeof object.result === "number") {
1059
+ message.result = object.result;
1060
+ break;
1061
+ }
1062
+ break;
1063
+ case "RESULT_CODE_UNSPECIFIED":
1064
+ case 0:
1065
+ message.result = 0;
1066
+ break;
1067
+ case "RESULT_CODE_OK":
1068
+ case 1:
1069
+ message.result = 1;
1070
+ break;
1071
+ case "RESULT_CODE_INVALID_PAYLOAD":
1072
+ case 2:
1073
+ message.result = 2;
1074
+ break;
1075
+ case "RESULT_CODE_RATE_LIMITED":
1076
+ case 3:
1077
+ message.result = 3;
1078
+ break;
1079
+ case "RESULT_CODE_SIGNATURE_INVALID":
1080
+ case 4:
1081
+ message.result = 4;
1082
+ break;
1083
+ case "RESULT_CODE_UNEXPECTED_ERROR":
1084
+ case 5:
1085
+ message.result = 5;
1086
+ break;
1087
+ case "RESULT_CODE_TIMEOUT":
1088
+ case 6:
1089
+ message.result = 6;
1090
+ break;
1091
+ case "RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS":
1092
+ case 7:
1093
+ message.result = 7;
1094
+ break;
1095
+ case "RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE":
1096
+ case 8:
1097
+ message.result = 8;
1098
+ break;
1099
+ case "RESULT_CODE_NODE_OVERLOADED":
1100
+ case 9:
1101
+ message.result = 9;
1102
+ break;
1103
+ case "RESULT_CODE_TX_ALREADY_PENDING":
1104
+ case 10:
1105
+ message.result = 10;
1106
+ break;
1107
+ case "RESULT_CODE_OPERATION_TYPE_UNKNOWN":
1108
+ case 11:
1109
+ message.result = 11;
1110
+ break;
1111
+ case "RESULT_CODE_SCHEMA_VALIDATION_FAILED":
1112
+ case 12:
1113
+ message.result = 12;
1114
+ break;
1115
+ case "RESULT_CODE_REQUESTER_ADDRESS_INVALID":
1116
+ case 13:
1117
+ message.result = 13;
1118
+ break;
1119
+ case "RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID":
1120
+ case 14:
1121
+ message.result = 14;
1122
+ break;
1123
+ case "RESULT_CODE_TX_HASH_MISMATCH":
1124
+ case 15:
1125
+ message.result = 15;
1126
+ break;
1127
+ case "RESULT_CODE_TX_SIGNATURE_INVALID":
1128
+ case 16:
1129
+ message.result = 16;
1130
+ break;
1131
+ case "RESULT_CODE_TX_EXPIRED":
1132
+ case 17:
1133
+ message.result = 17;
1134
+ break;
1135
+ case "RESULT_CODE_TX_ALREADY_EXISTS":
1136
+ case 18:
1137
+ message.result = 18;
1138
+ break;
1139
+ case "RESULT_CODE_OPERATION_ALREADY_COMPLETED":
1140
+ case 19:
1141
+ message.result = 19;
1142
+ break;
1143
+ case "RESULT_CODE_REQUESTER_NOT_FOUND":
1144
+ case 20:
1145
+ message.result = 20;
1146
+ break;
1147
+ case "RESULT_CODE_INSUFFICIENT_FEE_BALANCE":
1148
+ case 21:
1149
+ message.result = 21;
1150
+ break;
1151
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP":
1152
+ case 22:
1153
+ message.result = 22;
1154
+ break;
1155
+ case "RESULT_CODE_SELF_VALIDATION_FORBIDDEN":
1156
+ case 23:
1157
+ message.result = 23;
1158
+ break;
1159
+ case "RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND":
1160
+ case 24:
1161
+ message.result = 24;
1162
+ break;
1163
+ case "RESULT_CODE_ROLE_NODE_ALREADY_WRITER":
1164
+ case 25:
1165
+ message.result = 25;
1166
+ break;
1167
+ case "RESULT_CODE_ROLE_NODE_NOT_WHITELISTED":
1168
+ case 26:
1169
+ message.result = 26;
1170
+ break;
1171
+ case "RESULT_CODE_ROLE_NODE_NOT_WRITER":
1172
+ case 27:
1173
+ message.result = 27;
1174
+ break;
1175
+ case "RESULT_CODE_ROLE_NODE_IS_INDEXER":
1176
+ case 28:
1177
+ message.result = 28;
1178
+ break;
1179
+ case "RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING":
1180
+ case 29:
1181
+ message.result = 29;
1182
+ break;
1183
+ case "RESULT_CODE_ROLE_INVALID_RECOVERY_CASE":
1184
+ case 30:
1185
+ message.result = 30;
1186
+ break;
1187
+ case "RESULT_CODE_ROLE_UNKNOWN_OPERATION":
1188
+ case 31:
1189
+ message.result = 31;
1190
+ break;
1191
+ case "RESULT_CODE_ROLE_INVALID_WRITER_KEY":
1192
+ case 32:
1193
+ message.result = 32;
1194
+ break;
1195
+ case "RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE":
1196
+ case 33:
1197
+ message.result = 33;
1198
+ break;
1199
+ case "RESULT_CODE_MSB_BOOTSTRAP_MISMATCH":
1200
+ case 34:
1201
+ message.result = 34;
1202
+ break;
1203
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED":
1204
+ case 35:
1205
+ message.result = 35;
1206
+ break;
1207
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING":
1208
+ case 36:
1209
+ message.result = 36;
1210
+ break;
1211
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH":
1212
+ case 37:
1213
+ message.result = 37;
1214
+ break;
1215
+ case "RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS":
1216
+ case 38:
1217
+ message.result = 38;
1218
+ break;
1219
+ case "RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID":
1220
+ case 39:
1221
+ message.result = 39;
1222
+ break;
1223
+ case "RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID":
1224
+ case 40:
1225
+ message.result = 40;
1226
+ break;
1227
+ case "RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE":
1228
+ case 41:
1229
+ message.result = 41;
1230
+ break;
1231
+ case "RESULT_CODE_TRANSFER_SENDER_NOT_FOUND":
1232
+ case 42:
1233
+ message.result = 42;
1234
+ break;
1235
+ case "RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE":
1236
+ case 43:
1237
+ message.result = 43;
1238
+ break;
1239
+ case "RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW":
1240
+ case 44:
1241
+ message.result = 44;
1242
+ break;
1243
+ case "RESULT_CODE_TX_HASH_INVALID_FORMAT":
1244
+ case 45:
1245
+ message.result = 45;
1246
+ break;
1247
+ case "RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED":
1248
+ case 46:
1249
+ message.result = 46;
1250
+ break;
1251
+ case "RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING":
1252
+ case 47:
1253
+ message.result = 47;
1254
+ break;
1255
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID":
1256
+ case 48:
1257
+ message.result = 48;
1258
+ break;
1259
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN":
1260
+ case 49:
1261
+ message.result = 49;
1262
+ break;
1263
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED":
1264
+ case 50:
1265
+ message.result = 50;
1266
+ break;
1267
+ case "RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID":
1268
+ case 51:
1269
+ message.result = 51;
1270
+ break;
1271
+ case "RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA":
1272
+ case 52:
1273
+ message.result = 52;
1274
+ break;
1275
+ case "RESULT_CODE_PROOF_PAYLOAD_MISMATCH":
1276
+ case 53:
1277
+ message.result = 53;
1278
+ break;
1279
+ case "RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED":
1280
+ case 54:
1281
+ message.result = 54;
1282
+ break;
1283
+ case "RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH":
1284
+ case 55:
1285
+ message.result = 55;
1286
+ break;
1287
+ case "RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND":
1288
+ case 56:
1289
+ message.result = 56;
1290
+ break;
1291
+ case "RESULT_CODE_VALIDATOR_NODE_NOT_WRITER":
1292
+ case 57:
1293
+ message.result = 57;
1294
+ break;
1295
+ case "RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH":
1296
+ case 58:
1297
+ message.result = 58;
1298
+ break;
1299
+ case "RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID":
1300
+ case 59:
1301
+ message.result = 59;
1302
+ break;
1303
+ case "RESULT_CODE_VALIDATOR_VA_MISSING":
1304
+ case 60:
1305
+ message.result = 60;
1306
+ break;
1307
+ case "RESULT_CODE_TX_INVALID_PAYLOAD":
1308
+ case 61:
1309
+ message.result = 61;
1310
+ break;
1311
+ }
1312
+ return message;
1313
+ };
1314
+
1315
+ /**
1316
+ * Creates a plain object from a LivenessResponse message. Also converts values to other types if specified.
1317
+ * @function toObject
1318
+ * @memberof network.v1.LivenessResponse
1319
+ * @static
1320
+ * @param {network.v1.LivenessResponse} message LivenessResponse
1321
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1322
+ * @returns {Object.<string,*>} Plain object
1323
+ */
1324
+ LivenessResponse.toObject = function toObject(message, options) {
1325
+ if (!options)
1326
+ options = {};
1327
+ var object = {};
1328
+ if (options.defaults) {
1329
+ if (options.bytes === String)
1330
+ object.nonce = "";
1331
+ else {
1332
+ object.nonce = [];
1333
+ if (options.bytes !== Array)
1334
+ object.nonce = $util.newBuffer(object.nonce);
1335
+ }
1336
+ if (options.bytes === String)
1337
+ object.signature = "";
1338
+ else {
1339
+ object.signature = [];
1340
+ if (options.bytes !== Array)
1341
+ object.signature = $util.newBuffer(object.signature);
1342
+ }
1343
+ object.result = options.enums === String ? "RESULT_CODE_UNSPECIFIED" : 0;
1344
+ }
1345
+ if (message.nonce != null && message.hasOwnProperty("nonce"))
1346
+ object.nonce = options.bytes === String ? $util.base64.encode(message.nonce, 0, message.nonce.length) : options.bytes === Array ? Array.prototype.slice.call(message.nonce) : message.nonce;
1347
+ if (message.signature != null && message.hasOwnProperty("signature"))
1348
+ object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature;
1349
+ if (message.result != null && message.hasOwnProperty("result"))
1350
+ object.result = options.enums === String ? $root.network.v1.ResultCode[message.result] === undefined ? message.result : $root.network.v1.ResultCode[message.result] : message.result;
1351
+ return object;
1352
+ };
1353
+
1354
+ /**
1355
+ * Converts this LivenessResponse to JSON.
1356
+ * @function toJSON
1357
+ * @memberof network.v1.LivenessResponse
1358
+ * @instance
1359
+ * @returns {Object.<string,*>} JSON object
1360
+ */
1361
+ LivenessResponse.prototype.toJSON = function toJSON() {
1362
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1363
+ };
1364
+
1365
+ /**
1366
+ * Gets the default type url for LivenessResponse
1367
+ * @function getTypeUrl
1368
+ * @memberof network.v1.LivenessResponse
1369
+ * @static
1370
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1371
+ * @returns {string} The default type url
1372
+ */
1373
+ LivenessResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1374
+ if (typeUrlPrefix === undefined) {
1375
+ typeUrlPrefix = "type.googleapis.com";
1376
+ }
1377
+ return typeUrlPrefix + "/network.v1.LivenessResponse";
1378
+ };
1379
+
1380
+ return LivenessResponse;
1381
+ })();
1382
+
1383
+ /**
1384
+ * ResultCode enum.
1385
+ * @name network.v1.ResultCode
1386
+ * @enum {number}
1387
+ * @property {number} RESULT_CODE_UNSPECIFIED=0 RESULT_CODE_UNSPECIFIED value
1388
+ * @property {number} RESULT_CODE_OK=1 RESULT_CODE_OK value
1389
+ * @property {number} RESULT_CODE_INVALID_PAYLOAD=2 RESULT_CODE_INVALID_PAYLOAD value
1390
+ * @property {number} RESULT_CODE_RATE_LIMITED=3 RESULT_CODE_RATE_LIMITED value
1391
+ * @property {number} RESULT_CODE_SIGNATURE_INVALID=4 RESULT_CODE_SIGNATURE_INVALID value
1392
+ * @property {number} RESULT_CODE_UNEXPECTED_ERROR=5 RESULT_CODE_UNEXPECTED_ERROR value
1393
+ * @property {number} RESULT_CODE_TIMEOUT=6 RESULT_CODE_TIMEOUT value
1394
+ * @property {number} RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS=7 RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS value
1395
+ * @property {number} RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE=8 RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE value
1396
+ * @property {number} RESULT_CODE_NODE_OVERLOADED=9 RESULT_CODE_NODE_OVERLOADED value
1397
+ * @property {number} RESULT_CODE_TX_ALREADY_PENDING=10 RESULT_CODE_TX_ALREADY_PENDING value
1398
+ * @property {number} RESULT_CODE_OPERATION_TYPE_UNKNOWN=11 RESULT_CODE_OPERATION_TYPE_UNKNOWN value
1399
+ * @property {number} RESULT_CODE_SCHEMA_VALIDATION_FAILED=12 RESULT_CODE_SCHEMA_VALIDATION_FAILED value
1400
+ * @property {number} RESULT_CODE_REQUESTER_ADDRESS_INVALID=13 RESULT_CODE_REQUESTER_ADDRESS_INVALID value
1401
+ * @property {number} RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID=14 RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID value
1402
+ * @property {number} RESULT_CODE_TX_HASH_MISMATCH=15 RESULT_CODE_TX_HASH_MISMATCH value
1403
+ * @property {number} RESULT_CODE_TX_SIGNATURE_INVALID=16 RESULT_CODE_TX_SIGNATURE_INVALID value
1404
+ * @property {number} RESULT_CODE_TX_EXPIRED=17 RESULT_CODE_TX_EXPIRED value
1405
+ * @property {number} RESULT_CODE_TX_ALREADY_EXISTS=18 RESULT_CODE_TX_ALREADY_EXISTS value
1406
+ * @property {number} RESULT_CODE_OPERATION_ALREADY_COMPLETED=19 RESULT_CODE_OPERATION_ALREADY_COMPLETED value
1407
+ * @property {number} RESULT_CODE_REQUESTER_NOT_FOUND=20 RESULT_CODE_REQUESTER_NOT_FOUND value
1408
+ * @property {number} RESULT_CODE_INSUFFICIENT_FEE_BALANCE=21 RESULT_CODE_INSUFFICIENT_FEE_BALANCE value
1409
+ * @property {number} RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP=22 RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP value
1410
+ * @property {number} RESULT_CODE_SELF_VALIDATION_FORBIDDEN=23 RESULT_CODE_SELF_VALIDATION_FORBIDDEN value
1411
+ * @property {number} RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND=24 RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND value
1412
+ * @property {number} RESULT_CODE_ROLE_NODE_ALREADY_WRITER=25 RESULT_CODE_ROLE_NODE_ALREADY_WRITER value
1413
+ * @property {number} RESULT_CODE_ROLE_NODE_NOT_WHITELISTED=26 RESULT_CODE_ROLE_NODE_NOT_WHITELISTED value
1414
+ * @property {number} RESULT_CODE_ROLE_NODE_NOT_WRITER=27 RESULT_CODE_ROLE_NODE_NOT_WRITER value
1415
+ * @property {number} RESULT_CODE_ROLE_NODE_IS_INDEXER=28 RESULT_CODE_ROLE_NODE_IS_INDEXER value
1416
+ * @property {number} RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING=29 RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING value
1417
+ * @property {number} RESULT_CODE_ROLE_INVALID_RECOVERY_CASE=30 RESULT_CODE_ROLE_INVALID_RECOVERY_CASE value
1418
+ * @property {number} RESULT_CODE_ROLE_UNKNOWN_OPERATION=31 RESULT_CODE_ROLE_UNKNOWN_OPERATION value
1419
+ * @property {number} RESULT_CODE_ROLE_INVALID_WRITER_KEY=32 RESULT_CODE_ROLE_INVALID_WRITER_KEY value
1420
+ * @property {number} RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE=33 RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE value
1421
+ * @property {number} RESULT_CODE_MSB_BOOTSTRAP_MISMATCH=34 RESULT_CODE_MSB_BOOTSTRAP_MISMATCH value
1422
+ * @property {number} RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED=35 RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED value
1423
+ * @property {number} RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING=36 RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING value
1424
+ * @property {number} RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH=37 RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH value
1425
+ * @property {number} RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS=38 RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS value
1426
+ * @property {number} RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID=39 RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID value
1427
+ * @property {number} RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID=40 RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID value
1428
+ * @property {number} RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE=41 RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE value
1429
+ * @property {number} RESULT_CODE_TRANSFER_SENDER_NOT_FOUND=42 RESULT_CODE_TRANSFER_SENDER_NOT_FOUND value
1430
+ * @property {number} RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE=43 RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE value
1431
+ * @property {number} RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW=44 RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW value
1432
+ * @property {number} RESULT_CODE_TX_HASH_INVALID_FORMAT=45 RESULT_CODE_TX_HASH_INVALID_FORMAT value
1433
+ * @property {number} RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED=46 RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED value
1434
+ * @property {number} RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING=47 RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING value
1435
+ * @property {number} RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID=48 RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID value
1436
+ * @property {number} RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN=49 RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN value
1437
+ * @property {number} RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED=50 RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED value
1438
+ * @property {number} RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID=51 RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID value
1439
+ * @property {number} RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA=52 RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA value
1440
+ * @property {number} RESULT_CODE_PROOF_PAYLOAD_MISMATCH=53 RESULT_CODE_PROOF_PAYLOAD_MISMATCH value
1441
+ * @property {number} RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED=54 RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED value
1442
+ * @property {number} RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH=55 RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH value
1443
+ * @property {number} RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND=56 RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND value
1444
+ * @property {number} RESULT_CODE_VALIDATOR_NODE_NOT_WRITER=57 RESULT_CODE_VALIDATOR_NODE_NOT_WRITER value
1445
+ * @property {number} RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH=58 RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH value
1446
+ * @property {number} RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID=59 RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID value
1447
+ * @property {number} RESULT_CODE_VALIDATOR_VA_MISSING=60 RESULT_CODE_VALIDATOR_VA_MISSING value
1448
+ * @property {number} RESULT_CODE_TX_INVALID_PAYLOAD=61 RESULT_CODE_TX_INVALID_PAYLOAD value
1449
+ */
1450
+ v1.ResultCode = (function() {
1451
+ var valuesById = {}, values = Object.create(valuesById);
1452
+ values[valuesById[0] = "RESULT_CODE_UNSPECIFIED"] = 0;
1453
+ values[valuesById[1] = "RESULT_CODE_OK"] = 1;
1454
+ values[valuesById[2] = "RESULT_CODE_INVALID_PAYLOAD"] = 2;
1455
+ values[valuesById[3] = "RESULT_CODE_RATE_LIMITED"] = 3;
1456
+ values[valuesById[4] = "RESULT_CODE_SIGNATURE_INVALID"] = 4;
1457
+ values[valuesById[5] = "RESULT_CODE_UNEXPECTED_ERROR"] = 5;
1458
+ values[valuesById[6] = "RESULT_CODE_TIMEOUT"] = 6;
1459
+ values[valuesById[7] = "RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS"] = 7;
1460
+ values[valuesById[8] = "RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE"] = 8;
1461
+ values[valuesById[9] = "RESULT_CODE_NODE_OVERLOADED"] = 9;
1462
+ values[valuesById[10] = "RESULT_CODE_TX_ALREADY_PENDING"] = 10;
1463
+ values[valuesById[11] = "RESULT_CODE_OPERATION_TYPE_UNKNOWN"] = 11;
1464
+ values[valuesById[12] = "RESULT_CODE_SCHEMA_VALIDATION_FAILED"] = 12;
1465
+ values[valuesById[13] = "RESULT_CODE_REQUESTER_ADDRESS_INVALID"] = 13;
1466
+ values[valuesById[14] = "RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID"] = 14;
1467
+ values[valuesById[15] = "RESULT_CODE_TX_HASH_MISMATCH"] = 15;
1468
+ values[valuesById[16] = "RESULT_CODE_TX_SIGNATURE_INVALID"] = 16;
1469
+ values[valuesById[17] = "RESULT_CODE_TX_EXPIRED"] = 17;
1470
+ values[valuesById[18] = "RESULT_CODE_TX_ALREADY_EXISTS"] = 18;
1471
+ values[valuesById[19] = "RESULT_CODE_OPERATION_ALREADY_COMPLETED"] = 19;
1472
+ values[valuesById[20] = "RESULT_CODE_REQUESTER_NOT_FOUND"] = 20;
1473
+ values[valuesById[21] = "RESULT_CODE_INSUFFICIENT_FEE_BALANCE"] = 21;
1474
+ values[valuesById[22] = "RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP"] = 22;
1475
+ values[valuesById[23] = "RESULT_CODE_SELF_VALIDATION_FORBIDDEN"] = 23;
1476
+ values[valuesById[24] = "RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND"] = 24;
1477
+ values[valuesById[25] = "RESULT_CODE_ROLE_NODE_ALREADY_WRITER"] = 25;
1478
+ values[valuesById[26] = "RESULT_CODE_ROLE_NODE_NOT_WHITELISTED"] = 26;
1479
+ values[valuesById[27] = "RESULT_CODE_ROLE_NODE_NOT_WRITER"] = 27;
1480
+ values[valuesById[28] = "RESULT_CODE_ROLE_NODE_IS_INDEXER"] = 28;
1481
+ values[valuesById[29] = "RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING"] = 29;
1482
+ values[valuesById[30] = "RESULT_CODE_ROLE_INVALID_RECOVERY_CASE"] = 30;
1483
+ values[valuesById[31] = "RESULT_CODE_ROLE_UNKNOWN_OPERATION"] = 31;
1484
+ values[valuesById[32] = "RESULT_CODE_ROLE_INVALID_WRITER_KEY"] = 32;
1485
+ values[valuesById[33] = "RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE"] = 33;
1486
+ values[valuesById[34] = "RESULT_CODE_MSB_BOOTSTRAP_MISMATCH"] = 34;
1487
+ values[valuesById[35] = "RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED"] = 35;
1488
+ values[valuesById[36] = "RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING"] = 36;
1489
+ values[valuesById[37] = "RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH"] = 37;
1490
+ values[valuesById[38] = "RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS"] = 38;
1491
+ values[valuesById[39] = "RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID"] = 39;
1492
+ values[valuesById[40] = "RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID"] = 40;
1493
+ values[valuesById[41] = "RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE"] = 41;
1494
+ values[valuesById[42] = "RESULT_CODE_TRANSFER_SENDER_NOT_FOUND"] = 42;
1495
+ values[valuesById[43] = "RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE"] = 43;
1496
+ values[valuesById[44] = "RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW"] = 44;
1497
+ values[valuesById[45] = "RESULT_CODE_TX_HASH_INVALID_FORMAT"] = 45;
1498
+ values[valuesById[46] = "RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED"] = 46;
1499
+ values[valuesById[47] = "RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING"] = 47;
1500
+ values[valuesById[48] = "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID"] = 48;
1501
+ values[valuesById[49] = "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN"] = 49;
1502
+ values[valuesById[50] = "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED"] = 50;
1503
+ values[valuesById[51] = "RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID"] = 51;
1504
+ values[valuesById[52] = "RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA"] = 52;
1505
+ values[valuesById[53] = "RESULT_CODE_PROOF_PAYLOAD_MISMATCH"] = 53;
1506
+ values[valuesById[54] = "RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED"] = 54;
1507
+ values[valuesById[55] = "RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH"] = 55;
1508
+ values[valuesById[56] = "RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND"] = 56;
1509
+ values[valuesById[57] = "RESULT_CODE_VALIDATOR_NODE_NOT_WRITER"] = 57;
1510
+ values[valuesById[58] = "RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH"] = 58;
1511
+ values[valuesById[59] = "RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID"] = 59;
1512
+ values[valuesById[60] = "RESULT_CODE_VALIDATOR_VA_MISSING"] = 60;
1513
+ values[valuesById[61] = "RESULT_CODE_TX_INVALID_PAYLOAD"] = 61;
1514
+ return values;
1515
+ })();
1516
+
1517
+ v1.BroadcastTransactionRequest = (function() {
1518
+
1519
+ /**
1520
+ * Properties of a BroadcastTransactionRequest.
1521
+ * @memberof network.v1
1522
+ * @interface IBroadcastTransactionRequest
1523
+ * @property {Uint8Array|null} [data] BroadcastTransactionRequest data
1524
+ * @property {Uint8Array|null} [nonce] BroadcastTransactionRequest nonce
1525
+ * @property {Uint8Array|null} [signature] BroadcastTransactionRequest signature
1526
+ */
1527
+
1528
+ /**
1529
+ * Constructs a new BroadcastTransactionRequest.
1530
+ * @memberof network.v1
1531
+ * @classdesc Represents a BroadcastTransactionRequest.
1532
+ * @implements IBroadcastTransactionRequest
1533
+ * @constructor
1534
+ * @param {network.v1.IBroadcastTransactionRequest=} [properties] Properties to set
1535
+ */
1536
+ function BroadcastTransactionRequest(properties) {
1537
+ if (properties)
1538
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1539
+ if (properties[keys[i]] != null)
1540
+ this[keys[i]] = properties[keys[i]];
1541
+ }
1542
+
1543
+ /**
1544
+ * BroadcastTransactionRequest data.
1545
+ * @member {Uint8Array} data
1546
+ * @memberof network.v1.BroadcastTransactionRequest
1547
+ * @instance
1548
+ */
1549
+ BroadcastTransactionRequest.prototype.data = $util.newBuffer([]);
1550
+
1551
+ /**
1552
+ * BroadcastTransactionRequest nonce.
1553
+ * @member {Uint8Array} nonce
1554
+ * @memberof network.v1.BroadcastTransactionRequest
1555
+ * @instance
1556
+ */
1557
+ BroadcastTransactionRequest.prototype.nonce = $util.newBuffer([]);
1558
+
1559
+ /**
1560
+ * BroadcastTransactionRequest signature.
1561
+ * @member {Uint8Array} signature
1562
+ * @memberof network.v1.BroadcastTransactionRequest
1563
+ * @instance
1564
+ */
1565
+ BroadcastTransactionRequest.prototype.signature = $util.newBuffer([]);
1566
+
1567
+ /**
1568
+ * Creates a new BroadcastTransactionRequest instance using the specified properties.
1569
+ * @function create
1570
+ * @memberof network.v1.BroadcastTransactionRequest
1571
+ * @static
1572
+ * @param {network.v1.IBroadcastTransactionRequest=} [properties] Properties to set
1573
+ * @returns {network.v1.BroadcastTransactionRequest} BroadcastTransactionRequest instance
1574
+ */
1575
+ BroadcastTransactionRequest.create = function create(properties) {
1576
+ return new BroadcastTransactionRequest(properties);
1577
+ };
1578
+
1579
+ /**
1580
+ * Encodes the specified BroadcastTransactionRequest message. Does not implicitly {@link network.v1.BroadcastTransactionRequest.verify|verify} messages.
1581
+ * @function encode
1582
+ * @memberof network.v1.BroadcastTransactionRequest
1583
+ * @static
1584
+ * @param {network.v1.IBroadcastTransactionRequest} message BroadcastTransactionRequest message or plain object to encode
1585
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1586
+ * @returns {$protobuf.Writer} Writer
1587
+ */
1588
+ BroadcastTransactionRequest.encode = function encode(message, writer) {
1589
+ if (!writer)
1590
+ writer = $Writer.create();
1591
+ if (message.data != null && Object.hasOwnProperty.call(message, "data"))
1592
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data);
1593
+ if (message.nonce != null && Object.hasOwnProperty.call(message, "nonce"))
1594
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.nonce);
1595
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
1596
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.signature);
1597
+ return writer;
1598
+ };
1599
+
1600
+ /**
1601
+ * Encodes the specified BroadcastTransactionRequest message, length delimited. Does not implicitly {@link network.v1.BroadcastTransactionRequest.verify|verify} messages.
1602
+ * @function encodeDelimited
1603
+ * @memberof network.v1.BroadcastTransactionRequest
1604
+ * @static
1605
+ * @param {network.v1.IBroadcastTransactionRequest} message BroadcastTransactionRequest message or plain object to encode
1606
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1607
+ * @returns {$protobuf.Writer} Writer
1608
+ */
1609
+ BroadcastTransactionRequest.encodeDelimited = function encodeDelimited(message, writer) {
1610
+ return this.encode(message, writer).ldelim();
1611
+ };
1612
+
1613
+ /**
1614
+ * Decodes a BroadcastTransactionRequest message from the specified reader or buffer.
1615
+ * @function decode
1616
+ * @memberof network.v1.BroadcastTransactionRequest
1617
+ * @static
1618
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1619
+ * @param {number} [length] Message length if known beforehand
1620
+ * @returns {network.v1.BroadcastTransactionRequest} BroadcastTransactionRequest
1621
+ * @throws {Error} If the payload is not a reader or valid buffer
1622
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1623
+ */
1624
+ BroadcastTransactionRequest.decode = function decode(reader, length, error) {
1625
+ if (!(reader instanceof $Reader))
1626
+ reader = $Reader.create(reader);
1627
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.network.v1.BroadcastTransactionRequest();
1628
+ while (reader.pos < end) {
1629
+ var tag = reader.uint32();
1630
+ if (tag === error)
1631
+ break;
1632
+ switch (tag >>> 3) {
1633
+ case 1: {
1634
+ message.data = reader.bytes();
1635
+ break;
1636
+ }
1637
+ case 2: {
1638
+ message.nonce = reader.bytes();
1639
+ break;
1640
+ }
1641
+ case 3: {
1642
+ message.signature = reader.bytes();
1643
+ break;
1644
+ }
1645
+ default:
1646
+ reader.skipType(tag & 7);
1647
+ break;
1648
+ }
1649
+ }
1650
+ return message;
1651
+ };
1652
+
1653
+ /**
1654
+ * Decodes a BroadcastTransactionRequest message from the specified reader or buffer, length delimited.
1655
+ * @function decodeDelimited
1656
+ * @memberof network.v1.BroadcastTransactionRequest
1657
+ * @static
1658
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1659
+ * @returns {network.v1.BroadcastTransactionRequest} BroadcastTransactionRequest
1660
+ * @throws {Error} If the payload is not a reader or valid buffer
1661
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1662
+ */
1663
+ BroadcastTransactionRequest.decodeDelimited = function decodeDelimited(reader) {
1664
+ if (!(reader instanceof $Reader))
1665
+ reader = new $Reader(reader);
1666
+ return this.decode(reader, reader.uint32());
1667
+ };
1668
+
1669
+ /**
1670
+ * Verifies a BroadcastTransactionRequest message.
1671
+ * @function verify
1672
+ * @memberof network.v1.BroadcastTransactionRequest
1673
+ * @static
1674
+ * @param {Object.<string,*>} message Plain object to verify
1675
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1676
+ */
1677
+ BroadcastTransactionRequest.verify = function verify(message) {
1678
+ if (typeof message !== "object" || message === null)
1679
+ return "object expected";
1680
+ if (message.data != null && message.hasOwnProperty("data"))
1681
+ if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data)))
1682
+ return "data: buffer expected";
1683
+ if (message.nonce != null && message.hasOwnProperty("nonce"))
1684
+ if (!(message.nonce && typeof message.nonce.length === "number" || $util.isString(message.nonce)))
1685
+ return "nonce: buffer expected";
1686
+ if (message.signature != null && message.hasOwnProperty("signature"))
1687
+ if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature)))
1688
+ return "signature: buffer expected";
1689
+ return null;
1690
+ };
1691
+
1692
+ /**
1693
+ * Creates a BroadcastTransactionRequest message from a plain object. Also converts values to their respective internal types.
1694
+ * @function fromObject
1695
+ * @memberof network.v1.BroadcastTransactionRequest
1696
+ * @static
1697
+ * @param {Object.<string,*>} object Plain object
1698
+ * @returns {network.v1.BroadcastTransactionRequest} BroadcastTransactionRequest
1699
+ */
1700
+ BroadcastTransactionRequest.fromObject = function fromObject(object) {
1701
+ if (object instanceof $root.network.v1.BroadcastTransactionRequest)
1702
+ return object;
1703
+ var message = new $root.network.v1.BroadcastTransactionRequest();
1704
+ if (object.data != null)
1705
+ if (typeof object.data === "string")
1706
+ $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0);
1707
+ else if (object.data.length >= 0)
1708
+ message.data = object.data;
1709
+ if (object.nonce != null)
1710
+ if (typeof object.nonce === "string")
1711
+ $util.base64.decode(object.nonce, message.nonce = $util.newBuffer($util.base64.length(object.nonce)), 0);
1712
+ else if (object.nonce.length >= 0)
1713
+ message.nonce = object.nonce;
1714
+ if (object.signature != null)
1715
+ if (typeof object.signature === "string")
1716
+ $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0);
1717
+ else if (object.signature.length >= 0)
1718
+ message.signature = object.signature;
1719
+ return message;
1720
+ };
1721
+
1722
+ /**
1723
+ * Creates a plain object from a BroadcastTransactionRequest message. Also converts values to other types if specified.
1724
+ * @function toObject
1725
+ * @memberof network.v1.BroadcastTransactionRequest
1726
+ * @static
1727
+ * @param {network.v1.BroadcastTransactionRequest} message BroadcastTransactionRequest
1728
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
1729
+ * @returns {Object.<string,*>} Plain object
1730
+ */
1731
+ BroadcastTransactionRequest.toObject = function toObject(message, options) {
1732
+ if (!options)
1733
+ options = {};
1734
+ var object = {};
1735
+ if (options.defaults) {
1736
+ if (options.bytes === String)
1737
+ object.data = "";
1738
+ else {
1739
+ object.data = [];
1740
+ if (options.bytes !== Array)
1741
+ object.data = $util.newBuffer(object.data);
1742
+ }
1743
+ if (options.bytes === String)
1744
+ object.nonce = "";
1745
+ else {
1746
+ object.nonce = [];
1747
+ if (options.bytes !== Array)
1748
+ object.nonce = $util.newBuffer(object.nonce);
1749
+ }
1750
+ if (options.bytes === String)
1751
+ object.signature = "";
1752
+ else {
1753
+ object.signature = [];
1754
+ if (options.bytes !== Array)
1755
+ object.signature = $util.newBuffer(object.signature);
1756
+ }
1757
+ }
1758
+ if (message.data != null && message.hasOwnProperty("data"))
1759
+ object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data;
1760
+ if (message.nonce != null && message.hasOwnProperty("nonce"))
1761
+ object.nonce = options.bytes === String ? $util.base64.encode(message.nonce, 0, message.nonce.length) : options.bytes === Array ? Array.prototype.slice.call(message.nonce) : message.nonce;
1762
+ if (message.signature != null && message.hasOwnProperty("signature"))
1763
+ object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature;
1764
+ return object;
1765
+ };
1766
+
1767
+ /**
1768
+ * Converts this BroadcastTransactionRequest to JSON.
1769
+ * @function toJSON
1770
+ * @memberof network.v1.BroadcastTransactionRequest
1771
+ * @instance
1772
+ * @returns {Object.<string,*>} JSON object
1773
+ */
1774
+ BroadcastTransactionRequest.prototype.toJSON = function toJSON() {
1775
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1776
+ };
1777
+
1778
+ /**
1779
+ * Gets the default type url for BroadcastTransactionRequest
1780
+ * @function getTypeUrl
1781
+ * @memberof network.v1.BroadcastTransactionRequest
1782
+ * @static
1783
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1784
+ * @returns {string} The default type url
1785
+ */
1786
+ BroadcastTransactionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
1787
+ if (typeUrlPrefix === undefined) {
1788
+ typeUrlPrefix = "type.googleapis.com";
1789
+ }
1790
+ return typeUrlPrefix + "/network.v1.BroadcastTransactionRequest";
1791
+ };
1792
+
1793
+ return BroadcastTransactionRequest;
1794
+ })();
1795
+
1796
+ v1.BroadcastTransactionResponse = (function() {
1797
+
1798
+ /**
1799
+ * Properties of a BroadcastTransactionResponse.
1800
+ * @memberof network.v1
1801
+ * @interface IBroadcastTransactionResponse
1802
+ * @property {Uint8Array|null} [nonce] BroadcastTransactionResponse nonce
1803
+ * @property {Uint8Array|null} [signature] BroadcastTransactionResponse signature
1804
+ * @property {Uint8Array|null} [proof] BroadcastTransactionResponse proof
1805
+ * @property {number|Long|null} [timestamp] BroadcastTransactionResponse timestamp
1806
+ * @property {network.v1.ResultCode|null} [result] BroadcastTransactionResponse result
1807
+ */
1808
+
1809
+ /**
1810
+ * Constructs a new BroadcastTransactionResponse.
1811
+ * @memberof network.v1
1812
+ * @classdesc Represents a BroadcastTransactionResponse.
1813
+ * @implements IBroadcastTransactionResponse
1814
+ * @constructor
1815
+ * @param {network.v1.IBroadcastTransactionResponse=} [properties] Properties to set
1816
+ */
1817
+ function BroadcastTransactionResponse(properties) {
1818
+ if (properties)
1819
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1820
+ if (properties[keys[i]] != null)
1821
+ this[keys[i]] = properties[keys[i]];
1822
+ }
1823
+
1824
+ /**
1825
+ * BroadcastTransactionResponse nonce.
1826
+ * @member {Uint8Array} nonce
1827
+ * @memberof network.v1.BroadcastTransactionResponse
1828
+ * @instance
1829
+ */
1830
+ BroadcastTransactionResponse.prototype.nonce = $util.newBuffer([]);
1831
+
1832
+ /**
1833
+ * BroadcastTransactionResponse signature.
1834
+ * @member {Uint8Array} signature
1835
+ * @memberof network.v1.BroadcastTransactionResponse
1836
+ * @instance
1837
+ */
1838
+ BroadcastTransactionResponse.prototype.signature = $util.newBuffer([]);
1839
+
1840
+ /**
1841
+ * BroadcastTransactionResponse proof.
1842
+ * @member {Uint8Array} proof
1843
+ * @memberof network.v1.BroadcastTransactionResponse
1844
+ * @instance
1845
+ */
1846
+ BroadcastTransactionResponse.prototype.proof = $util.newBuffer([]);
1847
+
1848
+ /**
1849
+ * BroadcastTransactionResponse timestamp.
1850
+ * @member {number|Long} timestamp
1851
+ * @memberof network.v1.BroadcastTransactionResponse
1852
+ * @instance
1853
+ */
1854
+ BroadcastTransactionResponse.prototype.timestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
1855
+
1856
+ /**
1857
+ * BroadcastTransactionResponse result.
1858
+ * @member {network.v1.ResultCode} result
1859
+ * @memberof network.v1.BroadcastTransactionResponse
1860
+ * @instance
1861
+ */
1862
+ BroadcastTransactionResponse.prototype.result = 0;
1863
+
1864
+ /**
1865
+ * Creates a new BroadcastTransactionResponse instance using the specified properties.
1866
+ * @function create
1867
+ * @memberof network.v1.BroadcastTransactionResponse
1868
+ * @static
1869
+ * @param {network.v1.IBroadcastTransactionResponse=} [properties] Properties to set
1870
+ * @returns {network.v1.BroadcastTransactionResponse} BroadcastTransactionResponse instance
1871
+ */
1872
+ BroadcastTransactionResponse.create = function create(properties) {
1873
+ return new BroadcastTransactionResponse(properties);
1874
+ };
1875
+
1876
+ /**
1877
+ * Encodes the specified BroadcastTransactionResponse message. Does not implicitly {@link network.v1.BroadcastTransactionResponse.verify|verify} messages.
1878
+ * @function encode
1879
+ * @memberof network.v1.BroadcastTransactionResponse
1880
+ * @static
1881
+ * @param {network.v1.IBroadcastTransactionResponse} message BroadcastTransactionResponse message or plain object to encode
1882
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1883
+ * @returns {$protobuf.Writer} Writer
1884
+ */
1885
+ BroadcastTransactionResponse.encode = function encode(message, writer) {
1886
+ if (!writer)
1887
+ writer = $Writer.create();
1888
+ if (message.nonce != null && Object.hasOwnProperty.call(message, "nonce"))
1889
+ writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.nonce);
1890
+ if (message.signature != null && Object.hasOwnProperty.call(message, "signature"))
1891
+ writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.signature);
1892
+ if (message.proof != null && Object.hasOwnProperty.call(message, "proof"))
1893
+ writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.proof);
1894
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
1895
+ writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.timestamp);
1896
+ if (message.result != null && Object.hasOwnProperty.call(message, "result"))
1897
+ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.result);
1898
+ return writer;
1899
+ };
1900
+
1901
+ /**
1902
+ * Encodes the specified BroadcastTransactionResponse message, length delimited. Does not implicitly {@link network.v1.BroadcastTransactionResponse.verify|verify} messages.
1903
+ * @function encodeDelimited
1904
+ * @memberof network.v1.BroadcastTransactionResponse
1905
+ * @static
1906
+ * @param {network.v1.IBroadcastTransactionResponse} message BroadcastTransactionResponse message or plain object to encode
1907
+ * @param {$protobuf.Writer} [writer] Writer to encode to
1908
+ * @returns {$protobuf.Writer} Writer
1909
+ */
1910
+ BroadcastTransactionResponse.encodeDelimited = function encodeDelimited(message, writer) {
1911
+ return this.encode(message, writer).ldelim();
1912
+ };
1913
+
1914
+ /**
1915
+ * Decodes a BroadcastTransactionResponse message from the specified reader or buffer.
1916
+ * @function decode
1917
+ * @memberof network.v1.BroadcastTransactionResponse
1918
+ * @static
1919
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1920
+ * @param {number} [length] Message length if known beforehand
1921
+ * @returns {network.v1.BroadcastTransactionResponse} BroadcastTransactionResponse
1922
+ * @throws {Error} If the payload is not a reader or valid buffer
1923
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1924
+ */
1925
+ BroadcastTransactionResponse.decode = function decode(reader, length, error) {
1926
+ if (!(reader instanceof $Reader))
1927
+ reader = $Reader.create(reader);
1928
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.network.v1.BroadcastTransactionResponse();
1929
+ while (reader.pos < end) {
1930
+ var tag = reader.uint32();
1931
+ if (tag === error)
1932
+ break;
1933
+ switch (tag >>> 3) {
1934
+ case 1: {
1935
+ message.nonce = reader.bytes();
1936
+ break;
1937
+ }
1938
+ case 2: {
1939
+ message.signature = reader.bytes();
1940
+ break;
1941
+ }
1942
+ case 3: {
1943
+ message.proof = reader.bytes();
1944
+ break;
1945
+ }
1946
+ case 4: {
1947
+ message.timestamp = reader.uint64();
1948
+ break;
1949
+ }
1950
+ case 5: {
1951
+ message.result = reader.int32();
1952
+ break;
1953
+ }
1954
+ default:
1955
+ reader.skipType(tag & 7);
1956
+ break;
1957
+ }
1958
+ }
1959
+ return message;
1960
+ };
1961
+
1962
+ /**
1963
+ * Decodes a BroadcastTransactionResponse message from the specified reader or buffer, length delimited.
1964
+ * @function decodeDelimited
1965
+ * @memberof network.v1.BroadcastTransactionResponse
1966
+ * @static
1967
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1968
+ * @returns {network.v1.BroadcastTransactionResponse} BroadcastTransactionResponse
1969
+ * @throws {Error} If the payload is not a reader or valid buffer
1970
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1971
+ */
1972
+ BroadcastTransactionResponse.decodeDelimited = function decodeDelimited(reader) {
1973
+ if (!(reader instanceof $Reader))
1974
+ reader = new $Reader(reader);
1975
+ return this.decode(reader, reader.uint32());
1976
+ };
1977
+
1978
+ /**
1979
+ * Verifies a BroadcastTransactionResponse message.
1980
+ * @function verify
1981
+ * @memberof network.v1.BroadcastTransactionResponse
1982
+ * @static
1983
+ * @param {Object.<string,*>} message Plain object to verify
1984
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
1985
+ */
1986
+ BroadcastTransactionResponse.verify = function verify(message) {
1987
+ if (typeof message !== "object" || message === null)
1988
+ return "object expected";
1989
+ if (message.nonce != null && message.hasOwnProperty("nonce"))
1990
+ if (!(message.nonce && typeof message.nonce.length === "number" || $util.isString(message.nonce)))
1991
+ return "nonce: buffer expected";
1992
+ if (message.signature != null && message.hasOwnProperty("signature"))
1993
+ if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature)))
1994
+ return "signature: buffer expected";
1995
+ if (message.proof != null && message.hasOwnProperty("proof"))
1996
+ if (!(message.proof && typeof message.proof.length === "number" || $util.isString(message.proof)))
1997
+ return "proof: buffer expected";
1998
+ if (message.timestamp != null && message.hasOwnProperty("timestamp"))
1999
+ if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high)))
2000
+ return "timestamp: integer|Long expected";
2001
+ if (message.result != null && message.hasOwnProperty("result"))
2002
+ switch (message.result) {
2003
+ default:
2004
+ return "result: enum value expected";
2005
+ case 0:
2006
+ case 1:
2007
+ case 2:
2008
+ case 3:
2009
+ case 4:
2010
+ case 5:
2011
+ case 6:
2012
+ case 7:
2013
+ case 8:
2014
+ case 9:
2015
+ case 10:
2016
+ case 11:
2017
+ case 12:
2018
+ case 13:
2019
+ case 14:
2020
+ case 15:
2021
+ case 16:
2022
+ case 17:
2023
+ case 18:
2024
+ case 19:
2025
+ case 20:
2026
+ case 21:
2027
+ case 22:
2028
+ case 23:
2029
+ case 24:
2030
+ case 25:
2031
+ case 26:
2032
+ case 27:
2033
+ case 28:
2034
+ case 29:
2035
+ case 30:
2036
+ case 31:
2037
+ case 32:
2038
+ case 33:
2039
+ case 34:
2040
+ case 35:
2041
+ case 36:
2042
+ case 37:
2043
+ case 38:
2044
+ case 39:
2045
+ case 40:
2046
+ case 41:
2047
+ case 42:
2048
+ case 43:
2049
+ case 44:
2050
+ case 45:
2051
+ case 46:
2052
+ case 47:
2053
+ case 48:
2054
+ case 49:
2055
+ case 50:
2056
+ case 51:
2057
+ case 52:
2058
+ case 53:
2059
+ case 54:
2060
+ case 55:
2061
+ case 56:
2062
+ case 57:
2063
+ case 58:
2064
+ case 59:
2065
+ case 60:
2066
+ case 61:
2067
+ break;
2068
+ }
2069
+ return null;
2070
+ };
2071
+
2072
+ /**
2073
+ * Creates a BroadcastTransactionResponse message from a plain object. Also converts values to their respective internal types.
2074
+ * @function fromObject
2075
+ * @memberof network.v1.BroadcastTransactionResponse
2076
+ * @static
2077
+ * @param {Object.<string,*>} object Plain object
2078
+ * @returns {network.v1.BroadcastTransactionResponse} BroadcastTransactionResponse
2079
+ */
2080
+ BroadcastTransactionResponse.fromObject = function fromObject(object) {
2081
+ if (object instanceof $root.network.v1.BroadcastTransactionResponse)
2082
+ return object;
2083
+ var message = new $root.network.v1.BroadcastTransactionResponse();
2084
+ if (object.nonce != null)
2085
+ if (typeof object.nonce === "string")
2086
+ $util.base64.decode(object.nonce, message.nonce = $util.newBuffer($util.base64.length(object.nonce)), 0);
2087
+ else if (object.nonce.length >= 0)
2088
+ message.nonce = object.nonce;
2089
+ if (object.signature != null)
2090
+ if (typeof object.signature === "string")
2091
+ $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0);
2092
+ else if (object.signature.length >= 0)
2093
+ message.signature = object.signature;
2094
+ if (object.proof != null)
2095
+ if (typeof object.proof === "string")
2096
+ $util.base64.decode(object.proof, message.proof = $util.newBuffer($util.base64.length(object.proof)), 0);
2097
+ else if (object.proof.length >= 0)
2098
+ message.proof = object.proof;
2099
+ if (object.timestamp != null)
2100
+ if ($util.Long)
2101
+ (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = true;
2102
+ else if (typeof object.timestamp === "string")
2103
+ message.timestamp = parseInt(object.timestamp, 10);
2104
+ else if (typeof object.timestamp === "number")
2105
+ message.timestamp = object.timestamp;
2106
+ else if (typeof object.timestamp === "object")
2107
+ message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber(true);
2108
+ switch (object.result) {
2109
+ default:
2110
+ if (typeof object.result === "number") {
2111
+ message.result = object.result;
2112
+ break;
2113
+ }
2114
+ break;
2115
+ case "RESULT_CODE_UNSPECIFIED":
2116
+ case 0:
2117
+ message.result = 0;
2118
+ break;
2119
+ case "RESULT_CODE_OK":
2120
+ case 1:
2121
+ message.result = 1;
2122
+ break;
2123
+ case "RESULT_CODE_INVALID_PAYLOAD":
2124
+ case 2:
2125
+ message.result = 2;
2126
+ break;
2127
+ case "RESULT_CODE_RATE_LIMITED":
2128
+ case 3:
2129
+ message.result = 3;
2130
+ break;
2131
+ case "RESULT_CODE_SIGNATURE_INVALID":
2132
+ case 4:
2133
+ message.result = 4;
2134
+ break;
2135
+ case "RESULT_CODE_UNEXPECTED_ERROR":
2136
+ case 5:
2137
+ message.result = 5;
2138
+ break;
2139
+ case "RESULT_CODE_TIMEOUT":
2140
+ case 6:
2141
+ message.result = 6;
2142
+ break;
2143
+ case "RESULT_CODE_NODE_HAS_NO_WRITE_ACCESS":
2144
+ case 7:
2145
+ message.result = 7;
2146
+ break;
2147
+ case "RESULT_CODE_TX_ACCEPTED_PROOF_UNAVAILABLE":
2148
+ case 8:
2149
+ message.result = 8;
2150
+ break;
2151
+ case "RESULT_CODE_NODE_OVERLOADED":
2152
+ case 9:
2153
+ message.result = 9;
2154
+ break;
2155
+ case "RESULT_CODE_TX_ALREADY_PENDING":
2156
+ case 10:
2157
+ message.result = 10;
2158
+ break;
2159
+ case "RESULT_CODE_OPERATION_TYPE_UNKNOWN":
2160
+ case 11:
2161
+ message.result = 11;
2162
+ break;
2163
+ case "RESULT_CODE_SCHEMA_VALIDATION_FAILED":
2164
+ case 12:
2165
+ message.result = 12;
2166
+ break;
2167
+ case "RESULT_CODE_REQUESTER_ADDRESS_INVALID":
2168
+ case 13:
2169
+ message.result = 13;
2170
+ break;
2171
+ case "RESULT_CODE_REQUESTER_PUBLIC_KEY_INVALID":
2172
+ case 14:
2173
+ message.result = 14;
2174
+ break;
2175
+ case "RESULT_CODE_TX_HASH_MISMATCH":
2176
+ case 15:
2177
+ message.result = 15;
2178
+ break;
2179
+ case "RESULT_CODE_TX_SIGNATURE_INVALID":
2180
+ case 16:
2181
+ message.result = 16;
2182
+ break;
2183
+ case "RESULT_CODE_TX_EXPIRED":
2184
+ case 17:
2185
+ message.result = 17;
2186
+ break;
2187
+ case "RESULT_CODE_TX_ALREADY_EXISTS":
2188
+ case 18:
2189
+ message.result = 18;
2190
+ break;
2191
+ case "RESULT_CODE_OPERATION_ALREADY_COMPLETED":
2192
+ case 19:
2193
+ message.result = 19;
2194
+ break;
2195
+ case "RESULT_CODE_REQUESTER_NOT_FOUND":
2196
+ case 20:
2197
+ message.result = 20;
2198
+ break;
2199
+ case "RESULT_CODE_INSUFFICIENT_FEE_BALANCE":
2200
+ case 21:
2201
+ message.result = 21;
2202
+ break;
2203
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_EQUALS_MSB_BOOTSTRAP":
2204
+ case 22:
2205
+ message.result = 22;
2206
+ break;
2207
+ case "RESULT_CODE_SELF_VALIDATION_FORBIDDEN":
2208
+ case 23:
2209
+ message.result = 23;
2210
+ break;
2211
+ case "RESULT_CODE_ROLE_NODE_ENTRY_NOT_FOUND":
2212
+ case 24:
2213
+ message.result = 24;
2214
+ break;
2215
+ case "RESULT_CODE_ROLE_NODE_ALREADY_WRITER":
2216
+ case 25:
2217
+ message.result = 25;
2218
+ break;
2219
+ case "RESULT_CODE_ROLE_NODE_NOT_WHITELISTED":
2220
+ case 26:
2221
+ message.result = 26;
2222
+ break;
2223
+ case "RESULT_CODE_ROLE_NODE_NOT_WRITER":
2224
+ case 27:
2225
+ message.result = 27;
2226
+ break;
2227
+ case "RESULT_CODE_ROLE_NODE_IS_INDEXER":
2228
+ case 28:
2229
+ message.result = 28;
2230
+ break;
2231
+ case "RESULT_CODE_ROLE_ADMIN_ENTRY_MISSING":
2232
+ case 29:
2233
+ message.result = 29;
2234
+ break;
2235
+ case "RESULT_CODE_ROLE_INVALID_RECOVERY_CASE":
2236
+ case 30:
2237
+ message.result = 30;
2238
+ break;
2239
+ case "RESULT_CODE_ROLE_UNKNOWN_OPERATION":
2240
+ case 31:
2241
+ message.result = 31;
2242
+ break;
2243
+ case "RESULT_CODE_ROLE_INVALID_WRITER_KEY":
2244
+ case 32:
2245
+ message.result = 32;
2246
+ break;
2247
+ case "RESULT_CODE_ROLE_INSUFFICIENT_FEE_BALANCE":
2248
+ case 33:
2249
+ message.result = 33;
2250
+ break;
2251
+ case "RESULT_CODE_MSB_BOOTSTRAP_MISMATCH":
2252
+ case 34:
2253
+ message.result = 34;
2254
+ break;
2255
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_NOT_DEPLOYED":
2256
+ case 35:
2257
+ message.result = 35;
2258
+ break;
2259
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_TX_MISSING":
2260
+ case 36:
2261
+ message.result = 36;
2262
+ break;
2263
+ case "RESULT_CODE_EXTERNAL_BOOTSTRAP_MISMATCH":
2264
+ case 37:
2265
+ message.result = 37;
2266
+ break;
2267
+ case "RESULT_CODE_BOOTSTRAP_ALREADY_EXISTS":
2268
+ case 38:
2269
+ message.result = 38;
2270
+ break;
2271
+ case "RESULT_CODE_TRANSFER_RECIPIENT_ADDRESS_INVALID":
2272
+ case 39:
2273
+ message.result = 39;
2274
+ break;
2275
+ case "RESULT_CODE_TRANSFER_RECIPIENT_PUBLIC_KEY_INVALID":
2276
+ case 40:
2277
+ message.result = 40;
2278
+ break;
2279
+ case "RESULT_CODE_TRANSFER_AMOUNT_TOO_LARGE":
2280
+ case 41:
2281
+ message.result = 41;
2282
+ break;
2283
+ case "RESULT_CODE_TRANSFER_SENDER_NOT_FOUND":
2284
+ case 42:
2285
+ message.result = 42;
2286
+ break;
2287
+ case "RESULT_CODE_TRANSFER_INSUFFICIENT_BALANCE":
2288
+ case 43:
2289
+ message.result = 43;
2290
+ break;
2291
+ case "RESULT_CODE_TRANSFER_RECIPIENT_BALANCE_OVERFLOW":
2292
+ case 44:
2293
+ message.result = 44;
2294
+ break;
2295
+ case "RESULT_CODE_TX_HASH_INVALID_FORMAT":
2296
+ case 45:
2297
+ message.result = 45;
2298
+ break;
2299
+ case "RESULT_CODE_INTERNAL_ENQUEUE_VALIDATION_FAILED":
2300
+ case 46:
2301
+ message.result = 46;
2302
+ break;
2303
+ case "RESULT_CODE_TX_COMMITTED_RECEIPT_MISSING":
2304
+ case 47:
2305
+ message.result = 47;
2306
+ break;
2307
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_INVALID":
2308
+ case 48:
2309
+ message.result = 48;
2310
+ break;
2311
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNKNOWN":
2312
+ case 49:
2313
+ message.result = 49;
2314
+ break;
2315
+ case "RESULT_CODE_VALIDATOR_RESPONSE_TX_TYPE_UNSUPPORTED":
2316
+ case 50:
2317
+ message.result = 50;
2318
+ break;
2319
+ case "RESULT_CODE_VALIDATOR_RESPONSE_SCHEMA_INVALID":
2320
+ case 51:
2321
+ message.result = 51;
2322
+ break;
2323
+ case "RESULT_CODE_PENDING_REQUEST_MISSING_TX_DATA":
2324
+ case 52:
2325
+ message.result = 52;
2326
+ break;
2327
+ case "RESULT_CODE_PROOF_PAYLOAD_MISMATCH":
2328
+ case 53:
2329
+ message.result = 53;
2330
+ break;
2331
+ case "RESULT_CODE_VALIDATOR_WRITER_KEY_NOT_REGISTERED":
2332
+ case 54:
2333
+ message.result = 54;
2334
+ break;
2335
+ case "RESULT_CODE_VALIDATOR_ADDRESS_MISMATCH":
2336
+ case 55:
2337
+ message.result = 55;
2338
+ break;
2339
+ case "RESULT_CODE_VALIDATOR_NODE_ENTRY_NOT_FOUND":
2340
+ case 56:
2341
+ message.result = 56;
2342
+ break;
2343
+ case "RESULT_CODE_VALIDATOR_NODE_NOT_WRITER":
2344
+ case 57:
2345
+ message.result = 57;
2346
+ break;
2347
+ case "RESULT_CODE_VALIDATOR_WRITER_KEY_MISMATCH":
2348
+ case 58:
2349
+ message.result = 58;
2350
+ break;
2351
+ case "RESULT_CODE_VALIDATOR_TX_OBJECT_INVALID":
2352
+ case 59:
2353
+ message.result = 59;
2354
+ break;
2355
+ case "RESULT_CODE_VALIDATOR_VA_MISSING":
2356
+ case 60:
2357
+ message.result = 60;
2358
+ break;
2359
+ case "RESULT_CODE_TX_INVALID_PAYLOAD":
2360
+ case 61:
2361
+ message.result = 61;
2362
+ break;
2363
+ }
2364
+ return message;
2365
+ };
2366
+
2367
+ /**
2368
+ * Creates a plain object from a BroadcastTransactionResponse message. Also converts values to other types if specified.
2369
+ * @function toObject
2370
+ * @memberof network.v1.BroadcastTransactionResponse
2371
+ * @static
2372
+ * @param {network.v1.BroadcastTransactionResponse} message BroadcastTransactionResponse
2373
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
2374
+ * @returns {Object.<string,*>} Plain object
2375
+ */
2376
+ BroadcastTransactionResponse.toObject = function toObject(message, options) {
2377
+ if (!options)
2378
+ options = {};
2379
+ var object = {};
2380
+ if (options.defaults) {
2381
+ if (options.bytes === String)
2382
+ object.nonce = "";
2383
+ else {
2384
+ object.nonce = [];
2385
+ if (options.bytes !== Array)
2386
+ object.nonce = $util.newBuffer(object.nonce);
2387
+ }
2388
+ if (options.bytes === String)
2389
+ object.signature = "";
2390
+ else {
2391
+ object.signature = [];
2392
+ if (options.bytes !== Array)
2393
+ object.signature = $util.newBuffer(object.signature);
2394
+ }
2395
+ if (options.bytes === String)
2396
+ object.proof = "";
2397
+ else {
2398
+ object.proof = [];
2399
+ if (options.bytes !== Array)
2400
+ object.proof = $util.newBuffer(object.proof);
2401
+ }
2402
+ if ($util.Long) {
2403
+ var long = new $util.Long(0, 0, true);
2404
+ object.timestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
2405
+ } else
2406
+ object.timestamp = options.longs === String ? "0" : 0;
2407
+ object.result = options.enums === String ? "RESULT_CODE_UNSPECIFIED" : 0;
2408
+ }
2409
+ if (message.nonce != null && message.hasOwnProperty("nonce"))
2410
+ object.nonce = options.bytes === String ? $util.base64.encode(message.nonce, 0, message.nonce.length) : options.bytes === Array ? Array.prototype.slice.call(message.nonce) : message.nonce;
2411
+ if (message.signature != null && message.hasOwnProperty("signature"))
2412
+ object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature;
2413
+ if (message.proof != null && message.hasOwnProperty("proof"))
2414
+ object.proof = options.bytes === String ? $util.base64.encode(message.proof, 0, message.proof.length) : options.bytes === Array ? Array.prototype.slice.call(message.proof) : message.proof;
2415
+ if (message.timestamp != null && message.hasOwnProperty("timestamp"))
2416
+ if (typeof message.timestamp === "number")
2417
+ object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp;
2418
+ else
2419
+ 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;
2420
+ if (message.result != null && message.hasOwnProperty("result"))
2421
+ object.result = options.enums === String ? $root.network.v1.ResultCode[message.result] === undefined ? message.result : $root.network.v1.ResultCode[message.result] : message.result;
2422
+ return object;
2423
+ };
2424
+
2425
+ /**
2426
+ * Converts this BroadcastTransactionResponse to JSON.
2427
+ * @function toJSON
2428
+ * @memberof network.v1.BroadcastTransactionResponse
2429
+ * @instance
2430
+ * @returns {Object.<string,*>} JSON object
2431
+ */
2432
+ BroadcastTransactionResponse.prototype.toJSON = function toJSON() {
2433
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2434
+ };
2435
+
2436
+ /**
2437
+ * Gets the default type url for BroadcastTransactionResponse
2438
+ * @function getTypeUrl
2439
+ * @memberof network.v1.BroadcastTransactionResponse
2440
+ * @static
2441
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
2442
+ * @returns {string} The default type url
2443
+ */
2444
+ BroadcastTransactionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
2445
+ if (typeUrlPrefix === undefined) {
2446
+ typeUrlPrefix = "type.googleapis.com";
2447
+ }
2448
+ return typeUrlPrefix + "/network.v1.BroadcastTransactionResponse";
2449
+ };
2450
+
2451
+ return BroadcastTransactionResponse;
2452
+ })();
2453
+
2454
+ return v1;
2455
+ })();
2456
+
2457
+ return network;
2458
+ })();
2459
+
2460
+ module.exports = $root;