@snowbridge/registry 0.2.4 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowbridge/registry",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Snowbridge Asset Registry",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -11,19 +11,19 @@
11
11
  "main": "dist/index.js",
12
12
  "types": "dist/index.d.ts",
13
13
  "devDependencies": {
14
- "@types/node": "^18.19.31",
15
- "@typescript-eslint/eslint-plugin": "^5.62.0",
16
- "@typescript-eslint/parser": "^5.62.0",
17
- "eslint": "^8.57.0",
18
- "eslint-config-prettier": "^8.10.0",
19
- "prettier": "^2.8.8",
20
- "ts-node": "^10.9.2",
21
- "tsconfig-paths": "^4.2.0",
22
- "typescript": "^5.4.5",
23
- "@snowbridge/api": "0.2.4"
14
+ "@types/node": "18.19.31",
15
+ "@typescript-eslint/eslint-plugin": "5.62.0",
16
+ "@typescript-eslint/parser": "5.62.0",
17
+ "eslint": "8.57.0",
18
+ "eslint-config-prettier": "8.10.0",
19
+ "prettier": "2.8.8",
20
+ "ts-node": "10.9.2",
21
+ "tsconfig-paths": "4.2.0",
22
+ "typescript": "5.5.4",
23
+ "@snowbridge/api": "0.2.6"
24
24
  },
25
25
  "dependencies": {
26
- "@snowbridge/base-types": "0.2.4"
26
+ "@snowbridge/base-types": "0.2.6"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "tsc --build --force",
package/src/index.ts CHANGED
@@ -1,63 +1,63 @@
1
- import { AssetRegistry } from "@snowbridge/base-types";
2
- import polkadot_mainnet from "./polkadot_mainnet.registry.json";
3
- import westend_sepolia from "./westend_sepolia.registry.json";
4
- import paseo_sepolia from "./paseo_sepolia.registry.json";
5
- import local_e2e from "./local_e2e.registry.json";
1
+ import { AssetRegistry } from "@snowbridge/base-types"
2
+ import polkadot_mainnet from "./polkadot_mainnet.registry.json"
3
+ import westend_sepolia from "./westend_sepolia.registry.json"
4
+ import paseo_sepolia from "./paseo_sepolia.registry.json"
5
+ import local_e2e from "./local_e2e.registry.json"
6
6
 
7
7
  function transformBigInt(obj: any): any {
8
- // Regex to match strings like "bigint:123"
9
- const bigintPattern = /^bigint:(\d+)$/;
8
+ // Regex to match strings like "bigint:123"
9
+ const bigintPattern = /^bigint:(\d+)$/
10
10
 
11
- // Handle null or non-object/non-array values
12
- if (obj === null || typeof obj !== "object") {
13
- if (typeof obj === "string") {
14
- const match = obj.match(bigintPattern);
15
- if (match) {
16
- return Object.freeze(BigInt(match[1]));
17
- }
11
+ // Handle null or non-object/non-array values
12
+ if (obj === null || typeof obj !== "object") {
13
+ if (typeof obj === "string") {
14
+ const match = obj.match(bigintPattern)
15
+ if (match) {
16
+ return Object.freeze(BigInt(match[1]))
17
+ }
18
+ }
19
+ return Object.freeze(obj)
18
20
  }
19
- return Object.freeze(obj);
20
- }
21
21
 
22
- // Handle arrays
23
- if (Array.isArray(obj)) {
24
- return Object.freeze(obj.map((item) => transformBigInt(item)));
25
- }
22
+ // Handle arrays
23
+ if (Array.isArray(obj)) {
24
+ return Object.freeze(obj.map((item) => transformBigInt(item)))
25
+ }
26
26
 
27
- // Handle objects
28
- const result: { [key: string]: any } = {};
29
- for (const key in obj) {
30
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
31
- result[key] = transformBigInt(obj[key]);
27
+ // Handle objects
28
+ const result: { [key: string]: any } = {}
29
+ for (const key in obj) {
30
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
31
+ result[key] = transformBigInt(obj[key])
32
+ }
32
33
  }
33
- }
34
- return Object.freeze(result);
34
+ return Object.freeze(result)
35
35
  }
36
36
 
37
- const cache: { [env: string]: AssetRegistry } = {};
37
+ const cache: { [env: string]: AssetRegistry } = {}
38
38
  export function assetRegistryFor(
39
- env: "polkadot_mainnet" | "westend_sepolia" | "paseo_sepolia" | (string & {})
39
+ env: "polkadot_mainnet" | "westend_sepolia" | "paseo_sepolia" | (string & {})
40
40
  ): AssetRegistry {
41
- if (env in cache) {
42
- return cache[env];
43
- }
44
- let json;
45
- switch (env) {
46
- case "polkadot_mainnet":
47
- json = polkadot_mainnet;
48
- break;
49
- case "westend_sepolia":
50
- json = westend_sepolia;
51
- break;
52
- case "paseo_sepolia":
53
- json = paseo_sepolia;
54
- break;
55
- case "local_e2e":
56
- json = local_e2e;
57
- break;
58
- default:
59
- throw Error(`Unknown env '${env}'`);
60
- }
61
- cache[env] = transformBigInt(json);
62
- return cache[env];
41
+ if (env in cache) {
42
+ return cache[env]
43
+ }
44
+ let json
45
+ switch (env) {
46
+ case "polkadot_mainnet":
47
+ json = polkadot_mainnet
48
+ break
49
+ case "westend_sepolia":
50
+ json = westend_sepolia
51
+ break
52
+ case "paseo_sepolia":
53
+ json = paseo_sepolia
54
+ break
55
+ case "local_e2e":
56
+ json = local_e2e
57
+ break
58
+ default:
59
+ throw Error(`Unknown env '${env}'`)
60
+ }
61
+ cache[env] = transformBigInt(json)
62
+ return cache[env]
63
63
  }