Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot/networks

Package Overview
Dependencies
Maintainers
2
Versions
751
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/networks - npm Package Compare versions

Comparing version 4.2.2-8 to 4.2.2-9

85

esm/crosscheck.spec.js

@@ -0,1 +1,2 @@

import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
// Copyright 2017-2020 @polkadot/networks authors & contributors

@@ -6,11 +7,8 @@ // SPDX-License-Identifier: Apache-2.0

import { all } from "./index.js";
const ORIGINAL = 'https://raw.githubusercontent.com/paritytech/substrate/master/ss58-registry.json';
const OUTPUT = './.github/ss58-check.md';
var ORIGINAL = 'https://raw.githubusercontent.com/paritytech/substrate/master/ss58-registry.json';
var OUTPUT = './.github/ss58-check.md';
function assertAndLog(check, error) {
if (!check) {
process.env.CI_LOG && fs.appendFileSync(OUTPUT, `
${error}
`);
process.env.CI_LOG && fs.appendFileSync(OUTPUT, "\n\n".concat(error, "\n"));
throw new Error(error);

@@ -21,39 +19,60 @@ }

describe('check latest Substrate ss58 registry', () => {
let original;
beforeAll(async () => {
original = await (await fetch(ORIGINAL)).json();
});
var original;
beforeAll( /*#__PURE__*/_asyncToGenerator(function* () {
original = yield (yield fetch(ORIGINAL)).json();
}));
it('has the same number as the original', () => {
assertAndLog(all.length === original.registry.length, `Number of entries mismatched:: Expected ${original.registry.length} found ${all.length}`);
assertAndLog(all.length === original.registry.length, "Number of entries mismatched:: Expected ".concat(original.registry.length, " found ").concat(all.length));
});
it('has no missing any entries', () => {
const missing = original.registry.filter(({
prefix
}) => !all.some(n => n.prefix === prefix)).map(({
displayName,
prefix
}) => `${displayName} (${prefix})`);
assertAndLog(!missing.length, `Missing entries found: ${JSON.stringify(missing, null, 2)}`);
var missing = original.registry.filter((_ref2) => {
var {
prefix
} = _ref2;
return !all.some(n => n.prefix === prefix);
}).map((_ref3) => {
var {
displayName,
prefix
} = _ref3;
return "".concat(displayName, " (").concat(prefix, ")");
});
assertAndLog(!missing.length, "Missing entries found: ".concat(JSON.stringify(missing, null, 2)));
});
it('has no extra entries', () => {
const missing = all.filter(({
prefix
}) => !original.registry.some(n => n.prefix === prefix)).map(({
displayName,
prefix
}) => `${displayName} (${prefix})`);
assertAndLog(!missing.length, `Extra entries found: ${JSON.stringify(missing, null, 2)}`);
var missing = all.filter((_ref4) => {
var {
prefix
} = _ref4;
return !original.registry.some(n => n.prefix === prefix);
}).map((_ref5) => {
var {
displayName,
prefix
} = _ref5;
return "".concat(displayName, " (").concat(prefix, ")");
});
assertAndLog(!missing.length, "Extra entries found: ".concat(JSON.stringify(missing, null, 2)));
});
it('has the same values as the original', () => {
const fields = Object.keys(original.schema);
const errors = original.registry.map(n => {
const other = all.find(({
prefix
}) => prefix === n.prefix);
return [`${n.displayName} (${n.prefix})`, other // eslint-disable-next-line @typescript-eslint/ban-ts-comment
var fields = Object.keys(original.schema);
var errors = original.registry.map(n => {
var other = all.find((_ref6) => {
var {
prefix
} = _ref6;
return prefix === n.prefix;
});
return ["".concat(n.displayName, " (").concat(n.prefix, ")"), other // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
? fields.filter(f => JSON.stringify(n[f]) !== JSON.stringify(other[f])) : []];
}).filter(([, fields]) => fields.length);
assertAndLog(!errors.length, `Mismatches found: ${JSON.stringify(errors.map(([name, m]) => `${name}:: ${m.join(', ')}`), null, 2)}`);
}).filter((_ref7) => {
var [, fields] = _ref7;
return fields.length;
});
assertAndLog(!errors.length, "Mismatches found: ".concat(JSON.stringify(errors.map((_ref8) => {
var [name, m] = _ref8;
return "".concat(name, ":: ").concat(m.join(', '));
}), null, 2)));
});
});

@@ -1,2 +0,2 @@

import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

@@ -14,3 +14,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

// These are known prefixes that are not sorted
const UNSORTED = [0, 2, 42]; // NOTE: In the case where the network was hard-spooned and multiple genesisHashes
var UNSORTED = [0, 2, 42]; // NOTE: In the case where the network was hard-spooned and multiple genesisHashes
// are provided, it needs to be in reverse order, i.e. most-recent first, oldest

@@ -20,13 +20,16 @@ // last. This make lookups for the current a simple genesisHash[0]

const createReserved = (prefix, displayName = 'This prefix is reserved.') => ({
decimals: null,
displayName,
network: `reserved${prefix}`,
prefix,
standardAccount: null,
symbols: null,
website: null
});
var createReserved = function createReserved(prefix) {
var displayName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'This prefix is reserved.';
return {
decimals: null,
displayName,
network: "reserved".concat(prefix),
prefix,
standardAccount: null,
symbols: null,
website: null
};
};
const all = [{
var all = [{
decimals: [10],

@@ -322,3 +325,3 @@ displayName: 'Polkadot Relay Chain',

const available = all.filter(n => n.standardAccount === '*25519').map(n => _objectSpread(_objectSpread({}, n), {}, {
var available = all.filter(n => n.standardAccount === '*25519').map(n => _objectSpread(_objectSpread({}, n), {}, {
genesisHash: n.genesisHash || [],

@@ -328,4 +331,4 @@ icon: n.icon || 'substrate'

const filtered = available.filter(n => n.genesisHash.length || n.prefix === 42);
var filtered = available.filter(n => n.genesisHash.length || n.prefix === 42);
export { all, available };
export default filtered;

@@ -6,6 +6,9 @@ // Copyright 2017-2020 @polkadot/networks authors & contributors

it('has the correct starting order', () => {
expect(filtered.slice(0, 3).map(({
prefix
}) => prefix)).toEqual([0, 2, 42]);
expect(filtered.slice(0, 3).map((_ref) => {
var {
prefix
} = _ref;
return prefix;
})).toEqual([0, 2, 42]);
});
});

@@ -9,3 +9,3 @@ {

"type": "module",
"version": "4.2.2-8"
"version": "4.2.2-9"
}
{
"name": "@polkadot/networks",
"version": "4.2.2-8",
"version": "4.2.2-9",
"description": "A list of all available Substrate networks and their applicable prefixes",

@@ -22,5 +22,5 @@ "main": "index.js",

"devDependencies": {
"@polkadot/util": "4.2.2-8",
"@polkadot/x-fetch": "4.2.2-8"
"@polkadot/util": "4.2.2-9",
"@polkadot/x-fetch": "4.2.2-9"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc