@polkadot/networks 7.6.2-6 → 7.7.2-0

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/interfaces.cjs CHANGED
@@ -15,26 +15,49 @@ var _substrate = require("./substrate.cjs");
15
15
  const UNSORTED = [0, 2, 42];
16
16
  const TESTNETS = ['testnet'];
17
17
 
18
- const allNetworks = _substrate.knownSubstrate.map(o => {
18
+ function toExpanded(o) {
19
19
  const network = o.network || '';
20
20
  const nameParts = network.replace(/_/g, '-').split('-');
21
- const n = o;
21
+ const n = o; // ledger additions
22
+
22
23
  n.slip44 = _defaults.knownLedger[network];
23
- n.hasLedgerSupport = !!n.slip44;
24
+ n.hasLedgerSupport = !!n.slip44; // general items
25
+
24
26
  n.genesisHash = _defaults.knownGenesis[network] || [];
25
- n.icon = _defaults.knownIcon[network] || 'substrate';
27
+ n.icon = _defaults.knownIcon[network] || 'substrate'; // filtering
28
+
26
29
  n.isTestnet = !!_defaults.knownTestnet[network] || TESTNETS.includes(nameParts[nameParts.length - 1]);
27
30
  n.isIgnored = n.isTestnet || !(o.standardAccount && o.decimals && o.symbols) && o.prefix !== 42;
28
31
  return n;
29
- }); // The list of available/claimed prefixes
32
+ }
33
+
34
+ function filterSelectable({
35
+ genesisHash,
36
+ prefix
37
+ }) {
38
+ return !!genesisHash.length || prefix === 42;
39
+ }
40
+
41
+ function filterAvailable(n) {
42
+ return !n.isIgnored && !!n.network;
43
+ }
44
+
45
+ function sortNetworks(a, b) {
46
+ const isUnSortedA = UNSORTED.includes(a.prefix);
47
+ const isUnSortedB = UNSORTED.includes(b.prefix);
48
+ return isUnSortedA === isUnSortedB ? 0 : isUnSortedA ? -1 : isUnSortedB ? 1 : a.displayName.localeCompare(b.displayName);
49
+ } // This is all the Substrate networks with our additional information
50
+
51
+
52
+ const allNetworks = _substrate.knownSubstrate.map(toExpanded); // The list of available/claimed prefixes
30
53
  // - no testnets
31
54
  // - we only include those where we have a standardAccount
32
55
  // - sort by name, however we keep 0, 2, 42 first in the list
33
56
 
34
57
 
35
58
  exports.allNetworks = allNetworks;
36
- const availableNetworks = allNetworks.filter(n => !n.isIgnored && !!n.network).sort((a, b) => UNSORTED.includes(a.prefix) === UNSORTED.includes(b.prefix) ? 0 : UNSORTED.includes(a.prefix) ? -1 : UNSORTED.includes(b.prefix) ? 1 : a.displayName.localeCompare(b.displayName)); // A filtered list of those chains we have details about (genesisHashes)
59
+ const availableNetworks = allNetworks.filter(filterAvailable).sort(sortNetworks); // A filtered list of those chains we have details about (genesisHashes)
37
60
 
38
61
  exports.availableNetworks = availableNetworks;
39
- const selectableNetworks = availableNetworks.filter(n => n.genesisHash.length || n.prefix === 42);
62
+ const selectableNetworks = availableNetworks.filter(filterSelectable);
40
63
  exports.selectableNetworks = selectableNetworks;
package/interfaces.js CHANGED
@@ -5,22 +5,46 @@ import { knownSubstrate } from "./substrate.js"; // These are known prefixes tha
5
5
 
6
6
  const UNSORTED = [0, 2, 42];
7
7
  const TESTNETS = ['testnet'];
8
- export const allNetworks = knownSubstrate.map(o => {
8
+
9
+ function toExpanded(o) {
9
10
  const network = o.network || '';
10
11
  const nameParts = network.replace(/_/g, '-').split('-');
11
- const n = o;
12
+ const n = o; // ledger additions
13
+
12
14
  n.slip44 = knownLedger[network];
13
- n.hasLedgerSupport = !!n.slip44;
15
+ n.hasLedgerSupport = !!n.slip44; // general items
16
+
14
17
  n.genesisHash = knownGenesis[network] || [];
15
- n.icon = knownIcon[network] || 'substrate';
18
+ n.icon = knownIcon[network] || 'substrate'; // filtering
19
+
16
20
  n.isTestnet = !!knownTestnet[network] || TESTNETS.includes(nameParts[nameParts.length - 1]);
17
21
  n.isIgnored = n.isTestnet || !(o.standardAccount && o.decimals && o.symbols) && o.prefix !== 42;
18
22
  return n;
19
- }); // The list of available/claimed prefixes
23
+ }
24
+
25
+ function filterSelectable({
26
+ genesisHash,
27
+ prefix
28
+ }) {
29
+ return !!genesisHash.length || prefix === 42;
30
+ }
31
+
32
+ function filterAvailable(n) {
33
+ return !n.isIgnored && !!n.network;
34
+ }
35
+
36
+ function sortNetworks(a, b) {
37
+ const isUnSortedA = UNSORTED.includes(a.prefix);
38
+ const isUnSortedB = UNSORTED.includes(b.prefix);
39
+ return isUnSortedA === isUnSortedB ? 0 : isUnSortedA ? -1 : isUnSortedB ? 1 : a.displayName.localeCompare(b.displayName);
40
+ } // This is all the Substrate networks with our additional information
41
+
42
+
43
+ export const allNetworks = knownSubstrate.map(toExpanded); // The list of available/claimed prefixes
20
44
  // - no testnets
21
45
  // - we only include those where we have a standardAccount
22
46
  // - sort by name, however we keep 0, 2, 42 first in the list
23
47
 
24
- export const availableNetworks = allNetworks.filter(n => !n.isIgnored && !!n.network).sort((a, b) => UNSORTED.includes(a.prefix) === UNSORTED.includes(b.prefix) ? 0 : UNSORTED.includes(a.prefix) ? -1 : UNSORTED.includes(b.prefix) ? 1 : a.displayName.localeCompare(b.displayName)); // A filtered list of those chains we have details about (genesisHashes)
48
+ export const availableNetworks = allNetworks.filter(filterAvailable).sort(sortNetworks); // A filtered list of those chains we have details about (genesisHashes)
25
49
 
26
- export const selectableNetworks = availableNetworks.filter(n => n.genesisHash.length || n.prefix === 42);
50
+ export const selectableNetworks = availableNetworks.filter(filterSelectable);
package/package.json CHANGED
@@ -17,14 +17,14 @@
17
17
  },
18
18
  "sideEffects": false,
19
19
  "type": "module",
20
- "version": "7.6.2-6",
20
+ "version": "7.7.2-0",
21
21
  "main": "index.js",
22
22
  "dependencies": {
23
23
  "@babel/runtime": "^7.15.4"
24
24
  },
25
25
  "devDependencies": {
26
- "@polkadot/util": "7.6.2-6",
27
- "@polkadot/x-fetch": "7.6.2-6"
26
+ "@polkadot/util": "7.7.2-0",
27
+ "@polkadot/x-fetch": "7.7.2-0"
28
28
  },
29
29
  "exports": {
30
30
  ".": {
package/packageInfo.cjs CHANGED
@@ -9,6 +9,6 @@ exports.packageInfo = void 0;
9
9
  // Auto-generated by @polkadot/dev, do not edit
10
10
  const packageInfo = {
11
11
  name: '@polkadot/networks',
12
- version: '7.6.2-6'
12
+ version: '7.7.2-0'
13
13
  };
14
14
  exports.packageInfo = packageInfo;
package/packageInfo.js CHANGED
@@ -3,5 +3,5 @@
3
3
  // Auto-generated by @polkadot/dev, do not edit
4
4
  export const packageInfo = {
5
5
  name: '@polkadot/networks',
6
- version: '7.6.2-6'
6
+ version: '7.7.2-0'
7
7
  };
package/substrate.cjs CHANGED
@@ -243,13 +243,13 @@ const knownSubstrate = [{
243
243
  symbols: null,
244
244
  website: null
245
245
  }, {
246
- decimals: [18],
247
- displayName: 'Dhiway CORD Network',
246
+ decimals: [12, 12],
247
+ displayName: 'CORD Network',
248
248
  network: 'cord',
249
249
  prefix: 29,
250
250
  standardAccount: '*25519',
251
- symbols: ['DCU'],
252
- website: 'https://dhiway.com/'
251
+ symbols: ['DHI', 'WAY'],
252
+ website: 'https://cord.network/'
253
253
  }, {
254
254
  decimals: [12],
255
255
  displayName: 'Phala Network',
package/substrate.js CHANGED
@@ -237,13 +237,13 @@ export const knownSubstrate = [{
237
237
  symbols: null,
238
238
  website: null
239
239
  }, {
240
- decimals: [18],
241
- displayName: 'Dhiway CORD Network',
240
+ decimals: [12, 12],
241
+ displayName: 'CORD Network',
242
242
  network: 'cord',
243
243
  prefix: 29,
244
244
  standardAccount: '*25519',
245
- symbols: ['DCU'],
246
- website: 'https://dhiway.com/'
245
+ symbols: ['DHI', 'WAY'],
246
+ website: 'https://cord.network/'
247
247
  }, {
248
248
  decimals: [12],
249
249
  displayName: 'Phala Network',