koilib 5.5.3 → 5.5.5
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.
- package/lib/Contract.d.ts +1 -1
- package/lib/browser/Contract.d.ts +1 -1
- package/package.json +3 -2
- package/src/Contract.ts +614 -0
- package/src/Provider.ts +512 -0
- package/src/Serializer.ts +366 -0
- package/src/Signer.ts +827 -0
- package/src/Transaction.ts +241 -0
- package/src/index.ts +9 -0
- package/src/index2.ts +17 -0
- package/src/indexUtils.ts +2 -0
- package/src/interface.ts +767 -0
- package/src/jsonDescriptors/chain-proto.json +726 -0
- package/src/jsonDescriptors/pow-proto.json +68 -0
- package/src/jsonDescriptors/token-proto.json +255 -0
- package/src/jsonDescriptors/value-proto.json +161 -0
- package/src/protoModules/protocol-proto.js +8138 -0
- package/src/protoModules/value-proto.js +1736 -0
- package/src/utils.ts +533 -0
- package/src/utilsNode.ts +378 -0
|
@@ -0,0 +1,1736 @@
|
|
|
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
|
+
(function (global, factory) {
|
|
3
|
+
/* global define, require, module */
|
|
4
|
+
|
|
5
|
+
/* AMD */ if (typeof define === "function" && define.amd)
|
|
6
|
+
define(["protobufjs/minimal"], factory);
|
|
7
|
+
/* CommonJS */ else if (
|
|
8
|
+
typeof require === "function" &&
|
|
9
|
+
typeof module === "object" &&
|
|
10
|
+
module &&
|
|
11
|
+
module.exports
|
|
12
|
+
)
|
|
13
|
+
module.exports = factory(require("protobufjs/minimal"));
|
|
14
|
+
})(this, function ($protobuf) {
|
|
15
|
+
"use strict";
|
|
16
|
+
|
|
17
|
+
// Common aliases
|
|
18
|
+
var $Reader = $protobuf.Reader,
|
|
19
|
+
$Writer = $protobuf.Writer,
|
|
20
|
+
$util = $protobuf.util;
|
|
21
|
+
|
|
22
|
+
// Exported root namespace
|
|
23
|
+
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
|
|
24
|
+
|
|
25
|
+
$root.koinos = (function () {
|
|
26
|
+
/**
|
|
27
|
+
* Namespace koinos.
|
|
28
|
+
* @exports koinos
|
|
29
|
+
* @namespace
|
|
30
|
+
*/
|
|
31
|
+
var koinos = {};
|
|
32
|
+
|
|
33
|
+
koinos.chain = (function () {
|
|
34
|
+
/**
|
|
35
|
+
* Namespace chain.
|
|
36
|
+
* @memberof koinos
|
|
37
|
+
* @namespace
|
|
38
|
+
*/
|
|
39
|
+
var chain = {};
|
|
40
|
+
|
|
41
|
+
chain.value_type = (function () {
|
|
42
|
+
/**
|
|
43
|
+
* Properties of a value_type.
|
|
44
|
+
* @memberof koinos.chain
|
|
45
|
+
* @interface Ivalue_type
|
|
46
|
+
* @property {google.protobuf.IAny|null} [message_value] value_type message_value
|
|
47
|
+
* @property {number|null} [int32_value] value_type int32_value
|
|
48
|
+
* @property {number|Long|null} [int64_value] value_type int64_value
|
|
49
|
+
* @property {number|null} [uint32_value] value_type uint32_value
|
|
50
|
+
* @property {number|Long|null} [uint64_value] value_type uint64_value
|
|
51
|
+
* @property {number|null} [sint32_value] value_type sint32_value
|
|
52
|
+
* @property {number|Long|null} [sint64_value] value_type sint64_value
|
|
53
|
+
* @property {number|null} [fixed32_value] value_type fixed32_value
|
|
54
|
+
* @property {number|Long|null} [fixed64_value] value_type fixed64_value
|
|
55
|
+
* @property {number|null} [sfixed32_value] value_type sfixed32_value
|
|
56
|
+
* @property {number|Long|null} [sfixed64_value] value_type sfixed64_value
|
|
57
|
+
* @property {boolean|null} [bool_value] value_type bool_value
|
|
58
|
+
* @property {string|null} [string_value] value_type string_value
|
|
59
|
+
* @property {Uint8Array|null} [bytes_value] value_type bytes_value
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Constructs a new value_type.
|
|
64
|
+
* @memberof koinos.chain
|
|
65
|
+
* @classdesc Represents a value_type.
|
|
66
|
+
* @implements Ivalue_type
|
|
67
|
+
* @constructor
|
|
68
|
+
* @param {koinos.chain.Ivalue_type=} [properties] Properties to set
|
|
69
|
+
*/
|
|
70
|
+
function value_type(properties) {
|
|
71
|
+
if (properties)
|
|
72
|
+
for (
|
|
73
|
+
var keys = Object.keys(properties), i = 0;
|
|
74
|
+
i < keys.length;
|
|
75
|
+
++i
|
|
76
|
+
)
|
|
77
|
+
if (properties[keys[i]] != null)
|
|
78
|
+
this[keys[i]] = properties[keys[i]];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* value_type message_value.
|
|
83
|
+
* @member {google.protobuf.IAny|null|undefined} message_value
|
|
84
|
+
* @memberof koinos.chain.value_type
|
|
85
|
+
* @instance
|
|
86
|
+
*/
|
|
87
|
+
value_type.prototype.message_value = null;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* value_type int32_value.
|
|
91
|
+
* @member {number|null|undefined} int32_value
|
|
92
|
+
* @memberof koinos.chain.value_type
|
|
93
|
+
* @instance
|
|
94
|
+
*/
|
|
95
|
+
value_type.prototype.int32_value = null;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* value_type int64_value.
|
|
99
|
+
* @member {number|Long|null|undefined} int64_value
|
|
100
|
+
* @memberof koinos.chain.value_type
|
|
101
|
+
* @instance
|
|
102
|
+
*/
|
|
103
|
+
value_type.prototype.int64_value = null;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* value_type uint32_value.
|
|
107
|
+
* @member {number|null|undefined} uint32_value
|
|
108
|
+
* @memberof koinos.chain.value_type
|
|
109
|
+
* @instance
|
|
110
|
+
*/
|
|
111
|
+
value_type.prototype.uint32_value = null;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* value_type uint64_value.
|
|
115
|
+
* @member {number|Long|null|undefined} uint64_value
|
|
116
|
+
* @memberof koinos.chain.value_type
|
|
117
|
+
* @instance
|
|
118
|
+
*/
|
|
119
|
+
value_type.prototype.uint64_value = null;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* value_type sint32_value.
|
|
123
|
+
* @member {number|null|undefined} sint32_value
|
|
124
|
+
* @memberof koinos.chain.value_type
|
|
125
|
+
* @instance
|
|
126
|
+
*/
|
|
127
|
+
value_type.prototype.sint32_value = null;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* value_type sint64_value.
|
|
131
|
+
* @member {number|Long|null|undefined} sint64_value
|
|
132
|
+
* @memberof koinos.chain.value_type
|
|
133
|
+
* @instance
|
|
134
|
+
*/
|
|
135
|
+
value_type.prototype.sint64_value = null;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* value_type fixed32_value.
|
|
139
|
+
* @member {number|null|undefined} fixed32_value
|
|
140
|
+
* @memberof koinos.chain.value_type
|
|
141
|
+
* @instance
|
|
142
|
+
*/
|
|
143
|
+
value_type.prototype.fixed32_value = null;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* value_type fixed64_value.
|
|
147
|
+
* @member {number|Long|null|undefined} fixed64_value
|
|
148
|
+
* @memberof koinos.chain.value_type
|
|
149
|
+
* @instance
|
|
150
|
+
*/
|
|
151
|
+
value_type.prototype.fixed64_value = null;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* value_type sfixed32_value.
|
|
155
|
+
* @member {number|null|undefined} sfixed32_value
|
|
156
|
+
* @memberof koinos.chain.value_type
|
|
157
|
+
* @instance
|
|
158
|
+
*/
|
|
159
|
+
value_type.prototype.sfixed32_value = null;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* value_type sfixed64_value.
|
|
163
|
+
* @member {number|Long|null|undefined} sfixed64_value
|
|
164
|
+
* @memberof koinos.chain.value_type
|
|
165
|
+
* @instance
|
|
166
|
+
*/
|
|
167
|
+
value_type.prototype.sfixed64_value = null;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* value_type bool_value.
|
|
171
|
+
* @member {boolean|null|undefined} bool_value
|
|
172
|
+
* @memberof koinos.chain.value_type
|
|
173
|
+
* @instance
|
|
174
|
+
*/
|
|
175
|
+
value_type.prototype.bool_value = null;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* value_type string_value.
|
|
179
|
+
* @member {string|null|undefined} string_value
|
|
180
|
+
* @memberof koinos.chain.value_type
|
|
181
|
+
* @instance
|
|
182
|
+
*/
|
|
183
|
+
value_type.prototype.string_value = null;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* value_type bytes_value.
|
|
187
|
+
* @member {Uint8Array|null|undefined} bytes_value
|
|
188
|
+
* @memberof koinos.chain.value_type
|
|
189
|
+
* @instance
|
|
190
|
+
*/
|
|
191
|
+
value_type.prototype.bytes_value = null;
|
|
192
|
+
|
|
193
|
+
// OneOf field names bound to virtual getters and setters
|
|
194
|
+
var $oneOfFields;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* value_type kind.
|
|
198
|
+
* @member {"message_value"|"int32_value"|"int64_value"|"uint32_value"|"uint64_value"|"sint32_value"|"sint64_value"|"fixed32_value"|"fixed64_value"|"sfixed32_value"|"sfixed64_value"|"bool_value"|"string_value"|"bytes_value"|undefined} kind
|
|
199
|
+
* @memberof koinos.chain.value_type
|
|
200
|
+
* @instance
|
|
201
|
+
*/
|
|
202
|
+
Object.defineProperty(value_type.prototype, "kind", {
|
|
203
|
+
get: $util.oneOfGetter(
|
|
204
|
+
($oneOfFields = [
|
|
205
|
+
"message_value",
|
|
206
|
+
"int32_value",
|
|
207
|
+
"int64_value",
|
|
208
|
+
"uint32_value",
|
|
209
|
+
"uint64_value",
|
|
210
|
+
"sint32_value",
|
|
211
|
+
"sint64_value",
|
|
212
|
+
"fixed32_value",
|
|
213
|
+
"fixed64_value",
|
|
214
|
+
"sfixed32_value",
|
|
215
|
+
"sfixed64_value",
|
|
216
|
+
"bool_value",
|
|
217
|
+
"string_value",
|
|
218
|
+
"bytes_value",
|
|
219
|
+
])
|
|
220
|
+
),
|
|
221
|
+
set: $util.oneOfSetter($oneOfFields),
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Creates a new value_type instance using the specified properties.
|
|
226
|
+
* @function create
|
|
227
|
+
* @memberof koinos.chain.value_type
|
|
228
|
+
* @static
|
|
229
|
+
* @param {koinos.chain.Ivalue_type=} [properties] Properties to set
|
|
230
|
+
* @returns {koinos.chain.value_type} value_type instance
|
|
231
|
+
*/
|
|
232
|
+
value_type.create = function create(properties) {
|
|
233
|
+
return new value_type(properties);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Encodes the specified value_type message. Does not implicitly {@link koinos.chain.value_type.verify|verify} messages.
|
|
238
|
+
* @function encode
|
|
239
|
+
* @memberof koinos.chain.value_type
|
|
240
|
+
* @static
|
|
241
|
+
* @param {koinos.chain.Ivalue_type} message value_type message or plain object to encode
|
|
242
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
243
|
+
* @returns {$protobuf.Writer} Writer
|
|
244
|
+
*/
|
|
245
|
+
value_type.encode = function encode(message, writer) {
|
|
246
|
+
if (!writer) writer = $Writer.create();
|
|
247
|
+
if (
|
|
248
|
+
message.message_value != null &&
|
|
249
|
+
Object.hasOwnProperty.call(message, "message_value")
|
|
250
|
+
)
|
|
251
|
+
$root.google.protobuf.Any.encode(
|
|
252
|
+
message.message_value,
|
|
253
|
+
writer.uint32(/* id 1, wireType 2 =*/ 10).fork()
|
|
254
|
+
).ldelim();
|
|
255
|
+
if (
|
|
256
|
+
message.int32_value != null &&
|
|
257
|
+
Object.hasOwnProperty.call(message, "int32_value")
|
|
258
|
+
)
|
|
259
|
+
writer
|
|
260
|
+
.uint32(/* id 2, wireType 0 =*/ 16)
|
|
261
|
+
.int32(message.int32_value);
|
|
262
|
+
if (
|
|
263
|
+
message.int64_value != null &&
|
|
264
|
+
Object.hasOwnProperty.call(message, "int64_value")
|
|
265
|
+
)
|
|
266
|
+
writer
|
|
267
|
+
.uint32(/* id 3, wireType 0 =*/ 24)
|
|
268
|
+
.int64(message.int64_value);
|
|
269
|
+
if (
|
|
270
|
+
message.uint32_value != null &&
|
|
271
|
+
Object.hasOwnProperty.call(message, "uint32_value")
|
|
272
|
+
)
|
|
273
|
+
writer
|
|
274
|
+
.uint32(/* id 4, wireType 0 =*/ 32)
|
|
275
|
+
.uint32(message.uint32_value);
|
|
276
|
+
if (
|
|
277
|
+
message.uint64_value != null &&
|
|
278
|
+
Object.hasOwnProperty.call(message, "uint64_value")
|
|
279
|
+
)
|
|
280
|
+
writer
|
|
281
|
+
.uint32(/* id 5, wireType 0 =*/ 40)
|
|
282
|
+
.uint64(message.uint64_value);
|
|
283
|
+
if (
|
|
284
|
+
message.sint32_value != null &&
|
|
285
|
+
Object.hasOwnProperty.call(message, "sint32_value")
|
|
286
|
+
)
|
|
287
|
+
writer
|
|
288
|
+
.uint32(/* id 6, wireType 0 =*/ 48)
|
|
289
|
+
.sint32(message.sint32_value);
|
|
290
|
+
if (
|
|
291
|
+
message.sint64_value != null &&
|
|
292
|
+
Object.hasOwnProperty.call(message, "sint64_value")
|
|
293
|
+
)
|
|
294
|
+
writer
|
|
295
|
+
.uint32(/* id 7, wireType 0 =*/ 56)
|
|
296
|
+
.sint64(message.sint64_value);
|
|
297
|
+
if (
|
|
298
|
+
message.fixed32_value != null &&
|
|
299
|
+
Object.hasOwnProperty.call(message, "fixed32_value")
|
|
300
|
+
)
|
|
301
|
+
writer
|
|
302
|
+
.uint32(/* id 8, wireType 5 =*/ 69)
|
|
303
|
+
.fixed32(message.fixed32_value);
|
|
304
|
+
if (
|
|
305
|
+
message.fixed64_value != null &&
|
|
306
|
+
Object.hasOwnProperty.call(message, "fixed64_value")
|
|
307
|
+
)
|
|
308
|
+
writer
|
|
309
|
+
.uint32(/* id 9, wireType 1 =*/ 73)
|
|
310
|
+
.fixed64(message.fixed64_value);
|
|
311
|
+
if (
|
|
312
|
+
message.sfixed32_value != null &&
|
|
313
|
+
Object.hasOwnProperty.call(message, "sfixed32_value")
|
|
314
|
+
)
|
|
315
|
+
writer
|
|
316
|
+
.uint32(/* id 10, wireType 5 =*/ 85)
|
|
317
|
+
.sfixed32(message.sfixed32_value);
|
|
318
|
+
if (
|
|
319
|
+
message.sfixed64_value != null &&
|
|
320
|
+
Object.hasOwnProperty.call(message, "sfixed64_value")
|
|
321
|
+
)
|
|
322
|
+
writer
|
|
323
|
+
.uint32(/* id 11, wireType 1 =*/ 89)
|
|
324
|
+
.sfixed64(message.sfixed64_value);
|
|
325
|
+
if (
|
|
326
|
+
message.bool_value != null &&
|
|
327
|
+
Object.hasOwnProperty.call(message, "bool_value")
|
|
328
|
+
)
|
|
329
|
+
writer.uint32(/* id 12, wireType 0 =*/ 96).bool(message.bool_value);
|
|
330
|
+
if (
|
|
331
|
+
message.string_value != null &&
|
|
332
|
+
Object.hasOwnProperty.call(message, "string_value")
|
|
333
|
+
)
|
|
334
|
+
writer
|
|
335
|
+
.uint32(/* id 13, wireType 2 =*/ 106)
|
|
336
|
+
.string(message.string_value);
|
|
337
|
+
if (
|
|
338
|
+
message.bytes_value != null &&
|
|
339
|
+
Object.hasOwnProperty.call(message, "bytes_value")
|
|
340
|
+
)
|
|
341
|
+
writer
|
|
342
|
+
.uint32(/* id 14, wireType 2 =*/ 114)
|
|
343
|
+
.bytes(message.bytes_value);
|
|
344
|
+
return writer;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Encodes the specified value_type message, length delimited. Does not implicitly {@link koinos.chain.value_type.verify|verify} messages.
|
|
349
|
+
* @function encodeDelimited
|
|
350
|
+
* @memberof koinos.chain.value_type
|
|
351
|
+
* @static
|
|
352
|
+
* @param {koinos.chain.Ivalue_type} message value_type message or plain object to encode
|
|
353
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
354
|
+
* @returns {$protobuf.Writer} Writer
|
|
355
|
+
*/
|
|
356
|
+
value_type.encodeDelimited = function encodeDelimited(message, writer) {
|
|
357
|
+
return this.encode(message, writer).ldelim();
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Decodes a value_type message from the specified reader or buffer.
|
|
362
|
+
* @function decode
|
|
363
|
+
* @memberof koinos.chain.value_type
|
|
364
|
+
* @static
|
|
365
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
366
|
+
* @param {number} [length] Message length if known beforehand
|
|
367
|
+
* @returns {koinos.chain.value_type} value_type
|
|
368
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
369
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
370
|
+
*/
|
|
371
|
+
value_type.decode = function decode(reader, length) {
|
|
372
|
+
if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
|
|
373
|
+
var end = length === undefined ? reader.len : reader.pos + length,
|
|
374
|
+
message = new $root.koinos.chain.value_type();
|
|
375
|
+
while (reader.pos < end) {
|
|
376
|
+
var tag = reader.uint32();
|
|
377
|
+
switch (tag >>> 3) {
|
|
378
|
+
case 1: {
|
|
379
|
+
message.message_value = $root.google.protobuf.Any.decode(
|
|
380
|
+
reader,
|
|
381
|
+
reader.uint32()
|
|
382
|
+
);
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
case 2: {
|
|
386
|
+
message.int32_value = reader.int32();
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
case 3: {
|
|
390
|
+
message.int64_value = reader.int64();
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
case 4: {
|
|
394
|
+
message.uint32_value = reader.uint32();
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
case 5: {
|
|
398
|
+
message.uint64_value = reader.uint64();
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
case 6: {
|
|
402
|
+
message.sint32_value = reader.sint32();
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
case 7: {
|
|
406
|
+
message.sint64_value = reader.sint64();
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
case 8: {
|
|
410
|
+
message.fixed32_value = reader.fixed32();
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
case 9: {
|
|
414
|
+
message.fixed64_value = reader.fixed64();
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
case 10: {
|
|
418
|
+
message.sfixed32_value = reader.sfixed32();
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
case 11: {
|
|
422
|
+
message.sfixed64_value = reader.sfixed64();
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
case 12: {
|
|
426
|
+
message.bool_value = reader.bool();
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
case 13: {
|
|
430
|
+
message.string_value = reader.string();
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
case 14: {
|
|
434
|
+
message.bytes_value = reader.bytes();
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
default:
|
|
438
|
+
reader.skipType(tag & 7);
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return message;
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Decodes a value_type message from the specified reader or buffer, length delimited.
|
|
447
|
+
* @function decodeDelimited
|
|
448
|
+
* @memberof koinos.chain.value_type
|
|
449
|
+
* @static
|
|
450
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
451
|
+
* @returns {koinos.chain.value_type} value_type
|
|
452
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
453
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
454
|
+
*/
|
|
455
|
+
value_type.decodeDelimited = function decodeDelimited(reader) {
|
|
456
|
+
if (!(reader instanceof $Reader)) reader = new $Reader(reader);
|
|
457
|
+
return this.decode(reader, reader.uint32());
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Verifies a value_type message.
|
|
462
|
+
* @function verify
|
|
463
|
+
* @memberof koinos.chain.value_type
|
|
464
|
+
* @static
|
|
465
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
466
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
467
|
+
*/
|
|
468
|
+
value_type.verify = function verify(message) {
|
|
469
|
+
if (typeof message !== "object" || message === null)
|
|
470
|
+
return "object expected";
|
|
471
|
+
var properties = {};
|
|
472
|
+
if (
|
|
473
|
+
message.message_value != null &&
|
|
474
|
+
message.hasOwnProperty("message_value")
|
|
475
|
+
) {
|
|
476
|
+
properties.kind = 1;
|
|
477
|
+
{
|
|
478
|
+
var error = $root.google.protobuf.Any.verify(
|
|
479
|
+
message.message_value
|
|
480
|
+
);
|
|
481
|
+
if (error) return "message_value." + error;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (
|
|
485
|
+
message.int32_value != null &&
|
|
486
|
+
message.hasOwnProperty("int32_value")
|
|
487
|
+
) {
|
|
488
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
489
|
+
properties.kind = 1;
|
|
490
|
+
if (!$util.isInteger(message.int32_value))
|
|
491
|
+
return "int32_value: integer expected";
|
|
492
|
+
}
|
|
493
|
+
if (
|
|
494
|
+
message.int64_value != null &&
|
|
495
|
+
message.hasOwnProperty("int64_value")
|
|
496
|
+
) {
|
|
497
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
498
|
+
properties.kind = 1;
|
|
499
|
+
if (
|
|
500
|
+
!$util.isInteger(message.int64_value) &&
|
|
501
|
+
!(
|
|
502
|
+
message.int64_value &&
|
|
503
|
+
$util.isInteger(message.int64_value.low) &&
|
|
504
|
+
$util.isInteger(message.int64_value.high)
|
|
505
|
+
)
|
|
506
|
+
)
|
|
507
|
+
return "int64_value: integer|Long expected";
|
|
508
|
+
}
|
|
509
|
+
if (
|
|
510
|
+
message.uint32_value != null &&
|
|
511
|
+
message.hasOwnProperty("uint32_value")
|
|
512
|
+
) {
|
|
513
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
514
|
+
properties.kind = 1;
|
|
515
|
+
if (!$util.isInteger(message.uint32_value))
|
|
516
|
+
return "uint32_value: integer expected";
|
|
517
|
+
}
|
|
518
|
+
if (
|
|
519
|
+
message.uint64_value != null &&
|
|
520
|
+
message.hasOwnProperty("uint64_value")
|
|
521
|
+
) {
|
|
522
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
523
|
+
properties.kind = 1;
|
|
524
|
+
if (
|
|
525
|
+
!$util.isInteger(message.uint64_value) &&
|
|
526
|
+
!(
|
|
527
|
+
message.uint64_value &&
|
|
528
|
+
$util.isInteger(message.uint64_value.low) &&
|
|
529
|
+
$util.isInteger(message.uint64_value.high)
|
|
530
|
+
)
|
|
531
|
+
)
|
|
532
|
+
return "uint64_value: integer|Long expected";
|
|
533
|
+
}
|
|
534
|
+
if (
|
|
535
|
+
message.sint32_value != null &&
|
|
536
|
+
message.hasOwnProperty("sint32_value")
|
|
537
|
+
) {
|
|
538
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
539
|
+
properties.kind = 1;
|
|
540
|
+
if (!$util.isInteger(message.sint32_value))
|
|
541
|
+
return "sint32_value: integer expected";
|
|
542
|
+
}
|
|
543
|
+
if (
|
|
544
|
+
message.sint64_value != null &&
|
|
545
|
+
message.hasOwnProperty("sint64_value")
|
|
546
|
+
) {
|
|
547
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
548
|
+
properties.kind = 1;
|
|
549
|
+
if (
|
|
550
|
+
!$util.isInteger(message.sint64_value) &&
|
|
551
|
+
!(
|
|
552
|
+
message.sint64_value &&
|
|
553
|
+
$util.isInteger(message.sint64_value.low) &&
|
|
554
|
+
$util.isInteger(message.sint64_value.high)
|
|
555
|
+
)
|
|
556
|
+
)
|
|
557
|
+
return "sint64_value: integer|Long expected";
|
|
558
|
+
}
|
|
559
|
+
if (
|
|
560
|
+
message.fixed32_value != null &&
|
|
561
|
+
message.hasOwnProperty("fixed32_value")
|
|
562
|
+
) {
|
|
563
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
564
|
+
properties.kind = 1;
|
|
565
|
+
if (!$util.isInteger(message.fixed32_value))
|
|
566
|
+
return "fixed32_value: integer expected";
|
|
567
|
+
}
|
|
568
|
+
if (
|
|
569
|
+
message.fixed64_value != null &&
|
|
570
|
+
message.hasOwnProperty("fixed64_value")
|
|
571
|
+
) {
|
|
572
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
573
|
+
properties.kind = 1;
|
|
574
|
+
if (
|
|
575
|
+
!$util.isInteger(message.fixed64_value) &&
|
|
576
|
+
!(
|
|
577
|
+
message.fixed64_value &&
|
|
578
|
+
$util.isInteger(message.fixed64_value.low) &&
|
|
579
|
+
$util.isInteger(message.fixed64_value.high)
|
|
580
|
+
)
|
|
581
|
+
)
|
|
582
|
+
return "fixed64_value: integer|Long expected";
|
|
583
|
+
}
|
|
584
|
+
if (
|
|
585
|
+
message.sfixed32_value != null &&
|
|
586
|
+
message.hasOwnProperty("sfixed32_value")
|
|
587
|
+
) {
|
|
588
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
589
|
+
properties.kind = 1;
|
|
590
|
+
if (!$util.isInteger(message.sfixed32_value))
|
|
591
|
+
return "sfixed32_value: integer expected";
|
|
592
|
+
}
|
|
593
|
+
if (
|
|
594
|
+
message.sfixed64_value != null &&
|
|
595
|
+
message.hasOwnProperty("sfixed64_value")
|
|
596
|
+
) {
|
|
597
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
598
|
+
properties.kind = 1;
|
|
599
|
+
if (
|
|
600
|
+
!$util.isInteger(message.sfixed64_value) &&
|
|
601
|
+
!(
|
|
602
|
+
message.sfixed64_value &&
|
|
603
|
+
$util.isInteger(message.sfixed64_value.low) &&
|
|
604
|
+
$util.isInteger(message.sfixed64_value.high)
|
|
605
|
+
)
|
|
606
|
+
)
|
|
607
|
+
return "sfixed64_value: integer|Long expected";
|
|
608
|
+
}
|
|
609
|
+
if (
|
|
610
|
+
message.bool_value != null &&
|
|
611
|
+
message.hasOwnProperty("bool_value")
|
|
612
|
+
) {
|
|
613
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
614
|
+
properties.kind = 1;
|
|
615
|
+
if (typeof message.bool_value !== "boolean")
|
|
616
|
+
return "bool_value: boolean expected";
|
|
617
|
+
}
|
|
618
|
+
if (
|
|
619
|
+
message.string_value != null &&
|
|
620
|
+
message.hasOwnProperty("string_value")
|
|
621
|
+
) {
|
|
622
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
623
|
+
properties.kind = 1;
|
|
624
|
+
if (!$util.isString(message.string_value))
|
|
625
|
+
return "string_value: string expected";
|
|
626
|
+
}
|
|
627
|
+
if (
|
|
628
|
+
message.bytes_value != null &&
|
|
629
|
+
message.hasOwnProperty("bytes_value")
|
|
630
|
+
) {
|
|
631
|
+
if (properties.kind === 1) return "kind: multiple values";
|
|
632
|
+
properties.kind = 1;
|
|
633
|
+
if (
|
|
634
|
+
!(
|
|
635
|
+
(message.bytes_value &&
|
|
636
|
+
typeof message.bytes_value.length === "number") ||
|
|
637
|
+
$util.isString(message.bytes_value)
|
|
638
|
+
)
|
|
639
|
+
)
|
|
640
|
+
return "bytes_value: buffer expected";
|
|
641
|
+
}
|
|
642
|
+
return null;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Creates a value_type message from a plain object. Also converts values to their respective internal types.
|
|
647
|
+
* @function fromObject
|
|
648
|
+
* @memberof koinos.chain.value_type
|
|
649
|
+
* @static
|
|
650
|
+
* @param {Object.<string,*>} object Plain object
|
|
651
|
+
* @returns {koinos.chain.value_type} value_type
|
|
652
|
+
*/
|
|
653
|
+
value_type.fromObject = function fromObject(object) {
|
|
654
|
+
if (object instanceof $root.koinos.chain.value_type) return object;
|
|
655
|
+
var message = new $root.koinos.chain.value_type();
|
|
656
|
+
if (object.message_value != null) {
|
|
657
|
+
if (typeof object.message_value !== "object")
|
|
658
|
+
throw TypeError(
|
|
659
|
+
".koinos.chain.value_type.message_value: object expected"
|
|
660
|
+
);
|
|
661
|
+
message.message_value = $root.google.protobuf.Any.fromObject(
|
|
662
|
+
object.message_value
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
if (object.int32_value != null)
|
|
666
|
+
message.int32_value = object.int32_value | 0;
|
|
667
|
+
if (object.int64_value != null)
|
|
668
|
+
if ($util.Long)
|
|
669
|
+
(message.int64_value = $util.Long.fromValue(
|
|
670
|
+
object.int64_value
|
|
671
|
+
)).unsigned = false;
|
|
672
|
+
else if (typeof object.int64_value === "string")
|
|
673
|
+
message.int64_value = parseInt(object.int64_value, 10);
|
|
674
|
+
else if (typeof object.int64_value === "number")
|
|
675
|
+
message.int64_value = object.int64_value;
|
|
676
|
+
else if (typeof object.int64_value === "object")
|
|
677
|
+
message.int64_value = new $util.LongBits(
|
|
678
|
+
object.int64_value.low >>> 0,
|
|
679
|
+
object.int64_value.high >>> 0
|
|
680
|
+
).toNumber();
|
|
681
|
+
if (object.uint32_value != null)
|
|
682
|
+
message.uint32_value = object.uint32_value >>> 0;
|
|
683
|
+
if (object.uint64_value != null)
|
|
684
|
+
if ($util.Long)
|
|
685
|
+
(message.uint64_value = $util.Long.fromValue(
|
|
686
|
+
object.uint64_value
|
|
687
|
+
)).unsigned = true;
|
|
688
|
+
else if (typeof object.uint64_value === "string")
|
|
689
|
+
message.uint64_value = parseInt(object.uint64_value, 10);
|
|
690
|
+
else if (typeof object.uint64_value === "number")
|
|
691
|
+
message.uint64_value = object.uint64_value;
|
|
692
|
+
else if (typeof object.uint64_value === "object")
|
|
693
|
+
message.uint64_value = new $util.LongBits(
|
|
694
|
+
object.uint64_value.low >>> 0,
|
|
695
|
+
object.uint64_value.high >>> 0
|
|
696
|
+
).toNumber(true);
|
|
697
|
+
if (object.sint32_value != null)
|
|
698
|
+
message.sint32_value = object.sint32_value | 0;
|
|
699
|
+
if (object.sint64_value != null)
|
|
700
|
+
if ($util.Long)
|
|
701
|
+
(message.sint64_value = $util.Long.fromValue(
|
|
702
|
+
object.sint64_value
|
|
703
|
+
)).unsigned = false;
|
|
704
|
+
else if (typeof object.sint64_value === "string")
|
|
705
|
+
message.sint64_value = parseInt(object.sint64_value, 10);
|
|
706
|
+
else if (typeof object.sint64_value === "number")
|
|
707
|
+
message.sint64_value = object.sint64_value;
|
|
708
|
+
else if (typeof object.sint64_value === "object")
|
|
709
|
+
message.sint64_value = new $util.LongBits(
|
|
710
|
+
object.sint64_value.low >>> 0,
|
|
711
|
+
object.sint64_value.high >>> 0
|
|
712
|
+
).toNumber();
|
|
713
|
+
if (object.fixed32_value != null)
|
|
714
|
+
message.fixed32_value = object.fixed32_value >>> 0;
|
|
715
|
+
if (object.fixed64_value != null)
|
|
716
|
+
if ($util.Long)
|
|
717
|
+
(message.fixed64_value = $util.Long.fromValue(
|
|
718
|
+
object.fixed64_value
|
|
719
|
+
)).unsigned = false;
|
|
720
|
+
else if (typeof object.fixed64_value === "string")
|
|
721
|
+
message.fixed64_value = parseInt(object.fixed64_value, 10);
|
|
722
|
+
else if (typeof object.fixed64_value === "number")
|
|
723
|
+
message.fixed64_value = object.fixed64_value;
|
|
724
|
+
else if (typeof object.fixed64_value === "object")
|
|
725
|
+
message.fixed64_value = new $util.LongBits(
|
|
726
|
+
object.fixed64_value.low >>> 0,
|
|
727
|
+
object.fixed64_value.high >>> 0
|
|
728
|
+
).toNumber();
|
|
729
|
+
if (object.sfixed32_value != null)
|
|
730
|
+
message.sfixed32_value = object.sfixed32_value | 0;
|
|
731
|
+
if (object.sfixed64_value != null)
|
|
732
|
+
if ($util.Long)
|
|
733
|
+
(message.sfixed64_value = $util.Long.fromValue(
|
|
734
|
+
object.sfixed64_value
|
|
735
|
+
)).unsigned = false;
|
|
736
|
+
else if (typeof object.sfixed64_value === "string")
|
|
737
|
+
message.sfixed64_value = parseInt(object.sfixed64_value, 10);
|
|
738
|
+
else if (typeof object.sfixed64_value === "number")
|
|
739
|
+
message.sfixed64_value = object.sfixed64_value;
|
|
740
|
+
else if (typeof object.sfixed64_value === "object")
|
|
741
|
+
message.sfixed64_value = new $util.LongBits(
|
|
742
|
+
object.sfixed64_value.low >>> 0,
|
|
743
|
+
object.sfixed64_value.high >>> 0
|
|
744
|
+
).toNumber();
|
|
745
|
+
if (object.bool_value != null)
|
|
746
|
+
message.bool_value = Boolean(object.bool_value);
|
|
747
|
+
if (object.string_value != null)
|
|
748
|
+
message.string_value = String(object.string_value);
|
|
749
|
+
if (object.bytes_value != null)
|
|
750
|
+
if (typeof object.bytes_value === "string")
|
|
751
|
+
$util.base64.decode(
|
|
752
|
+
object.bytes_value,
|
|
753
|
+
(message.bytes_value = $util.newBuffer(
|
|
754
|
+
$util.base64.length(object.bytes_value)
|
|
755
|
+
)),
|
|
756
|
+
0
|
|
757
|
+
);
|
|
758
|
+
else if (object.bytes_value.length >= 0)
|
|
759
|
+
message.bytes_value = object.bytes_value;
|
|
760
|
+
return message;
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Creates a plain object from a value_type message. Also converts values to other types if specified.
|
|
765
|
+
* @function toObject
|
|
766
|
+
* @memberof koinos.chain.value_type
|
|
767
|
+
* @static
|
|
768
|
+
* @param {koinos.chain.value_type} message value_type
|
|
769
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
770
|
+
* @returns {Object.<string,*>} Plain object
|
|
771
|
+
*/
|
|
772
|
+
value_type.toObject = function toObject(message, options) {
|
|
773
|
+
if (!options) options = {};
|
|
774
|
+
var object = {};
|
|
775
|
+
if (
|
|
776
|
+
message.message_value != null &&
|
|
777
|
+
message.hasOwnProperty("message_value")
|
|
778
|
+
) {
|
|
779
|
+
object.message_value = $root.google.protobuf.Any.toObject(
|
|
780
|
+
message.message_value,
|
|
781
|
+
options
|
|
782
|
+
);
|
|
783
|
+
if (options.oneofs) object.kind = "message_value";
|
|
784
|
+
}
|
|
785
|
+
if (
|
|
786
|
+
message.int32_value != null &&
|
|
787
|
+
message.hasOwnProperty("int32_value")
|
|
788
|
+
) {
|
|
789
|
+
object.int32_value = message.int32_value;
|
|
790
|
+
if (options.oneofs) object.kind = "int32_value";
|
|
791
|
+
}
|
|
792
|
+
if (
|
|
793
|
+
message.int64_value != null &&
|
|
794
|
+
message.hasOwnProperty("int64_value")
|
|
795
|
+
) {
|
|
796
|
+
if (typeof message.int64_value === "number")
|
|
797
|
+
object.int64_value =
|
|
798
|
+
options.longs === String
|
|
799
|
+
? String(message.int64_value)
|
|
800
|
+
: message.int64_value;
|
|
801
|
+
else
|
|
802
|
+
object.int64_value =
|
|
803
|
+
options.longs === String
|
|
804
|
+
? $util.Long.prototype.toString.call(message.int64_value)
|
|
805
|
+
: options.longs === Number
|
|
806
|
+
? new $util.LongBits(
|
|
807
|
+
message.int64_value.low >>> 0,
|
|
808
|
+
message.int64_value.high >>> 0
|
|
809
|
+
).toNumber()
|
|
810
|
+
: message.int64_value;
|
|
811
|
+
if (options.oneofs) object.kind = "int64_value";
|
|
812
|
+
}
|
|
813
|
+
if (
|
|
814
|
+
message.uint32_value != null &&
|
|
815
|
+
message.hasOwnProperty("uint32_value")
|
|
816
|
+
) {
|
|
817
|
+
object.uint32_value = message.uint32_value;
|
|
818
|
+
if (options.oneofs) object.kind = "uint32_value";
|
|
819
|
+
}
|
|
820
|
+
if (
|
|
821
|
+
message.uint64_value != null &&
|
|
822
|
+
message.hasOwnProperty("uint64_value")
|
|
823
|
+
) {
|
|
824
|
+
if (typeof message.uint64_value === "number")
|
|
825
|
+
object.uint64_value =
|
|
826
|
+
options.longs === String
|
|
827
|
+
? String(message.uint64_value)
|
|
828
|
+
: message.uint64_value;
|
|
829
|
+
else
|
|
830
|
+
object.uint64_value =
|
|
831
|
+
options.longs === String
|
|
832
|
+
? $util.Long.prototype.toString.call(message.uint64_value)
|
|
833
|
+
: options.longs === Number
|
|
834
|
+
? new $util.LongBits(
|
|
835
|
+
message.uint64_value.low >>> 0,
|
|
836
|
+
message.uint64_value.high >>> 0
|
|
837
|
+
).toNumber(true)
|
|
838
|
+
: message.uint64_value;
|
|
839
|
+
if (options.oneofs) object.kind = "uint64_value";
|
|
840
|
+
}
|
|
841
|
+
if (
|
|
842
|
+
message.sint32_value != null &&
|
|
843
|
+
message.hasOwnProperty("sint32_value")
|
|
844
|
+
) {
|
|
845
|
+
object.sint32_value = message.sint32_value;
|
|
846
|
+
if (options.oneofs) object.kind = "sint32_value";
|
|
847
|
+
}
|
|
848
|
+
if (
|
|
849
|
+
message.sint64_value != null &&
|
|
850
|
+
message.hasOwnProperty("sint64_value")
|
|
851
|
+
) {
|
|
852
|
+
if (typeof message.sint64_value === "number")
|
|
853
|
+
object.sint64_value =
|
|
854
|
+
options.longs === String
|
|
855
|
+
? String(message.sint64_value)
|
|
856
|
+
: message.sint64_value;
|
|
857
|
+
else
|
|
858
|
+
object.sint64_value =
|
|
859
|
+
options.longs === String
|
|
860
|
+
? $util.Long.prototype.toString.call(message.sint64_value)
|
|
861
|
+
: options.longs === Number
|
|
862
|
+
? new $util.LongBits(
|
|
863
|
+
message.sint64_value.low >>> 0,
|
|
864
|
+
message.sint64_value.high >>> 0
|
|
865
|
+
).toNumber()
|
|
866
|
+
: message.sint64_value;
|
|
867
|
+
if (options.oneofs) object.kind = "sint64_value";
|
|
868
|
+
}
|
|
869
|
+
if (
|
|
870
|
+
message.fixed32_value != null &&
|
|
871
|
+
message.hasOwnProperty("fixed32_value")
|
|
872
|
+
) {
|
|
873
|
+
object.fixed32_value = message.fixed32_value;
|
|
874
|
+
if (options.oneofs) object.kind = "fixed32_value";
|
|
875
|
+
}
|
|
876
|
+
if (
|
|
877
|
+
message.fixed64_value != null &&
|
|
878
|
+
message.hasOwnProperty("fixed64_value")
|
|
879
|
+
) {
|
|
880
|
+
if (typeof message.fixed64_value === "number")
|
|
881
|
+
object.fixed64_value =
|
|
882
|
+
options.longs === String
|
|
883
|
+
? String(message.fixed64_value)
|
|
884
|
+
: message.fixed64_value;
|
|
885
|
+
else
|
|
886
|
+
object.fixed64_value =
|
|
887
|
+
options.longs === String
|
|
888
|
+
? $util.Long.prototype.toString.call(message.fixed64_value)
|
|
889
|
+
: options.longs === Number
|
|
890
|
+
? new $util.LongBits(
|
|
891
|
+
message.fixed64_value.low >>> 0,
|
|
892
|
+
message.fixed64_value.high >>> 0
|
|
893
|
+
).toNumber()
|
|
894
|
+
: message.fixed64_value;
|
|
895
|
+
if (options.oneofs) object.kind = "fixed64_value";
|
|
896
|
+
}
|
|
897
|
+
if (
|
|
898
|
+
message.sfixed32_value != null &&
|
|
899
|
+
message.hasOwnProperty("sfixed32_value")
|
|
900
|
+
) {
|
|
901
|
+
object.sfixed32_value = message.sfixed32_value;
|
|
902
|
+
if (options.oneofs) object.kind = "sfixed32_value";
|
|
903
|
+
}
|
|
904
|
+
if (
|
|
905
|
+
message.sfixed64_value != null &&
|
|
906
|
+
message.hasOwnProperty("sfixed64_value")
|
|
907
|
+
) {
|
|
908
|
+
if (typeof message.sfixed64_value === "number")
|
|
909
|
+
object.sfixed64_value =
|
|
910
|
+
options.longs === String
|
|
911
|
+
? String(message.sfixed64_value)
|
|
912
|
+
: message.sfixed64_value;
|
|
913
|
+
else
|
|
914
|
+
object.sfixed64_value =
|
|
915
|
+
options.longs === String
|
|
916
|
+
? $util.Long.prototype.toString.call(message.sfixed64_value)
|
|
917
|
+
: options.longs === Number
|
|
918
|
+
? new $util.LongBits(
|
|
919
|
+
message.sfixed64_value.low >>> 0,
|
|
920
|
+
message.sfixed64_value.high >>> 0
|
|
921
|
+
).toNumber()
|
|
922
|
+
: message.sfixed64_value;
|
|
923
|
+
if (options.oneofs) object.kind = "sfixed64_value";
|
|
924
|
+
}
|
|
925
|
+
if (
|
|
926
|
+
message.bool_value != null &&
|
|
927
|
+
message.hasOwnProperty("bool_value")
|
|
928
|
+
) {
|
|
929
|
+
object.bool_value = message.bool_value;
|
|
930
|
+
if (options.oneofs) object.kind = "bool_value";
|
|
931
|
+
}
|
|
932
|
+
if (
|
|
933
|
+
message.string_value != null &&
|
|
934
|
+
message.hasOwnProperty("string_value")
|
|
935
|
+
) {
|
|
936
|
+
object.string_value = message.string_value;
|
|
937
|
+
if (options.oneofs) object.kind = "string_value";
|
|
938
|
+
}
|
|
939
|
+
if (
|
|
940
|
+
message.bytes_value != null &&
|
|
941
|
+
message.hasOwnProperty("bytes_value")
|
|
942
|
+
) {
|
|
943
|
+
object.bytes_value =
|
|
944
|
+
options.bytes === String
|
|
945
|
+
? $util.base64.encode(
|
|
946
|
+
message.bytes_value,
|
|
947
|
+
0,
|
|
948
|
+
message.bytes_value.length
|
|
949
|
+
)
|
|
950
|
+
: options.bytes === Array
|
|
951
|
+
? Array.prototype.slice.call(message.bytes_value)
|
|
952
|
+
: message.bytes_value;
|
|
953
|
+
if (options.oneofs) object.kind = "bytes_value";
|
|
954
|
+
}
|
|
955
|
+
return object;
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Converts this value_type to JSON.
|
|
960
|
+
* @function toJSON
|
|
961
|
+
* @memberof koinos.chain.value_type
|
|
962
|
+
* @instance
|
|
963
|
+
* @returns {Object.<string,*>} JSON object
|
|
964
|
+
*/
|
|
965
|
+
value_type.prototype.toJSON = function toJSON() {
|
|
966
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
967
|
+
};
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Gets the default type url for value_type
|
|
971
|
+
* @function getTypeUrl
|
|
972
|
+
* @memberof koinos.chain.value_type
|
|
973
|
+
* @static
|
|
974
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
975
|
+
* @returns {string} The default type url
|
|
976
|
+
*/
|
|
977
|
+
value_type.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
978
|
+
if (typeUrlPrefix === undefined) {
|
|
979
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
980
|
+
}
|
|
981
|
+
return typeUrlPrefix + "/koinos.chain.value_type";
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
return value_type;
|
|
985
|
+
})();
|
|
986
|
+
|
|
987
|
+
chain.enum_type = (function () {
|
|
988
|
+
/**
|
|
989
|
+
* Properties of an enum_type.
|
|
990
|
+
* @memberof koinos.chain
|
|
991
|
+
* @interface Ienum_type
|
|
992
|
+
* @property {string|null} [name] enum_type name
|
|
993
|
+
* @property {number|null} [number] enum_type number
|
|
994
|
+
*/
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Constructs a new enum_type.
|
|
998
|
+
* @memberof koinos.chain
|
|
999
|
+
* @classdesc Represents an enum_type.
|
|
1000
|
+
* @implements Ienum_type
|
|
1001
|
+
* @constructor
|
|
1002
|
+
* @param {koinos.chain.Ienum_type=} [properties] Properties to set
|
|
1003
|
+
*/
|
|
1004
|
+
function enum_type(properties) {
|
|
1005
|
+
if (properties)
|
|
1006
|
+
for (
|
|
1007
|
+
var keys = Object.keys(properties), i = 0;
|
|
1008
|
+
i < keys.length;
|
|
1009
|
+
++i
|
|
1010
|
+
)
|
|
1011
|
+
if (properties[keys[i]] != null)
|
|
1012
|
+
this[keys[i]] = properties[keys[i]];
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* enum_type name.
|
|
1017
|
+
* @member {string} name
|
|
1018
|
+
* @memberof koinos.chain.enum_type
|
|
1019
|
+
* @instance
|
|
1020
|
+
*/
|
|
1021
|
+
enum_type.prototype.name = "";
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* enum_type number.
|
|
1025
|
+
* @member {number} number
|
|
1026
|
+
* @memberof koinos.chain.enum_type
|
|
1027
|
+
* @instance
|
|
1028
|
+
*/
|
|
1029
|
+
enum_type.prototype.number = 0;
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Creates a new enum_type instance using the specified properties.
|
|
1033
|
+
* @function create
|
|
1034
|
+
* @memberof koinos.chain.enum_type
|
|
1035
|
+
* @static
|
|
1036
|
+
* @param {koinos.chain.Ienum_type=} [properties] Properties to set
|
|
1037
|
+
* @returns {koinos.chain.enum_type} enum_type instance
|
|
1038
|
+
*/
|
|
1039
|
+
enum_type.create = function create(properties) {
|
|
1040
|
+
return new enum_type(properties);
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Encodes the specified enum_type message. Does not implicitly {@link koinos.chain.enum_type.verify|verify} messages.
|
|
1045
|
+
* @function encode
|
|
1046
|
+
* @memberof koinos.chain.enum_type
|
|
1047
|
+
* @static
|
|
1048
|
+
* @param {koinos.chain.Ienum_type} message enum_type message or plain object to encode
|
|
1049
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
1050
|
+
* @returns {$protobuf.Writer} Writer
|
|
1051
|
+
*/
|
|
1052
|
+
enum_type.encode = function encode(message, writer) {
|
|
1053
|
+
if (!writer) writer = $Writer.create();
|
|
1054
|
+
if (
|
|
1055
|
+
message.name != null &&
|
|
1056
|
+
Object.hasOwnProperty.call(message, "name")
|
|
1057
|
+
)
|
|
1058
|
+
writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.name);
|
|
1059
|
+
if (
|
|
1060
|
+
message.number != null &&
|
|
1061
|
+
Object.hasOwnProperty.call(message, "number")
|
|
1062
|
+
)
|
|
1063
|
+
writer.uint32(/* id 2, wireType 0 =*/ 16).int32(message.number);
|
|
1064
|
+
return writer;
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Encodes the specified enum_type message, length delimited. Does not implicitly {@link koinos.chain.enum_type.verify|verify} messages.
|
|
1069
|
+
* @function encodeDelimited
|
|
1070
|
+
* @memberof koinos.chain.enum_type
|
|
1071
|
+
* @static
|
|
1072
|
+
* @param {koinos.chain.Ienum_type} message enum_type message or plain object to encode
|
|
1073
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
1074
|
+
* @returns {$protobuf.Writer} Writer
|
|
1075
|
+
*/
|
|
1076
|
+
enum_type.encodeDelimited = function encodeDelimited(message, writer) {
|
|
1077
|
+
return this.encode(message, writer).ldelim();
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* Decodes an enum_type message from the specified reader or buffer.
|
|
1082
|
+
* @function decode
|
|
1083
|
+
* @memberof koinos.chain.enum_type
|
|
1084
|
+
* @static
|
|
1085
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1086
|
+
* @param {number} [length] Message length if known beforehand
|
|
1087
|
+
* @returns {koinos.chain.enum_type} enum_type
|
|
1088
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1089
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1090
|
+
*/
|
|
1091
|
+
enum_type.decode = function decode(reader, length) {
|
|
1092
|
+
if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
|
|
1093
|
+
var end = length === undefined ? reader.len : reader.pos + length,
|
|
1094
|
+
message = new $root.koinos.chain.enum_type();
|
|
1095
|
+
while (reader.pos < end) {
|
|
1096
|
+
var tag = reader.uint32();
|
|
1097
|
+
switch (tag >>> 3) {
|
|
1098
|
+
case 1: {
|
|
1099
|
+
message.name = reader.string();
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
case 2: {
|
|
1103
|
+
message.number = reader.int32();
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
default:
|
|
1107
|
+
reader.skipType(tag & 7);
|
|
1108
|
+
break;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
return message;
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
/**
|
|
1115
|
+
* Decodes an enum_type message from the specified reader or buffer, length delimited.
|
|
1116
|
+
* @function decodeDelimited
|
|
1117
|
+
* @memberof koinos.chain.enum_type
|
|
1118
|
+
* @static
|
|
1119
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1120
|
+
* @returns {koinos.chain.enum_type} enum_type
|
|
1121
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1122
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1123
|
+
*/
|
|
1124
|
+
enum_type.decodeDelimited = function decodeDelimited(reader) {
|
|
1125
|
+
if (!(reader instanceof $Reader)) reader = new $Reader(reader);
|
|
1126
|
+
return this.decode(reader, reader.uint32());
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Verifies an enum_type message.
|
|
1131
|
+
* @function verify
|
|
1132
|
+
* @memberof koinos.chain.enum_type
|
|
1133
|
+
* @static
|
|
1134
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
1135
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
1136
|
+
*/
|
|
1137
|
+
enum_type.verify = function verify(message) {
|
|
1138
|
+
if (typeof message !== "object" || message === null)
|
|
1139
|
+
return "object expected";
|
|
1140
|
+
if (message.name != null && message.hasOwnProperty("name"))
|
|
1141
|
+
if (!$util.isString(message.name)) return "name: string expected";
|
|
1142
|
+
if (message.number != null && message.hasOwnProperty("number"))
|
|
1143
|
+
if (!$util.isInteger(message.number))
|
|
1144
|
+
return "number: integer expected";
|
|
1145
|
+
return null;
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Creates an enum_type message from a plain object. Also converts values to their respective internal types.
|
|
1150
|
+
* @function fromObject
|
|
1151
|
+
* @memberof koinos.chain.enum_type
|
|
1152
|
+
* @static
|
|
1153
|
+
* @param {Object.<string,*>} object Plain object
|
|
1154
|
+
* @returns {koinos.chain.enum_type} enum_type
|
|
1155
|
+
*/
|
|
1156
|
+
enum_type.fromObject = function fromObject(object) {
|
|
1157
|
+
if (object instanceof $root.koinos.chain.enum_type) return object;
|
|
1158
|
+
var message = new $root.koinos.chain.enum_type();
|
|
1159
|
+
if (object.name != null) message.name = String(object.name);
|
|
1160
|
+
if (object.number != null) message.number = object.number | 0;
|
|
1161
|
+
return message;
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Creates a plain object from an enum_type message. Also converts values to other types if specified.
|
|
1166
|
+
* @function toObject
|
|
1167
|
+
* @memberof koinos.chain.enum_type
|
|
1168
|
+
* @static
|
|
1169
|
+
* @param {koinos.chain.enum_type} message enum_type
|
|
1170
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
1171
|
+
* @returns {Object.<string,*>} Plain object
|
|
1172
|
+
*/
|
|
1173
|
+
enum_type.toObject = function toObject(message, options) {
|
|
1174
|
+
if (!options) options = {};
|
|
1175
|
+
var object = {};
|
|
1176
|
+
if (options.defaults) {
|
|
1177
|
+
object.name = "";
|
|
1178
|
+
object.number = 0;
|
|
1179
|
+
}
|
|
1180
|
+
if (message.name != null && message.hasOwnProperty("name"))
|
|
1181
|
+
object.name = message.name;
|
|
1182
|
+
if (message.number != null && message.hasOwnProperty("number"))
|
|
1183
|
+
object.number = message.number;
|
|
1184
|
+
return object;
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* Converts this enum_type to JSON.
|
|
1189
|
+
* @function toJSON
|
|
1190
|
+
* @memberof koinos.chain.enum_type
|
|
1191
|
+
* @instance
|
|
1192
|
+
* @returns {Object.<string,*>} JSON object
|
|
1193
|
+
*/
|
|
1194
|
+
enum_type.prototype.toJSON = function toJSON() {
|
|
1195
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Gets the default type url for enum_type
|
|
1200
|
+
* @function getTypeUrl
|
|
1201
|
+
* @memberof koinos.chain.enum_type
|
|
1202
|
+
* @static
|
|
1203
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
1204
|
+
* @returns {string} The default type url
|
|
1205
|
+
*/
|
|
1206
|
+
enum_type.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
1207
|
+
if (typeUrlPrefix === undefined) {
|
|
1208
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
1209
|
+
}
|
|
1210
|
+
return typeUrlPrefix + "/koinos.chain.enum_type";
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
return enum_type;
|
|
1214
|
+
})();
|
|
1215
|
+
|
|
1216
|
+
chain.list_type = (function () {
|
|
1217
|
+
/**
|
|
1218
|
+
* Properties of a list_type.
|
|
1219
|
+
* @memberof koinos.chain
|
|
1220
|
+
* @interface Ilist_type
|
|
1221
|
+
* @property {Array.<koinos.chain.Ivalue_type>|null} [values] list_type values
|
|
1222
|
+
*/
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* Constructs a new list_type.
|
|
1226
|
+
* @memberof koinos.chain
|
|
1227
|
+
* @classdesc Represents a list_type.
|
|
1228
|
+
* @implements Ilist_type
|
|
1229
|
+
* @constructor
|
|
1230
|
+
* @param {koinos.chain.Ilist_type=} [properties] Properties to set
|
|
1231
|
+
*/
|
|
1232
|
+
function list_type(properties) {
|
|
1233
|
+
this.values = [];
|
|
1234
|
+
if (properties)
|
|
1235
|
+
for (
|
|
1236
|
+
var keys = Object.keys(properties), i = 0;
|
|
1237
|
+
i < keys.length;
|
|
1238
|
+
++i
|
|
1239
|
+
)
|
|
1240
|
+
if (properties[keys[i]] != null)
|
|
1241
|
+
this[keys[i]] = properties[keys[i]];
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* list_type values.
|
|
1246
|
+
* @member {Array.<koinos.chain.Ivalue_type>} values
|
|
1247
|
+
* @memberof koinos.chain.list_type
|
|
1248
|
+
* @instance
|
|
1249
|
+
*/
|
|
1250
|
+
list_type.prototype.values = $util.emptyArray;
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* Creates a new list_type instance using the specified properties.
|
|
1254
|
+
* @function create
|
|
1255
|
+
* @memberof koinos.chain.list_type
|
|
1256
|
+
* @static
|
|
1257
|
+
* @param {koinos.chain.Ilist_type=} [properties] Properties to set
|
|
1258
|
+
* @returns {koinos.chain.list_type} list_type instance
|
|
1259
|
+
*/
|
|
1260
|
+
list_type.create = function create(properties) {
|
|
1261
|
+
return new list_type(properties);
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* Encodes the specified list_type message. Does not implicitly {@link koinos.chain.list_type.verify|verify} messages.
|
|
1266
|
+
* @function encode
|
|
1267
|
+
* @memberof koinos.chain.list_type
|
|
1268
|
+
* @static
|
|
1269
|
+
* @param {koinos.chain.Ilist_type} message list_type message or plain object to encode
|
|
1270
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
1271
|
+
* @returns {$protobuf.Writer} Writer
|
|
1272
|
+
*/
|
|
1273
|
+
list_type.encode = function encode(message, writer) {
|
|
1274
|
+
if (!writer) writer = $Writer.create();
|
|
1275
|
+
if (message.values != null && message.values.length)
|
|
1276
|
+
for (var i = 0; i < message.values.length; ++i)
|
|
1277
|
+
$root.koinos.chain.value_type
|
|
1278
|
+
.encode(
|
|
1279
|
+
message.values[i],
|
|
1280
|
+
writer.uint32(/* id 1, wireType 2 =*/ 10).fork()
|
|
1281
|
+
)
|
|
1282
|
+
.ldelim();
|
|
1283
|
+
return writer;
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Encodes the specified list_type message, length delimited. Does not implicitly {@link koinos.chain.list_type.verify|verify} messages.
|
|
1288
|
+
* @function encodeDelimited
|
|
1289
|
+
* @memberof koinos.chain.list_type
|
|
1290
|
+
* @static
|
|
1291
|
+
* @param {koinos.chain.Ilist_type} message list_type message or plain object to encode
|
|
1292
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
1293
|
+
* @returns {$protobuf.Writer} Writer
|
|
1294
|
+
*/
|
|
1295
|
+
list_type.encodeDelimited = function encodeDelimited(message, writer) {
|
|
1296
|
+
return this.encode(message, writer).ldelim();
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Decodes a list_type message from the specified reader or buffer.
|
|
1301
|
+
* @function decode
|
|
1302
|
+
* @memberof koinos.chain.list_type
|
|
1303
|
+
* @static
|
|
1304
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1305
|
+
* @param {number} [length] Message length if known beforehand
|
|
1306
|
+
* @returns {koinos.chain.list_type} list_type
|
|
1307
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1308
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1309
|
+
*/
|
|
1310
|
+
list_type.decode = function decode(reader, length) {
|
|
1311
|
+
if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
|
|
1312
|
+
var end = length === undefined ? reader.len : reader.pos + length,
|
|
1313
|
+
message = new $root.koinos.chain.list_type();
|
|
1314
|
+
while (reader.pos < end) {
|
|
1315
|
+
var tag = reader.uint32();
|
|
1316
|
+
switch (tag >>> 3) {
|
|
1317
|
+
case 1: {
|
|
1318
|
+
if (!(message.values && message.values.length))
|
|
1319
|
+
message.values = [];
|
|
1320
|
+
message.values.push(
|
|
1321
|
+
$root.koinos.chain.value_type.decode(reader, reader.uint32())
|
|
1322
|
+
);
|
|
1323
|
+
break;
|
|
1324
|
+
}
|
|
1325
|
+
default:
|
|
1326
|
+
reader.skipType(tag & 7);
|
|
1327
|
+
break;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
return message;
|
|
1331
|
+
};
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Decodes a list_type message from the specified reader or buffer, length delimited.
|
|
1335
|
+
* @function decodeDelimited
|
|
1336
|
+
* @memberof koinos.chain.list_type
|
|
1337
|
+
* @static
|
|
1338
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1339
|
+
* @returns {koinos.chain.list_type} list_type
|
|
1340
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1341
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1342
|
+
*/
|
|
1343
|
+
list_type.decodeDelimited = function decodeDelimited(reader) {
|
|
1344
|
+
if (!(reader instanceof $Reader)) reader = new $Reader(reader);
|
|
1345
|
+
return this.decode(reader, reader.uint32());
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Verifies a list_type message.
|
|
1350
|
+
* @function verify
|
|
1351
|
+
* @memberof koinos.chain.list_type
|
|
1352
|
+
* @static
|
|
1353
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
1354
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
1355
|
+
*/
|
|
1356
|
+
list_type.verify = function verify(message) {
|
|
1357
|
+
if (typeof message !== "object" || message === null)
|
|
1358
|
+
return "object expected";
|
|
1359
|
+
if (message.values != null && message.hasOwnProperty("values")) {
|
|
1360
|
+
if (!Array.isArray(message.values)) return "values: array expected";
|
|
1361
|
+
for (var i = 0; i < message.values.length; ++i) {
|
|
1362
|
+
var error = $root.koinos.chain.value_type.verify(
|
|
1363
|
+
message.values[i]
|
|
1364
|
+
);
|
|
1365
|
+
if (error) return "values." + error;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
return null;
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Creates a list_type message from a plain object. Also converts values to their respective internal types.
|
|
1373
|
+
* @function fromObject
|
|
1374
|
+
* @memberof koinos.chain.list_type
|
|
1375
|
+
* @static
|
|
1376
|
+
* @param {Object.<string,*>} object Plain object
|
|
1377
|
+
* @returns {koinos.chain.list_type} list_type
|
|
1378
|
+
*/
|
|
1379
|
+
list_type.fromObject = function fromObject(object) {
|
|
1380
|
+
if (object instanceof $root.koinos.chain.list_type) return object;
|
|
1381
|
+
var message = new $root.koinos.chain.list_type();
|
|
1382
|
+
if (object.values) {
|
|
1383
|
+
if (!Array.isArray(object.values))
|
|
1384
|
+
throw TypeError(".koinos.chain.list_type.values: array expected");
|
|
1385
|
+
message.values = [];
|
|
1386
|
+
for (var i = 0; i < object.values.length; ++i) {
|
|
1387
|
+
if (typeof object.values[i] !== "object")
|
|
1388
|
+
throw TypeError(
|
|
1389
|
+
".koinos.chain.list_type.values: object expected"
|
|
1390
|
+
);
|
|
1391
|
+
message.values[i] = $root.koinos.chain.value_type.fromObject(
|
|
1392
|
+
object.values[i]
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
return message;
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* Creates a plain object from a list_type message. Also converts values to other types if specified.
|
|
1401
|
+
* @function toObject
|
|
1402
|
+
* @memberof koinos.chain.list_type
|
|
1403
|
+
* @static
|
|
1404
|
+
* @param {koinos.chain.list_type} message list_type
|
|
1405
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
1406
|
+
* @returns {Object.<string,*>} Plain object
|
|
1407
|
+
*/
|
|
1408
|
+
list_type.toObject = function toObject(message, options) {
|
|
1409
|
+
if (!options) options = {};
|
|
1410
|
+
var object = {};
|
|
1411
|
+
if (options.arrays || options.defaults) object.values = [];
|
|
1412
|
+
if (message.values && message.values.length) {
|
|
1413
|
+
object.values = [];
|
|
1414
|
+
for (var j = 0; j < message.values.length; ++j)
|
|
1415
|
+
object.values[j] = $root.koinos.chain.value_type.toObject(
|
|
1416
|
+
message.values[j],
|
|
1417
|
+
options
|
|
1418
|
+
);
|
|
1419
|
+
}
|
|
1420
|
+
return object;
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* Converts this list_type to JSON.
|
|
1425
|
+
* @function toJSON
|
|
1426
|
+
* @memberof koinos.chain.list_type
|
|
1427
|
+
* @instance
|
|
1428
|
+
* @returns {Object.<string,*>} JSON object
|
|
1429
|
+
*/
|
|
1430
|
+
list_type.prototype.toJSON = function toJSON() {
|
|
1431
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
1432
|
+
};
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* Gets the default type url for list_type
|
|
1436
|
+
* @function getTypeUrl
|
|
1437
|
+
* @memberof koinos.chain.list_type
|
|
1438
|
+
* @static
|
|
1439
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
1440
|
+
* @returns {string} The default type url
|
|
1441
|
+
*/
|
|
1442
|
+
list_type.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
1443
|
+
if (typeUrlPrefix === undefined) {
|
|
1444
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
1445
|
+
}
|
|
1446
|
+
return typeUrlPrefix + "/koinos.chain.list_type";
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1449
|
+
return list_type;
|
|
1450
|
+
})();
|
|
1451
|
+
|
|
1452
|
+
return chain;
|
|
1453
|
+
})();
|
|
1454
|
+
|
|
1455
|
+
return koinos;
|
|
1456
|
+
})();
|
|
1457
|
+
|
|
1458
|
+
$root.google = (function () {
|
|
1459
|
+
/**
|
|
1460
|
+
* Namespace google.
|
|
1461
|
+
* @exports google
|
|
1462
|
+
* @namespace
|
|
1463
|
+
*/
|
|
1464
|
+
var google = {};
|
|
1465
|
+
|
|
1466
|
+
google.protobuf = (function () {
|
|
1467
|
+
/**
|
|
1468
|
+
* Namespace protobuf.
|
|
1469
|
+
* @memberof google
|
|
1470
|
+
* @namespace
|
|
1471
|
+
*/
|
|
1472
|
+
var protobuf = {};
|
|
1473
|
+
|
|
1474
|
+
protobuf.Any = (function () {
|
|
1475
|
+
/**
|
|
1476
|
+
* Properties of an Any.
|
|
1477
|
+
* @memberof google.protobuf
|
|
1478
|
+
* @interface IAny
|
|
1479
|
+
* @property {string|null} [type_url] Any type_url
|
|
1480
|
+
* @property {Uint8Array|null} [value] Any value
|
|
1481
|
+
*/
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* Constructs a new Any.
|
|
1485
|
+
* @memberof google.protobuf
|
|
1486
|
+
* @classdesc Represents an Any.
|
|
1487
|
+
* @implements IAny
|
|
1488
|
+
* @constructor
|
|
1489
|
+
* @param {google.protobuf.IAny=} [properties] Properties to set
|
|
1490
|
+
*/
|
|
1491
|
+
function Any(properties) {
|
|
1492
|
+
if (properties)
|
|
1493
|
+
for (
|
|
1494
|
+
var keys = Object.keys(properties), i = 0;
|
|
1495
|
+
i < keys.length;
|
|
1496
|
+
++i
|
|
1497
|
+
)
|
|
1498
|
+
if (properties[keys[i]] != null)
|
|
1499
|
+
this[keys[i]] = properties[keys[i]];
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
/**
|
|
1503
|
+
* Any type_url.
|
|
1504
|
+
* @member {string} type_url
|
|
1505
|
+
* @memberof google.protobuf.Any
|
|
1506
|
+
* @instance
|
|
1507
|
+
*/
|
|
1508
|
+
Any.prototype.type_url = "";
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Any value.
|
|
1512
|
+
* @member {Uint8Array} value
|
|
1513
|
+
* @memberof google.protobuf.Any
|
|
1514
|
+
* @instance
|
|
1515
|
+
*/
|
|
1516
|
+
Any.prototype.value = $util.newBuffer([]);
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* Creates a new Any instance using the specified properties.
|
|
1520
|
+
* @function create
|
|
1521
|
+
* @memberof google.protobuf.Any
|
|
1522
|
+
* @static
|
|
1523
|
+
* @param {google.protobuf.IAny=} [properties] Properties to set
|
|
1524
|
+
* @returns {google.protobuf.Any} Any instance
|
|
1525
|
+
*/
|
|
1526
|
+
Any.create = function create(properties) {
|
|
1527
|
+
return new Any(properties);
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages.
|
|
1532
|
+
* @function encode
|
|
1533
|
+
* @memberof google.protobuf.Any
|
|
1534
|
+
* @static
|
|
1535
|
+
* @param {google.protobuf.IAny} message Any message or plain object to encode
|
|
1536
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
1537
|
+
* @returns {$protobuf.Writer} Writer
|
|
1538
|
+
*/
|
|
1539
|
+
Any.encode = function encode(message, writer) {
|
|
1540
|
+
if (!writer) writer = $Writer.create();
|
|
1541
|
+
if (
|
|
1542
|
+
message.type_url != null &&
|
|
1543
|
+
Object.hasOwnProperty.call(message, "type_url")
|
|
1544
|
+
)
|
|
1545
|
+
writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.type_url);
|
|
1546
|
+
if (
|
|
1547
|
+
message.value != null &&
|
|
1548
|
+
Object.hasOwnProperty.call(message, "value")
|
|
1549
|
+
)
|
|
1550
|
+
writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.value);
|
|
1551
|
+
return writer;
|
|
1552
|
+
};
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages.
|
|
1556
|
+
* @function encodeDelimited
|
|
1557
|
+
* @memberof google.protobuf.Any
|
|
1558
|
+
* @static
|
|
1559
|
+
* @param {google.protobuf.IAny} message Any message or plain object to encode
|
|
1560
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
1561
|
+
* @returns {$protobuf.Writer} Writer
|
|
1562
|
+
*/
|
|
1563
|
+
Any.encodeDelimited = function encodeDelimited(message, writer) {
|
|
1564
|
+
return this.encode(message, writer).ldelim();
|
|
1565
|
+
};
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* Decodes an Any message from the specified reader or buffer.
|
|
1569
|
+
* @function decode
|
|
1570
|
+
* @memberof google.protobuf.Any
|
|
1571
|
+
* @static
|
|
1572
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1573
|
+
* @param {number} [length] Message length if known beforehand
|
|
1574
|
+
* @returns {google.protobuf.Any} Any
|
|
1575
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1576
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1577
|
+
*/
|
|
1578
|
+
Any.decode = function decode(reader, length) {
|
|
1579
|
+
if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
|
|
1580
|
+
var end = length === undefined ? reader.len : reader.pos + length,
|
|
1581
|
+
message = new $root.google.protobuf.Any();
|
|
1582
|
+
while (reader.pos < end) {
|
|
1583
|
+
var tag = reader.uint32();
|
|
1584
|
+
switch (tag >>> 3) {
|
|
1585
|
+
case 1: {
|
|
1586
|
+
message.type_url = reader.string();
|
|
1587
|
+
break;
|
|
1588
|
+
}
|
|
1589
|
+
case 2: {
|
|
1590
|
+
message.value = reader.bytes();
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
default:
|
|
1594
|
+
reader.skipType(tag & 7);
|
|
1595
|
+
break;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
return message;
|
|
1599
|
+
};
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Decodes an Any message from the specified reader or buffer, length delimited.
|
|
1603
|
+
* @function decodeDelimited
|
|
1604
|
+
* @memberof google.protobuf.Any
|
|
1605
|
+
* @static
|
|
1606
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
1607
|
+
* @returns {google.protobuf.Any} Any
|
|
1608
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
1609
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
1610
|
+
*/
|
|
1611
|
+
Any.decodeDelimited = function decodeDelimited(reader) {
|
|
1612
|
+
if (!(reader instanceof $Reader)) reader = new $Reader(reader);
|
|
1613
|
+
return this.decode(reader, reader.uint32());
|
|
1614
|
+
};
|
|
1615
|
+
|
|
1616
|
+
/**
|
|
1617
|
+
* Verifies an Any message.
|
|
1618
|
+
* @function verify
|
|
1619
|
+
* @memberof google.protobuf.Any
|
|
1620
|
+
* @static
|
|
1621
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
1622
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
1623
|
+
*/
|
|
1624
|
+
Any.verify = function verify(message) {
|
|
1625
|
+
if (typeof message !== "object" || message === null)
|
|
1626
|
+
return "object expected";
|
|
1627
|
+
if (message.type_url != null && message.hasOwnProperty("type_url"))
|
|
1628
|
+
if (!$util.isString(message.type_url))
|
|
1629
|
+
return "type_url: string expected";
|
|
1630
|
+
if (message.value != null && message.hasOwnProperty("value"))
|
|
1631
|
+
if (
|
|
1632
|
+
!(
|
|
1633
|
+
(message.value && typeof message.value.length === "number") ||
|
|
1634
|
+
$util.isString(message.value)
|
|
1635
|
+
)
|
|
1636
|
+
)
|
|
1637
|
+
return "value: buffer expected";
|
|
1638
|
+
return null;
|
|
1639
|
+
};
|
|
1640
|
+
|
|
1641
|
+
/**
|
|
1642
|
+
* Creates an Any message from a plain object. Also converts values to their respective internal types.
|
|
1643
|
+
* @function fromObject
|
|
1644
|
+
* @memberof google.protobuf.Any
|
|
1645
|
+
* @static
|
|
1646
|
+
* @param {Object.<string,*>} object Plain object
|
|
1647
|
+
* @returns {google.protobuf.Any} Any
|
|
1648
|
+
*/
|
|
1649
|
+
Any.fromObject = function fromObject(object) {
|
|
1650
|
+
if (object instanceof $root.google.protobuf.Any) return object;
|
|
1651
|
+
var message = new $root.google.protobuf.Any();
|
|
1652
|
+
if (object.type_url != null)
|
|
1653
|
+
message.type_url = String(object.type_url);
|
|
1654
|
+
if (object.value != null)
|
|
1655
|
+
if (typeof object.value === "string")
|
|
1656
|
+
$util.base64.decode(
|
|
1657
|
+
object.value,
|
|
1658
|
+
(message.value = $util.newBuffer(
|
|
1659
|
+
$util.base64.length(object.value)
|
|
1660
|
+
)),
|
|
1661
|
+
0
|
|
1662
|
+
);
|
|
1663
|
+
else if (object.value.length >= 0) message.value = object.value;
|
|
1664
|
+
return message;
|
|
1665
|
+
};
|
|
1666
|
+
|
|
1667
|
+
/**
|
|
1668
|
+
* Creates a plain object from an Any message. Also converts values to other types if specified.
|
|
1669
|
+
* @function toObject
|
|
1670
|
+
* @memberof google.protobuf.Any
|
|
1671
|
+
* @static
|
|
1672
|
+
* @param {google.protobuf.Any} message Any
|
|
1673
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
1674
|
+
* @returns {Object.<string,*>} Plain object
|
|
1675
|
+
*/
|
|
1676
|
+
Any.toObject = function toObject(message, options) {
|
|
1677
|
+
if (!options) options = {};
|
|
1678
|
+
var object = {};
|
|
1679
|
+
if (options.defaults) {
|
|
1680
|
+
object.type_url = "";
|
|
1681
|
+
if (options.bytes === String) object.value = "";
|
|
1682
|
+
else {
|
|
1683
|
+
object.value = [];
|
|
1684
|
+
if (options.bytes !== Array)
|
|
1685
|
+
object.value = $util.newBuffer(object.value);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
if (message.type_url != null && message.hasOwnProperty("type_url"))
|
|
1689
|
+
object.type_url = message.type_url;
|
|
1690
|
+
if (message.value != null && message.hasOwnProperty("value"))
|
|
1691
|
+
object.value =
|
|
1692
|
+
options.bytes === String
|
|
1693
|
+
? $util.base64.encode(message.value, 0, message.value.length)
|
|
1694
|
+
: options.bytes === Array
|
|
1695
|
+
? Array.prototype.slice.call(message.value)
|
|
1696
|
+
: message.value;
|
|
1697
|
+
return object;
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
/**
|
|
1701
|
+
* Converts this Any to JSON.
|
|
1702
|
+
* @function toJSON
|
|
1703
|
+
* @memberof google.protobuf.Any
|
|
1704
|
+
* @instance
|
|
1705
|
+
* @returns {Object.<string,*>} JSON object
|
|
1706
|
+
*/
|
|
1707
|
+
Any.prototype.toJSON = function toJSON() {
|
|
1708
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
1709
|
+
};
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
* Gets the default type url for Any
|
|
1713
|
+
* @function getTypeUrl
|
|
1714
|
+
* @memberof google.protobuf.Any
|
|
1715
|
+
* @static
|
|
1716
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
1717
|
+
* @returns {string} The default type url
|
|
1718
|
+
*/
|
|
1719
|
+
Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
1720
|
+
if (typeUrlPrefix === undefined) {
|
|
1721
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
1722
|
+
}
|
|
1723
|
+
return typeUrlPrefix + "/google.protobuf.Any";
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1726
|
+
return Any;
|
|
1727
|
+
})();
|
|
1728
|
+
|
|
1729
|
+
return protobuf;
|
|
1730
|
+
})();
|
|
1731
|
+
|
|
1732
|
+
return google;
|
|
1733
|
+
})();
|
|
1734
|
+
|
|
1735
|
+
return $root;
|
|
1736
|
+
});
|