-
Notifications
You must be signed in to change notification settings - Fork 73
/
index.js
71 lines (68 loc) · 2.21 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const kusamaJsons = require.context("./networks/kusama/parachain", false, /\.json$/);
const kusamaParachains = {};
kusamaJsons.keys().forEach((k) => {
const c = kusamaJsons(k);
if (c.data && c.data.ParaID) {
kusamaParachains[c.data.ParaID] = c.data;
try {
const logoPaths = c.data.Logo.split("/");
const imageName = logoPaths[logoPaths.length - 1];
kusamaParachains[
c.data.ParaID
].logo = `https://gcs.subscan.io/projects-info/images/${imageName}`;
} catch {}
}
});
const polkadotJsons = require.context("./networks/polkadot/parachain", false, /\.json$/);
const polkadotParachains = {};
polkadotJsons.keys().forEach((k) => {
const c = polkadotJsons(k);
if (c.data && c.data.ParaID) {
polkadotParachains[c.data.ParaID] = c.data;
try {
const logoPaths = c.data.Logo.split("/");
const imageName = logoPaths[logoPaths.length - 1];
polkadotParachains[
c.data.ParaID
].logo = `https://gcs.subscan.io/projects-info/images/${imageName}`;
} catch {}
}
});
const rococoJsons = require.context("./networks/rococo/parachain", false, /\.json$/);
const rococoParachains = {};
rococoJsons.keys().forEach((k) => {
const c = rococoJsons(k);
if (c.data && c.data.ParaID) {
rococoParachains[c.data.ParaID] = c.data;
try {
const logoPaths = c.data.Logo.split("/");
const imageName = logoPaths[logoPaths.length - 1];
rococoParachains[
c.data.ParaID
].logo = `https://gcs.subscan.io/projects-info/images/${imageName}`;
} catch {}
}
});
const westendJsons = require.context("./networks/westend/parachain", false, /\.json$/);
const westendParachains = {};
westendJsons.keys().forEach((k) => {
const c = westendJsons(k);
if (c.data && c.data.ParaID) {
westendParachains[c.data.ParaID] = c.data;
try {
const logoPaths = c.data.Logo.split("/");
const imageName = logoPaths[logoPaths.length - 1];
westendParachains[
c.data.ParaID
].logo = `https://gcs.subscan.io/projects-info/images/${imageName}`;
} catch {}
}
});
module.exports = {
parachainInfos: {
kusama: kusamaParachains,
polkadot: polkadotParachains,
rococo: rococoParachains,
westend: westendParachains,
}
}