forked from polkadot-js/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
99 lines (94 loc) · 2.88 KB
/
index.ts
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright 2017-2024 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { TFunction, TOptions } from '../types.js';
import type { LinkOption } from './types.js';
import { createCustom, createDev, createOwn } from './development.js';
import { prodChains, prodRelayKusama, prodRelayPolkadot } from './production.js';
import { testChains, testRelayWestend } from './testing.js';
import { testRelayPaseo } from './testingRelayPaseo.js';
import { expandEndpoints } from './util.js';
export { CUSTOM_ENDPOINT_KEY } from './development.js';
export * from './production.js';
export * from './testing.js';
function defaultT (keyOrText: string, text?: string | TOptions, options?: TOptions): string {
return (
(options?.replace?.host as string) ||
text?.toString() ||
keyOrText
);
}
export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, withSort = true): LinkOption[] {
return [
...createCustom(t),
{
isDisabled: false,
isHeader: true,
isSpaced: true,
text: t('rpc.header.polkadot.relay', 'Polkadot & parachains', { ns: 'apps-config' }),
textBy: '',
ui: {},
value: ''
},
...expandEndpoints(t, [prodRelayPolkadot], firstOnly, withSort),
{
isDisabled: false,
isHeader: true,
text: t('rpc.header.kusama.relay', 'Kusama & parachains', { ns: 'apps-config' }),
textBy: '',
ui: {},
value: ''
},
...expandEndpoints(t, [prodRelayKusama], firstOnly, withSort),
{
isDisabled: false,
isHeader: true,
isSpaced: true,
text: t('rpc.header.westend.relay', 'Test Westend & parachains', { ns: 'apps-config' }),
textBy: '',
ui: {},
value: ''
},
...expandEndpoints(t, [testRelayWestend], firstOnly, withSort),
{
isDisabled: false,
isHeader: true,
isSpaced: true,
text: t('rpc.header.paseo.relay', 'Test Paseo & parachains', { ns: 'apps-config' }),
textBy: '',
ui: {},
value: ''
},
...expandEndpoints(t, [testRelayPaseo], firstOnly, withSort),
{
isDisabled: false,
isHeader: true,
isSpaced: true,
text: t('rpc.header.live', 'Live networks', { ns: 'apps-config' }),
textBy: '',
ui: {},
value: ''
},
...expandEndpoints(t, prodChains, firstOnly, withSort),
{
isDisabled: false,
isHeader: true,
text: t('rpc.header.test', 'Test networks', { ns: 'apps-config' }),
textBy: '',
ui: {},
value: ''
},
...expandEndpoints(t, testChains, firstOnly, withSort),
{
isDevelopment: true,
isDisabled: false,
isHeader: true,
isSpaced: true,
text: t('rpc.header.dev', 'Development', { ns: 'apps-config' }),
textBy: '',
ui: {},
value: ''
},
...createDev(t),
...createOwn(t)
].filter(({ isDisabled }) => !isDisabled);
}