@keplr-wallet/cosmos 0.11.21 → 0.11.22
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.
|
@@ -4,6 +4,14 @@ exports.EthermintChainIdHelper = void 0;
|
|
|
4
4
|
const cosmos_1 = require("./cosmos");
|
|
5
5
|
class EthermintChainIdHelper {
|
|
6
6
|
static parse(chainId) {
|
|
7
|
+
const cosmosChainId = cosmos_1.ChainIdHelper.parse(chainId);
|
|
8
|
+
if (chainId.startsWith("injective")) {
|
|
9
|
+
const injectiveTestnetChainIds = ["injective-777", "injective-888"];
|
|
10
|
+
if (injectiveTestnetChainIds.includes(chainId)) {
|
|
11
|
+
return Object.assign({ ethChainId: 5 }, cosmosChainId);
|
|
12
|
+
}
|
|
13
|
+
return Object.assign({ ethChainId: 1 }, cosmosChainId);
|
|
14
|
+
}
|
|
7
15
|
const matches = chainId.match("^([a-z]{1,})_{1}([1-9][0-9]*)-{1}([1-9][0-9]*)$");
|
|
8
16
|
if (!matches ||
|
|
9
17
|
matches.length !== 4 ||
|
|
@@ -12,7 +20,6 @@ class EthermintChainIdHelper {
|
|
|
12
20
|
!Number.isInteger(parseFloat(matches[2]))) {
|
|
13
21
|
throw new Error(`Invalid chainId for ethermint: ${chainId}`);
|
|
14
22
|
}
|
|
15
|
-
const cosmosChainId = cosmos_1.ChainIdHelper.parse(chainId);
|
|
16
23
|
return Object.assign(Object.assign({}, cosmosChainId), { ethChainId: parseFloat(matches[2]) });
|
|
17
24
|
}
|
|
18
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethermint.js","sourceRoot":"","sources":["../../src/chain-id/ethermint.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAEzC,MAAa,sBAAsB;IACjC,MAAM,CAAC,KAAK,CACV,OAAe;
|
|
1
|
+
{"version":3,"file":"ethermint.js","sourceRoot":"","sources":["../../src/chain-id/ethermint.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAEzC,MAAa,sBAAsB;IACjC,MAAM,CAAC,KAAK,CACV,OAAe;QAMf,MAAM,aAAa,GAAG,sBAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEnD,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;YACnC,MAAM,wBAAwB,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;YAEpE,IAAI,wBAAwB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;gBAC9C,uBACE,UAAU,EAAE,CAAC,IACV,aAAa,EAChB;aACH;YAED,uBACE,UAAU,EAAE,CAAC,IACV,aAAa,EAChB;SACH;QAED,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAC3B,iDAAiD,CAClD,CAAC;QAEF,IACE,CAAC,OAAO;YACR,OAAO,CAAC,MAAM,KAAK,CAAC;YACpB,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE;YACjB,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EACzC;YACA,MAAM,IAAI,KAAK,CAAC,kCAAkC,OAAO,EAAE,CAAC,CAAC;SAC9D;QAED,uCACK,aAAa,KAChB,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAClC;IACJ,CAAC;CACF;AA7CD,wDA6CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keplr-wallet/cosmos",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.22",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"author": "chainapsis",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@ethersproject/address": "^5.6.0",
|
|
21
|
-
"@keplr-wallet/common": "0.11.
|
|
22
|
-
"@keplr-wallet/crypto": "0.11.
|
|
23
|
-
"@keplr-wallet/proto-types": "0.11.
|
|
24
|
-
"@keplr-wallet/types": "0.11.
|
|
25
|
-
"@keplr-wallet/unit": "0.11.
|
|
21
|
+
"@keplr-wallet/common": "0.11.22",
|
|
22
|
+
"@keplr-wallet/crypto": "0.11.22",
|
|
23
|
+
"@keplr-wallet/proto-types": "0.11.22",
|
|
24
|
+
"@keplr-wallet/types": "0.11.22",
|
|
25
|
+
"@keplr-wallet/unit": "0.11.22",
|
|
26
26
|
"axios": "^0.27.2",
|
|
27
27
|
"bech32": "^1.1.4",
|
|
28
28
|
"buffer": "^6.0.3",
|
|
29
29
|
"long": "^4.0.0",
|
|
30
30
|
"protobufjs": "^6.11.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "fdcad4028c640345066f4955a8b94fc1fc1ccf96"
|
|
33
33
|
}
|
|
@@ -6,9 +6,26 @@ export class EthermintChainIdHelper {
|
|
|
6
6
|
): {
|
|
7
7
|
identifier: string;
|
|
8
8
|
version: number;
|
|
9
|
-
|
|
10
9
|
ethChainId: number;
|
|
11
10
|
} {
|
|
11
|
+
const cosmosChainId = ChainIdHelper.parse(chainId);
|
|
12
|
+
|
|
13
|
+
if (chainId.startsWith("injective")) {
|
|
14
|
+
const injectiveTestnetChainIds = ["injective-777", "injective-888"];
|
|
15
|
+
|
|
16
|
+
if (injectiveTestnetChainIds.includes(chainId)) {
|
|
17
|
+
return {
|
|
18
|
+
ethChainId: 5,
|
|
19
|
+
...cosmosChainId,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
ethChainId: 1,
|
|
25
|
+
...cosmosChainId,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
12
29
|
const matches = chainId.match(
|
|
13
30
|
"^([a-z]{1,})_{1}([1-9][0-9]*)-{1}([1-9][0-9]*)$"
|
|
14
31
|
);
|
|
@@ -23,8 +40,6 @@ export class EthermintChainIdHelper {
|
|
|
23
40
|
throw new Error(`Invalid chainId for ethermint: ${chainId}`);
|
|
24
41
|
}
|
|
25
42
|
|
|
26
|
-
const cosmosChainId = ChainIdHelper.parse(chainId);
|
|
27
|
-
|
|
28
43
|
return {
|
|
29
44
|
...cosmosChainId,
|
|
30
45
|
ethChainId: parseFloat(matches[2]),
|