mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-04-25 22:18:01 +00:00
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-settings 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';
|
||||
|
||||
export const CRYPTOS: Option[] = [
|
||||
{
|
||||
info: 'ed25519',
|
||||
text: 'Edwards (ed25519)',
|
||||
value: 'ed25519'
|
||||
},
|
||||
{
|
||||
info: 'sr25519',
|
||||
text: 'Schnorrkel (sr25519)',
|
||||
value: 'sr25519'
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,112 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-settings 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';
|
||||
|
||||
import { isPolkadot } from './type';
|
||||
|
||||
type ChainName = 'alexander' | 'edgewareTest' | 'flamingFir' | 'kusama';
|
||||
|
||||
interface ChainData {
|
||||
chainDisplay: string;
|
||||
logo: 'alexander' | 'edgeware' | 'kusama' | 'polkadot' | 'substrate';
|
||||
type: string;
|
||||
}
|
||||
|
||||
type ProviderName = 'commonwealth' | 'parity' | 'unfrastructure' | 'w3f';
|
||||
|
||||
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', 'alexander', 'edgewareTest', 'flamingFir'];
|
||||
|
||||
// we use this to order the providers inside the chains
|
||||
const ORDER_PROVIDERS: ProviderName[] = ['parity', 'w3f', 'unfrastructure', 'commonwealth'];
|
||||
|
||||
// some suplementary info on a per-chain basis
|
||||
const CHAIN_INFO: Record<ChainName, ChainData> = {
|
||||
alexander: {
|
||||
chainDisplay: 'Alexander',
|
||||
logo: 'alexander',
|
||||
type: 'Polkadot Test'
|
||||
},
|
||||
edgewareTest: {
|
||||
chainDisplay: 'Edgeware Testnet',
|
||||
logo: 'edgeware',
|
||||
type: 'Edgeware Test'
|
||||
},
|
||||
flamingFir: {
|
||||
chainDisplay: 'Flaming Fir',
|
||||
logo: 'substrate',
|
||||
type: 'Substrate Test'
|
||||
},
|
||||
kusama: {
|
||||
chainDisplay: 'Kusama CC1',
|
||||
logo: 'kusama',
|
||||
type: 'Polkadot Canary'
|
||||
}
|
||||
};
|
||||
|
||||
// the actual providers with all the nodes they provide
|
||||
const PROVIDERS: Record<ProviderName, PoviderData> = {
|
||||
commonwealth: {
|
||||
providerDisplay: 'Commonwealth Labs',
|
||||
nodes: {
|
||||
edgewareTest: 'wss://testnet2.edgewa.re'
|
||||
}
|
||||
},
|
||||
parity: {
|
||||
providerDisplay: 'Parity',
|
||||
nodes: {
|
||||
alexander: 'wss://poc3-rpc.polkadot.io/',
|
||||
flamingFir: 'wss://substrate-rpc.parity.io/',
|
||||
kusama: 'wss://kusama-rpc.polkadot.io/'
|
||||
}
|
||||
},
|
||||
unfrastructure: {
|
||||
providerDisplay: 'Centrality UNfrastructure',
|
||||
nodes: {
|
||||
alexander: 'wss://alex.unfrastructure.io/public/ws'
|
||||
}
|
||||
},
|
||||
w3f: {
|
||||
providerDisplay: 'Web3 Foundation',
|
||||
nodes: {
|
||||
kusama: 'wss://canary-5.kusama.network/'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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({
|
||||
info: 'local',
|
||||
text: 'Local Node (Any, 127.0.0.1:9944)',
|
||||
value: 'ws://127.0.0.1:9944/'
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-settings 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';
|
||||
|
||||
import { CRYPTOS } from './crypto';
|
||||
import { ENDPOINTS, ENDPOINT_DEFAULT } from './endpoints';
|
||||
import { PREFIXES, PREFIX_DEFAULT } from './ss58';
|
||||
import { isPolkadot } from './type';
|
||||
|
||||
const LANGUAGE_DEFAULT = 'default';
|
||||
|
||||
const LANGUAGES: Option[] = [
|
||||
{
|
||||
info: 'detect',
|
||||
text: 'Default browser language (auto-detect)',
|
||||
value: LANGUAGE_DEFAULT
|
||||
}
|
||||
];
|
||||
|
||||
const LOCKING_DEFAULT = 'session';
|
||||
|
||||
const LOCKING: Option[] = [
|
||||
{
|
||||
info: 'session',
|
||||
text: 'Once per session',
|
||||
value: 'session'
|
||||
},
|
||||
{
|
||||
info: 'tx',
|
||||
text: 'On each transaction',
|
||||
value: 'tx'
|
||||
}
|
||||
];
|
||||
|
||||
const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.includes('ui-light')
|
||||
? 'light'
|
||||
: 'full';
|
||||
|
||||
const UIMODES: Option[] = [
|
||||
{
|
||||
info: 'full',
|
||||
text: 'Fully featured',
|
||||
value: 'full'
|
||||
},
|
||||
{
|
||||
info: 'light',
|
||||
text: 'Basic features only',
|
||||
value: 'light'
|
||||
}
|
||||
];
|
||||
|
||||
const UITHEME_DEFAULT = isPolkadot
|
||||
? 'polkadot'
|
||||
: 'substrate';
|
||||
|
||||
const UITHEMES: Option[] = [
|
||||
{
|
||||
info: 'polkadot',
|
||||
text: 'Polkadot',
|
||||
value: 'polkadot'
|
||||
},
|
||||
{
|
||||
info: 'substrate',
|
||||
text: 'Substrate',
|
||||
value: 'substrate'
|
||||
}
|
||||
];
|
||||
|
||||
export {
|
||||
CRYPTOS,
|
||||
ENDPOINT_DEFAULT,
|
||||
ENDPOINTS,
|
||||
LANGUAGE_DEFAULT,
|
||||
LANGUAGES,
|
||||
LOCKING_DEFAULT,
|
||||
LOCKING,
|
||||
PREFIX_DEFAULT,
|
||||
PREFIXES,
|
||||
UIMODE_DEFAULT,
|
||||
UIMODES,
|
||||
UITHEME_DEFAULT,
|
||||
UITHEMES
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-settings 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';
|
||||
|
||||
export const PREFIX_DEFAULT = -1;
|
||||
|
||||
export const PREFIXES: Option[] = [
|
||||
{
|
||||
info: 'default',
|
||||
text: 'Default for the connected node',
|
||||
value: -1
|
||||
},
|
||||
{
|
||||
info: 'substrate',
|
||||
text: 'Substrate (development)',
|
||||
value: 42
|
||||
},
|
||||
{
|
||||
info: 'kusama',
|
||||
text: 'Kusama (canary)',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
info: 'polkadot',
|
||||
text: 'Polkadot (live)',
|
||||
value: 0
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-settings authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
// matches https://polkadot.js.org & https://*.polkadot.io
|
||||
export const isPolkadot = typeof window !== 'undefined' && window.location.host.includes('polkadot');
|
||||
Reference in New Issue
Block a user