@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 +1 -0
- package/build/index.js +20 -2
- package/build/kima/common.d.ts +2 -1
- package/build/kima/common.js +5 -0
- package/build/kima/tx.d.ts +152 -2
- package/build/kima/tx.js +1126 -99
- package/package.json +1 -1
- package/src/index.ts +24 -2
- package/src/kima/common.ts +6 -1
- package/src/kima/tx.ts +1322 -126
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -51,6 +51,28 @@ export async function submitKimaTransaction({
|
|
|
51
51
|
fee: fee.toString(),
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
let msg = await client.msgRequestTransaction(params);
|
|
55
|
+
const result = await client.signAndBroadcast([msg]);
|
|
56
|
+
|
|
57
|
+
let txId = "1";
|
|
58
|
+
|
|
59
|
+
for (const event of result.events) {
|
|
60
|
+
if (event.type === "transaction_requested") {
|
|
61
|
+
for (const attr of event.attributes) {
|
|
62
|
+
if (attr.key === "txId") {
|
|
63
|
+
txId = attr.value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
msg = await client.msgSetTxHash({
|
|
70
|
+
creator: firstAccount.address,
|
|
71
|
+
txId,
|
|
72
|
+
txHash: result.transactionHash,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const temp = await client.signAndBroadcast([msg]);
|
|
76
|
+
|
|
77
|
+
return result;
|
|
56
78
|
}
|
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 } from "./tx";
|
|
4
|
+
import { 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
|
["/KimaFinance.kima.kima.MsgRequestTransaction", MsgRequestTransaction],
|
|
20
|
+
["/KimaFinance.kima.kima.MsgSetTxHash", MsgSetTxHash],
|
|
20
21
|
];
|
|
21
22
|
|
|
22
23
|
export const registry = new Registry(<any>types);
|
|
@@ -38,5 +39,9 @@ export const TxClient = async (wallet: OfflineSigner) => {
|
|
|
38
39
|
typeUrl: "/KimaFinance.kima.kima.MsgRequestTransaction",
|
|
39
40
|
value: MsgRequestTransaction.fromPartial(data),
|
|
40
41
|
}),
|
|
42
|
+
msgSetTxHash: (data: MsgSetTxHash): EncodeObject => ({
|
|
43
|
+
typeUrl: "/KimaFinance.kima.kima.MsgSetTxHash",
|
|
44
|
+
value: MsgSetTxHash.fromPartial(data),
|
|
45
|
+
}),
|
|
41
46
|
};
|
|
42
47
|
};
|