@pezkuwi/networks 14.0.1
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/README.md +5 -0
- package/package.json +28 -0
- package/src/defaults/genesis.ts +210 -0
- package/src/defaults/icons.ts +15 -0
- package/src/defaults/index.ts +7 -0
- package/src/defaults/ledger.ts +61 -0
- package/src/defaults/testnets.ts +16 -0
- package/src/defaults.spec.ts +59 -0
- package/src/index.spec.ts +120 -0
- package/src/index.ts +9 -0
- package/src/interfaces.ts +72 -0
- package/src/mod.ts +4 -0
- package/src/packageDetect.ts +11 -0
- package/src/packageInfo.ts +6 -0
- package/src/ss58registry.spec.ts +34 -0
- package/src/types.ts +43 -0
- package/test/ss58registry.json +1905 -0
- package/tsconfig.build.json +17 -0
- package/tsconfig.spec.json +18 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Jaco Greeff <jacogr@gmail.com>",
|
|
3
|
+
"bugs": "https://github.com/pezkuwichain/pezkuwi-common/issues",
|
|
4
|
+
"description": "A list of all available Substrate networks and their applicable prefixes",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=18"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/pezkuwichain/pezkuwi-common/tree/master/packages/networks#readme",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"name": "@pezkuwi/networks",
|
|
11
|
+
"repository": {
|
|
12
|
+
"directory": "packages/networks",
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/pezkuwichain/pezkuwi-common.git"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"type": "module",
|
|
18
|
+
"version": "14.0.1",
|
|
19
|
+
"main": "index.js",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@pezkuwi/util": "14.0.1",
|
|
22
|
+
"@substrate/ss58-registry": "^1.51.0",
|
|
23
|
+
"tslib": "^2.8.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@pezkuwi/hw-ledger": "14.0.1"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { KnownGenesis } from '../types.js';
|
|
5
|
+
|
|
6
|
+
// In the case where the network was hard-spooned and multiple genesisHashes
|
|
7
|
+
// are provided, it needs to be in reverse order, i.e. most-recent goes first,
|
|
8
|
+
// oldest goes last. This make lookups for the current a simple genesisHash[0]
|
|
9
|
+
// where the latest ios always the first entry (See Kusama as an example)
|
|
10
|
+
//
|
|
11
|
+
// IMPORTANT: Apart from the test relays, this list is limited to live parachains
|
|
12
|
+
// and live production networks. It does not and should not contain any testnets,
|
|
13
|
+
// either stand-alone or connected to test relays such as Westend/Rococo
|
|
14
|
+
export const knownGenesis: KnownGenesis = {
|
|
15
|
+
acala: [
|
|
16
|
+
'0xfc41b9bd8ef8fe53d58c7ea67c794c7ec9a73daf05e6d54b14ff6342c99ba64c'
|
|
17
|
+
],
|
|
18
|
+
ajuna: [
|
|
19
|
+
'0xe358eb1d11b31255a286c12e44fe6780b7edb171d657905a97e39f71d9c6c3ee'
|
|
20
|
+
],
|
|
21
|
+
'aleph-node': [
|
|
22
|
+
'0x70255b4d28de0fc4e1a193d7e175ad1ccef431598211c55538f1018651a0344e'
|
|
23
|
+
],
|
|
24
|
+
astar: [
|
|
25
|
+
'0x9eb76c5184c4ab8679d2d5d819fdf90b9c001403e9e17da2e14b6d8aec4029c6'
|
|
26
|
+
],
|
|
27
|
+
basilisk: [
|
|
28
|
+
'0xa85cfb9b9fd4d622a5b28289a02347af987d8f73fa3108450e2b4a11c1ce5755'
|
|
29
|
+
],
|
|
30
|
+
bifrost: [
|
|
31
|
+
'0x262e1b2ad728475fd6fe88e62d34c200abe6fd693931ddad144059b1eb884e5b'
|
|
32
|
+
],
|
|
33
|
+
'bifrost-kusama': [
|
|
34
|
+
'0x9f28c6a68e0fc9646eff64935684f6eeeece527e37bbe1f213d22caa1d9d6bed'
|
|
35
|
+
],
|
|
36
|
+
bittensor: [
|
|
37
|
+
'0x2f0555cc76fc2840a25a6ea3b9637146806f1f44b090c175ffde2a7e5ab36c03'
|
|
38
|
+
],
|
|
39
|
+
centrifuge: [
|
|
40
|
+
'0xb3db41421702df9a7fcac62b53ffeac85f7853cc4e689e0b93aeb3db18c09d82',
|
|
41
|
+
'0x67dddf2673b69e5f875f6f25277495834398eafd67f492e09f3f3345e003d1b5'
|
|
42
|
+
],
|
|
43
|
+
cere: [
|
|
44
|
+
'0x81443836a9a24caaa23f1241897d1235717535711d1d3fe24eae4fdc942c092c'
|
|
45
|
+
],
|
|
46
|
+
composable: [
|
|
47
|
+
'0xdaab8df776eb52ec604a5df5d388bb62a050a0aaec4556a64265b9d42755552d'
|
|
48
|
+
],
|
|
49
|
+
creditcoin3: [
|
|
50
|
+
'0x4436a7d64e363df85e065a894721002a86643283f9707338bf195d360ba2ee71', // cc3 mainnet
|
|
51
|
+
'0xfc4ec97a1c1f119c4353aecb4a17c7c0cf7b40d5d660143d8bad9117e9866572', // cc3 testnet/drynet
|
|
52
|
+
'0xfc9df99a665f964aed6649f275055e54df5e3420489538ed31d7788f53d11ef6' // cc3 devnet
|
|
53
|
+
],
|
|
54
|
+
darwinia: [
|
|
55
|
+
'0xe71578b37a7c799b0ab4ee87ffa6f059a6b98f71f06fb8c84a8d88013a548ad6'
|
|
56
|
+
],
|
|
57
|
+
dentnet: [
|
|
58
|
+
'0x0313f6a011d128d22f996703cbab05162e2fdc9e031493314fe6db79979c5ca7'
|
|
59
|
+
],
|
|
60
|
+
'dock-mainnet': [
|
|
61
|
+
'0x6bfe24dca2a3be10f22212678ac13a6446ec764103c0f3471c71609eac384aae',
|
|
62
|
+
'0xf73467c6544aa68df2ee546b135f955c46b90fa627e9b5d7935f41061bb8a5a9'
|
|
63
|
+
],
|
|
64
|
+
edgeware: [
|
|
65
|
+
'0x742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b'
|
|
66
|
+
],
|
|
67
|
+
encointer: [
|
|
68
|
+
'0x7dd99936c1e9e6d1ce7d90eb6f33bea8393b4bf87677d675aa63c9cb3e8c5b5b'
|
|
69
|
+
],
|
|
70
|
+
enjin: [
|
|
71
|
+
'0xd8761d3c88f26dc12875c00d3165f7d67243d56fc85b4cf19937601a7916e5a9'
|
|
72
|
+
],
|
|
73
|
+
equilibrium: [
|
|
74
|
+
'0x6f1a800de3daff7f5e037ddf66ab22ce03ab91874debeddb1086f5f7dbd48925'
|
|
75
|
+
],
|
|
76
|
+
frequency: [
|
|
77
|
+
'0x4a587bf17a404e3572747add7aab7bbe56e805a5479c6c436f07f36fcc8d3ae1'
|
|
78
|
+
],
|
|
79
|
+
genshiro: [
|
|
80
|
+
'0x9b8cefc0eb5c568b527998bdd76c184e2b76ae561be76e4667072230217ea243'
|
|
81
|
+
],
|
|
82
|
+
hydradx: [
|
|
83
|
+
'0xafdc188f45c71dacbaa0b62e16a91f726c7b8699a9748cdf715459de6b7f366d', // Hydration | HydraDX Parachain
|
|
84
|
+
'0xd2a620c27ec5cbc5621ff9a522689895074f7cca0d08e7134a7804e1a3ba86fc', // Snakenet Gen3-1
|
|
85
|
+
'0x10af6e84234477d84dc572bac0789813b254aa490767ed06fb9591191d1073f9', // Snakenet Gen3
|
|
86
|
+
'0x3d75507dd46301767e601265791da1d9cb47b6ebc94e87347b635e5bf58bd047', // Snakenet Gen2
|
|
87
|
+
'0x0ed32bfcab4a83517fac88f2aa7cbc2f88d3ab93be9a12b6188a036bf8a943c2' // Snakenet Gen1
|
|
88
|
+
],
|
|
89
|
+
integritee: [
|
|
90
|
+
'0xcdedc8eadbfa209d3f207bba541e57c3c58a667b05a2e1d1e86353c9000758da', // on Kusama
|
|
91
|
+
'0xe13e7af377c64e83f95e0d70d5e5c3c01d697a84538776c5b9bbe0e7d7b6034c' // on Polkadot
|
|
92
|
+
],
|
|
93
|
+
'interlay-parachain': [
|
|
94
|
+
'0xbf88efe70e9e0e916416e8bed61f2b45717f517d7f3523e33c7b001e5ffcbc72'
|
|
95
|
+
],
|
|
96
|
+
karura: [
|
|
97
|
+
'0xbaf5aabe40646d11f0ee8abbdc64f4a4b7674925cba08e4a05ff9ebed6e2126b'
|
|
98
|
+
],
|
|
99
|
+
khala: [
|
|
100
|
+
'0xd43540ba6d3eb4897c28a77d48cb5b729fea37603cbbfc7a86a73b72adb3be8d'
|
|
101
|
+
],
|
|
102
|
+
kulupu: [
|
|
103
|
+
'0xf7a99d3cb92853d00d5275c971c132c074636256583fee53b3bbe60d7b8769ba'
|
|
104
|
+
],
|
|
105
|
+
kusama: [
|
|
106
|
+
'0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe', // Kusama CC3,
|
|
107
|
+
'0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636', // Kusama CC2
|
|
108
|
+
'0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf' // Kusama CC1
|
|
109
|
+
],
|
|
110
|
+
liberland: [
|
|
111
|
+
'0x6bd89e052d67a45bb60a9a23e8581053d5e0d619f15cb9865946937e690c42d6'
|
|
112
|
+
],
|
|
113
|
+
matrixchain: [
|
|
114
|
+
'0x3af4ff48ec76d2efc8476730f423ac07e25ad48f5f4c9dc39c778b164d808615'
|
|
115
|
+
],
|
|
116
|
+
mythos: [
|
|
117
|
+
'0xf6ee56e9c5277df5b4ce6ae9983ee88f3cbed27d31beeb98f9f84f997a1ab0b9'
|
|
118
|
+
],
|
|
119
|
+
nodle: [
|
|
120
|
+
'0x97da7ede98d7bad4e36b4d734b6055425a3be036da2a332ea5a7037656427a21'
|
|
121
|
+
],
|
|
122
|
+
origintrail: [
|
|
123
|
+
'0xe7e0962324a3b86c83404dbea483f25fb5dab4c224791c81b756cfc948006174'
|
|
124
|
+
],
|
|
125
|
+
p3d: [
|
|
126
|
+
'0x6c5894837ad89b6d92b114a2fb3eafa8fe3d26a54848e3447015442cd6ef4e66'
|
|
127
|
+
],
|
|
128
|
+
parallel: [
|
|
129
|
+
'0xe61a41c53f5dcd0beb09df93b34402aada44cb05117b71059cce40a2723a4e97'
|
|
130
|
+
],
|
|
131
|
+
peaq: [
|
|
132
|
+
'0xd2a5d385932d1f650dae03ef8e2748983779ee342c614f80854d32b8cd8fa48c'
|
|
133
|
+
],
|
|
134
|
+
pendulum: [
|
|
135
|
+
'0x5d3c298622d5634ed019bf61ea4b71655030015bde9beb0d6a24743714462c86'
|
|
136
|
+
],
|
|
137
|
+
phala: [
|
|
138
|
+
'0x1bb969d85965e4bb5a651abbedf21a54b6b31a21f66b5401cc3f1e286268d736'
|
|
139
|
+
],
|
|
140
|
+
picasso: [
|
|
141
|
+
'0x6811a339673c9daa897944dcdac99c6e2939cc88245ed21951a0a3c9a2be75bc',
|
|
142
|
+
'0xe8e7f0f4c4f5a00720b4821dbfddefea7490bcf0b19009961cc46957984e2c1c'
|
|
143
|
+
],
|
|
144
|
+
polimec: [
|
|
145
|
+
'0x7eb9354488318e7549c722669dcbdcdc526f1fef1420e7944667212f3601fdbd'
|
|
146
|
+
],
|
|
147
|
+
polkadex: [
|
|
148
|
+
'0x3920bcb4960a1eef5580cd5367ff3f430eef052774f78468852f7b9cb39f8a3c'
|
|
149
|
+
],
|
|
150
|
+
polkadot: [
|
|
151
|
+
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3'
|
|
152
|
+
],
|
|
153
|
+
polymesh: [
|
|
154
|
+
'0x6fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063'
|
|
155
|
+
],
|
|
156
|
+
quartz: [
|
|
157
|
+
'0xcd4d732201ebe5d6b014edda071c4203e16867305332301dc8d092044b28e554'
|
|
158
|
+
],
|
|
159
|
+
rococo: [
|
|
160
|
+
'0x6408de7737c59c238890533af25896a2c20608d8b380bb01029acb392781063e',
|
|
161
|
+
'0xaaf2cd1b74b5f726895921259421b534124726263982522174147046b8827897',
|
|
162
|
+
'0x037f5f3c8e67b314062025fc886fcd6238ea25a4a9b45dce8d246815c9ebe770',
|
|
163
|
+
'0xc196f81260cf1686172b47a79cf002120735d7cb0eb1474e8adce56618456fff',
|
|
164
|
+
'0xf6e9983c37baf68846fedafe21e56718790e39fb1c582abc408b81bc7b208f9a',
|
|
165
|
+
'0x5fce687da39305dfe682b117f0820b319348e8bb37eb16cf34acbf6a202de9d9',
|
|
166
|
+
'0xe7c3d5edde7db964317cd9b51a3a059d7cd99f81bdbce14990047354334c9779',
|
|
167
|
+
'0x1611e1dbf0405379b861e2e27daa90f480b2e6d3682414a80835a52e8cb8a215',
|
|
168
|
+
'0x343442f12fa715489a8714e79a7b264ea88c0d5b8c66b684a7788a516032f6b9',
|
|
169
|
+
'0x78bcd530c6b3a068bc17473cf5d2aff9c287102bed9af3ae3c41c33b9d6c6147',
|
|
170
|
+
'0x47381ee0697153d64404fc578392c8fd5cba9073391908f46c888498415647bd',
|
|
171
|
+
'0x19c0e4fa8ab75f5ac7865e0b8f74ff91eb9a100d336f423cd013a8befba40299'
|
|
172
|
+
],
|
|
173
|
+
sora: [
|
|
174
|
+
'0x7e4e32d0feafd4f9c9414b0be86373f9a1efa904809b683453a9af6856d38ad5'
|
|
175
|
+
],
|
|
176
|
+
stafi: [
|
|
177
|
+
'0x290a4149f09ea0e402c74c1c7e96ae4239588577fe78932f94f5404c68243d80'
|
|
178
|
+
],
|
|
179
|
+
statemine: [
|
|
180
|
+
'0x48239ef607d7928874027a43a67689209727dfb3d3dc5e5b03a39bdc2eda771a'
|
|
181
|
+
],
|
|
182
|
+
statemint: [
|
|
183
|
+
'0x68d56f15f85d3136970ec16946040bc1752654e906147f7e43e9d539d7c3de2f'
|
|
184
|
+
],
|
|
185
|
+
subsocial: [
|
|
186
|
+
'0x0bd72c1c305172e1275278aaeb3f161e02eccb7a819e63f62d47bd53a28189f8'
|
|
187
|
+
],
|
|
188
|
+
ternoa: [
|
|
189
|
+
'0x6859c81ca95ef624c9dfe4dc6e3381c33e5d6509e35e147092bfbc780f777c4e'
|
|
190
|
+
],
|
|
191
|
+
unique: [
|
|
192
|
+
'0x84322d9cddbf35088f1e54e9a85c967a41a56a4f43445768125e61af166c7d31'
|
|
193
|
+
],
|
|
194
|
+
vara: [
|
|
195
|
+
'0xfe1b4c55fd4d668101126434206571a7838a8b6b93a6d1b95d607e78e6c53763'
|
|
196
|
+
],
|
|
197
|
+
vtb: [
|
|
198
|
+
'0x286bc8414c7000ce1d6ee6a834e29a54c1784814b76243eb77ed0b2c5573c60f',
|
|
199
|
+
'0x7483b89572fb2bd687c7b9a93b242d0b237f9aba463aba07ec24503931038aaa'
|
|
200
|
+
],
|
|
201
|
+
westend: [
|
|
202
|
+
'0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e'
|
|
203
|
+
],
|
|
204
|
+
xxnetwork: [
|
|
205
|
+
'0x50dd5d206917bf10502c68fb4d18a59fc8aa31586f4e8856b493e43544aa82aa'
|
|
206
|
+
],
|
|
207
|
+
zeitgeist: [
|
|
208
|
+
'0x1bf2a2ecb4a868de66ea8610f2ce7c8c43706561b6476031315f6640fe38e060'
|
|
209
|
+
]
|
|
210
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { KnownIcon } from '../types.js';
|
|
5
|
+
|
|
6
|
+
// these are icon overrides
|
|
7
|
+
export const knownIcon: KnownIcon = {
|
|
8
|
+
centrifuge: 'polkadot',
|
|
9
|
+
kusama: 'polkadot',
|
|
10
|
+
polkadot: 'polkadot',
|
|
11
|
+
sora: 'polkadot',
|
|
12
|
+
statemine: 'polkadot',
|
|
13
|
+
statemint: 'polkadot',
|
|
14
|
+
westmint: 'polkadot'
|
|
15
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export { knownGenesis } from './genesis.js';
|
|
5
|
+
export { knownIcon } from './icons.js';
|
|
6
|
+
export { knownLedger } from './ledger.js';
|
|
7
|
+
export { knownTestnet } from './testnets.js';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { KnownLedger } from '../types.js';
|
|
5
|
+
|
|
6
|
+
// These match up with the keys of the ledgerApps object in the @polkadot/hw-ledger/defaults.ts
|
|
7
|
+
// and maps to the known slip44 (minus the `0x8` hard derivation flag)
|
|
8
|
+
//
|
|
9
|
+
// NOTE: Any network here needs to have a genesisHash attached in the ./genesis.ts config
|
|
10
|
+
export const knownLedger: KnownLedger = {
|
|
11
|
+
acala: 0x00000313,
|
|
12
|
+
ajuna: 0x00000162,
|
|
13
|
+
'aleph-node': 0x00000283,
|
|
14
|
+
astar: 0x0000032a,
|
|
15
|
+
bifrost: 0x00000314,
|
|
16
|
+
'bifrost-kusama': 0x00000314,
|
|
17
|
+
bittensor: 0x00000162,
|
|
18
|
+
centrifuge: 0x000002eb,
|
|
19
|
+
composable: 0x00000162,
|
|
20
|
+
creditcoin3: 0x00000162,
|
|
21
|
+
darwinia: 0x00000162,
|
|
22
|
+
dentnet: 0x000002de,
|
|
23
|
+
'dock-mainnet': 0x00000252,
|
|
24
|
+
edgeware: 0x0000020b,
|
|
25
|
+
encointer: 0x000001b2,
|
|
26
|
+
enjin: 0x00000483,
|
|
27
|
+
equilibrium: 0x05f5e0fd,
|
|
28
|
+
frequency: 0x0000082b,
|
|
29
|
+
genshiro: 0x05f5e0fc,
|
|
30
|
+
hydradx: 0x00000162,
|
|
31
|
+
integritee: 0x000007df,
|
|
32
|
+
'interlay-parachain': 0x00000162,
|
|
33
|
+
karura: 0x000002ae,
|
|
34
|
+
khala: 0x000001b2,
|
|
35
|
+
kusama: 0x000001b2,
|
|
36
|
+
liberland: 0x000002ff,
|
|
37
|
+
matrixchain: 0x00000483,
|
|
38
|
+
mythos: 0x0000003c,
|
|
39
|
+
nodle: 0x000003eb,
|
|
40
|
+
origintrail: 0x00000162,
|
|
41
|
+
parallel: 0x00000162,
|
|
42
|
+
peaq: 0x00000d0a,
|
|
43
|
+
pendulum: 0x00000162,
|
|
44
|
+
phala: 0x00000162,
|
|
45
|
+
picasso: 0x000001b2,
|
|
46
|
+
polimec: 0x00000d10,
|
|
47
|
+
polkadex: 0x0000031f,
|
|
48
|
+
polkadot: 0x00000162,
|
|
49
|
+
polymesh: 0x00000253,
|
|
50
|
+
quartz: 0x00000277,
|
|
51
|
+
sora: 0x00000269,
|
|
52
|
+
stafi: 0x0000038b,
|
|
53
|
+
statemine: 0x000001b2, // common-good on Kusama, shares derivation
|
|
54
|
+
statemint: 0x00000162, // common-good on Polkadot, shares derivation
|
|
55
|
+
ternoa: 0x00003e3,
|
|
56
|
+
unique: 0x00000295,
|
|
57
|
+
vara: 0x00001370,
|
|
58
|
+
vtb: 0x000002b6,
|
|
59
|
+
xxnetwork: 0x000007a3,
|
|
60
|
+
zeitgeist: 0x00000162
|
|
61
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { KnownTestnet } from '../types.js';
|
|
5
|
+
|
|
6
|
+
// testnets should not allow selection
|
|
7
|
+
export const knownTestnet: KnownTestnet = {
|
|
8
|
+
'': true, // this is the default non-network entry
|
|
9
|
+
'cess-testnet': true,
|
|
10
|
+
'dock-testnet': true,
|
|
11
|
+
jupiter: true,
|
|
12
|
+
'mathchain-testnet': true,
|
|
13
|
+
p3dt: true,
|
|
14
|
+
subspace_testnet: true,
|
|
15
|
+
'zero-alphaville': true
|
|
16
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/// <reference types="@polkadot/dev-test/globals.d.ts" />
|
|
5
|
+
|
|
6
|
+
import { ledgerApps } from '@pezkuwi/hw-ledger/defaults';
|
|
7
|
+
import { isHex } from '@pezkuwi/util';
|
|
8
|
+
|
|
9
|
+
import { knownGenesis, knownLedger, knownTestnet } from './defaults/index.js';
|
|
10
|
+
|
|
11
|
+
describe('defaults', (): void => {
|
|
12
|
+
const genesisKeys = Object.keys(knownGenesis);
|
|
13
|
+
const ledgerKeys = Object.keys(knownLedger);
|
|
14
|
+
|
|
15
|
+
describe('genesis', (): void => {
|
|
16
|
+
it('has hex values for all genesis chains', (): void => {
|
|
17
|
+
expect(
|
|
18
|
+
genesisKeys.filter((network) =>
|
|
19
|
+
!knownGenesis[network].length ||
|
|
20
|
+
knownGenesis[network].some((g) => !isHex(g, 256))
|
|
21
|
+
)
|
|
22
|
+
).toEqual([]);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('has no entries for testnets', (): void => {
|
|
26
|
+
expect(
|
|
27
|
+
genesisKeys.filter((network) =>
|
|
28
|
+
knownTestnet[network]
|
|
29
|
+
)
|
|
30
|
+
).toEqual([]);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('has genesis for all Ledger chains', (): void => {
|
|
34
|
+
expect(
|
|
35
|
+
ledgerKeys.filter((network) =>
|
|
36
|
+
!knownGenesis[network]
|
|
37
|
+
)
|
|
38
|
+
).toEqual([]);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('Ledger', (): void => {
|
|
43
|
+
it('has entries for each of the apps (hwledger -> networks)', (): void => {
|
|
44
|
+
expect(
|
|
45
|
+
ledgerKeys.filter((network) =>
|
|
46
|
+
!ledgerApps[network]
|
|
47
|
+
)
|
|
48
|
+
).toEqual([]);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('has entries for each of the apps (networks -> hwledger)', (): void => {
|
|
52
|
+
expect(
|
|
53
|
+
Object.keys(ledgerApps).filter((network) =>
|
|
54
|
+
!knownLedger[network]
|
|
55
|
+
)
|
|
56
|
+
).toEqual([]);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/// <reference types="@polkadot/dev-test/globals.d.ts" />
|
|
5
|
+
|
|
6
|
+
import type { SubstrateNetwork } from './types.js';
|
|
7
|
+
|
|
8
|
+
import { knownGenesis, knownIcon, knownLedger, knownTestnet } from './defaults/index.js';
|
|
9
|
+
import { allNetworks, availableNetworks, selectableNetworks } from './index.js';
|
|
10
|
+
|
|
11
|
+
describe('availableNetworks', (): void => {
|
|
12
|
+
it('has the correct starting order', (): void => {
|
|
13
|
+
expect(availableNetworks.slice(0, 3).map(({ prefix }) => prefix)).toEqual([0, 2, 42]);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('has a sorted list (first external, last external)', (): void => {
|
|
17
|
+
expect(availableNetworks[3].displayName).toEqual('3DP network');
|
|
18
|
+
expect(availableNetworks[availableNetworks.length - 1].displayName).toEqual('ZERO');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('has no ignored networks', (): void => {
|
|
22
|
+
expect(availableNetworks.some(({ isIgnored }) => isIgnored)).toEqual(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('has no reserved networks', (): void => {
|
|
26
|
+
expect(availableNetworks.some(({ prefix }) => prefix === 47)).toEqual(false);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('has allNetworks genesis information', (): void => {
|
|
30
|
+
expect(
|
|
31
|
+
Object.entries(knownGenesis).filter(([network, genesisHash]) =>
|
|
32
|
+
availableNetworks.some((a) =>
|
|
33
|
+
a.network === network &&
|
|
34
|
+
genesisHash.some((g, index) => a.genesisHash[index] !== g)
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
).toEqual([]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('has allNetworks ledger details', (): void => {
|
|
41
|
+
expect(
|
|
42
|
+
Object.entries(knownLedger).filter(([network, slip44]) =>
|
|
43
|
+
availableNetworks.some((a) =>
|
|
44
|
+
a.network === network && (
|
|
45
|
+
a.slip44 !== slip44 ||
|
|
46
|
+
!a.hasLedgerSupport ||
|
|
47
|
+
!a.genesisHash.length
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
).toEqual([]);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('has no testnets exposed', (): void => {
|
|
55
|
+
expect(
|
|
56
|
+
Object.keys(knownTestnet).filter((network) =>
|
|
57
|
+
availableNetworks.some((a) =>
|
|
58
|
+
a.network === network
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
).toEqual([]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('has allNetworks icons, except for overrides', (): void => {
|
|
65
|
+
expect(
|
|
66
|
+
availableNetworks.filter(({ icon, network }) =>
|
|
67
|
+
icon !== 'substrate' &&
|
|
68
|
+
knownIcon[network] !== icon
|
|
69
|
+
)
|
|
70
|
+
).toEqual([]);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('has all the correct fields', (): void => {
|
|
74
|
+
expect(availableNetworks[0]).toEqual({
|
|
75
|
+
decimals: [10],
|
|
76
|
+
displayName: 'Polkadot Relay Chain',
|
|
77
|
+
genesisHash: [
|
|
78
|
+
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3'
|
|
79
|
+
],
|
|
80
|
+
hasLedgerSupport: true,
|
|
81
|
+
icon: 'polkadot',
|
|
82
|
+
isIgnored: false,
|
|
83
|
+
isTestnet: false,
|
|
84
|
+
network: 'polkadot',
|
|
85
|
+
prefix: 0,
|
|
86
|
+
slip44: 354,
|
|
87
|
+
standardAccount: '*25519',
|
|
88
|
+
symbols: ['DOT'],
|
|
89
|
+
website: 'https://polkadot.network'
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('allNetworks', (): void => {
|
|
95
|
+
it('has no ss58 duplicates', (): void => {
|
|
96
|
+
const dupes: SubstrateNetwork[] = [];
|
|
97
|
+
const uniques: SubstrateNetwork[] = [];
|
|
98
|
+
|
|
99
|
+
allNetworks.forEach((a): void => {
|
|
100
|
+
if (uniques.some((u) => u.prefix === a.prefix)) {
|
|
101
|
+
dupes.push(a);
|
|
102
|
+
} else {
|
|
103
|
+
uniques.push(a);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
expect(dupes).toEqual([]);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('selectableNetworks', (): void => {
|
|
112
|
+
it('has the correct starting order', (): void => {
|
|
113
|
+
expect(selectableNetworks.slice(0, 3).map(({ prefix }) => prefix)).toEqual([0, 2, 42]);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('has a sorted list (first external, last external)', (): void => {
|
|
117
|
+
expect(selectableNetworks[3].displayName).toEqual('3DP network');
|
|
118
|
+
expect(selectableNetworks[selectableNetworks.length - 1].displayName).toEqual('Zeitgeist');
|
|
119
|
+
});
|
|
120
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// TODO: This was removed, really cannot recall the reason...
|
|
5
|
+
// ... put it back, but keep it removed
|
|
6
|
+
// import './packageDetect.js';
|
|
7
|
+
|
|
8
|
+
export * from './interfaces.js';
|
|
9
|
+
export { packageInfo } from './packageInfo.js';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { KnownSubstrate, Network, SubstrateNetwork } from './types.js';
|
|
5
|
+
|
|
6
|
+
import knownSubstrate from '@substrate/ss58-registry';
|
|
7
|
+
|
|
8
|
+
import { knownGenesis, knownIcon, knownLedger, knownTestnet } from './defaults/index.js';
|
|
9
|
+
|
|
10
|
+
// These are known prefixes that are not sorted
|
|
11
|
+
const UNSORTED = [0, 2, 42];
|
|
12
|
+
const TESTNETS = ['testnet'];
|
|
13
|
+
|
|
14
|
+
function toExpanded (o: KnownSubstrate): SubstrateNetwork {
|
|
15
|
+
const network = o.network || '';
|
|
16
|
+
const nameParts = network.replace(/_/g, '-').split('-');
|
|
17
|
+
const n = o as SubstrateNetwork;
|
|
18
|
+
|
|
19
|
+
// ledger additions
|
|
20
|
+
n.slip44 = knownLedger[network];
|
|
21
|
+
n.hasLedgerSupport = !!n.slip44;
|
|
22
|
+
|
|
23
|
+
// general items
|
|
24
|
+
n.genesisHash = knownGenesis[network] || [];
|
|
25
|
+
n.icon = knownIcon[network] || 'substrate';
|
|
26
|
+
|
|
27
|
+
// filtering
|
|
28
|
+
n.isTestnet = !!knownTestnet[network] || TESTNETS.includes(nameParts[nameParts.length - 1]);
|
|
29
|
+
n.isIgnored = n.isTestnet || (
|
|
30
|
+
!(
|
|
31
|
+
o.standardAccount &&
|
|
32
|
+
o.decimals?.length &&
|
|
33
|
+
o.symbols?.length
|
|
34
|
+
) &&
|
|
35
|
+
o.prefix !== 42
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function filterSelectable ({ genesisHash, prefix }: Network): boolean {
|
|
42
|
+
return !!genesisHash.length || prefix === 42;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function filterAvailable (n: SubstrateNetwork): n is Network {
|
|
46
|
+
return !n.isIgnored && !!n.network;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function sortNetworks (a: Network, b: Network): number {
|
|
50
|
+
const isUnSortedA = UNSORTED.includes(a.prefix);
|
|
51
|
+
const isUnSortedB = UNSORTED.includes(b.prefix);
|
|
52
|
+
|
|
53
|
+
return isUnSortedA === isUnSortedB
|
|
54
|
+
? isUnSortedA
|
|
55
|
+
? 0
|
|
56
|
+
: a.displayName.localeCompare(b.displayName)
|
|
57
|
+
: isUnSortedA
|
|
58
|
+
? -1
|
|
59
|
+
: 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// This is all the Substrate networks with our additional information
|
|
63
|
+
export const allNetworks = knownSubstrate.map(toExpanded);
|
|
64
|
+
|
|
65
|
+
// The list of available/claimed prefixes
|
|
66
|
+
// - no testnets
|
|
67
|
+
// - we only include those where we have a standardAccount
|
|
68
|
+
// - sort by name, however we keep 0, 2, 42 first in the list
|
|
69
|
+
export const availableNetworks = allNetworks.filter(filterAvailable).sort(sortNetworks);
|
|
70
|
+
|
|
71
|
+
// A filtered list of those chains we have details about (genesisHashes)
|
|
72
|
+
export const selectableNetworks = availableNetworks.filter(filterSelectable);
|
package/src/mod.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// Do not edit, auto-generated by @polkadot/dev
|
|
5
|
+
// (packageInfo imports will be kept as-is, user-editable)
|
|
6
|
+
|
|
7
|
+
import { detectPackage } from '@pezkuwi/util';
|
|
8
|
+
|
|
9
|
+
import { packageInfo } from './packageInfo.js';
|
|
10
|
+
|
|
11
|
+
detectPackage(packageInfo, null, []);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/networks authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/// <reference types="@polkadot/dev-test/globals.d.ts" />
|
|
5
|
+
|
|
6
|
+
import known from '@substrate/ss58-registry';
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
|
|
9
|
+
import { stringify } from '@pezkuwi/util';
|
|
10
|
+
|
|
11
|
+
describe('@substrate/ss58-registry', (): void => {
|
|
12
|
+
it('has known values', (): void => {
|
|
13
|
+
const testUrl = new URL('../test/ss58registry.json', import.meta.url);
|
|
14
|
+
const json = stringify(known, 2);
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
expect(
|
|
18
|
+
JSON.parse(json)
|
|
19
|
+
).toEqual(
|
|
20
|
+
JSON.parse(
|
|
21
|
+
fs.readFileSync(testUrl, 'utf-8')
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (process.env['GITHUB_REPOSITORY']) {
|
|
26
|
+
console.error(json);
|
|
27
|
+
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fs.writeFileSync(testUrl, json, { flag: 'w' });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|