@kimafinance/kima-transaction-api 1.0.26-beta.1 → 1.0.27-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/kima/tx.ts CHANGED
@@ -1,2017 +1,2267 @@
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
- symbol: string;
14
- amount: string;
15
- fee: string;
16
- /** the timestamp when the HTLC contract expires and the user can reclaim the funds locked there */
17
- htlcExpirationTimestamp: string;
18
- /** the txhash locking the funds in the HTLC */
19
- htlcCreationHash: string;
20
- /** the output index of the locked funds in the HTLC creation transaction */
21
- htlcCreationVout: number;
22
- /** a version denoting which HTLC script version is being using for the HTLC transaction */
23
- htlcVersion: string;
24
- /** for bitcoin transaction this is the public key of the sender */
25
- senderPubKey: Uint8Array;
26
- }
27
-
28
- export interface MsgRequestTransactionResponse {
29
- code: string;
30
- msg: string;
31
- txId: number;
32
- }
33
-
34
- export interface MsgFinalizeTransaction {
35
- creator: string;
36
- txId: number;
37
- txHash: string;
38
- success: string;
39
- signedKey: string;
40
- }
41
-
42
- export interface MsgFinalizeTransactionResponse {
43
- code: string;
44
- msg: string;
45
- }
46
-
47
- export interface MsgFinalizeProvisionTransaction {
48
- creator: string;
49
- txId: number;
50
- txHash: string;
51
- success: string;
52
- signedKey: string;
53
- }
54
-
55
- export interface MsgFinalizeProvisionTransactionResponse {
56
- code: string;
57
- msg: string;
58
- }
59
-
60
- export interface MsgRequestProvisionTransaction {
61
- creator: string;
62
- chain: string;
63
- fromAddress: string;
64
- symbol: string;
65
- amount: string;
66
- options: string;
67
- /** BTC transaction */
68
- htlcExpirationTimestamp: string;
69
- /** the txhash locking the funds in the HTLC */
70
- htlcCreationHash: string;
71
- /** the output index of the locked funds in the HTLC creation transaction */
72
- htlcCreationVout: number;
73
- /** a version denoting which HTLC script version is being using for the HTLC transaction */
74
- htlcVersion: string;
75
- /** the (compressed) public key of the sender */
76
- senderPubKey: Uint8Array;
77
- }
78
-
79
- export interface MsgRequestProvisionTransactionResponse {
80
- code: string;
81
- msg: string;
82
- txId: number;
83
- }
84
-
85
- export interface MsgCancelTransaction {
86
- creator: string;
87
- transactionId: string;
88
- }
89
-
90
- export interface MsgCancelTransactionResponse {
91
- code: string;
92
- msg: string;
93
- }
94
-
95
- export interface MsgSetTxHash {
96
- creator: string;
97
- txId: number;
98
- txHash: string;
99
- /** request_transaction, request_provision_transaction, request_drain_transaction */
100
- txType: string;
101
- }
102
-
103
- export interface MsgSetTxHashResponse {
104
- code: string;
105
- msg: string;
106
- }
107
-
108
- export interface MsgSetTxProcess {
109
- creator: string;
110
- txId: number;
111
- timestamp: number;
112
- msgId: string;
113
- /** request_transaction, request_provision_transaction, request_drain_transaction */
114
- txType: string;
115
- }
116
-
117
- export interface MsgSetTxProcessResponse {}
118
-
119
- export interface MsgRequestDrainTransaction {
120
- creator: string;
121
- toChain: string;
122
- toAddress: string;
123
- symbol: string;
124
- amount: string;
125
- options: string;
126
- }
127
-
128
- export interface MsgRequestDrainTransactionResponse {
129
- code: string;
130
- msg: string;
131
- txId: number;
132
- }
133
-
134
- export interface MsgFinalizeDrainTransaction {
135
- creator: string;
136
- txId: number;
137
- txHash: string;
138
- success: string;
139
- signedKey: string;
140
- }
141
-
142
- export interface MsgFinalizeDrainTransactionResponse {
143
- code: string;
144
- msg: string;
145
- }
146
-
147
- function createBaseMsgRequestTransaction(): MsgRequestTransaction {
148
- return {
149
- creator: "",
150
- originChain: "",
151
- originAddress: "",
152
- targetChain: "",
153
- targetAddress: "",
154
- symbol: "",
155
- amount: "",
156
- fee: "",
157
- htlcExpirationTimestamp: "",
158
- htlcCreationHash: "",
159
- htlcCreationVout: 0,
160
- htlcVersion: "",
161
- senderPubKey: new Uint8Array(),
162
- };
163
- }
164
-
165
- export const MsgRequestTransaction = {
166
- encode(
167
- message: MsgRequestTransaction,
168
- writer: _m0.Writer = _m0.Writer.create()
169
- ): _m0.Writer {
170
- if (message.creator !== "") {
171
- writer.uint32(10).string(message.creator);
172
- }
173
- if (message.originChain !== "") {
174
- writer.uint32(18).string(message.originChain);
175
- }
176
- if (message.originAddress !== "") {
177
- writer.uint32(26).string(message.originAddress);
178
- }
179
- if (message.targetChain !== "") {
180
- writer.uint32(34).string(message.targetChain);
181
- }
182
- if (message.targetAddress !== "") {
183
- writer.uint32(42).string(message.targetAddress);
184
- }
185
- if (message.symbol !== "") {
186
- writer.uint32(50).string(message.symbol);
187
- }
188
- if (message.amount !== "") {
189
- writer.uint32(58).string(message.amount);
190
- }
191
- if (message.fee !== "") {
192
- writer.uint32(66).string(message.fee);
193
- }
194
- if (message.htlcExpirationTimestamp !== "") {
195
- writer.uint32(74).string(message.htlcExpirationTimestamp);
196
- }
197
- if (message.htlcCreationHash !== "") {
198
- writer.uint32(82).string(message.htlcCreationHash);
199
- }
200
- if (message.htlcCreationVout !== 0) {
201
- writer.uint32(88).uint32(message.htlcCreationVout);
202
- }
203
- if (message.htlcVersion !== "") {
204
- writer.uint32(98).string(message.htlcVersion);
205
- }
206
- if (message.senderPubKey.length !== 0) {
207
- writer.uint32(106).bytes(message.senderPubKey);
208
- }
209
- return writer;
210
- },
211
-
212
- decode(
213
- input: _m0.Reader | Uint8Array,
214
- length?: number
215
- ): MsgRequestTransaction {
216
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
217
- let end = length === undefined ? reader.len : reader.pos + length;
218
- const message = createBaseMsgRequestTransaction();
219
- while (reader.pos < end) {
220
- const tag = reader.uint32();
221
- switch (tag >>> 3) {
222
- case 1:
223
- message.creator = reader.string();
224
- break;
225
- case 2:
226
- message.originChain = reader.string();
227
- break;
228
- case 3:
229
- message.originAddress = reader.string();
230
- break;
231
- case 4:
232
- message.targetChain = reader.string();
233
- break;
234
- case 5:
235
- message.targetAddress = reader.string();
236
- break;
237
- case 6:
238
- message.symbol = reader.string();
239
- break;
240
- case 7:
241
- message.amount = reader.string();
242
- break;
243
- case 8:
244
- message.fee = reader.string();
245
- break;
246
- case 9:
247
- message.htlcExpirationTimestamp = reader.string();
248
- break;
249
- case 10:
250
- message.htlcCreationHash = reader.string();
251
- break;
252
- case 11:
253
- message.htlcCreationVout = reader.uint32();
254
- break;
255
- case 12:
256
- message.htlcVersion = reader.string();
257
- break;
258
- case 13:
259
- message.senderPubKey = reader.bytes();
260
- break;
261
- default:
262
- reader.skipType(tag & 7);
263
- break;
264
- }
265
- }
266
- return message;
267
- },
268
-
269
- fromJSON(object: any): MsgRequestTransaction {
270
- return {
271
- creator: isSet(object.creator) ? String(object.creator) : "",
272
- originChain: isSet(object.originChain) ? String(object.originChain) : "",
273
- originAddress: isSet(object.originAddress)
274
- ? String(object.originAddress)
275
- : "",
276
- targetChain: isSet(object.targetChain) ? String(object.targetChain) : "",
277
- targetAddress: isSet(object.targetAddress)
278
- ? String(object.targetAddress)
279
- : "",
280
- symbol: isSet(object.symbol) ? String(object.symbol) : "",
281
- amount: isSet(object.amount) ? String(object.amount) : "",
282
- fee: isSet(object.fee) ? String(object.fee) : "",
283
- htlcExpirationTimestamp: isSet(object.htlcExpirationTimestamp)
284
- ? String(object.htlcExpirationTimestamp)
285
- : "",
286
- htlcCreationHash: isSet(object.htlcCreationHash)
287
- ? String(object.htlcCreationHash)
288
- : "",
289
- htlcCreationVout: isSet(object.htlcCreationVout)
290
- ? Number(object.htlcCreationVout)
291
- : 0,
292
- htlcVersion: isSet(object.htlcVersion) ? String(object.htlcVersion) : "",
293
- senderPubKey: isSet(object.senderPubKey)
294
- ? bytesFromBase64(object.senderPubKey)
295
- : new Uint8Array(),
296
- };
297
- },
298
-
299
- toJSON(message: MsgRequestTransaction): unknown {
300
- const obj: any = {};
301
- message.creator !== undefined && (obj.creator = message.creator);
302
- message.originChain !== undefined &&
303
- (obj.originChain = message.originChain);
304
- message.originAddress !== undefined &&
305
- (obj.originAddress = message.originAddress);
306
- message.targetChain !== undefined &&
307
- (obj.targetChain = message.targetChain);
308
- message.targetAddress !== undefined &&
309
- (obj.targetAddress = message.targetAddress);
310
- message.symbol !== undefined && (obj.symbol = message.symbol);
311
- message.amount !== undefined && (obj.amount = message.amount);
312
- message.fee !== undefined && (obj.fee = message.fee);
313
- message.htlcExpirationTimestamp !== undefined &&
314
- (obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
315
- message.htlcCreationHash !== undefined &&
316
- (obj.htlcCreationHash = message.htlcCreationHash);
317
- message.htlcCreationVout !== undefined &&
318
- (obj.htlcCreationVout = Math.round(message.htlcCreationVout));
319
- message.htlcVersion !== undefined &&
320
- (obj.htlcVersion = message.htlcVersion);
321
- message.senderPubKey !== undefined &&
322
- (obj.senderPubKey = base64FromBytes(
323
- message.senderPubKey !== undefined
324
- ? message.senderPubKey
325
- : new Uint8Array()
326
- ));
327
- return obj;
328
- },
329
-
330
- fromPartial<I extends Exact<DeepPartial<MsgRequestTransaction>, I>>(
331
- object: I
332
- ): MsgRequestTransaction {
333
- const message = createBaseMsgRequestTransaction();
334
- message.creator = object.creator ?? "";
335
- message.originChain = object.originChain ?? "";
336
- message.originAddress = object.originAddress ?? "";
337
- message.targetChain = object.targetChain ?? "";
338
- message.targetAddress = object.targetAddress ?? "";
339
- message.symbol = object.symbol ?? "";
340
- message.amount = object.amount ?? "";
341
- message.fee = object.fee ?? "";
342
- message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
343
- message.htlcCreationHash = object.htlcCreationHash ?? "";
344
- message.htlcCreationVout = object.htlcCreationVout ?? 0;
345
- message.htlcVersion = object.htlcVersion ?? "";
346
- message.senderPubKey = object.senderPubKey ?? new Uint8Array();
347
- return message;
348
- },
349
- };
350
-
351
- function createBaseMsgRequestTransactionResponse(): MsgRequestTransactionResponse {
352
- return { code: "", msg: "", txId: 0 };
353
- }
354
-
355
- export const MsgRequestTransactionResponse = {
356
- encode(
357
- message: MsgRequestTransactionResponse,
358
- writer: _m0.Writer = _m0.Writer.create()
359
- ): _m0.Writer {
360
- if (message.code !== "") {
361
- writer.uint32(10).string(message.code);
362
- }
363
- if (message.msg !== "") {
364
- writer.uint32(18).string(message.msg);
365
- }
366
- if (message.txId !== 0) {
367
- writer.uint32(24).uint64(message.txId);
368
- }
369
- return writer;
370
- },
371
-
372
- decode(
373
- input: _m0.Reader | Uint8Array,
374
- length?: number
375
- ): MsgRequestTransactionResponse {
376
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
377
- let end = length === undefined ? reader.len : reader.pos + length;
378
- const message = createBaseMsgRequestTransactionResponse();
379
- while (reader.pos < end) {
380
- const tag = reader.uint32();
381
- switch (tag >>> 3) {
382
- case 1:
383
- message.code = reader.string();
384
- break;
385
- case 2:
386
- message.msg = reader.string();
387
- break;
388
- case 3:
389
- message.txId = longToNumber(reader.uint64() as Long);
390
- break;
391
- default:
392
- reader.skipType(tag & 7);
393
- break;
394
- }
395
- }
396
- return message;
397
- },
398
-
399
- fromJSON(object: any): MsgRequestTransactionResponse {
400
- return {
401
- code: isSet(object.code) ? String(object.code) : "",
402
- msg: isSet(object.msg) ? String(object.msg) : "",
403
- txId: isSet(object.txId) ? Number(object.txId) : 0,
404
- };
405
- },
406
-
407
- toJSON(message: MsgRequestTransactionResponse): unknown {
408
- const obj: any = {};
409
- message.code !== undefined && (obj.code = message.code);
410
- message.msg !== undefined && (obj.msg = message.msg);
411
- message.txId !== undefined && (obj.txId = Math.round(message.txId));
412
- return obj;
413
- },
414
-
415
- fromPartial<I extends Exact<DeepPartial<MsgRequestTransactionResponse>, I>>(
416
- object: I
417
- ): MsgRequestTransactionResponse {
418
- const message = createBaseMsgRequestTransactionResponse();
419
- message.code = object.code ?? "";
420
- message.msg = object.msg ?? "";
421
- message.txId = object.txId ?? 0;
422
- return message;
423
- },
424
- };
425
-
426
- function createBaseMsgFinalizeTransaction(): MsgFinalizeTransaction {
427
- return { creator: "", txId: 0, txHash: "", success: "", signedKey: "" };
428
- }
429
-
430
- export const MsgFinalizeTransaction = {
431
- encode(
432
- message: MsgFinalizeTransaction,
433
- writer: _m0.Writer = _m0.Writer.create()
434
- ): _m0.Writer {
435
- if (message.creator !== "") {
436
- writer.uint32(10).string(message.creator);
437
- }
438
- if (message.txId !== 0) {
439
- writer.uint32(16).uint64(message.txId);
440
- }
441
- if (message.txHash !== "") {
442
- writer.uint32(26).string(message.txHash);
443
- }
444
- if (message.success !== "") {
445
- writer.uint32(34).string(message.success);
446
- }
447
- if (message.signedKey !== "") {
448
- writer.uint32(42).string(message.signedKey);
449
- }
450
- return writer;
451
- },
452
-
453
- decode(
454
- input: _m0.Reader | Uint8Array,
455
- length?: number
456
- ): MsgFinalizeTransaction {
457
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
458
- let end = length === undefined ? reader.len : reader.pos + length;
459
- const message = createBaseMsgFinalizeTransaction();
460
- while (reader.pos < end) {
461
- const tag = reader.uint32();
462
- switch (tag >>> 3) {
463
- case 1:
464
- message.creator = reader.string();
465
- break;
466
- case 2:
467
- message.txId = longToNumber(reader.uint64() as Long);
468
- break;
469
- case 3:
470
- message.txHash = reader.string();
471
- break;
472
- case 4:
473
- message.success = reader.string();
474
- break;
475
- case 5:
476
- message.signedKey = reader.string();
477
- break;
478
- default:
479
- reader.skipType(tag & 7);
480
- break;
481
- }
482
- }
483
- return message;
484
- },
485
-
486
- fromJSON(object: any): MsgFinalizeTransaction {
487
- return {
488
- creator: isSet(object.creator) ? String(object.creator) : "",
489
- txId: isSet(object.txId) ? Number(object.txId) : 0,
490
- txHash: isSet(object.txHash) ? String(object.txHash) : "",
491
- success: isSet(object.success) ? String(object.success) : "",
492
- signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
493
- };
494
- },
495
-
496
- toJSON(message: MsgFinalizeTransaction): unknown {
497
- const obj: any = {};
498
- message.creator !== undefined && (obj.creator = message.creator);
499
- message.txId !== undefined && (obj.txId = Math.round(message.txId));
500
- message.txHash !== undefined && (obj.txHash = message.txHash);
501
- message.success !== undefined && (obj.success = message.success);
502
- message.signedKey !== undefined && (obj.signedKey = message.signedKey);
503
- return obj;
504
- },
505
-
506
- fromPartial<I extends Exact<DeepPartial<MsgFinalizeTransaction>, I>>(
507
- object: I
508
- ): MsgFinalizeTransaction {
509
- const message = createBaseMsgFinalizeTransaction();
510
- message.creator = object.creator ?? "";
511
- message.txId = object.txId ?? 0;
512
- message.txHash = object.txHash ?? "";
513
- message.success = object.success ?? "";
514
- message.signedKey = object.signedKey ?? "";
515
- return message;
516
- },
517
- };
518
-
519
- function createBaseMsgFinalizeTransactionResponse(): MsgFinalizeTransactionResponse {
520
- return { code: "", msg: "" };
521
- }
522
-
523
- export const MsgFinalizeTransactionResponse = {
524
- encode(
525
- message: MsgFinalizeTransactionResponse,
526
- writer: _m0.Writer = _m0.Writer.create()
527
- ): _m0.Writer {
528
- if (message.code !== "") {
529
- writer.uint32(10).string(message.code);
530
- }
531
- if (message.msg !== "") {
532
- writer.uint32(18).string(message.msg);
533
- }
534
- return writer;
535
- },
536
-
537
- decode(
538
- input: _m0.Reader | Uint8Array,
539
- length?: number
540
- ): MsgFinalizeTransactionResponse {
541
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
542
- let end = length === undefined ? reader.len : reader.pos + length;
543
- const message = createBaseMsgFinalizeTransactionResponse();
544
- while (reader.pos < end) {
545
- const tag = reader.uint32();
546
- switch (tag >>> 3) {
547
- case 1:
548
- message.code = reader.string();
549
- break;
550
- case 2:
551
- message.msg = reader.string();
552
- break;
553
- default:
554
- reader.skipType(tag & 7);
555
- break;
556
- }
557
- }
558
- return message;
559
- },
560
-
561
- fromJSON(object: any): MsgFinalizeTransactionResponse {
562
- return {
563
- code: isSet(object.code) ? String(object.code) : "",
564
- msg: isSet(object.msg) ? String(object.msg) : "",
565
- };
566
- },
567
-
568
- toJSON(message: MsgFinalizeTransactionResponse): unknown {
569
- const obj: any = {};
570
- message.code !== undefined && (obj.code = message.code);
571
- message.msg !== undefined && (obj.msg = message.msg);
572
- return obj;
573
- },
574
-
575
- fromPartial<I extends Exact<DeepPartial<MsgFinalizeTransactionResponse>, I>>(
576
- object: I
577
- ): MsgFinalizeTransactionResponse {
578
- const message = createBaseMsgFinalizeTransactionResponse();
579
- message.code = object.code ?? "";
580
- message.msg = object.msg ?? "";
581
- return message;
582
- },
583
- };
584
-
585
- function createBaseMsgFinalizeProvisionTransaction(): MsgFinalizeProvisionTransaction {
586
- return { creator: "", txId: 0, txHash: "", success: "", signedKey: "" };
587
- }
588
-
589
- export const MsgFinalizeProvisionTransaction = {
590
- encode(
591
- message: MsgFinalizeProvisionTransaction,
592
- writer: _m0.Writer = _m0.Writer.create()
593
- ): _m0.Writer {
594
- if (message.creator !== "") {
595
- writer.uint32(10).string(message.creator);
596
- }
597
- if (message.txId !== 0) {
598
- writer.uint32(16).uint64(message.txId);
599
- }
600
- if (message.txHash !== "") {
601
- writer.uint32(26).string(message.txHash);
602
- }
603
- if (message.success !== "") {
604
- writer.uint32(34).string(message.success);
605
- }
606
- if (message.signedKey !== "") {
607
- writer.uint32(42).string(message.signedKey);
608
- }
609
- return writer;
610
- },
611
-
612
- decode(
613
- input: _m0.Reader | Uint8Array,
614
- length?: number
615
- ): MsgFinalizeProvisionTransaction {
616
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
617
- let end = length === undefined ? reader.len : reader.pos + length;
618
- const message = createBaseMsgFinalizeProvisionTransaction();
619
- while (reader.pos < end) {
620
- const tag = reader.uint32();
621
- switch (tag >>> 3) {
622
- case 1:
623
- message.creator = reader.string();
624
- break;
625
- case 2:
626
- message.txId = longToNumber(reader.uint64() as Long);
627
- break;
628
- case 3:
629
- message.txHash = reader.string();
630
- break;
631
- case 4:
632
- message.success = reader.string();
633
- break;
634
- case 5:
635
- message.signedKey = reader.string();
636
- break;
637
- default:
638
- reader.skipType(tag & 7);
639
- break;
640
- }
641
- }
642
- return message;
643
- },
644
-
645
- fromJSON(object: any): MsgFinalizeProvisionTransaction {
646
- return {
647
- creator: isSet(object.creator) ? String(object.creator) : "",
648
- txId: isSet(object.txId) ? Number(object.txId) : 0,
649
- txHash: isSet(object.txHash) ? String(object.txHash) : "",
650
- success: isSet(object.success) ? String(object.success) : "",
651
- signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
652
- };
653
- },
654
-
655
- toJSON(message: MsgFinalizeProvisionTransaction): unknown {
656
- const obj: any = {};
657
- message.creator !== undefined && (obj.creator = message.creator);
658
- message.txId !== undefined && (obj.txId = Math.round(message.txId));
659
- message.txHash !== undefined && (obj.txHash = message.txHash);
660
- message.success !== undefined && (obj.success = message.success);
661
- message.signedKey !== undefined && (obj.signedKey = message.signedKey);
662
- return obj;
663
- },
664
-
665
- fromPartial<I extends Exact<DeepPartial<MsgFinalizeProvisionTransaction>, I>>(
666
- object: I
667
- ): MsgFinalizeProvisionTransaction {
668
- const message = createBaseMsgFinalizeProvisionTransaction();
669
- message.creator = object.creator ?? "";
670
- message.txId = object.txId ?? 0;
671
- message.txHash = object.txHash ?? "";
672
- message.success = object.success ?? "";
673
- message.signedKey = object.signedKey ?? "";
674
- return message;
675
- },
676
- };
677
-
678
- function createBaseMsgFinalizeProvisionTransactionResponse(): MsgFinalizeProvisionTransactionResponse {
679
- return { code: "", msg: "" };
680
- }
681
-
682
- export const MsgFinalizeProvisionTransactionResponse = {
683
- encode(
684
- message: MsgFinalizeProvisionTransactionResponse,
685
- writer: _m0.Writer = _m0.Writer.create()
686
- ): _m0.Writer {
687
- if (message.code !== "") {
688
- writer.uint32(10).string(message.code);
689
- }
690
- if (message.msg !== "") {
691
- writer.uint32(18).string(message.msg);
692
- }
693
- return writer;
694
- },
695
-
696
- decode(
697
- input: _m0.Reader | Uint8Array,
698
- length?: number
699
- ): MsgFinalizeProvisionTransactionResponse {
700
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
701
- let end = length === undefined ? reader.len : reader.pos + length;
702
- const message = createBaseMsgFinalizeProvisionTransactionResponse();
703
- while (reader.pos < end) {
704
- const tag = reader.uint32();
705
- switch (tag >>> 3) {
706
- case 1:
707
- message.code = reader.string();
708
- break;
709
- case 2:
710
- message.msg = reader.string();
711
- break;
712
- default:
713
- reader.skipType(tag & 7);
714
- break;
715
- }
716
- }
717
- return message;
718
- },
719
-
720
- fromJSON(object: any): MsgFinalizeProvisionTransactionResponse {
721
- return {
722
- code: isSet(object.code) ? String(object.code) : "",
723
- msg: isSet(object.msg) ? String(object.msg) : "",
724
- };
725
- },
726
-
727
- toJSON(message: MsgFinalizeProvisionTransactionResponse): unknown {
728
- const obj: any = {};
729
- message.code !== undefined && (obj.code = message.code);
730
- message.msg !== undefined && (obj.msg = message.msg);
731
- return obj;
732
- },
733
-
734
- fromPartial<
735
- I extends Exact<DeepPartial<MsgFinalizeProvisionTransactionResponse>, I>
736
- >(object: I): MsgFinalizeProvisionTransactionResponse {
737
- const message = createBaseMsgFinalizeProvisionTransactionResponse();
738
- message.code = object.code ?? "";
739
- message.msg = object.msg ?? "";
740
- return message;
741
- },
742
- };
743
-
744
- function createBaseMsgRequestProvisionTransaction(): MsgRequestProvisionTransaction {
745
- return {
746
- creator: "",
747
- chain: "",
748
- fromAddress: "",
749
- symbol: "",
750
- amount: "",
751
- options: "",
752
- htlcExpirationTimestamp: "",
753
- htlcCreationHash: "",
754
- htlcCreationVout: 0,
755
- htlcVersion: "",
756
- senderPubKey: new Uint8Array(),
757
- };
758
- }
759
-
760
- export const MsgRequestProvisionTransaction = {
761
- encode(
762
- message: MsgRequestProvisionTransaction,
763
- writer: _m0.Writer = _m0.Writer.create()
764
- ): _m0.Writer {
765
- if (message.creator !== "") {
766
- writer.uint32(10).string(message.creator);
767
- }
768
- if (message.chain !== "") {
769
- writer.uint32(18).string(message.chain);
770
- }
771
- if (message.fromAddress !== "") {
772
- writer.uint32(26).string(message.fromAddress);
773
- }
774
- if (message.symbol !== "") {
775
- writer.uint32(34).string(message.symbol);
776
- }
777
- if (message.amount !== "") {
778
- writer.uint32(42).string(message.amount);
779
- }
780
- if (message.options !== "") {
781
- writer.uint32(50).string(message.options);
782
- }
783
- if (message.htlcExpirationTimestamp !== "") {
784
- writer.uint32(58).string(message.htlcExpirationTimestamp);
785
- }
786
- if (message.htlcCreationHash !== "") {
787
- writer.uint32(66).string(message.htlcCreationHash);
788
- }
789
- if (message.htlcCreationVout !== 0) {
790
- writer.uint32(72).uint32(message.htlcCreationVout);
791
- }
792
- if (message.htlcVersion !== "") {
793
- writer.uint32(82).string(message.htlcVersion);
794
- }
795
- if (message.senderPubKey.length !== 0) {
796
- writer.uint32(90).bytes(message.senderPubKey);
797
- }
798
- return writer;
799
- },
800
-
801
- decode(
802
- input: _m0.Reader | Uint8Array,
803
- length?: number
804
- ): MsgRequestProvisionTransaction {
805
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
806
- let end = length === undefined ? reader.len : reader.pos + length;
807
- const message = createBaseMsgRequestProvisionTransaction();
808
- while (reader.pos < end) {
809
- const tag = reader.uint32();
810
- switch (tag >>> 3) {
811
- case 1:
812
- message.creator = reader.string();
813
- break;
814
- case 2:
815
- message.chain = reader.string();
816
- break;
817
- case 3:
818
- message.fromAddress = reader.string();
819
- break;
820
- case 4:
821
- message.symbol = reader.string();
822
- break;
823
- case 5:
824
- message.amount = reader.string();
825
- break;
826
- case 6:
827
- message.options = reader.string();
828
- break;
829
- case 7:
830
- message.htlcExpirationTimestamp = reader.string();
831
- break;
832
- case 8:
833
- message.htlcCreationHash = reader.string();
834
- break;
835
- case 9:
836
- message.htlcCreationVout = reader.uint32();
837
- break;
838
- case 10:
839
- message.htlcVersion = reader.string();
840
- break;
841
- case 11:
842
- message.senderPubKey = reader.bytes();
843
- break;
844
- default:
845
- reader.skipType(tag & 7);
846
- break;
847
- }
848
- }
849
- return message;
850
- },
851
-
852
- fromJSON(object: any): MsgRequestProvisionTransaction {
853
- return {
854
- creator: isSet(object.creator) ? String(object.creator) : "",
855
- chain: isSet(object.chain) ? String(object.chain) : "",
856
- fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "",
857
- symbol: isSet(object.symbol) ? String(object.symbol) : "",
858
- amount: isSet(object.amount) ? String(object.amount) : "",
859
- options: isSet(object.options) ? String(object.options) : "",
860
- htlcExpirationTimestamp: isSet(object.htlcExpirationTimestamp)
861
- ? String(object.htlcExpirationTimestamp)
862
- : "",
863
- htlcCreationHash: isSet(object.htlcCreationHash)
864
- ? String(object.htlcCreationHash)
865
- : "",
866
- htlcCreationVout: isSet(object.htlcCreationVout)
867
- ? Number(object.htlcCreationVout)
868
- : 0,
869
- htlcVersion: isSet(object.htlcVersion) ? String(object.htlcVersion) : "",
870
- senderPubKey: isSet(object.senderPubKey)
871
- ? bytesFromBase64(object.senderPubKey)
872
- : new Uint8Array(),
873
- };
874
- },
875
-
876
- toJSON(message: MsgRequestProvisionTransaction): unknown {
877
- const obj: any = {};
878
- message.creator !== undefined && (obj.creator = message.creator);
879
- message.chain !== undefined && (obj.chain = message.chain);
880
- message.fromAddress !== undefined &&
881
- (obj.fromAddress = message.fromAddress);
882
- message.symbol !== undefined && (obj.symbol = message.symbol);
883
- message.amount !== undefined && (obj.amount = message.amount);
884
- message.options !== undefined && (obj.options = message.options);
885
- message.htlcExpirationTimestamp !== undefined &&
886
- (obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
887
- message.htlcCreationHash !== undefined &&
888
- (obj.htlcCreationHash = message.htlcCreationHash);
889
- message.htlcCreationVout !== undefined &&
890
- (obj.htlcCreationVout = Math.round(message.htlcCreationVout));
891
- message.htlcVersion !== undefined &&
892
- (obj.htlcVersion = message.htlcVersion);
893
- message.senderPubKey !== undefined &&
894
- (obj.senderPubKey = base64FromBytes(
895
- message.senderPubKey !== undefined
896
- ? message.senderPubKey
897
- : new Uint8Array()
898
- ));
899
- return obj;
900
- },
901
-
902
- fromPartial<I extends Exact<DeepPartial<MsgRequestProvisionTransaction>, I>>(
903
- object: I
904
- ): MsgRequestProvisionTransaction {
905
- const message = createBaseMsgRequestProvisionTransaction();
906
- message.creator = object.creator ?? "";
907
- message.chain = object.chain ?? "";
908
- message.fromAddress = object.fromAddress ?? "";
909
- message.symbol = object.symbol ?? "";
910
- message.amount = object.amount ?? "";
911
- message.options = object.options ?? "";
912
- message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
913
- message.htlcCreationHash = object.htlcCreationHash ?? "";
914
- message.htlcCreationVout = object.htlcCreationVout ?? 0;
915
- message.htlcVersion = object.htlcVersion ?? "";
916
- message.senderPubKey = object.senderPubKey ?? new Uint8Array();
917
- return message;
918
- },
919
- };
920
-
921
- function createBaseMsgRequestProvisionTransactionResponse(): MsgRequestProvisionTransactionResponse {
922
- return { code: "", msg: "", txId: 0 };
923
- }
924
-
925
- export const MsgRequestProvisionTransactionResponse = {
926
- encode(
927
- message: MsgRequestProvisionTransactionResponse,
928
- writer: _m0.Writer = _m0.Writer.create()
929
- ): _m0.Writer {
930
- if (message.code !== "") {
931
- writer.uint32(10).string(message.code);
932
- }
933
- if (message.msg !== "") {
934
- writer.uint32(18).string(message.msg);
935
- }
936
- if (message.txId !== 0) {
937
- writer.uint32(24).uint64(message.txId);
938
- }
939
- return writer;
940
- },
941
-
942
- decode(
943
- input: _m0.Reader | Uint8Array,
944
- length?: number
945
- ): MsgRequestProvisionTransactionResponse {
946
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
947
- let end = length === undefined ? reader.len : reader.pos + length;
948
- const message = createBaseMsgRequestProvisionTransactionResponse();
949
- while (reader.pos < end) {
950
- const tag = reader.uint32();
951
- switch (tag >>> 3) {
952
- case 1:
953
- message.code = reader.string();
954
- break;
955
- case 2:
956
- message.msg = reader.string();
957
- break;
958
- case 3:
959
- message.txId = longToNumber(reader.uint64() as Long);
960
- break;
961
- default:
962
- reader.skipType(tag & 7);
963
- break;
964
- }
965
- }
966
- return message;
967
- },
968
-
969
- fromJSON(object: any): MsgRequestProvisionTransactionResponse {
970
- return {
971
- code: isSet(object.code) ? String(object.code) : "",
972
- msg: isSet(object.msg) ? String(object.msg) : "",
973
- txId: isSet(object.txId) ? Number(object.txId) : 0,
974
- };
975
- },
976
-
977
- toJSON(message: MsgRequestProvisionTransactionResponse): unknown {
978
- const obj: any = {};
979
- message.code !== undefined && (obj.code = message.code);
980
- message.msg !== undefined && (obj.msg = message.msg);
981
- message.txId !== undefined && (obj.txId = Math.round(message.txId));
982
- return obj;
983
- },
984
-
985
- fromPartial<
986
- I extends Exact<DeepPartial<MsgRequestProvisionTransactionResponse>, I>
987
- >(object: I): MsgRequestProvisionTransactionResponse {
988
- const message = createBaseMsgRequestProvisionTransactionResponse();
989
- message.code = object.code ?? "";
990
- message.msg = object.msg ?? "";
991
- message.txId = object.txId ?? 0;
992
- return message;
993
- },
994
- };
995
-
996
- function createBaseMsgCancelTransaction(): MsgCancelTransaction {
997
- return { creator: "", transactionId: "" };
998
- }
999
-
1000
- export const MsgCancelTransaction = {
1001
- encode(
1002
- message: MsgCancelTransaction,
1003
- writer: _m0.Writer = _m0.Writer.create()
1004
- ): _m0.Writer {
1005
- if (message.creator !== "") {
1006
- writer.uint32(10).string(message.creator);
1007
- }
1008
- if (message.transactionId !== "") {
1009
- writer.uint32(18).string(message.transactionId);
1010
- }
1011
- return writer;
1012
- },
1013
-
1014
- decode(
1015
- input: _m0.Reader | Uint8Array,
1016
- length?: number
1017
- ): MsgCancelTransaction {
1018
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1019
- let end = length === undefined ? reader.len : reader.pos + length;
1020
- const message = createBaseMsgCancelTransaction();
1021
- while (reader.pos < end) {
1022
- const tag = reader.uint32();
1023
- switch (tag >>> 3) {
1024
- case 1:
1025
- message.creator = reader.string();
1026
- break;
1027
- case 2:
1028
- message.transactionId = reader.string();
1029
- break;
1030
- default:
1031
- reader.skipType(tag & 7);
1032
- break;
1033
- }
1034
- }
1035
- return message;
1036
- },
1037
-
1038
- fromJSON(object: any): MsgCancelTransaction {
1039
- return {
1040
- creator: isSet(object.creator) ? String(object.creator) : "",
1041
- transactionId: isSet(object.transactionId)
1042
- ? String(object.transactionId)
1043
- : "",
1044
- };
1045
- },
1046
-
1047
- toJSON(message: MsgCancelTransaction): unknown {
1048
- const obj: any = {};
1049
- message.creator !== undefined && (obj.creator = message.creator);
1050
- message.transactionId !== undefined &&
1051
- (obj.transactionId = message.transactionId);
1052
- return obj;
1053
- },
1054
-
1055
- fromPartial<I extends Exact<DeepPartial<MsgCancelTransaction>, I>>(
1056
- object: I
1057
- ): MsgCancelTransaction {
1058
- const message = createBaseMsgCancelTransaction();
1059
- message.creator = object.creator ?? "";
1060
- message.transactionId = object.transactionId ?? "";
1061
- return message;
1062
- },
1063
- };
1064
-
1065
- function createBaseMsgCancelTransactionResponse(): MsgCancelTransactionResponse {
1066
- return { code: "", msg: "" };
1067
- }
1068
-
1069
- export const MsgCancelTransactionResponse = {
1070
- encode(
1071
- message: MsgCancelTransactionResponse,
1072
- writer: _m0.Writer = _m0.Writer.create()
1073
- ): _m0.Writer {
1074
- if (message.code !== "") {
1075
- writer.uint32(10).string(message.code);
1076
- }
1077
- if (message.msg !== "") {
1078
- writer.uint32(18).string(message.msg);
1079
- }
1080
- return writer;
1081
- },
1082
-
1083
- decode(
1084
- input: _m0.Reader | Uint8Array,
1085
- length?: number
1086
- ): MsgCancelTransactionResponse {
1087
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1088
- let end = length === undefined ? reader.len : reader.pos + length;
1089
- const message = createBaseMsgCancelTransactionResponse();
1090
- while (reader.pos < end) {
1091
- const tag = reader.uint32();
1092
- switch (tag >>> 3) {
1093
- case 1:
1094
- message.code = reader.string();
1095
- break;
1096
- case 2:
1097
- message.msg = reader.string();
1098
- break;
1099
- default:
1100
- reader.skipType(tag & 7);
1101
- break;
1102
- }
1103
- }
1104
- return message;
1105
- },
1106
-
1107
- fromJSON(object: any): MsgCancelTransactionResponse {
1108
- return {
1109
- code: isSet(object.code) ? String(object.code) : "",
1110
- msg: isSet(object.msg) ? String(object.msg) : "",
1111
- };
1112
- },
1113
-
1114
- toJSON(message: MsgCancelTransactionResponse): unknown {
1115
- const obj: any = {};
1116
- message.code !== undefined && (obj.code = message.code);
1117
- message.msg !== undefined && (obj.msg = message.msg);
1118
- return obj;
1119
- },
1120
-
1121
- fromPartial<I extends Exact<DeepPartial<MsgCancelTransactionResponse>, I>>(
1122
- object: I
1123
- ): MsgCancelTransactionResponse {
1124
- const message = createBaseMsgCancelTransactionResponse();
1125
- message.code = object.code ?? "";
1126
- message.msg = object.msg ?? "";
1127
- return message;
1128
- },
1129
- };
1130
-
1131
- function createBaseMsgSetTxHash(): MsgSetTxHash {
1132
- return { creator: "", txId: 0, txHash: "", txType: "" };
1133
- }
1134
-
1135
- export const MsgSetTxHash = {
1136
- encode(
1137
- message: MsgSetTxHash,
1138
- writer: _m0.Writer = _m0.Writer.create()
1139
- ): _m0.Writer {
1140
- if (message.creator !== "") {
1141
- writer.uint32(10).string(message.creator);
1142
- }
1143
- if (message.txId !== 0) {
1144
- writer.uint32(16).uint64(message.txId);
1145
- }
1146
- if (message.txHash !== "") {
1147
- writer.uint32(26).string(message.txHash);
1148
- }
1149
- if (message.txType !== "") {
1150
- writer.uint32(34).string(message.txType);
1151
- }
1152
- return writer;
1153
- },
1154
-
1155
- decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetTxHash {
1156
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1157
- let end = length === undefined ? reader.len : reader.pos + length;
1158
- const message = createBaseMsgSetTxHash();
1159
- while (reader.pos < end) {
1160
- const tag = reader.uint32();
1161
- switch (tag >>> 3) {
1162
- case 1:
1163
- message.creator = reader.string();
1164
- break;
1165
- case 2:
1166
- message.txId = longToNumber(reader.uint64() as Long);
1167
- break;
1168
- case 3:
1169
- message.txHash = reader.string();
1170
- break;
1171
- case 4:
1172
- message.txType = reader.string();
1173
- break;
1174
- default:
1175
- reader.skipType(tag & 7);
1176
- break;
1177
- }
1178
- }
1179
- return message;
1180
- },
1181
-
1182
- fromJSON(object: any): MsgSetTxHash {
1183
- return {
1184
- creator: isSet(object.creator) ? String(object.creator) : "",
1185
- txId: isSet(object.txId) ? Number(object.txId) : 0,
1186
- txHash: isSet(object.txHash) ? String(object.txHash) : "",
1187
- txType: isSet(object.txType) ? String(object.txType) : "",
1188
- };
1189
- },
1190
-
1191
- toJSON(message: MsgSetTxHash): unknown {
1192
- const obj: any = {};
1193
- message.creator !== undefined && (obj.creator = message.creator);
1194
- message.txId !== undefined && (obj.txId = Math.round(message.txId));
1195
- message.txHash !== undefined && (obj.txHash = message.txHash);
1196
- message.txType !== undefined && (obj.txType = message.txType);
1197
- return obj;
1198
- },
1199
-
1200
- fromPartial<I extends Exact<DeepPartial<MsgSetTxHash>, I>>(
1201
- object: I
1202
- ): MsgSetTxHash {
1203
- const message = createBaseMsgSetTxHash();
1204
- message.creator = object.creator ?? "";
1205
- message.txId = object.txId ?? 0;
1206
- message.txHash = object.txHash ?? "";
1207
- message.txType = object.txType ?? "";
1208
- return message;
1209
- },
1210
- };
1211
-
1212
- function createBaseMsgSetTxHashResponse(): MsgSetTxHashResponse {
1213
- return { code: "", msg: "" };
1214
- }
1215
-
1216
- export const MsgSetTxHashResponse = {
1217
- encode(
1218
- message: MsgSetTxHashResponse,
1219
- writer: _m0.Writer = _m0.Writer.create()
1220
- ): _m0.Writer {
1221
- if (message.code !== "") {
1222
- writer.uint32(10).string(message.code);
1223
- }
1224
- if (message.msg !== "") {
1225
- writer.uint32(18).string(message.msg);
1226
- }
1227
- return writer;
1228
- },
1229
-
1230
- decode(
1231
- input: _m0.Reader | Uint8Array,
1232
- length?: number
1233
- ): MsgSetTxHashResponse {
1234
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1235
- let end = length === undefined ? reader.len : reader.pos + length;
1236
- const message = createBaseMsgSetTxHashResponse();
1237
- while (reader.pos < end) {
1238
- const tag = reader.uint32();
1239
- switch (tag >>> 3) {
1240
- case 1:
1241
- message.code = reader.string();
1242
- break;
1243
- case 2:
1244
- message.msg = reader.string();
1245
- break;
1246
- default:
1247
- reader.skipType(tag & 7);
1248
- break;
1249
- }
1250
- }
1251
- return message;
1252
- },
1253
-
1254
- fromJSON(object: any): MsgSetTxHashResponse {
1255
- return {
1256
- code: isSet(object.code) ? String(object.code) : "",
1257
- msg: isSet(object.msg) ? String(object.msg) : "",
1258
- };
1259
- },
1260
-
1261
- toJSON(message: MsgSetTxHashResponse): unknown {
1262
- const obj: any = {};
1263
- message.code !== undefined && (obj.code = message.code);
1264
- message.msg !== undefined && (obj.msg = message.msg);
1265
- return obj;
1266
- },
1267
-
1268
- fromPartial<I extends Exact<DeepPartial<MsgSetTxHashResponse>, I>>(
1269
- object: I
1270
- ): MsgSetTxHashResponse {
1271
- const message = createBaseMsgSetTxHashResponse();
1272
- message.code = object.code ?? "";
1273
- message.msg = object.msg ?? "";
1274
- return message;
1275
- },
1276
- };
1277
-
1278
- function createBaseMsgSetTxProcess(): MsgSetTxProcess {
1279
- return { creator: "", txId: 0, timestamp: 0, msgId: "", txType: "" };
1280
- }
1281
-
1282
- export const MsgSetTxProcess = {
1283
- encode(
1284
- message: MsgSetTxProcess,
1285
- writer: _m0.Writer = _m0.Writer.create()
1286
- ): _m0.Writer {
1287
- if (message.creator !== "") {
1288
- writer.uint32(10).string(message.creator);
1289
- }
1290
- if (message.txId !== 0) {
1291
- writer.uint32(16).uint64(message.txId);
1292
- }
1293
- if (message.timestamp !== 0) {
1294
- writer.uint32(24).uint64(message.timestamp);
1295
- }
1296
- if (message.msgId !== "") {
1297
- writer.uint32(34).string(message.msgId);
1298
- }
1299
- if (message.txType !== "") {
1300
- writer.uint32(42).string(message.txType);
1301
- }
1302
- return writer;
1303
- },
1304
-
1305
- decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetTxProcess {
1306
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1307
- let end = length === undefined ? reader.len : reader.pos + length;
1308
- const message = createBaseMsgSetTxProcess();
1309
- while (reader.pos < end) {
1310
- const tag = reader.uint32();
1311
- switch (tag >>> 3) {
1312
- case 1:
1313
- message.creator = reader.string();
1314
- break;
1315
- case 2:
1316
- message.txId = longToNumber(reader.uint64() as Long);
1317
- break;
1318
- case 3:
1319
- message.timestamp = longToNumber(reader.uint64() as Long);
1320
- break;
1321
- case 4:
1322
- message.msgId = reader.string();
1323
- break;
1324
- case 5:
1325
- message.txType = reader.string();
1326
- break;
1327
- default:
1328
- reader.skipType(tag & 7);
1329
- break;
1330
- }
1331
- }
1332
- return message;
1333
- },
1334
-
1335
- fromJSON(object: any): MsgSetTxProcess {
1336
- return {
1337
- creator: isSet(object.creator) ? String(object.creator) : "",
1338
- txId: isSet(object.txId) ? Number(object.txId) : 0,
1339
- timestamp: isSet(object.timestamp) ? Number(object.timestamp) : 0,
1340
- msgId: isSet(object.msgId) ? String(object.msgId) : "",
1341
- txType: isSet(object.txType) ? String(object.txType) : "",
1342
- };
1343
- },
1344
-
1345
- toJSON(message: MsgSetTxProcess): unknown {
1346
- const obj: any = {};
1347
- message.creator !== undefined && (obj.creator = message.creator);
1348
- message.txId !== undefined && (obj.txId = Math.round(message.txId));
1349
- message.timestamp !== undefined &&
1350
- (obj.timestamp = Math.round(message.timestamp));
1351
- message.msgId !== undefined && (obj.msgId = message.msgId);
1352
- message.txType !== undefined && (obj.txType = message.txType);
1353
- return obj;
1354
- },
1355
-
1356
- fromPartial<I extends Exact<DeepPartial<MsgSetTxProcess>, I>>(
1357
- object: I
1358
- ): MsgSetTxProcess {
1359
- const message = createBaseMsgSetTxProcess();
1360
- message.creator = object.creator ?? "";
1361
- message.txId = object.txId ?? 0;
1362
- message.timestamp = object.timestamp ?? 0;
1363
- message.msgId = object.msgId ?? "";
1364
- message.txType = object.txType ?? "";
1365
- return message;
1366
- },
1367
- };
1368
-
1369
- function createBaseMsgSetTxProcessResponse(): MsgSetTxProcessResponse {
1370
- return {};
1371
- }
1372
-
1373
- export const MsgSetTxProcessResponse = {
1374
- encode(
1375
- _: MsgSetTxProcessResponse,
1376
- writer: _m0.Writer = _m0.Writer.create()
1377
- ): _m0.Writer {
1378
- return writer;
1379
- },
1380
-
1381
- decode(
1382
- input: _m0.Reader | Uint8Array,
1383
- length?: number
1384
- ): MsgSetTxProcessResponse {
1385
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1386
- let end = length === undefined ? reader.len : reader.pos + length;
1387
- const message = createBaseMsgSetTxProcessResponse();
1388
- while (reader.pos < end) {
1389
- const tag = reader.uint32();
1390
- switch (tag >>> 3) {
1391
- default:
1392
- reader.skipType(tag & 7);
1393
- break;
1394
- }
1395
- }
1396
- return message;
1397
- },
1398
-
1399
- fromJSON(_: any): MsgSetTxProcessResponse {
1400
- return {};
1401
- },
1402
-
1403
- toJSON(_: MsgSetTxProcessResponse): unknown {
1404
- const obj: any = {};
1405
- return obj;
1406
- },
1407
-
1408
- fromPartial<I extends Exact<DeepPartial<MsgSetTxProcessResponse>, I>>(
1409
- _: I
1410
- ): MsgSetTxProcessResponse {
1411
- const message = createBaseMsgSetTxProcessResponse();
1412
- return message;
1413
- },
1414
- };
1415
-
1416
- function createBaseMsgRequestDrainTransaction(): MsgRequestDrainTransaction {
1417
- return {
1418
- creator: "",
1419
- toChain: "",
1420
- toAddress: "",
1421
- symbol: "",
1422
- amount: "",
1423
- options: "",
1424
- };
1425
- }
1426
-
1427
- export const MsgRequestDrainTransaction = {
1428
- encode(
1429
- message: MsgRequestDrainTransaction,
1430
- writer: _m0.Writer = _m0.Writer.create()
1431
- ): _m0.Writer {
1432
- if (message.creator !== "") {
1433
- writer.uint32(10).string(message.creator);
1434
- }
1435
- if (message.toChain !== "") {
1436
- writer.uint32(18).string(message.toChain);
1437
- }
1438
- if (message.toAddress !== "") {
1439
- writer.uint32(26).string(message.toAddress);
1440
- }
1441
- if (message.symbol !== "") {
1442
- writer.uint32(34).string(message.symbol);
1443
- }
1444
- if (message.amount !== "") {
1445
- writer.uint32(42).string(message.amount);
1446
- }
1447
- if (message.options !== "") {
1448
- writer.uint32(50).string(message.options);
1449
- }
1450
- return writer;
1451
- },
1452
-
1453
- decode(
1454
- input: _m0.Reader | Uint8Array,
1455
- length?: number
1456
- ): MsgRequestDrainTransaction {
1457
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1458
- let end = length === undefined ? reader.len : reader.pos + length;
1459
- const message = createBaseMsgRequestDrainTransaction();
1460
- while (reader.pos < end) {
1461
- const tag = reader.uint32();
1462
- switch (tag >>> 3) {
1463
- case 1:
1464
- message.creator = reader.string();
1465
- break;
1466
- case 2:
1467
- message.toChain = reader.string();
1468
- break;
1469
- case 3:
1470
- message.toAddress = reader.string();
1471
- break;
1472
- case 4:
1473
- message.symbol = reader.string();
1474
- break;
1475
- case 5:
1476
- message.amount = reader.string();
1477
- break;
1478
- case 6:
1479
- message.options = reader.string();
1480
- break;
1481
- default:
1482
- reader.skipType(tag & 7);
1483
- break;
1484
- }
1485
- }
1486
- return message;
1487
- },
1488
-
1489
- fromJSON(object: any): MsgRequestDrainTransaction {
1490
- return {
1491
- creator: isSet(object.creator) ? String(object.creator) : "",
1492
- toChain: isSet(object.toChain) ? String(object.toChain) : "",
1493
- toAddress: isSet(object.toAddress) ? String(object.toAddress) : "",
1494
- symbol: isSet(object.symbol) ? String(object.symbol) : "",
1495
- amount: isSet(object.amount) ? String(object.amount) : "",
1496
- options: isSet(object.options) ? String(object.options) : "",
1497
- };
1498
- },
1499
-
1500
- toJSON(message: MsgRequestDrainTransaction): unknown {
1501
- const obj: any = {};
1502
- message.creator !== undefined && (obj.creator = message.creator);
1503
- message.toChain !== undefined && (obj.toChain = message.toChain);
1504
- message.toAddress !== undefined && (obj.toAddress = message.toAddress);
1505
- message.symbol !== undefined && (obj.symbol = message.symbol);
1506
- message.amount !== undefined && (obj.amount = message.amount);
1507
- message.options !== undefined && (obj.options = message.options);
1508
- return obj;
1509
- },
1510
-
1511
- fromPartial<I extends Exact<DeepPartial<MsgRequestDrainTransaction>, I>>(
1512
- object: I
1513
- ): MsgRequestDrainTransaction {
1514
- const message = createBaseMsgRequestDrainTransaction();
1515
- message.creator = object.creator ?? "";
1516
- message.toChain = object.toChain ?? "";
1517
- message.toAddress = object.toAddress ?? "";
1518
- message.symbol = object.symbol ?? "";
1519
- message.amount = object.amount ?? "";
1520
- message.options = object.options ?? "";
1521
- return message;
1522
- },
1523
- };
1524
-
1525
- function createBaseMsgRequestDrainTransactionResponse(): MsgRequestDrainTransactionResponse {
1526
- return { code: "", msg: "", txId: 0 };
1527
- }
1528
-
1529
- export const MsgRequestDrainTransactionResponse = {
1530
- encode(
1531
- message: MsgRequestDrainTransactionResponse,
1532
- writer: _m0.Writer = _m0.Writer.create()
1533
- ): _m0.Writer {
1534
- if (message.code !== "") {
1535
- writer.uint32(10).string(message.code);
1536
- }
1537
- if (message.msg !== "") {
1538
- writer.uint32(18).string(message.msg);
1539
- }
1540
- if (message.txId !== 0) {
1541
- writer.uint32(24).uint64(message.txId);
1542
- }
1543
- return writer;
1544
- },
1545
-
1546
- decode(
1547
- input: _m0.Reader | Uint8Array,
1548
- length?: number
1549
- ): MsgRequestDrainTransactionResponse {
1550
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1551
- let end = length === undefined ? reader.len : reader.pos + length;
1552
- const message = createBaseMsgRequestDrainTransactionResponse();
1553
- while (reader.pos < end) {
1554
- const tag = reader.uint32();
1555
- switch (tag >>> 3) {
1556
- case 1:
1557
- message.code = reader.string();
1558
- break;
1559
- case 2:
1560
- message.msg = reader.string();
1561
- break;
1562
- case 3:
1563
- message.txId = longToNumber(reader.uint64() as Long);
1564
- break;
1565
- default:
1566
- reader.skipType(tag & 7);
1567
- break;
1568
- }
1569
- }
1570
- return message;
1571
- },
1572
-
1573
- fromJSON(object: any): MsgRequestDrainTransactionResponse {
1574
- return {
1575
- code: isSet(object.code) ? String(object.code) : "",
1576
- msg: isSet(object.msg) ? String(object.msg) : "",
1577
- txId: isSet(object.txId) ? Number(object.txId) : 0,
1578
- };
1579
- },
1580
-
1581
- toJSON(message: MsgRequestDrainTransactionResponse): unknown {
1582
- const obj: any = {};
1583
- message.code !== undefined && (obj.code = message.code);
1584
- message.msg !== undefined && (obj.msg = message.msg);
1585
- message.txId !== undefined && (obj.txId = Math.round(message.txId));
1586
- return obj;
1587
- },
1588
-
1589
- fromPartial<
1590
- I extends Exact<DeepPartial<MsgRequestDrainTransactionResponse>, I>
1591
- >(object: I): MsgRequestDrainTransactionResponse {
1592
- const message = createBaseMsgRequestDrainTransactionResponse();
1593
- message.code = object.code ?? "";
1594
- message.msg = object.msg ?? "";
1595
- message.txId = object.txId ?? 0;
1596
- return message;
1597
- },
1598
- };
1599
-
1600
- function createBaseMsgFinalizeDrainTransaction(): MsgFinalizeDrainTransaction {
1601
- return { creator: "", txId: 0, txHash: "", success: "", signedKey: "" };
1602
- }
1603
-
1604
- export const MsgFinalizeDrainTransaction = {
1605
- encode(
1606
- message: MsgFinalizeDrainTransaction,
1607
- writer: _m0.Writer = _m0.Writer.create()
1608
- ): _m0.Writer {
1609
- if (message.creator !== "") {
1610
- writer.uint32(10).string(message.creator);
1611
- }
1612
- if (message.txId !== 0) {
1613
- writer.uint32(16).uint64(message.txId);
1614
- }
1615
- if (message.txHash !== "") {
1616
- writer.uint32(26).string(message.txHash);
1617
- }
1618
- if (message.success !== "") {
1619
- writer.uint32(34).string(message.success);
1620
- }
1621
- if (message.signedKey !== "") {
1622
- writer.uint32(42).string(message.signedKey);
1623
- }
1624
- return writer;
1625
- },
1626
-
1627
- decode(
1628
- input: _m0.Reader | Uint8Array,
1629
- length?: number
1630
- ): MsgFinalizeDrainTransaction {
1631
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1632
- let end = length === undefined ? reader.len : reader.pos + length;
1633
- const message = createBaseMsgFinalizeDrainTransaction();
1634
- while (reader.pos < end) {
1635
- const tag = reader.uint32();
1636
- switch (tag >>> 3) {
1637
- case 1:
1638
- message.creator = reader.string();
1639
- break;
1640
- case 2:
1641
- message.txId = longToNumber(reader.uint64() as Long);
1642
- break;
1643
- case 3:
1644
- message.txHash = reader.string();
1645
- break;
1646
- case 4:
1647
- message.success = reader.string();
1648
- break;
1649
- case 5:
1650
- message.signedKey = reader.string();
1651
- break;
1652
- default:
1653
- reader.skipType(tag & 7);
1654
- break;
1655
- }
1656
- }
1657
- return message;
1658
- },
1659
-
1660
- fromJSON(object: any): MsgFinalizeDrainTransaction {
1661
- return {
1662
- creator: isSet(object.creator) ? String(object.creator) : "",
1663
- txId: isSet(object.txId) ? Number(object.txId) : 0,
1664
- txHash: isSet(object.txHash) ? String(object.txHash) : "",
1665
- success: isSet(object.success) ? String(object.success) : "",
1666
- signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
1667
- };
1668
- },
1669
-
1670
- toJSON(message: MsgFinalizeDrainTransaction): unknown {
1671
- const obj: any = {};
1672
- message.creator !== undefined && (obj.creator = message.creator);
1673
- message.txId !== undefined && (obj.txId = Math.round(message.txId));
1674
- message.txHash !== undefined && (obj.txHash = message.txHash);
1675
- message.success !== undefined && (obj.success = message.success);
1676
- message.signedKey !== undefined && (obj.signedKey = message.signedKey);
1677
- return obj;
1678
- },
1679
-
1680
- fromPartial<I extends Exact<DeepPartial<MsgFinalizeDrainTransaction>, I>>(
1681
- object: I
1682
- ): MsgFinalizeDrainTransaction {
1683
- const message = createBaseMsgFinalizeDrainTransaction();
1684
- message.creator = object.creator ?? "";
1685
- message.txId = object.txId ?? 0;
1686
- message.txHash = object.txHash ?? "";
1687
- message.success = object.success ?? "";
1688
- message.signedKey = object.signedKey ?? "";
1689
- return message;
1690
- },
1691
- };
1692
-
1693
- function createBaseMsgFinalizeDrainTransactionResponse(): MsgFinalizeDrainTransactionResponse {
1694
- return { code: "", msg: "" };
1695
- }
1696
-
1697
- export const MsgFinalizeDrainTransactionResponse = {
1698
- encode(
1699
- message: MsgFinalizeDrainTransactionResponse,
1700
- writer: _m0.Writer = _m0.Writer.create()
1701
- ): _m0.Writer {
1702
- if (message.code !== "") {
1703
- writer.uint32(10).string(message.code);
1704
- }
1705
- if (message.msg !== "") {
1706
- writer.uint32(18).string(message.msg);
1707
- }
1708
- return writer;
1709
- },
1710
-
1711
- decode(
1712
- input: _m0.Reader | Uint8Array,
1713
- length?: number
1714
- ): MsgFinalizeDrainTransactionResponse {
1715
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1716
- let end = length === undefined ? reader.len : reader.pos + length;
1717
- const message = createBaseMsgFinalizeDrainTransactionResponse();
1718
- while (reader.pos < end) {
1719
- const tag = reader.uint32();
1720
- switch (tag >>> 3) {
1721
- case 1:
1722
- message.code = reader.string();
1723
- break;
1724
- case 2:
1725
- message.msg = reader.string();
1726
- break;
1727
- default:
1728
- reader.skipType(tag & 7);
1729
- break;
1730
- }
1731
- }
1732
- return message;
1733
- },
1734
-
1735
- fromJSON(object: any): MsgFinalizeDrainTransactionResponse {
1736
- return {
1737
- code: isSet(object.code) ? String(object.code) : "",
1738
- msg: isSet(object.msg) ? String(object.msg) : "",
1739
- };
1740
- },
1741
-
1742
- toJSON(message: MsgFinalizeDrainTransactionResponse): unknown {
1743
- const obj: any = {};
1744
- message.code !== undefined && (obj.code = message.code);
1745
- message.msg !== undefined && (obj.msg = message.msg);
1746
- return obj;
1747
- },
1748
-
1749
- fromPartial<
1750
- I extends Exact<DeepPartial<MsgFinalizeDrainTransactionResponse>, I>
1751
- >(object: I): MsgFinalizeDrainTransactionResponse {
1752
- const message = createBaseMsgFinalizeDrainTransactionResponse();
1753
- message.code = object.code ?? "";
1754
- message.msg = object.msg ?? "";
1755
- return message;
1756
- },
1757
- };
1758
-
1759
- /** Msg defines the Msg service. */
1760
- export interface Msg {
1761
- RequestTransaction(
1762
- request: MsgRequestTransaction
1763
- ): Promise<MsgRequestTransactionResponse>;
1764
- FinalizeTransaction(
1765
- request: MsgFinalizeTransaction
1766
- ): Promise<MsgFinalizeTransactionResponse>;
1767
- RequestProvisionTransaction(
1768
- request: MsgRequestProvisionTransaction
1769
- ): Promise<MsgRequestProvisionTransactionResponse>;
1770
- CancelTransaction(
1771
- request: MsgCancelTransaction
1772
- ): Promise<MsgCancelTransactionResponse>;
1773
- SetTxHash(request: MsgSetTxHash): Promise<MsgSetTxHashResponse>;
1774
- SetTxProcess(request: MsgSetTxProcess): Promise<MsgSetTxProcessResponse>;
1775
- FinalizeProvisionTransaction(
1776
- request: MsgFinalizeProvisionTransaction
1777
- ): Promise<MsgFinalizeProvisionTransactionResponse>;
1778
- RequestDrainTransaction(
1779
- request: MsgRequestDrainTransaction
1780
- ): Promise<MsgRequestDrainTransactionResponse>;
1781
- FinalizeDrainTransaction(
1782
- request: MsgFinalizeDrainTransaction
1783
- ): Promise<MsgFinalizeDrainTransactionResponse>;
1784
- }
1785
-
1786
- export class MsgClientImpl implements Msg {
1787
- private readonly rpc: Rpc;
1788
- constructor(rpc: Rpc) {
1789
- this.rpc = rpc;
1790
- this.RequestTransaction = this.RequestTransaction.bind(this);
1791
- this.FinalizeTransaction = this.FinalizeTransaction.bind(this);
1792
- this.RequestProvisionTransaction =
1793
- this.RequestProvisionTransaction.bind(this);
1794
- this.CancelTransaction = this.CancelTransaction.bind(this);
1795
- this.SetTxHash = this.SetTxHash.bind(this);
1796
- this.SetTxProcess = this.SetTxProcess.bind(this);
1797
- this.FinalizeProvisionTransaction =
1798
- this.FinalizeProvisionTransaction.bind(this);
1799
- this.RequestDrainTransaction = this.RequestDrainTransaction.bind(this);
1800
- this.FinalizeDrainTransaction = this.FinalizeDrainTransaction.bind(this);
1801
- }
1802
- RequestTransaction(
1803
- request: MsgRequestTransaction
1804
- ): Promise<MsgRequestTransactionResponse> {
1805
- const data = MsgRequestTransaction.encode(request).finish();
1806
- const promise = this.rpc.request(
1807
- "kimablockchain.transaction.Msg",
1808
- "RequestTransaction",
1809
- data
1810
- );
1811
- return promise.then((data) =>
1812
- MsgRequestTransactionResponse.decode(new _m0.Reader(data))
1813
- );
1814
- }
1815
-
1816
- FinalizeTransaction(
1817
- request: MsgFinalizeTransaction
1818
- ): Promise<MsgFinalizeTransactionResponse> {
1819
- const data = MsgFinalizeTransaction.encode(request).finish();
1820
- const promise = this.rpc.request(
1821
- "kimablockchain.transaction.Msg",
1822
- "FinalizeTransaction",
1823
- data
1824
- );
1825
- return promise.then((data) =>
1826
- MsgFinalizeTransactionResponse.decode(new _m0.Reader(data))
1827
- );
1828
- }
1829
-
1830
- RequestProvisionTransaction(
1831
- request: MsgRequestProvisionTransaction
1832
- ): Promise<MsgRequestProvisionTransactionResponse> {
1833
- const data = MsgRequestProvisionTransaction.encode(request).finish();
1834
- const promise = this.rpc.request(
1835
- "kimablockchain.transaction.Msg",
1836
- "RequestProvisionTransaction",
1837
- data
1838
- );
1839
- return promise.then((data) =>
1840
- MsgRequestProvisionTransactionResponse.decode(new _m0.Reader(data))
1841
- );
1842
- }
1843
-
1844
- CancelTransaction(
1845
- request: MsgCancelTransaction
1846
- ): Promise<MsgCancelTransactionResponse> {
1847
- const data = MsgCancelTransaction.encode(request).finish();
1848
- const promise = this.rpc.request(
1849
- "kimablockchain.transaction.Msg",
1850
- "CancelTransaction",
1851
- data
1852
- );
1853
- return promise.then((data) =>
1854
- MsgCancelTransactionResponse.decode(new _m0.Reader(data))
1855
- );
1856
- }
1857
-
1858
- SetTxHash(request: MsgSetTxHash): Promise<MsgSetTxHashResponse> {
1859
- const data = MsgSetTxHash.encode(request).finish();
1860
- const promise = this.rpc.request(
1861
- "kimablockchain.transaction.Msg",
1862
- "SetTxHash",
1863
- data
1864
- );
1865
- return promise.then((data) =>
1866
- MsgSetTxHashResponse.decode(new _m0.Reader(data))
1867
- );
1868
- }
1869
-
1870
- SetTxProcess(request: MsgSetTxProcess): Promise<MsgSetTxProcessResponse> {
1871
- const data = MsgSetTxProcess.encode(request).finish();
1872
- const promise = this.rpc.request(
1873
- "kimablockchain.transaction.Msg",
1874
- "SetTxProcess",
1875
- data
1876
- );
1877
- return promise.then((data) =>
1878
- MsgSetTxProcessResponse.decode(new _m0.Reader(data))
1879
- );
1880
- }
1881
-
1882
- FinalizeProvisionTransaction(
1883
- request: MsgFinalizeProvisionTransaction
1884
- ): Promise<MsgFinalizeProvisionTransactionResponse> {
1885
- const data = MsgFinalizeProvisionTransaction.encode(request).finish();
1886
- const promise = this.rpc.request(
1887
- "kimablockchain.transaction.Msg",
1888
- "FinalizeProvisionTransaction",
1889
- data
1890
- );
1891
- return promise.then((data) =>
1892
- MsgFinalizeProvisionTransactionResponse.decode(new _m0.Reader(data))
1893
- );
1894
- }
1895
-
1896
- RequestDrainTransaction(
1897
- request: MsgRequestDrainTransaction
1898
- ): Promise<MsgRequestDrainTransactionResponse> {
1899
- const data = MsgRequestDrainTransaction.encode(request).finish();
1900
- const promise = this.rpc.request(
1901
- "kimablockchain.transaction.Msg",
1902
- "RequestDrainTransaction",
1903
- data
1904
- );
1905
- return promise.then((data) =>
1906
- MsgRequestDrainTransactionResponse.decode(new _m0.Reader(data))
1907
- );
1908
- }
1909
-
1910
- FinalizeDrainTransaction(
1911
- request: MsgFinalizeDrainTransaction
1912
- ): Promise<MsgFinalizeDrainTransactionResponse> {
1913
- const data = MsgFinalizeDrainTransaction.encode(request).finish();
1914
- const promise = this.rpc.request(
1915
- "kimablockchain.transaction.Msg",
1916
- "FinalizeDrainTransaction",
1917
- data
1918
- );
1919
- return promise.then((data) =>
1920
- MsgFinalizeDrainTransactionResponse.decode(new _m0.Reader(data))
1921
- );
1922
- }
1923
- }
1924
-
1925
- interface Rpc {
1926
- request(
1927
- service: string,
1928
- method: string,
1929
- data: Uint8Array
1930
- ): Promise<Uint8Array>;
1931
- }
1932
-
1933
- declare var self: any | undefined;
1934
- declare var window: any | undefined;
1935
- declare var global: any | undefined;
1936
- var globalThis: any = (() => {
1937
- if (typeof globalThis !== "undefined") {
1938
- return globalThis;
1939
- }
1940
- if (typeof self !== "undefined") {
1941
- return self;
1942
- }
1943
- if (typeof window !== "undefined") {
1944
- return window;
1945
- }
1946
- if (typeof global !== "undefined") {
1947
- return global;
1948
- }
1949
- throw "Unable to locate global object";
1950
- })();
1951
-
1952
- function bytesFromBase64(b64: string): Uint8Array {
1953
- if (globalThis.Buffer) {
1954
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1955
- } else {
1956
- const bin = globalThis.atob(b64);
1957
- const arr = new Uint8Array(bin.length);
1958
- for (let i = 0; i < bin.length; ++i) {
1959
- arr[i] = bin.charCodeAt(i);
1960
- }
1961
- return arr;
1962
- }
1963
- }
1964
-
1965
- function base64FromBytes(arr: Uint8Array): string {
1966
- if (globalThis.Buffer) {
1967
- return globalThis.Buffer.from(arr).toString("base64");
1968
- } else {
1969
- const bin: string[] = [];
1970
- arr.forEach((byte) => {
1971
- bin.push(String.fromCharCode(byte));
1972
- });
1973
- return globalThis.btoa(bin.join(""));
1974
- }
1975
- }
1976
-
1977
- type Builtin =
1978
- | Date
1979
- | Function
1980
- | Uint8Array
1981
- | string
1982
- | number
1983
- | boolean
1984
- | undefined;
1985
-
1986
- export type DeepPartial<T> = T extends Builtin
1987
- ? T
1988
- : T extends Array<infer U>
1989
- ? Array<DeepPartial<U>>
1990
- : T extends ReadonlyArray<infer U>
1991
- ? ReadonlyArray<DeepPartial<U>>
1992
- : T extends {}
1993
- ? { [K in keyof T]?: DeepPartial<T[K]> }
1994
- : Partial<T>;
1995
-
1996
- type KeysOfUnion<T> = T extends T ? keyof T : never;
1997
- export type Exact<P, I extends P> = P extends Builtin
1998
- ? P
1999
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & {
2000
- [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
2001
- };
2002
-
2003
- function longToNumber(long: Long): number {
2004
- if (long.gt(Number.MAX_SAFE_INTEGER)) {
2005
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
2006
- }
2007
- return long.toNumber();
2008
- }
2009
-
2010
- if (_m0.util.Long !== Long) {
2011
- _m0.util.Long = Long as any;
2012
- _m0.configure();
2013
- }
2014
-
2015
- function isSet(value: any): boolean {
2016
- return value !== null && value !== undefined;
2017
- }
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
+ symbol: string;
14
+ amount: string;
15
+ fee: string;
16
+ /** the timestamp when the HTLC contract expires and the user can reclaim the funds locked there */
17
+ htlcExpirationTimestamp: string;
18
+ /** the txhash locking the funds in the HTLC */
19
+ htlcCreationHash: string;
20
+ /** the output index of the locked funds in the HTLC creation transaction */
21
+ htlcCreationVout: number;
22
+ /** a version denoting which HTLC script version is being using for the HTLC transaction */
23
+ htlcVersion: string;
24
+ /** for bitcoin transaction this is the public key of the sender */
25
+ senderPubKey: Uint8Array;
26
+ }
27
+
28
+ export interface MsgRequestTransactionResponse {
29
+ code: string;
30
+ msg: string;
31
+ txId: number;
32
+ }
33
+
34
+ export interface MsgFinalizeTransaction {
35
+ creator: string;
36
+ txId: number;
37
+ txHash: string;
38
+ success: boolean;
39
+ signedKey: string;
40
+ errReason: string;
41
+ }
42
+
43
+ export interface MsgFinalizeTransactionResponse {
44
+ code: string;
45
+ msg: string;
46
+ }
47
+
48
+ export interface MsgFinalizeProvisionTransaction {
49
+ creator: string;
50
+ txId: number;
51
+ txHash: string;
52
+ success: boolean;
53
+ signedKey: string;
54
+ errReason: string;
55
+ }
56
+
57
+ export interface MsgFinalizeProvisionTransactionResponse {
58
+ code: string;
59
+ msg: string;
60
+ }
61
+
62
+ export interface MsgRequestProvisionTransaction {
63
+ creator: string;
64
+ chain: string;
65
+ fromAddress: string;
66
+ symbol: string;
67
+ amount: string;
68
+ options: string;
69
+ /** BTC transaction */
70
+ htlcExpirationTimestamp: string;
71
+ /** the txhash locking the funds in the HTLC */
72
+ htlcCreationHash: string;
73
+ /** the output index of the locked funds in the HTLC creation transaction */
74
+ htlcCreationVout: number;
75
+ /** a version denoting which HTLC script version is being using for the HTLC transaction */
76
+ htlcVersion: string;
77
+ /** the (compressed) public key of the sender */
78
+ senderPubKey: Uint8Array;
79
+ }
80
+
81
+ export interface MsgRequestProvisionTransactionResponse {
82
+ code: string;
83
+ msg: string;
84
+ txId: number;
85
+ }
86
+
87
+ export interface MsgCancelTransaction {
88
+ creator: string;
89
+ transactionId: string;
90
+ }
91
+
92
+ export interface MsgCancelTransactionResponse {
93
+ code: string;
94
+ msg: string;
95
+ }
96
+
97
+ export interface MsgSetTxHash {
98
+ creator: string;
99
+ txId: number;
100
+ txHash: string;
101
+ /** request_transaction, request_provision_transaction, request_drain_transaction */
102
+ txType: string;
103
+ }
104
+
105
+ export interface MsgSetTxHashResponse {
106
+ code: string;
107
+ msg: string;
108
+ }
109
+
110
+ export interface MsgSetTxProcess {
111
+ creator: string;
112
+ txId: number;
113
+ timestamp: number;
114
+ msgId: string;
115
+ /** request_transaction, request_provision_transaction, request_drain_transaction */
116
+ txType: string;
117
+ }
118
+
119
+ export interface MsgSetTxProcessResponse {}
120
+
121
+ export interface MsgRequestDrainTransaction {
122
+ creator: string;
123
+ toChain: string;
124
+ toAddress: string;
125
+ symbol: string;
126
+ amount: string;
127
+ options: string;
128
+ }
129
+
130
+ export interface MsgRequestDrainTransactionResponse {
131
+ code: string;
132
+ msg: string;
133
+ txId: number;
134
+ }
135
+
136
+ export interface MsgFinalizeDrainTransaction {
137
+ creator: string;
138
+ txId: number;
139
+ txHash: string;
140
+ success: boolean;
141
+ signedKey: string;
142
+ errReason: string;
143
+ }
144
+
145
+ export interface MsgFinalizeDrainTransactionResponse {
146
+ code: string;
147
+ msg: string;
148
+ }
149
+
150
+ export interface MsgRequestHtlcLock {
151
+ creator: string;
152
+ fromAddress: string;
153
+ senderPubkey: string;
154
+ amount: string;
155
+ htlcTimeout: string;
156
+ txHash: string;
157
+ htlcAddress: string;
158
+ }
159
+
160
+ export interface MsgRequestHtlcLockResponse {}
161
+
162
+ function createBaseMsgRequestTransaction(): MsgRequestTransaction {
163
+ return {
164
+ creator: "",
165
+ originChain: "",
166
+ originAddress: "",
167
+ targetChain: "",
168
+ targetAddress: "",
169
+ symbol: "",
170
+ amount: "",
171
+ fee: "",
172
+ htlcExpirationTimestamp: "",
173
+ htlcCreationHash: "",
174
+ htlcCreationVout: 0,
175
+ htlcVersion: "",
176
+ senderPubKey: new Uint8Array(),
177
+ };
178
+ }
179
+
180
+ export const MsgRequestTransaction = {
181
+ encode(
182
+ message: MsgRequestTransaction,
183
+ writer: _m0.Writer = _m0.Writer.create()
184
+ ): _m0.Writer {
185
+ if (message.creator !== "") {
186
+ writer.uint32(10).string(message.creator);
187
+ }
188
+ if (message.originChain !== "") {
189
+ writer.uint32(18).string(message.originChain);
190
+ }
191
+ if (message.originAddress !== "") {
192
+ writer.uint32(26).string(message.originAddress);
193
+ }
194
+ if (message.targetChain !== "") {
195
+ writer.uint32(34).string(message.targetChain);
196
+ }
197
+ if (message.targetAddress !== "") {
198
+ writer.uint32(42).string(message.targetAddress);
199
+ }
200
+ if (message.symbol !== "") {
201
+ writer.uint32(50).string(message.symbol);
202
+ }
203
+ if (message.amount !== "") {
204
+ writer.uint32(58).string(message.amount);
205
+ }
206
+ if (message.fee !== "") {
207
+ writer.uint32(66).string(message.fee);
208
+ }
209
+ if (message.htlcExpirationTimestamp !== "") {
210
+ writer.uint32(74).string(message.htlcExpirationTimestamp);
211
+ }
212
+ if (message.htlcCreationHash !== "") {
213
+ writer.uint32(82).string(message.htlcCreationHash);
214
+ }
215
+ if (message.htlcCreationVout !== 0) {
216
+ writer.uint32(88).uint32(message.htlcCreationVout);
217
+ }
218
+ if (message.htlcVersion !== "") {
219
+ writer.uint32(98).string(message.htlcVersion);
220
+ }
221
+ if (message.senderPubKey.length !== 0) {
222
+ writer.uint32(106).bytes(message.senderPubKey);
223
+ }
224
+ return writer;
225
+ },
226
+
227
+ decode(
228
+ input: _m0.Reader | Uint8Array,
229
+ length?: number
230
+ ): MsgRequestTransaction {
231
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
232
+ let end = length === undefined ? reader.len : reader.pos + length;
233
+ const message = createBaseMsgRequestTransaction();
234
+ while (reader.pos < end) {
235
+ const tag = reader.uint32();
236
+ switch (tag >>> 3) {
237
+ case 1:
238
+ message.creator = reader.string();
239
+ break;
240
+ case 2:
241
+ message.originChain = reader.string();
242
+ break;
243
+ case 3:
244
+ message.originAddress = reader.string();
245
+ break;
246
+ case 4:
247
+ message.targetChain = reader.string();
248
+ break;
249
+ case 5:
250
+ message.targetAddress = reader.string();
251
+ break;
252
+ case 6:
253
+ message.symbol = reader.string();
254
+ break;
255
+ case 7:
256
+ message.amount = reader.string();
257
+ break;
258
+ case 8:
259
+ message.fee = reader.string();
260
+ break;
261
+ case 9:
262
+ message.htlcExpirationTimestamp = reader.string();
263
+ break;
264
+ case 10:
265
+ message.htlcCreationHash = reader.string();
266
+ break;
267
+ case 11:
268
+ message.htlcCreationVout = reader.uint32();
269
+ break;
270
+ case 12:
271
+ message.htlcVersion = reader.string();
272
+ break;
273
+ case 13:
274
+ message.senderPubKey = reader.bytes();
275
+ break;
276
+ default:
277
+ reader.skipType(tag & 7);
278
+ break;
279
+ }
280
+ }
281
+ return message;
282
+ },
283
+
284
+ fromJSON(object: any): MsgRequestTransaction {
285
+ return {
286
+ creator: isSet(object.creator) ? String(object.creator) : "",
287
+ originChain: isSet(object.originChain) ? String(object.originChain) : "",
288
+ originAddress: isSet(object.originAddress)
289
+ ? String(object.originAddress)
290
+ : "",
291
+ targetChain: isSet(object.targetChain) ? String(object.targetChain) : "",
292
+ targetAddress: isSet(object.targetAddress)
293
+ ? String(object.targetAddress)
294
+ : "",
295
+ symbol: isSet(object.symbol) ? String(object.symbol) : "",
296
+ amount: isSet(object.amount) ? String(object.amount) : "",
297
+ fee: isSet(object.fee) ? String(object.fee) : "",
298
+ htlcExpirationTimestamp: isSet(object.htlcExpirationTimestamp)
299
+ ? String(object.htlcExpirationTimestamp)
300
+ : "",
301
+ htlcCreationHash: isSet(object.htlcCreationHash)
302
+ ? String(object.htlcCreationHash)
303
+ : "",
304
+ htlcCreationVout: isSet(object.htlcCreationVout)
305
+ ? Number(object.htlcCreationVout)
306
+ : 0,
307
+ htlcVersion: isSet(object.htlcVersion) ? String(object.htlcVersion) : "",
308
+ senderPubKey: isSet(object.senderPubKey)
309
+ ? bytesFromBase64(object.senderPubKey)
310
+ : new Uint8Array(),
311
+ };
312
+ },
313
+
314
+ toJSON(message: MsgRequestTransaction): unknown {
315
+ const obj: any = {};
316
+ message.creator !== undefined && (obj.creator = message.creator);
317
+ message.originChain !== undefined &&
318
+ (obj.originChain = message.originChain);
319
+ message.originAddress !== undefined &&
320
+ (obj.originAddress = message.originAddress);
321
+ message.targetChain !== undefined &&
322
+ (obj.targetChain = message.targetChain);
323
+ message.targetAddress !== undefined &&
324
+ (obj.targetAddress = message.targetAddress);
325
+ message.symbol !== undefined && (obj.symbol = message.symbol);
326
+ message.amount !== undefined && (obj.amount = message.amount);
327
+ message.fee !== undefined && (obj.fee = message.fee);
328
+ message.htlcExpirationTimestamp !== undefined &&
329
+ (obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
330
+ message.htlcCreationHash !== undefined &&
331
+ (obj.htlcCreationHash = message.htlcCreationHash);
332
+ message.htlcCreationVout !== undefined &&
333
+ (obj.htlcCreationVout = Math.round(message.htlcCreationVout));
334
+ message.htlcVersion !== undefined &&
335
+ (obj.htlcVersion = message.htlcVersion);
336
+ message.senderPubKey !== undefined &&
337
+ (obj.senderPubKey = base64FromBytes(
338
+ message.senderPubKey !== undefined
339
+ ? message.senderPubKey
340
+ : new Uint8Array()
341
+ ));
342
+ return obj;
343
+ },
344
+
345
+ fromPartial<I extends Exact<DeepPartial<MsgRequestTransaction>, I>>(
346
+ object: I
347
+ ): MsgRequestTransaction {
348
+ const message = createBaseMsgRequestTransaction();
349
+ message.creator = object.creator ?? "";
350
+ message.originChain = object.originChain ?? "";
351
+ message.originAddress = object.originAddress ?? "";
352
+ message.targetChain = object.targetChain ?? "";
353
+ message.targetAddress = object.targetAddress ?? "";
354
+ message.symbol = object.symbol ?? "";
355
+ message.amount = object.amount ?? "";
356
+ message.fee = object.fee ?? "";
357
+ message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
358
+ message.htlcCreationHash = object.htlcCreationHash ?? "";
359
+ message.htlcCreationVout = object.htlcCreationVout ?? 0;
360
+ message.htlcVersion = object.htlcVersion ?? "";
361
+ message.senderPubKey = object.senderPubKey ?? new Uint8Array();
362
+ return message;
363
+ },
364
+ };
365
+
366
+ function createBaseMsgRequestTransactionResponse(): MsgRequestTransactionResponse {
367
+ return { code: "", msg: "", txId: 0 };
368
+ }
369
+
370
+ export const MsgRequestTransactionResponse = {
371
+ encode(
372
+ message: MsgRequestTransactionResponse,
373
+ writer: _m0.Writer = _m0.Writer.create()
374
+ ): _m0.Writer {
375
+ if (message.code !== "") {
376
+ writer.uint32(10).string(message.code);
377
+ }
378
+ if (message.msg !== "") {
379
+ writer.uint32(18).string(message.msg);
380
+ }
381
+ if (message.txId !== 0) {
382
+ writer.uint32(24).uint64(message.txId);
383
+ }
384
+ return writer;
385
+ },
386
+
387
+ decode(
388
+ input: _m0.Reader | Uint8Array,
389
+ length?: number
390
+ ): MsgRequestTransactionResponse {
391
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
392
+ let end = length === undefined ? reader.len : reader.pos + length;
393
+ const message = createBaseMsgRequestTransactionResponse();
394
+ while (reader.pos < end) {
395
+ const tag = reader.uint32();
396
+ switch (tag >>> 3) {
397
+ case 1:
398
+ message.code = reader.string();
399
+ break;
400
+ case 2:
401
+ message.msg = reader.string();
402
+ break;
403
+ case 3:
404
+ message.txId = longToNumber(reader.uint64() as Long);
405
+ break;
406
+ default:
407
+ reader.skipType(tag & 7);
408
+ break;
409
+ }
410
+ }
411
+ return message;
412
+ },
413
+
414
+ fromJSON(object: any): MsgRequestTransactionResponse {
415
+ return {
416
+ code: isSet(object.code) ? String(object.code) : "",
417
+ msg: isSet(object.msg) ? String(object.msg) : "",
418
+ txId: isSet(object.txId) ? Number(object.txId) : 0,
419
+ };
420
+ },
421
+
422
+ toJSON(message: MsgRequestTransactionResponse): unknown {
423
+ const obj: any = {};
424
+ message.code !== undefined && (obj.code = message.code);
425
+ message.msg !== undefined && (obj.msg = message.msg);
426
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
427
+ return obj;
428
+ },
429
+
430
+ fromPartial<I extends Exact<DeepPartial<MsgRequestTransactionResponse>, I>>(
431
+ object: I
432
+ ): MsgRequestTransactionResponse {
433
+ const message = createBaseMsgRequestTransactionResponse();
434
+ message.code = object.code ?? "";
435
+ message.msg = object.msg ?? "";
436
+ message.txId = object.txId ?? 0;
437
+ return message;
438
+ },
439
+ };
440
+
441
+ function createBaseMsgFinalizeTransaction(): MsgFinalizeTransaction {
442
+ return {
443
+ creator: "",
444
+ txId: 0,
445
+ txHash: "",
446
+ success: false,
447
+ signedKey: "",
448
+ errReason: "",
449
+ };
450
+ }
451
+
452
+ export const MsgFinalizeTransaction = {
453
+ encode(
454
+ message: MsgFinalizeTransaction,
455
+ writer: _m0.Writer = _m0.Writer.create()
456
+ ): _m0.Writer {
457
+ if (message.creator !== "") {
458
+ writer.uint32(10).string(message.creator);
459
+ }
460
+ if (message.txId !== 0) {
461
+ writer.uint32(16).uint64(message.txId);
462
+ }
463
+ if (message.txHash !== "") {
464
+ writer.uint32(26).string(message.txHash);
465
+ }
466
+ if (message.success === true) {
467
+ writer.uint32(32).bool(message.success);
468
+ }
469
+ if (message.signedKey !== "") {
470
+ writer.uint32(42).string(message.signedKey);
471
+ }
472
+ if (message.errReason !== "") {
473
+ writer.uint32(50).string(message.errReason);
474
+ }
475
+ return writer;
476
+ },
477
+
478
+ decode(
479
+ input: _m0.Reader | Uint8Array,
480
+ length?: number
481
+ ): MsgFinalizeTransaction {
482
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
483
+ let end = length === undefined ? reader.len : reader.pos + length;
484
+ const message = createBaseMsgFinalizeTransaction();
485
+ while (reader.pos < end) {
486
+ const tag = reader.uint32();
487
+ switch (tag >>> 3) {
488
+ case 1:
489
+ message.creator = reader.string();
490
+ break;
491
+ case 2:
492
+ message.txId = longToNumber(reader.uint64() as Long);
493
+ break;
494
+ case 3:
495
+ message.txHash = reader.string();
496
+ break;
497
+ case 4:
498
+ message.success = reader.bool();
499
+ break;
500
+ case 5:
501
+ message.signedKey = reader.string();
502
+ break;
503
+ case 6:
504
+ message.errReason = reader.string();
505
+ break;
506
+ default:
507
+ reader.skipType(tag & 7);
508
+ break;
509
+ }
510
+ }
511
+ return message;
512
+ },
513
+
514
+ fromJSON(object: any): MsgFinalizeTransaction {
515
+ return {
516
+ creator: isSet(object.creator) ? String(object.creator) : "",
517
+ txId: isSet(object.txId) ? Number(object.txId) : 0,
518
+ txHash: isSet(object.txHash) ? String(object.txHash) : "",
519
+ success: isSet(object.success) ? Boolean(object.success) : false,
520
+ signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
521
+ errReason: isSet(object.errReason) ? String(object.errReason) : "",
522
+ };
523
+ },
524
+
525
+ toJSON(message: MsgFinalizeTransaction): unknown {
526
+ const obj: any = {};
527
+ message.creator !== undefined && (obj.creator = message.creator);
528
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
529
+ message.txHash !== undefined && (obj.txHash = message.txHash);
530
+ message.success !== undefined && (obj.success = message.success);
531
+ message.signedKey !== undefined && (obj.signedKey = message.signedKey);
532
+ message.errReason !== undefined && (obj.errReason = message.errReason);
533
+ return obj;
534
+ },
535
+
536
+ fromPartial<I extends Exact<DeepPartial<MsgFinalizeTransaction>, I>>(
537
+ object: I
538
+ ): MsgFinalizeTransaction {
539
+ const message = createBaseMsgFinalizeTransaction();
540
+ message.creator = object.creator ?? "";
541
+ message.txId = object.txId ?? 0;
542
+ message.txHash = object.txHash ?? "";
543
+ message.success = object.success ?? false;
544
+ message.signedKey = object.signedKey ?? "";
545
+ message.errReason = object.errReason ?? "";
546
+ return message;
547
+ },
548
+ };
549
+
550
+ function createBaseMsgFinalizeTransactionResponse(): MsgFinalizeTransactionResponse {
551
+ return { code: "", msg: "" };
552
+ }
553
+
554
+ export const MsgFinalizeTransactionResponse = {
555
+ encode(
556
+ message: MsgFinalizeTransactionResponse,
557
+ writer: _m0.Writer = _m0.Writer.create()
558
+ ): _m0.Writer {
559
+ if (message.code !== "") {
560
+ writer.uint32(10).string(message.code);
561
+ }
562
+ if (message.msg !== "") {
563
+ writer.uint32(18).string(message.msg);
564
+ }
565
+ return writer;
566
+ },
567
+
568
+ decode(
569
+ input: _m0.Reader | Uint8Array,
570
+ length?: number
571
+ ): MsgFinalizeTransactionResponse {
572
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
573
+ let end = length === undefined ? reader.len : reader.pos + length;
574
+ const message = createBaseMsgFinalizeTransactionResponse();
575
+ while (reader.pos < end) {
576
+ const tag = reader.uint32();
577
+ switch (tag >>> 3) {
578
+ case 1:
579
+ message.code = reader.string();
580
+ break;
581
+ case 2:
582
+ message.msg = reader.string();
583
+ break;
584
+ default:
585
+ reader.skipType(tag & 7);
586
+ break;
587
+ }
588
+ }
589
+ return message;
590
+ },
591
+
592
+ fromJSON(object: any): MsgFinalizeTransactionResponse {
593
+ return {
594
+ code: isSet(object.code) ? String(object.code) : "",
595
+ msg: isSet(object.msg) ? String(object.msg) : "",
596
+ };
597
+ },
598
+
599
+ toJSON(message: MsgFinalizeTransactionResponse): unknown {
600
+ const obj: any = {};
601
+ message.code !== undefined && (obj.code = message.code);
602
+ message.msg !== undefined && (obj.msg = message.msg);
603
+ return obj;
604
+ },
605
+
606
+ fromPartial<I extends Exact<DeepPartial<MsgFinalizeTransactionResponse>, I>>(
607
+ object: I
608
+ ): MsgFinalizeTransactionResponse {
609
+ const message = createBaseMsgFinalizeTransactionResponse();
610
+ message.code = object.code ?? "";
611
+ message.msg = object.msg ?? "";
612
+ return message;
613
+ },
614
+ };
615
+
616
+ function createBaseMsgFinalizeProvisionTransaction(): MsgFinalizeProvisionTransaction {
617
+ return {
618
+ creator: "",
619
+ txId: 0,
620
+ txHash: "",
621
+ success: false,
622
+ signedKey: "",
623
+ errReason: "",
624
+ };
625
+ }
626
+
627
+ export const MsgFinalizeProvisionTransaction = {
628
+ encode(
629
+ message: MsgFinalizeProvisionTransaction,
630
+ writer: _m0.Writer = _m0.Writer.create()
631
+ ): _m0.Writer {
632
+ if (message.creator !== "") {
633
+ writer.uint32(10).string(message.creator);
634
+ }
635
+ if (message.txId !== 0) {
636
+ writer.uint32(16).uint64(message.txId);
637
+ }
638
+ if (message.txHash !== "") {
639
+ writer.uint32(26).string(message.txHash);
640
+ }
641
+ if (message.success === true) {
642
+ writer.uint32(32).bool(message.success);
643
+ }
644
+ if (message.signedKey !== "") {
645
+ writer.uint32(42).string(message.signedKey);
646
+ }
647
+ if (message.errReason !== "") {
648
+ writer.uint32(50).string(message.errReason);
649
+ }
650
+ return writer;
651
+ },
652
+
653
+ decode(
654
+ input: _m0.Reader | Uint8Array,
655
+ length?: number
656
+ ): MsgFinalizeProvisionTransaction {
657
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
658
+ let end = length === undefined ? reader.len : reader.pos + length;
659
+ const message = createBaseMsgFinalizeProvisionTransaction();
660
+ while (reader.pos < end) {
661
+ const tag = reader.uint32();
662
+ switch (tag >>> 3) {
663
+ case 1:
664
+ message.creator = reader.string();
665
+ break;
666
+ case 2:
667
+ message.txId = longToNumber(reader.uint64() as Long);
668
+ break;
669
+ case 3:
670
+ message.txHash = reader.string();
671
+ break;
672
+ case 4:
673
+ message.success = reader.bool();
674
+ break;
675
+ case 5:
676
+ message.signedKey = reader.string();
677
+ break;
678
+ case 6:
679
+ message.errReason = reader.string();
680
+ break;
681
+ default:
682
+ reader.skipType(tag & 7);
683
+ break;
684
+ }
685
+ }
686
+ return message;
687
+ },
688
+
689
+ fromJSON(object: any): MsgFinalizeProvisionTransaction {
690
+ return {
691
+ creator: isSet(object.creator) ? String(object.creator) : "",
692
+ txId: isSet(object.txId) ? Number(object.txId) : 0,
693
+ txHash: isSet(object.txHash) ? String(object.txHash) : "",
694
+ success: isSet(object.success) ? Boolean(object.success) : false,
695
+ signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
696
+ errReason: isSet(object.errReason) ? String(object.errReason) : "",
697
+ };
698
+ },
699
+
700
+ toJSON(message: MsgFinalizeProvisionTransaction): unknown {
701
+ const obj: any = {};
702
+ message.creator !== undefined && (obj.creator = message.creator);
703
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
704
+ message.txHash !== undefined && (obj.txHash = message.txHash);
705
+ message.success !== undefined && (obj.success = message.success);
706
+ message.signedKey !== undefined && (obj.signedKey = message.signedKey);
707
+ message.errReason !== undefined && (obj.errReason = message.errReason);
708
+ return obj;
709
+ },
710
+
711
+ fromPartial<I extends Exact<DeepPartial<MsgFinalizeProvisionTransaction>, I>>(
712
+ object: I
713
+ ): MsgFinalizeProvisionTransaction {
714
+ const message = createBaseMsgFinalizeProvisionTransaction();
715
+ message.creator = object.creator ?? "";
716
+ message.txId = object.txId ?? 0;
717
+ message.txHash = object.txHash ?? "";
718
+ message.success = object.success ?? false;
719
+ message.signedKey = object.signedKey ?? "";
720
+ message.errReason = object.errReason ?? "";
721
+ return message;
722
+ },
723
+ };
724
+
725
+ function createBaseMsgFinalizeProvisionTransactionResponse(): MsgFinalizeProvisionTransactionResponse {
726
+ return { code: "", msg: "" };
727
+ }
728
+
729
+ export const MsgFinalizeProvisionTransactionResponse = {
730
+ encode(
731
+ message: MsgFinalizeProvisionTransactionResponse,
732
+ writer: _m0.Writer = _m0.Writer.create()
733
+ ): _m0.Writer {
734
+ if (message.code !== "") {
735
+ writer.uint32(10).string(message.code);
736
+ }
737
+ if (message.msg !== "") {
738
+ writer.uint32(18).string(message.msg);
739
+ }
740
+ return writer;
741
+ },
742
+
743
+ decode(
744
+ input: _m0.Reader | Uint8Array,
745
+ length?: number
746
+ ): MsgFinalizeProvisionTransactionResponse {
747
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
748
+ let end = length === undefined ? reader.len : reader.pos + length;
749
+ const message = createBaseMsgFinalizeProvisionTransactionResponse();
750
+ while (reader.pos < end) {
751
+ const tag = reader.uint32();
752
+ switch (tag >>> 3) {
753
+ case 1:
754
+ message.code = reader.string();
755
+ break;
756
+ case 2:
757
+ message.msg = reader.string();
758
+ break;
759
+ default:
760
+ reader.skipType(tag & 7);
761
+ break;
762
+ }
763
+ }
764
+ return message;
765
+ },
766
+
767
+ fromJSON(object: any): MsgFinalizeProvisionTransactionResponse {
768
+ return {
769
+ code: isSet(object.code) ? String(object.code) : "",
770
+ msg: isSet(object.msg) ? String(object.msg) : "",
771
+ };
772
+ },
773
+
774
+ toJSON(message: MsgFinalizeProvisionTransactionResponse): unknown {
775
+ const obj: any = {};
776
+ message.code !== undefined && (obj.code = message.code);
777
+ message.msg !== undefined && (obj.msg = message.msg);
778
+ return obj;
779
+ },
780
+
781
+ fromPartial<
782
+ I extends Exact<DeepPartial<MsgFinalizeProvisionTransactionResponse>, I>
783
+ >(object: I): MsgFinalizeProvisionTransactionResponse {
784
+ const message = createBaseMsgFinalizeProvisionTransactionResponse();
785
+ message.code = object.code ?? "";
786
+ message.msg = object.msg ?? "";
787
+ return message;
788
+ },
789
+ };
790
+
791
+ function createBaseMsgRequestProvisionTransaction(): MsgRequestProvisionTransaction {
792
+ return {
793
+ creator: "",
794
+ chain: "",
795
+ fromAddress: "",
796
+ symbol: "",
797
+ amount: "",
798
+ options: "",
799
+ htlcExpirationTimestamp: "",
800
+ htlcCreationHash: "",
801
+ htlcCreationVout: 0,
802
+ htlcVersion: "",
803
+ senderPubKey: new Uint8Array(),
804
+ };
805
+ }
806
+
807
+ export const MsgRequestProvisionTransaction = {
808
+ encode(
809
+ message: MsgRequestProvisionTransaction,
810
+ writer: _m0.Writer = _m0.Writer.create()
811
+ ): _m0.Writer {
812
+ if (message.creator !== "") {
813
+ writer.uint32(10).string(message.creator);
814
+ }
815
+ if (message.chain !== "") {
816
+ writer.uint32(18).string(message.chain);
817
+ }
818
+ if (message.fromAddress !== "") {
819
+ writer.uint32(26).string(message.fromAddress);
820
+ }
821
+ if (message.symbol !== "") {
822
+ writer.uint32(34).string(message.symbol);
823
+ }
824
+ if (message.amount !== "") {
825
+ writer.uint32(42).string(message.amount);
826
+ }
827
+ if (message.options !== "") {
828
+ writer.uint32(50).string(message.options);
829
+ }
830
+ if (message.htlcExpirationTimestamp !== "") {
831
+ writer.uint32(58).string(message.htlcExpirationTimestamp);
832
+ }
833
+ if (message.htlcCreationHash !== "") {
834
+ writer.uint32(66).string(message.htlcCreationHash);
835
+ }
836
+ if (message.htlcCreationVout !== 0) {
837
+ writer.uint32(72).uint32(message.htlcCreationVout);
838
+ }
839
+ if (message.htlcVersion !== "") {
840
+ writer.uint32(82).string(message.htlcVersion);
841
+ }
842
+ if (message.senderPubKey.length !== 0) {
843
+ writer.uint32(90).bytes(message.senderPubKey);
844
+ }
845
+ return writer;
846
+ },
847
+
848
+ decode(
849
+ input: _m0.Reader | Uint8Array,
850
+ length?: number
851
+ ): MsgRequestProvisionTransaction {
852
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
853
+ let end = length === undefined ? reader.len : reader.pos + length;
854
+ const message = createBaseMsgRequestProvisionTransaction();
855
+ while (reader.pos < end) {
856
+ const tag = reader.uint32();
857
+ switch (tag >>> 3) {
858
+ case 1:
859
+ message.creator = reader.string();
860
+ break;
861
+ case 2:
862
+ message.chain = reader.string();
863
+ break;
864
+ case 3:
865
+ message.fromAddress = reader.string();
866
+ break;
867
+ case 4:
868
+ message.symbol = reader.string();
869
+ break;
870
+ case 5:
871
+ message.amount = reader.string();
872
+ break;
873
+ case 6:
874
+ message.options = reader.string();
875
+ break;
876
+ case 7:
877
+ message.htlcExpirationTimestamp = reader.string();
878
+ break;
879
+ case 8:
880
+ message.htlcCreationHash = reader.string();
881
+ break;
882
+ case 9:
883
+ message.htlcCreationVout = reader.uint32();
884
+ break;
885
+ case 10:
886
+ message.htlcVersion = reader.string();
887
+ break;
888
+ case 11:
889
+ message.senderPubKey = reader.bytes();
890
+ break;
891
+ default:
892
+ reader.skipType(tag & 7);
893
+ break;
894
+ }
895
+ }
896
+ return message;
897
+ },
898
+
899
+ fromJSON(object: any): MsgRequestProvisionTransaction {
900
+ return {
901
+ creator: isSet(object.creator) ? String(object.creator) : "",
902
+ chain: isSet(object.chain) ? String(object.chain) : "",
903
+ fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "",
904
+ symbol: isSet(object.symbol) ? String(object.symbol) : "",
905
+ amount: isSet(object.amount) ? String(object.amount) : "",
906
+ options: isSet(object.options) ? String(object.options) : "",
907
+ htlcExpirationTimestamp: isSet(object.htlcExpirationTimestamp)
908
+ ? String(object.htlcExpirationTimestamp)
909
+ : "",
910
+ htlcCreationHash: isSet(object.htlcCreationHash)
911
+ ? String(object.htlcCreationHash)
912
+ : "",
913
+ htlcCreationVout: isSet(object.htlcCreationVout)
914
+ ? Number(object.htlcCreationVout)
915
+ : 0,
916
+ htlcVersion: isSet(object.htlcVersion) ? String(object.htlcVersion) : "",
917
+ senderPubKey: isSet(object.senderPubKey)
918
+ ? bytesFromBase64(object.senderPubKey)
919
+ : new Uint8Array(),
920
+ };
921
+ },
922
+
923
+ toJSON(message: MsgRequestProvisionTransaction): unknown {
924
+ const obj: any = {};
925
+ message.creator !== undefined && (obj.creator = message.creator);
926
+ message.chain !== undefined && (obj.chain = message.chain);
927
+ message.fromAddress !== undefined &&
928
+ (obj.fromAddress = message.fromAddress);
929
+ message.symbol !== undefined && (obj.symbol = message.symbol);
930
+ message.amount !== undefined && (obj.amount = message.amount);
931
+ message.options !== undefined && (obj.options = message.options);
932
+ message.htlcExpirationTimestamp !== undefined &&
933
+ (obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
934
+ message.htlcCreationHash !== undefined &&
935
+ (obj.htlcCreationHash = message.htlcCreationHash);
936
+ message.htlcCreationVout !== undefined &&
937
+ (obj.htlcCreationVout = Math.round(message.htlcCreationVout));
938
+ message.htlcVersion !== undefined &&
939
+ (obj.htlcVersion = message.htlcVersion);
940
+ message.senderPubKey !== undefined &&
941
+ (obj.senderPubKey = base64FromBytes(
942
+ message.senderPubKey !== undefined
943
+ ? message.senderPubKey
944
+ : new Uint8Array()
945
+ ));
946
+ return obj;
947
+ },
948
+
949
+ fromPartial<I extends Exact<DeepPartial<MsgRequestProvisionTransaction>, I>>(
950
+ object: I
951
+ ): MsgRequestProvisionTransaction {
952
+ const message = createBaseMsgRequestProvisionTransaction();
953
+ message.creator = object.creator ?? "";
954
+ message.chain = object.chain ?? "";
955
+ message.fromAddress = object.fromAddress ?? "";
956
+ message.symbol = object.symbol ?? "";
957
+ message.amount = object.amount ?? "";
958
+ message.options = object.options ?? "";
959
+ message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
960
+ message.htlcCreationHash = object.htlcCreationHash ?? "";
961
+ message.htlcCreationVout = object.htlcCreationVout ?? 0;
962
+ message.htlcVersion = object.htlcVersion ?? "";
963
+ message.senderPubKey = object.senderPubKey ?? new Uint8Array();
964
+ return message;
965
+ },
966
+ };
967
+
968
+ function createBaseMsgRequestProvisionTransactionResponse(): MsgRequestProvisionTransactionResponse {
969
+ return { code: "", msg: "", txId: 0 };
970
+ }
971
+
972
+ export const MsgRequestProvisionTransactionResponse = {
973
+ encode(
974
+ message: MsgRequestProvisionTransactionResponse,
975
+ writer: _m0.Writer = _m0.Writer.create()
976
+ ): _m0.Writer {
977
+ if (message.code !== "") {
978
+ writer.uint32(10).string(message.code);
979
+ }
980
+ if (message.msg !== "") {
981
+ writer.uint32(18).string(message.msg);
982
+ }
983
+ if (message.txId !== 0) {
984
+ writer.uint32(24).uint64(message.txId);
985
+ }
986
+ return writer;
987
+ },
988
+
989
+ decode(
990
+ input: _m0.Reader | Uint8Array,
991
+ length?: number
992
+ ): MsgRequestProvisionTransactionResponse {
993
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
994
+ let end = length === undefined ? reader.len : reader.pos + length;
995
+ const message = createBaseMsgRequestProvisionTransactionResponse();
996
+ while (reader.pos < end) {
997
+ const tag = reader.uint32();
998
+ switch (tag >>> 3) {
999
+ case 1:
1000
+ message.code = reader.string();
1001
+ break;
1002
+ case 2:
1003
+ message.msg = reader.string();
1004
+ break;
1005
+ case 3:
1006
+ message.txId = longToNumber(reader.uint64() as Long);
1007
+ break;
1008
+ default:
1009
+ reader.skipType(tag & 7);
1010
+ break;
1011
+ }
1012
+ }
1013
+ return message;
1014
+ },
1015
+
1016
+ fromJSON(object: any): MsgRequestProvisionTransactionResponse {
1017
+ return {
1018
+ code: isSet(object.code) ? String(object.code) : "",
1019
+ msg: isSet(object.msg) ? String(object.msg) : "",
1020
+ txId: isSet(object.txId) ? Number(object.txId) : 0,
1021
+ };
1022
+ },
1023
+
1024
+ toJSON(message: MsgRequestProvisionTransactionResponse): unknown {
1025
+ const obj: any = {};
1026
+ message.code !== undefined && (obj.code = message.code);
1027
+ message.msg !== undefined && (obj.msg = message.msg);
1028
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
1029
+ return obj;
1030
+ },
1031
+
1032
+ fromPartial<
1033
+ I extends Exact<DeepPartial<MsgRequestProvisionTransactionResponse>, I>
1034
+ >(object: I): MsgRequestProvisionTransactionResponse {
1035
+ const message = createBaseMsgRequestProvisionTransactionResponse();
1036
+ message.code = object.code ?? "";
1037
+ message.msg = object.msg ?? "";
1038
+ message.txId = object.txId ?? 0;
1039
+ return message;
1040
+ },
1041
+ };
1042
+
1043
+ function createBaseMsgCancelTransaction(): MsgCancelTransaction {
1044
+ return { creator: "", transactionId: "" };
1045
+ }
1046
+
1047
+ export const MsgCancelTransaction = {
1048
+ encode(
1049
+ message: MsgCancelTransaction,
1050
+ writer: _m0.Writer = _m0.Writer.create()
1051
+ ): _m0.Writer {
1052
+ if (message.creator !== "") {
1053
+ writer.uint32(10).string(message.creator);
1054
+ }
1055
+ if (message.transactionId !== "") {
1056
+ writer.uint32(18).string(message.transactionId);
1057
+ }
1058
+ return writer;
1059
+ },
1060
+
1061
+ decode(
1062
+ input: _m0.Reader | Uint8Array,
1063
+ length?: number
1064
+ ): MsgCancelTransaction {
1065
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1066
+ let end = length === undefined ? reader.len : reader.pos + length;
1067
+ const message = createBaseMsgCancelTransaction();
1068
+ while (reader.pos < end) {
1069
+ const tag = reader.uint32();
1070
+ switch (tag >>> 3) {
1071
+ case 1:
1072
+ message.creator = reader.string();
1073
+ break;
1074
+ case 2:
1075
+ message.transactionId = reader.string();
1076
+ break;
1077
+ default:
1078
+ reader.skipType(tag & 7);
1079
+ break;
1080
+ }
1081
+ }
1082
+ return message;
1083
+ },
1084
+
1085
+ fromJSON(object: any): MsgCancelTransaction {
1086
+ return {
1087
+ creator: isSet(object.creator) ? String(object.creator) : "",
1088
+ transactionId: isSet(object.transactionId)
1089
+ ? String(object.transactionId)
1090
+ : "",
1091
+ };
1092
+ },
1093
+
1094
+ toJSON(message: MsgCancelTransaction): unknown {
1095
+ const obj: any = {};
1096
+ message.creator !== undefined && (obj.creator = message.creator);
1097
+ message.transactionId !== undefined &&
1098
+ (obj.transactionId = message.transactionId);
1099
+ return obj;
1100
+ },
1101
+
1102
+ fromPartial<I extends Exact<DeepPartial<MsgCancelTransaction>, I>>(
1103
+ object: I
1104
+ ): MsgCancelTransaction {
1105
+ const message = createBaseMsgCancelTransaction();
1106
+ message.creator = object.creator ?? "";
1107
+ message.transactionId = object.transactionId ?? "";
1108
+ return message;
1109
+ },
1110
+ };
1111
+
1112
+ function createBaseMsgCancelTransactionResponse(): MsgCancelTransactionResponse {
1113
+ return { code: "", msg: "" };
1114
+ }
1115
+
1116
+ export const MsgCancelTransactionResponse = {
1117
+ encode(
1118
+ message: MsgCancelTransactionResponse,
1119
+ writer: _m0.Writer = _m0.Writer.create()
1120
+ ): _m0.Writer {
1121
+ if (message.code !== "") {
1122
+ writer.uint32(10).string(message.code);
1123
+ }
1124
+ if (message.msg !== "") {
1125
+ writer.uint32(18).string(message.msg);
1126
+ }
1127
+ return writer;
1128
+ },
1129
+
1130
+ decode(
1131
+ input: _m0.Reader | Uint8Array,
1132
+ length?: number
1133
+ ): MsgCancelTransactionResponse {
1134
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1135
+ let end = length === undefined ? reader.len : reader.pos + length;
1136
+ const message = createBaseMsgCancelTransactionResponse();
1137
+ while (reader.pos < end) {
1138
+ const tag = reader.uint32();
1139
+ switch (tag >>> 3) {
1140
+ case 1:
1141
+ message.code = reader.string();
1142
+ break;
1143
+ case 2:
1144
+ message.msg = reader.string();
1145
+ break;
1146
+ default:
1147
+ reader.skipType(tag & 7);
1148
+ break;
1149
+ }
1150
+ }
1151
+ return message;
1152
+ },
1153
+
1154
+ fromJSON(object: any): MsgCancelTransactionResponse {
1155
+ return {
1156
+ code: isSet(object.code) ? String(object.code) : "",
1157
+ msg: isSet(object.msg) ? String(object.msg) : "",
1158
+ };
1159
+ },
1160
+
1161
+ toJSON(message: MsgCancelTransactionResponse): unknown {
1162
+ const obj: any = {};
1163
+ message.code !== undefined && (obj.code = message.code);
1164
+ message.msg !== undefined && (obj.msg = message.msg);
1165
+ return obj;
1166
+ },
1167
+
1168
+ fromPartial<I extends Exact<DeepPartial<MsgCancelTransactionResponse>, I>>(
1169
+ object: I
1170
+ ): MsgCancelTransactionResponse {
1171
+ const message = createBaseMsgCancelTransactionResponse();
1172
+ message.code = object.code ?? "";
1173
+ message.msg = object.msg ?? "";
1174
+ return message;
1175
+ },
1176
+ };
1177
+
1178
+ function createBaseMsgSetTxHash(): MsgSetTxHash {
1179
+ return { creator: "", txId: 0, txHash: "", txType: "" };
1180
+ }
1181
+
1182
+ export const MsgSetTxHash = {
1183
+ encode(
1184
+ message: MsgSetTxHash,
1185
+ writer: _m0.Writer = _m0.Writer.create()
1186
+ ): _m0.Writer {
1187
+ if (message.creator !== "") {
1188
+ writer.uint32(10).string(message.creator);
1189
+ }
1190
+ if (message.txId !== 0) {
1191
+ writer.uint32(16).uint64(message.txId);
1192
+ }
1193
+ if (message.txHash !== "") {
1194
+ writer.uint32(26).string(message.txHash);
1195
+ }
1196
+ if (message.txType !== "") {
1197
+ writer.uint32(34).string(message.txType);
1198
+ }
1199
+ return writer;
1200
+ },
1201
+
1202
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetTxHash {
1203
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1204
+ let end = length === undefined ? reader.len : reader.pos + length;
1205
+ const message = createBaseMsgSetTxHash();
1206
+ while (reader.pos < end) {
1207
+ const tag = reader.uint32();
1208
+ switch (tag >>> 3) {
1209
+ case 1:
1210
+ message.creator = reader.string();
1211
+ break;
1212
+ case 2:
1213
+ message.txId = longToNumber(reader.uint64() as Long);
1214
+ break;
1215
+ case 3:
1216
+ message.txHash = reader.string();
1217
+ break;
1218
+ case 4:
1219
+ message.txType = reader.string();
1220
+ break;
1221
+ default:
1222
+ reader.skipType(tag & 7);
1223
+ break;
1224
+ }
1225
+ }
1226
+ return message;
1227
+ },
1228
+
1229
+ fromJSON(object: any): MsgSetTxHash {
1230
+ return {
1231
+ creator: isSet(object.creator) ? String(object.creator) : "",
1232
+ txId: isSet(object.txId) ? Number(object.txId) : 0,
1233
+ txHash: isSet(object.txHash) ? String(object.txHash) : "",
1234
+ txType: isSet(object.txType) ? String(object.txType) : "",
1235
+ };
1236
+ },
1237
+
1238
+ toJSON(message: MsgSetTxHash): unknown {
1239
+ const obj: any = {};
1240
+ message.creator !== undefined && (obj.creator = message.creator);
1241
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
1242
+ message.txHash !== undefined && (obj.txHash = message.txHash);
1243
+ message.txType !== undefined && (obj.txType = message.txType);
1244
+ return obj;
1245
+ },
1246
+
1247
+ fromPartial<I extends Exact<DeepPartial<MsgSetTxHash>, I>>(
1248
+ object: I
1249
+ ): MsgSetTxHash {
1250
+ const message = createBaseMsgSetTxHash();
1251
+ message.creator = object.creator ?? "";
1252
+ message.txId = object.txId ?? 0;
1253
+ message.txHash = object.txHash ?? "";
1254
+ message.txType = object.txType ?? "";
1255
+ return message;
1256
+ },
1257
+ };
1258
+
1259
+ function createBaseMsgSetTxHashResponse(): MsgSetTxHashResponse {
1260
+ return { code: "", msg: "" };
1261
+ }
1262
+
1263
+ export const MsgSetTxHashResponse = {
1264
+ encode(
1265
+ message: MsgSetTxHashResponse,
1266
+ writer: _m0.Writer = _m0.Writer.create()
1267
+ ): _m0.Writer {
1268
+ if (message.code !== "") {
1269
+ writer.uint32(10).string(message.code);
1270
+ }
1271
+ if (message.msg !== "") {
1272
+ writer.uint32(18).string(message.msg);
1273
+ }
1274
+ return writer;
1275
+ },
1276
+
1277
+ decode(
1278
+ input: _m0.Reader | Uint8Array,
1279
+ length?: number
1280
+ ): MsgSetTxHashResponse {
1281
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1282
+ let end = length === undefined ? reader.len : reader.pos + length;
1283
+ const message = createBaseMsgSetTxHashResponse();
1284
+ while (reader.pos < end) {
1285
+ const tag = reader.uint32();
1286
+ switch (tag >>> 3) {
1287
+ case 1:
1288
+ message.code = reader.string();
1289
+ break;
1290
+ case 2:
1291
+ message.msg = reader.string();
1292
+ break;
1293
+ default:
1294
+ reader.skipType(tag & 7);
1295
+ break;
1296
+ }
1297
+ }
1298
+ return message;
1299
+ },
1300
+
1301
+ fromJSON(object: any): MsgSetTxHashResponse {
1302
+ return {
1303
+ code: isSet(object.code) ? String(object.code) : "",
1304
+ msg: isSet(object.msg) ? String(object.msg) : "",
1305
+ };
1306
+ },
1307
+
1308
+ toJSON(message: MsgSetTxHashResponse): unknown {
1309
+ const obj: any = {};
1310
+ message.code !== undefined && (obj.code = message.code);
1311
+ message.msg !== undefined && (obj.msg = message.msg);
1312
+ return obj;
1313
+ },
1314
+
1315
+ fromPartial<I extends Exact<DeepPartial<MsgSetTxHashResponse>, I>>(
1316
+ object: I
1317
+ ): MsgSetTxHashResponse {
1318
+ const message = createBaseMsgSetTxHashResponse();
1319
+ message.code = object.code ?? "";
1320
+ message.msg = object.msg ?? "";
1321
+ return message;
1322
+ },
1323
+ };
1324
+
1325
+ function createBaseMsgSetTxProcess(): MsgSetTxProcess {
1326
+ return { creator: "", txId: 0, timestamp: 0, msgId: "", txType: "" };
1327
+ }
1328
+
1329
+ export const MsgSetTxProcess = {
1330
+ encode(
1331
+ message: MsgSetTxProcess,
1332
+ writer: _m0.Writer = _m0.Writer.create()
1333
+ ): _m0.Writer {
1334
+ if (message.creator !== "") {
1335
+ writer.uint32(10).string(message.creator);
1336
+ }
1337
+ if (message.txId !== 0) {
1338
+ writer.uint32(16).uint64(message.txId);
1339
+ }
1340
+ if (message.timestamp !== 0) {
1341
+ writer.uint32(24).uint64(message.timestamp);
1342
+ }
1343
+ if (message.msgId !== "") {
1344
+ writer.uint32(34).string(message.msgId);
1345
+ }
1346
+ if (message.txType !== "") {
1347
+ writer.uint32(42).string(message.txType);
1348
+ }
1349
+ return writer;
1350
+ },
1351
+
1352
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetTxProcess {
1353
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1354
+ let end = length === undefined ? reader.len : reader.pos + length;
1355
+ const message = createBaseMsgSetTxProcess();
1356
+ while (reader.pos < end) {
1357
+ const tag = reader.uint32();
1358
+ switch (tag >>> 3) {
1359
+ case 1:
1360
+ message.creator = reader.string();
1361
+ break;
1362
+ case 2:
1363
+ message.txId = longToNumber(reader.uint64() as Long);
1364
+ break;
1365
+ case 3:
1366
+ message.timestamp = longToNumber(reader.uint64() as Long);
1367
+ break;
1368
+ case 4:
1369
+ message.msgId = reader.string();
1370
+ break;
1371
+ case 5:
1372
+ message.txType = reader.string();
1373
+ break;
1374
+ default:
1375
+ reader.skipType(tag & 7);
1376
+ break;
1377
+ }
1378
+ }
1379
+ return message;
1380
+ },
1381
+
1382
+ fromJSON(object: any): MsgSetTxProcess {
1383
+ return {
1384
+ creator: isSet(object.creator) ? String(object.creator) : "",
1385
+ txId: isSet(object.txId) ? Number(object.txId) : 0,
1386
+ timestamp: isSet(object.timestamp) ? Number(object.timestamp) : 0,
1387
+ msgId: isSet(object.msgId) ? String(object.msgId) : "",
1388
+ txType: isSet(object.txType) ? String(object.txType) : "",
1389
+ };
1390
+ },
1391
+
1392
+ toJSON(message: MsgSetTxProcess): unknown {
1393
+ const obj: any = {};
1394
+ message.creator !== undefined && (obj.creator = message.creator);
1395
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
1396
+ message.timestamp !== undefined &&
1397
+ (obj.timestamp = Math.round(message.timestamp));
1398
+ message.msgId !== undefined && (obj.msgId = message.msgId);
1399
+ message.txType !== undefined && (obj.txType = message.txType);
1400
+ return obj;
1401
+ },
1402
+
1403
+ fromPartial<I extends Exact<DeepPartial<MsgSetTxProcess>, I>>(
1404
+ object: I
1405
+ ): MsgSetTxProcess {
1406
+ const message = createBaseMsgSetTxProcess();
1407
+ message.creator = object.creator ?? "";
1408
+ message.txId = object.txId ?? 0;
1409
+ message.timestamp = object.timestamp ?? 0;
1410
+ message.msgId = object.msgId ?? "";
1411
+ message.txType = object.txType ?? "";
1412
+ return message;
1413
+ },
1414
+ };
1415
+
1416
+ function createBaseMsgSetTxProcessResponse(): MsgSetTxProcessResponse {
1417
+ return {};
1418
+ }
1419
+
1420
+ export const MsgSetTxProcessResponse = {
1421
+ encode(
1422
+ _: MsgSetTxProcessResponse,
1423
+ writer: _m0.Writer = _m0.Writer.create()
1424
+ ): _m0.Writer {
1425
+ return writer;
1426
+ },
1427
+
1428
+ decode(
1429
+ input: _m0.Reader | Uint8Array,
1430
+ length?: number
1431
+ ): MsgSetTxProcessResponse {
1432
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1433
+ let end = length === undefined ? reader.len : reader.pos + length;
1434
+ const message = createBaseMsgSetTxProcessResponse();
1435
+ while (reader.pos < end) {
1436
+ const tag = reader.uint32();
1437
+ switch (tag >>> 3) {
1438
+ default:
1439
+ reader.skipType(tag & 7);
1440
+ break;
1441
+ }
1442
+ }
1443
+ return message;
1444
+ },
1445
+
1446
+ fromJSON(_: any): MsgSetTxProcessResponse {
1447
+ return {};
1448
+ },
1449
+
1450
+ toJSON(_: MsgSetTxProcessResponse): unknown {
1451
+ const obj: any = {};
1452
+ return obj;
1453
+ },
1454
+
1455
+ fromPartial<I extends Exact<DeepPartial<MsgSetTxProcessResponse>, I>>(
1456
+ _: I
1457
+ ): MsgSetTxProcessResponse {
1458
+ const message = createBaseMsgSetTxProcessResponse();
1459
+ return message;
1460
+ },
1461
+ };
1462
+
1463
+ function createBaseMsgRequestDrainTransaction(): MsgRequestDrainTransaction {
1464
+ return {
1465
+ creator: "",
1466
+ toChain: "",
1467
+ toAddress: "",
1468
+ symbol: "",
1469
+ amount: "",
1470
+ options: "",
1471
+ };
1472
+ }
1473
+
1474
+ export const MsgRequestDrainTransaction = {
1475
+ encode(
1476
+ message: MsgRequestDrainTransaction,
1477
+ writer: _m0.Writer = _m0.Writer.create()
1478
+ ): _m0.Writer {
1479
+ if (message.creator !== "") {
1480
+ writer.uint32(10).string(message.creator);
1481
+ }
1482
+ if (message.toChain !== "") {
1483
+ writer.uint32(18).string(message.toChain);
1484
+ }
1485
+ if (message.toAddress !== "") {
1486
+ writer.uint32(26).string(message.toAddress);
1487
+ }
1488
+ if (message.symbol !== "") {
1489
+ writer.uint32(34).string(message.symbol);
1490
+ }
1491
+ if (message.amount !== "") {
1492
+ writer.uint32(42).string(message.amount);
1493
+ }
1494
+ if (message.options !== "") {
1495
+ writer.uint32(50).string(message.options);
1496
+ }
1497
+ return writer;
1498
+ },
1499
+
1500
+ decode(
1501
+ input: _m0.Reader | Uint8Array,
1502
+ length?: number
1503
+ ): MsgRequestDrainTransaction {
1504
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1505
+ let end = length === undefined ? reader.len : reader.pos + length;
1506
+ const message = createBaseMsgRequestDrainTransaction();
1507
+ while (reader.pos < end) {
1508
+ const tag = reader.uint32();
1509
+ switch (tag >>> 3) {
1510
+ case 1:
1511
+ message.creator = reader.string();
1512
+ break;
1513
+ case 2:
1514
+ message.toChain = reader.string();
1515
+ break;
1516
+ case 3:
1517
+ message.toAddress = reader.string();
1518
+ break;
1519
+ case 4:
1520
+ message.symbol = reader.string();
1521
+ break;
1522
+ case 5:
1523
+ message.amount = reader.string();
1524
+ break;
1525
+ case 6:
1526
+ message.options = reader.string();
1527
+ break;
1528
+ default:
1529
+ reader.skipType(tag & 7);
1530
+ break;
1531
+ }
1532
+ }
1533
+ return message;
1534
+ },
1535
+
1536
+ fromJSON(object: any): MsgRequestDrainTransaction {
1537
+ return {
1538
+ creator: isSet(object.creator) ? String(object.creator) : "",
1539
+ toChain: isSet(object.toChain) ? String(object.toChain) : "",
1540
+ toAddress: isSet(object.toAddress) ? String(object.toAddress) : "",
1541
+ symbol: isSet(object.symbol) ? String(object.symbol) : "",
1542
+ amount: isSet(object.amount) ? String(object.amount) : "",
1543
+ options: isSet(object.options) ? String(object.options) : "",
1544
+ };
1545
+ },
1546
+
1547
+ toJSON(message: MsgRequestDrainTransaction): unknown {
1548
+ const obj: any = {};
1549
+ message.creator !== undefined && (obj.creator = message.creator);
1550
+ message.toChain !== undefined && (obj.toChain = message.toChain);
1551
+ message.toAddress !== undefined && (obj.toAddress = message.toAddress);
1552
+ message.symbol !== undefined && (obj.symbol = message.symbol);
1553
+ message.amount !== undefined && (obj.amount = message.amount);
1554
+ message.options !== undefined && (obj.options = message.options);
1555
+ return obj;
1556
+ },
1557
+
1558
+ fromPartial<I extends Exact<DeepPartial<MsgRequestDrainTransaction>, I>>(
1559
+ object: I
1560
+ ): MsgRequestDrainTransaction {
1561
+ const message = createBaseMsgRequestDrainTransaction();
1562
+ message.creator = object.creator ?? "";
1563
+ message.toChain = object.toChain ?? "";
1564
+ message.toAddress = object.toAddress ?? "";
1565
+ message.symbol = object.symbol ?? "";
1566
+ message.amount = object.amount ?? "";
1567
+ message.options = object.options ?? "";
1568
+ return message;
1569
+ },
1570
+ };
1571
+
1572
+ function createBaseMsgRequestDrainTransactionResponse(): MsgRequestDrainTransactionResponse {
1573
+ return { code: "", msg: "", txId: 0 };
1574
+ }
1575
+
1576
+ export const MsgRequestDrainTransactionResponse = {
1577
+ encode(
1578
+ message: MsgRequestDrainTransactionResponse,
1579
+ writer: _m0.Writer = _m0.Writer.create()
1580
+ ): _m0.Writer {
1581
+ if (message.code !== "") {
1582
+ writer.uint32(10).string(message.code);
1583
+ }
1584
+ if (message.msg !== "") {
1585
+ writer.uint32(18).string(message.msg);
1586
+ }
1587
+ if (message.txId !== 0) {
1588
+ writer.uint32(24).uint64(message.txId);
1589
+ }
1590
+ return writer;
1591
+ },
1592
+
1593
+ decode(
1594
+ input: _m0.Reader | Uint8Array,
1595
+ length?: number
1596
+ ): MsgRequestDrainTransactionResponse {
1597
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1598
+ let end = length === undefined ? reader.len : reader.pos + length;
1599
+ const message = createBaseMsgRequestDrainTransactionResponse();
1600
+ while (reader.pos < end) {
1601
+ const tag = reader.uint32();
1602
+ switch (tag >>> 3) {
1603
+ case 1:
1604
+ message.code = reader.string();
1605
+ break;
1606
+ case 2:
1607
+ message.msg = reader.string();
1608
+ break;
1609
+ case 3:
1610
+ message.txId = longToNumber(reader.uint64() as Long);
1611
+ break;
1612
+ default:
1613
+ reader.skipType(tag & 7);
1614
+ break;
1615
+ }
1616
+ }
1617
+ return message;
1618
+ },
1619
+
1620
+ fromJSON(object: any): MsgRequestDrainTransactionResponse {
1621
+ return {
1622
+ code: isSet(object.code) ? String(object.code) : "",
1623
+ msg: isSet(object.msg) ? String(object.msg) : "",
1624
+ txId: isSet(object.txId) ? Number(object.txId) : 0,
1625
+ };
1626
+ },
1627
+
1628
+ toJSON(message: MsgRequestDrainTransactionResponse): unknown {
1629
+ const obj: any = {};
1630
+ message.code !== undefined && (obj.code = message.code);
1631
+ message.msg !== undefined && (obj.msg = message.msg);
1632
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
1633
+ return obj;
1634
+ },
1635
+
1636
+ fromPartial<
1637
+ I extends Exact<DeepPartial<MsgRequestDrainTransactionResponse>, I>
1638
+ >(object: I): MsgRequestDrainTransactionResponse {
1639
+ const message = createBaseMsgRequestDrainTransactionResponse();
1640
+ message.code = object.code ?? "";
1641
+ message.msg = object.msg ?? "";
1642
+ message.txId = object.txId ?? 0;
1643
+ return message;
1644
+ },
1645
+ };
1646
+
1647
+ function createBaseMsgFinalizeDrainTransaction(): MsgFinalizeDrainTransaction {
1648
+ return {
1649
+ creator: "",
1650
+ txId: 0,
1651
+ txHash: "",
1652
+ success: false,
1653
+ signedKey: "",
1654
+ errReason: "",
1655
+ };
1656
+ }
1657
+
1658
+ export const MsgFinalizeDrainTransaction = {
1659
+ encode(
1660
+ message: MsgFinalizeDrainTransaction,
1661
+ writer: _m0.Writer = _m0.Writer.create()
1662
+ ): _m0.Writer {
1663
+ if (message.creator !== "") {
1664
+ writer.uint32(10).string(message.creator);
1665
+ }
1666
+ if (message.txId !== 0) {
1667
+ writer.uint32(16).uint64(message.txId);
1668
+ }
1669
+ if (message.txHash !== "") {
1670
+ writer.uint32(26).string(message.txHash);
1671
+ }
1672
+ if (message.success === true) {
1673
+ writer.uint32(32).bool(message.success);
1674
+ }
1675
+ if (message.signedKey !== "") {
1676
+ writer.uint32(42).string(message.signedKey);
1677
+ }
1678
+ if (message.errReason !== "") {
1679
+ writer.uint32(50).string(message.errReason);
1680
+ }
1681
+ return writer;
1682
+ },
1683
+
1684
+ decode(
1685
+ input: _m0.Reader | Uint8Array,
1686
+ length?: number
1687
+ ): MsgFinalizeDrainTransaction {
1688
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1689
+ let end = length === undefined ? reader.len : reader.pos + length;
1690
+ const message = createBaseMsgFinalizeDrainTransaction();
1691
+ while (reader.pos < end) {
1692
+ const tag = reader.uint32();
1693
+ switch (tag >>> 3) {
1694
+ case 1:
1695
+ message.creator = reader.string();
1696
+ break;
1697
+ case 2:
1698
+ message.txId = longToNumber(reader.uint64() as Long);
1699
+ break;
1700
+ case 3:
1701
+ message.txHash = reader.string();
1702
+ break;
1703
+ case 4:
1704
+ message.success = reader.bool();
1705
+ break;
1706
+ case 5:
1707
+ message.signedKey = reader.string();
1708
+ break;
1709
+ case 6:
1710
+ message.errReason = reader.string();
1711
+ break;
1712
+ default:
1713
+ reader.skipType(tag & 7);
1714
+ break;
1715
+ }
1716
+ }
1717
+ return message;
1718
+ },
1719
+
1720
+ fromJSON(object: any): MsgFinalizeDrainTransaction {
1721
+ return {
1722
+ creator: isSet(object.creator) ? String(object.creator) : "",
1723
+ txId: isSet(object.txId) ? Number(object.txId) : 0,
1724
+ txHash: isSet(object.txHash) ? String(object.txHash) : "",
1725
+ success: isSet(object.success) ? Boolean(object.success) : false,
1726
+ signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
1727
+ errReason: isSet(object.errReason) ? String(object.errReason) : "",
1728
+ };
1729
+ },
1730
+
1731
+ toJSON(message: MsgFinalizeDrainTransaction): unknown {
1732
+ const obj: any = {};
1733
+ message.creator !== undefined && (obj.creator = message.creator);
1734
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
1735
+ message.txHash !== undefined && (obj.txHash = message.txHash);
1736
+ message.success !== undefined && (obj.success = message.success);
1737
+ message.signedKey !== undefined && (obj.signedKey = message.signedKey);
1738
+ message.errReason !== undefined && (obj.errReason = message.errReason);
1739
+ return obj;
1740
+ },
1741
+
1742
+ fromPartial<I extends Exact<DeepPartial<MsgFinalizeDrainTransaction>, I>>(
1743
+ object: I
1744
+ ): MsgFinalizeDrainTransaction {
1745
+ const message = createBaseMsgFinalizeDrainTransaction();
1746
+ message.creator = object.creator ?? "";
1747
+ message.txId = object.txId ?? 0;
1748
+ message.txHash = object.txHash ?? "";
1749
+ message.success = object.success ?? false;
1750
+ message.signedKey = object.signedKey ?? "";
1751
+ message.errReason = object.errReason ?? "";
1752
+ return message;
1753
+ },
1754
+ };
1755
+
1756
+ function createBaseMsgFinalizeDrainTransactionResponse(): MsgFinalizeDrainTransactionResponse {
1757
+ return { code: "", msg: "" };
1758
+ }
1759
+
1760
+ export const MsgFinalizeDrainTransactionResponse = {
1761
+ encode(
1762
+ message: MsgFinalizeDrainTransactionResponse,
1763
+ writer: _m0.Writer = _m0.Writer.create()
1764
+ ): _m0.Writer {
1765
+ if (message.code !== "") {
1766
+ writer.uint32(10).string(message.code);
1767
+ }
1768
+ if (message.msg !== "") {
1769
+ writer.uint32(18).string(message.msg);
1770
+ }
1771
+ return writer;
1772
+ },
1773
+
1774
+ decode(
1775
+ input: _m0.Reader | Uint8Array,
1776
+ length?: number
1777
+ ): MsgFinalizeDrainTransactionResponse {
1778
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1779
+ let end = length === undefined ? reader.len : reader.pos + length;
1780
+ const message = createBaseMsgFinalizeDrainTransactionResponse();
1781
+ while (reader.pos < end) {
1782
+ const tag = reader.uint32();
1783
+ switch (tag >>> 3) {
1784
+ case 1:
1785
+ message.code = reader.string();
1786
+ break;
1787
+ case 2:
1788
+ message.msg = reader.string();
1789
+ break;
1790
+ default:
1791
+ reader.skipType(tag & 7);
1792
+ break;
1793
+ }
1794
+ }
1795
+ return message;
1796
+ },
1797
+
1798
+ fromJSON(object: any): MsgFinalizeDrainTransactionResponse {
1799
+ return {
1800
+ code: isSet(object.code) ? String(object.code) : "",
1801
+ msg: isSet(object.msg) ? String(object.msg) : "",
1802
+ };
1803
+ },
1804
+
1805
+ toJSON(message: MsgFinalizeDrainTransactionResponse): unknown {
1806
+ const obj: any = {};
1807
+ message.code !== undefined && (obj.code = message.code);
1808
+ message.msg !== undefined && (obj.msg = message.msg);
1809
+ return obj;
1810
+ },
1811
+
1812
+ fromPartial<
1813
+ I extends Exact<DeepPartial<MsgFinalizeDrainTransactionResponse>, I>
1814
+ >(object: I): MsgFinalizeDrainTransactionResponse {
1815
+ const message = createBaseMsgFinalizeDrainTransactionResponse();
1816
+ message.code = object.code ?? "";
1817
+ message.msg = object.msg ?? "";
1818
+ return message;
1819
+ },
1820
+ };
1821
+
1822
+ function createBaseMsgRequestHtlcLock(): MsgRequestHtlcLock {
1823
+ return {
1824
+ creator: "",
1825
+ fromAddress: "",
1826
+ senderPubkey: "",
1827
+ amount: "",
1828
+ htlcTimeout: "",
1829
+ txHash: "",
1830
+ htlcAddress: "",
1831
+ };
1832
+ }
1833
+
1834
+ export const MsgRequestHtlcLock = {
1835
+ encode(
1836
+ message: MsgRequestHtlcLock,
1837
+ writer: _m0.Writer = _m0.Writer.create()
1838
+ ): _m0.Writer {
1839
+ if (message.creator !== "") {
1840
+ writer.uint32(10).string(message.creator);
1841
+ }
1842
+ if (message.fromAddress !== "") {
1843
+ writer.uint32(18).string(message.fromAddress);
1844
+ }
1845
+ if (message.senderPubkey !== "") {
1846
+ writer.uint32(26).string(message.senderPubkey);
1847
+ }
1848
+ if (message.amount !== "") {
1849
+ writer.uint32(34).string(message.amount);
1850
+ }
1851
+ if (message.htlcTimeout !== "") {
1852
+ writer.uint32(42).string(message.htlcTimeout);
1853
+ }
1854
+ if (message.txHash !== "") {
1855
+ writer.uint32(50).string(message.txHash);
1856
+ }
1857
+ if (message.htlcAddress !== "") {
1858
+ writer.uint32(58).string(message.htlcAddress);
1859
+ }
1860
+ return writer;
1861
+ },
1862
+
1863
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestHtlcLock {
1864
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1865
+ let end = length === undefined ? reader.len : reader.pos + length;
1866
+ const message = createBaseMsgRequestHtlcLock();
1867
+ while (reader.pos < end) {
1868
+ const tag = reader.uint32();
1869
+ switch (tag >>> 3) {
1870
+ case 1:
1871
+ message.creator = reader.string();
1872
+ break;
1873
+ case 2:
1874
+ message.fromAddress = reader.string();
1875
+ break;
1876
+ case 3:
1877
+ message.senderPubkey = reader.string();
1878
+ break;
1879
+ case 4:
1880
+ message.amount = reader.string();
1881
+ break;
1882
+ case 5:
1883
+ message.htlcTimeout = reader.string();
1884
+ break;
1885
+ case 6:
1886
+ message.txHash = reader.string();
1887
+ break;
1888
+ case 7:
1889
+ message.htlcAddress = reader.string();
1890
+ break;
1891
+ default:
1892
+ reader.skipType(tag & 7);
1893
+ break;
1894
+ }
1895
+ }
1896
+ return message;
1897
+ },
1898
+
1899
+ fromJSON(object: any): MsgRequestHtlcLock {
1900
+ return {
1901
+ creator: isSet(object.creator) ? String(object.creator) : "",
1902
+ fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "",
1903
+ senderPubkey: isSet(object.senderPubkey)
1904
+ ? String(object.senderPubkey)
1905
+ : "",
1906
+ amount: isSet(object.amount) ? String(object.amount) : "",
1907
+ htlcTimeout: isSet(object.htlcTimeout) ? String(object.htlcTimeout) : "",
1908
+ txHash: isSet(object.txHash) ? String(object.txHash) : "",
1909
+ htlcAddress: isSet(object.htlcAddress) ? String(object.htlcAddress) : "",
1910
+ };
1911
+ },
1912
+
1913
+ toJSON(message: MsgRequestHtlcLock): unknown {
1914
+ const obj: any = {};
1915
+ message.creator !== undefined && (obj.creator = message.creator);
1916
+ message.fromAddress !== undefined &&
1917
+ (obj.fromAddress = message.fromAddress);
1918
+ message.senderPubkey !== undefined &&
1919
+ (obj.senderPubkey = message.senderPubkey);
1920
+ message.amount !== undefined && (obj.amount = message.amount);
1921
+ message.htlcTimeout !== undefined &&
1922
+ (obj.htlcTimeout = message.htlcTimeout);
1923
+ message.txHash !== undefined && (obj.txHash = message.txHash);
1924
+ message.htlcAddress !== undefined &&
1925
+ (obj.htlcAddress = message.htlcAddress);
1926
+ return obj;
1927
+ },
1928
+
1929
+ fromPartial<I extends Exact<DeepPartial<MsgRequestHtlcLock>, I>>(
1930
+ object: I
1931
+ ): MsgRequestHtlcLock {
1932
+ const message = createBaseMsgRequestHtlcLock();
1933
+ message.creator = object.creator ?? "";
1934
+ message.fromAddress = object.fromAddress ?? "";
1935
+ message.senderPubkey = object.senderPubkey ?? "";
1936
+ message.amount = object.amount ?? "";
1937
+ message.htlcTimeout = object.htlcTimeout ?? "";
1938
+ message.txHash = object.txHash ?? "";
1939
+ message.htlcAddress = object.htlcAddress ?? "";
1940
+ return message;
1941
+ },
1942
+ };
1943
+
1944
+ function createBaseMsgRequestHtlcLockResponse(): MsgRequestHtlcLockResponse {
1945
+ return {};
1946
+ }
1947
+
1948
+ export const MsgRequestHtlcLockResponse = {
1949
+ encode(
1950
+ _: MsgRequestHtlcLockResponse,
1951
+ writer: _m0.Writer = _m0.Writer.create()
1952
+ ): _m0.Writer {
1953
+ return writer;
1954
+ },
1955
+
1956
+ decode(
1957
+ input: _m0.Reader | Uint8Array,
1958
+ length?: number
1959
+ ): MsgRequestHtlcLockResponse {
1960
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
1961
+ let end = length === undefined ? reader.len : reader.pos + length;
1962
+ const message = createBaseMsgRequestHtlcLockResponse();
1963
+ while (reader.pos < end) {
1964
+ const tag = reader.uint32();
1965
+ switch (tag >>> 3) {
1966
+ default:
1967
+ reader.skipType(tag & 7);
1968
+ break;
1969
+ }
1970
+ }
1971
+ return message;
1972
+ },
1973
+
1974
+ fromJSON(_: any): MsgRequestHtlcLockResponse {
1975
+ return {};
1976
+ },
1977
+
1978
+ toJSON(_: MsgRequestHtlcLockResponse): unknown {
1979
+ const obj: any = {};
1980
+ return obj;
1981
+ },
1982
+
1983
+ fromPartial<I extends Exact<DeepPartial<MsgRequestHtlcLockResponse>, I>>(
1984
+ _: I
1985
+ ): MsgRequestHtlcLockResponse {
1986
+ const message = createBaseMsgRequestHtlcLockResponse();
1987
+ return message;
1988
+ },
1989
+ };
1990
+
1991
+ /** Msg defines the Msg service. */
1992
+ export interface Msg {
1993
+ RequestTransaction(
1994
+ request: MsgRequestTransaction
1995
+ ): Promise<MsgRequestTransactionResponse>;
1996
+ FinalizeTransaction(
1997
+ request: MsgFinalizeTransaction
1998
+ ): Promise<MsgFinalizeTransactionResponse>;
1999
+ RequestProvisionTransaction(
2000
+ request: MsgRequestProvisionTransaction
2001
+ ): Promise<MsgRequestProvisionTransactionResponse>;
2002
+ CancelTransaction(
2003
+ request: MsgCancelTransaction
2004
+ ): Promise<MsgCancelTransactionResponse>;
2005
+ SetTxHash(request: MsgSetTxHash): Promise<MsgSetTxHashResponse>;
2006
+ SetTxProcess(request: MsgSetTxProcess): Promise<MsgSetTxProcessResponse>;
2007
+ FinalizeProvisionTransaction(
2008
+ request: MsgFinalizeProvisionTransaction
2009
+ ): Promise<MsgFinalizeProvisionTransactionResponse>;
2010
+ RequestDrainTransaction(
2011
+ request: MsgRequestDrainTransaction
2012
+ ): Promise<MsgRequestDrainTransactionResponse>;
2013
+ FinalizeDrainTransaction(
2014
+ request: MsgFinalizeDrainTransaction
2015
+ ): Promise<MsgFinalizeDrainTransactionResponse>;
2016
+ RequestHtlcLock(
2017
+ request: MsgRequestHtlcLock
2018
+ ): Promise<MsgRequestHtlcLockResponse>;
2019
+ }
2020
+
2021
+ export class MsgClientImpl implements Msg {
2022
+ private readonly rpc: Rpc;
2023
+ constructor(rpc: Rpc) {
2024
+ this.rpc = rpc;
2025
+ this.RequestTransaction = this.RequestTransaction.bind(this);
2026
+ this.FinalizeTransaction = this.FinalizeTransaction.bind(this);
2027
+ this.RequestProvisionTransaction =
2028
+ this.RequestProvisionTransaction.bind(this);
2029
+ this.CancelTransaction = this.CancelTransaction.bind(this);
2030
+ this.SetTxHash = this.SetTxHash.bind(this);
2031
+ this.SetTxProcess = this.SetTxProcess.bind(this);
2032
+ this.FinalizeProvisionTransaction =
2033
+ this.FinalizeProvisionTransaction.bind(this);
2034
+ this.RequestDrainTransaction = this.RequestDrainTransaction.bind(this);
2035
+ this.FinalizeDrainTransaction = this.FinalizeDrainTransaction.bind(this);
2036
+ this.RequestHtlcLock = this.RequestHtlcLock.bind(this);
2037
+ }
2038
+ RequestTransaction(
2039
+ request: MsgRequestTransaction
2040
+ ): Promise<MsgRequestTransactionResponse> {
2041
+ const data = MsgRequestTransaction.encode(request).finish();
2042
+ const promise = this.rpc.request(
2043
+ "kimablockchain.transaction.Msg",
2044
+ "RequestTransaction",
2045
+ data
2046
+ );
2047
+ return promise.then((data) =>
2048
+ MsgRequestTransactionResponse.decode(new _m0.Reader(data))
2049
+ );
2050
+ }
2051
+
2052
+ FinalizeTransaction(
2053
+ request: MsgFinalizeTransaction
2054
+ ): Promise<MsgFinalizeTransactionResponse> {
2055
+ const data = MsgFinalizeTransaction.encode(request).finish();
2056
+ const promise = this.rpc.request(
2057
+ "kimablockchain.transaction.Msg",
2058
+ "FinalizeTransaction",
2059
+ data
2060
+ );
2061
+ return promise.then((data) =>
2062
+ MsgFinalizeTransactionResponse.decode(new _m0.Reader(data))
2063
+ );
2064
+ }
2065
+
2066
+ RequestProvisionTransaction(
2067
+ request: MsgRequestProvisionTransaction
2068
+ ): Promise<MsgRequestProvisionTransactionResponse> {
2069
+ const data = MsgRequestProvisionTransaction.encode(request).finish();
2070
+ const promise = this.rpc.request(
2071
+ "kimablockchain.transaction.Msg",
2072
+ "RequestProvisionTransaction",
2073
+ data
2074
+ );
2075
+ return promise.then((data) =>
2076
+ MsgRequestProvisionTransactionResponse.decode(new _m0.Reader(data))
2077
+ );
2078
+ }
2079
+
2080
+ CancelTransaction(
2081
+ request: MsgCancelTransaction
2082
+ ): Promise<MsgCancelTransactionResponse> {
2083
+ const data = MsgCancelTransaction.encode(request).finish();
2084
+ const promise = this.rpc.request(
2085
+ "kimablockchain.transaction.Msg",
2086
+ "CancelTransaction",
2087
+ data
2088
+ );
2089
+ return promise.then((data) =>
2090
+ MsgCancelTransactionResponse.decode(new _m0.Reader(data))
2091
+ );
2092
+ }
2093
+
2094
+ SetTxHash(request: MsgSetTxHash): Promise<MsgSetTxHashResponse> {
2095
+ const data = MsgSetTxHash.encode(request).finish();
2096
+ const promise = this.rpc.request(
2097
+ "kimablockchain.transaction.Msg",
2098
+ "SetTxHash",
2099
+ data
2100
+ );
2101
+ return promise.then((data) =>
2102
+ MsgSetTxHashResponse.decode(new _m0.Reader(data))
2103
+ );
2104
+ }
2105
+
2106
+ SetTxProcess(request: MsgSetTxProcess): Promise<MsgSetTxProcessResponse> {
2107
+ const data = MsgSetTxProcess.encode(request).finish();
2108
+ const promise = this.rpc.request(
2109
+ "kimablockchain.transaction.Msg",
2110
+ "SetTxProcess",
2111
+ data
2112
+ );
2113
+ return promise.then((data) =>
2114
+ MsgSetTxProcessResponse.decode(new _m0.Reader(data))
2115
+ );
2116
+ }
2117
+
2118
+ FinalizeProvisionTransaction(
2119
+ request: MsgFinalizeProvisionTransaction
2120
+ ): Promise<MsgFinalizeProvisionTransactionResponse> {
2121
+ const data = MsgFinalizeProvisionTransaction.encode(request).finish();
2122
+ const promise = this.rpc.request(
2123
+ "kimablockchain.transaction.Msg",
2124
+ "FinalizeProvisionTransaction",
2125
+ data
2126
+ );
2127
+ return promise.then((data) =>
2128
+ MsgFinalizeProvisionTransactionResponse.decode(new _m0.Reader(data))
2129
+ );
2130
+ }
2131
+
2132
+ RequestDrainTransaction(
2133
+ request: MsgRequestDrainTransaction
2134
+ ): Promise<MsgRequestDrainTransactionResponse> {
2135
+ const data = MsgRequestDrainTransaction.encode(request).finish();
2136
+ const promise = this.rpc.request(
2137
+ "kimablockchain.transaction.Msg",
2138
+ "RequestDrainTransaction",
2139
+ data
2140
+ );
2141
+ return promise.then((data) =>
2142
+ MsgRequestDrainTransactionResponse.decode(new _m0.Reader(data))
2143
+ );
2144
+ }
2145
+
2146
+ FinalizeDrainTransaction(
2147
+ request: MsgFinalizeDrainTransaction
2148
+ ): Promise<MsgFinalizeDrainTransactionResponse> {
2149
+ const data = MsgFinalizeDrainTransaction.encode(request).finish();
2150
+ const promise = this.rpc.request(
2151
+ "kimablockchain.transaction.Msg",
2152
+ "FinalizeDrainTransaction",
2153
+ data
2154
+ );
2155
+ return promise.then((data) =>
2156
+ MsgFinalizeDrainTransactionResponse.decode(new _m0.Reader(data))
2157
+ );
2158
+ }
2159
+
2160
+ RequestHtlcLock(
2161
+ request: MsgRequestHtlcLock
2162
+ ): Promise<MsgRequestHtlcLockResponse> {
2163
+ const data = MsgRequestHtlcLock.encode(request).finish();
2164
+ const promise = this.rpc.request(
2165
+ "kimablockchain.transaction.Msg",
2166
+ "RequestHtlcLock",
2167
+ data
2168
+ );
2169
+ return promise.then((data) =>
2170
+ MsgRequestHtlcLockResponse.decode(new _m0.Reader(data))
2171
+ );
2172
+ }
2173
+ }
2174
+
2175
+ interface Rpc {
2176
+ request(
2177
+ service: string,
2178
+ method: string,
2179
+ data: Uint8Array
2180
+ ): Promise<Uint8Array>;
2181
+ }
2182
+
2183
+ declare var self: any | undefined;
2184
+ declare var window: any | undefined;
2185
+ declare var global: any | undefined;
2186
+ var globalThis: any = (() => {
2187
+ if (typeof globalThis !== "undefined") {
2188
+ return globalThis;
2189
+ }
2190
+ if (typeof self !== "undefined") {
2191
+ return self;
2192
+ }
2193
+ if (typeof window !== "undefined") {
2194
+ return window;
2195
+ }
2196
+ if (typeof global !== "undefined") {
2197
+ return global;
2198
+ }
2199
+ throw "Unable to locate global object";
2200
+ })();
2201
+
2202
+ function bytesFromBase64(b64: string): Uint8Array {
2203
+ if (globalThis.Buffer) {
2204
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
2205
+ } else {
2206
+ const bin = globalThis.atob(b64);
2207
+ const arr = new Uint8Array(bin.length);
2208
+ for (let i = 0; i < bin.length; ++i) {
2209
+ arr[i] = bin.charCodeAt(i);
2210
+ }
2211
+ return arr;
2212
+ }
2213
+ }
2214
+
2215
+ function base64FromBytes(arr: Uint8Array): string {
2216
+ if (globalThis.Buffer) {
2217
+ return globalThis.Buffer.from(arr).toString("base64");
2218
+ } else {
2219
+ const bin: string[] = [];
2220
+ arr.forEach((byte) => {
2221
+ bin.push(String.fromCharCode(byte));
2222
+ });
2223
+ return globalThis.btoa(bin.join(""));
2224
+ }
2225
+ }
2226
+
2227
+ type Builtin =
2228
+ | Date
2229
+ | Function
2230
+ | Uint8Array
2231
+ | string
2232
+ | number
2233
+ | boolean
2234
+ | undefined;
2235
+
2236
+ export type DeepPartial<T> = T extends Builtin
2237
+ ? T
2238
+ : T extends Array<infer U>
2239
+ ? Array<DeepPartial<U>>
2240
+ : T extends ReadonlyArray<infer U>
2241
+ ? ReadonlyArray<DeepPartial<U>>
2242
+ : T extends {}
2243
+ ? { [K in keyof T]?: DeepPartial<T[K]> }
2244
+ : Partial<T>;
2245
+
2246
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
2247
+ export type Exact<P, I extends P> = P extends Builtin
2248
+ ? P
2249
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & {
2250
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
2251
+ };
2252
+
2253
+ function longToNumber(long: Long): number {
2254
+ if (long.gt(Number.MAX_SAFE_INTEGER)) {
2255
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
2256
+ }
2257
+ return long.toNumber();
2258
+ }
2259
+
2260
+ if (_m0.util.Long !== Long) {
2261
+ _m0.util.Long = Long as any;
2262
+ _m0.configure();
2263
+ }
2264
+
2265
+ function isSet(value: any): boolean {
2266
+ return value !== null && value !== undefined;
2267
+ }