Adjust testnet detection in @polkadot/networks (#1147)

This commit is contained in:
Jaco
2021-10-26 10:08:52 +03:00
committed by GitHub
parent 48158927e1
commit cac98aac03
18 changed files with 100 additions and 108 deletions
+4 -1
View File
@@ -8,9 +8,11 @@ import { knownSubstrate } from './substrate';
// These are known prefixes that are not sorted
const UNSORTED = [0, 2, 42];
const TESTNETS = ['testnet'];
export const allNetworks = knownSubstrate.map((o): SubstrateNetwork => {
const network = o.network || '';
const nameParts = network.replace(/_/g, '-').split('-');
const n = o as SubstrateNetwork;
n.slip44 = knownLedger[network];
@@ -18,7 +20,8 @@ export const allNetworks = knownSubstrate.map((o): SubstrateNetwork => {
n.genesisHash = knownGenesis[network] || [];
n.icon = knownIcon[network] || 'substrate';
n.isIgnored = !!knownTestnet[network] || (!(o.standardAccount && o.decimals && o.symbols) && o.prefix !== 42);
n.isTestnet = !!knownTestnet[network] || TESTNETS.includes(nameParts[nameParts.length - 1]);
n.isIgnored = n.isTestnet || (!(o.standardAccount && o.decimals && o.symbols) && o.prefix !== 42);
return n;
});
+1
View File
@@ -26,6 +26,7 @@ export interface SubstrateNetwork extends KnownSubstrate {
hasLedgerSupport: boolean;
icon: Icon;
isIgnored: boolean;
isTestnet: boolean;
slip44?: number | null;
}