@bitgo-beta/sdk-coin-icp 1.0.1-beta.84 → 1.0.1-beta.841

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