From 5ff15b18a1ce746d40c17b849da01f9fe85e1629 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Sun, 27 Dec 2020 12:50:18 +0100 Subject: [PATCH] Filter ss58 testnets (#822) * Filter ss58 testnets * Remove genesisHash testnet * Ignore reserved --- package.json | 2 +- packages/keyring/package.json | 10 ++++---- packages/networks/package.json | 6 ++--- packages/networks/src/index.spec.ts | 6 ++++- packages/networks/src/index.ts | 8 ++++-- packages/networks/src/types.ts | 1 + packages/util-crypto/package.json | 10 ++++---- packages/util/package.json | 6 ++--- packages/x-fetch/package.json | 2 +- packages/x-randomvalues/package.json | 2 +- packages/x-textdecoder/package.json | 2 +- packages/x-textencoder/package.json | 2 +- packages/x-ws/package.json | 2 +- yarn.lock | 38 ++++++++++++++-------------- 14 files changed, 53 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 9186dc2a0..ac1d1a0ce 100644 --- a/package.json +++ b/package.json @@ -25,5 +25,5 @@ "@polkadot/ts": "^0.3.58", "@types/jest": "^26.0.19" }, - "version": "5.2.1" + "version": "5.2.2" } diff --git a/packages/keyring/package.json b/packages/keyring/package.json index 063c53637..a9a1feb94 100644 --- a/packages/keyring/package.json +++ b/packages/keyring/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/keyring", - "version": "5.2.1", + "version": "5.2.2", "description": "Keyring management", "author": "Jaco Greeff ", "maintainers": [], @@ -17,11 +17,11 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme", "dependencies": { "@babel/runtime": "^7.12.5", - "@polkadot/util": "5.2.1", - "@polkadot/util-crypto": "5.2.1" + "@polkadot/util": "5.2.2", + "@polkadot/util-crypto": "5.2.2" }, "peerDependencies": { - "@polkadot/util": "5.2.1", - "@polkadot/util-crypto": "5.2.1" + "@polkadot/util": "5.2.2", + "@polkadot/util-crypto": "5.2.2" } } diff --git a/packages/networks/package.json b/packages/networks/package.json index 67d6829d1..cb72b7cc6 100644 --- a/packages/networks/package.json +++ b/packages/networks/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/networks", - "version": "5.2.1", + "version": "5.2.2", "description": "A list of all available Substrate networks and their applicable prefixes", "main": "index.js", "module": "index.mjs", @@ -16,7 +16,7 @@ "@babel/runtime": "^7.12.5" }, "devDependencies": { - "@polkadot/util": "5.2.1", - "@polkadot/x-fetch": "5.2.1" + "@polkadot/util": "5.2.2", + "@polkadot/x-fetch": "5.2.2" } } diff --git a/packages/networks/src/index.spec.ts b/packages/networks/src/index.spec.ts index 21d61958b..88aaa80a2 100644 --- a/packages/networks/src/index.spec.ts +++ b/packages/networks/src/index.spec.ts @@ -1,10 +1,14 @@ // Copyright 2017-2020 @polkadot/networks authors & contributors // SPDX-License-Identifier: Apache-2.0 -import filtered from './'; +import filtered, { available } from '.'; describe('filtered', (): void => { it('has the correct starting order', (): void => { expect(filtered.slice(0, 3).map(({ prefix }) => prefix)).toEqual([0, 2, 42]); }); + + it('has no ignored networks', (): void => { + expect(available.some(({ isIgnored }) => isIgnored)).toEqual(false); + }); }); diff --git a/packages/networks/src/index.ts b/packages/networks/src/index.ts index c37402e3c..4602470a7 100644 --- a/packages/networks/src/index.ts +++ b/packages/networks/src/index.ts @@ -19,6 +19,7 @@ const UNSORTED = [0, 2, 42]; const createReserved = (prefix: number, displayName = 'This prefix is reserved.'): NetworkFromSubstrate => ({ decimals: null, displayName, + isIgnored: true, network: `reserved${prefix}`, prefix, standardAccount: null, @@ -215,7 +216,7 @@ const all: NetworkFromSubstrate[] = [ { decimals: [6], displayName: 'Dock Testnet', - genesisHash: ['0x3f0608444cf5d7eec977430483ffef31ff86dfa6bfc6d7114023ee80cc03ea3f'], + isIgnored: true, // testnet network: 'dock-testnet', prefix: 21, standardAccount: '*25519', @@ -253,6 +254,7 @@ const all: NetworkFromSubstrate[] = [ { decimals: [18], displayName: 'ZERO Alphaville', + isIgnored: true, // testnet network: 'zero-alphaville', prefix: 25, standardAccount: '*25519', @@ -344,6 +346,7 @@ const all: NetworkFromSubstrate[] = [ { decimals: [18], displayName: 'MathChain testnet', + isIgnored: true, // testnet network: 'mathchain-testnet', prefix: 40, standardAccount: '*25519', @@ -384,11 +387,12 @@ const all: NetworkFromSubstrate[] = [ ]; // The list of available/claimed prefixes +// - no testnets // - we only include those where we have a standardAccount // - when no icon has been specified, default to substrate // - sort by name, however we keep 0, 2, 42 first in the list const available: Network[] = all - .filter((n) => n.standardAccount === '*25519') + .filter((n) => !n.isIgnored) .map((n) => ({ ...n, genesisHash: n.genesisHash || [], icon: n.icon || 'substrate' })) .sort((a, b) => UNSORTED.includes(a.prefix) && UNSORTED.includes(b.prefix) diff --git a/packages/networks/src/types.ts b/packages/networks/src/types.ts index 08d64e6c0..e1d3f55d2 100644 --- a/packages/networks/src/types.ts +++ b/packages/networks/src/types.ts @@ -10,6 +10,7 @@ export interface NetworkFromSubstrate { prefix: number; genesisHash?: string[] | null; icon?: Icon | null; + isIgnored?: boolean; standardAccount: '*25519' | null; symbols: string[] | null; website: string | null; diff --git a/packages/util-crypto/package.json b/packages/util-crypto/package.json index 62a83b93e..6e21c7fbe 100644 --- a/packages/util-crypto/package.json +++ b/packages/util-crypto/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util-crypto", - "version": "5.2.1", + "version": "5.2.2", "description": "A collection of useful crypto utilities for @polkadot", "main": "index.js", "module": "index.mjs", @@ -17,10 +17,10 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme", "dependencies": { "@babel/runtime": "^7.12.5", - "@polkadot/networks": "5.2.1", - "@polkadot/util": "5.2.1", + "@polkadot/networks": "5.2.2", + "@polkadot/util": "5.2.2", "@polkadot/wasm-crypto": "^3.1.1", - "@polkadot/x-randomvalues": "5.2.1", + "@polkadot/x-randomvalues": "5.2.2", "base-x": "^3.0.8", "blakejs": "^1.1.0", "bn.js": "^4.11.9", @@ -40,6 +40,6 @@ "@types/xxhashjs": "^0.2.2" }, "peerDependencies": { - "@polkadot/util": "5.2.1" + "@polkadot/util": "5.2.2" } } diff --git a/packages/util/package.json b/packages/util/package.json index 26d608bed..0b61bec2b 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/util", - "version": "5.2.1", + "version": "5.2.2", "description": "A collection of useful utilities for @polkadot", "main": "index.js", "module": "index.mjs", @@ -14,8 +14,8 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/util#readme", "dependencies": { "@babel/runtime": "^7.12.5", - "@polkadot/x-textdecoder": "5.2.1", - "@polkadot/x-textencoder": "5.2.1", + "@polkadot/x-textdecoder": "5.2.2", + "@polkadot/x-textencoder": "5.2.2", "@types/bn.js": "^4.11.6", "bn.js": "^4.11.9", "camelcase": "^5.3.1", diff --git a/packages/x-fetch/package.json b/packages/x-fetch/package.json index 3a4f9d2f7..f84bd385d 100644 --- a/packages/x-fetch/package.json +++ b/packages/x-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-fetch", - "version": "5.2.1", + "version": "5.2.2", "description": "A cross-environment fetch replacement", "browser": "browser.js", "main": "node.js", diff --git a/packages/x-randomvalues/package.json b/packages/x-randomvalues/package.json index c95478038..f8c31a41c 100644 --- a/packages/x-randomvalues/package.json +++ b/packages/x-randomvalues/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-randomvalues", - "version": "5.2.1", + "version": "5.2.2", "description": "A cross-environment window.crypto.getRandomValues replacement", "browser": "browser.js", "main": "node.js", diff --git a/packages/x-textdecoder/package.json b/packages/x-textdecoder/package.json index 4d0bee4db..52487bf06 100644 --- a/packages/x-textdecoder/package.json +++ b/packages/x-textdecoder/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-textdecoder", - "version": "5.2.1", + "version": "5.2.2", "description": "A TextDecoder replacement", "browser": "browser.js", "main": "node.js", diff --git a/packages/x-textencoder/package.json b/packages/x-textencoder/package.json index d0a9519d1..c156808b9 100644 --- a/packages/x-textencoder/package.json +++ b/packages/x-textencoder/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-textencoder", - "version": "5.2.1", + "version": "5.2.2", "description": "A TextDecoder replacement", "browser": "browser.js", "main": "node.js", diff --git a/packages/x-ws/package.json b/packages/x-ws/package.json index 72e62554f..8c9f20933 100644 --- a/packages/x-ws/package.json +++ b/packages/x-ws/package.json @@ -1,6 +1,6 @@ { "name": "@polkadot/x-ws", - "version": "5.2.1", + "version": "5.2.2", "description": "A cross-environment WebSocket replacement", "browser": "browser.js", "main": "node.js", diff --git a/yarn.lock b/yarn.lock index d3a478463..d8ae4a9c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1784,21 +1784,21 @@ __metadata: resolution: "@polkadot/keyring@workspace:packages/keyring" dependencies: "@babel/runtime": ^7.12.5 - "@polkadot/util": 5.2.1 - "@polkadot/util-crypto": 5.2.1 + "@polkadot/util": 5.2.2 + "@polkadot/util-crypto": 5.2.2 peerDependencies: - "@polkadot/util": 5.2.1 - "@polkadot/util-crypto": 5.2.1 + "@polkadot/util": 5.2.2 + "@polkadot/util-crypto": 5.2.2 languageName: unknown linkType: soft -"@polkadot/networks@5.2.1, @polkadot/networks@workspace:packages/networks": +"@polkadot/networks@5.2.2, @polkadot/networks@workspace:packages/networks": version: 0.0.0-use.local resolution: "@polkadot/networks@workspace:packages/networks" dependencies: "@babel/runtime": ^7.12.5 - "@polkadot/util": 5.2.1 - "@polkadot/x-fetch": 5.2.1 + "@polkadot/util": 5.2.2 + "@polkadot/x-fetch": 5.2.2 languageName: unknown linkType: soft @@ -1811,15 +1811,15 @@ __metadata: languageName: node linkType: hard -"@polkadot/util-crypto@5.2.1, @polkadot/util-crypto@workspace:packages/util-crypto": +"@polkadot/util-crypto@5.2.2, @polkadot/util-crypto@workspace:packages/util-crypto": version: 0.0.0-use.local resolution: "@polkadot/util-crypto@workspace:packages/util-crypto" dependencies: "@babel/runtime": ^7.12.5 - "@polkadot/networks": 5.2.1 - "@polkadot/util": 5.2.1 + "@polkadot/networks": 5.2.2 + "@polkadot/util": 5.2.2 "@polkadot/wasm-crypto": ^3.1.1 - "@polkadot/x-randomvalues": 5.2.1 + "@polkadot/x-randomvalues": 5.2.2 "@types/bn.js": ^4.11.6 "@types/create-hash": ^1.2.2 "@types/elliptic": ^6.4.12 @@ -1836,17 +1836,17 @@ __metadata: tweetnacl: ^1.0.3 xxhashjs: ^0.2.2 peerDependencies: - "@polkadot/util": 5.2.1 + "@polkadot/util": 5.2.2 languageName: unknown linkType: soft -"@polkadot/util@5.2.1, @polkadot/util@workspace:packages/util": +"@polkadot/util@5.2.2, @polkadot/util@workspace:packages/util": version: 0.0.0-use.local resolution: "@polkadot/util@workspace:packages/util" dependencies: "@babel/runtime": ^7.12.5 - "@polkadot/x-textdecoder": 5.2.1 - "@polkadot/x-textencoder": 5.2.1 + "@polkadot/x-textdecoder": 5.2.2 + "@polkadot/x-textencoder": 5.2.2 "@types/bn.js": ^4.11.6 bn.js: ^4.11.9 camelcase: ^5.3.1 @@ -1886,7 +1886,7 @@ __metadata: languageName: node linkType: hard -"@polkadot/x-fetch@5.2.1, @polkadot/x-fetch@workspace:packages/x-fetch": +"@polkadot/x-fetch@5.2.2, @polkadot/x-fetch@workspace:packages/x-fetch": version: 0.0.0-use.local resolution: "@polkadot/x-fetch@workspace:packages/x-fetch" dependencies: @@ -1896,7 +1896,7 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/x-randomvalues@5.2.1, @polkadot/x-randomvalues@workspace:packages/x-randomvalues": +"@polkadot/x-randomvalues@5.2.2, @polkadot/x-randomvalues@workspace:packages/x-randomvalues": version: 0.0.0-use.local resolution: "@polkadot/x-randomvalues@workspace:packages/x-randomvalues" dependencies: @@ -1905,7 +1905,7 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/x-textdecoder@5.2.1, @polkadot/x-textdecoder@workspace:packages/x-textdecoder": +"@polkadot/x-textdecoder@5.2.2, @polkadot/x-textdecoder@workspace:packages/x-textdecoder": version: 0.0.0-use.local resolution: "@polkadot/x-textdecoder@workspace:packages/x-textdecoder" dependencies: @@ -1913,7 +1913,7 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/x-textencoder@5.2.1, @polkadot/x-textencoder@workspace:packages/x-textencoder": +"@polkadot/x-textencoder@5.2.2, @polkadot/x-textencoder@workspace:packages/x-textencoder": version: 0.0.0-use.local resolution: "@polkadot/x-textencoder@workspace:packages/x-textencoder" dependencies: