@subwallet/chain-list 0.0.24 → 0.0.26

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,15 @@
1
+ // Convert chain list
2
+
3
+ import fs from 'fs';
4
+
5
+ const ChainMap = JSON.parse(fs.readFileSync('../data/ChainInfo.json'));
6
+
7
+ const regex = /^https?:\/\/(.+)\.subscan\.io\//;
8
+ Object.entries(ChainMap).forEach(([slug, chain]) => {
9
+ const link = chain.substrateInfo?.blockExplorer || chain.evmInfo?.blockExplorer;
10
+ const match = link && link.match(regex);
11
+
12
+ if (match) {
13
+ console.log(slug, `'${match[1]}'`);
14
+ }
15
+ });
@@ -1,3 +1,6 @@
1
+ // Copyright 2017-2023 @subwallet/chain-list authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
1
4
  // Convert chain list
2
5
 
3
6
  import fs from 'fs';
@@ -6,27 +9,51 @@ const CoinGeckoList = JSON.parse(fs.readFileSync('./CoinGeckoTokens.json'));
6
9
  const AssetMap = JSON.parse(fs.readFileSync('../data/ChainAsset.json'));
7
10
  const ChainMap = JSON.parse(fs.readFileSync('../data/ChainInfo.json'));
8
11
 
9
- const symbolMap = CoinGeckoList.reduce((map, item) => {
10
- if (map[item.symbol]) {
11
- map[item.symbol].push(item.id);
12
- } else {
13
- map[item.symbol] = [item.id];
14
- }
12
+ // const symbolMap = CoinGeckoList.reduce((map, item) => {
13
+ // if (map[item.symbol]) {
14
+ // map[item.symbol].push(item.id);
15
+ // } else {
16
+ // map[item.symbol] = [item.id];
17
+ // }
18
+ //
19
+ // return map;
20
+ // }, {});
21
+ //
22
+ // Object.entries(AssetMap).forEach(([slug, asset]) => {
23
+ // const lsym = (asset.symbol || '').toLowerCase();
24
+ //
25
+ // if (!asset.priceId && symbolMap[lsym]) {
26
+ // if (ChainMap[asset.originChain] && ChainMap[asset.originChain].isTestnet) {
27
+ // if (asset.priceId) {
28
+ // console.warn(slug);
29
+ // }
30
+ // return;
31
+ // }
32
+ //
33
+ // console.log(slug, asset.originChain, asset.symbol, symbolMap[lsym]);
34
+ // }
35
+ // });
36
+
37
+ // Check priceId not support by coingecko
38
+ const priceIdMap = CoinGeckoList.reduce((map, item) => {
39
+ map[item.id] = item.symbol.toLowerCase();
15
40
 
16
41
  return map;
17
42
  }, {});
18
43
 
19
44
  Object.entries(AssetMap).forEach(([slug, asset]) => {
20
- const lsym = (asset.symbol || '').toLowerCase();
21
-
22
- if (!asset.priceId && symbolMap[lsym]) {
23
- if (ChainMap[asset.originChain] && ChainMap[asset.originChain].isTestnet) {
24
- if (asset.priceId) {
25
- console.warn(slug)
26
- }
27
- return;
45
+ const priceId = asset.priceId;
46
+ const networkInfo = ChainMap[asset.originChain];
47
+
48
+ if (networkInfo.isTestnet || !priceId) {
49
+ if (priceId) {
50
+ console.error('error', slug);
28
51
  }
29
52
 
30
- console.log(slug, asset.originChain, asset.symbol, symbolMap[lsym]);
53
+ return;
54
+ }
55
+
56
+ if ((priceId && !priceIdMap[priceId]) || (asset.symbol.toLowerCase() !== priceIdMap[priceId])) {
57
+ console.log(slug, asset.priceId, priceIdMap[priceId]);
31
58
  }
32
59
  });
@@ -1,3 +1,6 @@
1
+ // Copyright 2017-2023 @subwallet/chain-list authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
1
4
  // Convert chain list
2
5
  import fs from 'fs';
3
6
 
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./cjs/detectPackage.js"
21
21
  ],
22
22
  "type": "module",
23
- "version": "0.0.24",
23
+ "version": "0.0.26",
24
24
  "main": "./cjs/index.js",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts",
@@ -251,6 +251,7 @@
251
251
  "./migrate/CoinGeckoTokens.json": "./migrate/CoinGeckoTokens.json",
252
252
  "./migrate/convert-change-list": "./migrate/convert-change-list.js",
253
253
  "./migrate/generate-native-tokens": "./migrate/generate-native-tokens.js",
254
+ "./migrate/subscan-support-map": "./migrate/subscan-support-map.js",
254
255
  "./migrate/update-price-symbol": "./migrate/update-price-symbol.js",
255
256
  "./migrate/validate-chainAsset": "./migrate/validate-chainAsset.js",
256
257
  "./package.json": "./package.json",
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@subwallet/chain-list',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '0.0.24'
10
+ version: '0.0.26'
11
11
  };