@subwallet/chain-list 0.0.18 → 0.0.20

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,32 @@
1
+ // Convert chain list
2
+
3
+ import fs from 'fs';
4
+
5
+ const CoinGeckoList = JSON.parse(fs.readFileSync('./CoinGeckoTokens.json'));
6
+ const AssetMap = JSON.parse(fs.readFileSync('../data/ChainAsset.json'));
7
+ const ChainMap = JSON.parse(fs.readFileSync('../data/ChainInfo.json'));
8
+
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
+ }
15
+
16
+ return map;
17
+ }, {});
18
+
19
+ 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;
28
+ }
29
+
30
+ console.log(slug, asset.originChain, asset.symbol, symbolMap[lsym]);
31
+ }
32
+ });
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./cjs/detectPackage.js"
21
21
  ],
22
22
  "type": "module",
23
- "version": "0.0.18",
23
+ "version": "0.0.20",
24
24
  "main": "./cjs/index.js",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts",
@@ -248,8 +248,10 @@
248
248
  "./logo/99.Sora.png": "./logo/99.Sora.png",
249
249
  "./migrate/add-decimals": "./migrate/add-decimals.js",
250
250
  "./migrate/add-ED": "./migrate/add-ED.js",
251
+ "./migrate/CoinGeckoTokens.json": "./migrate/CoinGeckoTokens.json",
251
252
  "./migrate/convert-change-list": "./migrate/convert-change-list.js",
252
253
  "./migrate/generate-native-tokens": "./migrate/generate-native-tokens.js",
254
+ "./migrate/update-price-symbol": "./migrate/update-price-symbol.js",
253
255
  "./package.json": "./package.json",
254
256
  "./packageInfo.js": {
255
257
  "types": "./packageInfo.d.ts",
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.18'
10
+ version: '0.0.20'
11
11
  };
package/types.d.ts CHANGED
@@ -89,5 +89,7 @@ export declare enum _AssetRefPath {
89
89
  export interface _AssetRef {
90
90
  srcAsset: string;
91
91
  destAsset: string;
92
+ srcChain: string;
93
+ destChain: string;
92
94
  path: _AssetRefPath;
93
95
  }