@swapkit/toolboxes 1.0.0-beta.0 → 1.0.0-beta.10

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 (103) hide show
  1. package/dist/chunk-0f0249b1.js +3 -0
  2. package/dist/chunk-0f0249b1.js.map +10 -0
  3. package/dist/chunk-0h4xdrwz.js +4 -0
  4. package/dist/chunk-0h4xdrwz.js.map +10 -0
  5. package/dist/chunk-4yap1fvd.js +3 -0
  6. package/dist/chunk-4yap1fvd.js.map +10 -0
  7. package/dist/chunk-fjfxga2v.js +3 -0
  8. package/dist/chunk-fjfxga2v.js.map +10 -0
  9. package/dist/{chunk-tvrdndbw.js → chunk-p1kdg37m.js} +2 -2
  10. package/dist/{chunk-tvrdndbw.js.map → chunk-p1kdg37m.js.map} +1 -1
  11. package/dist/cosmos/index.cjs +2 -2
  12. package/dist/cosmos/index.cjs.map +10 -13
  13. package/dist/cosmos/index.js +2 -2
  14. package/dist/cosmos/index.js.map +10 -13
  15. package/dist/evm/index.cjs +2 -2
  16. package/dist/evm/index.cjs.map +10 -16
  17. package/dist/evm/index.js +2 -2
  18. package/dist/evm/index.js.map +10 -16
  19. package/dist/index.cjs +2 -2
  20. package/dist/index.cjs.map +4 -3
  21. package/dist/index.js +2 -2
  22. package/dist/index.js.map +4 -3
  23. package/dist/radix/index.cjs +2 -2
  24. package/dist/radix/index.cjs.map +3 -3
  25. package/dist/radix/index.js +2 -2
  26. package/dist/radix/index.js.map +3 -3
  27. package/dist/ripple/index.cjs +3 -0
  28. package/dist/ripple/index.cjs.map +10 -0
  29. package/dist/ripple/index.js +3 -0
  30. package/dist/ripple/index.js.map +10 -0
  31. package/dist/solana/index.cjs +2 -2
  32. package/dist/solana/index.cjs.map +3 -3
  33. package/dist/solana/index.js +2 -2
  34. package/dist/solana/index.js.map +3 -3
  35. package/dist/substrate/index.cjs +2 -2
  36. package/dist/substrate/index.cjs.map +5 -6
  37. package/dist/substrate/index.js +2 -2
  38. package/dist/substrate/index.js.map +5 -6
  39. package/dist/utxo/index.cjs +2 -2
  40. package/dist/utxo/index.cjs.map +9 -11
  41. package/dist/utxo/index.js +2 -2
  42. package/dist/utxo/index.js.map +9 -11
  43. package/package.json +27 -23
  44. package/src/cosmos/index.ts +2 -9
  45. package/src/cosmos/thorchainUtils/addressFormat.ts +1 -2
  46. package/src/cosmos/thorchainUtils/index.ts +1 -1
  47. package/src/cosmos/thorchainUtils/messages.ts +74 -56
  48. package/src/cosmos/thorchainUtils/registry.ts +19 -26
  49. package/src/cosmos/thorchainUtils/types/{proto/MsgCompiled.ts → MsgCompiled.ts} +1 -3
  50. package/src/cosmos/thorchainUtils/types/client-types.ts +16 -23
  51. package/src/cosmos/toolbox/cosmos.ts +334 -0
  52. package/src/cosmos/toolbox/index.ts +33 -0
  53. package/src/cosmos/toolbox/thorchain.ts +125 -137
  54. package/src/cosmos/types.ts +37 -18
  55. package/src/cosmos/util.ts +24 -74
  56. package/src/evm/__tests__/ethereum.test.ts +110 -116
  57. package/src/evm/api.ts +11 -147
  58. package/src/evm/helpers.ts +111 -83
  59. package/src/evm/index.ts +1 -17
  60. package/src/evm/toolbox/baseEVMToolbox.ts +744 -0
  61. package/src/evm/toolbox/evm.ts +69 -0
  62. package/src/evm/toolbox/index.ts +36 -0
  63. package/src/evm/toolbox/op.ts +97 -143
  64. package/src/evm/types.ts +50 -28
  65. package/src/index.ts +235 -0
  66. package/src/radix/index.ts +18 -19
  67. package/src/ripple/index.ts +199 -0
  68. package/src/solana/index.ts +11 -5
  69. package/src/solana/toolbox.ts +227 -137
  70. package/src/substrate/index.ts +2 -3
  71. package/src/substrate/{toolbox/baseSubstrateToolbox.ts → substrate.ts} +104 -72
  72. package/src/substrate/types.ts +120 -0
  73. package/src/utils.ts +27 -0
  74. package/src/utxo/helpers/api.ts +27 -23
  75. package/src/utxo/helpers/bchaddrjs.ts +21 -21
  76. package/src/utxo/helpers/index.ts +0 -1
  77. package/src/utxo/helpers/txSize.ts +3 -4
  78. package/src/utxo/index.ts +3 -7
  79. package/src/utxo/toolbox/bitcoinCash.ts +165 -155
  80. package/src/utxo/toolbox/index.ts +63 -24
  81. package/src/utxo/toolbox/utxo.ts +376 -229
  82. package/src/utxo/types.ts +26 -39
  83. package/src/cosmos/thorchainUtils/types/proto/MsgCompiled.js +0 -2806
  84. package/src/cosmos/thorchainUtils/util.ts +0 -46
  85. package/src/cosmos/toolbox/BaseCosmosToolbox.ts +0 -254
  86. package/src/cosmos/toolbox/gaia.ts +0 -39
  87. package/src/cosmos/toolbox/getToolboxByChain.ts +0 -29
  88. package/src/cosmos/toolbox/kujira.ts +0 -61
  89. package/src/evm/provider.ts +0 -6
  90. package/src/evm/toolbox/EVMToolbox.ts +0 -662
  91. package/src/evm/toolbox/arb.ts +0 -61
  92. package/src/evm/toolbox/avax.ts +0 -36
  93. package/src/evm/toolbox/base.ts +0 -42
  94. package/src/evm/toolbox/bsc.ts +0 -34
  95. package/src/evm/toolbox/eth.ts +0 -44
  96. package/src/evm/toolbox/getToolboxByChain.ts +0 -42
  97. package/src/evm/toolbox/matic.ts +0 -42
  98. package/src/radix/toolbox.ts +0 -693
  99. package/src/substrate/toolbox/index.ts +0 -40
  100. package/src/substrate/types/index.ts +0 -2
  101. package/src/substrate/types/network.ts +0 -42
  102. package/src/substrate/types/wallet.ts +0 -78
  103. package/src/utxo/helpers/utils.ts +0 -45
@@ -1,2806 +0,0 @@
1
- // @ts-nocheck
2
- import $protobuf from "protobufjs/minimal";
3
-
4
- // Common aliases
5
- const $Reader = $protobuf.Reader;
6
- const $Writer = $protobuf.Writer;
7
- const $util = $protobuf.util;
8
-
9
- // Exported root namespace
10
- const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
11
-
12
- $root.common = (() => {
13
- /**
14
- * Namespace common.
15
- * @exports common
16
- * @namespace
17
- */
18
- const common = {};
19
-
20
- common.Asset = (() => {
21
- /**
22
- * Properties of an Asset.
23
- * @memberof common
24
- * @interface IAsset
25
- * @property {string|null} [chain] Asset chain
26
- * @property {string|null} [symbol] Asset symbol
27
- * @property {string|null} [ticker] Asset ticker
28
- * @property {boolean|null} [synth] Asset synth
29
- */
30
-
31
- /**
32
- * Constructs a new Asset.
33
- * @memberof common
34
- * @classdesc Represents an Asset.
35
- * @implements IAsset
36
- * @constructor
37
- * @param {common.IAsset=} [properties] Properties to set
38
- */
39
- function Asset(properties) {
40
- if (properties)
41
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
42
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
43
- }
44
-
45
- /**
46
- * Asset chain.
47
- * @member {string} chain
48
- * @memberof common.Asset
49
- * @instance
50
- */
51
- Asset.prototype.chain = "";
52
-
53
- /**
54
- * Asset symbol.
55
- * @member {string} symbol
56
- * @memberof common.Asset
57
- * @instance
58
- */
59
- Asset.prototype.symbol = "";
60
-
61
- /**
62
- * Asset ticker.
63
- * @member {string} ticker
64
- * @memberof common.Asset
65
- * @instance
66
- */
67
- Asset.prototype.ticker = "";
68
-
69
- /**
70
- * Asset synth.
71
- * @member {boolean} synth
72
- * @memberof common.Asset
73
- * @instance
74
- */
75
- Asset.prototype.synth = false;
76
-
77
- /**
78
- * Creates a new Asset instance using the specified properties.
79
- * @function create
80
- * @memberof common.Asset
81
- * @static
82
- * @param {common.IAsset=} [properties] Properties to set
83
- * @returns {common.Asset} Asset instance
84
- */
85
- Asset.create = function create(properties) {
86
- return new Asset(properties);
87
- };
88
-
89
- /**
90
- * Encodes the specified Asset message. Does not implicitly {@link common.Asset.verify|verify} messages.
91
- * @function encode
92
- * @memberof common.Asset
93
- * @static
94
- * @param {common.IAsset} message Asset message or plain object to encode
95
- * @param {$protobuf.Writer} [writer] Writer to encode to
96
- * @returns {$protobuf.Writer} Writer
97
- */
98
- Asset.encode = function encode(message, writer) {
99
- if (!writer) writer = $Writer.create();
100
- if (message.chain != null && Object.hasOwnProperty.call(message, "chain"))
101
- writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.chain);
102
- if (message.symbol != null && Object.hasOwnProperty.call(message, "symbol"))
103
- writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.symbol);
104
- if (message.ticker != null && Object.hasOwnProperty.call(message, "ticker"))
105
- writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.ticker);
106
- if (message.synth != null && Object.hasOwnProperty.call(message, "synth"))
107
- writer.uint32(/* id 4, wireType 0 =*/ 32).bool(message.synth);
108
- return writer;
109
- };
110
-
111
- /**
112
- * Encodes the specified Asset message, length delimited. Does not implicitly {@link common.Asset.verify|verify} messages.
113
- * @function encodeDelimited
114
- * @memberof common.Asset
115
- * @static
116
- * @param {common.IAsset} message Asset message or plain object to encode
117
- * @param {$protobuf.Writer} [writer] Writer to encode to
118
- * @returns {$protobuf.Writer} Writer
119
- */
120
- Asset.encodeDelimited = function encodeDelimited(message, writer) {
121
- return this.encode(message, writer).ldelim();
122
- };
123
-
124
- /**
125
- * Decodes an Asset message from the specified reader or buffer.
126
- * @function decode
127
- * @memberof common.Asset
128
- * @static
129
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
130
- * @param {number} [length] Message length if known beforehand
131
- * @returns {common.Asset} Asset
132
- * @throws {Error} If the payload is not a reader or valid buffer
133
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
134
- */
135
- Asset.decode = function decode(reader, length) {
136
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
137
- const end = length === undefined ? reader.len : reader.pos + length,
138
- message = new $root.common.Asset();
139
- while (reader.pos < end) {
140
- const tag = reader.uint32();
141
- switch (tag >>> 3) {
142
- case 1:
143
- message.chain = reader.string();
144
- break;
145
- case 2:
146
- message.symbol = reader.string();
147
- break;
148
- case 3:
149
- message.ticker = reader.string();
150
- break;
151
- case 4:
152
- message.synth = reader.bool();
153
- break;
154
- default:
155
- reader.skipType(tag & 7);
156
- break;
157
- }
158
- }
159
- return message;
160
- };
161
-
162
- /**
163
- * Decodes an Asset message from the specified reader or buffer, length delimited.
164
- * @function decodeDelimited
165
- * @memberof common.Asset
166
- * @static
167
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
168
- * @returns {common.Asset} Asset
169
- * @throws {Error} If the payload is not a reader or valid buffer
170
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
171
- */
172
- Asset.decodeDelimited = function decodeDelimited(reader) {
173
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
174
- return this.decode(reader, reader.uint32());
175
- };
176
-
177
- /**
178
- * Verifies an Asset message.
179
- * @function verify
180
- * @memberof common.Asset
181
- * @static
182
- * @param {Object.<string,*>} message Plain object to verify
183
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
184
- */
185
- Asset.verify = function verify(message) {
186
- if (typeof message !== "object" || message === null) return "object expected";
187
- if (message.chain != null && message.hasOwnProperty("chain"))
188
- if (!$util.isString(message.chain)) return "chain: string expected";
189
- if (message.symbol != null && message.hasOwnProperty("symbol"))
190
- if (!$util.isString(message.symbol)) return "symbol: string expected";
191
- if (message.ticker != null && message.hasOwnProperty("ticker"))
192
- if (!$util.isString(message.ticker)) return "ticker: string expected";
193
- if (message.synth != null && message.hasOwnProperty("synth"))
194
- if (typeof message.synth !== "boolean") return "synth: boolean expected";
195
- return null;
196
- };
197
-
198
- /**
199
- * Creates an Asset message from a plain object. Also converts values to their respective internal types.
200
- * @function fromObject
201
- * @memberof common.Asset
202
- * @static
203
- * @param {Object.<string,*>} object Plain object
204
- * @returns {common.Asset} Asset
205
- */
206
- Asset.fromObject = function fromObject(object) {
207
- if (object instanceof $root.common.Asset) return object;
208
- const message = new $root.common.Asset();
209
- if (object.chain != null) message.chain = String(object.chain);
210
- if (object.symbol != null) message.symbol = String(object.symbol);
211
- if (object.ticker != null) message.ticker = String(object.ticker);
212
- if (object.synth != null) message.synth = Boolean(object.synth);
213
- return message;
214
- };
215
-
216
- /**
217
- * Creates a plain object from an Asset message. Also converts values to other types if specified.
218
- * @function toObject
219
- * @memberof common.Asset
220
- * @static
221
- * @param {common.Asset} message Asset
222
- * @param {$protobuf.IConversionOptions} [options] Conversion options
223
- * @returns {Object.<string,*>} Plain object
224
- */
225
- Asset.toObject = function toObject(message, options) {
226
- if (!options) options = {};
227
- const object = {};
228
- if (options.defaults) {
229
- object.chain = "";
230
- object.symbol = "";
231
- object.ticker = "";
232
- object.synth = false;
233
- }
234
- if (message.chain != null && message.hasOwnProperty("chain")) object.chain = message.chain;
235
- if (message.symbol != null && message.hasOwnProperty("symbol"))
236
- object.symbol = message.symbol;
237
- if (message.ticker != null && message.hasOwnProperty("ticker"))
238
- object.ticker = message.ticker;
239
- if (message.synth != null && message.hasOwnProperty("synth")) object.synth = message.synth;
240
- return object;
241
- };
242
-
243
- /**
244
- * Converts this Asset to JSON.
245
- * @function toJSON
246
- * @memberof common.Asset
247
- * @instance
248
- * @returns {Object.<string,*>} JSON object
249
- */
250
- Asset.prototype.toJSON = function toJSON() {
251
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
252
- };
253
-
254
- return Asset;
255
- })();
256
-
257
- common.Coin = (() => {
258
- /**
259
- * Properties of a Coin.
260
- * @memberof common
261
- * @interface ICoin
262
- * @property {common.IAsset|null} [asset] Coin asset
263
- * @property {string|null} [amount] Coin amount
264
- * @property {number|Long|null} [decimals] Coin decimals
265
- */
266
-
267
- /**
268
- * Constructs a new Coin.
269
- * @memberof common
270
- * @classdesc Represents a Coin.
271
- * @implements ICoin
272
- * @constructor
273
- * @param {common.ICoin=} [properties] Properties to set
274
- */
275
- function Coin(properties) {
276
- if (properties)
277
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
278
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
279
- }
280
-
281
- /**
282
- * Coin asset.
283
- * @member {common.IAsset|null|undefined} asset
284
- * @memberof common.Coin
285
- * @instance
286
- */
287
- Coin.prototype.asset = null;
288
-
289
- /**
290
- * Coin amount.
291
- * @member {string} amount
292
- * @memberof common.Coin
293
- * @instance
294
- */
295
- Coin.prototype.amount = "";
296
-
297
- /**
298
- * Coin decimals.
299
- * @member {number|Long} decimals
300
- * @memberof common.Coin
301
- * @instance
302
- */
303
- Coin.prototype.decimals = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
304
-
305
- /**
306
- * Creates a new Coin instance using the specified properties.
307
- * @function create
308
- * @memberof common.Coin
309
- * @static
310
- * @param {common.ICoin=} [properties] Properties to set
311
- * @returns {common.Coin} Coin instance
312
- */
313
- Coin.create = function create(properties) {
314
- return new Coin(properties);
315
- };
316
-
317
- /**
318
- * Encodes the specified Coin message. Does not implicitly {@link common.Coin.verify|verify} messages.
319
- * @function encode
320
- * @memberof common.Coin
321
- * @static
322
- * @param {common.ICoin} message Coin message or plain object to encode
323
- * @param {$protobuf.Writer} [writer] Writer to encode to
324
- * @returns {$protobuf.Writer} Writer
325
- */
326
- Coin.encode = function encode(message, writer) {
327
- if (!writer) writer = $Writer.create();
328
- if (message.asset != null && Object.hasOwnProperty.call(message, "asset"))
329
- $root.common.Asset.encode(
330
- message.asset,
331
- writer.uint32(/* id 1, wireType 2 =*/ 10).fork(),
332
- ).ldelim();
333
- if (message.amount != null && Object.hasOwnProperty.call(message, "amount"))
334
- writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.amount);
335
- if (message.decimals != null && Object.hasOwnProperty.call(message, "decimals"))
336
- writer.uint32(/* id 3, wireType 0 =*/ 24).int64(message.decimals);
337
- return writer;
338
- };
339
-
340
- /**
341
- * Encodes the specified Coin message, length delimited. Does not implicitly {@link common.Coin.verify|verify} messages.
342
- * @function encodeDelimited
343
- * @memberof common.Coin
344
- * @static
345
- * @param {common.ICoin} message Coin message or plain object to encode
346
- * @param {$protobuf.Writer} [writer] Writer to encode to
347
- * @returns {$protobuf.Writer} Writer
348
- */
349
- Coin.encodeDelimited = function encodeDelimited(message, writer) {
350
- return this.encode(message, writer).ldelim();
351
- };
352
-
353
- /**
354
- * Decodes a Coin message from the specified reader or buffer.
355
- * @function decode
356
- * @memberof common.Coin
357
- * @static
358
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
359
- * @param {number} [length] Message length if known beforehand
360
- * @returns {common.Coin} Coin
361
- * @throws {Error} If the payload is not a reader or valid buffer
362
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
363
- */
364
- Coin.decode = function decode(reader, length) {
365
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
366
- const end = length === undefined ? reader.len : reader.pos + length,
367
- message = new $root.common.Coin();
368
- while (reader.pos < end) {
369
- const tag = reader.uint32();
370
- switch (tag >>> 3) {
371
- case 1:
372
- message.asset = $root.common.Asset.decode(reader, reader.uint32());
373
- break;
374
- case 2:
375
- message.amount = reader.string();
376
- break;
377
- case 3:
378
- message.decimals = reader.int64();
379
- break;
380
- default:
381
- reader.skipType(tag & 7);
382
- break;
383
- }
384
- }
385
- return message;
386
- };
387
-
388
- /**
389
- * Decodes a Coin message from the specified reader or buffer, length delimited.
390
- * @function decodeDelimited
391
- * @memberof common.Coin
392
- * @static
393
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
394
- * @returns {common.Coin} Coin
395
- * @throws {Error} If the payload is not a reader or valid buffer
396
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
397
- */
398
- Coin.decodeDelimited = function decodeDelimited(reader) {
399
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
400
- return this.decode(reader, reader.uint32());
401
- };
402
-
403
- /**
404
- * Verifies a Coin message.
405
- * @function verify
406
- * @memberof common.Coin
407
- * @static
408
- * @param {Object.<string,*>} message Plain object to verify
409
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
410
- */
411
- Coin.verify = function verify(message) {
412
- if (typeof message !== "object" || message === null) return "object expected";
413
- if (message.asset != null && message.hasOwnProperty("asset")) {
414
- const error = $root.common.Asset.verify(message.asset);
415
- if (error) return "asset." + error;
416
- }
417
- if (message.amount != null && message.hasOwnProperty("amount"))
418
- if (!$util.isString(message.amount)) return "amount: string expected";
419
- if (message.decimals != null && message.hasOwnProperty("decimals"))
420
- if (
421
- !$util.isInteger(message.decimals) &&
422
- !(
423
- message.decimals &&
424
- $util.isInteger(message.decimals.low) &&
425
- $util.isInteger(message.decimals.high)
426
- )
427
- )
428
- return "decimals: integer|Long expected";
429
- return null;
430
- };
431
-
432
- /**
433
- * Creates a Coin message from a plain object. Also converts values to their respective internal types.
434
- * @function fromObject
435
- * @memberof common.Coin
436
- * @static
437
- * @param {Object.<string,*>} object Plain object
438
- * @returns {common.Coin} Coin
439
- */
440
- Coin.fromObject = function fromObject(object) {
441
- if (object instanceof $root.common.Coin) return object;
442
- const message = new $root.common.Coin();
443
- if (object.asset != null) {
444
- if (typeof object.asset !== "object")
445
- throw TypeError(".common.Coin.asset: object expected");
446
- message.asset = $root.common.Asset.fromObject(object.asset);
447
- }
448
- if (object.amount != null) message.amount = String(object.amount);
449
- if (object.decimals != null)
450
- if ($util.Long) (message.decimals = $util.Long.fromValue(object.decimals)).unsigned = false;
451
- else if (typeof object.decimals === "string")
452
- message.decimals = Number.parseInt(object.decimals, 10);
453
- else if (typeof object.decimals === "number") message.decimals = object.decimals;
454
- else if (typeof object.decimals === "object")
455
- message.decimals = new $util.LongBits(
456
- object.decimals.low >>> 0,
457
- object.decimals.high >>> 0,
458
- ).toNumber();
459
- return message;
460
- };
461
-
462
- /**
463
- * Creates a plain object from a Coin message. Also converts values to other types if specified.
464
- * @function toObject
465
- * @memberof common.Coin
466
- * @static
467
- * @param {common.Coin} message Coin
468
- * @param {$protobuf.IConversionOptions} [options] Conversion options
469
- * @returns {Object.<string,*>} Plain object
470
- */
471
- Coin.toObject = function toObject(message, options) {
472
- if (!options) options = {};
473
- const object = {};
474
- if (options.defaults) {
475
- object.asset = null;
476
- object.amount = "";
477
- if ($util.Long) {
478
- const long = new $util.Long(0, 0, false);
479
- object.decimals =
480
- options.longs === String
481
- ? long.toString()
482
- : options.longs === Number
483
- ? long.toNumber()
484
- : long;
485
- } else object.decimals = options.longs === String ? "0" : 0;
486
- }
487
- if (message.asset != null && message.hasOwnProperty("asset"))
488
- object.asset = $root.common.Asset.toObject(message.asset, options);
489
- if (message.amount != null && message.hasOwnProperty("amount"))
490
- object.amount = message.amount;
491
- if (message.decimals != null && message.hasOwnProperty("decimals"))
492
- if (typeof message.decimals === "number")
493
- object.decimals = options.longs === String ? String(message.decimals) : message.decimals;
494
- else
495
- object.decimals =
496
- options.longs === String
497
- ? $util.Long.prototype.toString.call(message.decimals)
498
- : options.longs === Number
499
- ? new $util.LongBits(
500
- message.decimals.low >>> 0,
501
- message.decimals.high >>> 0,
502
- ).toNumber()
503
- : message.decimals;
504
- return object;
505
- };
506
-
507
- /**
508
- * Converts this Coin to JSON.
509
- * @function toJSON
510
- * @memberof common.Coin
511
- * @instance
512
- * @returns {Object.<string,*>} JSON object
513
- */
514
- Coin.prototype.toJSON = function toJSON() {
515
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
516
- };
517
-
518
- return Coin;
519
- })();
520
-
521
- common.PubKeySet = (() => {
522
- /**
523
- * Properties of a PubKeySet.
524
- * @memberof common
525
- * @interface IPubKeySet
526
- * @property {string|null} [secp256k1] PubKeySet secp256k1
527
- * @property {string|null} [ed25519] PubKeySet ed25519
528
- */
529
-
530
- /**
531
- * Constructs a new PubKeySet.
532
- * @memberof common
533
- * @classdesc Represents a PubKeySet.
534
- * @implements IPubKeySet
535
- * @constructor
536
- * @param {common.IPubKeySet=} [properties] Properties to set
537
- */
538
- function PubKeySet(properties) {
539
- if (properties)
540
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
541
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
542
- }
543
-
544
- /**
545
- * PubKeySet secp256k1.
546
- * @member {string} secp256k1
547
- * @memberof common.PubKeySet
548
- * @instance
549
- */
550
- PubKeySet.prototype.secp256k1 = "";
551
-
552
- /**
553
- * PubKeySet ed25519.
554
- * @member {string} ed25519
555
- * @memberof common.PubKeySet
556
- * @instance
557
- */
558
- PubKeySet.prototype.ed25519 = "";
559
-
560
- /**
561
- * Creates a new PubKeySet instance using the specified properties.
562
- * @function create
563
- * @memberof common.PubKeySet
564
- * @static
565
- * @param {common.IPubKeySet=} [properties] Properties to set
566
- * @returns {common.PubKeySet} PubKeySet instance
567
- */
568
- PubKeySet.create = function create(properties) {
569
- return new PubKeySet(properties);
570
- };
571
-
572
- /**
573
- * Encodes the specified PubKeySet message. Does not implicitly {@link common.PubKeySet.verify|verify} messages.
574
- * @function encode
575
- * @memberof common.PubKeySet
576
- * @static
577
- * @param {common.IPubKeySet} message PubKeySet message or plain object to encode
578
- * @param {$protobuf.Writer} [writer] Writer to encode to
579
- * @returns {$protobuf.Writer} Writer
580
- */
581
- PubKeySet.encode = function encode(message, writer) {
582
- if (!writer) writer = $Writer.create();
583
- if (message.secp256k1 != null && Object.hasOwnProperty.call(message, "secp256k1"))
584
- writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.secp256k1);
585
- if (message.ed25519 != null && Object.hasOwnProperty.call(message, "ed25519"))
586
- writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.ed25519);
587
- return writer;
588
- };
589
-
590
- /**
591
- * Encodes the specified PubKeySet message, length delimited. Does not implicitly {@link common.PubKeySet.verify|verify} messages.
592
- * @function encodeDelimited
593
- * @memberof common.PubKeySet
594
- * @static
595
- * @param {common.IPubKeySet} message PubKeySet message or plain object to encode
596
- * @param {$protobuf.Writer} [writer] Writer to encode to
597
- * @returns {$protobuf.Writer} Writer
598
- */
599
- PubKeySet.encodeDelimited = function encodeDelimited(message, writer) {
600
- return this.encode(message, writer).ldelim();
601
- };
602
-
603
- /**
604
- * Decodes a PubKeySet message from the specified reader or buffer.
605
- * @function decode
606
- * @memberof common.PubKeySet
607
- * @static
608
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
609
- * @param {number} [length] Message length if known beforehand
610
- * @returns {common.PubKeySet} PubKeySet
611
- * @throws {Error} If the payload is not a reader or valid buffer
612
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
613
- */
614
- PubKeySet.decode = function decode(reader, length) {
615
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
616
- const end = length === undefined ? reader.len : reader.pos + length,
617
- message = new $root.common.PubKeySet();
618
- while (reader.pos < end) {
619
- const tag = reader.uint32();
620
- switch (tag >>> 3) {
621
- case 1:
622
- message.secp256k1 = reader.string();
623
- break;
624
- case 2:
625
- message.ed25519 = reader.string();
626
- break;
627
- default:
628
- reader.skipType(tag & 7);
629
- break;
630
- }
631
- }
632
- return message;
633
- };
634
-
635
- /**
636
- * Decodes a PubKeySet message from the specified reader or buffer, length delimited.
637
- * @function decodeDelimited
638
- * @memberof common.PubKeySet
639
- * @static
640
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
641
- * @returns {common.PubKeySet} PubKeySet
642
- * @throws {Error} If the payload is not a reader or valid buffer
643
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
644
- */
645
- PubKeySet.decodeDelimited = function decodeDelimited(reader) {
646
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
647
- return this.decode(reader, reader.uint32());
648
- };
649
-
650
- /**
651
- * Verifies a PubKeySet message.
652
- * @function verify
653
- * @memberof common.PubKeySet
654
- * @static
655
- * @param {Object.<string,*>} message Plain object to verify
656
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
657
- */
658
- PubKeySet.verify = function verify(message) {
659
- if (typeof message !== "object" || message === null) return "object expected";
660
- if (message.secp256k1 != null && message.hasOwnProperty("secp256k1"))
661
- if (!$util.isString(message.secp256k1)) return "secp256k1: string expected";
662
- if (message.ed25519 != null && message.hasOwnProperty("ed25519"))
663
- if (!$util.isString(message.ed25519)) return "ed25519: string expected";
664
- return null;
665
- };
666
-
667
- /**
668
- * Creates a PubKeySet message from a plain object. Also converts values to their respective internal types.
669
- * @function fromObject
670
- * @memberof common.PubKeySet
671
- * @static
672
- * @param {Object.<string,*>} object Plain object
673
- * @returns {common.PubKeySet} PubKeySet
674
- */
675
- PubKeySet.fromObject = function fromObject(object) {
676
- if (object instanceof $root.common.PubKeySet) return object;
677
- const message = new $root.common.PubKeySet();
678
- if (object.secp256k1 != null) message.secp256k1 = String(object.secp256k1);
679
- if (object.ed25519 != null) message.ed25519 = String(object.ed25519);
680
- return message;
681
- };
682
-
683
- /**
684
- * Creates a plain object from a PubKeySet message. Also converts values to other types if specified.
685
- * @function toObject
686
- * @memberof common.PubKeySet
687
- * @static
688
- * @param {common.PubKeySet} message PubKeySet
689
- * @param {$protobuf.IConversionOptions} [options] Conversion options
690
- * @returns {Object.<string,*>} Plain object
691
- */
692
- PubKeySet.toObject = function toObject(message, options) {
693
- if (!options) options = {};
694
- const object = {};
695
- if (options.defaults) {
696
- object.secp256k1 = "";
697
- object.ed25519 = "";
698
- }
699
- if (message.secp256k1 != null && message.hasOwnProperty("secp256k1"))
700
- object.secp256k1 = message.secp256k1;
701
- if (message.ed25519 != null && message.hasOwnProperty("ed25519"))
702
- object.ed25519 = message.ed25519;
703
- return object;
704
- };
705
-
706
- /**
707
- * Converts this PubKeySet to JSON.
708
- * @function toJSON
709
- * @memberof common.PubKeySet
710
- * @instance
711
- * @returns {Object.<string,*>} JSON object
712
- */
713
- PubKeySet.prototype.toJSON = function toJSON() {
714
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
715
- };
716
-
717
- return PubKeySet;
718
- })();
719
-
720
- common.Tx = (() => {
721
- /**
722
- * Properties of a Tx.
723
- * @memberof common
724
- * @interface ITx
725
- * @property {string|null} [id] Tx id
726
- * @property {string|null} [chain] Tx chain
727
- * @property {string|null} [fromAddress] Tx fromAddress
728
- * @property {string|null} [toAddress] Tx toAddress
729
- * @property {Array.<common.ICoin>|null} [coins] Tx coins
730
- * @property {Array.<common.ICoin>|null} [gas] Tx gas
731
- * @property {string|null} [memo] Tx memo
732
- */
733
-
734
- /**
735
- * Constructs a new Tx.
736
- * @memberof common
737
- * @classdesc Represents a Tx.
738
- * @implements ITx
739
- * @constructor
740
- * @param {common.ITx=} [properties] Properties to set
741
- */
742
- function Tx(properties) {
743
- this.coins = [];
744
- this.gas = [];
745
- if (properties)
746
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
747
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
748
- }
749
-
750
- /**
751
- * Tx id.
752
- * @member {string} id
753
- * @memberof common.Tx
754
- * @instance
755
- */
756
- Tx.prototype.id = "";
757
-
758
- /**
759
- * Tx chain.
760
- * @member {string} chain
761
- * @memberof common.Tx
762
- * @instance
763
- */
764
- Tx.prototype.chain = "";
765
-
766
- /**
767
- * Tx fromAddress.
768
- * @member {string} fromAddress
769
- * @memberof common.Tx
770
- * @instance
771
- */
772
- Tx.prototype.fromAddress = "";
773
-
774
- /**
775
- * Tx toAddress.
776
- * @member {string} toAddress
777
- * @memberof common.Tx
778
- * @instance
779
- */
780
- Tx.prototype.toAddress = "";
781
-
782
- /**
783
- * Tx coins.
784
- * @member {Array.<common.ICoin>} coins
785
- * @memberof common.Tx
786
- * @instance
787
- */
788
- Tx.prototype.coins = $util.emptyArray;
789
-
790
- /**
791
- * Tx gas.
792
- * @member {Array.<common.ICoin>} gas
793
- * @memberof common.Tx
794
- * @instance
795
- */
796
- Tx.prototype.gas = $util.emptyArray;
797
-
798
- /**
799
- * Tx memo.
800
- * @member {string} memo
801
- * @memberof common.Tx
802
- * @instance
803
- */
804
- Tx.prototype.memo = "";
805
-
806
- /**
807
- * Creates a new Tx instance using the specified properties.
808
- * @function create
809
- * @memberof common.Tx
810
- * @static
811
- * @param {common.ITx=} [properties] Properties to set
812
- * @returns {common.Tx} Tx instance
813
- */
814
- Tx.create = function create(properties) {
815
- return new Tx(properties);
816
- };
817
-
818
- /**
819
- * Encodes the specified Tx message. Does not implicitly {@link common.Tx.verify|verify} messages.
820
- * @function encode
821
- * @memberof common.Tx
822
- * @static
823
- * @param {common.ITx} message Tx message or plain object to encode
824
- * @param {$protobuf.Writer} [writer] Writer to encode to
825
- * @returns {$protobuf.Writer} Writer
826
- */
827
- Tx.encode = function encode(message, writer) {
828
- if (!writer) writer = $Writer.create();
829
- if (message.id != null && Object.hasOwnProperty.call(message, "id"))
830
- writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.id);
831
- if (message.chain != null && Object.hasOwnProperty.call(message, "chain"))
832
- writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.chain);
833
- if (message.fromAddress != null && Object.hasOwnProperty.call(message, "fromAddress"))
834
- writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.fromAddress);
835
- if (message.toAddress != null && Object.hasOwnProperty.call(message, "toAddress"))
836
- writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.toAddress);
837
- if (message.coins?.length)
838
- for (let i = 0; i < message.coins.length; ++i)
839
- $root.common.Coin.encode(
840
- message.coins[i],
841
- writer.uint32(/* id 5, wireType 2 =*/ 42).fork(),
842
- ).ldelim();
843
- if (message.gas?.length)
844
- for (let j = 0; j < message.gas.length; ++j)
845
- $root.common.Coin.encode(
846
- message.gas[j],
847
- writer.uint32(/* id 6, wireType 2 =*/ 50).fork(),
848
- ).ldelim();
849
- if (message.memo != null && Object.hasOwnProperty.call(message, "memo"))
850
- writer.uint32(/* id 7, wireType 2 =*/ 58).string(message.memo);
851
- return writer;
852
- };
853
-
854
- /**
855
- * Encodes the specified Tx message, length delimited. Does not implicitly {@link common.Tx.verify|verify} messages.
856
- * @function encodeDelimited
857
- * @memberof common.Tx
858
- * @static
859
- * @param {common.ITx} message Tx message or plain object to encode
860
- * @param {$protobuf.Writer} [writer] Writer to encode to
861
- * @returns {$protobuf.Writer} Writer
862
- */
863
- Tx.encodeDelimited = function encodeDelimited(message, writer) {
864
- return this.encode(message, writer).ldelim();
865
- };
866
-
867
- /**
868
- * Decodes a Tx message from the specified reader or buffer.
869
- * @function decode
870
- * @memberof common.Tx
871
- * @static
872
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
873
- * @param {number} [length] Message length if known beforehand
874
- * @returns {common.Tx} Tx
875
- * @throws {Error} If the payload is not a reader or valid buffer
876
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
877
- */
878
- Tx.decode = function decode(reader, length) {
879
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
880
- const end = length === undefined ? reader.len : reader.pos + length,
881
- message = new $root.common.Tx();
882
- while (reader.pos < end) {
883
- const tag = reader.uint32();
884
- switch (tag >>> 3) {
885
- case 1:
886
- message.id = reader.string();
887
- break;
888
- case 2:
889
- message.chain = reader.string();
890
- break;
891
- case 3:
892
- message.fromAddress = reader.string();
893
- break;
894
- case 4:
895
- message.toAddress = reader.string();
896
- break;
897
- case 5:
898
- if (!message.coins?.length) message.coins = [];
899
- message.coins.push($root.common.Coin.decode(reader, reader.uint32()));
900
- break;
901
- case 6:
902
- if (!message.gas?.length) message.gas = [];
903
- message.gas.push($root.common.Coin.decode(reader, reader.uint32()));
904
- break;
905
- case 7:
906
- message.memo = reader.string();
907
- break;
908
- default:
909
- reader.skipType(tag & 7);
910
- break;
911
- }
912
- }
913
- return message;
914
- };
915
-
916
- /**
917
- * Decodes a Tx message from the specified reader or buffer, length delimited.
918
- * @function decodeDelimited
919
- * @memberof common.Tx
920
- * @static
921
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
922
- * @returns {common.Tx} Tx
923
- * @throws {Error} If the payload is not a reader or valid buffer
924
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
925
- */
926
- Tx.decodeDelimited = function decodeDelimited(reader) {
927
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
928
- return this.decode(reader, reader.uint32());
929
- };
930
-
931
- /**
932
- * Verifies a Tx message.
933
- * @function verify
934
- * @memberof common.Tx
935
- * @static
936
- * @param {Object.<string,*>} message Plain object to verify
937
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
938
- */
939
- Tx.verify = function verify(message) {
940
- if (typeof message !== "object" || message === null) return "object expected";
941
- if (message.id != null && message.hasOwnProperty("id"))
942
- if (!$util.isString(message.id)) return "id: string expected";
943
- if (message.chain != null && message.hasOwnProperty("chain"))
944
- if (!$util.isString(message.chain)) return "chain: string expected";
945
- if (message.fromAddress != null && message.hasOwnProperty("fromAddress"))
946
- if (!$util.isString(message.fromAddress)) return "fromAddress: string expected";
947
- if (message.toAddress != null && message.hasOwnProperty("toAddress"))
948
- if (!$util.isString(message.toAddress)) return "toAddress: string expected";
949
- if (message.coins != null && message.hasOwnProperty("coins")) {
950
- if (!Array.isArray(message.coins)) return "coins: array expected";
951
-
952
- for (let i = 0; i < message.coins.length; ++i) {
953
- const error = $root.common.Coin.verify(message.coins[i]);
954
- if (error) return "coins." + error;
955
- }
956
- }
957
- if (message.gas != null && message.hasOwnProperty("gas")) {
958
- if (!Array.isArray(message.gas)) return "gas: array expected";
959
-
960
- for (let j = 0; j < message.gas.length; ++j) {
961
- const error = $root.common.Coin.verify(message.gas[j]);
962
- if (error) return "gas." + error;
963
- }
964
- }
965
- if (message.memo != null && message.hasOwnProperty("memo"))
966
- if (!$util.isString(message.memo)) return "memo: string expected";
967
- return null;
968
- };
969
-
970
- /**
971
- * Creates a Tx message from a plain object. Also converts values to their respective internal types.
972
- * @function fromObject
973
- * @memberof common.Tx
974
- * @static
975
- * @param {Object.<string,*>} object Plain object
976
- * @returns {common.Tx} Tx
977
- */
978
- Tx.fromObject = function fromObject(object) {
979
- if (object instanceof $root.common.Tx) return object;
980
- const message = new $root.common.Tx();
981
- if (object.id != null) message.id = String(object.id);
982
- if (object.chain != null) message.chain = String(object.chain);
983
- if (object.fromAddress != null) message.fromAddress = String(object.fromAddress);
984
- if (object.toAddress != null) message.toAddress = String(object.toAddress);
985
- if (object.coins) {
986
- if (!Array.isArray(object.coins)) throw TypeError(".common.Tx.coins: array expected");
987
- message.coins = [];
988
- for (let i = 0; i < object.coins.length; ++i) {
989
- if (typeof object.coins[i] !== "object")
990
- throw TypeError(".common.Tx.coins: object expected");
991
- message.coins[i] = $root.common.Coin.fromObject(object.coins[i]);
992
- }
993
- }
994
- if (object.gas) {
995
- if (!Array.isArray(object.gas)) throw TypeError(".common.Tx.gas: array expected");
996
- message.gas = [];
997
- for (let i = 0; i < object.gas.length; ++i) {
998
- if (typeof object.gas[i] !== "object") throw TypeError(".common.Tx.gas: object expected");
999
- message.gas[i] = $root.common.Coin.fromObject(object.gas[i]);
1000
- }
1001
- }
1002
- if (object.memo != null) message.memo = String(object.memo);
1003
- return message;
1004
- };
1005
-
1006
- /**
1007
- * Creates a plain object from a Tx message. Also converts values to other types if specified.
1008
- * @function toObject
1009
- * @memberof common.Tx
1010
- * @static
1011
- * @param {common.Tx} message Tx
1012
- * @param {$protobuf.IConversionOptions} [options] Conversion options
1013
- * @returns {Object.<string,*>} Plain object
1014
- */
1015
- Tx.toObject = function toObject(message, options) {
1016
- if (!options) options = {};
1017
- const object = {};
1018
- if (options.arrays || options.defaults) {
1019
- object.coins = [];
1020
- object.gas = [];
1021
- }
1022
- if (options.defaults) {
1023
- object.id = "";
1024
- object.chain = "";
1025
- object.fromAddress = "";
1026
- object.toAddress = "";
1027
- object.memo = "";
1028
- }
1029
- if (message.id != null && message.hasOwnProperty("id")) object.id = message.id;
1030
- if (message.chain != null && message.hasOwnProperty("chain")) object.chain = message.chain;
1031
- if (message.fromAddress != null && message.hasOwnProperty("fromAddress"))
1032
- object.fromAddress = message.fromAddress;
1033
- if (message.toAddress != null && message.hasOwnProperty("toAddress"))
1034
- object.toAddress = message.toAddress;
1035
- if (message.coins?.length) {
1036
- object.coins = [];
1037
- for (let j = 0; j < message.coins.length; ++j)
1038
- object.coins[j] = $root.common.Coin.toObject(message.coins[j], options);
1039
- }
1040
- if (message.gas?.length) {
1041
- object.gas = [];
1042
- for (let j = 0; j < message.gas.length; ++j)
1043
- object.gas[j] = $root.common.Coin.toObject(message.gas[j], options);
1044
- }
1045
- if (message.memo != null && message.hasOwnProperty("memo")) object.memo = message.memo;
1046
- return object;
1047
- };
1048
-
1049
- /**
1050
- * Converts this Tx to JSON.
1051
- * @function toJSON
1052
- * @memberof common.Tx
1053
- * @instance
1054
- * @returns {Object.<string,*>} JSON object
1055
- */
1056
- Tx.prototype.toJSON = function toJSON() {
1057
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1058
- };
1059
-
1060
- return Tx;
1061
- })();
1062
-
1063
- common.Fee = (() => {
1064
- /**
1065
- * Properties of a Fee.
1066
- * @memberof common
1067
- * @interface IFee
1068
- * @property {Array.<common.ICoin>|null} [coins] Fee coins
1069
- * @property {string|null} [poolDeduct] Fee poolDeduct
1070
- */
1071
-
1072
- /**
1073
- * Constructs a new Fee.
1074
- * @memberof common
1075
- * @classdesc Represents a Fee.
1076
- * @implements IFee
1077
- * @constructor
1078
- * @param {common.IFee=} [properties] Properties to set
1079
- */
1080
- function Fee(properties) {
1081
- this.coins = [];
1082
- if (properties)
1083
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1084
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
1085
- }
1086
-
1087
- /**
1088
- * Fee coins.
1089
- * @member {Array.<common.ICoin>} coins
1090
- * @memberof common.Fee
1091
- * @instance
1092
- */
1093
- Fee.prototype.coins = $util.emptyArray;
1094
-
1095
- /**
1096
- * Fee poolDeduct.
1097
- * @member {string} poolDeduct
1098
- * @memberof common.Fee
1099
- * @instance
1100
- */
1101
- Fee.prototype.poolDeduct = "";
1102
-
1103
- /**
1104
- * Creates a new Fee instance using the specified properties.
1105
- * @function create
1106
- * @memberof common.Fee
1107
- * @static
1108
- * @param {common.IFee=} [properties] Properties to set
1109
- * @returns {common.Fee} Fee instance
1110
- */
1111
- Fee.create = function create(properties) {
1112
- return new Fee(properties);
1113
- };
1114
-
1115
- /**
1116
- * Encodes the specified Fee message. Does not implicitly {@link common.Fee.verify|verify} messages.
1117
- * @function encode
1118
- * @memberof common.Fee
1119
- * @static
1120
- * @param {common.IFee} message Fee message or plain object to encode
1121
- * @param {$protobuf.Writer} [writer] Writer to encode to
1122
- * @returns {$protobuf.Writer} Writer
1123
- */
1124
- Fee.encode = function encode(message, writer) {
1125
- if (!writer) writer = $Writer.create();
1126
- if (message.coins?.length)
1127
- for (let i = 0; i < message.coins.length; ++i)
1128
- $root.common.Coin.encode(
1129
- message.coins[i],
1130
- writer.uint32(/* id 1, wireType 2 =*/ 10).fork(),
1131
- ).ldelim();
1132
- if (message.poolDeduct != null && Object.hasOwnProperty.call(message, "poolDeduct"))
1133
- writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.poolDeduct);
1134
- return writer;
1135
- };
1136
-
1137
- /**
1138
- * Encodes the specified Fee message, length delimited. Does not implicitly {@link common.Fee.verify|verify} messages.
1139
- * @function encodeDelimited
1140
- * @memberof common.Fee
1141
- * @static
1142
- * @param {common.IFee} message Fee message or plain object to encode
1143
- * @param {$protobuf.Writer} [writer] Writer to encode to
1144
- * @returns {$protobuf.Writer} Writer
1145
- */
1146
- Fee.encodeDelimited = function encodeDelimited(message, writer) {
1147
- return this.encode(message, writer).ldelim();
1148
- };
1149
-
1150
- /**
1151
- * Decodes a Fee message from the specified reader or buffer.
1152
- * @function decode
1153
- * @memberof common.Fee
1154
- * @static
1155
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1156
- * @param {number} [length] Message length if known beforehand
1157
- * @returns {common.Fee} Fee
1158
- * @throws {Error} If the payload is not a reader or valid buffer
1159
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
1160
- */
1161
- Fee.decode = function decode(reader, length) {
1162
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
1163
- const end = length === undefined ? reader.len : reader.pos + length,
1164
- message = new $root.common.Fee();
1165
- while (reader.pos < end) {
1166
- const tag = reader.uint32();
1167
- switch (tag >>> 3) {
1168
- case 1:
1169
- if (!message.coins?.length) message.coins = [];
1170
- message.coins.push($root.common.Coin.decode(reader, reader.uint32()));
1171
- break;
1172
- case 2:
1173
- message.poolDeduct = reader.string();
1174
- break;
1175
- default:
1176
- reader.skipType(tag & 7);
1177
- break;
1178
- }
1179
- }
1180
- return message;
1181
- };
1182
-
1183
- /**
1184
- * Decodes a Fee message from the specified reader or buffer, length delimited.
1185
- * @function decodeDelimited
1186
- * @memberof common.Fee
1187
- * @static
1188
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1189
- * @returns {common.Fee} Fee
1190
- * @throws {Error} If the payload is not a reader or valid buffer
1191
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
1192
- */
1193
- Fee.decodeDelimited = function decodeDelimited(reader) {
1194
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
1195
- return this.decode(reader, reader.uint32());
1196
- };
1197
-
1198
- /**
1199
- * Verifies a Fee message.
1200
- * @function verify
1201
- * @memberof common.Fee
1202
- * @static
1203
- * @param {Object.<string,*>} message Plain object to verify
1204
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
1205
- */
1206
- Fee.verify = function verify(message) {
1207
- if (typeof message !== "object" || message === null) return "object expected";
1208
- if (message.coins != null && message.hasOwnProperty("coins")) {
1209
- if (!Array.isArray(message.coins)) return "coins: array expected";
1210
-
1211
- for (let i = 0; i < message.coins.length; ++i) {
1212
- const error = $root.common.Coin.verify(message.coins[i]);
1213
- if (error) return "coins." + error;
1214
- }
1215
- }
1216
- if (message.poolDeduct != null && message.hasOwnProperty("poolDeduct"))
1217
- if (!$util.isString(message.poolDeduct)) return "poolDeduct: string expected";
1218
- return null;
1219
- };
1220
-
1221
- /**
1222
- * Creates a Fee message from a plain object. Also converts values to their respective internal types.
1223
- * @function fromObject
1224
- * @memberof common.Fee
1225
- * @static
1226
- * @param {Object.<string,*>} object Plain object
1227
- * @returns {common.Fee} Fee
1228
- */
1229
- Fee.fromObject = function fromObject(object) {
1230
- if (object instanceof $root.common.Fee) return object;
1231
- const message = new $root.common.Fee();
1232
- if (object.coins) {
1233
- if (!Array.isArray(object.coins)) throw TypeError(".common.Fee.coins: array expected");
1234
- message.coins = [];
1235
- for (let i = 0; i < object.coins.length; ++i) {
1236
- if (typeof object.coins[i] !== "object")
1237
- throw TypeError(".common.Fee.coins: object expected");
1238
- message.coins[i] = $root.common.Coin.fromObject(object.coins[i]);
1239
- }
1240
- }
1241
- if (object.poolDeduct != null) message.poolDeduct = String(object.poolDeduct);
1242
- return message;
1243
- };
1244
-
1245
- /**
1246
- * Creates a plain object from a Fee message. Also converts values to other types if specified.
1247
- * @function toObject
1248
- * @memberof common.Fee
1249
- * @static
1250
- * @param {common.Fee} message Fee
1251
- * @param {$protobuf.IConversionOptions} [options] Conversion options
1252
- * @returns {Object.<string,*>} Plain object
1253
- */
1254
- Fee.toObject = function toObject(message, options) {
1255
- if (!options) options = {};
1256
- const object = {};
1257
- if (options.arrays || options.defaults) object.coins = [];
1258
- if (options.defaults) object.poolDeduct = "";
1259
- if (message.coins?.length) {
1260
- object.coins = [];
1261
- for (let j = 0; j < message.coins.length; ++j)
1262
- object.coins[j] = $root.common.Coin.toObject(message.coins[j], options);
1263
- }
1264
- if (message.poolDeduct != null && message.hasOwnProperty("poolDeduct"))
1265
- object.poolDeduct = message.poolDeduct;
1266
- return object;
1267
- };
1268
-
1269
- /**
1270
- * Converts this Fee to JSON.
1271
- * @function toJSON
1272
- * @memberof common.Fee
1273
- * @instance
1274
- * @returns {Object.<string,*>} JSON object
1275
- */
1276
- Fee.prototype.toJSON = function toJSON() {
1277
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1278
- };
1279
-
1280
- return Fee;
1281
- })();
1282
-
1283
- common.ProtoUint = (() => {
1284
- /**
1285
- * Properties of a ProtoUint.
1286
- * @memberof common
1287
- * @interface IProtoUint
1288
- * @property {string|null} [value] ProtoUint value
1289
- */
1290
-
1291
- /**
1292
- * Constructs a new ProtoUint.
1293
- * @memberof common
1294
- * @classdesc Represents a ProtoUint.
1295
- * @implements IProtoUint
1296
- * @constructor
1297
- * @param {common.IProtoUint=} [properties] Properties to set
1298
- */
1299
- function ProtoUint(properties) {
1300
- if (properties)
1301
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1302
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
1303
- }
1304
-
1305
- /**
1306
- * ProtoUint value.
1307
- * @member {string} value
1308
- * @memberof common.ProtoUint
1309
- * @instance
1310
- */
1311
- ProtoUint.prototype.value = "";
1312
-
1313
- /**
1314
- * Creates a new ProtoUint instance using the specified properties.
1315
- * @function create
1316
- * @memberof common.ProtoUint
1317
- * @static
1318
- * @param {common.IProtoUint=} [properties] Properties to set
1319
- * @returns {common.ProtoUint} ProtoUint instance
1320
- */
1321
- ProtoUint.create = function create(properties) {
1322
- return new ProtoUint(properties);
1323
- };
1324
-
1325
- /**
1326
- * Encodes the specified ProtoUint message. Does not implicitly {@link common.ProtoUint.verify|verify} messages.
1327
- * @function encode
1328
- * @memberof common.ProtoUint
1329
- * @static
1330
- * @param {common.IProtoUint} message ProtoUint message or plain object to encode
1331
- * @param {$protobuf.Writer} [writer] Writer to encode to
1332
- * @returns {$protobuf.Writer} Writer
1333
- */
1334
- ProtoUint.encode = function encode(message, writer) {
1335
- if (!writer) writer = $Writer.create();
1336
- if (message.value != null && Object.hasOwnProperty.call(message, "value"))
1337
- writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.value);
1338
- return writer;
1339
- };
1340
-
1341
- /**
1342
- * Encodes the specified ProtoUint message, length delimited. Does not implicitly {@link common.ProtoUint.verify|verify} messages.
1343
- * @function encodeDelimited
1344
- * @memberof common.ProtoUint
1345
- * @static
1346
- * @param {common.IProtoUint} message ProtoUint message or plain object to encode
1347
- * @param {$protobuf.Writer} [writer] Writer to encode to
1348
- * @returns {$protobuf.Writer} Writer
1349
- */
1350
- ProtoUint.encodeDelimited = function encodeDelimited(message, writer) {
1351
- return this.encode(message, writer).ldelim();
1352
- };
1353
-
1354
- /**
1355
- * Decodes a ProtoUint message from the specified reader or buffer.
1356
- * @function decode
1357
- * @memberof common.ProtoUint
1358
- * @static
1359
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1360
- * @param {number} [length] Message length if known beforehand
1361
- * @returns {common.ProtoUint} ProtoUint
1362
- * @throws {Error} If the payload is not a reader or valid buffer
1363
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
1364
- */
1365
- ProtoUint.decode = function decode(reader, length) {
1366
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
1367
- const end = length === undefined ? reader.len : reader.pos + length,
1368
- message = new $root.common.ProtoUint();
1369
- while (reader.pos < end) {
1370
- const tag = reader.uint32();
1371
- switch (tag >>> 3) {
1372
- case 1:
1373
- message.value = reader.string();
1374
- break;
1375
- default:
1376
- reader.skipType(tag & 7);
1377
- break;
1378
- }
1379
- }
1380
- return message;
1381
- };
1382
-
1383
- /**
1384
- * Decodes a ProtoUint message from the specified reader or buffer, length delimited.
1385
- * @function decodeDelimited
1386
- * @memberof common.ProtoUint
1387
- * @static
1388
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1389
- * @returns {common.ProtoUint} ProtoUint
1390
- * @throws {Error} If the payload is not a reader or valid buffer
1391
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
1392
- */
1393
- ProtoUint.decodeDelimited = function decodeDelimited(reader) {
1394
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
1395
- return this.decode(reader, reader.uint32());
1396
- };
1397
-
1398
- /**
1399
- * Verifies a ProtoUint message.
1400
- * @function verify
1401
- * @memberof common.ProtoUint
1402
- * @static
1403
- * @param {Object.<string,*>} message Plain object to verify
1404
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
1405
- */
1406
- ProtoUint.verify = function verify(message) {
1407
- if (typeof message !== "object" || message === null) return "object expected";
1408
- if (message.value != null && message.hasOwnProperty("value"))
1409
- if (!$util.isString(message.value)) return "value: string expected";
1410
- return null;
1411
- };
1412
-
1413
- /**
1414
- * Creates a ProtoUint message from a plain object. Also converts values to their respective internal types.
1415
- * @function fromObject
1416
- * @memberof common.ProtoUint
1417
- * @static
1418
- * @param {Object.<string,*>} object Plain object
1419
- * @returns {common.ProtoUint} ProtoUint
1420
- */
1421
- ProtoUint.fromObject = function fromObject(object) {
1422
- if (object instanceof $root.common.ProtoUint) return object;
1423
- const message = new $root.common.ProtoUint();
1424
- if (object.value != null) message.value = String(object.value);
1425
- return message;
1426
- };
1427
-
1428
- /**
1429
- * Creates a plain object from a ProtoUint message. Also converts values to other types if specified.
1430
- * @function toObject
1431
- * @memberof common.ProtoUint
1432
- * @static
1433
- * @param {common.ProtoUint} message ProtoUint
1434
- * @param {$protobuf.IConversionOptions} [options] Conversion options
1435
- * @returns {Object.<string,*>} Plain object
1436
- */
1437
- ProtoUint.toObject = function toObject(message, options) {
1438
- if (!options) options = {};
1439
- const object = {};
1440
- if (options.defaults) object.value = "";
1441
- if (message.value != null && message.hasOwnProperty("value")) object.value = message.value;
1442
- return object;
1443
- };
1444
-
1445
- /**
1446
- * Converts this ProtoUint to JSON.
1447
- * @function toJSON
1448
- * @memberof common.ProtoUint
1449
- * @instance
1450
- * @returns {Object.<string,*>} JSON object
1451
- */
1452
- ProtoUint.prototype.toJSON = function toJSON() {
1453
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1454
- };
1455
-
1456
- return ProtoUint;
1457
- })();
1458
-
1459
- return common;
1460
- })();
1461
-
1462
- $root.types = (() => {
1463
- /**
1464
- * Namespace types.
1465
- * @exports types
1466
- * @namespace
1467
- */
1468
- const types = {};
1469
-
1470
- types.MsgDeposit = (() => {
1471
- /**
1472
- * Properties of a MsgDeposit.
1473
- * @memberof types
1474
- * @interface IMsgDeposit
1475
- * @property {Array.<common.ICoin>|null} [coins] MsgDeposit coins
1476
- * @property {string|null} [memo] MsgDeposit memo
1477
- * @property {Uint8Array|null} [signer] MsgDeposit signer
1478
- */
1479
-
1480
- /**
1481
- * Constructs a new MsgDeposit.
1482
- * @memberof types
1483
- * @classdesc Represents a MsgDeposit.
1484
- * @implements IMsgDeposit
1485
- * @constructor
1486
- * @param {types.IMsgDeposit=} [properties] Properties to set
1487
- */
1488
- function MsgDeposit(properties) {
1489
- this.coins = [];
1490
- if (properties)
1491
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1492
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
1493
- }
1494
-
1495
- /**
1496
- * MsgDeposit coins.
1497
- * @member {Array.<common.ICoin>} coins
1498
- * @memberof types.MsgDeposit
1499
- * @instance
1500
- */
1501
- MsgDeposit.prototype.coins = $util.emptyArray;
1502
-
1503
- /**
1504
- * MsgDeposit memo.
1505
- * @member {string} memo
1506
- * @memberof types.MsgDeposit
1507
- * @instance
1508
- */
1509
- MsgDeposit.prototype.memo = "";
1510
-
1511
- /**
1512
- * MsgDeposit signer.
1513
- * @member {Uint8Array} signer
1514
- * @memberof types.MsgDeposit
1515
- * @instance
1516
- */
1517
- MsgDeposit.prototype.signer = $util.newBuffer([]);
1518
-
1519
- /**
1520
- * Creates a new MsgDeposit instance using the specified properties.
1521
- * @function create
1522
- * @memberof types.MsgDeposit
1523
- * @static
1524
- * @param {types.IMsgDeposit=} [properties] Properties to set
1525
- * @returns {types.MsgDeposit} MsgDeposit instance
1526
- */
1527
- MsgDeposit.create = function create(properties) {
1528
- return new MsgDeposit(properties);
1529
- };
1530
-
1531
- /**
1532
- * Encodes the specified MsgDeposit message. Does not implicitly {@link types.MsgDeposit.verify|verify} messages.
1533
- * @function encode
1534
- * @memberof types.MsgDeposit
1535
- * @static
1536
- * @param {types.IMsgDeposit} message MsgDeposit message or plain object to encode
1537
- * @param {$protobuf.Writer} [writer] Writer to encode to
1538
- * @returns {$protobuf.Writer} Writer
1539
- */
1540
- MsgDeposit.encode = function encode(message, writer) {
1541
- if (!writer) writer = $Writer.create();
1542
- if (message.coins?.length)
1543
- for (let i = 0; i < message.coins.length; ++i)
1544
- $root.common.Coin.encode(
1545
- message.coins[i],
1546
- writer.uint32(/* id 1, wireType 2 =*/ 10).fork(),
1547
- ).ldelim();
1548
- if (message.memo != null && Object.hasOwnProperty.call(message, "memo"))
1549
- writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.memo);
1550
- if (message.signer != null && Object.hasOwnProperty.call(message, "signer"))
1551
- writer.uint32(/* id 3, wireType 2 =*/ 26).bytes(message.signer);
1552
- return writer;
1553
- };
1554
-
1555
- /**
1556
- * Encodes the specified MsgDeposit message, length delimited. Does not implicitly {@link types.MsgDeposit.verify|verify} messages.
1557
- * @function encodeDelimited
1558
- * @memberof types.MsgDeposit
1559
- * @static
1560
- * @param {types.IMsgDeposit} message MsgDeposit message or plain object to encode
1561
- * @param {$protobuf.Writer} [writer] Writer to encode to
1562
- * @returns {$protobuf.Writer} Writer
1563
- */
1564
- MsgDeposit.encodeDelimited = function encodeDelimited(message, writer) {
1565
- return this.encode(message, writer).ldelim();
1566
- };
1567
-
1568
- /**
1569
- * Decodes a MsgDeposit message from the specified reader or buffer.
1570
- * @function decode
1571
- * @memberof types.MsgDeposit
1572
- * @static
1573
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1574
- * @param {number} [length] Message length if known beforehand
1575
- * @returns {types.MsgDeposit} MsgDeposit
1576
- * @throws {Error} If the payload is not a reader or valid buffer
1577
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
1578
- */
1579
- MsgDeposit.decode = function decode(reader, length) {
1580
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
1581
- const end = length === undefined ? reader.len : reader.pos + length,
1582
- message = new $root.types.MsgDeposit();
1583
- while (reader.pos < end) {
1584
- const tag = reader.uint32();
1585
- switch (tag >>> 3) {
1586
- case 1:
1587
- if (!message.coins?.length) message.coins = [];
1588
- message.coins.push($root.common.Coin.decode(reader, reader.uint32()));
1589
- break;
1590
- case 2:
1591
- message.memo = reader.string();
1592
- break;
1593
- case 3:
1594
- message.signer = reader.bytes();
1595
- break;
1596
- default:
1597
- reader.skipType(tag & 7);
1598
- break;
1599
- }
1600
- }
1601
- return message;
1602
- };
1603
-
1604
- /**
1605
- * Decodes a MsgDeposit message from the specified reader or buffer, length delimited.
1606
- * @function decodeDelimited
1607
- * @memberof types.MsgDeposit
1608
- * @static
1609
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1610
- * @returns {types.MsgDeposit} MsgDeposit
1611
- * @throws {Error} If the payload is not a reader or valid buffer
1612
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
1613
- */
1614
- MsgDeposit.decodeDelimited = function decodeDelimited(reader) {
1615
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
1616
- return this.decode(reader, reader.uint32());
1617
- };
1618
-
1619
- /**
1620
- * Verifies a MsgDeposit message.
1621
- * @function verify
1622
- * @memberof types.MsgDeposit
1623
- * @static
1624
- * @param {Object.<string,*>} message Plain object to verify
1625
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
1626
- */
1627
- MsgDeposit.verify = function verify(message) {
1628
- if (typeof message !== "object" || message === null) return "object expected";
1629
- if (message.coins != null && message.hasOwnProperty("coins")) {
1630
- if (!Array.isArray(message.coins)) return "coins: array expected";
1631
-
1632
- for (let i = 0; i < message.coins.length; ++i) {
1633
- const error = $root.common.Coin.verify(message.coins[i]);
1634
- if (error) return "coins." + error;
1635
- }
1636
- }
1637
- if (message.memo != null && message.hasOwnProperty("memo"))
1638
- if (!$util.isString(message.memo)) return "memo: string expected";
1639
- if (message.signer != null && message.hasOwnProperty("signer"))
1640
- if (
1641
- !(
1642
- (message.signer && typeof message.signer.length === "number") ||
1643
- $util.isString(message.signer)
1644
- )
1645
- )
1646
- return "signer: buffer expected";
1647
- return null;
1648
- };
1649
-
1650
- /**
1651
- * Creates a MsgDeposit message from a plain object. Also converts values to their respective internal types.
1652
- * @function fromObject
1653
- * @memberof types.MsgDeposit
1654
- * @static
1655
- * @param {Object.<string,*>} object Plain object
1656
- * @returns {types.MsgDeposit} MsgDeposit
1657
- */
1658
- MsgDeposit.fromObject = function fromObject(object) {
1659
- if (object instanceof $root.types.MsgDeposit) return object;
1660
- const message = new $root.types.MsgDeposit();
1661
- if (object.coins) {
1662
- if (!Array.isArray(object.coins))
1663
- throw TypeError(".types.MsgDeposit.coins: array expected");
1664
- message.coins = [];
1665
- for (let i = 0; i < object.coins.length; ++i) {
1666
- if (typeof object.coins[i] !== "object")
1667
- throw TypeError(".types.MsgDeposit.coins: object expected");
1668
- message.coins[i] = $root.common.Coin.fromObject(object.coins[i]);
1669
- }
1670
- }
1671
- if (object.memo != null) message.memo = String(object.memo);
1672
- if (object.signer != null)
1673
- if (typeof object.signer === "string")
1674
- $util.base64.decode(
1675
- object.signer,
1676
- (message.signer = $util.newBuffer($util.base64.length(object.signer))),
1677
- 0,
1678
- );
1679
- else if (object.signer.length) message.signer = object.signer;
1680
- return message;
1681
- };
1682
-
1683
- /**
1684
- * Creates a plain object from a MsgDeposit message. Also converts values to other types if specified.
1685
- * @function toObject
1686
- * @memberof types.MsgDeposit
1687
- * @static
1688
- * @param {types.MsgDeposit} message MsgDeposit
1689
- * @param {$protobuf.IConversionOptions} [options] Conversion options
1690
- * @returns {Object.<string,*>} Plain object
1691
- */
1692
- MsgDeposit.toObject = function toObject(message, options) {
1693
- if (!options) options = {};
1694
- const object = {};
1695
- if (options.arrays || options.defaults) object.coins = [];
1696
- if (options.defaults) {
1697
- object.memo = "";
1698
- if (options.bytes === String) object.signer = "";
1699
- else {
1700
- object.signer = [];
1701
- if (options.bytes !== Array) object.signer = $util.newBuffer(object.signer);
1702
- }
1703
- }
1704
- if (message.coins?.length) {
1705
- object.coins = [];
1706
- for (let j = 0; j < message.coins.length; ++j)
1707
- object.coins[j] = $root.common.Coin.toObject(message.coins[j], options);
1708
- }
1709
- if (message.memo != null && message.hasOwnProperty("memo")) object.memo = message.memo;
1710
- if (message.signer != null && message.hasOwnProperty("signer"))
1711
- object.signer =
1712
- options.bytes === String
1713
- ? $util.base64.encode(message.signer, 0, message.signer.length)
1714
- : options.bytes === Array
1715
- ? Array.prototype.slice.call(message.signer)
1716
- : message.signer;
1717
- return object;
1718
- };
1719
-
1720
- /**
1721
- * Converts this MsgDeposit to JSON.
1722
- * @function toJSON
1723
- * @memberof types.MsgDeposit
1724
- * @instance
1725
- * @returns {Object.<string,*>} JSON object
1726
- */
1727
- MsgDeposit.prototype.toJSON = function toJSON() {
1728
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
1729
- };
1730
-
1731
- return MsgDeposit;
1732
- })();
1733
-
1734
- types.MsgSend = (() => {
1735
- /**
1736
- * Properties of a MsgSend.
1737
- * @memberof types
1738
- * @interface IMsgSend
1739
- * @property {Uint8Array|null} [fromAddress] MsgSend fromAddress
1740
- * @property {Uint8Array|null} [toAddress] MsgSend toAddress
1741
- * @property {Array.<cosmos.base.v1beta1.ICoin>|null} [amount] MsgSend amount
1742
- */
1743
-
1744
- /**
1745
- * Constructs a new MsgSend.
1746
- * @memberof types
1747
- * @classdesc Represents a MsgSend.
1748
- * @implements IMsgSend
1749
- * @constructor
1750
- * @param {types.IMsgSend=} [properties] Properties to set
1751
- */
1752
- function MsgSend(properties) {
1753
- this.amount = [];
1754
- if (properties)
1755
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
1756
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
1757
- }
1758
-
1759
- /**
1760
- * MsgSend fromAddress.
1761
- * @member {Uint8Array} fromAddress
1762
- * @memberof types.MsgSend
1763
- * @instance
1764
- */
1765
- MsgSend.prototype.fromAddress = $util.newBuffer([]);
1766
-
1767
- /**
1768
- * MsgSend toAddress.
1769
- * @member {Uint8Array} toAddress
1770
- * @memberof types.MsgSend
1771
- * @instance
1772
- */
1773
- MsgSend.prototype.toAddress = $util.newBuffer([]);
1774
-
1775
- /**
1776
- * MsgSend amount.
1777
- * @member {Array.<cosmos.base.v1beta1.ICoin>} amount
1778
- * @memberof types.MsgSend
1779
- * @instance
1780
- */
1781
- MsgSend.prototype.amount = $util.emptyArray;
1782
-
1783
- /**
1784
- * Creates a new MsgSend instance using the specified properties.
1785
- * @function create
1786
- * @memberof types.MsgSend
1787
- * @static
1788
- * @param {types.IMsgSend=} [properties] Properties to set
1789
- * @returns {types.MsgSend} MsgSend instance
1790
- */
1791
- MsgSend.create = function create(properties) {
1792
- return new MsgSend(properties);
1793
- };
1794
-
1795
- /**
1796
- * Encodes the specified MsgSend message. Does not implicitly {@link types.MsgSend.verify|verify} messages.
1797
- * @function encode
1798
- * @memberof types.MsgSend
1799
- * @static
1800
- * @param {types.IMsgSend} message MsgSend message or plain object to encode
1801
- * @param {$protobuf.Writer} [writer] Writer to encode to
1802
- * @returns {$protobuf.Writer} Writer
1803
- */
1804
- MsgSend.encode = function encode(message, writer) {
1805
- if (!writer) writer = $Writer.create();
1806
- if (message.fromAddress != null && Object.hasOwnProperty.call(message, "fromAddress"))
1807
- writer.uint32(/* id 1, wireType 2 =*/ 10).bytes(message.fromAddress);
1808
- if (message.toAddress != null && Object.hasOwnProperty.call(message, "toAddress"))
1809
- writer.uint32(/* id 2, wireType 2 =*/ 18).bytes(message.toAddress);
1810
- if (message.amount?.length)
1811
- for (let i = 0; i < message.amount.length; ++i)
1812
- $root.cosmos.base.v1beta1.Coin.encode(
1813
- message.amount[i],
1814
- writer.uint32(/* id 3, wireType 2 =*/ 26).fork(),
1815
- ).ldelim();
1816
- return writer;
1817
- };
1818
-
1819
- /**
1820
- * Encodes the specified MsgSend message, length delimited. Does not implicitly {@link types.MsgSend.verify|verify} messages.
1821
- * @function encodeDelimited
1822
- * @memberof types.MsgSend
1823
- * @static
1824
- * @param {types.IMsgSend} message MsgSend message or plain object to encode
1825
- * @param {$protobuf.Writer} [writer] Writer to encode to
1826
- * @returns {$protobuf.Writer} Writer
1827
- */
1828
- MsgSend.encodeDelimited = function encodeDelimited(message, writer) {
1829
- return this.encode(message, writer).ldelim();
1830
- };
1831
-
1832
- /**
1833
- * Decodes a MsgSend message from the specified reader or buffer.
1834
- * @function decode
1835
- * @memberof types.MsgSend
1836
- * @static
1837
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1838
- * @param {number} [length] Message length if known beforehand
1839
- * @returns {types.MsgSend} MsgSend
1840
- * @throws {Error} If the payload is not a reader or valid buffer
1841
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
1842
- */
1843
- MsgSend.decode = function decode(reader, length) {
1844
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
1845
- const end = length === undefined ? reader.len : reader.pos + length,
1846
- message = new $root.types.MsgSend();
1847
- while (reader.pos < end) {
1848
- const tag = reader.uint32();
1849
- switch (tag >>> 3) {
1850
- case 1:
1851
- message.fromAddress = reader.bytes();
1852
- break;
1853
- case 2:
1854
- message.toAddress = reader.bytes();
1855
- break;
1856
- case 3:
1857
- if (!message.amount?.length) message.amount = [];
1858
- message.amount.push($root.cosmos.base.v1beta1.Coin.decode(reader, reader.uint32()));
1859
- break;
1860
- default:
1861
- reader.skipType(tag & 7);
1862
- break;
1863
- }
1864
- }
1865
- return message;
1866
- };
1867
-
1868
- /**
1869
- * Decodes a MsgSend message from the specified reader or buffer, length delimited.
1870
- * @function decodeDelimited
1871
- * @memberof types.MsgSend
1872
- * @static
1873
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
1874
- * @returns {types.MsgSend} MsgSend
1875
- * @throws {Error} If the payload is not a reader or valid buffer
1876
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
1877
- */
1878
- MsgSend.decodeDelimited = function decodeDelimited(reader) {
1879
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
1880
- return this.decode(reader, reader.uint32());
1881
- };
1882
-
1883
- /**
1884
- * Verifies a MsgSend message.
1885
- * @function verify
1886
- * @memberof types.MsgSend
1887
- * @static
1888
- * @param {Object.<string,*>} message Plain object to verify
1889
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
1890
- */
1891
- MsgSend.verify = function verify(message) {
1892
- if (typeof message !== "object" || message === null) return "object expected";
1893
- if (message.fromAddress != null && message.hasOwnProperty("fromAddress"))
1894
- if (
1895
- !(
1896
- (message.fromAddress && typeof message.fromAddress.length === "number") ||
1897
- $util.isString(message.fromAddress)
1898
- )
1899
- )
1900
- return "fromAddress: buffer expected";
1901
- if (message.toAddress != null && message.hasOwnProperty("toAddress"))
1902
- if (
1903
- !(
1904
- (message.toAddress && typeof message.toAddress.length === "number") ||
1905
- $util.isString(message.toAddress)
1906
- )
1907
- )
1908
- return "toAddress: buffer expected";
1909
- if (message.amount != null && message.hasOwnProperty("amount")) {
1910
- if (!Array.isArray(message.amount)) return "amount: array expected";
1911
-
1912
- for (let i = 0; i < message.amount.length; ++i) {
1913
- const error = $root.cosmos.base.v1beta1.Coin.verify(message.amount[i]);
1914
- if (error) return "amount." + error;
1915
- }
1916
- }
1917
- return null;
1918
- };
1919
-
1920
- /**
1921
- * Creates a MsgSend message from a plain object. Also converts values to their respective internal types.
1922
- * @function fromObject
1923
- * @memberof types.MsgSend
1924
- * @static
1925
- * @param {Object.<string,*>} object Plain object
1926
- * @returns {types.MsgSend} MsgSend
1927
- */
1928
- MsgSend.fromObject = function fromObject(object) {
1929
- if (object instanceof $root.types.MsgSend) return object;
1930
- const message = new $root.types.MsgSend();
1931
- if (object.fromAddress != null)
1932
- if (typeof object.fromAddress === "string")
1933
- $util.base64.decode(
1934
- object.fromAddress,
1935
- (message.fromAddress = $util.newBuffer($util.base64.length(object.fromAddress))),
1936
- 0,
1937
- );
1938
- else if (object.fromAddress.length) message.fromAddress = object.fromAddress;
1939
- if (object.toAddress != null)
1940
- if (typeof object.toAddress === "string")
1941
- $util.base64.decode(
1942
- object.toAddress,
1943
- (message.toAddress = $util.newBuffer($util.base64.length(object.toAddress))),
1944
- 0,
1945
- );
1946
- else if (object.toAddress.length) message.toAddress = object.toAddress;
1947
- if (object.amount) {
1948
- if (!Array.isArray(object.amount)) throw TypeError(".types.MsgSend.amount: array expected");
1949
- message.amount = [];
1950
- for (let i = 0; i < object.amount.length; ++i) {
1951
- if (typeof object.amount[i] !== "object")
1952
- throw TypeError(".types.MsgSend.amount: object expected");
1953
- message.amount[i] = $root.cosmos.base.v1beta1.Coin.fromObject(object.amount[i]);
1954
- }
1955
- }
1956
- return message;
1957
- };
1958
-
1959
- /**
1960
- * Creates a plain object from a MsgSend message. Also converts values to other types if specified.
1961
- * @function toObject
1962
- * @memberof types.MsgSend
1963
- * @static
1964
- * @param {types.MsgSend} message MsgSend
1965
- * @param {$protobuf.IConversionOptions} [options] Conversion options
1966
- * @returns {Object.<string,*>} Plain object
1967
- */
1968
- MsgSend.toObject = function toObject(message, options) {
1969
- if (!options) options = {};
1970
- const object = {};
1971
- if (options.arrays || options.defaults) object.amount = [];
1972
- if (options.defaults) {
1973
- if (options.bytes === String) object.fromAddress = "";
1974
- else {
1975
- object.fromAddress = [];
1976
- if (options.bytes !== Array) object.fromAddress = $util.newBuffer(object.fromAddress);
1977
- }
1978
- if (options.bytes === String) object.toAddress = "";
1979
- else {
1980
- object.toAddress = [];
1981
- if (options.bytes !== Array) object.toAddress = $util.newBuffer(object.toAddress);
1982
- }
1983
- }
1984
- if (message.fromAddress != null && message.hasOwnProperty("fromAddress"))
1985
- object.fromAddress =
1986
- options.bytes === String
1987
- ? $util.base64.encode(message.fromAddress, 0, message.fromAddress.length)
1988
- : options.bytes === Array
1989
- ? Array.prototype.slice.call(message.fromAddress)
1990
- : message.fromAddress;
1991
- if (message.toAddress != null && message.hasOwnProperty("toAddress"))
1992
- object.toAddress =
1993
- options.bytes === String
1994
- ? $util.base64.encode(message.toAddress, 0, message.toAddress.length)
1995
- : options.bytes === Array
1996
- ? Array.prototype.slice.call(message.toAddress)
1997
- : message.toAddress;
1998
- if (message.amount?.length) {
1999
- object.amount = [];
2000
- for (let j = 0; j < message.amount.length; ++j)
2001
- object.amount[j] = $root.cosmos.base.v1beta1.Coin.toObject(message.amount[j], options);
2002
- }
2003
- return object;
2004
- };
2005
-
2006
- /**
2007
- * Converts this MsgSend to JSON.
2008
- * @function toJSON
2009
- * @memberof types.MsgSend
2010
- * @instance
2011
- * @returns {Object.<string,*>} JSON object
2012
- */
2013
- MsgSend.prototype.toJSON = function toJSON() {
2014
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2015
- };
2016
-
2017
- return MsgSend;
2018
- })();
2019
-
2020
- return types;
2021
- })();
2022
-
2023
- $root.cosmos = (() => {
2024
- /**
2025
- * Namespace cosmos.
2026
- * @exports cosmos
2027
- * @namespace
2028
- */
2029
- const cosmos = {};
2030
-
2031
- cosmos.base = (() => {
2032
- /**
2033
- * Namespace base.
2034
- * @memberof cosmos
2035
- * @namespace
2036
- */
2037
- const base = {};
2038
-
2039
- base.v1beta1 = (() => {
2040
- /**
2041
- * Namespace v1beta1.
2042
- * @memberof cosmos.base
2043
- * @namespace
2044
- */
2045
- const v1beta1 = {};
2046
-
2047
- v1beta1.Coin = (() => {
2048
- /**
2049
- * Properties of a Coin.
2050
- * @memberof cosmos.base.v1beta1
2051
- * @interface ICoin
2052
- * @property {string|null} [denom] Coin denom
2053
- * @property {string|null} [amount] Coin amount
2054
- */
2055
-
2056
- /**
2057
- * Constructs a new Coin.
2058
- * @memberof cosmos.base.v1beta1
2059
- * @classdesc Represents a Coin.
2060
- * @implements ICoin
2061
- * @constructor
2062
- * @param {cosmos.base.v1beta1.ICoin=} [properties] Properties to set
2063
- */
2064
- function Coin(properties) {
2065
- if (properties)
2066
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2067
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
2068
- }
2069
-
2070
- /**
2071
- * Coin denom.
2072
- * @member {string} denom
2073
- * @memberof cosmos.base.v1beta1.Coin
2074
- * @instance
2075
- */
2076
- Coin.prototype.denom = "";
2077
-
2078
- /**
2079
- * Coin amount.
2080
- * @member {string} amount
2081
- * @memberof cosmos.base.v1beta1.Coin
2082
- * @instance
2083
- */
2084
- Coin.prototype.amount = "";
2085
-
2086
- /**
2087
- * Creates a new Coin instance using the specified properties.
2088
- * @function create
2089
- * @memberof cosmos.base.v1beta1.Coin
2090
- * @static
2091
- * @param {cosmos.base.v1beta1.ICoin=} [properties] Properties to set
2092
- * @returns {cosmos.base.v1beta1.Coin} Coin instance
2093
- */
2094
- Coin.create = function create(properties) {
2095
- return new Coin(properties);
2096
- };
2097
-
2098
- /**
2099
- * Encodes the specified Coin message. Does not implicitly {@link cosmos.base.v1beta1.Coin.verify|verify} messages.
2100
- * @function encode
2101
- * @memberof cosmos.base.v1beta1.Coin
2102
- * @static
2103
- * @param {cosmos.base.v1beta1.ICoin} message Coin message or plain object to encode
2104
- * @param {$protobuf.Writer} [writer] Writer to encode to
2105
- * @returns {$protobuf.Writer} Writer
2106
- */
2107
- Coin.encode = function encode(message, writer) {
2108
- if (!writer) writer = $Writer.create();
2109
- if (message.denom != null && Object.hasOwnProperty.call(message, "denom"))
2110
- writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.denom);
2111
- if (message.amount != null && Object.hasOwnProperty.call(message, "amount"))
2112
- writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.amount);
2113
- return writer;
2114
- };
2115
-
2116
- /**
2117
- * Encodes the specified Coin message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.Coin.verify|verify} messages.
2118
- * @function encodeDelimited
2119
- * @memberof cosmos.base.v1beta1.Coin
2120
- * @static
2121
- * @param {cosmos.base.v1beta1.ICoin} message Coin message or plain object to encode
2122
- * @param {$protobuf.Writer} [writer] Writer to encode to
2123
- * @returns {$protobuf.Writer} Writer
2124
- */
2125
- Coin.encodeDelimited = function encodeDelimited(message, writer) {
2126
- return this.encode(message, writer).ldelim();
2127
- };
2128
-
2129
- /**
2130
- * Decodes a Coin message from the specified reader or buffer.
2131
- * @function decode
2132
- * @memberof cosmos.base.v1beta1.Coin
2133
- * @static
2134
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2135
- * @param {number} [length] Message length if known beforehand
2136
- * @returns {cosmos.base.v1beta1.Coin} Coin
2137
- * @throws {Error} If the payload is not a reader or valid buffer
2138
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
2139
- */
2140
- Coin.decode = function decode(reader, length) {
2141
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
2142
- const end = length === undefined ? reader.len : reader.pos + length,
2143
- message = new $root.cosmos.base.v1beta1.Coin();
2144
- while (reader.pos < end) {
2145
- const tag = reader.uint32();
2146
- switch (tag >>> 3) {
2147
- case 1:
2148
- message.denom = reader.string();
2149
- break;
2150
- case 2:
2151
- message.amount = reader.string();
2152
- break;
2153
- default:
2154
- reader.skipType(tag & 7);
2155
- break;
2156
- }
2157
- }
2158
- return message;
2159
- };
2160
-
2161
- /**
2162
- * Decodes a Coin message from the specified reader or buffer, length delimited.
2163
- * @function decodeDelimited
2164
- * @memberof cosmos.base.v1beta1.Coin
2165
- * @static
2166
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2167
- * @returns {cosmos.base.v1beta1.Coin} Coin
2168
- * @throws {Error} If the payload is not a reader or valid buffer
2169
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
2170
- */
2171
- Coin.decodeDelimited = function decodeDelimited(reader) {
2172
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
2173
- return this.decode(reader, reader.uint32());
2174
- };
2175
-
2176
- /**
2177
- * Verifies a Coin message.
2178
- * @function verify
2179
- * @memberof cosmos.base.v1beta1.Coin
2180
- * @static
2181
- * @param {Object.<string,*>} message Plain object to verify
2182
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
2183
- */
2184
- Coin.verify = function verify(message) {
2185
- if (typeof message !== "object" || message === null) return "object expected";
2186
- if (message.denom != null && message.hasOwnProperty("denom"))
2187
- if (!$util.isString(message.denom)) return "denom: string expected";
2188
- if (message.amount != null && message.hasOwnProperty("amount"))
2189
- if (!$util.isString(message.amount)) return "amount: string expected";
2190
- return null;
2191
- };
2192
-
2193
- /**
2194
- * Creates a Coin message from a plain object. Also converts values to their respective internal types.
2195
- * @function fromObject
2196
- * @memberof cosmos.base.v1beta1.Coin
2197
- * @static
2198
- * @param {Object.<string,*>} object Plain object
2199
- * @returns {cosmos.base.v1beta1.Coin} Coin
2200
- */
2201
- Coin.fromObject = function fromObject(object) {
2202
- if (object instanceof $root.cosmos.base.v1beta1.Coin) return object;
2203
- const message = new $root.cosmos.base.v1beta1.Coin();
2204
- if (object.denom != null) message.denom = String(object.denom);
2205
- if (object.amount != null) message.amount = String(object.amount);
2206
- return message;
2207
- };
2208
-
2209
- /**
2210
- * Creates a plain object from a Coin message. Also converts values to other types if specified.
2211
- * @function toObject
2212
- * @memberof cosmos.base.v1beta1.Coin
2213
- * @static
2214
- * @param {cosmos.base.v1beta1.Coin} message Coin
2215
- * @param {$protobuf.IConversionOptions} [options] Conversion options
2216
- * @returns {Object.<string,*>} Plain object
2217
- */
2218
- Coin.toObject = function toObject(message, options) {
2219
- if (!options) options = {};
2220
- const object = {};
2221
- if (options.defaults) {
2222
- object.denom = "";
2223
- object.amount = "";
2224
- }
2225
- if (message.denom != null && message.hasOwnProperty("denom"))
2226
- object.denom = message.denom;
2227
- if (message.amount != null && message.hasOwnProperty("amount"))
2228
- object.amount = message.amount;
2229
- return object;
2230
- };
2231
-
2232
- /**
2233
- * Converts this Coin to JSON.
2234
- * @function toJSON
2235
- * @memberof cosmos.base.v1beta1.Coin
2236
- * @instance
2237
- * @returns {Object.<string,*>} JSON object
2238
- */
2239
- Coin.prototype.toJSON = function toJSON() {
2240
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2241
- };
2242
-
2243
- return Coin;
2244
- })();
2245
-
2246
- v1beta1.DecCoin = (() => {
2247
- /**
2248
- * Properties of a DecCoin.
2249
- * @memberof cosmos.base.v1beta1
2250
- * @interface IDecCoin
2251
- * @property {string|null} [denom] DecCoin denom
2252
- * @property {string|null} [amount] DecCoin amount
2253
- */
2254
-
2255
- /**
2256
- * Constructs a new DecCoin.
2257
- * @memberof cosmos.base.v1beta1
2258
- * @classdesc Represents a DecCoin.
2259
- * @implements IDecCoin
2260
- * @constructor
2261
- * @param {cosmos.base.v1beta1.IDecCoin=} [properties] Properties to set
2262
- */
2263
- function DecCoin(properties) {
2264
- if (properties)
2265
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2266
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
2267
- }
2268
-
2269
- /**
2270
- * DecCoin denom.
2271
- * @member {string} denom
2272
- * @memberof cosmos.base.v1beta1.DecCoin
2273
- * @instance
2274
- */
2275
- DecCoin.prototype.denom = "";
2276
-
2277
- /**
2278
- * DecCoin amount.
2279
- * @member {string} amount
2280
- * @memberof cosmos.base.v1beta1.DecCoin
2281
- * @instance
2282
- */
2283
- DecCoin.prototype.amount = "";
2284
-
2285
- /**
2286
- * Creates a new DecCoin instance using the specified properties.
2287
- * @function create
2288
- * @memberof cosmos.base.v1beta1.DecCoin
2289
- * @static
2290
- * @param {cosmos.base.v1beta1.IDecCoin=} [properties] Properties to set
2291
- * @returns {cosmos.base.v1beta1.DecCoin} DecCoin instance
2292
- */
2293
- DecCoin.create = function create(properties) {
2294
- return new DecCoin(properties);
2295
- };
2296
-
2297
- /**
2298
- * Encodes the specified DecCoin message. Does not implicitly {@link cosmos.base.v1beta1.DecCoin.verify|verify} messages.
2299
- * @function encode
2300
- * @memberof cosmos.base.v1beta1.DecCoin
2301
- * @static
2302
- * @param {cosmos.base.v1beta1.IDecCoin} message DecCoin message or plain object to encode
2303
- * @param {$protobuf.Writer} [writer] Writer to encode to
2304
- * @returns {$protobuf.Writer} Writer
2305
- */
2306
- DecCoin.encode = function encode(message, writer) {
2307
- if (!writer) writer = $Writer.create();
2308
- if (message.denom != null && Object.hasOwnProperty.call(message, "denom"))
2309
- writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.denom);
2310
- if (message.amount != null && Object.hasOwnProperty.call(message, "amount"))
2311
- writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.amount);
2312
- return writer;
2313
- };
2314
-
2315
- /**
2316
- * Encodes the specified DecCoin message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.DecCoin.verify|verify} messages.
2317
- * @function encodeDelimited
2318
- * @memberof cosmos.base.v1beta1.DecCoin
2319
- * @static
2320
- * @param {cosmos.base.v1beta1.IDecCoin} message DecCoin message or plain object to encode
2321
- * @param {$protobuf.Writer} [writer] Writer to encode to
2322
- * @returns {$protobuf.Writer} Writer
2323
- */
2324
- DecCoin.encodeDelimited = function encodeDelimited(message, writer) {
2325
- return this.encode(message, writer).ldelim();
2326
- };
2327
-
2328
- /**
2329
- * Decodes a DecCoin message from the specified reader or buffer.
2330
- * @function decode
2331
- * @memberof cosmos.base.v1beta1.DecCoin
2332
- * @static
2333
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2334
- * @param {number} [length] Message length if known beforehand
2335
- * @returns {cosmos.base.v1beta1.DecCoin} DecCoin
2336
- * @throws {Error} If the payload is not a reader or valid buffer
2337
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
2338
- */
2339
- DecCoin.decode = function decode(reader, length) {
2340
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
2341
- const end = length === undefined ? reader.len : reader.pos + length,
2342
- message = new $root.cosmos.base.v1beta1.DecCoin();
2343
- while (reader.pos < end) {
2344
- const tag = reader.uint32();
2345
- switch (tag >>> 3) {
2346
- case 1:
2347
- message.denom = reader.string();
2348
- break;
2349
- case 2:
2350
- message.amount = reader.string();
2351
- break;
2352
- default:
2353
- reader.skipType(tag & 7);
2354
- break;
2355
- }
2356
- }
2357
- return message;
2358
- };
2359
-
2360
- /**
2361
- * Decodes a DecCoin message from the specified reader or buffer, length delimited.
2362
- * @function decodeDelimited
2363
- * @memberof cosmos.base.v1beta1.DecCoin
2364
- * @static
2365
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2366
- * @returns {cosmos.base.v1beta1.DecCoin} DecCoin
2367
- * @throws {Error} If the payload is not a reader or valid buffer
2368
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
2369
- */
2370
- DecCoin.decodeDelimited = function decodeDelimited(reader) {
2371
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
2372
- return this.decode(reader, reader.uint32());
2373
- };
2374
-
2375
- /**
2376
- * Verifies a DecCoin message.
2377
- * @function verify
2378
- * @memberof cosmos.base.v1beta1.DecCoin
2379
- * @static
2380
- * @param {Object.<string,*>} message Plain object to verify
2381
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
2382
- */
2383
- DecCoin.verify = function verify(message) {
2384
- if (typeof message !== "object" || message === null) return "object expected";
2385
- if (message.denom != null && message.hasOwnProperty("denom"))
2386
- if (!$util.isString(message.denom)) return "denom: string expected";
2387
- if (message.amount != null && message.hasOwnProperty("amount"))
2388
- if (!$util.isString(message.amount)) return "amount: string expected";
2389
- return null;
2390
- };
2391
-
2392
- /**
2393
- * Creates a DecCoin message from a plain object. Also converts values to their respective internal types.
2394
- * @function fromObject
2395
- * @memberof cosmos.base.v1beta1.DecCoin
2396
- * @static
2397
- * @param {Object.<string,*>} object Plain object
2398
- * @returns {cosmos.base.v1beta1.DecCoin} DecCoin
2399
- */
2400
- DecCoin.fromObject = function fromObject(object) {
2401
- if (object instanceof $root.cosmos.base.v1beta1.DecCoin) return object;
2402
- const message = new $root.cosmos.base.v1beta1.DecCoin();
2403
- if (object.denom != null) message.denom = String(object.denom);
2404
- if (object.amount != null) message.amount = String(object.amount);
2405
- return message;
2406
- };
2407
-
2408
- /**
2409
- * Creates a plain object from a DecCoin message. Also converts values to other types if specified.
2410
- * @function toObject
2411
- * @memberof cosmos.base.v1beta1.DecCoin
2412
- * @static
2413
- * @param {cosmos.base.v1beta1.DecCoin} message DecCoin
2414
- * @param {$protobuf.IConversionOptions} [options] Conversion options
2415
- * @returns {Object.<string,*>} Plain object
2416
- */
2417
- DecCoin.toObject = function toObject(message, options) {
2418
- if (!options) options = {};
2419
- const object = {};
2420
- if (options.defaults) {
2421
- object.denom = "";
2422
- object.amount = "";
2423
- }
2424
- if (message.denom != null && message.hasOwnProperty("denom"))
2425
- object.denom = message.denom;
2426
- if (message.amount != null && message.hasOwnProperty("amount"))
2427
- object.amount = message.amount;
2428
- return object;
2429
- };
2430
-
2431
- /**
2432
- * Converts this DecCoin to JSON.
2433
- * @function toJSON
2434
- * @memberof cosmos.base.v1beta1.DecCoin
2435
- * @instance
2436
- * @returns {Object.<string,*>} JSON object
2437
- */
2438
- DecCoin.prototype.toJSON = function toJSON() {
2439
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2440
- };
2441
-
2442
- return DecCoin;
2443
- })();
2444
-
2445
- v1beta1.IntProto = (() => {
2446
- /**
2447
- * Properties of an IntProto.
2448
- * @memberof cosmos.base.v1beta1
2449
- * @interface IIntProto
2450
- * @property {string|null} [int] IntProto int
2451
- */
2452
-
2453
- /**
2454
- * Constructs a new IntProto.
2455
- * @memberof cosmos.base.v1beta1
2456
- * @classdesc Represents an IntProto.
2457
- * @implements IIntProto
2458
- * @constructor
2459
- * @param {cosmos.base.v1beta1.IIntProto=} [properties] Properties to set
2460
- */
2461
- function IntProto(properties) {
2462
- if (properties)
2463
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2464
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
2465
- }
2466
-
2467
- /**
2468
- * IntProto int.
2469
- * @member {string} int
2470
- * @memberof cosmos.base.v1beta1.IntProto
2471
- * @instance
2472
- */
2473
- IntProto.prototype.int = "";
2474
-
2475
- /**
2476
- * Creates a new IntProto instance using the specified properties.
2477
- * @function create
2478
- * @memberof cosmos.base.v1beta1.IntProto
2479
- * @static
2480
- * @param {cosmos.base.v1beta1.IIntProto=} [properties] Properties to set
2481
- * @returns {cosmos.base.v1beta1.IntProto} IntProto instance
2482
- */
2483
- IntProto.create = function create(properties) {
2484
- return new IntProto(properties);
2485
- };
2486
-
2487
- /**
2488
- * Encodes the specified IntProto message. Does not implicitly {@link cosmos.base.v1beta1.IntProto.verify|verify} messages.
2489
- * @function encode
2490
- * @memberof cosmos.base.v1beta1.IntProto
2491
- * @static
2492
- * @param {cosmos.base.v1beta1.IIntProto} message IntProto message or plain object to encode
2493
- * @param {$protobuf.Writer} [writer] Writer to encode to
2494
- * @returns {$protobuf.Writer} Writer
2495
- */
2496
- IntProto.encode = function encode(message, writer) {
2497
- if (!writer) writer = $Writer.create();
2498
- if (message.int != null && Object.hasOwnProperty.call(message, "int"))
2499
- writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.int);
2500
- return writer;
2501
- };
2502
-
2503
- /**
2504
- * Encodes the specified IntProto message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.IntProto.verify|verify} messages.
2505
- * @function encodeDelimited
2506
- * @memberof cosmos.base.v1beta1.IntProto
2507
- * @static
2508
- * @param {cosmos.base.v1beta1.IIntProto} message IntProto message or plain object to encode
2509
- * @param {$protobuf.Writer} [writer] Writer to encode to
2510
- * @returns {$protobuf.Writer} Writer
2511
- */
2512
- IntProto.encodeDelimited = function encodeDelimited(message, writer) {
2513
- return this.encode(message, writer).ldelim();
2514
- };
2515
-
2516
- /**
2517
- * Decodes an IntProto message from the specified reader or buffer.
2518
- * @function decode
2519
- * @memberof cosmos.base.v1beta1.IntProto
2520
- * @static
2521
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2522
- * @param {number} [length] Message length if known beforehand
2523
- * @returns {cosmos.base.v1beta1.IntProto} IntProto
2524
- * @throws {Error} If the payload is not a reader or valid buffer
2525
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
2526
- */
2527
- IntProto.decode = function decode(reader, length) {
2528
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
2529
- const end = length === undefined ? reader.len : reader.pos + length,
2530
- message = new $root.cosmos.base.v1beta1.IntProto();
2531
- while (reader.pos < end) {
2532
- const tag = reader.uint32();
2533
- switch (tag >>> 3) {
2534
- case 1:
2535
- message.int = reader.string();
2536
- break;
2537
- default:
2538
- reader.skipType(tag & 7);
2539
- break;
2540
- }
2541
- }
2542
- return message;
2543
- };
2544
-
2545
- /**
2546
- * Decodes an IntProto message from the specified reader or buffer, length delimited.
2547
- * @function decodeDelimited
2548
- * @memberof cosmos.base.v1beta1.IntProto
2549
- * @static
2550
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2551
- * @returns {cosmos.base.v1beta1.IntProto} IntProto
2552
- * @throws {Error} If the payload is not a reader or valid buffer
2553
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
2554
- */
2555
- IntProto.decodeDelimited = function decodeDelimited(reader) {
2556
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
2557
- return this.decode(reader, reader.uint32());
2558
- };
2559
-
2560
- /**
2561
- * Verifies an IntProto message.
2562
- * @function verify
2563
- * @memberof cosmos.base.v1beta1.IntProto
2564
- * @static
2565
- * @param {Object.<string,*>} message Plain object to verify
2566
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
2567
- */
2568
- IntProto.verify = function verify(message) {
2569
- if (typeof message !== "object" || message === null) return "object expected";
2570
- if (message.int != null && message.hasOwnProperty("int"))
2571
- if (!$util.isString(message.int)) return "int: string expected";
2572
- return null;
2573
- };
2574
-
2575
- /**
2576
- * Creates an IntProto message from a plain object. Also converts values to their respective internal types.
2577
- * @function fromObject
2578
- * @memberof cosmos.base.v1beta1.IntProto
2579
- * @static
2580
- * @param {Object.<string,*>} object Plain object
2581
- * @returns {cosmos.base.v1beta1.IntProto} IntProto
2582
- */
2583
- IntProto.fromObject = function fromObject(object) {
2584
- if (object instanceof $root.cosmos.base.v1beta1.IntProto) return object;
2585
- const message = new $root.cosmos.base.v1beta1.IntProto();
2586
- if (object.int != null) message.int = String(object.int);
2587
- return message;
2588
- };
2589
-
2590
- /**
2591
- * Creates a plain object from an IntProto message. Also converts values to other types if specified.
2592
- * @function toObject
2593
- * @memberof cosmos.base.v1beta1.IntProto
2594
- * @static
2595
- * @param {cosmos.base.v1beta1.IntProto} message IntProto
2596
- * @param {$protobuf.IConversionOptions} [options] Conversion options
2597
- * @returns {Object.<string,*>} Plain object
2598
- */
2599
- IntProto.toObject = function toObject(message, options) {
2600
- if (!options) options = {};
2601
- const object = {};
2602
- if (options.defaults) object.int = "";
2603
- if (message.int != null && message.hasOwnProperty("int")) object.int = message.int;
2604
- return object;
2605
- };
2606
-
2607
- /**
2608
- * Converts this IntProto to JSON.
2609
- * @function toJSON
2610
- * @memberof cosmos.base.v1beta1.IntProto
2611
- * @instance
2612
- * @returns {Object.<string,*>} JSON object
2613
- */
2614
- IntProto.prototype.toJSON = function toJSON() {
2615
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2616
- };
2617
-
2618
- return IntProto;
2619
- })();
2620
-
2621
- v1beta1.DecProto = (() => {
2622
- /**
2623
- * Properties of a DecProto.
2624
- * @memberof cosmos.base.v1beta1
2625
- * @interface IDecProto
2626
- * @property {string|null} [dec] DecProto dec
2627
- */
2628
-
2629
- /**
2630
- * Constructs a new DecProto.
2631
- * @memberof cosmos.base.v1beta1
2632
- * @classdesc Represents a DecProto.
2633
- * @implements IDecProto
2634
- * @constructor
2635
- * @param {cosmos.base.v1beta1.IDecProto=} [properties] Properties to set
2636
- */
2637
- function DecProto(properties) {
2638
- if (properties)
2639
- for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
2640
- if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]];
2641
- }
2642
-
2643
- /**
2644
- * DecProto dec.
2645
- * @member {string} dec
2646
- * @memberof cosmos.base.v1beta1.DecProto
2647
- * @instance
2648
- */
2649
- DecProto.prototype.dec = "";
2650
-
2651
- /**
2652
- * Creates a new DecProto instance using the specified properties.
2653
- * @function create
2654
- * @memberof cosmos.base.v1beta1.DecProto
2655
- * @static
2656
- * @param {cosmos.base.v1beta1.IDecProto=} [properties] Properties to set
2657
- * @returns {cosmos.base.v1beta1.DecProto} DecProto instance
2658
- */
2659
- DecProto.create = function create(properties) {
2660
- return new DecProto(properties);
2661
- };
2662
-
2663
- /**
2664
- * Encodes the specified DecProto message. Does not implicitly {@link cosmos.base.v1beta1.DecProto.verify|verify} messages.
2665
- * @function encode
2666
- * @memberof cosmos.base.v1beta1.DecProto
2667
- * @static
2668
- * @param {cosmos.base.v1beta1.IDecProto} message DecProto message or plain object to encode
2669
- * @param {$protobuf.Writer} [writer] Writer to encode to
2670
- * @returns {$protobuf.Writer} Writer
2671
- */
2672
- DecProto.encode = function encode(message, writer) {
2673
- if (!writer) writer = $Writer.create();
2674
- if (message.dec != null && Object.hasOwnProperty.call(message, "dec"))
2675
- writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.dec);
2676
- return writer;
2677
- };
2678
-
2679
- /**
2680
- * Encodes the specified DecProto message, length delimited. Does not implicitly {@link cosmos.base.v1beta1.DecProto.verify|verify} messages.
2681
- * @function encodeDelimited
2682
- * @memberof cosmos.base.v1beta1.DecProto
2683
- * @static
2684
- * @param {cosmos.base.v1beta1.IDecProto} message DecProto message or plain object to encode
2685
- * @param {$protobuf.Writer} [writer] Writer to encode to
2686
- * @returns {$protobuf.Writer} Writer
2687
- */
2688
- DecProto.encodeDelimited = function encodeDelimited(message, writer) {
2689
- return this.encode(message, writer).ldelim();
2690
- };
2691
-
2692
- /**
2693
- * Decodes a DecProto message from the specified reader or buffer.
2694
- * @function decode
2695
- * @memberof cosmos.base.v1beta1.DecProto
2696
- * @static
2697
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2698
- * @param {number} [length] Message length if known beforehand
2699
- * @returns {cosmos.base.v1beta1.DecProto} DecProto
2700
- * @throws {Error} If the payload is not a reader or valid buffer
2701
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
2702
- */
2703
- DecProto.decode = function decode(reader, length) {
2704
- if (!(reader instanceof $Reader)) reader = $Reader.create(reader);
2705
- const end = length === undefined ? reader.len : reader.pos + length,
2706
- message = new $root.cosmos.base.v1beta1.DecProto();
2707
- while (reader.pos < end) {
2708
- const tag = reader.uint32();
2709
- switch (tag >>> 3) {
2710
- case 1:
2711
- message.dec = reader.string();
2712
- break;
2713
- default:
2714
- reader.skipType(tag & 7);
2715
- break;
2716
- }
2717
- }
2718
- return message;
2719
- };
2720
-
2721
- /**
2722
- * Decodes a DecProto message from the specified reader or buffer, length delimited.
2723
- * @function decodeDelimited
2724
- * @memberof cosmos.base.v1beta1.DecProto
2725
- * @static
2726
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
2727
- * @returns {cosmos.base.v1beta1.DecProto} DecProto
2728
- * @throws {Error} If the payload is not a reader or valid buffer
2729
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
2730
- */
2731
- DecProto.decodeDelimited = function decodeDelimited(reader) {
2732
- if (!(reader instanceof $Reader)) reader = new $Reader(reader);
2733
- return this.decode(reader, reader.uint32());
2734
- };
2735
-
2736
- /**
2737
- * Verifies a DecProto message.
2738
- * @function verify
2739
- * @memberof cosmos.base.v1beta1.DecProto
2740
- * @static
2741
- * @param {Object.<string,*>} message Plain object to verify
2742
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
2743
- */
2744
- DecProto.verify = function verify(message) {
2745
- if (typeof message !== "object" || message === null) return "object expected";
2746
- if (message.dec != null && message.hasOwnProperty("dec"))
2747
- if (!$util.isString(message.dec)) return "dec: string expected";
2748
- return null;
2749
- };
2750
-
2751
- /**
2752
- * Creates a DecProto message from a plain object. Also converts values to their respective internal types.
2753
- * @function fromObject
2754
- * @memberof cosmos.base.v1beta1.DecProto
2755
- * @static
2756
- * @param {Object.<string,*>} object Plain object
2757
- * @returns {cosmos.base.v1beta1.DecProto} DecProto
2758
- */
2759
- DecProto.fromObject = function fromObject(object) {
2760
- if (object instanceof $root.cosmos.base.v1beta1.DecProto) return object;
2761
- const message = new $root.cosmos.base.v1beta1.DecProto();
2762
- if (object.dec != null) message.dec = String(object.dec);
2763
- return message;
2764
- };
2765
-
2766
- /**
2767
- * Creates a plain object from a DecProto message. Also converts values to other types if specified.
2768
- * @function toObject
2769
- * @memberof cosmos.base.v1beta1.DecProto
2770
- * @static
2771
- * @param {cosmos.base.v1beta1.DecProto} message DecProto
2772
- * @param {$protobuf.IConversionOptions} [options] Conversion options
2773
- * @returns {Object.<string,*>} Plain object
2774
- */
2775
- DecProto.toObject = function toObject(message, options) {
2776
- if (!options) options = {};
2777
- const object = {};
2778
- if (options.defaults) object.dec = "";
2779
- if (message.dec != null && message.hasOwnProperty("dec")) object.dec = message.dec;
2780
- return object;
2781
- };
2782
-
2783
- /**
2784
- * Converts this DecProto to JSON.
2785
- * @function toJSON
2786
- * @memberof cosmos.base.v1beta1.DecProto
2787
- * @instance
2788
- * @returns {Object.<string,*>} JSON object
2789
- */
2790
- DecProto.prototype.toJSON = function toJSON() {
2791
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
2792
- };
2793
-
2794
- return DecProto;
2795
- })();
2796
-
2797
- return v1beta1;
2798
- })();
2799
-
2800
- return base;
2801
- })();
2802
-
2803
- return cosmos;
2804
- })();
2805
-
2806
- export default $root;