@keplr-wallet/common 0.13.30 → 0.13.32

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.
@@ -0,0 +1,8 @@
1
+ export type IBCDenomTraceLike = {
2
+ paths?: {
3
+ portId: string;
4
+ channelId: string;
5
+ }[];
6
+ };
7
+ export declare function isIgnoredIBCAsset(chainId: string, coinMinimalDenom: string): boolean;
8
+ export declare function isIgnoredIBCTrace(chainId: string, denomTrace: IBCDenomTraceLike): boolean;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIgnoredIBCTrace = exports.isIgnoredIBCAsset = void 0;
4
+ const denom_1 = require("../denom");
5
+ const ignoredIBCAssets = {
6
+ "osmosis-1": new Set([
7
+ "ibc/C87E63E4798A43D182B8513F91360363315C602C25B98D1E497A3A6F7AA66473",
8
+ ]),
9
+ };
10
+ const ignoredIBCTraceFirstHops = {
11
+ "osmosis-1": [
12
+ {
13
+ portId: "transfer",
14
+ channelId: "channel-510",
15
+ },
16
+ ],
17
+ };
18
+ function isIgnoredIBCAsset(chainId, coinMinimalDenom) {
19
+ var _a, _b;
20
+ const normalizedCoinMinimalDenom = denom_1.DenomHelper.normalizeDenom(coinMinimalDenom);
21
+ return (_b = (_a = ignoredIBCAssets[chainId]) === null || _a === void 0 ? void 0 : _a.has(normalizedCoinMinimalDenom)) !== null && _b !== void 0 ? _b : false;
22
+ }
23
+ exports.isIgnoredIBCAsset = isIgnoredIBCAsset;
24
+ function isIgnoredIBCTrace(chainId, denomTrace) {
25
+ var _a, _b, _c;
26
+ const firstPath = (_a = denomTrace.paths) === null || _a === void 0 ? void 0 : _a[0];
27
+ if (!firstPath) {
28
+ return false;
29
+ }
30
+ return ((_c = (_b = ignoredIBCTraceFirstHops[chainId]) === null || _b === void 0 ? void 0 : _b.some((path) => path.portId === firstPath.portId &&
31
+ path.channelId === firstPath.channelId)) !== null && _c !== void 0 ? _c : false);
32
+ }
33
+ exports.isIgnoredIBCTrace = isIgnoredIBCTrace;
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ibc/index.ts"],"names":[],"mappings":";;;AAAA,oCAAuC;AASvC,MAAM,gBAAgB,GAAgC;IACpD,WAAW,EAAE,IAAI,GAAG,CAAC;QACnB,sEAAsE;KACvE,CAAC;CACH,CAAC;AAEF,MAAM,wBAAwB,GAM1B;IACF,WAAW,EAAE;QACX;YACE,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,aAAa;SACzB;KACF;CACF,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,OAAe,EACf,gBAAwB;;IAExB,MAAM,0BAA0B,GAC9B,mBAAW,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAE/C,OAAO,MAAA,MAAA,gBAAgB,CAAC,OAAO,CAAC,0CAAE,GAAG,CAAC,0BAA0B,CAAC,mCAAI,KAAK,CAAC;AAC7E,CAAC;AARD,8CAQC;AAED,SAAgB,iBAAiB,CAC/B,OAAe,EACf,UAA6B;;IAE7B,MAAM,SAAS,GAAG,MAAA,UAAU,CAAC,KAAK,0CAAG,CAAC,CAAC,CAAC;IACxC,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,KAAK,CAAC;KACd;IAED,OAAO,CACL,MAAA,MAAA,wBAAwB,CAAC,OAAO,CAAC,0CAAE,IAAI,CACrC,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;QAChC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,CACzC,mCAAI,KAAK,CACX,CAAC;AACJ,CAAC;AAhBD,8CAgBC"}
package/build/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from "./coin";
12
12
  export * from "./service-worker";
13
13
  export * from "./async";
14
14
  export * from "./bigint";
15
+ export * from "./ibc";
package/build/index.js CHANGED
@@ -28,4 +28,5 @@ __exportStar(require("./coin"), exports);
28
28
  __exportStar(require("./service-worker"), exports);
29
29
  __exportStar(require("./async"), exports);
30
30
  __exportStar(require("./bigint"), exports);
31
+ __exportStar(require("./ibc"), exports);
31
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB;AACxB,yCAAuB;AACvB,0CAAwB;AACxB,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,mDAAiC;AACjC,0CAAwB;AACxB,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB;AACxB,yCAAuB;AACvB,0CAAwB;AACxB,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,mDAAiC;AACjC,0CAAwB;AACxB,2CAAyB;AACzB,wCAAsB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keplr-wallet/common",
3
- "version": "0.13.30",
3
+ "version": "0.13.32",
4
4
  "main": "build/index.js",
5
5
  "author": "chainapsis",
6
6
  "license": "Apache-2.0",
@@ -21,11 +21,11 @@
21
21
  "typecheck": "npx tsc -p tsconfig.check.json"
22
22
  },
23
23
  "dependencies": {
24
- "@keplr-wallet/crypto": "0.13.30",
25
- "@keplr-wallet/types": "0.13.30",
24
+ "@keplr-wallet/crypto": "0.13.32",
25
+ "@keplr-wallet/types": "0.13.32",
26
26
  "buffer": "^6.0.3",
27
27
  "delay": "^4.4.0",
28
28
  "p-queue": "^6.6.2"
29
29
  },
30
- "gitHead": "bbc7e090a71224f5ee81d404c76dbf71d91c2f91"
30
+ "gitHead": "afca64992d57ad196660a44822328bc8f09dbfc8"
31
31
  }
@@ -0,0 +1,57 @@
1
+ import { DenomHelper } from "../denom";
2
+
3
+ export type IBCDenomTraceLike = {
4
+ paths?: {
5
+ portId: string;
6
+ channelId: string;
7
+ }[];
8
+ };
9
+
10
+ const ignoredIBCAssets: Record<string, Set<string>> = {
11
+ "osmosis-1": new Set([
12
+ "ibc/C87E63E4798A43D182B8513F91360363315C602C25B98D1E497A3A6F7AA66473",
13
+ ]),
14
+ };
15
+
16
+ const ignoredIBCTraceFirstHops: Record<
17
+ string,
18
+ {
19
+ portId: string;
20
+ channelId: string;
21
+ }[]
22
+ > = {
23
+ "osmosis-1": [
24
+ {
25
+ portId: "transfer",
26
+ channelId: "channel-510",
27
+ },
28
+ ],
29
+ };
30
+
31
+ export function isIgnoredIBCAsset(
32
+ chainId: string,
33
+ coinMinimalDenom: string
34
+ ): boolean {
35
+ const normalizedCoinMinimalDenom =
36
+ DenomHelper.normalizeDenom(coinMinimalDenom);
37
+
38
+ return ignoredIBCAssets[chainId]?.has(normalizedCoinMinimalDenom) ?? false;
39
+ }
40
+
41
+ export function isIgnoredIBCTrace(
42
+ chainId: string,
43
+ denomTrace: IBCDenomTraceLike
44
+ ): boolean {
45
+ const firstPath = denomTrace.paths?.[0];
46
+ if (!firstPath) {
47
+ return false;
48
+ }
49
+
50
+ return (
51
+ ignoredIBCTraceFirstHops[chainId]?.some(
52
+ (path) =>
53
+ path.portId === firstPath.portId &&
54
+ path.channelId === firstPath.channelId
55
+ ) ?? false
56
+ );
57
+ }
package/src/index.ts CHANGED
@@ -12,3 +12,4 @@ export * from "./coin";
12
12
  export * from "./service-worker";
13
13
  export * from "./async";
14
14
  export * from "./bigint";
15
+ export * from "./ibc";