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
+1 -2
View File
@@ -9,7 +9,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/hw-ledger-transports",
"private": false,
"repository": {
"directory": "packages/hw-ledger-transports",
"type": "git",
@@ -30,4 +29,4 @@
"optionalDependencies": {
"@ledgerhq/hw-transport-node-hid-singleton": "^6.11.0"
}
}
}
+1 -2
View File
@@ -9,7 +9,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/hw-ledger",
"private": false,
"repository": {
"directory": "packages/hw-ledger",
"type": "git",
@@ -28,4 +27,4 @@
"@polkadot/util": "7.6.2-3",
"@zondax/ledger-substrate": "^0.18.0"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/keyring",
"private": false,
"repository": {
"directory": "packages/keyring",
"type": "git",
@@ -32,4 +31,4 @@
"@polkadot/util": "7.6.2-3",
"@polkadot/util-crypto": "7.6.2-3"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/networks",
"private": false,
"repository": {
"directory": "packages/networks",
"type": "git",
@@ -27,4 +26,4 @@
"@polkadot/util": "7.6.2-3",
"@polkadot/x-fetch": "7.6.2-3"
}
}
}
+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;
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/util-crypto",
"private": false,
"repository": {
"directory": "packages/util-crypto",
"type": "git",
@@ -54,4 +53,4 @@
"peerDependencies": {
"@polkadot/util": "7.6.2-3"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/util",
"private": false,
"repository": {
"directory": "packages/util",
"type": "git",
@@ -32,4 +31,4 @@
"camelcase": "^6.2.0",
"ip-regex": "^4.3.0"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/x-bundle",
"private": false,
"repository": {
"directory": "packages/x-bundle",
"type": "git",
@@ -25,4 +24,4 @@
"@polkadot/util": "7.6.2-3",
"buffer-es6": "^4.9.3"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/x-fetch",
"private": false,
"repository": {
"directory": "packages/x-fetch",
"type": "git",
@@ -28,4 +27,4 @@
"@types/node-fetch": "^2.5.12",
"node-fetch": "^2.6.5"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/x-global",
"private": false,
"repository": {
"directory": "packages/x-global",
"type": "git",
@@ -23,4 +22,4 @@
"dependencies": {
"@babel/runtime": "^7.15.4"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/x-randomvalues",
"private": false,
"repository": {
"directory": "packages/x-randomvalues",
"type": "git",
@@ -29,4 +28,4 @@
"devDependencies": {
"@types/react-native": "^0.66.1"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/x-textdecoder",
"private": false,
"repository": {
"directory": "packages/x-textdecoder",
"type": "git",
@@ -26,4 +25,4 @@
"@babel/runtime": "^7.15.4",
"@polkadot/x-global": "7.6.2-3"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/x-textencoder",
"private": false,
"repository": {
"directory": "packages/x-textencoder",
"type": "git",
@@ -26,4 +25,4 @@
"@babel/runtime": "^7.15.4",
"@polkadot/x-global": "7.6.2-3"
}
}
}
+1 -2
View File
@@ -10,7 +10,6 @@
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/x-ws",
"private": false,
"repository": {
"directory": "packages/x-ws",
"type": "git",
@@ -28,4 +27,4 @@
"@types/websocket": "^1.0.4",
"websocket": "^1.0.34"
}
}
}