diff --git a/src/state/chains/networks/index.ts b/src/state/chains/networks/index.ts index 830ae8c..358e7aa 100644 --- a/src/state/chains/networks/index.ts +++ b/src/state/chains/networks/index.ts @@ -1,8 +1,4 @@ -import ksmRawNetworks from "./kusama.json" -import paseoRawNetworks from "./paseo.json" -import polkadotRawNetworks from "./polkadot.json" import quantusRawNetworks from "./quantus.json" -import westendRawNetworks from "./westend.json" export type Network = { id: string @@ -17,38 +13,45 @@ export type NetworkCategory = { networks: Network[] } -const [Polkadot, Kusama, Paseo, Westend, Quantus] = ( - [ - polkadotRawNetworks, - ksmRawNetworks, - paseoRawNetworks, - westendRawNetworks, - quantusRawNetworks, - ] as const -).map((n): Network[] => - n.map((x) => ({ - endpoints: x.rpcs as any, - lightclient: !!x.hasChainSpecs, - id: x.id, - display: x.display, - // Quantus is a solo chain and its entries carry no `relayChainInfo`, so the - // union of the imported JSON literals no longer has the property on every - // arm. Narrowed rather than cast: a typo in one of the relay-chain files - // should still be a type error. - relayChain: "relayChainInfo" in x ? x.relayChainInfo?.id : undefined, - })), -) +// Quantus only. +// +// Upstream ships Polkadot, Kusama, Paseo, Westend and their parachains. Every +// one of them signs with sr25519, ed25519 or ecdsa — discrete-log schemes that +// Shor's algorithm breaks together — so none has a quantum-safe account type to +// offer, and this console cannot sign for them anyway: polkadot-api rejected +// Quantus's DilithiumSignatureScheme until the patch in patches/, and that patch +// widened a check rather than adding support for anything else. +// +// Offering them would make the console look like a general-purpose Substrate +// tool that happens to include Quantus. It is the other way round. +// +// The patched header codec still carries both the Substrate and the Quantus +// layouts, and still has a test for each: Localhost and Custom below can point +// at anything, so the disambiguation has to keep working even with no Substrate +// chain in this list. +// Typed once here rather than per-field. TypeScript infers a union of object +// literals from the JSON, and because the endpoint keys differ per chain +// (rpc1/rpc2 vs a1/a2) every key is `?: undefined` on the arms that lack it — +// which is not assignable to Record. The double assertion is +// the narrowest way through and is what upstream did too (`x.rpcs as any`); +// the shape is checked by the build the moment quantus.json drifts from it. +type RawNetwork = { + id: string + display: string + rpcs: Record + hasChainSpecs: boolean +} + +const Quantus: Network[] = (quantusRawNetworks as unknown as RawNetwork[]).map((x) => ({ + endpoints: x.rpcs, + lightclient: !!x.hasChainSpecs, + id: x.id, + display: x.display, + relayChain: undefined, +})) -// Quantus first, and the default below. This console exists to exercise a -// post-quantum chain; the Substrate networks stay because a signature that works -// on both is the only evidence that the patch in patches/ widened a check rather -// than broke one. const networks = { Quantus, - Polkadot, - Kusama, - Paseo, - Westend, Localhost: [ { id: "localhost", diff --git a/src/state/chains/networks/quantus.json b/src/state/chains/networks/quantus.json index 9284a4c..fed7f5e 100644 --- a/src/state/chains/networks/quantus.json +++ b/src/state/chains/networks/quantus.json @@ -3,12 +3,10 @@ "id": "quantus", "display": "Quantus", "rpcs": { - "Quantus": "wss://rpc1-mainnet.quantus.com" - }, - "nativeToken": { - "symbol": "QTC", - "decimals": 12 + "rpc1": "wss://rpc1-mainnet.quantus.com", + "rpc2": "wss://rpc2-mainnet.quantus.com" }, + "nativeToken": { "symbol": "QTC", "decimals": 12 }, "hasChainSpecs": false }, { @@ -18,10 +16,7 @@ "a1": "wss://a1-heisenberg.quantus.cat", "a2": "wss://a2-heisenberg.quantus.cat" }, - "nativeToken": { - "symbol": "HEI", - "decimals": 12 - }, + "nativeToken": { "symbol": "HEI", "decimals": 12 }, "hasChainSpecs": false }, { @@ -31,10 +26,7 @@ "a1": "wss://a1-planck.quantus.cat", "a2": "wss://a2-planck.quantus.cat" }, - "nativeToken": { - "symbol": "PLK", - "decimals": 12 - }, + "nativeToken": { "symbol": "PLK", "decimals": 12 }, "hasChainSpecs": false } ]