@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.
@@ -1,9 +1,12 @@
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
  const ContractType = {
4
7
  wasm: 'wasm',
5
8
  evm: 'evm'
6
- }
9
+ };
7
10
 
8
11
  const inputMap = {
9
12
  polkadot: {
@@ -2779,87 +2782,87 @@ const inputMap = {
2779
2782
  nativeToken: 'JOY',
2780
2783
  decimals: 10
2781
2784
  }
2782
- }
2785
+ };
2783
2786
 
2784
2787
  const subscanExplorerMap = {
2785
- "polkadot": "https://polkadot.subscan.io/",
2786
- "acala": "https://acala.subscan.io/",
2787
- "astar": "https://astar.subscan.io/",
2788
- "bifrost": "https://bifrost.subscan.io/",
2789
- "centrifuge": "https://centrifuge.subscan.io/",
2790
- "clv": "https://clv.subscan.io/",
2791
- "composable": "https://composable.subscan.io/",
2792
- "crust-parachain": "https://crust-parachain.subscan.io/",
2793
- "darwinia-parachain": "https://darwinia-parachain.subscan.io/",
2794
- "efinity": "https://efinity.subscan.io/",
2795
- "equilibrium": "https://equilibrium.subscan.io/",
2796
- "hydradx": "https://hydradx.subscan.io/",
2797
- "interlay": "https://interlay.subscan.io/",
2798
- "spiritnet": "https://spiritnet.subscan.io/",
2799
- "moonbeam": "https://moonbeam.subscan.io/",
2800
- "nodle": "https://nodle.subscan.io/",
2801
- "origintrail": "https://origintrail.subscan.io/",
2802
- "parallel": "https://parallel.subscan.io/",
2803
- "phala": "https://phala.subscan.io/",
2804
- "statemint": "https://statemint.subscan.io/",
2805
- "unique": "https://unique.subscan.io/",
2806
- "zeitgeist": "https://zeitgeist.subscan.io/",
2807
- "kusama": "https://kusama.subscan.io/",
2808
- "altair": "https://altair.subscan.io/",
2809
- "bajun": "https://bajun.subscan.io/",
2810
- "basilisk": "https://basilisk.subscan.io/",
2811
- "bifrost-kusama": "https://bifrost-kusama.subscan.io/",
2812
- "calamari": "https://calamari.subscan.io/",
2813
- "crab": "https://crab.subscan.io/",
2814
- "datahighway": "https://datahighway.subscan.io/",
2815
- "encointer": "https://encointer.subscan.io/",
2816
- "parallel-heiko": "https://parallel-heiko.subscan.io/",
2817
- "integritee": "https://integritee.subscan.io/",
2818
- "karura": "https://karura.subscan.io/",
2819
- "khala": "https://khala.subscan.io/",
2820
- "kintsugi": "https://kintsugi.subscan.io/",
2821
- "mangatax": "https://mangatax.subscan.io/",
2822
- "moonriver": "https://moonriver.subscan.io/",
2823
- "picasso": "https://picasso.subscan.io/",
2824
- "pioneer": "https://pioneer.subscan.io/",
2825
- "quartz": "https://quartz.subscan.io/",
2826
- "robonomics": "https://robonomics.subscan.io/",
2827
- "shadow": "https://shadow.subscan.io/",
2828
- "shiden": "https://shiden.subscan.io/",
2829
- "snow": "https://snow.subscan.io/",
2830
- "statemine": "https://statemine.subscan.io/",
2831
- "turing": "https://turing.subscan.io/",
2832
- "darwinia": "https://darwinia.subscan.io/",
2833
- "alephzero": "https://alephzero.subscan.io/",
2834
- "clover": "https://clover.subscan.io/",
2835
- "crust": "https://crust.subscan.io/",
2836
- "dbc": "https://dbc.subscan.io/",
2837
- "dock": "https://dock.subscan.io/",
2838
- "edgeware": "https://edgeware.subscan.io/",
2839
- "genshiro": "https://genshiro.subscan.io/",
2840
- "polkadex": "https://polkadex.subscan.io/",
2841
- "polymesh": "https://polymesh.subscan.io/",
2842
- "reef": "https://reef.subscan.io/",
2843
- "sakura": "https://sakura.subscan.io/",
2844
- "sora": "https://sora.subscan.io/",
2845
- "stafi": "https://stafi.subscan.io/",
2846
- "rococo": "https://rococo.subscan.io/",
2847
- "bifrost-testnet": "https://bifrost-testnet.subscan.io/",
2848
- "dali": "https://dali.subscan.io/",
2849
- "dolphin": "https://dolphin.subscan.io/",
2850
- "origintrail-testnet": "https://origintrail-testnet.subscan.io/",
2851
- "rockmine": "https://rockmine.subscan.io/",
2852
- "westend": "https://westend.subscan.io/",
2853
- "acala-testnet": "https://acala-testnet.subscan.io/",
2854
- "arctic": "https://arctic.subscan.io/",
2855
- "clover-testnet": "https://clover-testnet.subscan.io/",
2856
- "kilt-testnet": "https://kilt-testnet.subscan.io/",
2857
- "moonbase": "https://moonbase.subscan.io/",
2858
- "pangoro": "https://pangoro.subscan.io/",
2859
- "polymesh-testnet": "https://polymesh-testnet.subscan.io/",
2860
- "shibuya": "https://shibuya.subscan.io/",
2861
- "subspace": "https://subspace.subscan.io/"
2862
- }
2788
+ polkadot: 'https://polkadot.subscan.io/',
2789
+ acala: 'https://acala.subscan.io/',
2790
+ astar: 'https://astar.subscan.io/',
2791
+ bifrost: 'https://bifrost.subscan.io/',
2792
+ centrifuge: 'https://centrifuge.subscan.io/',
2793
+ clv: 'https://clv.subscan.io/',
2794
+ composable: 'https://composable.subscan.io/',
2795
+ 'crust-parachain': 'https://crust-parachain.subscan.io/',
2796
+ 'darwinia-parachain': 'https://darwinia-parachain.subscan.io/',
2797
+ efinity: 'https://efinity.subscan.io/',
2798
+ equilibrium: 'https://equilibrium.subscan.io/',
2799
+ hydradx: 'https://hydradx.subscan.io/',
2800
+ interlay: 'https://interlay.subscan.io/',
2801
+ spiritnet: 'https://spiritnet.subscan.io/',
2802
+ moonbeam: 'https://moonbeam.subscan.io/',
2803
+ nodle: 'https://nodle.subscan.io/',
2804
+ origintrail: 'https://origintrail.subscan.io/',
2805
+ parallel: 'https://parallel.subscan.io/',
2806
+ phala: 'https://phala.subscan.io/',
2807
+ statemint: 'https://statemint.subscan.io/',
2808
+ unique: 'https://unique.subscan.io/',
2809
+ zeitgeist: 'https://zeitgeist.subscan.io/',
2810
+ kusama: 'https://kusama.subscan.io/',
2811
+ altair: 'https://altair.subscan.io/',
2812
+ bajun: 'https://bajun.subscan.io/',
2813
+ basilisk: 'https://basilisk.subscan.io/',
2814
+ 'bifrost-kusama': 'https://bifrost-kusama.subscan.io/',
2815
+ calamari: 'https://calamari.subscan.io/',
2816
+ crab: 'https://crab.subscan.io/',
2817
+ datahighway: 'https://datahighway.subscan.io/',
2818
+ encointer: 'https://encointer.subscan.io/',
2819
+ 'parallel-heiko': 'https://parallel-heiko.subscan.io/',
2820
+ integritee: 'https://integritee.subscan.io/',
2821
+ karura: 'https://karura.subscan.io/',
2822
+ khala: 'https://khala.subscan.io/',
2823
+ kintsugi: 'https://kintsugi.subscan.io/',
2824
+ mangatax: 'https://mangatax.subscan.io/',
2825
+ moonriver: 'https://moonriver.subscan.io/',
2826
+ picasso: 'https://picasso.subscan.io/',
2827
+ pioneer: 'https://pioneer.subscan.io/',
2828
+ quartz: 'https://quartz.subscan.io/',
2829
+ robonomics: 'https://robonomics.subscan.io/',
2830
+ shadow: 'https://shadow.subscan.io/',
2831
+ shiden: 'https://shiden.subscan.io/',
2832
+ snow: 'https://snow.subscan.io/',
2833
+ statemine: 'https://statemine.subscan.io/',
2834
+ turing: 'https://turing.subscan.io/',
2835
+ darwinia: 'https://darwinia.subscan.io/',
2836
+ alephzero: 'https://alephzero.subscan.io/',
2837
+ clover: 'https://clover.subscan.io/',
2838
+ crust: 'https://crust.subscan.io/',
2839
+ dbc: 'https://dbc.subscan.io/',
2840
+ dock: 'https://dock.subscan.io/',
2841
+ edgeware: 'https://edgeware.subscan.io/',
2842
+ genshiro: 'https://genshiro.subscan.io/',
2843
+ polkadex: 'https://polkadex.subscan.io/',
2844
+ polymesh: 'https://polymesh.subscan.io/',
2845
+ reef: 'https://reef.subscan.io/',
2846
+ sakura: 'https://sakura.subscan.io/',
2847
+ sora: 'https://sora.subscan.io/',
2848
+ stafi: 'https://stafi.subscan.io/',
2849
+ rococo: 'https://rococo.subscan.io/',
2850
+ 'bifrost-testnet': 'https://bifrost-testnet.subscan.io/',
2851
+ dali: 'https://dali.subscan.io/',
2852
+ dolphin: 'https://dolphin.subscan.io/',
2853
+ 'origintrail-testnet': 'https://origintrail-testnet.subscan.io/',
2854
+ rockmine: 'https://rockmine.subscan.io/',
2855
+ westend: 'https://westend.subscan.io/',
2856
+ 'acala-testnet': 'https://acala-testnet.subscan.io/',
2857
+ arctic: 'https://arctic.subscan.io/',
2858
+ 'clover-testnet': 'https://clover-testnet.subscan.io/',
2859
+ 'kilt-testnet': 'https://kilt-testnet.subscan.io/',
2860
+ moonbase: 'https://moonbase.subscan.io/',
2861
+ pangoro: 'https://pangoro.subscan.io/',
2862
+ 'polymesh-testnet': 'https://polymesh-testnet.subscan.io/',
2863
+ shibuya: 'https://shibuya.subscan.io/',
2864
+ subspace: 'https://subspace.subscan.io/'
2865
+ };
2863
2866
  const evmExplorerMap = {
2864
2867
  moonbeam: 'https://moonbeam.moonscan.io',
2865
2868
  moonriver: 'https://moonriver.moonscan.io',
@@ -2873,13 +2876,13 @@ const evmExplorerMap = {
2873
2876
  bobabeam: 'https://blockexplorer.bobabeam.boba.network'
2874
2877
  };
2875
2878
 
2876
- const useSubscanMap = Object.fromEntries(Object.keys(subscanExplorerMap).map(k => [k, false]));
2879
+ const useSubscanMap = Object.fromEntries(Object.keys(subscanExplorerMap).map((k) => [k, false]));
2877
2880
 
2878
2881
  // Convert inputMap to outputMap
2879
2882
  const outputMap = Object.keys(inputMap).reduce((acc, k) => {
2880
2883
  const value = inputMap[k];
2881
2884
  // Extract all the values from the value
2882
- const {key, chain, icon, active, providers, currentProvider, currentProviderMode, customProviders, nftProvider, genesisHash, groups, ss58Format, paraId, chainType, crowdloanUrl, isEthereum, evmChainId, isHybrid,nativeToken, decimals, coinGeckoKey, blockExplorer, abiExplorer, dependencies, getStakingOnChain, supportBonding, supportSmartContract, apiStatus, requestId} = value;
2885
+ const { abiExplorer, active, apiStatus, blockExplorer, chain, chainType, coinGeckoKey, crowdloanUrl, currentProvider, currentProviderMode, customProviders, decimals, dependencies, evmChainId, genesisHash, getStakingOnChain, groups, icon, isEthereum, isHybrid, key, nativeToken, nftProvider, paraId, providers, requestId, ss58Format, supportBonding, supportSmartContract } = value;
2883
2886
 
2884
2887
  const newItem = {
2885
2888
  slug: key,
@@ -2888,11 +2891,11 @@ const outputMap = Object.keys(inputMap).reduce((acc, k) => {
2888
2891
  providers,
2889
2892
  isTestnet: groups.includes('TEST_NET'),
2890
2893
  substrateInfo: null,
2891
- evmInfo: null,
2892
- }
2894
+ evmInfo: null
2895
+ };
2893
2896
 
2894
2897
  if (subscanExplorerMap[k]) {
2895
- useSubscanMap[k] = true
2898
+ useSubscanMap[k] = true;
2896
2899
  }
2897
2900
 
2898
2901
  if (isEthereum || currentProviderMode === 'http') {
@@ -2901,19 +2904,18 @@ const outputMap = Object.keys(inputMap).reduce((acc, k) => {
2901
2904
 
2902
2905
  newItem.evmInfo = {
2903
2906
  evmChainId,
2904
- blockExplorer: subscanExplorerMap[k] || evmExplorerMap[k]|| blockExplorer,
2907
+ blockExplorer: subscanExplorerMap[k] || evmExplorerMap[k] || blockExplorer,
2905
2908
  symbol: nativeToken,
2906
2909
  decimals,
2907
2910
  existentialDeposit: '0',
2908
- supportSmartContract: ['ERC20', 'ERC721'],
2909
- }
2911
+ supportSmartContract: ['ERC20', 'ERC721']
2912
+ };
2910
2913
  }
2911
2914
 
2912
2915
  if (currentProviderMode === 'ws') {
2913
2916
  // set prop substrateInfo with these field:
2914
2917
  // paraId, relaySlug, genesisHash, addressPrefix, crowdloanUrl, chainType, blockExplorer, symbol, existentialDeposit, decimals, hasNativeNft, supportStaking, supportSmartContract
2915
2918
 
2916
-
2917
2919
  newItem.substrateInfo = {
2918
2920
  paraId: paraId || null,
2919
2921
  relaySlug: null,
@@ -2927,13 +2929,14 @@ const outputMap = Object.keys(inputMap).reduce((acc, k) => {
2927
2929
  decimals,
2928
2930
  supportStaking: supportBonding || false,
2929
2931
  hasNativeNft: false,
2930
- supportSmartContract: supportSmartContract && supportSmartContract.filter(i => (i !== 'ERC20' && i !== 'ERC721')) || null
2931
- }
2932
+ supportSmartContract: supportSmartContract && supportSmartContract.filter((i) => (i !== 'ERC20' && i !== 'ERC721')) || null
2933
+ };
2932
2934
 
2933
2935
  if (groups.includes('POLKADOT_PARACHAIN') && paraId) {
2934
2936
  newItem.substrateInfo.relaySlug = 'polkadot';
2935
2937
  newItem.substrateInfo.chainType = 'PARACHAIN';
2936
2938
  }
2939
+
2937
2940
  if (groups.includes('KUSAMA_PARACHAIN') && paraId) {
2938
2941
  newItem.substrateInfo.relaySlug = 'kusama';
2939
2942
  newItem.substrateInfo.chainType = 'PARACHAIN';
@@ -2941,6 +2944,7 @@ const outputMap = Object.keys(inputMap).reduce((acc, k) => {
2941
2944
  }
2942
2945
 
2943
2946
  acc[k] = newItem;
2947
+
2944
2948
  return acc;
2945
2949
  }, {});
2946
2950
 
@@ -2972,12 +2976,11 @@ const migrated = [
2972
2976
  'amplitude',
2973
2977
  'amplitude_test',
2974
2978
  'bobabase'
2975
- ]
2979
+ ];
2976
2980
 
2977
2981
  for (const key of migrated) {
2978
2982
  delete outputMap[key];
2979
2983
  }
2980
2984
 
2981
-
2982
2985
  // console.log(useSubscanMap);
2983
2986
  console.log(JSON.stringify(outputMap));