@kimafinance/kima-transaction-api 1.4.1 → 1.4.3

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