@polkadot/networks 7.6.2-8 → 7.7.2-2
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 +31 -7
- package/interfaces.js +31 -7
- package/package.json +4 -4
- package/packageInfo.cjs +1 -1
- package/packageInfo.js +1 -1
- package/substrate.cjs +4 -4
- package/substrate.js +4 -4
package/interfaces.cjs
CHANGED
|
@@ -15,26 +15,50 @@ var _substrate = require("./substrate.cjs");
|
|
|
15
15
|
const UNSORTED = [0, 2, 42];
|
|
16
16
|
const TESTNETS = ['testnet'];
|
|
17
17
|
|
|
18
|
-
|
|
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
|
-
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function filterSelectable(_ref) {
|
|
35
|
+
let {
|
|
36
|
+
genesisHash,
|
|
37
|
+
prefix
|
|
38
|
+
} = _ref;
|
|
39
|
+
return !!genesisHash.length || prefix === 42;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function filterAvailable(n) {
|
|
43
|
+
return !n.isIgnored && !!n.network;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function sortNetworks(a, b) {
|
|
47
|
+
const isUnSortedA = UNSORTED.includes(a.prefix);
|
|
48
|
+
const isUnSortedB = UNSORTED.includes(b.prefix);
|
|
49
|
+
return isUnSortedA === isUnSortedB ? 0 : isUnSortedA ? -1 : isUnSortedB ? 1 : a.displayName.localeCompare(b.displayName);
|
|
50
|
+
} // This is all the Substrate networks with our additional information
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
const allNetworks = _substrate.knownSubstrate.map(toExpanded); // The list of available/claimed prefixes
|
|
30
54
|
// - no testnets
|
|
31
55
|
// - we only include those where we have a standardAccount
|
|
32
56
|
// - sort by name, however we keep 0, 2, 42 first in the list
|
|
33
57
|
|
|
34
58
|
|
|
35
59
|
exports.allNetworks = allNetworks;
|
|
36
|
-
const availableNetworks = allNetworks.filter(
|
|
60
|
+
const availableNetworks = allNetworks.filter(filterAvailable).sort(sortNetworks); // A filtered list of those chains we have details about (genesisHashes)
|
|
37
61
|
|
|
38
62
|
exports.availableNetworks = availableNetworks;
|
|
39
|
-
const selectableNetworks = availableNetworks.filter(
|
|
63
|
+
const selectableNetworks = availableNetworks.filter(filterSelectable);
|
|
40
64
|
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
|
-
|
|
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
|
-
}
|
|
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(
|
|
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(
|
|
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.
|
|
20
|
+
"version": "7.7.2-2",
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/runtime": "^7.
|
|
23
|
+
"@babel/runtime": "^7.16.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@polkadot/util": "7.
|
|
27
|
-
"@polkadot/x-fetch": "7.
|
|
26
|
+
"@polkadot/util": "7.7.2-2",
|
|
27
|
+
"@polkadot/x-fetch": "7.7.2-2"
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
package/packageInfo.cjs
CHANGED
package/packageInfo.js
CHANGED
package/substrate.cjs
CHANGED
|
@@ -243,13 +243,13 @@ const knownSubstrate = [{
|
|
|
243
243
|
symbols: null,
|
|
244
244
|
website: null
|
|
245
245
|
}, {
|
|
246
|
-
decimals: [
|
|
247
|
-
displayName: '
|
|
246
|
+
decimals: [12, 12],
|
|
247
|
+
displayName: 'CORD Network',
|
|
248
248
|
network: 'cord',
|
|
249
249
|
prefix: 29,
|
|
250
250
|
standardAccount: '*25519',
|
|
251
|
-
symbols: ['
|
|
252
|
-
website: 'https://
|
|
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: [
|
|
241
|
-
displayName: '
|
|
240
|
+
decimals: [12, 12],
|
|
241
|
+
displayName: 'CORD Network',
|
|
242
242
|
network: 'cord',
|
|
243
243
|
prefix: 29,
|
|
244
244
|
standardAccount: '*25519',
|
|
245
|
-
symbols: ['
|
|
246
|
-
website: 'https://
|
|
245
|
+
symbols: ['DHI', 'WAY'],
|
|
246
|
+
website: 'https://cord.network/'
|
|
247
247
|
}, {
|
|
248
248
|
decimals: [12],
|
|
249
249
|
displayName: 'Phala Network',
|