* Bump dev

* Fix linting
This commit is contained in:
Jaco Greeff
2020-02-13 16:07:21 +01:00
committed by GitHub
parent 924e69bc7b
commit 9e5a2ac7c5
14 changed files with 297 additions and 1326 deletions
+4 -126
View File
@@ -4,132 +4,10 @@
import { Option } from '../types';
import { isPolkadot } from './type';
type ChainName = 'alexander' | 'edgeware' | 'edgewareTest' | 'flamingFir' | 'kusama' | 'kulupu' | 'westend';
interface ChainData {
chainDisplay: string;
logo: 'alexander' | 'edgeware' | 'kusama' | 'polkadot' | 'substrate';
type: string;
}
type ProviderName = 'commonwealth' | 'parity' | 'unfrastructure' | 'w3f' | 'kulupu';
interface PoviderData {
providerDisplay: string;
nodes: Partial<Record<ChainName, string>>;
}
// we use this to give an ordering to the chains available
const ORDER_CHAINS: ChainName[] = ['kusama', 'edgeware', 'westend', 'edgewareTest', 'flamingFir', 'kulupu'];
// we use this to order the providers inside the chains
const ORDER_PROVIDERS: ProviderName[] = ['parity', 'w3f', 'unfrastructure', 'commonwealth', 'kulupu'];
// some suplementary info on a per-chain basis
const CHAIN_INFO: Record<ChainName, ChainData> = {
alexander: {
chainDisplay: 'Alexander',
logo: 'alexander',
type: 'Polkadot Testnet'
},
edgeware: {
chainDisplay: 'Edgeware',
logo: 'edgeware',
type: 'Edgeware Mainnet'
},
edgewareTest: {
chainDisplay: 'Berlin',
logo: 'edgeware',
type: 'Edgeware Testnet'
},
flamingFir: {
chainDisplay: 'Flaming Fir',
logo: 'substrate',
type: 'Substrate Testnet'
},
kusama: {
chainDisplay: 'Kusama',
logo: 'kusama',
type: 'Polkadot Canary'
},
kulupu: {
chainDisplay: 'Kulupu',
logo: 'substrate',
type: 'Kulupu Mainnet'
},
westend: {
chainDisplay: 'Westend',
logo: 'alexander',
type: 'Polkadot Testnet'
}
};
// the actual providers with all the nodes they provide
const PROVIDERS: Record<ProviderName, PoviderData> = {
commonwealth: {
providerDisplay: 'Commonwealth Labs',
nodes: {
edgeware: 'wss://mainnet1.edgewa.re',
edgewareTest: 'wss://berlin1.edgewa.re'
}
},
parity: {
providerDisplay: 'Parity',
nodes: {
// alexander: 'wss://poc3-rpc.polkadot.io/',
flamingFir: 'wss://substrate-rpc.parity.io/',
kusama: 'wss://kusama-rpc.polkadot.io/',
westend: 'wss://westend-rpc.polkadot.io'
}
},
unfrastructure: {
providerDisplay: 'Centrality UNfrastructure',
nodes: {
// alexander: 'wss://alex.unfrastructure.io/public/ws'
}
},
w3f: {
providerDisplay: 'Web3 Foundation',
nodes: {
kusama: 'wss://cc3-5.kusama.network/'
}
},
kulupu: {
providerDisplay: 'Kulupu',
nodes: {
kulupu: 'wss://rpc.kulupu.network/ws'
}
}
};
export const ENDPOINT_DEFAULT = isPolkadot
? PROVIDERS.parity.nodes.kusama
: PROVIDERS.parity.nodes.flamingFir;
export const ENDPOINTS: Option[] = ORDER_CHAINS.reduce((endpoints: Option[], chainName): Option[] => {
const { chainDisplay, logo, type } = CHAIN_INFO[chainName];
return ORDER_PROVIDERS.reduce((endpoints: Option[], providerName): Option[] => {
const { providerDisplay, nodes } = PROVIDERS[providerName];
const wssUrl = nodes[chainName];
if (wssUrl) {
endpoints.push({
info: logo,
text: `${chainDisplay} (${type}, hosted by ${providerDisplay})`,
value: wssUrl
});
}
return endpoints;
}, endpoints);
}, []);
// add a local node right at the end
ENDPOINTS.push({
export const ENDPOINTS: Option[] = [{
info: 'local',
text: 'Local Node (Own, 127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/'
});
}];
export const ENDPOINT_DEFAULT = ENDPOINTS[0];