Bump dev deps (#5647)

* Bump dev deps

* Adjust

* Actual bump, fix tsconfig for typegen
This commit is contained in:
Jaco
2023-05-18 08:42:41 +03:00
committed by GitHub
parent dd0bd21d88
commit 8394c71cfa
34 changed files with 220 additions and 238 deletions
+9 -3
View File
@@ -5,7 +5,6 @@ import fs from 'node:fs';
import { fetch } from '@polkadot/x-fetch';
const META = 14;
const PREAMBLE = `// Copyright 2017-2023 @polkadot/types-support authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable */\n\n`;
const CMD = {
kusama: `${PREAMBLE}// cargo run --release -- purge-chain -y --chain kusama-dev && cargo run --release -- --chain kusama-dev --alice --force-authoring\n\nexport default`,
@@ -15,6 +14,11 @@ const CMD = {
let requestId = 0;
/**
*
* @param {'rpc_methods' | 'state_getMetadata' | 'state_getRuntimeVersion'} method
* @returns {Promise<any>}
*/
async function get (method) {
const res = await fetch('http://127.0.0.1:9944', {
body: JSON.stringify({
@@ -34,6 +38,7 @@ async function get (method) {
return body.result;
}
/** @type {[string[], string, { specName: 'polkadot' | 'kusama' | 'node'; specVersion: string; }]} */
const [methods, metadata, version] = await Promise.all([
get('rpc_methods'),
get('state_getMetadata'),
@@ -42,10 +47,11 @@ const [methods, metadata, version] = await Promise.all([
const chain = version.specName === 'node'
? 'substrate'
: version.specName;
const path = `packages/types-support/src/metadata/v${META}/${chain}`;
const metaVer = parseInt(metadata.substring(10, 12), 16);
const path = `packages/types-support/src/metadata/v${metaVer}/${chain}`;
fs.writeFileSync(`${path}-hex.ts`, `${CMD[chain]} '${metadata}';\n`);
fs.writeFileSync(`${path}-rpc.ts`, `${CMD[chain]} ${JSON.stringify(methods, null, 2)};\n`);
fs.writeFileSync(`${path}-ver.ts`, `${CMD[chain]} ${JSON.stringify(version, null, 2)};\n`);
console.log(`Done. ${chain}/${version.specVersion}`);
console.log(`Retrieved ${chain}/${version.specVersion}, metadata v${metaVer}`);