@subwallet/chain-list 0.0.28 → 0.0.29

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.
@@ -141,7 +141,7 @@
141
141
  path: "XCM"
142
142
  },
143
143
  "karura-NATIVE-KAR___moonriver-LOCAL-xcKAR": {
144
- srcAsset: "karura-LOCAL-aUSD",
144
+ srcAsset: "karura-NATIVE-KAR",
145
145
  destAsset: "moonriver-LOCAL-xcKAR",
146
146
  srcChain: "karura",
147
147
  destChain: "moonriver",
@@ -684,7 +684,14 @@
684
684
  priceId: "astar",
685
685
  minAmount: "1000000",
686
686
  assetType: "NATIVE",
687
- metadata: null,
687
+ metadata: {
688
+ multilocation: {
689
+ Concrete: {
690
+ parents: 0,
691
+ interior: "Here"
692
+ }
693
+ }
694
+ },
688
695
  multiChainAsset: "ASTR-Astar",
689
696
  hasValue: true
690
697
  },
@@ -700,8 +707,10 @@
700
707
  metadata: {
701
708
  assetId: "340282366920938463463374607431768211455",
702
709
  multilocation: {
703
- parents: 1,
704
- interior: "Here"
710
+ Concrete: {
711
+ parents: 1,
712
+ interior: "Here"
713
+ }
705
714
  }
706
715
  },
707
716
  multiChainAsset: "DOT-Polkadot",
@@ -719,19 +728,21 @@
719
728
  metadata: {
720
729
  assetId: "4294969280",
721
730
  multilocation: {
722
- parents: 1,
723
- interior: {
724
- X3: [
725
- {
726
- Parachain: 1000
727
- },
728
- {
729
- GeneralIndex: 50
730
- },
731
- {
732
- GeneralIndex: 1984
733
- }
734
- ]
731
+ Concrete: {
732
+ parents: 1,
733
+ interior: {
734
+ X3: [
735
+ {
736
+ Parachain: 1000
737
+ },
738
+ {
739
+ GeneralIndex: 50
740
+ },
741
+ {
742
+ GeneralIndex: 1984
743
+ }
744
+ ]
745
+ }
735
746
  }
736
747
  }
737
748
  },
@@ -1529,7 +1540,16 @@
1529
1540
  priceId: "karura",
1530
1541
  minAmount: "100000000000",
1531
1542
  assetType: "NATIVE",
1532
- metadata: null,
1543
+ metadata: {
1544
+ onChainInfo: {
1545
+ NativeAssetId: {
1546
+ Token: "KAR"
1547
+ }
1548
+ },
1549
+ multilocation: {
1550
+ Token: "KAR"
1551
+ }
1552
+ },
1533
1553
  multiChainAsset: "KAR-Karura",
1534
1554
  hasValue: true
1535
1555
  },
@@ -2712,9 +2732,9 @@
2712
2732
  multiChainAsset: null,
2713
2733
  hasValue: true
2714
2734
  },
2715
- "sora-substrate-NATIVE-XOR": {
2716
- originChain: "sora-substrate",
2717
- slug: "sora-substrate-NATIVE-XOR",
2735
+ "sora_substrate-NATIVE-XOR": {
2736
+ originChain: "sora_substrate",
2737
+ slug: "sora_substrate-NATIVE-XOR",
2718
2738
  name: "SORA",
2719
2739
  symbol: "XOR",
2720
2740
  decimals: 18,
@@ -2834,7 +2854,7 @@
2834
2854
  assetType: "ForeignAsset",
2835
2855
  contractAddress: "0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080"
2836
2856
  },
2837
- multiChainAsset: "USDT-Tether",
2857
+ multiChainAsset: "KSM-Kusama",
2838
2858
  hasValue: true
2839
2859
  },
2840
2860
  "shiden-LOCAL-KSM": {
@@ -2848,7 +2868,13 @@
2848
2868
  assetType: "LOCAL",
2849
2869
  metadata: {
2850
2870
  assetId: "42259045809535163221576417993425387648",
2851
- assetType: "ForeignAsset"
2871
+ assetType: "ForeignAsset",
2872
+ multilocation: {
2873
+ Concrete: {
2874
+ parents: 1,
2875
+ interior: "Here"
2876
+ }
2877
+ }
2852
2878
  },
2853
2879
  multiChainAsset: "KSM-Kusama",
2854
2880
  hasValue: true
@@ -2901,7 +2927,7 @@
2901
2927
  Token: "BNC"
2902
2928
  }
2903
2929
  },
2904
- multiChainAsset: "KSM-Kusama",
2930
+ multiChainAsset: "BNC-BifrostKusama",
2905
2931
  hasValue: true
2906
2932
  },
2907
2933
  "bifrost-LOCAL-KSM": {
@@ -3018,16 +3044,18 @@
3018
3044
  metadata: {
3019
3045
  assetId: "18446744073709551617",
3020
3046
  multilocation: {
3021
- parents: 1,
3022
- interior: {
3023
- X2: [
3024
- {
3025
- Parachain: 2000
3026
- },
3027
- {
3028
- GeneralKey: "0x0001"
3029
- }
3030
- ]
3047
+ Concrete: {
3048
+ parents: 1,
3049
+ interior: {
3050
+ X2: [
3051
+ {
3052
+ Parachain: 2000
3053
+ },
3054
+ {
3055
+ GeneralKey: "0x0001"
3056
+ }
3057
+ ]
3058
+ }
3031
3059
  }
3032
3060
  }
3033
3061
  },
@@ -3083,9 +3111,9 @@
3083
3111
  originChain: "moonriver",
3084
3112
  slug: "moonriver-LOCAL-xcKAR",
3085
3113
  name: "Karura",
3086
- symbol: "KAR",
3114
+ symbol: "xcKAR",
3087
3115
  decimals: 12,
3088
- priceId: null,
3116
+ priceId: "karura",
3089
3117
  minAmount: null,
3090
3118
  assetType: "LOCAL",
3091
3119
  metadata: {
@@ -4029,12 +4057,12 @@
4029
4057
  hasValue: true,
4030
4058
  multiChainAsset: null
4031
4059
  },
4032
- "astarEvm-ERC20-ARSW-LP-0x87988EbDE7E661F44eB3a586C5E0cEAB533a2d9C": {
4060
+ "astarEvm-ERC20-ARSW_LP-0x87988EbDE7E661F44eB3a586C5E0cEAB533a2d9C": {
4033
4061
  originChain: "astarEvm",
4034
- slug: "astarEvm-ERC20-ARSW-LP-0x87988EbDE7E661F44eB3a586C5E0cEAB533a2d9C",
4062
+ slug: "astarEvm-ERC20-ARSW_LP-0x87988EbDE7E661F44eB3a586C5E0cEAB533a2d9C",
4035
4063
  name: "Arthswap LPs (ARSW-LP)",
4036
4064
  decimals: 18,
4037
- symbol: "ARSW-LP",
4065
+ symbol: "ARSW_LP",
4038
4066
  priceId: null,
4039
4067
  minAmount: null,
4040
4068
  assetType: "ERC20",
@@ -5066,9 +5094,9 @@
5066
5094
  multiChainAsset: null,
5067
5095
  hasValue: true
5068
5096
  },
5069
- "ethereum-ERC20-FTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870": {
5097
+ "ethereum-ERC20-WFTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870": {
5070
5098
  originChain: "ethereum",
5071
- slug: "ethereum-ERC20-FTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870",
5099
+ slug: "ethereum-ERC20-WFTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870",
5072
5100
  name: "Wrapped Fantom",
5073
5101
  symbol: "WFTM",
5074
5102
  decimals: 18,
@@ -9085,6 +9113,33 @@
9085
9113
  },
9086
9114
  evmInfo: null
9087
9115
  };
9116
+ var sora_substrate = {
9117
+ slug: "sora_substrate",
9118
+ name: "SORA",
9119
+ chainStatus: "ACTIVE",
9120
+ providers: {
9121
+ "SORA Parliament Ministry of Finance #2": "wss://mof2.sora.org",
9122
+ "SORA Parliament Ministry of Finance": "wss://ws.mof.sora.org",
9123
+ "SORA Parliament Ministry of Finance #3": "wss://mof3.sora.org",
9124
+ OnFinality: "wss://sora.api.onfinality.io/public-ws"
9125
+ },
9126
+ isTestnet: false,
9127
+ substrateInfo: {
9128
+ paraId: null,
9129
+ relaySlug: null,
9130
+ genesisHash: "0x7e4e32d0feafd4f9c9414b0be86373f9a1efa904809b683453a9af6856d38ad5",
9131
+ addressPrefix: 69,
9132
+ chainType: "RELAYCHAIN",
9133
+ blockExplorer: "https://sora.subscan.io",
9134
+ symbol: "XOR",
9135
+ existentialDeposit: "0",
9136
+ decimals: 18,
9137
+ supportStaking: false,
9138
+ hasNativeNft: false,
9139
+ supportSmartContract: null
9140
+ },
9141
+ evmInfo: null
9142
+ };
9088
9143
  var swapdex = {
9089
9144
  slug: "swapdex",
9090
9145
  name: "Swapdex",
@@ -9370,33 +9425,7 @@
9370
9425
  polymesh: polymesh,
9371
9426
  riochain: riochain,
9372
9427
  sherpax: sherpax,
9373
- "sora-substrate": {
9374
- slug: "sora-substrate",
9375
- name: "SORA",
9376
- chainStatus: "ACTIVE",
9377
- providers: {
9378
- "SORA Parliament Ministry of Finance #2": "wss://mof2.sora.org",
9379
- "SORA Parliament Ministry of Finance": "wss://ws.mof.sora.org",
9380
- "SORA Parliament Ministry of Finance #3": "wss://mof3.sora.org",
9381
- OnFinality: "wss://sora.api.onfinality.io/public-ws"
9382
- },
9383
- isTestnet: false,
9384
- substrateInfo: {
9385
- paraId: null,
9386
- relaySlug: null,
9387
- genesisHash: "0x7e4e32d0feafd4f9c9414b0be86373f9a1efa904809b683453a9af6856d38ad5",
9388
- addressPrefix: 69,
9389
- chainType: "RELAYCHAIN",
9390
- blockExplorer: "https://sora.subscan.io",
9391
- symbol: "XOR",
9392
- existentialDeposit: "0",
9393
- decimals: 18,
9394
- supportStaking: false,
9395
- hasNativeNft: false,
9396
- supportSmartContract: null
9397
- },
9398
- evmInfo: null
9399
- },
9428
+ sora_substrate: sora_substrate,
9400
9429
  swapdex: swapdex,
9401
9430
  "3dpass": {
9402
9431
  slug: "3dpass",
@@ -9467,7 +9496,7 @@
9467
9496
  originChainAsset: "karura-NATIVE-KAR",
9468
9497
  name: "Karura",
9469
9498
  symbol: "KAR",
9470
- priceId: null,
9499
+ priceId: "karura",
9471
9500
  hasValue: true
9472
9501
  },
9473
9502
  "USDT-Tether": {
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/chain-list',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '0.0.28'
16
+ version: '0.0.29'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -135,7 +135,7 @@
135
135
  },
136
136
 
137
137
  "karura-NATIVE-KAR___moonriver-LOCAL-xcKAR": {
138
- "srcAsset": "karura-LOCAL-aUSD",
138
+ "srcAsset": "karura-NATIVE-KAR",
139
139
  "destAsset": "moonriver-LOCAL-xcKAR",
140
140
  "srcChain": "karura",
141
141
  "destChain": "moonriver",
@@ -344,7 +344,14 @@
344
344
  "priceId": "astar",
345
345
  "minAmount": "1000000",
346
346
  "assetType": "NATIVE",
347
- "metadata": null,
347
+ "metadata": {
348
+ "multilocation": {
349
+ "Concrete": {
350
+ "parents": 0,
351
+ "interior": "Here"
352
+ }
353
+ }
354
+ },
348
355
  "multiChainAsset": "ASTR-Astar",
349
356
  "hasValue": true
350
357
  },
@@ -360,8 +367,10 @@
360
367
  "metadata": {
361
368
  "assetId": "340282366920938463463374607431768211455",
362
369
  "multilocation": {
363
- "parents": 1,
364
- "interior": "Here"
370
+ "Concrete": {
371
+ "parents": 1,
372
+ "interior": "Here"
373
+ }
365
374
  }
366
375
  },
367
376
  "multiChainAsset": "DOT-Polkadot",
@@ -379,19 +388,21 @@
379
388
  "metadata": {
380
389
  "assetId": "4294969280",
381
390
  "multilocation": {
382
- "parents": 1,
383
- "interior": {
384
- "X3": [
385
- {
386
- "Parachain": 1000
387
- },
388
- {
389
- "GeneralIndex": 50
390
- },
391
- {
392
- "GeneralIndex": 1984
393
- }
394
- ]
391
+ "Concrete": {
392
+ "parents": 1,
393
+ "interior": {
394
+ "X3": [
395
+ {
396
+ "Parachain": 1000
397
+ },
398
+ {
399
+ "GeneralIndex": 50
400
+ },
401
+ {
402
+ "GeneralIndex": 1984
403
+ }
404
+ ]
405
+ }
395
406
  }
396
407
  }
397
408
  },
@@ -1189,7 +1200,16 @@
1189
1200
  "priceId": "karura",
1190
1201
  "minAmount": "100000000000",
1191
1202
  "assetType": "NATIVE",
1192
- "metadata": null,
1203
+ "metadata": {
1204
+ "onChainInfo": {
1205
+ "NativeAssetId": {
1206
+ "Token": "KAR"
1207
+ }
1208
+ },
1209
+ "multilocation": {
1210
+ "Token": "KAR"
1211
+ }
1212
+ },
1193
1213
  "multiChainAsset": "KAR-Karura",
1194
1214
  "hasValue": true
1195
1215
  },
@@ -2372,9 +2392,9 @@
2372
2392
  "multiChainAsset": null,
2373
2393
  "hasValue": true
2374
2394
  },
2375
- "sora-substrate-NATIVE-XOR": {
2376
- "originChain": "sora-substrate",
2377
- "slug": "sora-substrate-NATIVE-XOR",
2395
+ "sora_substrate-NATIVE-XOR": {
2396
+ "originChain": "sora_substrate",
2397
+ "slug": "sora_substrate-NATIVE-XOR",
2378
2398
  "name": "SORA",
2379
2399
  "symbol": "XOR",
2380
2400
  "decimals": 18,
@@ -2494,7 +2514,7 @@
2494
2514
  "assetType": "ForeignAsset",
2495
2515
  "contractAddress": "0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080"
2496
2516
  },
2497
- "multiChainAsset": "USDT-Tether",
2517
+ "multiChainAsset": "KSM-Kusama",
2498
2518
  "hasValue": true
2499
2519
  },
2500
2520
  "shiden-LOCAL-KSM": {
@@ -2508,7 +2528,13 @@
2508
2528
  "assetType": "LOCAL",
2509
2529
  "metadata": {
2510
2530
  "assetId": "42259045809535163221576417993425387648",
2511
- "assetType": "ForeignAsset"
2531
+ "assetType": "ForeignAsset",
2532
+ "multilocation": {
2533
+ "Concrete": {
2534
+ "parents": 1,
2535
+ "interior": "Here"
2536
+ }
2537
+ }
2512
2538
  },
2513
2539
  "multiChainAsset": "KSM-Kusama",
2514
2540
  "hasValue": true
@@ -2561,7 +2587,7 @@
2561
2587
  "Token": "BNC"
2562
2588
  }
2563
2589
  },
2564
- "multiChainAsset": "KSM-Kusama",
2590
+ "multiChainAsset": "BNC-BifrostKusama",
2565
2591
  "hasValue": true
2566
2592
  },
2567
2593
  "bifrost-LOCAL-KSM": {
@@ -2678,16 +2704,18 @@
2678
2704
  "metadata": {
2679
2705
  "assetId": "18446744073709551617",
2680
2706
  "multilocation": {
2681
- "parents": 1,
2682
- "interior": {
2683
- "X2": [
2684
- {
2685
- "Parachain": 2000
2686
- },
2687
- {
2688
- "GeneralKey": "0x0001"
2689
- }
2690
- ]
2707
+ "Concrete": {
2708
+ "parents": 1,
2709
+ "interior": {
2710
+ "X2": [
2711
+ {
2712
+ "Parachain": 2000
2713
+ },
2714
+ {
2715
+ "GeneralKey": "0x0001"
2716
+ }
2717
+ ]
2718
+ }
2691
2719
  }
2692
2720
  }
2693
2721
  },
@@ -2743,9 +2771,9 @@
2743
2771
  "originChain": "moonriver",
2744
2772
  "slug": "moonriver-LOCAL-xcKAR",
2745
2773
  "name": "Karura",
2746
- "symbol": "KAR",
2774
+ "symbol": "xcKAR",
2747
2775
  "decimals": 12,
2748
- "priceId": null,
2776
+ "priceId": "karura",
2749
2777
  "minAmount": null,
2750
2778
  "assetType": "LOCAL",
2751
2779
  "metadata": {
@@ -3689,12 +3717,12 @@
3689
3717
  "hasValue": true,
3690
3718
  "multiChainAsset": null
3691
3719
  },
3692
- "astarEvm-ERC20-ARSW-LP-0x87988EbDE7E661F44eB3a586C5E0cEAB533a2d9C": {
3720
+ "astarEvm-ERC20-ARSW_LP-0x87988EbDE7E661F44eB3a586C5E0cEAB533a2d9C": {
3693
3721
  "originChain": "astarEvm",
3694
- "slug": "astarEvm-ERC20-ARSW-LP-0x87988EbDE7E661F44eB3a586C5E0cEAB533a2d9C",
3722
+ "slug": "astarEvm-ERC20-ARSW_LP-0x87988EbDE7E661F44eB3a586C5E0cEAB533a2d9C",
3695
3723
  "name": "Arthswap LPs (ARSW-LP)",
3696
3724
  "decimals": 18,
3697
- "symbol": "ARSW-LP",
3725
+ "symbol": "ARSW_LP",
3698
3726
  "priceId": null,
3699
3727
  "minAmount": null,
3700
3728
  "assetType": "ERC20",
@@ -4726,9 +4754,9 @@
4726
4754
  "multiChainAsset": null,
4727
4755
  "hasValue": true
4728
4756
  },
4729
- "ethereum-ERC20-FTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870": {
4757
+ "ethereum-ERC20-WFTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870": {
4730
4758
  "originChain": "ethereum",
4731
- "slug": "ethereum-ERC20-FTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870",
4759
+ "slug": "ethereum-ERC20-WFTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870",
4732
4760
  "name": "Wrapped Fantom",
4733
4761
  "symbol": "WFTM",
4734
4762
  "decimals": 18,
@@ -3581,8 +3581,8 @@
3581
3581
  },
3582
3582
  "evmInfo": null
3583
3583
  },
3584
- "sora-substrate": {
3585
- "slug": "sora-substrate",
3584
+ "sora_substrate": {
3585
+ "slug": "sora_substrate",
3586
3586
  "name": "SORA",
3587
3587
  "chainStatus": "ACTIVE",
3588
3588
  "providers": {
@@ -36,7 +36,7 @@
36
36
  "originChainAsset": "karura-NATIVE-KAR",
37
37
  "name": "Karura",
38
38
  "symbol": "KAR",
39
- "priceId": null,
39
+ "priceId": "karura",
40
40
  "hasValue": true
41
41
  },
42
42
  "USDT-Tether": {
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./cjs/detectPackage.js"
21
21
  ],
22
22
  "type": "module",
23
- "version": "0.0.28",
23
+ "version": "0.0.29",
24
24
  "main": "./cjs/index.js",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts",
@@ -269,7 +269,10 @@
269
269
  "types": "./types.d.ts",
270
270
  "require": "./cjs/types.js",
271
271
  "default": "./types.js"
272
- }
272
+ },
273
+ "./validations/validate-asset-refs": "./validations/validate-asset-refs.js",
274
+ "./validations/validate-chains": "./validations/validate-chains.js",
275
+ "./validations/validate-tokens": "./validations/validate-tokens.js"
273
276
  },
274
277
  "dependencies": {
275
278
  "@polkadot/dev": "0.67.167",
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.28'
10
+ version: '0.0.29'
11
11
  };
@@ -0,0 +1,38 @@
1
+ import MultiChainAssetMap from '../data/MultiChainAsset.json' assert { type: "json" };
2
+ import ChainAssetMap from '../data/ChainAsset.json' assert { type: "json" };
3
+ import ChainInfoMap from '../data/ChainInfo.json' assert { type: "json" };
4
+ import AssetRefMap from '../data/AssetRef.json' assert { type: "json" };
5
+
6
+ Object.entries(AssetRefMap).forEach(([slug, assetRef]) => {
7
+ const generatedSlug = `${assetRef.srcAsset}___${assetRef.destAsset}`;
8
+
9
+ if (generatedSlug !== slug) {
10
+ console.error('Invalid slug: ', slug);
11
+ }
12
+
13
+ if (assetRef.path === 'XCM') {
14
+ const srcAsset = ChainAssetMap[assetRef.srcAsset];
15
+
16
+ if (!srcAsset) {
17
+ console.error('Asset not found: ', assetRef);
18
+ } else {
19
+ if (['astar', 'shiden', 'statemine', 'statemint', 'pioneer'].includes(srcAsset.originChain)) {
20
+ if (!srcAsset?.metadata?.multilocation) {
21
+ console.error('Token must have multilocation: ', assetRef.srcAsset);
22
+ }
23
+ } else if (['acala', 'karura'].includes(srcAsset.originChain) && srcAsset.assetType === 'NATIVE') {
24
+ if (!srcAsset?.metadata?.multilocation) {
25
+ console.error('Token must have multilocation: ', assetRef.srcAsset);
26
+ }
27
+ } else if (['moonbeam', 'moonbase', 'moonriver'].includes(srcAsset.originChain)) {
28
+ if (!srcAsset?.metadata?.assetId) {
29
+ console.error('Token must have assetId: ', assetRef.srcAsset);
30
+ }
31
+
32
+ if (!srcAsset?.metadata?.assetType) {
33
+ console.error('Token must have assetType: ', assetRef.srcAsset);
34
+ }
35
+ }
36
+ }
37
+ }
38
+ });
@@ -0,0 +1,31 @@
1
+ import ChainInfoMap from '../data/ChainInfo.json' assert { type: "json" };
2
+ import ChainAssetMap from '../data/ChainAsset.json' assert { type: "json" };
3
+
4
+ // Last update: 10/4/2023
5
+ // Validations:
6
+ // Count number of native tokens and number of chains
7
+ // Validate chain and native token slug
8
+
9
+ const chainCount = Object.keys(ChainInfoMap).length;
10
+
11
+ console.log('Total chains: ', chainCount);
12
+
13
+ Object.entries(ChainInfoMap).forEach(([chainSlug, chainInfo]) => {
14
+ if (chainInfo.slug !== chainSlug) {
15
+ console.error('Error chain slug: ', chainSlug);
16
+ }
17
+
18
+ const symbol = chainInfo?.evmInfo ? chainInfo?.evmInfo?.symbol : chainInfo?.substrateInfo?.symbol;
19
+ const decimals = chainInfo?.evmInfo ? chainInfo?.evmInfo?.decimals : chainInfo?.substrateInfo?.decimals;
20
+ const nativeTokenSlug = `${chainInfo.slug}-NATIVE-${symbol}`;
21
+
22
+ if (!(nativeTokenSlug in ChainAssetMap)) {
23
+ console.error('Cannot find native token for chain: ', chainSlug);
24
+ } else {
25
+ const nativeToken = ChainAssetMap[nativeTokenSlug];
26
+
27
+ if (nativeToken.symbol !== symbol || nativeToken.decimals !== decimals) {
28
+ console.error('Error symbol/decimals for native token: ', nativeTokenSlug);
29
+ }
30
+ }
31
+ });
@@ -0,0 +1,72 @@
1
+ import MultiChainAssetMap from '../data/MultiChainAsset.json' assert { type: "json" };
2
+ import ChainAssetMap from '../data/ChainAsset.json' assert { type: "json" };
3
+ import ChainInfoMap from '../data/ChainInfo.json' assert { type: "json" };
4
+
5
+ const assetCount = Object.keys(ChainAssetMap).length;
6
+
7
+ console.log('Total assets: ', assetCount);
8
+
9
+ const ASSET_TYPES = [
10
+ 'NATIVE',
11
+ 'LOCAL',
12
+ 'ERC20',
13
+ 'ERC721',
14
+ 'PSP22',
15
+ 'PSP34',
16
+ 'UNKNOWN'
17
+ ]
18
+
19
+ Object.entries(ChainAssetMap).forEach(([assetSlug, chainAsset]) => {
20
+ const originChainSlug = assetSlug.split('-')[0];
21
+ const tokenType = assetSlug.split('-')[1];
22
+ const tokenSymbol = assetSlug.split('-')[2];
23
+
24
+ const isValidOriginChain = originChainSlug === chainAsset.originChain && originChainSlug in ChainInfoMap;
25
+ const isValidTokenType = ASSET_TYPES.includes(tokenType);
26
+ const isValidTokenSymbol = tokenSymbol === chainAsset.symbol;
27
+
28
+ if (!(isValidOriginChain && isValidTokenType && isValidTokenSymbol)) {
29
+ console.error('Invalid asset info: ', assetSlug);
30
+ } else {
31
+ // Check multichain asset
32
+ if (chainAsset.multiChainAsset !== null) {
33
+ if (!(chainAsset.multiChainAsset in MultiChainAssetMap)) {
34
+ console.error('Cannot find multi-chain asset: ', assetSlug);
35
+ } else {
36
+ const multiChainAsset = MultiChainAssetMap[chainAsset.multiChainAsset];
37
+
38
+ if (multiChainAsset.symbol !== chainAsset.symbol) {
39
+ console.warn('Symbol mismatch: ', chainAsset.slug, multiChainAsset.slug);
40
+ }
41
+
42
+ if (multiChainAsset.priceId !== chainAsset.priceId) {
43
+ console.warn('PriceId mismatch: ', chainAsset.slug, multiChainAsset.slug);
44
+ }
45
+ }
46
+ }
47
+
48
+ if (['ERC20', 'ERC721', 'PSP22', 'PSP34'].includes(chainAsset.assetType)) {
49
+ if (!chainAsset.metadata.contractAddress) {
50
+ console.error('Cannot find multi-chain asset: ', assetSlug);
51
+ }
52
+ }
53
+
54
+ if (chainAsset.assetType === 'LOCAL' && ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'kintsugi', 'interlay', 'kintsugi_test'].includes(chainAsset.originChain)) {
55
+ if (!chainAsset.metadata?.onChainInfo) {
56
+ console.error('Asset must have onChainInfo: ', assetSlug);
57
+ }
58
+ }
59
+
60
+ if (chainAsset.assetType === 'LOCAL' && ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'equilibrium_parachain', 'genshiro_testnet', 'genshiro'].includes(chainAsset.originChain)) {
61
+ if (!chainAsset.metadata?.assetId) {
62
+ console.error('Asset must have assetId: ', assetSlug);
63
+ }
64
+ }
65
+
66
+ // if (chainAsset.originChain === 'astar') {
67
+ // if (!chainAsset.metadata.multilocation) {
68
+ // console.error('Astar assets should have multilocation: ', assetSlug);
69
+ // }
70
+ // }
71
+ }
72
+ });