diff --git a/packages/apps-config/src/endpoints/index.ts b/packages/apps-config/src/endpoints/index.ts index 9f2f2be518..1b06e8b417 100644 --- a/packages/apps-config/src/endpoints/index.ts +++ b/packages/apps-config/src/endpoints/index.ts @@ -6,16 +6,13 @@ import type { LinkOption } from './types'; import { defaultT } from '../util'; import { createCustom, createDev, createOwn } from './development'; -import { createProduction } from './production'; -import { createKusamaRelay, createPolkadotRelay } from './productionRelays'; -import { createTesting } from './testing'; -import { createRococoRelay, createWestendRelay } from './testingRelays'; +import { prodChains, prodRelayKusama, prodRelayPolkadot } from './production'; +import { testChains, testRelayRococo, testRelayWestend } from './testing'; +import { expandEndpoints } from './util'; export { CUSTOM_ENDPOINT_KEY } from './development'; -export { prodChains } from './production'; -export { prodParasKusama, prodParasKusamaCommon, prodParasPolkadot, prodParasPolkadotCommon } from './productionRelays'; -export { testChains } from './testing'; -export { testParasRococo, testParasRococoCommon, testParasWestend, testParasWestendCommon } from './testingRelays'; +export * from './production'; +export * from './testing'; export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, withSort = true): LinkOption[] { return [ @@ -28,7 +25,7 @@ export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, w textBy: '', value: '' }, - ...createPolkadotRelay(t, firstOnly, withSort), + ...expandEndpoints(t, [prodRelayPolkadot], firstOnly, withSort), { isDisabled: false, isHeader: true, @@ -36,7 +33,7 @@ export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, w textBy: '', value: '' }, - ...createKusamaRelay(t, firstOnly, withSort), + ...expandEndpoints(t, [prodRelayKusama], firstOnly, withSort), { isDisabled: false, isHeader: true, @@ -45,7 +42,7 @@ export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, w textBy: '', value: '' }, - ...createWestendRelay(t, firstOnly, withSort), + ...expandEndpoints(t, [testRelayWestend], firstOnly, withSort), { isDisabled: false, isHeader: true, @@ -53,7 +50,7 @@ export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, w textBy: '', value: '' }, - ...createRococoRelay(t, firstOnly, withSort), + ...expandEndpoints(t, [testRelayRococo], firstOnly, withSort), { isDisabled: false, isHeader: true, @@ -62,7 +59,7 @@ export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, w textBy: '', value: '' }, - ...createProduction(t, firstOnly, withSort), + ...expandEndpoints(t, prodChains, firstOnly, withSort), { isDisabled: false, isHeader: true, @@ -70,7 +67,7 @@ export function createWsEndpoints (t: TFunction = defaultT, firstOnly = false, w textBy: '', value: '' }, - ...createTesting(t, firstOnly, withSort), + ...expandEndpoints(t, testChains, firstOnly, withSort), { isDevelopment: true, isDisabled: false, diff --git a/packages/apps-config/src/endpoints/production.ts b/packages/apps-config/src/endpoints/production.ts index 708ebc947b..5c8a617658 100644 --- a/packages/apps-config/src/endpoints/production.ts +++ b/packages/apps-config/src/endpoints/production.ts @@ -1,10 +1,10 @@ // Copyright 2017-2022 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { TFunction } from '../types'; -import type { EndpointOption, LinkOption } from './types'; +import type { EndpointOption } from './types'; -import { expandEndpoints } from './util'; +export * from './productionRelayKusama'; +export * from './productionRelayPolkadot'; /* eslint-disable sort-keys */ @@ -12,9 +12,9 @@ import { expandEndpoints } from './util'; // 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 ../ui/logos/index.ts in namedLogos (this also needs to align with @polkadot/networks) // text: The text to display on the dropdown -// value: The actual hosted secure websocket endpoint +// providers: The actual hosted secure websocket endpoint // -// Alpahebtical based on text +// IMPORTANT: Alphabetical based on text export const prodChains: EndpointOption[] = [ { info: 'aleph', @@ -318,8 +318,3 @@ export const prodChains: EndpointOption[] = [ } } ]; - -// alphabetical based on chain name -export function createProduction (t: TFunction, firstOnly: boolean, withSort: boolean): LinkOption[] { - return expandEndpoints(t, prodChains, firstOnly, withSort); -} diff --git a/packages/apps-config/src/endpoints/productionRelayKusama.ts b/packages/apps-config/src/endpoints/productionRelayKusama.ts index fb83dce8f1..3b58b67d80 100644 --- a/packages/apps-config/src/endpoints/productionRelayKusama.ts +++ b/packages/apps-config/src/endpoints/productionRelayKusama.ts @@ -1,7 +1,6 @@ // Copyright 2017-2022 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { TFunction } from '../types'; import type { EndpointOption } from './types'; import { KUSAMA_GENESIS } from '../api/constants'; @@ -12,9 +11,9 @@ import { KUSAMA_GENESIS } from '../api/constants'; // 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 ../ui/logos/index.ts in namedLogos (this also needs to align with @polkadot/networks) // text: The text to display on the dropdown -// value: The actual hosted secure websocket endpoint +// providers: The actual hosted secure websocket endpoint // -// Alpahebtical based on text +// IMPORTANT: Alphabetical based on text export const prodParasKusama: EndpointOption[] = [ { info: 'altair', @@ -459,26 +458,23 @@ export const prodParasKusamaCommon: EndpointOption[] = [ } ]; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function createKusama (t: TFunction): EndpointOption { - return { - dnslink: 'kusama', - genesisHash: KUSAMA_GENESIS, - info: 'kusama', - text: 'Kusama', - providers: { - Parity: 'wss://kusama-rpc.polkadot.io', - OnFinality: 'wss://kusama.api.onfinality.io/public-ws', - // 'Geometry Labs': 'wss://kusama.geometry.io/websockets', // https://github.com/polkadot-js/apps/pull/6746 - Dwellir: 'wss://kusama-rpc.dwellir.com', - RadiumBlock: 'wss://kusama.public.curie.radiumblock.co/ws', - 'light client': 'light://substrate-connect/kusama' - // Pinknode: 'wss://rpc.pinknode.io/kusama/explorer' // https://github.com/polkadot-js/apps/issues/5721 - }, - teleport: [1000, 1001], - linked: [ - ...prodParasKusamaCommon, - ...prodParasKusama - ] - }; -} +export const prodRelayKusama: EndpointOption = { + dnslink: 'kusama', + genesisHash: KUSAMA_GENESIS, + info: 'kusama', + text: 'Kusama', + providers: { + Parity: 'wss://kusama-rpc.polkadot.io', + OnFinality: 'wss://kusama.api.onfinality.io/public-ws', + Dwellir: 'wss://kusama-rpc.dwellir.com', + RadiumBlock: 'wss://kusama.public.curie.radiumblock.co/ws', + // 'Geometry Labs': 'wss://kusama.geometry.io/websockets', // https://github.com/polkadot-js/apps/pull/6746 + // Pinknode: 'wss://rpc.pinknode.io/kusama/explorer' // https://github.com/polkadot-js/apps/issues/5721 + 'light client': 'light://substrate-connect/kusama' + }, + teleport: [1000, 1001], + linked: [ + ...prodParasKusamaCommon, + ...prodParasKusama + ] +}; diff --git a/packages/apps-config/src/endpoints/productionRelayPolkadot.ts b/packages/apps-config/src/endpoints/productionRelayPolkadot.ts index 0a6a8e0141..897560e911 100644 --- a/packages/apps-config/src/endpoints/productionRelayPolkadot.ts +++ b/packages/apps-config/src/endpoints/productionRelayPolkadot.ts @@ -1,7 +1,6 @@ // Copyright 2017-2022 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { TFunction } from '../types'; import type { EndpointOption } from './types'; import { POLKADOT_GENESIS } from '../api/constants'; @@ -12,9 +11,9 @@ import { POLKADOT_GENESIS } from '../api/constants'; // 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 ../ui/logos/index.ts in namedLogos (this also needs to align with @polkadot/networks) // text: The text to display on the dropdown -// value: The actual hosted secure websocket endpoint +// providers: The actual hosted secure websocket endpoint // -// Alpahebtical based on text +// IMPORTANT: Alphabetical based on text export const prodParasPolkadot: EndpointOption[] = [ { info: 'acala', @@ -306,24 +305,21 @@ export const prodParasPolkadotCommon: EndpointOption[] = [ } ]; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function createPolkadot (t: TFunction): EndpointOption { - return { - dnslink: 'polkadot', - genesisHash: POLKADOT_GENESIS, - info: 'polkadot', - text: 'Polkadot', - providers: { - Parity: 'wss://rpc.polkadot.io', - OnFinality: 'wss://polkadot.api.onfinality.io/public-ws', - // 'Geometry Labs': 'wss://polkadot.geometry.io/websockets', // https://github.com/polkadot-js/apps/pull/6746 - Dwellir: 'wss://polkadot-rpc.dwellir.com', - 'light client': 'light://substrate-connect/polkadot' - // Pinknode: 'wss://rpc.pinknode.io/polkadot/explorer' // https://github.com/polkadot-js/apps/issues/5721 - }, - linked: [ - ...prodParasPolkadotCommon, - ...prodParasPolkadot - ] - }; -} +export const prodRelayPolkadot: EndpointOption = { + dnslink: 'polkadot', + genesisHash: POLKADOT_GENESIS, + info: 'polkadot', + text: 'Polkadot', + providers: { + Parity: 'wss://rpc.polkadot.io', + OnFinality: 'wss://polkadot.api.onfinality.io/public-ws', + Dwellir: 'wss://polkadot-rpc.dwellir.com', + // 'Geometry Labs': 'wss://polkadot.geometry.io/websockets', // https://github.com/polkadot-js/apps/pull/6746 + // Pinknode: 'wss://rpc.pinknode.io/polkadot/explorer' // https://github.com/polkadot-js/apps/issues/5721 + 'light client': 'light://substrate-connect/polkadot' + }, + linked: [ + ...prodParasPolkadotCommon, + ...prodParasPolkadot + ] +}; diff --git a/packages/apps-config/src/endpoints/productionRelays.ts b/packages/apps-config/src/endpoints/productionRelays.ts deleted file mode 100644 index cd6132d418..0000000000 --- a/packages/apps-config/src/endpoints/productionRelays.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017-2022 @polkadot/apps-config authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -import type { TFunction } from '../types'; -import type { LinkOption } from './types'; - -import { createKusama } from './productionRelayKusama'; -import { createPolkadot } from './productionRelayPolkadot'; -import { expandEndpoints } from './util'; - -export { prodParasKusama, prodParasKusamaCommon } from './productionRelayKusama'; -export { prodParasPolkadot, prodParasPolkadotCommon } from './productionRelayPolkadot'; - -export function createKusamaRelay (t: TFunction, firstOnly: boolean, withSort: boolean): LinkOption[] { - return expandEndpoints(t, [createKusama(t)], firstOnly, withSort); -} - -export function createPolkadotRelay (t: TFunction, firstOnly: boolean, withSort: boolean): LinkOption[] { - return expandEndpoints(t, [createPolkadot(t)], firstOnly, withSort); -} diff --git a/packages/apps-config/src/endpoints/testing.ts b/packages/apps-config/src/endpoints/testing.ts index c5501cd75c..cb903bc41d 100644 --- a/packages/apps-config/src/endpoints/testing.ts +++ b/packages/apps-config/src/endpoints/testing.ts @@ -1,10 +1,10 @@ // Copyright 2017-2022 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { TFunction } from '../types'; -import type { EndpointOption, LinkOption } from './types'; +import type { EndpointOption } from './types'; -import { expandEndpoints } from './util'; +export * from './testingRelayRococo'; +export * from './testingRelayWestend'; /* eslint-disable sort-keys */ @@ -12,9 +12,9 @@ import { expandEndpoints } from './util'; // 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 ../ui/logos/index.ts in namedLogos (this also needs to align with @polkadot/networks) // text: The text to display on the dropdown -// value: The actual hosted secure websocket endpoint +// providers: The actual hosted secure websocket endpoint // -// Alpahebtical based on text +// IMPORTANT: Alphabetical based on text export const testChains: EndpointOption[] = [ { info: 'ajuna', @@ -588,7 +588,3 @@ export const testChains: EndpointOption[] = [ } } ]; - -export function createTesting (t: TFunction, firstOnly: boolean, withSort: boolean): LinkOption[] { - return expandEndpoints(t, testChains, firstOnly, withSort); -} diff --git a/packages/apps-config/src/endpoints/testingRelayRococo.ts b/packages/apps-config/src/endpoints/testingRelayRococo.ts index e0e412ad6b..a2207f925f 100644 --- a/packages/apps-config/src/endpoints/testingRelayRococo.ts +++ b/packages/apps-config/src/endpoints/testingRelayRococo.ts @@ -1,7 +1,6 @@ // Copyright 2017-2022 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { TFunction } from '../types'; import type { EndpointOption } from './types'; import { ROCOCO_GENESIS } from '../api/constants'; @@ -12,9 +11,9 @@ import { ROCOCO_GENESIS } from '../api/constants'; // 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 ../ui/logos/index.ts in namedLogos (this also needs to align with @polkadot/networks) // text: The text to display on the dropdown -// value: The actual hosted secure websocket endpoint +// providers: The actual hosted secure websocket endpoint // -// Alpahebtical based on text +// IMPORTANT: Alphabetical based on text export const testParasRococo: EndpointOption[] = [ { info: 'arctic', @@ -220,25 +219,21 @@ export const testParasRococoCommon: EndpointOption[] = [ } ]; -// Based on history, this will expand so keep it as a singular chunk -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function createRococo (t: TFunction): EndpointOption { - return { - dnslink: 'rococo', - genesisHash: ROCOCO_GENESIS, - info: 'rococo', - text: 'Rococo', - providers: { - Parity: 'wss://rococo-rpc.polkadot.io', - 'light client': 'light://substrate-connect/rococo' - // OnFinality: 'wss://rococo.api.onfinality.io/public-ws', // After reset, node misses host functions - // Pinknode: 'wss://rpc.pinknode.io/rococo/explorer' // After reset, syncs to old chain - // 'Ares Protocol': 'wss://rococo.aresprotocol.com' // https://github.com/polkadot-js/apps/issues/5767 - }, - teleport: [1000, 1002], - linked: [ - ...testParasRococoCommon, - ...testParasRococo - ] - }; -} +export const testRelayRococo: EndpointOption = { + dnslink: 'rococo', + genesisHash: ROCOCO_GENESIS, + info: 'rococo', + text: 'Rococo', + providers: { + Parity: 'wss://rococo-rpc.polkadot.io', + // OnFinality: 'wss://rococo.api.onfinality.io/public-ws', // After reset, node misses host functions + // Pinknode: 'wss://rpc.pinknode.io/rococo/explorer' // After reset, syncs to old chain + // 'Ares Protocol': 'wss://rococo.aresprotocol.com' // https://github.com/polkadot-js/apps/issues/5767 + 'light client': 'light://substrate-connect/rococo' + }, + teleport: [1000, 1002], + linked: [ + ...testParasRococoCommon, + ...testParasRococo + ] +}; diff --git a/packages/apps-config/src/endpoints/testingRelayWestend.ts b/packages/apps-config/src/endpoints/testingRelayWestend.ts index df8be1e2eb..c5c3fcb23b 100644 --- a/packages/apps-config/src/endpoints/testingRelayWestend.ts +++ b/packages/apps-config/src/endpoints/testingRelayWestend.ts @@ -1,7 +1,6 @@ // Copyright 2017-2022 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { TFunction } from '../types'; import type { EndpointOption } from './types'; import { WESTEND_GENESIS } from '../api/constants'; @@ -12,9 +11,9 @@ import { WESTEND_GENESIS } from '../api/constants'; // 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 ../ui/logos/index.ts in namedLogos (this also needs to align with @polkadot/networks) // text: The text to display on the dropdown -// value: The actual hosted secure websocket endpoint +// providers: The actual hosted secure websocket endpoint // -// Alpahebtical based on text +// IMPORTANT: Alphabetical based on text export const testParasWestend: EndpointOption[] = [ { info: 'basilisk', @@ -128,26 +127,22 @@ export const testParasWestendCommon: EndpointOption[] = [ } ]; -// Based on history, this will expand so keep it as a singular chunk -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export function createWestend (t: TFunction): EndpointOption { - return { - dnslink: 'westend', - genesisHash: WESTEND_GENESIS, - info: 'westend', - text: 'Westend', - providers: { - Parity: 'wss://westend-rpc.polkadot.io', - OnFinality: 'wss://westend.api.onfinality.io/public-ws', - Pinknode: 'wss://rpc.pinknode.io/westend/explorer', - Dwellir: 'wss://westend-rpc.dwellir.com', - 'light client': 'light://substrate-connect/westend' - // 'NodeFactory(Vedran)': 'wss://westend.vedran.nodefactory.io/ws', // https://github.com/polkadot-js/apps/issues/5580 - }, - teleport: [1000], - linked: [ - ...testParasWestendCommon, - ...testParasWestend - ] - }; -} +export const testRelayWestend: EndpointOption = { + dnslink: 'westend', + genesisHash: WESTEND_GENESIS, + info: 'westend', + text: 'Westend', + providers: { + Parity: 'wss://westend-rpc.polkadot.io', + OnFinality: 'wss://westend.api.onfinality.io/public-ws', + Pinknode: 'wss://rpc.pinknode.io/westend/explorer', + Dwellir: 'wss://westend-rpc.dwellir.com', + // 'NodeFactory(Vedran)': 'wss://westend.vedran.nodefactory.io/ws', // https://github.com/polkadot-js/apps/issues/5580 + 'light client': 'light://substrate-connect/westend' + }, + teleport: [1000], + linked: [ + ...testParasWestendCommon, + ...testParasWestend + ] +}; diff --git a/packages/apps-config/src/endpoints/testingRelays.ts b/packages/apps-config/src/endpoints/testingRelays.ts deleted file mode 100644 index f3c70fbb80..0000000000 --- a/packages/apps-config/src/endpoints/testingRelays.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017-2022 @polkadot/apps-config authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -import type { TFunction } from '../types'; -import type { LinkOption } from './types'; - -import { createRococo } from './testingRelayRococo'; -import { createWestend } from './testingRelayWestend'; -import { expandEndpoints } from './util'; - -export { testParasRococo, testParasRococoCommon } from './testingRelayRococo'; -export { testParasWestend, testParasWestendCommon } from './testingRelayWestend'; - -export function createRococoRelay (t: TFunction, firstOnly: boolean, withSort: boolean): LinkOption[] { - return expandEndpoints(t, [createRococo(t)], firstOnly, withSort); -} - -export function createWestendRelay (t: TFunction, firstOnly: boolean, withSort: boolean): LinkOption[] { - return expandEndpoints(t, [createWestend(t)], firstOnly, withSort); -} diff --git a/packages/apps-config/src/endpoints/types.ts b/packages/apps-config/src/endpoints/types.ts index 29993cc851..19c5d3f839 100644 --- a/packages/apps-config/src/endpoints/types.ts +++ b/packages/apps-config/src/endpoints/types.ts @@ -17,7 +17,7 @@ export interface EndpointOption { providers: Record; summary?: string; teleport?: number[]; - text: React.ReactNode; + text: string; } export interface LinkOption extends Option {