@kimafinance/kima-transaction-api 1.3.7 → 1.4.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.
Files changed (83) hide show
  1. package/README.md +19 -5
  2. package/build/api/htlc-lock.d.ts +23 -0
  3. package/build/api/htlc-lock.js +37 -0
  4. package/build/api/htlc-reclaim.d.ts +14 -0
  5. package/build/api/htlc-reclaim.js +28 -0
  6. package/build/api/submit.d.ts +54 -0
  7. package/build/api/submit.js +94 -0
  8. package/build/config/global-this.config.d.ts +2 -0
  9. package/build/config/global-this.config.js +18 -0
  10. package/build/config/probuff.config.d.ts +2 -0
  11. package/build/config/probuff.config.js +12 -0
  12. package/build/index.d.ts +3 -50
  13. package/build/index.js +17 -121
  14. package/build/kima/common.d.ts +4 -1
  15. package/build/kima/common.js +12 -9
  16. package/build/kima/tx/cancel.d.ts +35 -0
  17. package/build/kima/tx/cancel.js +115 -0
  18. package/build/kima/tx/drain-finalize.d.ts +47 -0
  19. package/build/kima/tx/drain-finalize.js +155 -0
  20. package/build/kima/tx/drain.d.ts +50 -0
  21. package/build/kima/tx/drain.js +164 -0
  22. package/build/kima/tx/finalize.d.ts +47 -0
  23. package/build/kima/tx/finalize.js +155 -0
  24. package/build/kima/tx/htlc-lock.d.ts +42 -0
  25. package/build/kima/tx/htlc-lock.js +152 -0
  26. package/build/kima/tx/htlc-reclaim.d.ts +30 -0
  27. package/build/kima/tx/htlc-reclaim.js +105 -0
  28. package/build/kima/tx/index.d.ts +1 -0
  29. package/build/kima/tx/index.js +4 -0
  30. package/build/kima/tx/liquidity-provision.d.ts +30 -0
  31. package/build/kima/tx/liquidity-provision.js +102 -0
  32. package/build/kima/tx/message-service.d.ts +54 -0
  33. package/build/kima/tx/message-service.js +117 -0
  34. package/build/kima/tx/provision-finalize.d.ts +47 -0
  35. package/build/kima/tx/provision-finalize.js +155 -0
  36. package/build/kima/tx/provision.d.ts +70 -0
  37. package/build/kima/tx/provision.js +230 -0
  38. package/build/kima/tx/request.d.ts +63 -0
  39. package/build/kima/tx/request.js +222 -0
  40. package/build/kima/tx/response.d.ts +21 -0
  41. package/build/kima/tx/response.js +69 -0
  42. package/build/kima/tx/rpc.d.ts +0 -0
  43. package/build/kima/tx/rpc.js +1 -0
  44. package/build/kima/tx/set-hash.d.ts +42 -0
  45. package/build/kima/tx/set-hash.js +130 -0
  46. package/build/kima/tx/set-process.d.ts +37 -0
  47. package/build/kima/tx/set-process.js +121 -0
  48. package/build/kima/tx/transfer-limit.d.ts +30 -0
  49. package/build/kima/tx/transfer-limit.js +102 -0
  50. package/build/kima/tx/withdraw.d.ts +47 -0
  51. package/build/kima/tx/withdraw.js +155 -0
  52. package/build/utils.d.ts +17 -0
  53. package/build/utils.js +49 -0
  54. package/package.json +10 -10
  55. package/src/api/htlc-lock.ts +57 -0
  56. package/src/api/htlc-reclaim.ts +39 -0
  57. package/src/api/submit.ts +132 -0
  58. package/src/config/global-this.config.ts +20 -0
  59. package/src/config/probuff.config.ts +9 -0
  60. package/src/index.ts +3 -206
  61. package/src/kima/common.ts +5 -12
  62. package/src/kima/tx/cancel.ts +147 -0
  63. package/src/kima/tx/drain-finalize.ts +191 -0
  64. package/src/kima/tx/drain.ts +201 -0
  65. package/src/kima/tx/finalize.ts +191 -0
  66. package/src/kima/tx/htlc-lock.ts +183 -0
  67. package/src/kima/tx/htlc-reclaim.ts +132 -0
  68. package/src/kima/tx/index.ts +1 -0
  69. package/src/kima/tx/liquidity-provision.ts +132 -0
  70. package/src/kima/tx/message-service.ts +278 -0
  71. package/src/kima/tx/provision-finalize.ts +191 -0
  72. package/src/kima/tx/provision.ts +279 -0
  73. package/src/kima/tx/request.ts +256 -0
  74. package/src/kima/tx/response.ts +83 -0
  75. package/src/kima/tx/rpc.ts +0 -0
  76. package/src/kima/tx/set-hash.ts +162 -0
  77. package/src/kima/tx/set-process.ts +151 -0
  78. package/src/kima/tx/transfer-limit.ts +132 -0
  79. package/src/kima/tx/withdraw.ts +191 -0
  80. package/src/utils.ts +67 -0
  81. package/build/kima/tx.d.ts +0 -674
  82. package/build/kima/tx.js +0 -2170
  83. package/src/kima/tx.ts +0 -2945
@@ -0,0 +1,54 @@
1
+ import { MsgCancelTransaction, MsgCancelTransactionResponse } from "./cancel";
2
+ import { MsgRequestDrainTransaction, MsgRequestDrainTransactionResponse } from "./drain";
3
+ import { MsgFinalizeDrainTransaction, MsgFinalizeDrainTransactionResponse } from "./drain-finalize";
4
+ import { MsgFinalizeTransaction, MsgFinalizeTransactionResponse } from "./finalize";
5
+ import { MsgRequestHtlcLock, MsgRequestHtlcLockResponse } from "./htlc-lock";
6
+ import { MsgHtlcReclaim, MsgHtlcReclaimResponse } from "./htlc-reclaim";
7
+ import { MsgUpdateLiquidityProvisionParams, MsgUpdateLiquidityProvisionParamsResponse } from "./liquidity-provision";
8
+ import { MsgRequestProvisionTransaction, MsgRequestProvisionTransactionResponse } from "./provision";
9
+ import { MsgFinalizeProvisionTransaction, MsgFinalizeProvisionTransactionResponse } from "./provision-finalize";
10
+ import { MsgRequestTransaction } from "./request";
11
+ import { MsgRequestTransactionResponse } from "./response";
12
+ import { MsgSetTxHash, MsgSetTxHashResponse } from "./set-hash";
13
+ import { MsgSetTxProcess, MsgSetTxProcessResponse } from "./set-process";
14
+ import { MsgUpdateTransferLimitParams, MsgUpdateTransferLimitParamsResponse } from "./transfer-limit";
15
+ import { MsgFinalizeWithdrawTransaction, MsgFinalizeWithdrawTransactionResponse } from "./withdraw";
16
+ /** Msg defines the Msg service. */
17
+ export interface Msg {
18
+ RequestTransaction(request: MsgRequestTransaction): Promise<MsgRequestTransactionResponse>;
19
+ FinalizeTransaction(request: MsgFinalizeTransaction): Promise<MsgFinalizeTransactionResponse>;
20
+ RequestProvisionTransaction(request: MsgRequestProvisionTransaction): Promise<MsgRequestProvisionTransactionResponse>;
21
+ CancelTransaction(request: MsgCancelTransaction): Promise<MsgCancelTransactionResponse>;
22
+ SetTxHash(request: MsgSetTxHash): Promise<MsgSetTxHashResponse>;
23
+ SetTxProcess(request: MsgSetTxProcess): Promise<MsgSetTxProcessResponse>;
24
+ FinalizeProvisionTransaction(request: MsgFinalizeProvisionTransaction): Promise<MsgFinalizeProvisionTransactionResponse>;
25
+ RequestDrainTransaction(request: MsgRequestDrainTransaction): Promise<MsgRequestDrainTransactionResponse>;
26
+ FinalizeDrainTransaction(request: MsgFinalizeDrainTransaction): Promise<MsgFinalizeDrainTransactionResponse>;
27
+ RequestHtlcLock(request: MsgRequestHtlcLock): Promise<MsgRequestHtlcLockResponse>;
28
+ HtlcReclaim(request: MsgHtlcReclaim): Promise<MsgHtlcReclaimResponse>;
29
+ UpdateLiquidityProvisionParams(request: MsgUpdateLiquidityProvisionParams): Promise<MsgUpdateLiquidityProvisionParamsResponse>;
30
+ UpdateTransferLimitParams(request: MsgUpdateTransferLimitParams): Promise<MsgUpdateTransferLimitParamsResponse>;
31
+ FinalizeWithdrawTransaction(request: MsgFinalizeWithdrawTransaction): Promise<MsgFinalizeWithdrawTransactionResponse>;
32
+ }
33
+ interface Rpc {
34
+ request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
35
+ }
36
+ export declare class MsgClientImpl implements Msg {
37
+ private readonly rpc;
38
+ constructor(rpc: Rpc);
39
+ RequestTransaction(request: MsgRequestTransaction): Promise<MsgRequestTransactionResponse>;
40
+ FinalizeTransaction(request: MsgFinalizeTransaction): Promise<MsgFinalizeTransactionResponse>;
41
+ RequestProvisionTransaction(request: MsgRequestProvisionTransaction): Promise<MsgRequestProvisionTransactionResponse>;
42
+ CancelTransaction(request: MsgCancelTransaction): Promise<MsgCancelTransactionResponse>;
43
+ SetTxHash(request: MsgSetTxHash): Promise<MsgSetTxHashResponse>;
44
+ SetTxProcess(request: MsgSetTxProcess): Promise<MsgSetTxProcessResponse>;
45
+ FinalizeProvisionTransaction(request: MsgFinalizeProvisionTransaction): Promise<MsgFinalizeProvisionTransactionResponse>;
46
+ RequestDrainTransaction(request: MsgRequestDrainTransaction): Promise<MsgRequestDrainTransactionResponse>;
47
+ FinalizeDrainTransaction(request: MsgFinalizeDrainTransaction): Promise<MsgFinalizeDrainTransactionResponse>;
48
+ RequestHtlcLock(request: MsgRequestHtlcLock): Promise<MsgRequestHtlcLockResponse>;
49
+ HtlcReclaim(request: MsgHtlcReclaim): Promise<MsgHtlcReclaimResponse>;
50
+ UpdateLiquidityProvisionParams(request: MsgUpdateLiquidityProvisionParams): Promise<MsgUpdateLiquidityProvisionParamsResponse>;
51
+ UpdateTransferLimitParams(request: MsgUpdateTransferLimitParams): Promise<MsgUpdateTransferLimitParamsResponse>;
52
+ FinalizeWithdrawTransaction(request: MsgFinalizeWithdrawTransaction): Promise<MsgFinalizeWithdrawTransactionResponse>;
53
+ }
54
+ export {};
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MsgClientImpl = void 0;
7
+ const probuff_config_1 = __importDefault(require("../../config/probuff.config"));
8
+ const cancel_1 = require("./cancel");
9
+ const drain_1 = require("./drain");
10
+ const drain_finalize_1 = require("./drain-finalize");
11
+ const finalize_1 = require("./finalize");
12
+ const htlc_lock_1 = require("./htlc-lock");
13
+ const htlc_reclaim_1 = require("./htlc-reclaim");
14
+ const liquidity_provision_1 = require("./liquidity-provision");
15
+ const provision_1 = require("./provision");
16
+ const provision_finalize_1 = require("./provision-finalize");
17
+ const request_1 = require("./request");
18
+ const response_1 = require("./response");
19
+ const set_hash_1 = require("./set-hash");
20
+ const set_process_1 = require("./set-process");
21
+ const transfer_limit_1 = require("./transfer-limit");
22
+ const withdraw_1 = require("./withdraw");
23
+ class MsgClientImpl {
24
+ rpc;
25
+ constructor(rpc) {
26
+ this.rpc = rpc;
27
+ this.RequestTransaction = this.RequestTransaction.bind(this);
28
+ this.FinalizeTransaction = this.FinalizeTransaction.bind(this);
29
+ this.RequestProvisionTransaction =
30
+ this.RequestProvisionTransaction.bind(this);
31
+ this.CancelTransaction = this.CancelTransaction.bind(this);
32
+ this.SetTxHash = this.SetTxHash.bind(this);
33
+ this.SetTxProcess = this.SetTxProcess.bind(this);
34
+ this.FinalizeProvisionTransaction =
35
+ this.FinalizeProvisionTransaction.bind(this);
36
+ this.RequestDrainTransaction = this.RequestDrainTransaction.bind(this);
37
+ this.FinalizeDrainTransaction = this.FinalizeDrainTransaction.bind(this);
38
+ this.RequestHtlcLock = this.RequestHtlcLock.bind(this);
39
+ this.HtlcReclaim = this.HtlcReclaim.bind(this);
40
+ this.UpdateLiquidityProvisionParams =
41
+ this.UpdateLiquidityProvisionParams.bind(this);
42
+ this.UpdateTransferLimitParams = this.UpdateTransferLimitParams.bind(this);
43
+ this.FinalizeWithdrawTransaction =
44
+ this.FinalizeWithdrawTransaction.bind(this);
45
+ }
46
+ RequestTransaction(request) {
47
+ const data = request_1.MsgRequestTransaction.encode(request).finish();
48
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "RequestTransaction", data);
49
+ return promise.then((data) => response_1.MsgRequestTransactionResponse.decode(new probuff_config_1.default.Reader(data)));
50
+ }
51
+ FinalizeTransaction(request) {
52
+ const data = finalize_1.MsgFinalizeTransaction.encode(request).finish();
53
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "FinalizeTransaction", data);
54
+ return promise.then((data) => finalize_1.MsgFinalizeTransactionResponse.decode(new probuff_config_1.default.Reader(data)));
55
+ }
56
+ RequestProvisionTransaction(request) {
57
+ const data = provision_1.MsgRequestProvisionTransaction.encode(request).finish();
58
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "RequestProvisionTransaction", data);
59
+ return promise.then((data) => provision_1.MsgRequestProvisionTransactionResponse.decode(new probuff_config_1.default.Reader(data)));
60
+ }
61
+ CancelTransaction(request) {
62
+ const data = cancel_1.MsgCancelTransaction.encode(request).finish();
63
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "CancelTransaction", data);
64
+ return promise.then((data) => cancel_1.MsgCancelTransactionResponse.decode(new probuff_config_1.default.Reader(data)));
65
+ }
66
+ SetTxHash(request) {
67
+ const data = set_hash_1.MsgSetTxHash.encode(request).finish();
68
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "SetTxHash", data);
69
+ return promise.then((data) => set_hash_1.MsgSetTxHashResponse.decode(new probuff_config_1.default.Reader(data)));
70
+ }
71
+ SetTxProcess(request) {
72
+ const data = set_process_1.MsgSetTxProcess.encode(request).finish();
73
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "SetTxProcess", data);
74
+ return promise.then((data) => set_process_1.MsgSetTxProcessResponse.decode(new probuff_config_1.default.Reader(data)));
75
+ }
76
+ FinalizeProvisionTransaction(request) {
77
+ const data = provision_finalize_1.MsgFinalizeProvisionTransaction.encode(request).finish();
78
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "FinalizeProvisionTransaction", data);
79
+ return promise.then((data) => provision_finalize_1.MsgFinalizeProvisionTransactionResponse.decode(new probuff_config_1.default.Reader(data)));
80
+ }
81
+ RequestDrainTransaction(request) {
82
+ const data = drain_1.MsgRequestDrainTransaction.encode(request).finish();
83
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "RequestDrainTransaction", data);
84
+ return promise.then((data) => drain_1.MsgRequestDrainTransactionResponse.decode(new probuff_config_1.default.Reader(data)));
85
+ }
86
+ FinalizeDrainTransaction(request) {
87
+ const data = drain_finalize_1.MsgFinalizeDrainTransaction.encode(request).finish();
88
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "FinalizeDrainTransaction", data);
89
+ return promise.then((data) => drain_finalize_1.MsgFinalizeDrainTransactionResponse.decode(new probuff_config_1.default.Reader(data)));
90
+ }
91
+ RequestHtlcLock(request) {
92
+ const data = htlc_lock_1.MsgRequestHtlcLock.encode(request).finish();
93
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "RequestHtlcLock", data);
94
+ return promise.then((data) => htlc_lock_1.MsgRequestHtlcLockResponse.decode(new probuff_config_1.default.Reader(data)));
95
+ }
96
+ HtlcReclaim(request) {
97
+ const data = htlc_reclaim_1.MsgHtlcReclaim.encode(request).finish();
98
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "HtlcReclaim", data);
99
+ return promise.then((data) => htlc_reclaim_1.MsgHtlcReclaimResponse.decode(new probuff_config_1.default.Reader(data)));
100
+ }
101
+ UpdateLiquidityProvisionParams(request) {
102
+ const data = liquidity_provision_1.MsgUpdateLiquidityProvisionParams.encode(request).finish();
103
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "UpdateLiquidityProvisionParams", data);
104
+ return promise.then((data) => liquidity_provision_1.MsgUpdateLiquidityProvisionParamsResponse.decode(new probuff_config_1.default.Reader(data)));
105
+ }
106
+ UpdateTransferLimitParams(request) {
107
+ const data = transfer_limit_1.MsgUpdateTransferLimitParams.encode(request).finish();
108
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "UpdateTransferLimitParams", data);
109
+ return promise.then((data) => transfer_limit_1.MsgUpdateTransferLimitParamsResponse.decode(new probuff_config_1.default.Reader(data)));
110
+ }
111
+ FinalizeWithdrawTransaction(request) {
112
+ const data = withdraw_1.MsgFinalizeWithdrawTransaction.encode(request).finish();
113
+ const promise = this.rpc.request("kimablockchain.transaction.Msg", "FinalizeWithdrawTransaction", data);
114
+ return promise.then((data) => withdraw_1.MsgFinalizeWithdrawTransactionResponse.decode(new probuff_config_1.default.Reader(data)));
115
+ }
116
+ }
117
+ exports.MsgClientImpl = MsgClientImpl;
@@ -0,0 +1,47 @@
1
+ import _m0 from "../../config/probuff.config";
2
+ export interface MsgFinalizeProvisionTransaction {
3
+ creator: string;
4
+ txId: number;
5
+ txHash: string;
6
+ success: boolean;
7
+ signedKey: string;
8
+ errReason: string;
9
+ }
10
+ export interface MsgFinalizeProvisionTransactionResponse {
11
+ code: string;
12
+ msg: string;
13
+ }
14
+ export declare const MsgFinalizeProvisionTransaction: {
15
+ encode(message: MsgFinalizeProvisionTransaction, writer?: _m0.Writer): _m0.Writer;
16
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgFinalizeProvisionTransaction;
17
+ fromJSON(object: any): MsgFinalizeProvisionTransaction;
18
+ toJSON(message: MsgFinalizeProvisionTransaction): unknown;
19
+ fromPartial<I extends {
20
+ creator?: string | undefined;
21
+ txId?: number | undefined;
22
+ txHash?: string | undefined;
23
+ success?: boolean | undefined;
24
+ signedKey?: string | undefined;
25
+ errReason?: string | undefined;
26
+ } & {
27
+ creator?: string | undefined;
28
+ txId?: number | undefined;
29
+ txHash?: string | undefined;
30
+ success?: boolean | undefined;
31
+ signedKey?: string | undefined;
32
+ errReason?: string | undefined;
33
+ } & { [K in Exclude<keyof I, keyof MsgFinalizeProvisionTransaction>]: never; }>(object: I): MsgFinalizeProvisionTransaction;
34
+ };
35
+ export declare const MsgFinalizeProvisionTransactionResponse: {
36
+ encode(message: MsgFinalizeProvisionTransactionResponse, writer?: _m0.Writer): _m0.Writer;
37
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgFinalizeProvisionTransactionResponse;
38
+ fromJSON(object: any): MsgFinalizeProvisionTransactionResponse;
39
+ toJSON(message: MsgFinalizeProvisionTransactionResponse): unknown;
40
+ fromPartial<I extends {
41
+ code?: string | undefined;
42
+ msg?: string | undefined;
43
+ } & {
44
+ code?: string | undefined;
45
+ msg?: string | undefined;
46
+ } & { [K in Exclude<keyof I, keyof MsgFinalizeProvisionTransactionResponse>]: never; }>(object: I): MsgFinalizeProvisionTransactionResponse;
47
+ };
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MsgFinalizeProvisionTransactionResponse = exports.MsgFinalizeProvisionTransaction = void 0;
7
+ const probuff_config_1 = __importDefault(require("../../config/probuff.config"));
8
+ const utils_1 = require("../../utils");
9
+ function createBaseMsgFinalizeProvisionTransaction() {
10
+ return {
11
+ creator: "",
12
+ txId: 0,
13
+ txHash: "",
14
+ success: false,
15
+ signedKey: "",
16
+ errReason: "",
17
+ };
18
+ }
19
+ exports.MsgFinalizeProvisionTransaction = {
20
+ encode(message, writer = probuff_config_1.default.Writer.create()) {
21
+ if (message.creator !== "") {
22
+ writer.uint32(10).string(message.creator);
23
+ }
24
+ if (message.txId !== 0) {
25
+ writer.uint32(16).uint64(message.txId);
26
+ }
27
+ if (message.txHash !== "") {
28
+ writer.uint32(26).string(message.txHash);
29
+ }
30
+ if (message.success === true) {
31
+ writer.uint32(32).bool(message.success);
32
+ }
33
+ if (message.signedKey !== "") {
34
+ writer.uint32(42).string(message.signedKey);
35
+ }
36
+ if (message.errReason !== "") {
37
+ writer.uint32(50).string(message.errReason);
38
+ }
39
+ return writer;
40
+ },
41
+ decode(input, length) {
42
+ const reader = input instanceof probuff_config_1.default.Reader ? input : new probuff_config_1.default.Reader(input);
43
+ let end = length === undefined ? reader.len : reader.pos + length;
44
+ const message = createBaseMsgFinalizeProvisionTransaction();
45
+ while (reader.pos < end) {
46
+ const tag = reader.uint32();
47
+ switch (tag >>> 3) {
48
+ case 1:
49
+ message.creator = reader.string();
50
+ break;
51
+ case 2:
52
+ message.txId = (0, utils_1.longToNumber)(reader.uint64());
53
+ break;
54
+ case 3:
55
+ message.txHash = reader.string();
56
+ break;
57
+ case 4:
58
+ message.success = reader.bool();
59
+ break;
60
+ case 5:
61
+ message.signedKey = reader.string();
62
+ break;
63
+ case 6:
64
+ message.errReason = reader.string();
65
+ break;
66
+ default:
67
+ reader.skipType(tag & 7);
68
+ break;
69
+ }
70
+ }
71
+ return message;
72
+ },
73
+ fromJSON(object) {
74
+ return {
75
+ creator: (0, utils_1.isSet)(object.creator) ? String(object.creator) : "",
76
+ txId: (0, utils_1.isSet)(object.txId) ? Number(object.txId) : 0,
77
+ txHash: (0, utils_1.isSet)(object.txHash) ? String(object.txHash) : "",
78
+ success: (0, utils_1.isSet)(object.success) ? Boolean(object.success) : false,
79
+ signedKey: (0, utils_1.isSet)(object.signedKey) ? String(object.signedKey) : "",
80
+ errReason: (0, utils_1.isSet)(object.errReason) ? String(object.errReason) : "",
81
+ };
82
+ },
83
+ toJSON(message) {
84
+ const obj = {};
85
+ message.creator !== undefined && (obj.creator = message.creator);
86
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
87
+ message.txHash !== undefined && (obj.txHash = message.txHash);
88
+ message.success !== undefined && (obj.success = message.success);
89
+ message.signedKey !== undefined && (obj.signedKey = message.signedKey);
90
+ message.errReason !== undefined && (obj.errReason = message.errReason);
91
+ return obj;
92
+ },
93
+ fromPartial(object) {
94
+ const message = createBaseMsgFinalizeProvisionTransaction();
95
+ message.creator = object.creator ?? "";
96
+ message.txId = object.txId ?? 0;
97
+ message.txHash = object.txHash ?? "";
98
+ message.success = object.success ?? false;
99
+ message.signedKey = object.signedKey ?? "";
100
+ message.errReason = object.errReason ?? "";
101
+ return message;
102
+ },
103
+ };
104
+ function createBaseMsgFinalizeProvisionTransactionResponse() {
105
+ return { code: "", msg: "" };
106
+ }
107
+ exports.MsgFinalizeProvisionTransactionResponse = {
108
+ encode(message, writer = probuff_config_1.default.Writer.create()) {
109
+ if (message.code !== "") {
110
+ writer.uint32(10).string(message.code);
111
+ }
112
+ if (message.msg !== "") {
113
+ writer.uint32(18).string(message.msg);
114
+ }
115
+ return writer;
116
+ },
117
+ decode(input, length) {
118
+ const reader = input instanceof probuff_config_1.default.Reader ? input : new probuff_config_1.default.Reader(input);
119
+ let end = length === undefined ? reader.len : reader.pos + length;
120
+ const message = createBaseMsgFinalizeProvisionTransactionResponse();
121
+ while (reader.pos < end) {
122
+ const tag = reader.uint32();
123
+ switch (tag >>> 3) {
124
+ case 1:
125
+ message.code = reader.string();
126
+ break;
127
+ case 2:
128
+ message.msg = reader.string();
129
+ break;
130
+ default:
131
+ reader.skipType(tag & 7);
132
+ break;
133
+ }
134
+ }
135
+ return message;
136
+ },
137
+ fromJSON(object) {
138
+ return {
139
+ code: (0, utils_1.isSet)(object.code) ? String(object.code) : "",
140
+ msg: (0, utils_1.isSet)(object.msg) ? String(object.msg) : "",
141
+ };
142
+ },
143
+ toJSON(message) {
144
+ const obj = {};
145
+ message.code !== undefined && (obj.code = message.code);
146
+ message.msg !== undefined && (obj.msg = message.msg);
147
+ return obj;
148
+ },
149
+ fromPartial(object) {
150
+ const message = createBaseMsgFinalizeProvisionTransactionResponse();
151
+ message.code = object.code ?? "";
152
+ message.msg = object.msg ?? "";
153
+ return message;
154
+ },
155
+ };
@@ -0,0 +1,70 @@
1
+ import _m0 from "../../config/probuff.config";
2
+ export interface MsgRequestProvisionTransaction {
3
+ creator: string;
4
+ chain: string;
5
+ fromAddress: string;
6
+ symbol: string;
7
+ amount: string;
8
+ options: string;
9
+ /** BTC transaction */
10
+ htlcExpirationTimestamp: string;
11
+ /** the txhash locking the funds in the HTLC */
12
+ htlcCreationHash: string;
13
+ /** the output index of the locked funds in the HTLC creation transaction */
14
+ htlcCreationVout: number;
15
+ /** a version denoting which HTLC script version is being using for the HTLC transaction */
16
+ htlcVersion: string;
17
+ /** the (compressed) public key of the sender */
18
+ senderPubKey: Uint8Array;
19
+ }
20
+ export interface MsgRequestProvisionTransactionResponse {
21
+ code: string;
22
+ msg: string;
23
+ txId: number;
24
+ }
25
+ export declare const MsgRequestProvisionTransaction: {
26
+ encode(message: MsgRequestProvisionTransaction, writer?: _m0.Writer): _m0.Writer;
27
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestProvisionTransaction;
28
+ fromJSON(object: any): MsgRequestProvisionTransaction;
29
+ toJSON(message: MsgRequestProvisionTransaction): unknown;
30
+ fromPartial<I extends {
31
+ creator?: string | undefined;
32
+ chain?: string | undefined;
33
+ fromAddress?: string | undefined;
34
+ symbol?: string | undefined;
35
+ amount?: string | undefined;
36
+ options?: string | undefined;
37
+ htlcExpirationTimestamp?: string | undefined;
38
+ htlcCreationHash?: string | undefined;
39
+ htlcCreationVout?: number | undefined;
40
+ htlcVersion?: string | undefined;
41
+ senderPubKey?: Uint8Array | undefined;
42
+ } & {
43
+ creator?: string | undefined;
44
+ chain?: string | undefined;
45
+ fromAddress?: string | undefined;
46
+ symbol?: string | undefined;
47
+ amount?: string | undefined;
48
+ options?: string | undefined;
49
+ htlcExpirationTimestamp?: string | undefined;
50
+ htlcCreationHash?: string | undefined;
51
+ htlcCreationVout?: number | undefined;
52
+ htlcVersion?: string | undefined;
53
+ senderPubKey?: Uint8Array | undefined;
54
+ } & { [K in Exclude<keyof I, keyof MsgRequestProvisionTransaction>]: never; }>(object: I): MsgRequestProvisionTransaction;
55
+ };
56
+ export declare const MsgRequestProvisionTransactionResponse: {
57
+ encode(message: MsgRequestProvisionTransactionResponse, writer?: _m0.Writer): _m0.Writer;
58
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestProvisionTransactionResponse;
59
+ fromJSON(object: any): MsgRequestProvisionTransactionResponse;
60
+ toJSON(message: MsgRequestProvisionTransactionResponse): unknown;
61
+ fromPartial<I extends {
62
+ code?: string | undefined;
63
+ msg?: string | undefined;
64
+ txId?: number | undefined;
65
+ } & {
66
+ code?: string | undefined;
67
+ msg?: string | undefined;
68
+ txId?: number | undefined;
69
+ } & { [K in Exclude<keyof I, keyof MsgRequestProvisionTransactionResponse>]: never; }>(object: I): MsgRequestProvisionTransactionResponse;
70
+ };
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MsgRequestProvisionTransactionResponse = exports.MsgRequestProvisionTransaction = void 0;
7
+ const probuff_config_1 = __importDefault(require("../../config/probuff.config"));
8
+ const utils_1 = require("../../utils");
9
+ function createBaseMsgRequestProvisionTransaction() {
10
+ return {
11
+ creator: "",
12
+ chain: "",
13
+ fromAddress: "",
14
+ symbol: "",
15
+ amount: "",
16
+ options: "",
17
+ htlcExpirationTimestamp: "",
18
+ htlcCreationHash: "",
19
+ htlcCreationVout: 0,
20
+ htlcVersion: "",
21
+ senderPubKey: new Uint8Array(),
22
+ };
23
+ }
24
+ exports.MsgRequestProvisionTransaction = {
25
+ encode(message, writer = probuff_config_1.default.Writer.create()) {
26
+ if (message.creator !== "") {
27
+ writer.uint32(10).string(message.creator);
28
+ }
29
+ if (message.chain !== "") {
30
+ writer.uint32(18).string(message.chain);
31
+ }
32
+ if (message.fromAddress !== "") {
33
+ writer.uint32(26).string(message.fromAddress);
34
+ }
35
+ if (message.symbol !== "") {
36
+ writer.uint32(34).string(message.symbol);
37
+ }
38
+ if (message.amount !== "") {
39
+ writer.uint32(42).string(message.amount);
40
+ }
41
+ if (message.options !== "") {
42
+ writer.uint32(50).string(message.options);
43
+ }
44
+ if (message.htlcExpirationTimestamp !== "") {
45
+ writer.uint32(58).string(message.htlcExpirationTimestamp);
46
+ }
47
+ if (message.htlcCreationHash !== "") {
48
+ writer.uint32(66).string(message.htlcCreationHash);
49
+ }
50
+ if (message.htlcCreationVout !== 0) {
51
+ writer.uint32(72).uint32(message.htlcCreationVout);
52
+ }
53
+ if (message.htlcVersion !== "") {
54
+ writer.uint32(82).string(message.htlcVersion);
55
+ }
56
+ if (message.senderPubKey.length !== 0) {
57
+ writer.uint32(90).bytes(message.senderPubKey);
58
+ }
59
+ return writer;
60
+ },
61
+ decode(input, length) {
62
+ const reader = input instanceof probuff_config_1.default.Reader ? input : new probuff_config_1.default.Reader(input);
63
+ let end = length === undefined ? reader.len : reader.pos + length;
64
+ const message = createBaseMsgRequestProvisionTransaction();
65
+ while (reader.pos < end) {
66
+ const tag = reader.uint32();
67
+ switch (tag >>> 3) {
68
+ case 1:
69
+ message.creator = reader.string();
70
+ break;
71
+ case 2:
72
+ message.chain = reader.string();
73
+ break;
74
+ case 3:
75
+ message.fromAddress = reader.string();
76
+ break;
77
+ case 4:
78
+ message.symbol = reader.string();
79
+ break;
80
+ case 5:
81
+ message.amount = reader.string();
82
+ break;
83
+ case 6:
84
+ message.options = reader.string();
85
+ break;
86
+ case 7:
87
+ message.htlcExpirationTimestamp = reader.string();
88
+ break;
89
+ case 8:
90
+ message.htlcCreationHash = reader.string();
91
+ break;
92
+ case 9:
93
+ message.htlcCreationVout = reader.uint32();
94
+ break;
95
+ case 10:
96
+ message.htlcVersion = reader.string();
97
+ break;
98
+ case 11:
99
+ message.senderPubKey = reader.bytes();
100
+ break;
101
+ default:
102
+ reader.skipType(tag & 7);
103
+ break;
104
+ }
105
+ }
106
+ return message;
107
+ },
108
+ fromJSON(object) {
109
+ return {
110
+ creator: (0, utils_1.isSet)(object.creator) ? String(object.creator) : "",
111
+ chain: (0, utils_1.isSet)(object.chain) ? String(object.chain) : "",
112
+ fromAddress: (0, utils_1.isSet)(object.fromAddress) ? String(object.fromAddress) : "",
113
+ symbol: (0, utils_1.isSet)(object.symbol) ? String(object.symbol) : "",
114
+ amount: (0, utils_1.isSet)(object.amount) ? String(object.amount) : "",
115
+ options: (0, utils_1.isSet)(object.options) ? String(object.options) : "",
116
+ htlcExpirationTimestamp: (0, utils_1.isSet)(object.htlcExpirationTimestamp)
117
+ ? String(object.htlcExpirationTimestamp)
118
+ : "",
119
+ htlcCreationHash: (0, utils_1.isSet)(object.htlcCreationHash)
120
+ ? String(object.htlcCreationHash)
121
+ : "",
122
+ htlcCreationVout: (0, utils_1.isSet)(object.htlcCreationVout)
123
+ ? Number(object.htlcCreationVout)
124
+ : 0,
125
+ htlcVersion: (0, utils_1.isSet)(object.htlcVersion) ? String(object.htlcVersion) : "",
126
+ senderPubKey: (0, utils_1.isSet)(object.senderPubKey)
127
+ ? (0, utils_1.bytesFromBase64)(object.senderPubKey)
128
+ : new Uint8Array(),
129
+ };
130
+ },
131
+ toJSON(message) {
132
+ const obj = {};
133
+ message.creator !== undefined && (obj.creator = message.creator);
134
+ message.chain !== undefined && (obj.chain = message.chain);
135
+ message.fromAddress !== undefined &&
136
+ (obj.fromAddress = message.fromAddress);
137
+ message.symbol !== undefined && (obj.symbol = message.symbol);
138
+ message.amount !== undefined && (obj.amount = message.amount);
139
+ message.options !== undefined && (obj.options = message.options);
140
+ message.htlcExpirationTimestamp !== undefined &&
141
+ (obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
142
+ message.htlcCreationHash !== undefined &&
143
+ (obj.htlcCreationHash = message.htlcCreationHash);
144
+ message.htlcCreationVout !== undefined &&
145
+ (obj.htlcCreationVout = Math.round(message.htlcCreationVout));
146
+ message.htlcVersion !== undefined &&
147
+ (obj.htlcVersion = message.htlcVersion);
148
+ message.senderPubKey !== undefined &&
149
+ (obj.senderPubKey = (0, utils_1.base64FromBytes)(message.senderPubKey !== undefined
150
+ ? message.senderPubKey
151
+ : new Uint8Array()));
152
+ return obj;
153
+ },
154
+ fromPartial(object) {
155
+ const message = createBaseMsgRequestProvisionTransaction();
156
+ message.creator = object.creator ?? "";
157
+ message.chain = object.chain ?? "";
158
+ message.fromAddress = object.fromAddress ?? "";
159
+ message.symbol = object.symbol ?? "";
160
+ message.amount = object.amount ?? "";
161
+ message.options = object.options ?? "";
162
+ message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
163
+ message.htlcCreationHash = object.htlcCreationHash ?? "";
164
+ message.htlcCreationVout = object.htlcCreationVout ?? 0;
165
+ message.htlcVersion = object.htlcVersion ?? "";
166
+ message.senderPubKey = object.senderPubKey ?? new Uint8Array();
167
+ return message;
168
+ },
169
+ };
170
+ function createBaseMsgRequestProvisionTransactionResponse() {
171
+ return { code: "", msg: "", txId: 0 };
172
+ }
173
+ exports.MsgRequestProvisionTransactionResponse = {
174
+ encode(message, writer = probuff_config_1.default.Writer.create()) {
175
+ if (message.code !== "") {
176
+ writer.uint32(10).string(message.code);
177
+ }
178
+ if (message.msg !== "") {
179
+ writer.uint32(18).string(message.msg);
180
+ }
181
+ if (message.txId !== 0) {
182
+ writer.uint32(24).uint64(message.txId);
183
+ }
184
+ return writer;
185
+ },
186
+ decode(input, length) {
187
+ const reader = input instanceof probuff_config_1.default.Reader ? input : new probuff_config_1.default.Reader(input);
188
+ let end = length === undefined ? reader.len : reader.pos + length;
189
+ const message = createBaseMsgRequestProvisionTransactionResponse();
190
+ while (reader.pos < end) {
191
+ const tag = reader.uint32();
192
+ switch (tag >>> 3) {
193
+ case 1:
194
+ message.code = reader.string();
195
+ break;
196
+ case 2:
197
+ message.msg = reader.string();
198
+ break;
199
+ case 3:
200
+ message.txId = (0, utils_1.longToNumber)(reader.uint64());
201
+ break;
202
+ default:
203
+ reader.skipType(tag & 7);
204
+ break;
205
+ }
206
+ }
207
+ return message;
208
+ },
209
+ fromJSON(object) {
210
+ return {
211
+ code: (0, utils_1.isSet)(object.code) ? String(object.code) : "",
212
+ msg: (0, utils_1.isSet)(object.msg) ? String(object.msg) : "",
213
+ txId: (0, utils_1.isSet)(object.txId) ? Number(object.txId) : 0,
214
+ };
215
+ },
216
+ toJSON(message) {
217
+ const obj = {};
218
+ message.code !== undefined && (obj.code = message.code);
219
+ message.msg !== undefined && (obj.msg = message.msg);
220
+ message.txId !== undefined && (obj.txId = Math.round(message.txId));
221
+ return obj;
222
+ },
223
+ fromPartial(object) {
224
+ const message = createBaseMsgRequestProvisionTransactionResponse();
225
+ message.code = object.code ?? "";
226
+ message.msg = object.msg ?? "";
227
+ message.txId = object.txId ?? 0;
228
+ return message;
229
+ },
230
+ };