forked from many-things/cw-hyperlane
-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (65 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
diff --git a/build/cosmwasmclient.js b/build/cosmwasmclient.js
index 8f6305b0263886c5c31fab661c9235723ba1e6e9..b2aac8730ae07b2e62fec2c0a5ee9e6808239a68 100644
--- a/build/cosmwasmclient.js
+++ b/build/cosmwasmclient.js
@@ -81,6 +81,10 @@ class CosmWasmClient {
async getAccount(searchAddress) {
try {
const account = await this.forceGetQueryClient().auth.account(searchAddress);
+ if (searchAddress.startsWith('inj')) {
+ const m = await require('@injectivelabs/sdk-ts');
+ return m.injectiveAccountParser(account);
+ }
return account ? (0, stargate_1.accountFromAny)(account) : null;
}
catch (error) {
diff --git a/build/signingcosmwasmclient.js b/build/signingcosmwasmclient.js
index 2780b8c5ff5ed95c1e3a2994266279d1d682d994..8493e0bd7140d67493bc10d7e6e033d860ef54bb 100644
--- a/build/signingcosmwasmclient.js
+++ b/build/signingcosmwasmclient.js
@@ -85,7 +85,12 @@ class SigningCosmWasmClient extends cosmwasmclient_1.CosmWasmClient {
if (!accountFromSigner) {
throw new Error("Failed to retrieve account from signer");
}
+
const pubkey = (0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey);
+ if (signerAddress.startsWith('inj')) {
+ pubkey['typeUrl'] = '/injective.crypto.v1beta1.ethsecp256k1.PubKey';
+ }
+
const { sequence } = await this.getSequence(signerAddress);
const { gasInfo } = await this.forceGetQueryClient().tx.simulate(anyMsgs, memo, pubkey, sequence);
(0, utils_1.assertDefined)(gasInfo);
@@ -107,7 +112,8 @@ class SigningCosmWasmClient extends cosmwasmclient_1.CosmWasmClient {
throw new Error(createDeliverTxResponseErrorMessage(result));
}
const parsedLogs = stargate_1.logs.parseRawLog(result.rawLog);
- const codeIdAttr = stargate_1.logs.findAttribute(parsedLogs, "store_code", "code_id");
+ const escapedCodeIdAttr = stargate_1.logs.findAttribute(parsedLogs, "cosmwasm.wasm.v1.EventCodeStored", "code_id");
+ const codeIdAttr = { value: escapedCodeIdAttr.value.replace(/\"/g, "") };
return {
checksum: (0, encoding_1.toHex)((0, crypto_1.sha256)(wasmCode)),
originalSize: wasmCode.length,
@@ -388,6 +394,10 @@ class SigningCosmWasmClient extends cosmwasmclient_1.CosmWasmClient {
throw new Error("Failed to retrieve account from signer");
}
const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
+ if (signerAddress.startsWith('inj')) {
+ pubkey['typeUrl'] = '/injective.crypto.v1beta1.ethsecp256k1.PubKey';
+ }
+
const signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
const signDoc = (0, amino_1.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence);
diff --git a/package.json b/package.json
index b073b4317319dbfd761befe3d163bfe6a00dbcef..293b53bdc5e9a62f624de27ee562ae9677f670d8 100644
--- a/package.json
+++ b/package.json
@@ -38,6 +38,7 @@
"pack-web": "yarn build-or-skip && webpack --mode development --config webpack.web.config.js"
},
"dependencies": {
+ "@injectivelabs/sdk-ts": "^1.14.4",
"@cosmjs/amino": "^0.31.0",
"@cosmjs/crypto": "^0.31.0",
"@cosmjs/encoding": "^0.31.0",