forked from polkadot-js/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathderives.ts
More file actions
43 lines (36 loc) · 1.44 KB
/
derives.ts
File metadata and controls
43 lines (36 loc) · 1.44 KB
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
// Copyright 2017-2026 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { OverrideBundleDefinition, OverrideBundleType } from '@polkadot/types/types';
import equilibrium from './spec/equilibrium.js';
import genshiro from './spec/genshiro.js';
import hyperbridge from './spec/hyperbridge.js';
import interbtc from './spec/interbtc.js';
import mangata from './spec/mangata.js';
import subspace from './spec/subspace.js';
const mapping: [OverrideBundleDefinition, string[]][] = [
[equilibrium, ['Equilibrium', 'Equilibrium-parachain']],
[genshiro, ['Genshiro', 'Gens-parachain']],
[interbtc, ['interbtc-parachain', 'interbtc-standalone', 'interlay-parachain', 'kintsugi-parachain', 'testnet-kintsugi', 'testnet-interlay']],
[subspace, ['subspace']],
[mangata, ['mangata', 'mangata-parachain']]
];
const specMappings: [OverrideBundleDefinition, string[]][] = [
[hyperbridge, ['nexus', 'messier', 'gargantua']]
];
export function applyDerives (typesBundle: OverrideBundleType): OverrideBundleType {
mapping.forEach(([{ derives }, chains]): void => {
chains.forEach((chain): void => {
if (typesBundle.spec?.[chain]) {
typesBundle.spec[chain].derives = derives;
}
});
});
specMappings.forEach(([spec, chains]): void => {
chains.forEach((chain): void => {
if (typesBundle.spec?.[chain]) {
typesBundle.spec[chain] = spec;
}
});
});
return typesBundle;
}