@kimafinance/kima-transaction-api 1.0.1 → 1.0.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.
package/README.md CHANGED
@@ -43,4 +43,5 @@ const txResult = await submitKimaTransaction({
43
43
  ## Environment Variables
44
44
 
45
45
  `KIMA_BACKEND_MNEMONIC` : Seed phrase of developer wallet. This wallet must have KIMA token to submit a transaction to kima chain.
46
+
46
47
  `KIMA_BACKEND_NODE_PROVIDER` : Node provider for kima chain
package/build/index.js CHANGED
@@ -30,7 +30,25 @@ async function submitKimaTransaction({ originChain, originAddress, targetChain,
30
30
  amount: amount.toString(),
31
31
  fee: fee.toString(),
32
32
  };
33
- const msg = await client.msgRequestTransaction(params);
34
- return await client.signAndBroadcast([msg]);
33
+ let msg = await client.msgRequestTransaction(params);
34
+ const result = await client.signAndBroadcast([msg]);
35
+ let txId = "1";
36
+ for (const event of result.events) {
37
+ if (event.type === "transaction_requested") {
38
+ for (const attr of event.attributes) {
39
+ if (attr.key === "txId") {
40
+ txId = attr.value;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ msg = await client.msgSetTxHash({
46
+ creator: firstAccount.address,
47
+ txId,
48
+ txHash: result.transactionHash,
49
+ });
50
+ const temp = await client.signAndBroadcast([msg]);
51
+ console.log(temp);
52
+ return result;
35
53
  }
36
54
  exports.submitKimaTransaction = submitKimaTransaction;
@@ -1,6 +1,6 @@
1
1
  import { StdFee } from "@cosmjs/stargate";
2
2
  import { Registry, OfflineSigner, EncodeObject } from "@cosmjs/proto-signing";
3
- import { MsgRequestTransaction } from "./tx";
3
+ import { MsgRequestTransaction, MsgSetTxHash } from "./tx";
4
4
  interface SignAndBroadcastOptions {
5
5
  fee: StdFee;
6
6
  memo?: string;
@@ -9,5 +9,6 @@ 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
+ msgSetTxHash: (data: MsgSetTxHash) => EncodeObject;
12
13
  }>;
13
14
  export {};
@@ -15,6 +15,7 @@ const defaultFee = {
15
15
  };
16
16
  const types = [
17
17
  ["/KimaFinance.kima.kima.MsgRequestTransaction", tx_1.MsgRequestTransaction],
18
+ ["/KimaFinance.kima.kima.MsgSetTxHash", tx_1.MsgSetTxHash],
18
19
  ];
19
20
  exports.registry = new proto_signing_1.Registry(types);
20
21
  const TxClient = async (wallet) => {
@@ -26,6 +27,10 @@ const TxClient = async (wallet) => {
26
27
  typeUrl: "/KimaFinance.kima.kima.MsgRequestTransaction",
27
28
  value: tx_1.MsgRequestTransaction.fromPartial(data),
28
29
  }),
30
+ msgSetTxHash: (data) => ({
31
+ typeUrl: "/KimaFinance.kima.kima.MsgSetTxHash",
32
+ value: tx_1.MsgSetTxHash.fromPartial(data),
33
+ }),
29
34
  };
30
35
  };
31
36
  exports.TxClient = TxClient;
@@ -17,7 +17,8 @@ export interface MsgRequestTransactionResponse {
17
17
  }
18
18
  export interface MsgApproveTransaction {
19
19
  creator: string;
20
- txHash: string;
20
+ txCHash: string;
21
+ txTHash: string;
21
22
  success: string;
22
23
  signedKey: string;
23
24
  }
@@ -39,6 +40,7 @@ export interface MsgObservationVote {
39
40
  from: string;
40
41
  to: string;
41
42
  amount: string;
43
+ payType: string;
42
44
  }
43
45
  export interface MsgObservationVoteResponse {
44
46
  code: string;
@@ -155,6 +157,58 @@ export interface MsgClearTssInfoResponse {
155
157
  code: string;
156
158
  msg: string;
157
159
  }
160
+ export interface MsgAddChain {
161
+ creator: string;
162
+ name: string;
163
+ symbol: string;
164
+ tokens: string[];
165
+ }
166
+ export interface MsgAddChainResponse {
167
+ code: string;
168
+ msg: string;
169
+ }
170
+ export interface MsgUpdateTssHash {
171
+ creator: string;
172
+ txId: string;
173
+ tssPullHash: string;
174
+ }
175
+ export interface MsgUpdateTssHashResponse {
176
+ code: string;
177
+ msg: string;
178
+ }
179
+ export interface MsgUpdateChainStatus {
180
+ creator: string;
181
+ chainSymbol: string;
182
+ disabled: boolean;
183
+ }
184
+ export interface MsgUpdateChainStatusResponse {
185
+ code: string;
186
+ msg: string;
187
+ }
188
+ export interface MsgAddToken {
189
+ creator: string;
190
+ chainSymbol: string;
191
+ tokenSymbol: string;
192
+ }
193
+ export interface MsgAddTokenResponse {
194
+ code: string;
195
+ msg: string;
196
+ }
197
+ export interface MsgUpdateTssStatus {
198
+ creator: string;
199
+ status: string;
200
+ }
201
+ export interface MsgUpdateTssStatusResponse {
202
+ }
203
+ export interface MsgSetTxHash {
204
+ creator: string;
205
+ txId: string;
206
+ txHash: string;
207
+ }
208
+ export interface MsgSetTxHashResponse {
209
+ code: string;
210
+ msg: string;
211
+ }
158
212
  export declare const MsgRequestTransaction: {
159
213
  encode(message: MsgRequestTransaction, writer?: Writer): Writer;
160
214
  decode(input: Reader | Uint8Array, length?: number): MsgRequestTransaction;
@@ -379,6 +433,90 @@ export declare const MsgClearTssInfoResponse: {
379
433
  toJSON(message: MsgClearTssInfoResponse): unknown;
380
434
  fromPartial(object: DeepPartial<MsgClearTssInfoResponse>): MsgClearTssInfoResponse;
381
435
  };
436
+ export declare const MsgAddChain: {
437
+ encode(message: MsgAddChain, writer?: Writer): Writer;
438
+ decode(input: Reader | Uint8Array, length?: number): MsgAddChain;
439
+ fromJSON(object: any): MsgAddChain;
440
+ toJSON(message: MsgAddChain): unknown;
441
+ fromPartial(object: DeepPartial<MsgAddChain>): MsgAddChain;
442
+ };
443
+ export declare const MsgAddChainResponse: {
444
+ encode(message: MsgAddChainResponse, writer?: Writer): Writer;
445
+ decode(input: Reader | Uint8Array, length?: number): MsgAddChainResponse;
446
+ fromJSON(object: any): MsgAddChainResponse;
447
+ toJSON(message: MsgAddChainResponse): unknown;
448
+ fromPartial(object: DeepPartial<MsgAddChainResponse>): MsgAddChainResponse;
449
+ };
450
+ export declare const MsgUpdateTssHash: {
451
+ encode(message: MsgUpdateTssHash, writer?: Writer): Writer;
452
+ decode(input: Reader | Uint8Array, length?: number): MsgUpdateTssHash;
453
+ fromJSON(object: any): MsgUpdateTssHash;
454
+ toJSON(message: MsgUpdateTssHash): unknown;
455
+ fromPartial(object: DeepPartial<MsgUpdateTssHash>): MsgUpdateTssHash;
456
+ };
457
+ export declare const MsgUpdateTssHashResponse: {
458
+ encode(message: MsgUpdateTssHashResponse, writer?: Writer): Writer;
459
+ decode(input: Reader | Uint8Array, length?: number): MsgUpdateTssHashResponse;
460
+ fromJSON(object: any): MsgUpdateTssHashResponse;
461
+ toJSON(message: MsgUpdateTssHashResponse): unknown;
462
+ fromPartial(object: DeepPartial<MsgUpdateTssHashResponse>): MsgUpdateTssHashResponse;
463
+ };
464
+ export declare const MsgUpdateChainStatus: {
465
+ encode(message: MsgUpdateChainStatus, writer?: Writer): Writer;
466
+ decode(input: Reader | Uint8Array, length?: number): MsgUpdateChainStatus;
467
+ fromJSON(object: any): MsgUpdateChainStatus;
468
+ toJSON(message: MsgUpdateChainStatus): unknown;
469
+ fromPartial(object: DeepPartial<MsgUpdateChainStatus>): MsgUpdateChainStatus;
470
+ };
471
+ export declare const MsgUpdateChainStatusResponse: {
472
+ encode(message: MsgUpdateChainStatusResponse, writer?: Writer): Writer;
473
+ decode(input: Reader | Uint8Array, length?: number): MsgUpdateChainStatusResponse;
474
+ fromJSON(object: any): MsgUpdateChainStatusResponse;
475
+ toJSON(message: MsgUpdateChainStatusResponse): unknown;
476
+ fromPartial(object: DeepPartial<MsgUpdateChainStatusResponse>): MsgUpdateChainStatusResponse;
477
+ };
478
+ export declare const MsgAddToken: {
479
+ encode(message: MsgAddToken, writer?: Writer): Writer;
480
+ decode(input: Reader | Uint8Array, length?: number): MsgAddToken;
481
+ fromJSON(object: any): MsgAddToken;
482
+ toJSON(message: MsgAddToken): unknown;
483
+ fromPartial(object: DeepPartial<MsgAddToken>): MsgAddToken;
484
+ };
485
+ export declare const MsgAddTokenResponse: {
486
+ encode(message: MsgAddTokenResponse, writer?: Writer): Writer;
487
+ decode(input: Reader | Uint8Array, length?: number): MsgAddTokenResponse;
488
+ fromJSON(object: any): MsgAddTokenResponse;
489
+ toJSON(message: MsgAddTokenResponse): unknown;
490
+ fromPartial(object: DeepPartial<MsgAddTokenResponse>): MsgAddTokenResponse;
491
+ };
492
+ export declare const MsgUpdateTssStatus: {
493
+ encode(message: MsgUpdateTssStatus, writer?: Writer): Writer;
494
+ decode(input: Reader | Uint8Array, length?: number): MsgUpdateTssStatus;
495
+ fromJSON(object: any): MsgUpdateTssStatus;
496
+ toJSON(message: MsgUpdateTssStatus): unknown;
497
+ fromPartial(object: DeepPartial<MsgUpdateTssStatus>): MsgUpdateTssStatus;
498
+ };
499
+ export declare const MsgUpdateTssStatusResponse: {
500
+ encode(_: MsgUpdateTssStatusResponse, writer?: Writer): Writer;
501
+ decode(input: Reader | Uint8Array, length?: number): MsgUpdateTssStatusResponse;
502
+ fromJSON(_: any): MsgUpdateTssStatusResponse;
503
+ toJSON(_: MsgUpdateTssStatusResponse): unknown;
504
+ fromPartial(_: DeepPartial<MsgUpdateTssStatusResponse>): MsgUpdateTssStatusResponse;
505
+ };
506
+ export declare const MsgSetTxHash: {
507
+ encode(message: MsgSetTxHash, writer?: Writer): Writer;
508
+ decode(input: Reader | Uint8Array, length?: number): MsgSetTxHash;
509
+ fromJSON(object: any): MsgSetTxHash;
510
+ toJSON(message: MsgSetTxHash): unknown;
511
+ fromPartial(object: DeepPartial<MsgSetTxHash>): MsgSetTxHash;
512
+ };
513
+ export declare const MsgSetTxHashResponse: {
514
+ encode(message: MsgSetTxHashResponse, writer?: Writer): Writer;
515
+ decode(input: Reader | Uint8Array, length?: number): MsgSetTxHashResponse;
516
+ fromJSON(object: any): MsgSetTxHashResponse;
517
+ toJSON(message: MsgSetTxHashResponse): unknown;
518
+ fromPartial(object: DeepPartial<MsgSetTxHashResponse>): MsgSetTxHashResponse;
519
+ };
382
520
  /** Msg defines the Msg service. */
383
521
  export interface Msg {
384
522
  RequestTransaction(request: MsgRequestTransaction): Promise<MsgRequestTransactionResponse>;
@@ -396,8 +534,14 @@ export interface Msg {
396
534
  AddPubkey(request: MsgAddPubkey): Promise<MsgAddPubkeyResponse>;
397
535
  UpdateTssPubkey(request: MsgUpdateTssPubkey): Promise<MsgUpdateTssPubkeyResponse>;
398
536
  RemoveWhitelisted(request: MsgRemoveWhitelisted): Promise<MsgRemoveWhitelistedResponse>;
399
- /** this line is used by starport scaffolding # proto/tx/rpc */
400
537
  ClearTssInfo(request: MsgClearTssInfo): Promise<MsgClearTssInfoResponse>;
538
+ AddChain(request: MsgAddChain): Promise<MsgAddChainResponse>;
539
+ UpdateTssHash(request: MsgUpdateTssHash): Promise<MsgUpdateTssHashResponse>;
540
+ UpdateChainStatus(request: MsgUpdateChainStatus): Promise<MsgUpdateChainStatusResponse>;
541
+ AddToken(request: MsgAddToken): Promise<MsgAddTokenResponse>;
542
+ UpdateTssStatus(request: MsgUpdateTssStatus): Promise<MsgUpdateTssStatusResponse>;
543
+ /** this line is used by starport scaffolding # proto/tx/rpc */
544
+ SetTxHash(request: MsgSetTxHash): Promise<MsgSetTxHashResponse>;
401
545
  }
402
546
  export declare class MsgClientImpl implements Msg {
403
547
  private readonly rpc;
@@ -418,6 +562,12 @@ export declare class MsgClientImpl implements Msg {
418
562
  UpdateTssPubkey(request: MsgUpdateTssPubkey): Promise<MsgUpdateTssPubkeyResponse>;
419
563
  RemoveWhitelisted(request: MsgRemoveWhitelisted): Promise<MsgRemoveWhitelistedResponse>;
420
564
  ClearTssInfo(request: MsgClearTssInfo): Promise<MsgClearTssInfoResponse>;
565
+ AddChain(request: MsgAddChain): Promise<MsgAddChainResponse>;
566
+ UpdateTssHash(request: MsgUpdateTssHash): Promise<MsgUpdateTssHashResponse>;
567
+ UpdateChainStatus(request: MsgUpdateChainStatus): Promise<MsgUpdateChainStatusResponse>;
568
+ AddToken(request: MsgAddToken): Promise<MsgAddTokenResponse>;
569
+ UpdateTssStatus(request: MsgUpdateTssStatus): Promise<MsgUpdateTssStatusResponse>;
570
+ SetTxHash(request: MsgSetTxHash): Promise<MsgSetTxHashResponse>;
421
571
  }
422
572
  interface Rpc {
423
573
  request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;