@kimafinance/kima-transaction-api 1.3.4 → 1.3.5
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.js +8 -5
- package/package.json +1 -1
- package/src/index.ts +10 -6
package/build/index.js
CHANGED
|
@@ -84,8 +84,11 @@ async function submitKimaTransaction({ originChain, originAddress, targetChain,
|
|
|
84
84
|
senderPubKey,
|
|
85
85
|
options,
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
const result = await client.signAndBroadcast([
|
|
87
|
+
const msgTx = await client.msgRequestTransaction(params);
|
|
88
|
+
const result = await client.signAndBroadcast([msgTx]);
|
|
89
|
+
if (result.code !== 0) {
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
89
92
|
let txId = 1;
|
|
90
93
|
for (const event of result.events) {
|
|
91
94
|
if (event.type === "transaction_requested") {
|
|
@@ -96,16 +99,16 @@ async function submitKimaTransaction({ originChain, originAddress, targetChain,
|
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
|
-
|
|
102
|
+
const msgSetHash = await client.msgSetTxHash({
|
|
100
103
|
creator: firstAccount.address,
|
|
101
104
|
txId,
|
|
102
105
|
txHash: result.transactionHash,
|
|
103
106
|
txType: "request_transaction",
|
|
104
107
|
});
|
|
105
|
-
console.log(
|
|
108
|
+
console.log(msgSetHash);
|
|
106
109
|
let hashResult;
|
|
107
110
|
do {
|
|
108
|
-
hashResult = await client.signAndBroadcast([
|
|
111
|
+
hashResult = await client.signAndBroadcast([msgSetHash]);
|
|
109
112
|
await sleep(1000);
|
|
110
113
|
} while (hashResult.code !== 0);
|
|
111
114
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimafinance/kima-transaction-api",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
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
|
@@ -118,7 +118,7 @@ export async function getCreatorAddress() {
|
|
|
118
118
|
{ prefix: "kima" }
|
|
119
119
|
);
|
|
120
120
|
const [firstAccount] = await wallet.getAccounts();
|
|
121
|
-
return firstAccount
|
|
121
|
+
return firstAccount;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export async function submitKimaTransaction({
|
|
@@ -161,8 +161,12 @@ export async function submitKimaTransaction({
|
|
|
161
161
|
options,
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
const result = await client.signAndBroadcast([
|
|
164
|
+
const msgTx = await client.msgRequestTransaction(params);
|
|
165
|
+
const result = await client.signAndBroadcast([msgTx]);
|
|
166
|
+
|
|
167
|
+
if (result.code !== 0) {
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
166
170
|
|
|
167
171
|
let txId = 1;
|
|
168
172
|
|
|
@@ -176,18 +180,18 @@ export async function submitKimaTransaction({
|
|
|
176
180
|
}
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
|
|
183
|
+
const msgSetHash = await client.msgSetTxHash({
|
|
180
184
|
creator: firstAccount.address,
|
|
181
185
|
txId,
|
|
182
186
|
txHash: result.transactionHash,
|
|
183
187
|
txType: "request_transaction",
|
|
184
188
|
});
|
|
185
189
|
|
|
186
|
-
console.log(
|
|
190
|
+
console.log(msgSetHash);
|
|
187
191
|
|
|
188
192
|
let hashResult;
|
|
189
193
|
do {
|
|
190
|
-
hashResult = await client.signAndBroadcast([
|
|
194
|
+
hashResult = await client.signAndBroadcast([msgSetHash]);
|
|
191
195
|
await sleep(1000);
|
|
192
196
|
} while (hashResult.code !== 0);
|
|
193
197
|
|