ghost-portal/packages/apps-config/src/settings/endpoints.ts
Chevdor 5f64e08766
Improve support for WS_URL (#2421)
* Improve support for WS_URL

* Move the ENV section to the top of the list

* Update packages/apps-config/src/settings/endpoints.ts

Co-Authored-By: Jaco Greeff <jacogr@gmail.com>

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
2020-03-23 14:14:46 +01:00

104 lines
2.4 KiB
TypeScript

// Copyright 2017-2020 @polkadot/apps-config authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Option } from './types';
const DEV: Option[] = [
{
info: 'local',
text: 'Local Node (Own, 127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/'
}
];
const ENV: Option[] = [];
if (process.env.WS_URL) {
ENV.push({
info: 'WS_URL',
text: 'WS_URL: ' + process.env.WS_URL,
value: process.env.WS_URL
});
}
const LIVE: Option[] = [
{
info: 'kusama',
text: 'Kusama (Polkadot Canary, hosted by Parity)',
value: 'wss://kusama-rpc.polkadot.io/'
},
{
info: 'kusama',
text: 'Kusama (Polkadot Canary, hosted by Web3 Foundation)',
value: 'wss://cc3-5.kusama.network/'
},
{
info: 'edgeware',
text: 'Edgeware (Edgeware Mainnet, hosted by Commonwealth Labs)',
value: 'wss://mainnet1.edgewa.re'
},
{
info: 'substrate',
text: 'Kulupu (Kulupu Mainnet, hosted by Kulupu)',
value: 'wss://rpc.kulupu.network/ws'
}
];
const TEST: Option[] = [
{
info: 'westend',
text: 'Westend (Polkadot Testnet, hosted by Parity)',
value: 'wss://westend-rpc.polkadot.io'
},
{
info: 'edgeware',
text: 'Berlin (Edgeware Testnet, hosted by Commonwealth Labs)',
value: 'wss://berlin1.edgewa.re'
},
{
info: 'substrate',
text: 'Flaming Fir (Substrate Testnet, hosted by Parity)',
value: 'wss://substrate-rpc.parity.io/'
}
];
let endpoints = [
{
isHeader: true,
text: 'Live networks',
value: ''
},
...LIVE,
{
isHeader: true,
text: 'Test networks',
value: ''
},
...TEST,
{
isHeader: true,
text: 'Development',
value: ''
},
...DEV
];
if (ENV.length > 0) {
endpoints = [
{
isHeader: true,
text: 'Custom ENV',
value: ''
},
...ENV
].concat(endpoints);
}
// The available endpoints that will show in the dropdown. For the most part (with the exception of
// Polkadot) we try to keep this to live chains only, with RPCs hosted by the community/chain vendor
// info: The chain logo name as defined in ../logos, specifically in namedLogos
// text: The text to display on teh dropdown
// value: The actual hosted secure websocket endpoint
export default endpoints.map((option): Option => ({ ...option, withI18n: true }));