Sync with paritytech/ss58-registry (#1138)

* Sync with paritytech/ss58-registry

* Since registry location

* Adjust defaults with json location

* Adjust

* Adjust comments

* prefix 42
This commit is contained in:
Jaco
2021-10-23 12:34:53 +03:00
committed by GitHub
parent 6982380aff
commit 2cdaf71c4b
8 changed files with 68 additions and 28 deletions
+15 -5
View File
@@ -4,7 +4,11 @@
import fs from 'fs';
import fetch from 'node-fetch';
const SUBSTRATE_REGISTRY = 'https://raw.githubusercontent.com/paritytech/substrate/master/ss58-registry.json';
import { substrateRegistry } from '../build/defaults.js';
const substrateRegistryRepo = substrateRegistry
.replace('raw.githubusercontent.com', 'github.com')
.split('main')[0];
function outputField (k, v) {
if (typeof v === 'string') {
@@ -20,7 +24,7 @@ function outputField (k, v) {
}
async function getSubstrateRegistry () {
const original = await fetch(SUBSTRATE_REGISTRY);
const original = await fetch(substrateRegistry);
const json = await original.json();
return json.registry
@@ -39,11 +43,17 @@ getSubstrateRegistry()
fs.writeFileSync('packages/networks/src/substrate.ts', `// Copyright 2017-2021 @polkadot/networks authors & contributors
// SPDX-License-Identifier: Apache-2.0
//
// Auto-generated by yarn networks:sync (via scripts/fromSubstrate.mjs)
//
// Do not edit, rather
// - make a PR to the upstream registry as per ${SUBSTRATE_REGISTRY}
// - yarn networks:sync
// This file should never be edited manually. Rather the process is as follow -
//
// - make a PR to the upstream registry found at ${substrateRegistryRepo}
// - ensure the PR gets merged
// - yarn networks:sync in this repo to sync
//
// Any manual changes to this file will make CI cron checks fail and will be
// lost when the registry is updated alongside the above sync.
//
import type { KnownSubstrate } from './types';