@bitgo-beta/abstract-cosmos 1.0.0-alpha.413 → 1.0.0-alpha.415

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.
@@ -0,0 +1,696 @@
1
+ /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
2
+ 'use strict';
3
+
4
+ var $protobuf = require('protobufjs/minimal');
5
+
6
+ // Common aliases
7
+ var $Reader = $protobuf.Reader,
8
+ $Writer = $protobuf.Writer,
9
+ $util = $protobuf.util;
10
+
11
+ // Exported root namespace
12
+ var $root = $protobuf.roots['default'] || ($protobuf.roots['default'] = {});
13
+
14
+ $root.cosmos = (function () {
15
+ /**
16
+ * Namespace cosmos.
17
+ * @exports cosmos
18
+ * @namespace
19
+ */
20
+ var cosmos = {};
21
+
22
+ cosmos.group = (function () {
23
+ /**
24
+ * Namespace group.
25
+ * @memberof cosmos
26
+ * @namespace
27
+ */
28
+ var group = {};
29
+
30
+ group.v1 = (function () {
31
+ /**
32
+ * Namespace v1.
33
+ * @memberof cosmos.group
34
+ * @namespace
35
+ */
36
+ var v1 = {};
37
+
38
+ v1.MsgSubmitProposal = (function () {
39
+ /**
40
+ * Properties of a MsgSubmitProposal.
41
+ * @memberof cosmos.group.v1
42
+ * @interface IMsgSubmitProposal
43
+ * @property {string|null} [groupPolicyAddress] MsgSubmitProposal groupPolicyAddress
44
+ * @property {Array.<string>|null} [proposers] MsgSubmitProposal proposers
45
+ * @property {string|null} [metadata] MsgSubmitProposal metadata
46
+ * @property {Array.<google.protobuf.IAny>|null} [messages] MsgSubmitProposal messages
47
+ * @property {cosmos.group.v1.Exec|null} [exec] MsgSubmitProposal exec
48
+ * @property {string|null} [title] MsgSubmitProposal title
49
+ * @property {string|null} [summary] MsgSubmitProposal summary
50
+ */
51
+
52
+ /**
53
+ * Constructs a new MsgSubmitProposal.
54
+ * @memberof cosmos.group.v1
55
+ * @classdesc Represents a MsgSubmitProposal.
56
+ * @implements IMsgSubmitProposal
57
+ * @constructor
58
+ * @param {cosmos.group.v1.IMsgSubmitProposal=} [properties] Properties to set
59
+ */
60
+ function MsgSubmitProposal(properties) {
61
+ this.proposers = [];
62
+ this.messages = [];
63
+ if (properties)
64
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
65
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
66
+ }
67
+
68
+ /**
69
+ * MsgSubmitProposal groupPolicyAddress.
70
+ * @member {string} groupPolicyAddress
71
+ * @memberof cosmos.group.v1.MsgSubmitProposal
72
+ * @instance
73
+ */
74
+ MsgSubmitProposal.prototype.groupPolicyAddress = '';
75
+
76
+ /**
77
+ * MsgSubmitProposal proposers.
78
+ * @member {Array.<string>} proposers
79
+ * @memberof cosmos.group.v1.MsgSubmitProposal
80
+ * @instance
81
+ */
82
+ MsgSubmitProposal.prototype.proposers = $util.emptyArray;
83
+
84
+ /**
85
+ * MsgSubmitProposal metadata.
86
+ * @member {string} metadata
87
+ * @memberof cosmos.group.v1.MsgSubmitProposal
88
+ * @instance
89
+ */
90
+ MsgSubmitProposal.prototype.metadata = '';
91
+
92
+ /**
93
+ * MsgSubmitProposal messages.
94
+ * @member {Array.<google.protobuf.IAny>} messages
95
+ * @memberof cosmos.group.v1.MsgSubmitProposal
96
+ * @instance
97
+ */
98
+ MsgSubmitProposal.prototype.messages = $util.emptyArray;
99
+
100
+ /**
101
+ * MsgSubmitProposal exec.
102
+ * @member {cosmos.group.v1.Exec} exec
103
+ * @memberof cosmos.group.v1.MsgSubmitProposal
104
+ * @instance
105
+ */
106
+ MsgSubmitProposal.prototype.exec = 0;
107
+
108
+ /**
109
+ * MsgSubmitProposal title.
110
+ * @member {string} title
111
+ * @memberof cosmos.group.v1.MsgSubmitProposal
112
+ * @instance
113
+ */
114
+ MsgSubmitProposal.prototype.title = '';
115
+
116
+ /**
117
+ * MsgSubmitProposal summary.
118
+ * @member {string} summary
119
+ * @memberof cosmos.group.v1.MsgSubmitProposal
120
+ * @instance
121
+ */
122
+ MsgSubmitProposal.prototype.summary = '';
123
+
124
+ /**
125
+ * Creates a new MsgSubmitProposal instance using the specified properties.
126
+ * @function create
127
+ * @memberof cosmos.group.v1.MsgSubmitProposal
128
+ * @static
129
+ * @param {cosmos.group.v1.IMsgSubmitProposal=} [properties] Properties to set
130
+ * @returns {cosmos.group.v1.MsgSubmitProposal} MsgSubmitProposal instance
131
+ */
132
+ MsgSubmitProposal.create = function create(properties) {
133
+ return new MsgSubmitProposal(properties);
134
+ };
135
+
136
+ /**
137
+ * Encodes the specified MsgSubmitProposal message. Does not implicitly {@link cosmos.group.v1.MsgSubmitProposal.verify|verify} messages.
138
+ * @function encode
139
+ * @memberof cosmos.group.v1.MsgSubmitProposal
140
+ * @static
141
+ * @param {cosmos.group.v1.IMsgSubmitProposal} message MsgSubmitProposal message or plain object to encode
142
+ * @param {$protobuf.Writer} [writer] Writer to encode to
143
+ * @returns {$protobuf.Writer} Writer
144
+ */
145
+ MsgSubmitProposal.encode = function encode(message, writer) {
146
+ if (!writer) writer = $Writer.create();
147
+ if (message.groupPolicyAddress != null && Object.hasOwnProperty.call(message, 'groupPolicyAddress'))
148
+ writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.groupPolicyAddress);
149
+ if (message.proposers != null && message.proposers.length)
150
+ for (var i = 0; i < message.proposers.length; ++i)
151
+ writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.proposers[i]);
152
+ if (message.metadata != null && Object.hasOwnProperty.call(message, 'metadata'))
153
+ writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.metadata);
154
+ if (message.messages != null && message.messages.length)
155
+ for (var i = 0; i < message.messages.length; ++i)
156
+ $root.google.protobuf.Any.encode(
157
+ message.messages[i],
158
+ writer.uint32(/* id 4, wireType 2 =*/ 34).fork()
159
+ ).ldelim();
160
+ if (message.exec != null && Object.hasOwnProperty.call(message, 'exec'))
161
+ writer.uint32(/* id 5, wireType 0 =*/ 40).int32(message.exec);
162
+ if (message.title != null && Object.hasOwnProperty.call(message, 'title'))
163
+ writer.uint32(/* id 6, wireType 2 =*/ 50).string(message.title);
164
+ if (message.summary != null && Object.hasOwnProperty.call(message, 'summary'))
165
+ writer.uint32(/* id 7, wireType 2 =*/ 58).string(message.summary);
166
+ return writer;
167
+ };
168
+
169
+ /**
170
+ * Encodes the specified MsgSubmitProposal message, length delimited. Does not implicitly {@link cosmos.group.v1.MsgSubmitProposal.verify|verify} messages.
171
+ * @function encodeDelimited
172
+ * @memberof cosmos.group.v1.MsgSubmitProposal
173
+ * @static
174
+ * @param {cosmos.group.v1.IMsgSubmitProposal} message MsgSubmitProposal message or plain object to encode
175
+ * @param {$protobuf.Writer} [writer] Writer to encode to
176
+ * @returns {$protobuf.Writer} Writer
177
+ */
178
+ MsgSubmitProposal.encodeDelimited = function encodeDelimited(message, writer) {
179
+ return this.encode(message, writer).ldelim();
180
+ };
181
+
182
+ /**
183
+ * Decodes a MsgSubmitProposal message from the specified reader or buffer.
184
+ * @function decode
185
+ * @memberof cosmos.group.v1.MsgSubmitProposal
186
+ * @static
187
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
188
+ * @param {number} [length] Message length if known beforehand
189
+ * @returns {cosmos.group.v1.MsgSubmitProposal} MsgSubmitProposal
190
+ * @throws {Error} If the payload is not a reader or valid buffer
191
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
192
+ */
193
+ MsgSubmitProposal.decode = function decode(reader, length, error) {
194
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
195
+ var end = length === undefined ? reader.len : reader.pos + length,
196
+ message = new $root.cosmos.group.v1.MsgSubmitProposal();
197
+ while (reader.pos < end) {
198
+ var tag = reader.uint32();
199
+ if (tag === error) break;
200
+ switch (tag >>> 3) {
201
+ case 1: {
202
+ message.groupPolicyAddress = reader.string();
203
+ break;
204
+ }
205
+ case 2: {
206
+ if (!(message.proposers && message.proposers.length)) message.proposers = [];
207
+ message.proposers.push(reader.string());
208
+ break;
209
+ }
210
+ case 3: {
211
+ message.metadata = reader.string();
212
+ break;
213
+ }
214
+ case 4: {
215
+ if (!(message.messages && message.messages.length)) message.messages = [];
216
+ message.messages.push($root.google.protobuf.Any.decode(reader, reader.uint32()));
217
+ break;
218
+ }
219
+ case 5: {
220
+ message.exec = reader.int32();
221
+ break;
222
+ }
223
+ case 6: {
224
+ message.title = reader.string();
225
+ break;
226
+ }
227
+ case 7: {
228
+ message.summary = reader.string();
229
+ break;
230
+ }
231
+ default:
232
+ reader.skipType(tag & 7);
233
+ break;
234
+ }
235
+ }
236
+ return message;
237
+ };
238
+
239
+ /**
240
+ * Decodes a MsgSubmitProposal message from the specified reader or buffer, length delimited.
241
+ * @function decodeDelimited
242
+ * @memberof cosmos.group.v1.MsgSubmitProposal
243
+ * @static
244
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
245
+ * @returns {cosmos.group.v1.MsgSubmitProposal} MsgSubmitProposal
246
+ * @throws {Error} If the payload is not a reader or valid buffer
247
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
248
+ */
249
+ MsgSubmitProposal.decodeDelimited = function decodeDelimited(reader) {
250
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
251
+ return this.decode(reader, reader.uint32());
252
+ };
253
+
254
+ /**
255
+ * Verifies a MsgSubmitProposal message.
256
+ * @function verify
257
+ * @memberof cosmos.group.v1.MsgSubmitProposal
258
+ * @static
259
+ * @param {Object.<string,*>} message Plain object to verify
260
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
261
+ */
262
+ MsgSubmitProposal.verify = function verify(message) {
263
+ if (typeof message !== 'object' || message === null) return 'object expected';
264
+ if (message.groupPolicyAddress != null && message.hasOwnProperty('groupPolicyAddress'))
265
+ if (!$util.isString(message.groupPolicyAddress)) return 'groupPolicyAddress: string expected';
266
+ if (message.proposers != null && message.hasOwnProperty('proposers')) {
267
+ if (!Array.isArray(message.proposers)) return 'proposers: array expected';
268
+ for (var i = 0; i < message.proposers.length; ++i)
269
+ if (!$util.isString(message.proposers[i])) return 'proposers: string[] expected';
270
+ }
271
+ if (message.metadata != null && message.hasOwnProperty('metadata'))
272
+ if (!$util.isString(message.metadata)) return 'metadata: string expected';
273
+ if (message.messages != null && message.hasOwnProperty('messages')) {
274
+ if (!Array.isArray(message.messages)) return 'messages: array expected';
275
+ for (var i = 0; i < message.messages.length; ++i) {
276
+ var error = $root.google.protobuf.Any.verify(message.messages[i]);
277
+ if (error) return 'messages.' + error;
278
+ }
279
+ }
280
+ if (message.exec != null && message.hasOwnProperty('exec'))
281
+ switch (message.exec) {
282
+ default:
283
+ return 'exec: enum value expected';
284
+ case 0:
285
+ case 1:
286
+ break;
287
+ }
288
+ if (message.title != null && message.hasOwnProperty('title'))
289
+ if (!$util.isString(message.title)) return 'title: string expected';
290
+ if (message.summary != null && message.hasOwnProperty('summary'))
291
+ if (!$util.isString(message.summary)) return 'summary: string expected';
292
+ return null;
293
+ };
294
+
295
+ /**
296
+ * Creates a MsgSubmitProposal message from a plain object. Also converts values to their respective internal types.
297
+ * @function fromObject
298
+ * @memberof cosmos.group.v1.MsgSubmitProposal
299
+ * @static
300
+ * @param {Object.<string,*>} object Plain object
301
+ * @returns {cosmos.group.v1.MsgSubmitProposal} MsgSubmitProposal
302
+ */
303
+ MsgSubmitProposal.fromObject = function fromObject(object) {
304
+ if (object instanceof $root.cosmos.group.v1.MsgSubmitProposal) return object;
305
+ var message = new $root.cosmos.group.v1.MsgSubmitProposal();
306
+ if (object.groupPolicyAddress != null) message.groupPolicyAddress = String(object.groupPolicyAddress);
307
+ if (object.proposers) {
308
+ if (!Array.isArray(object.proposers))
309
+ throw TypeError('.cosmos.group.v1.MsgSubmitProposal.proposers: array expected');
310
+ message.proposers = [];
311
+ for (var i = 0; i < object.proposers.length; ++i) message.proposers[i] = String(object.proposers[i]);
312
+ }
313
+ if (object.metadata != null) message.metadata = String(object.metadata);
314
+ if (object.messages) {
315
+ if (!Array.isArray(object.messages))
316
+ throw TypeError('.cosmos.group.v1.MsgSubmitProposal.messages: array expected');
317
+ message.messages = [];
318
+ for (var i = 0; i < object.messages.length; ++i) {
319
+ if (typeof object.messages[i] !== 'object')
320
+ throw TypeError('.cosmos.group.v1.MsgSubmitProposal.messages: object expected');
321
+ message.messages[i] = $root.google.protobuf.Any.fromObject(object.messages[i]);
322
+ }
323
+ }
324
+ switch (object.exec) {
325
+ default:
326
+ if (typeof object.exec === 'number') {
327
+ message.exec = object.exec;
328
+ break;
329
+ }
330
+ break;
331
+ case 'EXEC_UNSPECIFIED':
332
+ case 0:
333
+ message.exec = 0;
334
+ break;
335
+ case 'EXEC_TRY':
336
+ case 1:
337
+ message.exec = 1;
338
+ break;
339
+ }
340
+ if (object.title != null) message.title = String(object.title);
341
+ if (object.summary != null) message.summary = String(object.summary);
342
+ return message;
343
+ };
344
+
345
+ /**
346
+ * Creates a plain object from a MsgSubmitProposal message. Also converts values to other types if specified.
347
+ * @function toObject
348
+ * @memberof cosmos.group.v1.MsgSubmitProposal
349
+ * @static
350
+ * @param {cosmos.group.v1.MsgSubmitProposal} message MsgSubmitProposal
351
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
352
+ * @returns {Object.<string,*>} Plain object
353
+ */
354
+ MsgSubmitProposal.toObject = function toObject(message, options) {
355
+ if (!options) options = {};
356
+ var object = {};
357
+ if (options.arrays || options.defaults) {
358
+ object.proposers = [];
359
+ object.messages = [];
360
+ }
361
+ if (options.defaults) {
362
+ object.groupPolicyAddress = '';
363
+ object.metadata = '';
364
+ object.exec = options.enums === String ? 'EXEC_UNSPECIFIED' : 0;
365
+ object.title = '';
366
+ object.summary = '';
367
+ }
368
+ if (message.groupPolicyAddress != null && message.hasOwnProperty('groupPolicyAddress'))
369
+ object.groupPolicyAddress = message.groupPolicyAddress;
370
+ if (message.proposers && message.proposers.length) {
371
+ object.proposers = [];
372
+ for (var j = 0; j < message.proposers.length; ++j) object.proposers[j] = message.proposers[j];
373
+ }
374
+ if (message.metadata != null && message.hasOwnProperty('metadata')) object.metadata = message.metadata;
375
+ if (message.messages && message.messages.length) {
376
+ object.messages = [];
377
+ for (var j = 0; j < message.messages.length; ++j)
378
+ object.messages[j] = $root.google.protobuf.Any.toObject(message.messages[j], options);
379
+ }
380
+ if (message.exec != null && message.hasOwnProperty('exec'))
381
+ object.exec =
382
+ options.enums === String
383
+ ? $root.cosmos.group.v1.Exec[message.exec] === undefined
384
+ ? message.exec
385
+ : $root.cosmos.group.v1.Exec[message.exec]
386
+ : message.exec;
387
+ if (message.title != null && message.hasOwnProperty('title')) object.title = message.title;
388
+ if (message.summary != null && message.hasOwnProperty('summary')) object.summary = message.summary;
389
+ return object;
390
+ };
391
+
392
+ /**
393
+ * Converts this MsgSubmitProposal to JSON.
394
+ * @function toJSON
395
+ * @memberof cosmos.group.v1.MsgSubmitProposal
396
+ * @instance
397
+ * @returns {Object.<string,*>} JSON object
398
+ */
399
+ MsgSubmitProposal.prototype.toJSON = function toJSON() {
400
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
401
+ };
402
+
403
+ /**
404
+ * Gets the default type url for MsgSubmitProposal
405
+ * @function getTypeUrl
406
+ * @memberof cosmos.group.v1.MsgSubmitProposal
407
+ * @static
408
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
409
+ * @returns {string} The default type url
410
+ */
411
+ MsgSubmitProposal.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
412
+ if (typeUrlPrefix === undefined) {
413
+ typeUrlPrefix = 'type.googleapis.com';
414
+ }
415
+ return typeUrlPrefix + '/cosmos.group.v1.MsgSubmitProposal';
416
+ };
417
+
418
+ return MsgSubmitProposal;
419
+ })();
420
+
421
+ /**
422
+ * Exec enum.
423
+ * @name cosmos.group.v1.Exec
424
+ * @enum {number}
425
+ * @property {number} EXEC_UNSPECIFIED=0 EXEC_UNSPECIFIED value
426
+ * @property {number} EXEC_TRY=1 EXEC_TRY value
427
+ */
428
+ v1.Exec = (function () {
429
+ var valuesById = {},
430
+ values = Object.create(valuesById);
431
+ values[(valuesById[0] = 'EXEC_UNSPECIFIED')] = 0;
432
+ values[(valuesById[1] = 'EXEC_TRY')] = 1;
433
+ return values;
434
+ })();
435
+
436
+ return v1;
437
+ })();
438
+
439
+ return group;
440
+ })();
441
+
442
+ return cosmos;
443
+ })();
444
+
445
+ $root.google = (function () {
446
+ /**
447
+ * Namespace google.
448
+ * @exports google
449
+ * @namespace
450
+ */
451
+ var google = {};
452
+
453
+ google.protobuf = (function () {
454
+ /**
455
+ * Namespace protobuf.
456
+ * @memberof google
457
+ * @namespace
458
+ */
459
+ var protobuf = {};
460
+
461
+ protobuf.Any = (function () {
462
+ /**
463
+ * Properties of an Any.
464
+ * @memberof google.protobuf
465
+ * @interface IAny
466
+ * @property {string|null} [type_url] Any type_url
467
+ * @property {Uint8Array|null} [value] Any value
468
+ */
469
+
470
+ /**
471
+ * Constructs a new Any.
472
+ * @memberof google.protobuf
473
+ * @classdesc Represents an Any.
474
+ * @implements IAny
475
+ * @constructor
476
+ * @param {google.protobuf.IAny=} [properties] Properties to set
477
+ */
478
+ function Any(properties) {
479
+ if (properties)
480
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
481
+ if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
482
+ }
483
+
484
+ /**
485
+ * Any type_url.
486
+ * @member {string} type_url
487
+ * @memberof google.protobuf.Any
488
+ * @instance
489
+ */
490
+ Any.prototype.type_url = '';
491
+
492
+ /**
493
+ * Any value.
494
+ * @member {Uint8Array} value
495
+ * @memberof google.protobuf.Any
496
+ * @instance
497
+ */
498
+ Any.prototype.value = $util.newBuffer([]);
499
+
500
+ /**
501
+ * Creates a new Any instance using the specified properties.
502
+ * @function create
503
+ * @memberof google.protobuf.Any
504
+ * @static
505
+ * @param {google.protobuf.IAny=} [properties] Properties to set
506
+ * @returns {google.protobuf.Any} Any instance
507
+ */
508
+ Any.create = function create(properties) {
509
+ return new Any(properties);
510
+ };
511
+
512
+ /**
513
+ * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages.
514
+ * @function encode
515
+ * @memberof google.protobuf.Any
516
+ * @static
517
+ * @param {google.protobuf.IAny} message Any message or plain object to encode
518
+ * @param {$protobuf.Writer} [writer] Writer to encode to
519
+ * @returns {$protobuf.Writer} Writer
520
+ */
521
+ Any.encode = function encode(message, writer) {
522
+ if (!writer) writer = $Writer.create();
523
+ if (message.type_url != null && Object.hasOwnProperty.call(message, 'type_url'))
524
+ writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.type_url);
525
+ if (message.value != null && Object.hasOwnProperty.call(message, 'value'))
526
+ writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.value);
527
+ return writer;
528
+ };
529
+
530
+ /**
531
+ * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages.
532
+ * @function encodeDelimited
533
+ * @memberof google.protobuf.Any
534
+ * @static
535
+ * @param {google.protobuf.IAny} message Any message or plain object to encode
536
+ * @param {$protobuf.Writer} [writer] Writer to encode to
537
+ * @returns {$protobuf.Writer} Writer
538
+ */
539
+ Any.encodeDelimited = function encodeDelimited(message, writer) {
540
+ return this.encode(message, writer).ldelim();
541
+ };
542
+
543
+ /**
544
+ * Decodes an Any message from the specified reader or buffer.
545
+ * @function decode
546
+ * @memberof google.protobuf.Any
547
+ * @static
548
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
549
+ * @param {number} [length] Message length if known beforehand
550
+ * @returns {google.protobuf.Any} Any
551
+ * @throws {Error} If the payload is not a reader or valid buffer
552
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
553
+ */
554
+ Any.decode = function decode(reader, length, error) {
555
+ if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
556
+ var end = length === undefined ? reader.len : reader.pos + length,
557
+ message = new $root.google.protobuf.Any();
558
+ while (reader.pos < end) {
559
+ var tag = reader.uint32();
560
+ if (tag === error) break;
561
+ switch (tag >>> 3) {
562
+ case 1: {
563
+ message.type_url = reader.string();
564
+ break;
565
+ }
566
+ case 2: {
567
+ message.value = reader.bytes();
568
+ break;
569
+ }
570
+ default:
571
+ reader.skipType(tag & 7);
572
+ break;
573
+ }
574
+ }
575
+ return message;
576
+ };
577
+
578
+ /**
579
+ * Decodes an Any message from the specified reader or buffer, length delimited.
580
+ * @function decodeDelimited
581
+ * @memberof google.protobuf.Any
582
+ * @static
583
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
584
+ * @returns {google.protobuf.Any} Any
585
+ * @throws {Error} If the payload is not a reader or valid buffer
586
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
587
+ */
588
+ Any.decodeDelimited = function decodeDelimited(reader) {
589
+ if (!(reader instanceof $Reader)) reader = new $Reader(reader);
590
+ return this.decode(reader, reader.uint32());
591
+ };
592
+
593
+ /**
594
+ * Verifies an Any message.
595
+ * @function verify
596
+ * @memberof google.protobuf.Any
597
+ * @static
598
+ * @param {Object.<string,*>} message Plain object to verify
599
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
600
+ */
601
+ Any.verify = function verify(message) {
602
+ if (typeof message !== 'object' || message === null) return 'object expected';
603
+ if (message.type_url != null && message.hasOwnProperty('type_url'))
604
+ if (!$util.isString(message.type_url)) return 'type_url: string expected';
605
+ if (message.value != null && message.hasOwnProperty('value'))
606
+ if (!((message.value && typeof message.value.length === 'number') || $util.isString(message.value)))
607
+ return 'value: buffer expected';
608
+ return null;
609
+ };
610
+
611
+ /**
612
+ * Creates an Any message from a plain object. Also converts values to their respective internal types.
613
+ * @function fromObject
614
+ * @memberof google.protobuf.Any
615
+ * @static
616
+ * @param {Object.<string,*>} object Plain object
617
+ * @returns {google.protobuf.Any} Any
618
+ */
619
+ Any.fromObject = function fromObject(object) {
620
+ if (object instanceof $root.google.protobuf.Any) return object;
621
+ var message = new $root.google.protobuf.Any();
622
+ if (object.type_url != null) message.type_url = String(object.type_url);
623
+ if (object.value != null)
624
+ if (typeof object.value === 'string')
625
+ $util.base64.decode(object.value, (message.value = $util.newBuffer($util.base64.length(object.value))), 0);
626
+ else if (object.value.length >= 0) message.value = object.value;
627
+ return message;
628
+ };
629
+
630
+ /**
631
+ * Creates a plain object from an Any message. Also converts values to other types if specified.
632
+ * @function toObject
633
+ * @memberof google.protobuf.Any
634
+ * @static
635
+ * @param {google.protobuf.Any} message Any
636
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
637
+ * @returns {Object.<string,*>} Plain object
638
+ */
639
+ Any.toObject = function toObject(message, options) {
640
+ if (!options) options = {};
641
+ var object = {};
642
+ if (options.defaults) {
643
+ object.type_url = '';
644
+ if (options.bytes === String) object.value = '';
645
+ else {
646
+ object.value = [];
647
+ if (options.bytes !== Array) object.value = $util.newBuffer(object.value);
648
+ }
649
+ }
650
+ if (message.type_url != null && message.hasOwnProperty('type_url')) object.type_url = message.type_url;
651
+ if (message.value != null && message.hasOwnProperty('value'))
652
+ object.value =
653
+ options.bytes === String
654
+ ? $util.base64.encode(message.value, 0, message.value.length)
655
+ : options.bytes === Array
656
+ ? Array.prototype.slice.call(message.value)
657
+ : message.value;
658
+ return object;
659
+ };
660
+
661
+ /**
662
+ * Converts this Any to JSON.
663
+ * @function toJSON
664
+ * @memberof google.protobuf.Any
665
+ * @instance
666
+ * @returns {Object.<string,*>} JSON object
667
+ */
668
+ Any.prototype.toJSON = function toJSON() {
669
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
670
+ };
671
+
672
+ /**
673
+ * Gets the default type url for Any
674
+ * @function getTypeUrl
675
+ * @memberof google.protobuf.Any
676
+ * @static
677
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
678
+ * @returns {string} The default type url
679
+ */
680
+ Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
681
+ if (typeUrlPrefix === undefined) {
682
+ typeUrlPrefix = 'type.googleapis.com';
683
+ }
684
+ return typeUrlPrefix + '/google.protobuf.Any';
685
+ };
686
+
687
+ return Any;
688
+ })();
689
+
690
+ return protobuf;
691
+ })();
692
+
693
+ return google;
694
+ })();
695
+
696
+ module.exports = $root;