@kimafinance/kima-transaction-api 1.4.1 → 1.4.2

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 (82) hide show
  1. package/build/index.d.ts +50 -3
  2. package/build/index.js +121 -17
  3. package/build/kima/common.d.ts +1 -4
  4. package/build/kima/common.js +9 -12
  5. package/build/kima/tx.d.ts +674 -0
  6. package/build/kima/tx.js +2170 -0
  7. package/package.json +10 -10
  8. package/src/index.ts +206 -3
  9. package/src/kima/common.ts +12 -5
  10. package/src/kima/tx.ts +2945 -0
  11. package/build/api/htlc-lock.d.ts +0 -23
  12. package/build/api/htlc-lock.js +0 -37
  13. package/build/api/htlc-reclaim.d.ts +0 -14
  14. package/build/api/htlc-reclaim.js +0 -28
  15. package/build/api/submit.d.ts +0 -54
  16. package/build/api/submit.js +0 -94
  17. package/build/config/global-this.config.d.ts +0 -2
  18. package/build/config/global-this.config.js +0 -18
  19. package/build/config/probuff.config.d.ts +0 -2
  20. package/build/config/probuff.config.js +0 -12
  21. package/build/kima/tx/cancel.d.ts +0 -35
  22. package/build/kima/tx/cancel.js +0 -115
  23. package/build/kima/tx/drain-finalize.d.ts +0 -47
  24. package/build/kima/tx/drain-finalize.js +0 -155
  25. package/build/kima/tx/drain.d.ts +0 -50
  26. package/build/kima/tx/drain.js +0 -164
  27. package/build/kima/tx/finalize.d.ts +0 -47
  28. package/build/kima/tx/finalize.js +0 -155
  29. package/build/kima/tx/htlc-lock.d.ts +0 -42
  30. package/build/kima/tx/htlc-lock.js +0 -152
  31. package/build/kima/tx/htlc-reclaim.d.ts +0 -30
  32. package/build/kima/tx/htlc-reclaim.js +0 -105
  33. package/build/kima/tx/index.d.ts +0 -1
  34. package/build/kima/tx/index.js +0 -4
  35. package/build/kima/tx/liquidity-provision.d.ts +0 -30
  36. package/build/kima/tx/liquidity-provision.js +0 -102
  37. package/build/kima/tx/message-service.d.ts +0 -54
  38. package/build/kima/tx/message-service.js +0 -117
  39. package/build/kima/tx/provision-finalize.d.ts +0 -47
  40. package/build/kima/tx/provision-finalize.js +0 -155
  41. package/build/kima/tx/provision.d.ts +0 -70
  42. package/build/kima/tx/provision.js +0 -230
  43. package/build/kima/tx/request.d.ts +0 -63
  44. package/build/kima/tx/request.js +0 -222
  45. package/build/kima/tx/response.d.ts +0 -21
  46. package/build/kima/tx/response.js +0 -69
  47. package/build/kima/tx/rpc.d.ts +0 -0
  48. package/build/kima/tx/rpc.js +0 -1
  49. package/build/kima/tx/set-hash.d.ts +0 -42
  50. package/build/kima/tx/set-hash.js +0 -130
  51. package/build/kima/tx/set-process.d.ts +0 -37
  52. package/build/kima/tx/set-process.js +0 -121
  53. package/build/kima/tx/transfer-limit.d.ts +0 -30
  54. package/build/kima/tx/transfer-limit.js +0 -102
  55. package/build/kima/tx/withdraw.d.ts +0 -47
  56. package/build/kima/tx/withdraw.js +0 -155
  57. package/build/utils.d.ts +0 -17
  58. package/build/utils.js +0 -49
  59. package/src/api/htlc-lock.ts +0 -57
  60. package/src/api/htlc-reclaim.ts +0 -39
  61. package/src/api/submit.ts +0 -132
  62. package/src/config/global-this.config.ts +0 -20
  63. package/src/config/probuff.config.ts +0 -9
  64. package/src/kima/tx/cancel.ts +0 -147
  65. package/src/kima/tx/drain-finalize.ts +0 -191
  66. package/src/kima/tx/drain.ts +0 -201
  67. package/src/kima/tx/finalize.ts +0 -191
  68. package/src/kima/tx/htlc-lock.ts +0 -183
  69. package/src/kima/tx/htlc-reclaim.ts +0 -132
  70. package/src/kima/tx/index.ts +0 -1
  71. package/src/kima/tx/liquidity-provision.ts +0 -132
  72. package/src/kima/tx/message-service.ts +0 -278
  73. package/src/kima/tx/provision-finalize.ts +0 -191
  74. package/src/kima/tx/provision.ts +0 -279
  75. package/src/kima/tx/request.ts +0 -256
  76. package/src/kima/tx/response.ts +0 -83
  77. package/src/kima/tx/rpc.ts +0 -0
  78. package/src/kima/tx/set-hash.ts +0 -162
  79. package/src/kima/tx/set-process.ts +0 -151
  80. package/src/kima/tx/transfer-limit.ts +0 -132
  81. package/src/kima/tx/withdraw.ts +0 -191
  82. package/src/utils.ts +0 -67
@@ -1,23 +0,0 @@
1
- export interface RequestHtlcLockProps {
2
- fromAddress: string;
3
- senderPubkey: string;
4
- amount: string;
5
- htlcTimeout: string;
6
- txHash: string;
7
- htlcAddress: string;
8
- }
9
- /**
10
- * Create an HTCL transaction
11
- *
12
- * @export
13
- * @async
14
- * @param {RequestHtlcLockProps} param0
15
- * @param {string} param0.fromAddress - The creator wallet address
16
- * @param {string} param0.senderPubkey - The creator wallet public key
17
- * @param {string} param0.amount - The total amount to be locked including fees
18
- * @param {string} param0.htlcTimeout - The time in seconds the HTLC will be valid for
19
- * @param {string} param0.txHash - The transaction hash of the HTLC lock
20
- * @param {string} param0.htlcAddress - The HTLC address
21
- * @returns {Promise<DeliverTxResponse>}
22
- */
23
- export declare function submitHtlcLock({ fromAddress, senderPubkey, amount, htlcTimeout, txHash, htlcAddress, }: RequestHtlcLockProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitHtlcLock = void 0;
4
- const proto_signing_1 = require("@cosmjs/proto-signing");
5
- const common_1 = require("../kima/common");
6
- /**
7
- * Create an HTCL transaction
8
- *
9
- * @export
10
- * @async
11
- * @param {RequestHtlcLockProps} param0
12
- * @param {string} param0.fromAddress - The creator wallet address
13
- * @param {string} param0.senderPubkey - The creator wallet public key
14
- * @param {string} param0.amount - The total amount to be locked including fees
15
- * @param {string} param0.htlcTimeout - The time in seconds the HTLC will be valid for
16
- * @param {string} param0.txHash - The transaction hash of the HTLC lock
17
- * @param {string} param0.htlcAddress - The HTLC address
18
- * @returns {Promise<DeliverTxResponse>}
19
- */
20
- async function submitHtlcLock({ fromAddress, senderPubkey, amount, htlcTimeout, txHash, htlcAddress, }) {
21
- const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
22
- const client = await (0, common_1.TxClient)(wallet);
23
- const [firstAccount] = await wallet.getAccounts();
24
- const params = {
25
- creator: firstAccount.address,
26
- fromAddress,
27
- senderPubkey,
28
- amount,
29
- htlcTimeout,
30
- htlcAddress,
31
- txHash,
32
- };
33
- let msg = await client.msgRequestHtlcLock(params);
34
- const result = await client.signAndBroadcast([msg]);
35
- return result;
36
- }
37
- exports.submitHtlcLock = submitHtlcLock;
@@ -1,14 +0,0 @@
1
- export interface RequestHtlcReclaimProps {
2
- senderAddress: string;
3
- txHash: string;
4
- }
5
- /**
6
- * Cancel an HTCL lock by user taking back the funds
7
- * @export
8
- * @async
9
- * @param {RequestHtlcReclaimProps} param0
10
- * @param {string} param0.senderAddress - The creator wallet address
11
- * @param {string} param0.txHash - The transaction hash of the HTLC lock
12
- * @returns {Promise<DeliverTxResponse>}
13
- */
14
- export declare function HtlcReclaim({ senderAddress, txHash, }: RequestHtlcReclaimProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HtlcReclaim = void 0;
4
- const proto_signing_1 = require("@cosmjs/proto-signing");
5
- const common_1 = require("../kima/common");
6
- /**
7
- * Cancel an HTCL lock by user taking back the funds
8
- * @export
9
- * @async
10
- * @param {RequestHtlcReclaimProps} param0
11
- * @param {string} param0.senderAddress - The creator wallet address
12
- * @param {string} param0.txHash - The transaction hash of the HTLC lock
13
- * @returns {Promise<DeliverTxResponse>}
14
- */
15
- async function HtlcReclaim({ senderAddress, txHash, }) {
16
- const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
17
- const client = await (0, common_1.TxClient)(wallet);
18
- const [firstAccount] = await wallet.getAccounts();
19
- const params = {
20
- creator: firstAccount.address,
21
- senderAddress,
22
- txHash,
23
- };
24
- let msg = await client.msgHtlcReclaim(params);
25
- const result = await client.signAndBroadcast([msg]);
26
- return result;
27
- }
28
- exports.HtlcReclaim = HtlcReclaim;
@@ -1,54 +0,0 @@
1
- export declare enum SupportedNetworks {
2
- ARBITRIUM = "ARB",
3
- AVALANCHE = "AVX",
4
- BSC = "BSC",
5
- BTC = "BTC",
6
- ETHEREUM = "ETH",
7
- OPTIMISM = "OPT",
8
- POLYGON = "POL",
9
- SOLANA = "SOL",
10
- TRON = "TRX"
11
- }
12
- export declare enum CurrencyOptions {
13
- USDT = "USDT",
14
- USDC = "USDC",
15
- USDK = "USDK"
16
- }
17
- export interface RequestTxProps {
18
- originChain: SupportedNetworks;
19
- originAddress: string;
20
- targetChain: SupportedNetworks;
21
- targetAddress: string;
22
- originSymbol: CurrencyOptions;
23
- targetSymbol: CurrencyOptions;
24
- amount: number;
25
- fee: number;
26
- htlcCreationHash: string;
27
- htlcCreationVout: number;
28
- htlcExpirationTimestamp: string;
29
- htlcVersion: string;
30
- senderPubKey: Uint8Array;
31
- }
32
- /**
33
- * Create a Kima transfer transaction. The HTLC parameters are only required on Bitcoin, use blank strings (or zeros) for other chains.
34
- * The approval or HTLC transaction must be completed before submitting the Kima transaction or it will fail.
35
- *
36
- * @export
37
- * @async
38
- * @param {RequestTxProps} param0
39
- * @param {SupportedNetworks} param0.originChain - The chain the funds are being transferred from
40
- * @param {string} param0.originAddress - The user wallet address
41
- * @param {SupportedNetworks} param0.targetChain - The chain the funds are being transferred to
42
- * @param {string} param0.targetAddress - The destination wallet address
43
- * @param {CurrencyOptions} param0.originSymbol - The starting token symbol
44
- * @param {CurrencyOptions} param0.targetSymbol - The destination token symbol
45
- * @param {number} param0.amount - amount of tokens to be transferred
46
- * @param {number} param0.fee - The total fees to be paid
47
- * @param {string} param0.htlcCreationHash - (if applicable) The transaction hash of the HTLC lock
48
- * @param {number} param0.htlcCreationVout - (if applicable) The vout of the HTLC lock
49
- * @param {string} param0.htlcExpirationTimestamp - (if applicable) The expiration timestamp of the HTLC lock
50
- * @param {string} param0.htlcVersion - (if applicable) The version of the HTLC lock
51
- * @param {Uint8Array} param0.senderPubKey - (if HTLC) The creator wallet public key
52
- * @returns {Promise<DeliverTxResponse>}
53
- */
54
- export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, }: RequestTxProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
@@ -1,94 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitKimaTransaction = exports.CurrencyOptions = exports.SupportedNetworks = void 0;
4
- const proto_signing_1 = require("@cosmjs/proto-signing");
5
- const common_1 = require("../kima/common");
6
- const utils_1 = require("../utils");
7
- var SupportedNetworks;
8
- (function (SupportedNetworks) {
9
- SupportedNetworks["ARBITRIUM"] = "ARB";
10
- SupportedNetworks["AVALANCHE"] = "AVX";
11
- SupportedNetworks["BSC"] = "BSC";
12
- SupportedNetworks["BTC"] = "BTC";
13
- SupportedNetworks["ETHEREUM"] = "ETH";
14
- SupportedNetworks["OPTIMISM"] = "OPT";
15
- SupportedNetworks["POLYGON"] = "POL";
16
- SupportedNetworks["SOLANA"] = "SOL";
17
- SupportedNetworks["TRON"] = "TRX";
18
- })(SupportedNetworks = exports.SupportedNetworks || (exports.SupportedNetworks = {}));
19
- var CurrencyOptions;
20
- (function (CurrencyOptions) {
21
- CurrencyOptions["USDT"] = "USDT";
22
- CurrencyOptions["USDC"] = "USDC";
23
- CurrencyOptions["USDK"] = "USDK";
24
- })(CurrencyOptions = exports.CurrencyOptions || (exports.CurrencyOptions = {}));
25
- /**
26
- * Create a Kima transfer transaction. The HTLC parameters are only required on Bitcoin, use blank strings (or zeros) for other chains.
27
- * The approval or HTLC transaction must be completed before submitting the Kima transaction or it will fail.
28
- *
29
- * @export
30
- * @async
31
- * @param {RequestTxProps} param0
32
- * @param {SupportedNetworks} param0.originChain - The chain the funds are being transferred from
33
- * @param {string} param0.originAddress - The user wallet address
34
- * @param {SupportedNetworks} param0.targetChain - The chain the funds are being transferred to
35
- * @param {string} param0.targetAddress - The destination wallet address
36
- * @param {CurrencyOptions} param0.originSymbol - The starting token symbol
37
- * @param {CurrencyOptions} param0.targetSymbol - The destination token symbol
38
- * @param {number} param0.amount - amount of tokens to be transferred
39
- * @param {number} param0.fee - The total fees to be paid
40
- * @param {string} param0.htlcCreationHash - (if applicable) The transaction hash of the HTLC lock
41
- * @param {number} param0.htlcCreationVout - (if applicable) The vout of the HTLC lock
42
- * @param {string} param0.htlcExpirationTimestamp - (if applicable) The expiration timestamp of the HTLC lock
43
- * @param {string} param0.htlcVersion - (if applicable) The version of the HTLC lock
44
- * @param {Uint8Array} param0.senderPubKey - (if HTLC) The creator wallet public key
45
- * @returns {Promise<DeliverTxResponse>}
46
- */
47
- async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, }) {
48
- const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
49
- const client = await (0, common_1.TxClient)(wallet);
50
- const [firstAccount] = await wallet.getAccounts();
51
- const params = {
52
- creator: firstAccount.address,
53
- originChain,
54
- originAddress,
55
- targetChain,
56
- targetAddress,
57
- originSymbol,
58
- targetSymbol,
59
- amount: amount.toString(),
60
- fee: fee.toString(),
61
- htlcCreationHash,
62
- htlcCreationVout,
63
- htlcExpirationTimestamp,
64
- htlcVersion,
65
- senderPubKey,
66
- options: "",
67
- };
68
- let msg = await client.msgRequestTransaction(params);
69
- const result = await client.signAndBroadcast([msg]);
70
- let txId = 1;
71
- for (const event of result.events) {
72
- if (event.type === "transaction_requested") {
73
- for (const attr of event.attributes) {
74
- if (attr.key === "txId") {
75
- txId = +attr.value;
76
- }
77
- }
78
- }
79
- }
80
- msg = await client.msgSetTxHash({
81
- creator: firstAccount.address,
82
- txId,
83
- txHash: result.transactionHash,
84
- txType: "request_transaction",
85
- });
86
- console.log(msg);
87
- let hashResult;
88
- do {
89
- hashResult = await client.signAndBroadcast([msg]);
90
- await (0, utils_1.sleep)(1000);
91
- } while (hashResult.code !== 0);
92
- return result;
93
- }
94
- exports.submitKimaTransaction = submitKimaTransaction;
@@ -1,2 +0,0 @@
1
- declare var globalThis: any;
2
- export default globalThis;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var globalThis = (() => {
4
- if (typeof globalThis !== "undefined") {
5
- return globalThis;
6
- }
7
- if (typeof self !== "undefined") {
8
- return self;
9
- }
10
- if (typeof window !== "undefined") {
11
- return window;
12
- }
13
- if (typeof global !== "undefined") {
14
- return global;
15
- }
16
- throw "Unable to locate global object";
17
- })();
18
- exports.default = globalThis;
@@ -1,2 +0,0 @@
1
- import _m0 from "protobufjs/minimal";
2
- export default _m0;
@@ -1,12 +0,0 @@
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
- const minimal_1 = __importDefault(require("protobufjs/minimal"));
7
- const long_1 = __importDefault(require("long"));
8
- if (minimal_1.default.util.Long !== long_1.default) {
9
- minimal_1.default.util.Long = long_1.default;
10
- minimal_1.default.configure();
11
- }
12
- exports.default = minimal_1.default;
@@ -1,35 +0,0 @@
1
- import _m0 from "../../config/probuff.config";
2
- export interface MsgCancelTransaction {
3
- creator: string;
4
- transactionId: string;
5
- }
6
- export interface MsgCancelTransactionResponse {
7
- code: string;
8
- msg: string;
9
- }
10
- export declare const MsgCancelTransaction: {
11
- encode(message: MsgCancelTransaction, writer?: _m0.Writer): _m0.Writer;
12
- decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelTransaction;
13
- fromJSON(object: any): MsgCancelTransaction;
14
- toJSON(message: MsgCancelTransaction): unknown;
15
- fromPartial<I extends {
16
- creator?: string | undefined;
17
- transactionId?: string | undefined;
18
- } & {
19
- creator?: string | undefined;
20
- transactionId?: string | undefined;
21
- } & { [K in Exclude<keyof I, keyof MsgCancelTransaction>]: never; }>(object: I): MsgCancelTransaction;
22
- };
23
- export declare const MsgCancelTransactionResponse: {
24
- encode(message: MsgCancelTransactionResponse, writer?: _m0.Writer): _m0.Writer;
25
- decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelTransactionResponse;
26
- fromJSON(object: any): MsgCancelTransactionResponse;
27
- toJSON(message: MsgCancelTransactionResponse): unknown;
28
- fromPartial<I extends {
29
- code?: string | undefined;
30
- msg?: string | undefined;
31
- } & {
32
- code?: string | undefined;
33
- msg?: string | undefined;
34
- } & { [K in Exclude<keyof I, keyof MsgCancelTransactionResponse>]: never; }>(object: I): MsgCancelTransactionResponse;
35
- };
@@ -1,115 +0,0 @@
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.MsgCancelTransactionResponse = exports.MsgCancelTransaction = void 0;
7
- const probuff_config_1 = __importDefault(require("../../config/probuff.config"));
8
- const utils_1 = require("../../utils");
9
- function createBaseMsgCancelTransaction() {
10
- return { creator: "", transactionId: "" };
11
- }
12
- exports.MsgCancelTransaction = {
13
- encode(message, writer = probuff_config_1.default.Writer.create()) {
14
- if (message.creator !== "") {
15
- writer.uint32(10).string(message.creator);
16
- }
17
- if (message.transactionId !== "") {
18
- writer.uint32(18).string(message.transactionId);
19
- }
20
- return writer;
21
- },
22
- decode(input, length) {
23
- const reader = input instanceof probuff_config_1.default.Reader ? input : new probuff_config_1.default.Reader(input);
24
- let end = length === undefined ? reader.len : reader.pos + length;
25
- const message = createBaseMsgCancelTransaction();
26
- while (reader.pos < end) {
27
- const tag = reader.uint32();
28
- switch (tag >>> 3) {
29
- case 1:
30
- message.creator = reader.string();
31
- break;
32
- case 2:
33
- message.transactionId = reader.string();
34
- break;
35
- default:
36
- reader.skipType(tag & 7);
37
- break;
38
- }
39
- }
40
- return message;
41
- },
42
- fromJSON(object) {
43
- return {
44
- creator: (0, utils_1.isSet)(object.creator) ? String(object.creator) : "",
45
- transactionId: (0, utils_1.isSet)(object.transactionId)
46
- ? String(object.transactionId)
47
- : "",
48
- };
49
- },
50
- toJSON(message) {
51
- const obj = {};
52
- message.creator !== undefined && (obj.creator = message.creator);
53
- message.transactionId !== undefined &&
54
- (obj.transactionId = message.transactionId);
55
- return obj;
56
- },
57
- fromPartial(object) {
58
- const message = createBaseMsgCancelTransaction();
59
- message.creator = object.creator ?? "";
60
- message.transactionId = object.transactionId ?? "";
61
- return message;
62
- },
63
- };
64
- function createBaseMsgCancelTransactionResponse() {
65
- return { code: "", msg: "" };
66
- }
67
- exports.MsgCancelTransactionResponse = {
68
- encode(message, writer = probuff_config_1.default.Writer.create()) {
69
- if (message.code !== "") {
70
- writer.uint32(10).string(message.code);
71
- }
72
- if (message.msg !== "") {
73
- writer.uint32(18).string(message.msg);
74
- }
75
- return writer;
76
- },
77
- decode(input, length) {
78
- const reader = input instanceof probuff_config_1.default.Reader ? input : new probuff_config_1.default.Reader(input);
79
- let end = length === undefined ? reader.len : reader.pos + length;
80
- const message = createBaseMsgCancelTransactionResponse();
81
- while (reader.pos < end) {
82
- const tag = reader.uint32();
83
- switch (tag >>> 3) {
84
- case 1:
85
- message.code = reader.string();
86
- break;
87
- case 2:
88
- message.msg = reader.string();
89
- break;
90
- default:
91
- reader.skipType(tag & 7);
92
- break;
93
- }
94
- }
95
- return message;
96
- },
97
- fromJSON(object) {
98
- return {
99
- code: (0, utils_1.isSet)(object.code) ? String(object.code) : "",
100
- msg: (0, utils_1.isSet)(object.msg) ? String(object.msg) : "",
101
- };
102
- },
103
- toJSON(message) {
104
- const obj = {};
105
- message.code !== undefined && (obj.code = message.code);
106
- message.msg !== undefined && (obj.msg = message.msg);
107
- return obj;
108
- },
109
- fromPartial(object) {
110
- const message = createBaseMsgCancelTransactionResponse();
111
- message.code = object.code ?? "";
112
- message.msg = object.msg ?? "";
113
- return message;
114
- },
115
- };
@@ -1,47 +0,0 @@
1
- import _m0 from "../../config/probuff.config";
2
- export interface MsgFinalizeDrainTransaction {
3
- creator: string;
4
- txId: number;
5
- txHash: string;
6
- success: boolean;
7
- signedKey: string;
8
- errReason: string;
9
- }
10
- export interface MsgFinalizeDrainTransactionResponse {
11
- code: string;
12
- msg: string;
13
- }
14
- export declare const MsgFinalizeDrainTransaction: {
15
- encode(message: MsgFinalizeDrainTransaction, writer?: _m0.Writer): _m0.Writer;
16
- decode(input: _m0.Reader | Uint8Array, length?: number): MsgFinalizeDrainTransaction;
17
- fromJSON(object: any): MsgFinalizeDrainTransaction;
18
- toJSON(message: MsgFinalizeDrainTransaction): 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 MsgFinalizeDrainTransaction>]: never; }>(object: I): MsgFinalizeDrainTransaction;
34
- };
35
- export declare const MsgFinalizeDrainTransactionResponse: {
36
- encode(message: MsgFinalizeDrainTransactionResponse, writer?: _m0.Writer): _m0.Writer;
37
- decode(input: _m0.Reader | Uint8Array, length?: number): MsgFinalizeDrainTransactionResponse;
38
- fromJSON(object: any): MsgFinalizeDrainTransactionResponse;
39
- toJSON(message: MsgFinalizeDrainTransactionResponse): 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 MsgFinalizeDrainTransactionResponse>]: never; }>(object: I): MsgFinalizeDrainTransactionResponse;
47
- };
@@ -1,155 +0,0 @@
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.MsgFinalizeDrainTransactionResponse = exports.MsgFinalizeDrainTransaction = void 0;
7
- const probuff_config_1 = __importDefault(require("../../config/probuff.config"));
8
- const utils_1 = require("../../utils");
9
- function createBaseMsgFinalizeDrainTransaction() {
10
- return {
11
- creator: "",
12
- txId: 0,
13
- txHash: "",
14
- success: false,
15
- signedKey: "",
16
- errReason: "",
17
- };
18
- }
19
- exports.MsgFinalizeDrainTransaction = {
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 = createBaseMsgFinalizeDrainTransaction();
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 = createBaseMsgFinalizeDrainTransaction();
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 createBaseMsgFinalizeDrainTransactionResponse() {
105
- return { code: "", msg: "" };
106
- }
107
- exports.MsgFinalizeDrainTransactionResponse = {
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 = createBaseMsgFinalizeDrainTransactionResponse();
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 = createBaseMsgFinalizeDrainTransactionResponse();
151
- message.code = object.code ?? "";
152
- message.msg = object.msg ?? "";
153
- return message;
154
- },
155
- };