From 69523d88dd1cfe060bb3efc9c1ce512da35feb8a Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 14 Oct 2020 21:09:47 +0200 Subject: [PATCH] Add canvas testnet RPC endpoint (#3872) * Add canvas testnet RPC endpoint * s/textHoster/textBy/ --- .../apps-config/src/settings/endpoints.ts | 111 ++++++++++-------- packages/apps-config/src/ui/logos/index.ts | 1 + packages/apps/src/Endpoints/index.tsx | 2 +- 3 files changed, 61 insertions(+), 53 deletions(-) diff --git a/packages/apps-config/src/settings/endpoints.ts b/packages/apps-config/src/settings/endpoints.ts index 0655f022af..10fc5847df 100644 --- a/packages/apps-config/src/settings/endpoints.ts +++ b/packages/apps-config/src/settings/endpoints.ts @@ -10,7 +10,7 @@ export interface LinkOption extends Option { dnslink?: string; isChild?: boolean; isDevelopment?: boolean; - textHoster: string; + textBy: string; } interface EnvWindow { @@ -20,6 +20,12 @@ interface EnvWindow { } } +// 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 ../ui/logos/index.ts in namedLogos +// text: The text to display on the dropdown +// value: The actual hosted secure websocket endpoint + function createOwn (t: TFunction): LinkOption[] { try { const storedItems = localStorage.getItem(CUSTOM_ENDPOINT_KEY); @@ -27,11 +33,11 @@ function createOwn (t: TFunction): LinkOption[] { if (storedItems) { const items = JSON.parse(storedItems) as string[]; - return items.map((textHoster) => ({ + return items.map((textBy) => ({ info: 'local', text: t('rpc.custom.entry', 'Custom', { ns: 'apps-config' }), - textHoster, - value: textHoster + textBy, + value: textBy })); } } catch (e) { @@ -47,7 +53,7 @@ function createDev (t: TFunction): LinkOption[] { dnslink: 'local', info: 'local', text: t('rpc.local', 'Local Node', { ns: 'apps-config' }), - textHoster: '127.0.0.1:9944', + textBy: '127.0.0.1:9944', value: 'ws://127.0.0.1:9944' } ]; @@ -60,33 +66,33 @@ function createLiveNetworks (t: TFunction): LinkOption[] { dnslink: 'polkadot', info: 'polkadot', text: t('rpc.polkadot.parity', 'Polkadot', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), value: 'wss://rpc.polkadot.io' }, { info: 'polkadot', text: t('rpc.polkadot.w3f', 'Polkadot', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Web3 Foundation' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Web3 Foundation' } }), value: 'wss://cc1-1.polkadot.network' }, { dnslink: 'kusama', info: 'kusama', text: t('rpc.kusama.parity', 'Kusama', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), value: 'wss://kusama-rpc.polkadot.io' }, { info: 'kusama', text: t('rpc.kusama.w3f', 'Kusama', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Web3 Foundation' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Web3 Foundation' } }), value: 'wss://cc3-5.kusama.network' }, { info: 'kusama', isDisabled: true, text: t('rpc.kusama.ava', 'Kusama', { ns: 'apps-config' }), - textHoster: t('rpc.ava.summary', 'user-run public nodes; see https://status.cloud.ava.do/', { ns: 'apps-config' }), + textBy: t('rpc.ava.summary', 'user-run public nodes; see https://status.cloud.ava.do/', { ns: 'apps-config' }), value: 'wss://kusama.polkadot.cloud.ava.do' }, // alphabetical based on chain name @@ -94,57 +100,57 @@ function createLiveNetworks (t: TFunction): LinkOption[] { dnslink: 'centrifuge', info: 'centrifuge', text: t('rpc.centrifuge', 'Centrifuge', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Centrifuge' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Centrifuge' } }), value: 'wss://fullnode.centrifuge.io' }, { info: 'crab', text: t('rpc.crab', 'Darwinia Crab', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Darwinia Network' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Darwinia Network' } }), value: 'wss://crab.darwinia.network' }, { info: 'dockMainnet', text: t('rpc.dock-mainnet', 'Dock Mainnet', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Dock Association' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Dock Association' } }), value: 'wss://mainnet-node.dock.io' }, { dnslink: 'edgeware', info: 'edgeware', text: t('rpc.edgeware', 'Edgeware', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Commonwealth Labs' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Commonwealth Labs' } }), value: 'wss://mainnet1.edgewa.re' }, { dnslink: 'kulupu', info: 'kulupu', text: t('rpc.kulupu', 'Kulupu', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Kulupu' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Kulupu' } }), value: 'wss://rpc.kulupu.corepaper.org/ws' }, { info: 'nodle', text: t('rpc.nodle-main', 'Nodle Main', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Nodle' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Nodle' } }), value: 'wss://main1.nodleprotocol.io' }, { info: 'plasm', text: t('rpc.plasm', 'Plasm', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stake Technologies' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stake Technologies' } }), value: 'wss://rpc.plasmnet.io/' }, { info: 'stafi', text: t('rpc.stafi', 'Stafi', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stafi Foundation' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stafi Foundation' } }), value: 'wss://mainnet-rpc.stafi.io' }, { info: 'subsocial', text: t('rpc.subsocial', 'Subsocial', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'DappForce' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'DappForce' } }), value: 'wss://rpc.subsocial.network' } ]; @@ -157,150 +163,156 @@ function createTestNetworks (t: TFunction): LinkOption[] { dnslink: 'rococo', info: 'rococo', text: t('rpc.rococo', 'Rococo', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), value: 'wss://rococo-rpc.polkadot.io' }, { info: 'rococoTick', isChild: true, text: t('rpc.rococo.tick', 'Tick', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), value: 'wss://tick-rpc.polkadot.io' }, { info: 'rococoTrick', isChild: true, text: t('rpc.rococo.trick', 'Trick', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Prity' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Prity' } }), value: 'wss://trick-rpc.polkadot.io' }, { info: 'rococoTrack', isChild: true, text: t('rpc.rococo.track', 'Track', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), value: 'wss://track-rpc.polkadot.io' }, { info: 'rococoAcala', isChild: true, text: t('rpc.rococo.acala', 'Mandala PC1', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Acala' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Acala' } }), value: 'wss://rococo-1.acala.laminar.one' }, { info: 'rococoDarwinia', isChild: true, text: t('rpc.rococo.darwinia', 'Darwinia PC1', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Darwinia Network' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Darwinia Network' } }), value: 'wss://parachain-rpc.darwinia.network' }, { info: 'rococoPlasm', isChild: true, text: t('rpc.rococo.plasm', 'Plasm PC1', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stake Technologies' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stake Technologies' } }), value: 'wss://rpc.parachain.plasmnet.io' }, { info: 'rococoRobonomics', isChild: true, text: t('rpc.rococo.robonomics', 'Robonomics PC1', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Airalab' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Airalab' } }), value: 'wss://parachain-rpc.robonomics.network' }, { info: 'rococoLaminar', isChild: true, text: t('rpc.rococo.laminar', 'Turbulence PC1', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Laminar' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Laminar' } }), value: 'wss://rococo-1.laminar-chain.laminar.one' }, // alphabetical based on chain name { info: 'centrifuge', text: t('rpc.amber', 'Amber', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Centrifuge' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Centrifuge' } }), value: 'wss://fullnode.amber.centrifuge.io' }, { info: 'nodle', text: t('rpc.nodle-arcadia', 'Arcadia', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Nodle' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Nodle' } }), value: 'wss://arcadia1.nodleprotocol.io' }, { info: 'edgeware', text: t('rpc.beresheet', 'Beresheet', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Commonwealth Labs' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Commonwealth Labs' } }), value: 'wss://beresheet1.edgewa.re' }, + { + info: 'canvas', + text: t('rpc.canvas', 'Canvas', { ns: 'apps-config' }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), + value: 'wss://canvas-rpc.parity.io' + }, { info: 'crust', text: t('rpc.crust.network', 'Crust Maxwell CC2', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Crust Network' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Crust Network' } }), value: 'wss://api.crust.network/' }, { info: 'datahighway', isDisabled: true, text: t('rpc.datahighway.harbour', 'Harbour', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'MXC' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'MXC' } }), value: 'wss://testnet-harbour.datahighway.com' }, { info: 'dockTestnet', text: t('rpc.dock-testnet', 'Dock Testnet', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Dock Association' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Dock Association' } }), value: 'wss://danforth-1.dock.io' }, { info: 'dusty', text: t('rpc.dusty', 'Dusty', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stake Technologies' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Stake Technologies' } }), value: 'wss://rpc.dusty.plasmnet.io/' }, { info: 'equilibrium', text: t('rpc.equilibriumr', 'Equilibrium', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Equilibrium' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Equilibrium' } }), value: 'wss://api.testnet.equilibrium.io:9944' }, { info: 'substrate', text: t('rpc.flamingfir', 'Flaming Fir', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), value: 'wss://substrate-rpc.parity.io' }, { info: 'acala', text: t('rpc.mandala', 'Mandala', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Acala' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Acala' } }), value: 'wss://node-6684611762228215808.jm.onfinality.io/ws' }, { info: 'kilt', text: t('rpc.kilt', 'Mashnet', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'KILT Protocol' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'KILT Protocol' } }), value: 'wss://full-nodes.kilt.io:9944/' }, { info: 'phala', text: t('rpc.phala', 'Phala PoC-2', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Phala Network' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Phala Network' } }), value: 'wss://poc2.phala.network/ws' }, { info: 'laminar', text: t('rpc.turbulence', 'Turbulence', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Laminar' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Laminar' } }), value: 'wss://testnet-node-1.laminar-chain.laminar.one/ws' }, { dnslink: 'westend', info: 'westend', text: t('rpc.westend', 'Westend', { ns: 'apps-config' }), - textHoster: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), + textBy: t('rpc.hosted.by', 'hosted by {{host}}', { ns: 'apps-config', replace: { host: 'Parity' } }), value: 'wss://westend-rpc.polkadot.io' } ]; @@ -317,38 +329,33 @@ function createCustom (t: TFunction): LinkOption[] { { isHeader: true, text: t('rpc.custom', 'Custom environment', { ns: 'apps-config' }), - textHoster: '', + textBy: '', value: '' }, { info: 'WS_URL', text: t('rpc.custom.entry', 'Custom {{WS_URL}}', { ns: 'apps-config', replace: { WS_URL } }), - textHoster: WS_URL, + textBy: WS_URL, value: WS_URL } ] : []; } -// 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 the dropdown -// value: The actual hosted secure websocket endpoint export default function create (t: TFunction): LinkOption[] { return [ ...createCustom(t), { isHeader: true, text: t('rpc.header.live', 'Live networks', { ns: 'apps-config' }), - textHoster: '', + textBy: '', value: '' }, ...createLiveNetworks(t), { isHeader: true, text: t('rpc.header.test', 'Test networks', { ns: 'apps-config' }), - textHoster: '', + textBy: '', value: '' }, ...createTestNetworks(t), @@ -356,7 +363,7 @@ export default function create (t: TFunction): LinkOption[] { isDevelopment: true, isHeader: true, text: t('rpc.header.dev', 'Development', { ns: 'apps-config' }), - textHoster: '', + textBy: '', value: '' }, ...createDev(t), diff --git a/packages/apps-config/src/ui/logos/index.ts b/packages/apps-config/src/ui/logos/index.ts index d009c57e90..a454d4209d 100644 --- a/packages/apps-config/src/ui/logos/index.ts +++ b/packages/apps-config/src/ui/logos/index.ts @@ -114,6 +114,7 @@ const nodeLogos: Record = [ const namedLogos: Record = { acala: nodeAcala, alexander: nodePolkadot, + canvas: nodeCanvas, centrifuge: nodeCentrifuge, crab: nodeCrab, crust: nodeCrust, diff --git a/packages/apps/src/Endpoints/index.tsx b/packages/apps/src/Endpoints/index.tsx index 45510c6c62..ab8e9a0dbe 100644 --- a/packages/apps/src/Endpoints/index.tsx +++ b/packages/apps/src/Endpoints/index.tsx @@ -46,7 +46,7 @@ function combineEndpoints (endpoints: LinkOption[]): Group[] { result.push({ header: e.text, isDevelopment: e.isDevelopment, networks: [] }); } else { const prev = result[result.length - 1]; - const prov = { name: e.textHoster, url: e.value as string }; + const prov = { name: e.textBy, url: e.value as string }; if (prev.networks[prev.networks.length - 1] && e.text === prev.networks[prev.networks.length - 1].name) { prev.networks[prev.networks.length - 1].providers.push(prov);