@kimafinance/kima-transaction-api 1.0.25-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/build/index.d.ts +16 -2
- package/build/index.js +25 -7
- package/build/kima/common.d.ts +2 -1
- package/build/kima/common.js +5 -0
- package/build/kima/tx.d.ts +61 -9
- package/build/kima/tx.js +217 -19
- package/package.json +1 -1
- package/src/index.ts +57 -8
- package/src/kima/common.ts +6 -1
- package/src/kima/tx.ts +271 -21
package/build/index.d.ts
CHANGED
|
@@ -15,7 +15,16 @@ export declare enum CurrencyOptions {
|
|
|
15
15
|
USDC = "USDC",
|
|
16
16
|
USDK = "USDK"
|
|
17
17
|
}
|
|
18
|
-
interface
|
|
18
|
+
interface RequestHtlcProps {
|
|
19
|
+
fromAddress: string;
|
|
20
|
+
senderPubkey: string;
|
|
21
|
+
amount: string;
|
|
22
|
+
htlcTimeout: string;
|
|
23
|
+
txHash: string;
|
|
24
|
+
htlcAddress: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function submitHtlcLock({ fromAddress, senderPubkey, amount, htlcTimeout, txHash, htlcAddress, }: RequestHtlcProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
27
|
+
interface RequestTxProps {
|
|
19
28
|
originChain: SupportedNetworks;
|
|
20
29
|
originAddress: string;
|
|
21
30
|
targetChain: SupportedNetworks;
|
|
@@ -23,6 +32,11 @@ interface Props {
|
|
|
23
32
|
symbol: CurrencyOptions;
|
|
24
33
|
amount: number;
|
|
25
34
|
fee: number;
|
|
35
|
+
htlcCreationHash: string;
|
|
36
|
+
htlcCreationVout: number;
|
|
37
|
+
htlcExpirationTimestamp: string;
|
|
38
|
+
htlcVersion: string;
|
|
39
|
+
senderPubKey: Uint8Array;
|
|
26
40
|
}
|
|
27
|
-
export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, }:
|
|
41
|
+
export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, }: RequestTxProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
28
42
|
export {};
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.submitKimaTransaction = exports.CurrencyOptions = exports.SupportedNetworks = void 0;
|
|
3
|
+
exports.submitKimaTransaction = exports.submitHtlcLock = exports.CurrencyOptions = exports.SupportedNetworks = void 0;
|
|
4
4
|
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
5
5
|
const common_1 = require("./kima/common");
|
|
6
6
|
var SupportedNetworks;
|
|
@@ -22,10 +22,28 @@ var CurrencyOptions;
|
|
|
22
22
|
CurrencyOptions["USDC"] = "USDC";
|
|
23
23
|
CurrencyOptions["USDK"] = "USDK";
|
|
24
24
|
})(CurrencyOptions = exports.CurrencyOptions || (exports.CurrencyOptions = {}));
|
|
25
|
+
async function submitHtlcLock({ fromAddress, senderPubkey, amount, htlcTimeout, txHash, htlcAddress, }) {
|
|
26
|
+
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
27
|
+
const client = await (0, common_1.TxClient)(wallet);
|
|
28
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
29
|
+
const params = {
|
|
30
|
+
creator: firstAccount.address,
|
|
31
|
+
fromAddress,
|
|
32
|
+
senderPubkey,
|
|
33
|
+
amount,
|
|
34
|
+
htlcTimeout,
|
|
35
|
+
htlcAddress,
|
|
36
|
+
txHash,
|
|
37
|
+
};
|
|
38
|
+
let msg = await client.msgRequestHtlcLock(params);
|
|
39
|
+
const result = await client.signAndBroadcast([msg]);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
exports.submitHtlcLock = submitHtlcLock;
|
|
25
43
|
function sleep(ms) {
|
|
26
44
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
27
45
|
}
|
|
28
|
-
async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, }) {
|
|
46
|
+
async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, }) {
|
|
29
47
|
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
30
48
|
const client = await (0, common_1.TxClient)(wallet);
|
|
31
49
|
const [firstAccount] = await wallet.getAccounts();
|
|
@@ -38,11 +56,11 @@ async function submitKimaTransaction({ originChain, originAddress, targetChain,
|
|
|
38
56
|
symbol,
|
|
39
57
|
amount: amount.toString(),
|
|
40
58
|
fee: fee.toString(),
|
|
41
|
-
htlcCreationHash
|
|
42
|
-
htlcCreationVout
|
|
43
|
-
htlcExpirationTimestamp
|
|
44
|
-
htlcVersion
|
|
45
|
-
senderPubKey
|
|
59
|
+
htlcCreationHash,
|
|
60
|
+
htlcCreationVout,
|
|
61
|
+
htlcExpirationTimestamp,
|
|
62
|
+
htlcVersion,
|
|
63
|
+
senderPubKey,
|
|
46
64
|
};
|
|
47
65
|
let msg = await client.msgRequestTransaction(params);
|
|
48
66
|
const result = await client.signAndBroadcast([msg]);
|
package/build/kima/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StdFee } from "@cosmjs/stargate";
|
|
2
2
|
import { Registry, OfflineSigner, EncodeObject } from "@cosmjs/proto-signing";
|
|
3
|
-
import { MsgRequestTransaction, MsgSetTxHash } from "./tx";
|
|
3
|
+
import { MsgRequestHtlcLock, MsgRequestTransaction, MsgSetTxHash } from "./tx";
|
|
4
4
|
interface SignAndBroadcastOptions {
|
|
5
5
|
fee: StdFee;
|
|
6
6
|
memo?: string;
|
|
@@ -9,6 +9,7 @@ export declare const registry: Registry;
|
|
|
9
9
|
export declare const TxClient: (wallet: OfflineSigner) => Promise<{
|
|
10
10
|
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }?: SignAndBroadcastOptions) => Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
11
11
|
msgRequestTransaction: (data: MsgRequestTransaction) => EncodeObject;
|
|
12
|
+
msgRequestHtlcLock: (data: MsgRequestHtlcLock) => EncodeObject;
|
|
12
13
|
msgSetTxHash: (data: MsgSetTxHash) => EncodeObject;
|
|
13
14
|
}>;
|
|
14
15
|
export {};
|
package/build/kima/common.js
CHANGED
|
@@ -15,6 +15,7 @@ const defaultFee = {
|
|
|
15
15
|
};
|
|
16
16
|
const types = [
|
|
17
17
|
["/kimablockchain.transaction.MsgRequestTransaction", tx_1.MsgRequestTransaction],
|
|
18
|
+
["/kimablockchain.transaction.MsgRequestHtlcLock", tx_1.MsgRequestHtlcLock],
|
|
18
19
|
["/kimablockchain.transaction.MsgSetTxHash", tx_1.MsgSetTxHash],
|
|
19
20
|
];
|
|
20
21
|
exports.registry = new proto_signing_1.Registry(types);
|
|
@@ -27,6 +28,10 @@ const TxClient = async (wallet) => {
|
|
|
27
28
|
typeUrl: "/kimablockchain.transaction.MsgRequestTransaction",
|
|
28
29
|
value: tx_1.MsgRequestTransaction.fromPartial(data),
|
|
29
30
|
}),
|
|
31
|
+
msgRequestHtlcLock: (data) => ({
|
|
32
|
+
typeUrl: "/kimablockchain.transaction.MsgRequestHtlcLock",
|
|
33
|
+
value: tx_1.MsgRequestHtlcLock.fromPartial(data),
|
|
34
|
+
}),
|
|
30
35
|
msgSetTxHash: (data) => ({
|
|
31
36
|
typeUrl: "/kimablockchain.transaction.MsgSetTxHash",
|
|
32
37
|
value: tx_1.MsgSetTxHash.fromPartial(data),
|
package/build/kima/tx.d.ts
CHANGED
|
@@ -29,8 +29,9 @@ export interface MsgFinalizeTransaction {
|
|
|
29
29
|
creator: string;
|
|
30
30
|
txId: number;
|
|
31
31
|
txHash: string;
|
|
32
|
-
success:
|
|
32
|
+
success: boolean;
|
|
33
33
|
signedKey: string;
|
|
34
|
+
errReason: string;
|
|
34
35
|
}
|
|
35
36
|
export interface MsgFinalizeTransactionResponse {
|
|
36
37
|
code: string;
|
|
@@ -40,8 +41,9 @@ export interface MsgFinalizeProvisionTransaction {
|
|
|
40
41
|
creator: string;
|
|
41
42
|
txId: number;
|
|
42
43
|
txHash: string;
|
|
43
|
-
success:
|
|
44
|
+
success: boolean;
|
|
44
45
|
signedKey: string;
|
|
46
|
+
errReason: string;
|
|
45
47
|
}
|
|
46
48
|
export interface MsgFinalizeProvisionTransactionResponse {
|
|
47
49
|
code: string;
|
|
@@ -116,13 +118,25 @@ export interface MsgFinalizeDrainTransaction {
|
|
|
116
118
|
creator: string;
|
|
117
119
|
txId: number;
|
|
118
120
|
txHash: string;
|
|
119
|
-
success:
|
|
121
|
+
success: boolean;
|
|
120
122
|
signedKey: string;
|
|
123
|
+
errReason: string;
|
|
121
124
|
}
|
|
122
125
|
export interface MsgFinalizeDrainTransactionResponse {
|
|
123
126
|
code: string;
|
|
124
127
|
msg: string;
|
|
125
128
|
}
|
|
129
|
+
export interface MsgRequestHtlcLock {
|
|
130
|
+
creator: string;
|
|
131
|
+
fromAddress: string;
|
|
132
|
+
senderPubkey: string;
|
|
133
|
+
amount: string;
|
|
134
|
+
htlcTimeout: string;
|
|
135
|
+
txHash: string;
|
|
136
|
+
htlcAddress: string;
|
|
137
|
+
}
|
|
138
|
+
export interface MsgRequestHtlcLockResponse {
|
|
139
|
+
}
|
|
126
140
|
export declare const MsgRequestTransaction: {
|
|
127
141
|
encode(message: MsgRequestTransaction, writer?: _m0.Writer): _m0.Writer;
|
|
128
142
|
decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestTransaction;
|
|
@@ -182,14 +196,16 @@ export declare const MsgFinalizeTransaction: {
|
|
|
182
196
|
creator?: string | undefined;
|
|
183
197
|
txId?: number | undefined;
|
|
184
198
|
txHash?: string | undefined;
|
|
185
|
-
success?:
|
|
199
|
+
success?: boolean | undefined;
|
|
186
200
|
signedKey?: string | undefined;
|
|
201
|
+
errReason?: string | undefined;
|
|
187
202
|
} & {
|
|
188
203
|
creator?: string | undefined;
|
|
189
204
|
txId?: number | undefined;
|
|
190
205
|
txHash?: string | undefined;
|
|
191
|
-
success?:
|
|
206
|
+
success?: boolean | undefined;
|
|
192
207
|
signedKey?: string | undefined;
|
|
208
|
+
errReason?: string | undefined;
|
|
193
209
|
} & { [K in Exclude<keyof I, keyof MsgFinalizeTransaction>]: never; }>(object: I): MsgFinalizeTransaction;
|
|
194
210
|
};
|
|
195
211
|
export declare const MsgFinalizeTransactionResponse: {
|
|
@@ -214,14 +230,16 @@ export declare const MsgFinalizeProvisionTransaction: {
|
|
|
214
230
|
creator?: string | undefined;
|
|
215
231
|
txId?: number | undefined;
|
|
216
232
|
txHash?: string | undefined;
|
|
217
|
-
success?:
|
|
233
|
+
success?: boolean | undefined;
|
|
218
234
|
signedKey?: string | undefined;
|
|
235
|
+
errReason?: string | undefined;
|
|
219
236
|
} & {
|
|
220
237
|
creator?: string | undefined;
|
|
221
238
|
txId?: number | undefined;
|
|
222
239
|
txHash?: string | undefined;
|
|
223
|
-
success?:
|
|
240
|
+
success?: boolean | undefined;
|
|
224
241
|
signedKey?: string | undefined;
|
|
242
|
+
errReason?: string | undefined;
|
|
225
243
|
} & { [K in Exclude<keyof I, keyof MsgFinalizeProvisionTransaction>]: never; }>(object: I): MsgFinalizeProvisionTransaction;
|
|
226
244
|
};
|
|
227
245
|
export declare const MsgFinalizeProvisionTransactionResponse: {
|
|
@@ -410,14 +428,16 @@ export declare const MsgFinalizeDrainTransaction: {
|
|
|
410
428
|
creator?: string | undefined;
|
|
411
429
|
txId?: number | undefined;
|
|
412
430
|
txHash?: string | undefined;
|
|
413
|
-
success?:
|
|
431
|
+
success?: boolean | undefined;
|
|
414
432
|
signedKey?: string | undefined;
|
|
433
|
+
errReason?: string | undefined;
|
|
415
434
|
} & {
|
|
416
435
|
creator?: string | undefined;
|
|
417
436
|
txId?: number | undefined;
|
|
418
437
|
txHash?: string | undefined;
|
|
419
|
-
success?:
|
|
438
|
+
success?: boolean | undefined;
|
|
420
439
|
signedKey?: string | undefined;
|
|
440
|
+
errReason?: string | undefined;
|
|
421
441
|
} & { [K in Exclude<keyof I, keyof MsgFinalizeDrainTransaction>]: never; }>(object: I): MsgFinalizeDrainTransaction;
|
|
422
442
|
};
|
|
423
443
|
export declare const MsgFinalizeDrainTransactionResponse: {
|
|
@@ -433,6 +453,36 @@ export declare const MsgFinalizeDrainTransactionResponse: {
|
|
|
433
453
|
msg?: string | undefined;
|
|
434
454
|
} & { [K in Exclude<keyof I, keyof MsgFinalizeDrainTransactionResponse>]: never; }>(object: I): MsgFinalizeDrainTransactionResponse;
|
|
435
455
|
};
|
|
456
|
+
export declare const MsgRequestHtlcLock: {
|
|
457
|
+
encode(message: MsgRequestHtlcLock, writer?: _m0.Writer): _m0.Writer;
|
|
458
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestHtlcLock;
|
|
459
|
+
fromJSON(object: any): MsgRequestHtlcLock;
|
|
460
|
+
toJSON(message: MsgRequestHtlcLock): unknown;
|
|
461
|
+
fromPartial<I extends {
|
|
462
|
+
creator?: string | undefined;
|
|
463
|
+
fromAddress?: string | undefined;
|
|
464
|
+
senderPubkey?: string | undefined;
|
|
465
|
+
amount?: string | undefined;
|
|
466
|
+
htlcTimeout?: string | undefined;
|
|
467
|
+
txHash?: string | undefined;
|
|
468
|
+
htlcAddress?: string | undefined;
|
|
469
|
+
} & {
|
|
470
|
+
creator?: string | undefined;
|
|
471
|
+
fromAddress?: string | undefined;
|
|
472
|
+
senderPubkey?: string | undefined;
|
|
473
|
+
amount?: string | undefined;
|
|
474
|
+
htlcTimeout?: string | undefined;
|
|
475
|
+
txHash?: string | undefined;
|
|
476
|
+
htlcAddress?: string | undefined;
|
|
477
|
+
} & { [K in Exclude<keyof I, keyof MsgRequestHtlcLock>]: never; }>(object: I): MsgRequestHtlcLock;
|
|
478
|
+
};
|
|
479
|
+
export declare const MsgRequestHtlcLockResponse: {
|
|
480
|
+
encode(_: MsgRequestHtlcLockResponse, writer?: _m0.Writer): _m0.Writer;
|
|
481
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestHtlcLockResponse;
|
|
482
|
+
fromJSON(_: any): MsgRequestHtlcLockResponse;
|
|
483
|
+
toJSON(_: MsgRequestHtlcLockResponse): unknown;
|
|
484
|
+
fromPartial<I extends {} & {} & { [K in Exclude<keyof I, never>]: never; }>(_: I): MsgRequestHtlcLockResponse;
|
|
485
|
+
};
|
|
436
486
|
/** Msg defines the Msg service. */
|
|
437
487
|
export interface Msg {
|
|
438
488
|
RequestTransaction(request: MsgRequestTransaction): Promise<MsgRequestTransactionResponse>;
|
|
@@ -444,6 +494,7 @@ export interface Msg {
|
|
|
444
494
|
FinalizeProvisionTransaction(request: MsgFinalizeProvisionTransaction): Promise<MsgFinalizeProvisionTransactionResponse>;
|
|
445
495
|
RequestDrainTransaction(request: MsgRequestDrainTransaction): Promise<MsgRequestDrainTransactionResponse>;
|
|
446
496
|
FinalizeDrainTransaction(request: MsgFinalizeDrainTransaction): Promise<MsgFinalizeDrainTransactionResponse>;
|
|
497
|
+
RequestHtlcLock(request: MsgRequestHtlcLock): Promise<MsgRequestHtlcLockResponse>;
|
|
447
498
|
}
|
|
448
499
|
export declare class MsgClientImpl implements Msg {
|
|
449
500
|
private readonly rpc;
|
|
@@ -457,6 +508,7 @@ export declare class MsgClientImpl implements Msg {
|
|
|
457
508
|
FinalizeProvisionTransaction(request: MsgFinalizeProvisionTransaction): Promise<MsgFinalizeProvisionTransactionResponse>;
|
|
458
509
|
RequestDrainTransaction(request: MsgRequestDrainTransaction): Promise<MsgRequestDrainTransactionResponse>;
|
|
459
510
|
FinalizeDrainTransaction(request: MsgFinalizeDrainTransaction): Promise<MsgFinalizeDrainTransactionResponse>;
|
|
511
|
+
RequestHtlcLock(request: MsgRequestHtlcLock): Promise<MsgRequestHtlcLockResponse>;
|
|
460
512
|
}
|
|
461
513
|
interface Rpc {
|
|
462
514
|
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
package/build/kima/tx.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MsgClientImpl = exports.MsgFinalizeDrainTransactionResponse = exports.MsgFinalizeDrainTransaction = exports.MsgRequestDrainTransactionResponse = exports.MsgRequestDrainTransaction = exports.MsgSetTxProcessResponse = exports.MsgSetTxProcess = exports.MsgSetTxHashResponse = exports.MsgSetTxHash = exports.MsgCancelTransactionResponse = exports.MsgCancelTransaction = exports.MsgRequestProvisionTransactionResponse = exports.MsgRequestProvisionTransaction = exports.MsgFinalizeProvisionTransactionResponse = exports.MsgFinalizeProvisionTransaction = exports.MsgFinalizeTransactionResponse = exports.MsgFinalizeTransaction = exports.MsgRequestTransactionResponse = exports.MsgRequestTransaction = exports.protobufPackage = void 0;
|
|
6
|
+
exports.MsgClientImpl = exports.MsgRequestHtlcLockResponse = exports.MsgRequestHtlcLock = exports.MsgFinalizeDrainTransactionResponse = exports.MsgFinalizeDrainTransaction = exports.MsgRequestDrainTransactionResponse = exports.MsgRequestDrainTransaction = exports.MsgSetTxProcessResponse = exports.MsgSetTxProcess = exports.MsgSetTxHashResponse = exports.MsgSetTxHash = exports.MsgCancelTransactionResponse = exports.MsgCancelTransaction = exports.MsgRequestProvisionTransactionResponse = exports.MsgRequestProvisionTransaction = exports.MsgFinalizeProvisionTransactionResponse = exports.MsgFinalizeProvisionTransaction = exports.MsgFinalizeTransactionResponse = exports.MsgFinalizeTransaction = exports.MsgRequestTransactionResponse = exports.MsgRequestTransaction = exports.protobufPackage = void 0;
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
const long_1 = __importDefault(require("long"));
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
@@ -258,7 +258,14 @@ exports.MsgRequestTransactionResponse = {
|
|
|
258
258
|
},
|
|
259
259
|
};
|
|
260
260
|
function createBaseMsgFinalizeTransaction() {
|
|
261
|
-
return {
|
|
261
|
+
return {
|
|
262
|
+
creator: "",
|
|
263
|
+
txId: 0,
|
|
264
|
+
txHash: "",
|
|
265
|
+
success: false,
|
|
266
|
+
signedKey: "",
|
|
267
|
+
errReason: "",
|
|
268
|
+
};
|
|
262
269
|
}
|
|
263
270
|
exports.MsgFinalizeTransaction = {
|
|
264
271
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
@@ -271,12 +278,15 @@ exports.MsgFinalizeTransaction = {
|
|
|
271
278
|
if (message.txHash !== "") {
|
|
272
279
|
writer.uint32(26).string(message.txHash);
|
|
273
280
|
}
|
|
274
|
-
if (message.success
|
|
275
|
-
writer.uint32(
|
|
281
|
+
if (message.success === true) {
|
|
282
|
+
writer.uint32(32).bool(message.success);
|
|
276
283
|
}
|
|
277
284
|
if (message.signedKey !== "") {
|
|
278
285
|
writer.uint32(42).string(message.signedKey);
|
|
279
286
|
}
|
|
287
|
+
if (message.errReason !== "") {
|
|
288
|
+
writer.uint32(50).string(message.errReason);
|
|
289
|
+
}
|
|
280
290
|
return writer;
|
|
281
291
|
},
|
|
282
292
|
decode(input, length) {
|
|
@@ -296,11 +306,14 @@ exports.MsgFinalizeTransaction = {
|
|
|
296
306
|
message.txHash = reader.string();
|
|
297
307
|
break;
|
|
298
308
|
case 4:
|
|
299
|
-
message.success = reader.
|
|
309
|
+
message.success = reader.bool();
|
|
300
310
|
break;
|
|
301
311
|
case 5:
|
|
302
312
|
message.signedKey = reader.string();
|
|
303
313
|
break;
|
|
314
|
+
case 6:
|
|
315
|
+
message.errReason = reader.string();
|
|
316
|
+
break;
|
|
304
317
|
default:
|
|
305
318
|
reader.skipType(tag & 7);
|
|
306
319
|
break;
|
|
@@ -313,8 +326,9 @@ exports.MsgFinalizeTransaction = {
|
|
|
313
326
|
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
314
327
|
txId: isSet(object.txId) ? Number(object.txId) : 0,
|
|
315
328
|
txHash: isSet(object.txHash) ? String(object.txHash) : "",
|
|
316
|
-
success: isSet(object.success) ?
|
|
329
|
+
success: isSet(object.success) ? Boolean(object.success) : false,
|
|
317
330
|
signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
|
|
331
|
+
errReason: isSet(object.errReason) ? String(object.errReason) : "",
|
|
318
332
|
};
|
|
319
333
|
},
|
|
320
334
|
toJSON(message) {
|
|
@@ -324,6 +338,7 @@ exports.MsgFinalizeTransaction = {
|
|
|
324
338
|
message.txHash !== undefined && (obj.txHash = message.txHash);
|
|
325
339
|
message.success !== undefined && (obj.success = message.success);
|
|
326
340
|
message.signedKey !== undefined && (obj.signedKey = message.signedKey);
|
|
341
|
+
message.errReason !== undefined && (obj.errReason = message.errReason);
|
|
327
342
|
return obj;
|
|
328
343
|
},
|
|
329
344
|
fromPartial(object) {
|
|
@@ -331,8 +346,9 @@ exports.MsgFinalizeTransaction = {
|
|
|
331
346
|
message.creator = object.creator ?? "";
|
|
332
347
|
message.txId = object.txId ?? 0;
|
|
333
348
|
message.txHash = object.txHash ?? "";
|
|
334
|
-
message.success = object.success ??
|
|
349
|
+
message.success = object.success ?? false;
|
|
335
350
|
message.signedKey = object.signedKey ?? "";
|
|
351
|
+
message.errReason = object.errReason ?? "";
|
|
336
352
|
return message;
|
|
337
353
|
},
|
|
338
354
|
};
|
|
@@ -389,7 +405,14 @@ exports.MsgFinalizeTransactionResponse = {
|
|
|
389
405
|
},
|
|
390
406
|
};
|
|
391
407
|
function createBaseMsgFinalizeProvisionTransaction() {
|
|
392
|
-
return {
|
|
408
|
+
return {
|
|
409
|
+
creator: "",
|
|
410
|
+
txId: 0,
|
|
411
|
+
txHash: "",
|
|
412
|
+
success: false,
|
|
413
|
+
signedKey: "",
|
|
414
|
+
errReason: "",
|
|
415
|
+
};
|
|
393
416
|
}
|
|
394
417
|
exports.MsgFinalizeProvisionTransaction = {
|
|
395
418
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
@@ -402,12 +425,15 @@ exports.MsgFinalizeProvisionTransaction = {
|
|
|
402
425
|
if (message.txHash !== "") {
|
|
403
426
|
writer.uint32(26).string(message.txHash);
|
|
404
427
|
}
|
|
405
|
-
if (message.success
|
|
406
|
-
writer.uint32(
|
|
428
|
+
if (message.success === true) {
|
|
429
|
+
writer.uint32(32).bool(message.success);
|
|
407
430
|
}
|
|
408
431
|
if (message.signedKey !== "") {
|
|
409
432
|
writer.uint32(42).string(message.signedKey);
|
|
410
433
|
}
|
|
434
|
+
if (message.errReason !== "") {
|
|
435
|
+
writer.uint32(50).string(message.errReason);
|
|
436
|
+
}
|
|
411
437
|
return writer;
|
|
412
438
|
},
|
|
413
439
|
decode(input, length) {
|
|
@@ -427,11 +453,14 @@ exports.MsgFinalizeProvisionTransaction = {
|
|
|
427
453
|
message.txHash = reader.string();
|
|
428
454
|
break;
|
|
429
455
|
case 4:
|
|
430
|
-
message.success = reader.
|
|
456
|
+
message.success = reader.bool();
|
|
431
457
|
break;
|
|
432
458
|
case 5:
|
|
433
459
|
message.signedKey = reader.string();
|
|
434
460
|
break;
|
|
461
|
+
case 6:
|
|
462
|
+
message.errReason = reader.string();
|
|
463
|
+
break;
|
|
435
464
|
default:
|
|
436
465
|
reader.skipType(tag & 7);
|
|
437
466
|
break;
|
|
@@ -444,8 +473,9 @@ exports.MsgFinalizeProvisionTransaction = {
|
|
|
444
473
|
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
445
474
|
txId: isSet(object.txId) ? Number(object.txId) : 0,
|
|
446
475
|
txHash: isSet(object.txHash) ? String(object.txHash) : "",
|
|
447
|
-
success: isSet(object.success) ?
|
|
476
|
+
success: isSet(object.success) ? Boolean(object.success) : false,
|
|
448
477
|
signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
|
|
478
|
+
errReason: isSet(object.errReason) ? String(object.errReason) : "",
|
|
449
479
|
};
|
|
450
480
|
},
|
|
451
481
|
toJSON(message) {
|
|
@@ -455,6 +485,7 @@ exports.MsgFinalizeProvisionTransaction = {
|
|
|
455
485
|
message.txHash !== undefined && (obj.txHash = message.txHash);
|
|
456
486
|
message.success !== undefined && (obj.success = message.success);
|
|
457
487
|
message.signedKey !== undefined && (obj.signedKey = message.signedKey);
|
|
488
|
+
message.errReason !== undefined && (obj.errReason = message.errReason);
|
|
458
489
|
return obj;
|
|
459
490
|
},
|
|
460
491
|
fromPartial(object) {
|
|
@@ -462,8 +493,9 @@ exports.MsgFinalizeProvisionTransaction = {
|
|
|
462
493
|
message.creator = object.creator ?? "";
|
|
463
494
|
message.txId = object.txId ?? 0;
|
|
464
495
|
message.txHash = object.txHash ?? "";
|
|
465
|
-
message.success = object.success ??
|
|
496
|
+
message.success = object.success ?? false;
|
|
466
497
|
message.signedKey = object.signedKey ?? "";
|
|
498
|
+
message.errReason = object.errReason ?? "";
|
|
467
499
|
return message;
|
|
468
500
|
},
|
|
469
501
|
};
|
|
@@ -1240,7 +1272,14 @@ exports.MsgRequestDrainTransactionResponse = {
|
|
|
1240
1272
|
},
|
|
1241
1273
|
};
|
|
1242
1274
|
function createBaseMsgFinalizeDrainTransaction() {
|
|
1243
|
-
return {
|
|
1275
|
+
return {
|
|
1276
|
+
creator: "",
|
|
1277
|
+
txId: 0,
|
|
1278
|
+
txHash: "",
|
|
1279
|
+
success: false,
|
|
1280
|
+
signedKey: "",
|
|
1281
|
+
errReason: "",
|
|
1282
|
+
};
|
|
1244
1283
|
}
|
|
1245
1284
|
exports.MsgFinalizeDrainTransaction = {
|
|
1246
1285
|
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
@@ -1253,12 +1292,15 @@ exports.MsgFinalizeDrainTransaction = {
|
|
|
1253
1292
|
if (message.txHash !== "") {
|
|
1254
1293
|
writer.uint32(26).string(message.txHash);
|
|
1255
1294
|
}
|
|
1256
|
-
if (message.success
|
|
1257
|
-
writer.uint32(
|
|
1295
|
+
if (message.success === true) {
|
|
1296
|
+
writer.uint32(32).bool(message.success);
|
|
1258
1297
|
}
|
|
1259
1298
|
if (message.signedKey !== "") {
|
|
1260
1299
|
writer.uint32(42).string(message.signedKey);
|
|
1261
1300
|
}
|
|
1301
|
+
if (message.errReason !== "") {
|
|
1302
|
+
writer.uint32(50).string(message.errReason);
|
|
1303
|
+
}
|
|
1262
1304
|
return writer;
|
|
1263
1305
|
},
|
|
1264
1306
|
decode(input, length) {
|
|
@@ -1278,11 +1320,14 @@ exports.MsgFinalizeDrainTransaction = {
|
|
|
1278
1320
|
message.txHash = reader.string();
|
|
1279
1321
|
break;
|
|
1280
1322
|
case 4:
|
|
1281
|
-
message.success = reader.
|
|
1323
|
+
message.success = reader.bool();
|
|
1282
1324
|
break;
|
|
1283
1325
|
case 5:
|
|
1284
1326
|
message.signedKey = reader.string();
|
|
1285
1327
|
break;
|
|
1328
|
+
case 6:
|
|
1329
|
+
message.errReason = reader.string();
|
|
1330
|
+
break;
|
|
1286
1331
|
default:
|
|
1287
1332
|
reader.skipType(tag & 7);
|
|
1288
1333
|
break;
|
|
@@ -1295,8 +1340,9 @@ exports.MsgFinalizeDrainTransaction = {
|
|
|
1295
1340
|
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
1296
1341
|
txId: isSet(object.txId) ? Number(object.txId) : 0,
|
|
1297
1342
|
txHash: isSet(object.txHash) ? String(object.txHash) : "",
|
|
1298
|
-
success: isSet(object.success) ?
|
|
1343
|
+
success: isSet(object.success) ? Boolean(object.success) : false,
|
|
1299
1344
|
signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
|
|
1345
|
+
errReason: isSet(object.errReason) ? String(object.errReason) : "",
|
|
1300
1346
|
};
|
|
1301
1347
|
},
|
|
1302
1348
|
toJSON(message) {
|
|
@@ -1306,6 +1352,7 @@ exports.MsgFinalizeDrainTransaction = {
|
|
|
1306
1352
|
message.txHash !== undefined && (obj.txHash = message.txHash);
|
|
1307
1353
|
message.success !== undefined && (obj.success = message.success);
|
|
1308
1354
|
message.signedKey !== undefined && (obj.signedKey = message.signedKey);
|
|
1355
|
+
message.errReason !== undefined && (obj.errReason = message.errReason);
|
|
1309
1356
|
return obj;
|
|
1310
1357
|
},
|
|
1311
1358
|
fromPartial(object) {
|
|
@@ -1313,8 +1360,9 @@ exports.MsgFinalizeDrainTransaction = {
|
|
|
1313
1360
|
message.creator = object.creator ?? "";
|
|
1314
1361
|
message.txId = object.txId ?? 0;
|
|
1315
1362
|
message.txHash = object.txHash ?? "";
|
|
1316
|
-
message.success = object.success ??
|
|
1363
|
+
message.success = object.success ?? false;
|
|
1317
1364
|
message.signedKey = object.signedKey ?? "";
|
|
1365
|
+
message.errReason = object.errReason ?? "";
|
|
1318
1366
|
return message;
|
|
1319
1367
|
},
|
|
1320
1368
|
};
|
|
@@ -1370,6 +1418,150 @@ exports.MsgFinalizeDrainTransactionResponse = {
|
|
|
1370
1418
|
return message;
|
|
1371
1419
|
},
|
|
1372
1420
|
};
|
|
1421
|
+
function createBaseMsgRequestHtlcLock() {
|
|
1422
|
+
return {
|
|
1423
|
+
creator: "",
|
|
1424
|
+
fromAddress: "",
|
|
1425
|
+
senderPubkey: "",
|
|
1426
|
+
amount: "",
|
|
1427
|
+
htlcTimeout: "",
|
|
1428
|
+
txHash: "",
|
|
1429
|
+
htlcAddress: "",
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
exports.MsgRequestHtlcLock = {
|
|
1433
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
1434
|
+
if (message.creator !== "") {
|
|
1435
|
+
writer.uint32(10).string(message.creator);
|
|
1436
|
+
}
|
|
1437
|
+
if (message.fromAddress !== "") {
|
|
1438
|
+
writer.uint32(18).string(message.fromAddress);
|
|
1439
|
+
}
|
|
1440
|
+
if (message.senderPubkey !== "") {
|
|
1441
|
+
writer.uint32(26).string(message.senderPubkey);
|
|
1442
|
+
}
|
|
1443
|
+
if (message.amount !== "") {
|
|
1444
|
+
writer.uint32(34).string(message.amount);
|
|
1445
|
+
}
|
|
1446
|
+
if (message.htlcTimeout !== "") {
|
|
1447
|
+
writer.uint32(42).string(message.htlcTimeout);
|
|
1448
|
+
}
|
|
1449
|
+
if (message.txHash !== "") {
|
|
1450
|
+
writer.uint32(50).string(message.txHash);
|
|
1451
|
+
}
|
|
1452
|
+
if (message.htlcAddress !== "") {
|
|
1453
|
+
writer.uint32(58).string(message.htlcAddress);
|
|
1454
|
+
}
|
|
1455
|
+
return writer;
|
|
1456
|
+
},
|
|
1457
|
+
decode(input, length) {
|
|
1458
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
1459
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1460
|
+
const message = createBaseMsgRequestHtlcLock();
|
|
1461
|
+
while (reader.pos < end) {
|
|
1462
|
+
const tag = reader.uint32();
|
|
1463
|
+
switch (tag >>> 3) {
|
|
1464
|
+
case 1:
|
|
1465
|
+
message.creator = reader.string();
|
|
1466
|
+
break;
|
|
1467
|
+
case 2:
|
|
1468
|
+
message.fromAddress = reader.string();
|
|
1469
|
+
break;
|
|
1470
|
+
case 3:
|
|
1471
|
+
message.senderPubkey = reader.string();
|
|
1472
|
+
break;
|
|
1473
|
+
case 4:
|
|
1474
|
+
message.amount = reader.string();
|
|
1475
|
+
break;
|
|
1476
|
+
case 5:
|
|
1477
|
+
message.htlcTimeout = reader.string();
|
|
1478
|
+
break;
|
|
1479
|
+
case 6:
|
|
1480
|
+
message.txHash = reader.string();
|
|
1481
|
+
break;
|
|
1482
|
+
case 7:
|
|
1483
|
+
message.htlcAddress = reader.string();
|
|
1484
|
+
break;
|
|
1485
|
+
default:
|
|
1486
|
+
reader.skipType(tag & 7);
|
|
1487
|
+
break;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
return message;
|
|
1491
|
+
},
|
|
1492
|
+
fromJSON(object) {
|
|
1493
|
+
return {
|
|
1494
|
+
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
1495
|
+
fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "",
|
|
1496
|
+
senderPubkey: isSet(object.senderPubkey)
|
|
1497
|
+
? String(object.senderPubkey)
|
|
1498
|
+
: "",
|
|
1499
|
+
amount: isSet(object.amount) ? String(object.amount) : "",
|
|
1500
|
+
htlcTimeout: isSet(object.htlcTimeout) ? String(object.htlcTimeout) : "",
|
|
1501
|
+
txHash: isSet(object.txHash) ? String(object.txHash) : "",
|
|
1502
|
+
htlcAddress: isSet(object.htlcAddress) ? String(object.htlcAddress) : "",
|
|
1503
|
+
};
|
|
1504
|
+
},
|
|
1505
|
+
toJSON(message) {
|
|
1506
|
+
const obj = {};
|
|
1507
|
+
message.creator !== undefined && (obj.creator = message.creator);
|
|
1508
|
+
message.fromAddress !== undefined &&
|
|
1509
|
+
(obj.fromAddress = message.fromAddress);
|
|
1510
|
+
message.senderPubkey !== undefined &&
|
|
1511
|
+
(obj.senderPubkey = message.senderPubkey);
|
|
1512
|
+
message.amount !== undefined && (obj.amount = message.amount);
|
|
1513
|
+
message.htlcTimeout !== undefined &&
|
|
1514
|
+
(obj.htlcTimeout = message.htlcTimeout);
|
|
1515
|
+
message.txHash !== undefined && (obj.txHash = message.txHash);
|
|
1516
|
+
message.htlcAddress !== undefined &&
|
|
1517
|
+
(obj.htlcAddress = message.htlcAddress);
|
|
1518
|
+
return obj;
|
|
1519
|
+
},
|
|
1520
|
+
fromPartial(object) {
|
|
1521
|
+
const message = createBaseMsgRequestHtlcLock();
|
|
1522
|
+
message.creator = object.creator ?? "";
|
|
1523
|
+
message.fromAddress = object.fromAddress ?? "";
|
|
1524
|
+
message.senderPubkey = object.senderPubkey ?? "";
|
|
1525
|
+
message.amount = object.amount ?? "";
|
|
1526
|
+
message.htlcTimeout = object.htlcTimeout ?? "";
|
|
1527
|
+
message.txHash = object.txHash ?? "";
|
|
1528
|
+
message.htlcAddress = object.htlcAddress ?? "";
|
|
1529
|
+
return message;
|
|
1530
|
+
},
|
|
1531
|
+
};
|
|
1532
|
+
function createBaseMsgRequestHtlcLockResponse() {
|
|
1533
|
+
return {};
|
|
1534
|
+
}
|
|
1535
|
+
exports.MsgRequestHtlcLockResponse = {
|
|
1536
|
+
encode(_, writer = minimal_1.default.Writer.create()) {
|
|
1537
|
+
return writer;
|
|
1538
|
+
},
|
|
1539
|
+
decode(input, length) {
|
|
1540
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
1541
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1542
|
+
const message = createBaseMsgRequestHtlcLockResponse();
|
|
1543
|
+
while (reader.pos < end) {
|
|
1544
|
+
const tag = reader.uint32();
|
|
1545
|
+
switch (tag >>> 3) {
|
|
1546
|
+
default:
|
|
1547
|
+
reader.skipType(tag & 7);
|
|
1548
|
+
break;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
return message;
|
|
1552
|
+
},
|
|
1553
|
+
fromJSON(_) {
|
|
1554
|
+
return {};
|
|
1555
|
+
},
|
|
1556
|
+
toJSON(_) {
|
|
1557
|
+
const obj = {};
|
|
1558
|
+
return obj;
|
|
1559
|
+
},
|
|
1560
|
+
fromPartial(_) {
|
|
1561
|
+
const message = createBaseMsgRequestHtlcLockResponse();
|
|
1562
|
+
return message;
|
|
1563
|
+
},
|
|
1564
|
+
};
|
|
1373
1565
|
class MsgClientImpl {
|
|
1374
1566
|
rpc;
|
|
1375
1567
|
constructor(rpc) {
|
|
@@ -1385,6 +1577,7 @@ class MsgClientImpl {
|
|
|
1385
1577
|
this.FinalizeProvisionTransaction.bind(this);
|
|
1386
1578
|
this.RequestDrainTransaction = this.RequestDrainTransaction.bind(this);
|
|
1387
1579
|
this.FinalizeDrainTransaction = this.FinalizeDrainTransaction.bind(this);
|
|
1580
|
+
this.RequestHtlcLock = this.RequestHtlcLock.bind(this);
|
|
1388
1581
|
}
|
|
1389
1582
|
RequestTransaction(request) {
|
|
1390
1583
|
const data = exports.MsgRequestTransaction.encode(request).finish();
|
|
@@ -1431,6 +1624,11 @@ class MsgClientImpl {
|
|
|
1431
1624
|
const promise = this.rpc.request("kimablockchain.transaction.Msg", "FinalizeDrainTransaction", data);
|
|
1432
1625
|
return promise.then((data) => exports.MsgFinalizeDrainTransactionResponse.decode(new minimal_1.default.Reader(data)));
|
|
1433
1626
|
}
|
|
1627
|
+
RequestHtlcLock(request) {
|
|
1628
|
+
const data = exports.MsgRequestHtlcLock.encode(request).finish();
|
|
1629
|
+
const promise = this.rpc.request("kimablockchain.transaction.Msg", "RequestHtlcLock", data);
|
|
1630
|
+
return promise.then((data) => exports.MsgRequestHtlcLockResponse.decode(new minimal_1.default.Reader(data)));
|
|
1631
|
+
}
|
|
1434
1632
|
}
|
|
1435
1633
|
exports.MsgClientImpl = MsgClientImpl;
|
|
1436
1634
|
var globalThis = (() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimafinance/kima-transaction-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27-beta.1",
|
|
4
4
|
"description": "A wrapper around Kima's API, enabling sending and monitoring transactions (Beta version)",
|
|
5
5
|
"repository": "https://github.com/kima-finance/kima-transaction-api",
|
|
6
6
|
"author": "",
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
2
2
|
import { TxClient } from "./kima/common";
|
|
3
|
-
import { MsgRequestTransaction } from "./kima/tx";
|
|
3
|
+
import { MsgRequestHtlcLock, MsgRequestTransaction } from "./kima/tx";
|
|
4
4
|
|
|
5
5
|
export enum SupportedNetworks {
|
|
6
6
|
ETHEREUM = "ETH",
|
|
@@ -21,7 +21,46 @@ export enum CurrencyOptions {
|
|
|
21
21
|
USDK = "USDK",
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
interface
|
|
24
|
+
interface RequestHtlcProps {
|
|
25
|
+
fromAddress: string;
|
|
26
|
+
senderPubkey: string;
|
|
27
|
+
amount: string;
|
|
28
|
+
htlcTimeout: string;
|
|
29
|
+
txHash: string;
|
|
30
|
+
htlcAddress: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function submitHtlcLock({
|
|
34
|
+
fromAddress,
|
|
35
|
+
senderPubkey,
|
|
36
|
+
amount,
|
|
37
|
+
htlcTimeout,
|
|
38
|
+
txHash,
|
|
39
|
+
htlcAddress,
|
|
40
|
+
}: RequestHtlcProps) {
|
|
41
|
+
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(
|
|
42
|
+
process.env.KIMA_BACKEND_MNEMONIC as string,
|
|
43
|
+
{ prefix: "kima" }
|
|
44
|
+
);
|
|
45
|
+
const client = await TxClient(wallet);
|
|
46
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
47
|
+
const params: MsgRequestHtlcLock = {
|
|
48
|
+
creator: firstAccount.address,
|
|
49
|
+
fromAddress,
|
|
50
|
+
senderPubkey,
|
|
51
|
+
amount,
|
|
52
|
+
htlcTimeout,
|
|
53
|
+
htlcAddress,
|
|
54
|
+
txHash,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
let msg = await client.msgRequestHtlcLock(params);
|
|
58
|
+
const result = await client.signAndBroadcast([msg]);
|
|
59
|
+
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface RequestTxProps {
|
|
25
64
|
originChain: SupportedNetworks;
|
|
26
65
|
originAddress: string;
|
|
27
66
|
targetChain: SupportedNetworks;
|
|
@@ -29,6 +68,11 @@ interface Props {
|
|
|
29
68
|
symbol: CurrencyOptions;
|
|
30
69
|
amount: number;
|
|
31
70
|
fee: number;
|
|
71
|
+
htlcCreationHash: string;
|
|
72
|
+
htlcCreationVout: number;
|
|
73
|
+
htlcExpirationTimestamp: string;
|
|
74
|
+
htlcVersion: string;
|
|
75
|
+
senderPubKey: Uint8Array;
|
|
32
76
|
}
|
|
33
77
|
|
|
34
78
|
function sleep(ms: number) {
|
|
@@ -43,7 +87,12 @@ export async function submitKimaTransaction({
|
|
|
43
87
|
symbol,
|
|
44
88
|
amount,
|
|
45
89
|
fee,
|
|
46
|
-
|
|
90
|
+
htlcCreationHash,
|
|
91
|
+
htlcCreationVout,
|
|
92
|
+
htlcExpirationTimestamp,
|
|
93
|
+
htlcVersion,
|
|
94
|
+
senderPubKey,
|
|
95
|
+
}: RequestTxProps) {
|
|
47
96
|
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(
|
|
48
97
|
process.env.KIMA_BACKEND_MNEMONIC as string,
|
|
49
98
|
{ prefix: "kima" }
|
|
@@ -59,11 +108,11 @@ export async function submitKimaTransaction({
|
|
|
59
108
|
symbol,
|
|
60
109
|
amount: amount.toString(),
|
|
61
110
|
fee: fee.toString(),
|
|
62
|
-
htlcCreationHash
|
|
63
|
-
htlcCreationVout
|
|
64
|
-
htlcExpirationTimestamp
|
|
65
|
-
htlcVersion
|
|
66
|
-
senderPubKey
|
|
111
|
+
htlcCreationHash,
|
|
112
|
+
htlcCreationVout,
|
|
113
|
+
htlcExpirationTimestamp,
|
|
114
|
+
htlcVersion,
|
|
115
|
+
senderPubKey,
|
|
67
116
|
};
|
|
68
117
|
|
|
69
118
|
let msg = await client.msgRequestTransaction(params);
|
package/src/kima/common.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SigningStargateClient, StdFee } from "@cosmjs/stargate";
|
|
2
2
|
import dotenv from "dotenv";
|
|
3
3
|
import { Registry, OfflineSigner, EncodeObject } from "@cosmjs/proto-signing";
|
|
4
|
-
import { MsgRequestTransaction, MsgSetTxHash } from "./tx";
|
|
4
|
+
import { MsgRequestHtlcLock, MsgRequestTransaction, MsgSetTxHash } from "./tx";
|
|
5
5
|
|
|
6
6
|
dotenv.config();
|
|
7
7
|
|
|
@@ -17,6 +17,7 @@ interface SignAndBroadcastOptions {
|
|
|
17
17
|
|
|
18
18
|
const types = [
|
|
19
19
|
["/kimablockchain.transaction.MsgRequestTransaction", MsgRequestTransaction],
|
|
20
|
+
["/kimablockchain.transaction.MsgRequestHtlcLock", MsgRequestHtlcLock],
|
|
20
21
|
["/kimablockchain.transaction.MsgSetTxHash", MsgSetTxHash],
|
|
21
22
|
];
|
|
22
23
|
|
|
@@ -39,6 +40,10 @@ export const TxClient = async (wallet: OfflineSigner) => {
|
|
|
39
40
|
typeUrl: "/kimablockchain.transaction.MsgRequestTransaction",
|
|
40
41
|
value: MsgRequestTransaction.fromPartial(data),
|
|
41
42
|
}),
|
|
43
|
+
msgRequestHtlcLock: (data: MsgRequestHtlcLock): EncodeObject => ({
|
|
44
|
+
typeUrl: "/kimablockchain.transaction.MsgRequestHtlcLock",
|
|
45
|
+
value: MsgRequestHtlcLock.fromPartial(data),
|
|
46
|
+
}),
|
|
42
47
|
msgSetTxHash: (data: MsgSetTxHash): EncodeObject => ({
|
|
43
48
|
typeUrl: "/kimablockchain.transaction.MsgSetTxHash",
|
|
44
49
|
value: MsgSetTxHash.fromPartial(data),
|
package/src/kima/tx.ts
CHANGED
|
@@ -35,8 +35,9 @@ export interface MsgFinalizeTransaction {
|
|
|
35
35
|
creator: string;
|
|
36
36
|
txId: number;
|
|
37
37
|
txHash: string;
|
|
38
|
-
success:
|
|
38
|
+
success: boolean;
|
|
39
39
|
signedKey: string;
|
|
40
|
+
errReason: string;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
export interface MsgFinalizeTransactionResponse {
|
|
@@ -48,8 +49,9 @@ export interface MsgFinalizeProvisionTransaction {
|
|
|
48
49
|
creator: string;
|
|
49
50
|
txId: number;
|
|
50
51
|
txHash: string;
|
|
51
|
-
success:
|
|
52
|
+
success: boolean;
|
|
52
53
|
signedKey: string;
|
|
54
|
+
errReason: string;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
export interface MsgFinalizeProvisionTransactionResponse {
|
|
@@ -135,8 +137,9 @@ export interface MsgFinalizeDrainTransaction {
|
|
|
135
137
|
creator: string;
|
|
136
138
|
txId: number;
|
|
137
139
|
txHash: string;
|
|
138
|
-
success:
|
|
140
|
+
success: boolean;
|
|
139
141
|
signedKey: string;
|
|
142
|
+
errReason: string;
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
export interface MsgFinalizeDrainTransactionResponse {
|
|
@@ -144,6 +147,18 @@ export interface MsgFinalizeDrainTransactionResponse {
|
|
|
144
147
|
msg: string;
|
|
145
148
|
}
|
|
146
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
|
+
|
|
147
162
|
function createBaseMsgRequestTransaction(): MsgRequestTransaction {
|
|
148
163
|
return {
|
|
149
164
|
creator: "",
|
|
@@ -424,7 +439,14 @@ export const MsgRequestTransactionResponse = {
|
|
|
424
439
|
};
|
|
425
440
|
|
|
426
441
|
function createBaseMsgFinalizeTransaction(): MsgFinalizeTransaction {
|
|
427
|
-
return {
|
|
442
|
+
return {
|
|
443
|
+
creator: "",
|
|
444
|
+
txId: 0,
|
|
445
|
+
txHash: "",
|
|
446
|
+
success: false,
|
|
447
|
+
signedKey: "",
|
|
448
|
+
errReason: "",
|
|
449
|
+
};
|
|
428
450
|
}
|
|
429
451
|
|
|
430
452
|
export const MsgFinalizeTransaction = {
|
|
@@ -441,12 +463,15 @@ export const MsgFinalizeTransaction = {
|
|
|
441
463
|
if (message.txHash !== "") {
|
|
442
464
|
writer.uint32(26).string(message.txHash);
|
|
443
465
|
}
|
|
444
|
-
if (message.success
|
|
445
|
-
writer.uint32(
|
|
466
|
+
if (message.success === true) {
|
|
467
|
+
writer.uint32(32).bool(message.success);
|
|
446
468
|
}
|
|
447
469
|
if (message.signedKey !== "") {
|
|
448
470
|
writer.uint32(42).string(message.signedKey);
|
|
449
471
|
}
|
|
472
|
+
if (message.errReason !== "") {
|
|
473
|
+
writer.uint32(50).string(message.errReason);
|
|
474
|
+
}
|
|
450
475
|
return writer;
|
|
451
476
|
},
|
|
452
477
|
|
|
@@ -470,11 +495,14 @@ export const MsgFinalizeTransaction = {
|
|
|
470
495
|
message.txHash = reader.string();
|
|
471
496
|
break;
|
|
472
497
|
case 4:
|
|
473
|
-
message.success = reader.
|
|
498
|
+
message.success = reader.bool();
|
|
474
499
|
break;
|
|
475
500
|
case 5:
|
|
476
501
|
message.signedKey = reader.string();
|
|
477
502
|
break;
|
|
503
|
+
case 6:
|
|
504
|
+
message.errReason = reader.string();
|
|
505
|
+
break;
|
|
478
506
|
default:
|
|
479
507
|
reader.skipType(tag & 7);
|
|
480
508
|
break;
|
|
@@ -488,8 +516,9 @@ export const MsgFinalizeTransaction = {
|
|
|
488
516
|
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
489
517
|
txId: isSet(object.txId) ? Number(object.txId) : 0,
|
|
490
518
|
txHash: isSet(object.txHash) ? String(object.txHash) : "",
|
|
491
|
-
success: isSet(object.success) ?
|
|
519
|
+
success: isSet(object.success) ? Boolean(object.success) : false,
|
|
492
520
|
signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
|
|
521
|
+
errReason: isSet(object.errReason) ? String(object.errReason) : "",
|
|
493
522
|
};
|
|
494
523
|
},
|
|
495
524
|
|
|
@@ -500,6 +529,7 @@ export const MsgFinalizeTransaction = {
|
|
|
500
529
|
message.txHash !== undefined && (obj.txHash = message.txHash);
|
|
501
530
|
message.success !== undefined && (obj.success = message.success);
|
|
502
531
|
message.signedKey !== undefined && (obj.signedKey = message.signedKey);
|
|
532
|
+
message.errReason !== undefined && (obj.errReason = message.errReason);
|
|
503
533
|
return obj;
|
|
504
534
|
},
|
|
505
535
|
|
|
@@ -510,8 +540,9 @@ export const MsgFinalizeTransaction = {
|
|
|
510
540
|
message.creator = object.creator ?? "";
|
|
511
541
|
message.txId = object.txId ?? 0;
|
|
512
542
|
message.txHash = object.txHash ?? "";
|
|
513
|
-
message.success = object.success ??
|
|
543
|
+
message.success = object.success ?? false;
|
|
514
544
|
message.signedKey = object.signedKey ?? "";
|
|
545
|
+
message.errReason = object.errReason ?? "";
|
|
515
546
|
return message;
|
|
516
547
|
},
|
|
517
548
|
};
|
|
@@ -583,7 +614,14 @@ export const MsgFinalizeTransactionResponse = {
|
|
|
583
614
|
};
|
|
584
615
|
|
|
585
616
|
function createBaseMsgFinalizeProvisionTransaction(): MsgFinalizeProvisionTransaction {
|
|
586
|
-
return {
|
|
617
|
+
return {
|
|
618
|
+
creator: "",
|
|
619
|
+
txId: 0,
|
|
620
|
+
txHash: "",
|
|
621
|
+
success: false,
|
|
622
|
+
signedKey: "",
|
|
623
|
+
errReason: "",
|
|
624
|
+
};
|
|
587
625
|
}
|
|
588
626
|
|
|
589
627
|
export const MsgFinalizeProvisionTransaction = {
|
|
@@ -600,12 +638,15 @@ export const MsgFinalizeProvisionTransaction = {
|
|
|
600
638
|
if (message.txHash !== "") {
|
|
601
639
|
writer.uint32(26).string(message.txHash);
|
|
602
640
|
}
|
|
603
|
-
if (message.success
|
|
604
|
-
writer.uint32(
|
|
641
|
+
if (message.success === true) {
|
|
642
|
+
writer.uint32(32).bool(message.success);
|
|
605
643
|
}
|
|
606
644
|
if (message.signedKey !== "") {
|
|
607
645
|
writer.uint32(42).string(message.signedKey);
|
|
608
646
|
}
|
|
647
|
+
if (message.errReason !== "") {
|
|
648
|
+
writer.uint32(50).string(message.errReason);
|
|
649
|
+
}
|
|
609
650
|
return writer;
|
|
610
651
|
},
|
|
611
652
|
|
|
@@ -629,11 +670,14 @@ export const MsgFinalizeProvisionTransaction = {
|
|
|
629
670
|
message.txHash = reader.string();
|
|
630
671
|
break;
|
|
631
672
|
case 4:
|
|
632
|
-
message.success = reader.
|
|
673
|
+
message.success = reader.bool();
|
|
633
674
|
break;
|
|
634
675
|
case 5:
|
|
635
676
|
message.signedKey = reader.string();
|
|
636
677
|
break;
|
|
678
|
+
case 6:
|
|
679
|
+
message.errReason = reader.string();
|
|
680
|
+
break;
|
|
637
681
|
default:
|
|
638
682
|
reader.skipType(tag & 7);
|
|
639
683
|
break;
|
|
@@ -647,8 +691,9 @@ export const MsgFinalizeProvisionTransaction = {
|
|
|
647
691
|
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
648
692
|
txId: isSet(object.txId) ? Number(object.txId) : 0,
|
|
649
693
|
txHash: isSet(object.txHash) ? String(object.txHash) : "",
|
|
650
|
-
success: isSet(object.success) ?
|
|
694
|
+
success: isSet(object.success) ? Boolean(object.success) : false,
|
|
651
695
|
signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
|
|
696
|
+
errReason: isSet(object.errReason) ? String(object.errReason) : "",
|
|
652
697
|
};
|
|
653
698
|
},
|
|
654
699
|
|
|
@@ -659,6 +704,7 @@ export const MsgFinalizeProvisionTransaction = {
|
|
|
659
704
|
message.txHash !== undefined && (obj.txHash = message.txHash);
|
|
660
705
|
message.success !== undefined && (obj.success = message.success);
|
|
661
706
|
message.signedKey !== undefined && (obj.signedKey = message.signedKey);
|
|
707
|
+
message.errReason !== undefined && (obj.errReason = message.errReason);
|
|
662
708
|
return obj;
|
|
663
709
|
},
|
|
664
710
|
|
|
@@ -669,8 +715,9 @@ export const MsgFinalizeProvisionTransaction = {
|
|
|
669
715
|
message.creator = object.creator ?? "";
|
|
670
716
|
message.txId = object.txId ?? 0;
|
|
671
717
|
message.txHash = object.txHash ?? "";
|
|
672
|
-
message.success = object.success ??
|
|
718
|
+
message.success = object.success ?? false;
|
|
673
719
|
message.signedKey = object.signedKey ?? "";
|
|
720
|
+
message.errReason = object.errReason ?? "";
|
|
674
721
|
return message;
|
|
675
722
|
},
|
|
676
723
|
};
|
|
@@ -1598,7 +1645,14 @@ export const MsgRequestDrainTransactionResponse = {
|
|
|
1598
1645
|
};
|
|
1599
1646
|
|
|
1600
1647
|
function createBaseMsgFinalizeDrainTransaction(): MsgFinalizeDrainTransaction {
|
|
1601
|
-
return {
|
|
1648
|
+
return {
|
|
1649
|
+
creator: "",
|
|
1650
|
+
txId: 0,
|
|
1651
|
+
txHash: "",
|
|
1652
|
+
success: false,
|
|
1653
|
+
signedKey: "",
|
|
1654
|
+
errReason: "",
|
|
1655
|
+
};
|
|
1602
1656
|
}
|
|
1603
1657
|
|
|
1604
1658
|
export const MsgFinalizeDrainTransaction = {
|
|
@@ -1615,12 +1669,15 @@ export const MsgFinalizeDrainTransaction = {
|
|
|
1615
1669
|
if (message.txHash !== "") {
|
|
1616
1670
|
writer.uint32(26).string(message.txHash);
|
|
1617
1671
|
}
|
|
1618
|
-
if (message.success
|
|
1619
|
-
writer.uint32(
|
|
1672
|
+
if (message.success === true) {
|
|
1673
|
+
writer.uint32(32).bool(message.success);
|
|
1620
1674
|
}
|
|
1621
1675
|
if (message.signedKey !== "") {
|
|
1622
1676
|
writer.uint32(42).string(message.signedKey);
|
|
1623
1677
|
}
|
|
1678
|
+
if (message.errReason !== "") {
|
|
1679
|
+
writer.uint32(50).string(message.errReason);
|
|
1680
|
+
}
|
|
1624
1681
|
return writer;
|
|
1625
1682
|
},
|
|
1626
1683
|
|
|
@@ -1644,11 +1701,14 @@ export const MsgFinalizeDrainTransaction = {
|
|
|
1644
1701
|
message.txHash = reader.string();
|
|
1645
1702
|
break;
|
|
1646
1703
|
case 4:
|
|
1647
|
-
message.success = reader.
|
|
1704
|
+
message.success = reader.bool();
|
|
1648
1705
|
break;
|
|
1649
1706
|
case 5:
|
|
1650
1707
|
message.signedKey = reader.string();
|
|
1651
1708
|
break;
|
|
1709
|
+
case 6:
|
|
1710
|
+
message.errReason = reader.string();
|
|
1711
|
+
break;
|
|
1652
1712
|
default:
|
|
1653
1713
|
reader.skipType(tag & 7);
|
|
1654
1714
|
break;
|
|
@@ -1662,8 +1722,9 @@ export const MsgFinalizeDrainTransaction = {
|
|
|
1662
1722
|
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
1663
1723
|
txId: isSet(object.txId) ? Number(object.txId) : 0,
|
|
1664
1724
|
txHash: isSet(object.txHash) ? String(object.txHash) : "",
|
|
1665
|
-
success: isSet(object.success) ?
|
|
1725
|
+
success: isSet(object.success) ? Boolean(object.success) : false,
|
|
1666
1726
|
signedKey: isSet(object.signedKey) ? String(object.signedKey) : "",
|
|
1727
|
+
errReason: isSet(object.errReason) ? String(object.errReason) : "",
|
|
1667
1728
|
};
|
|
1668
1729
|
},
|
|
1669
1730
|
|
|
@@ -1674,6 +1735,7 @@ export const MsgFinalizeDrainTransaction = {
|
|
|
1674
1735
|
message.txHash !== undefined && (obj.txHash = message.txHash);
|
|
1675
1736
|
message.success !== undefined && (obj.success = message.success);
|
|
1676
1737
|
message.signedKey !== undefined && (obj.signedKey = message.signedKey);
|
|
1738
|
+
message.errReason !== undefined && (obj.errReason = message.errReason);
|
|
1677
1739
|
return obj;
|
|
1678
1740
|
},
|
|
1679
1741
|
|
|
@@ -1684,8 +1746,9 @@ export const MsgFinalizeDrainTransaction = {
|
|
|
1684
1746
|
message.creator = object.creator ?? "";
|
|
1685
1747
|
message.txId = object.txId ?? 0;
|
|
1686
1748
|
message.txHash = object.txHash ?? "";
|
|
1687
|
-
message.success = object.success ??
|
|
1749
|
+
message.success = object.success ?? false;
|
|
1688
1750
|
message.signedKey = object.signedKey ?? "";
|
|
1751
|
+
message.errReason = object.errReason ?? "";
|
|
1689
1752
|
return message;
|
|
1690
1753
|
},
|
|
1691
1754
|
};
|
|
@@ -1756,6 +1819,175 @@ export const MsgFinalizeDrainTransactionResponse = {
|
|
|
1756
1819
|
},
|
|
1757
1820
|
};
|
|
1758
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
|
+
|
|
1759
1991
|
/** Msg defines the Msg service. */
|
|
1760
1992
|
export interface Msg {
|
|
1761
1993
|
RequestTransaction(
|
|
@@ -1781,6 +2013,9 @@ export interface Msg {
|
|
|
1781
2013
|
FinalizeDrainTransaction(
|
|
1782
2014
|
request: MsgFinalizeDrainTransaction
|
|
1783
2015
|
): Promise<MsgFinalizeDrainTransactionResponse>;
|
|
2016
|
+
RequestHtlcLock(
|
|
2017
|
+
request: MsgRequestHtlcLock
|
|
2018
|
+
): Promise<MsgRequestHtlcLockResponse>;
|
|
1784
2019
|
}
|
|
1785
2020
|
|
|
1786
2021
|
export class MsgClientImpl implements Msg {
|
|
@@ -1798,6 +2033,7 @@ export class MsgClientImpl implements Msg {
|
|
|
1798
2033
|
this.FinalizeProvisionTransaction.bind(this);
|
|
1799
2034
|
this.RequestDrainTransaction = this.RequestDrainTransaction.bind(this);
|
|
1800
2035
|
this.FinalizeDrainTransaction = this.FinalizeDrainTransaction.bind(this);
|
|
2036
|
+
this.RequestHtlcLock = this.RequestHtlcLock.bind(this);
|
|
1801
2037
|
}
|
|
1802
2038
|
RequestTransaction(
|
|
1803
2039
|
request: MsgRequestTransaction
|
|
@@ -1920,6 +2156,20 @@ export class MsgClientImpl implements Msg {
|
|
|
1920
2156
|
MsgFinalizeDrainTransactionResponse.decode(new _m0.Reader(data))
|
|
1921
2157
|
);
|
|
1922
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
|
+
}
|
|
1923
2173
|
}
|
|
1924
2174
|
|
|
1925
2175
|
interface Rpc {
|