From 0e26da74126250981c27679b7b9e71c208a92b68 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Fri, 24 Mar 2023 15:06:28 +0200 Subject: [PATCH 01/46] cleanup --- packages/cli/src/commands/contract/compile.ts | 13 +++++++------ packages/cli/src/commands/contract/test.ts | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/commands/contract/compile.ts b/packages/cli/src/commands/contract/compile.ts index c8e6835c..ef75a6e8 100644 --- a/packages/cli/src/commands/contract/compile.ts +++ b/packages/cli/src/commands/contract/compile.ts @@ -9,7 +9,7 @@ import { Spinner, generateTypesFor, } from "@astar-network/swanky-core"; -import { writeJSON, readdirSync, existsSync } from "fs-extra"; +import { writeJSON, existsSync } from "fs-extra"; export class CompileContract extends Command { static description = "Compile the smart contract(s) in your contracts directory"; @@ -23,13 +23,14 @@ export class CompileContract extends Command { release: Flags.boolean({ default: false, char: "r", - description: "A production contract should always be build in `release` mode for building optimized wasm" + description: + "A production contract should always be build in `release` mode for building optimized wasm", }), all: Flags.boolean({ default: false, char: "a", - description: "Set all to true to compile all contracts" - }) + description: "Set all to true to compile all contracts", + }), }; static args = { @@ -45,7 +46,7 @@ export class CompileContract extends Command { const { args, flags } = await this.parse(CompileContract); if (args.contractName === undefined && !flags.all) { - this.error("No contracts were selected to compile") + this.error("No contracts were selected to compile"); } await ensureSwankyProject(); @@ -90,7 +91,7 @@ export class CompileContract extends Command { }); }, `Compiling ${contractName} contract`, - `${contractName} Contract compiled successfully`, + `${contractName} Contract compiled successfully` ); await spinner.runCommand( diff --git a/packages/cli/src/commands/contract/test.ts b/packages/cli/src/commands/contract/test.ts index 25e47a77..8ed0ee2f 100644 --- a/packages/cli/src/commands/contract/test.ts +++ b/packages/cli/src/commands/contract/test.ts @@ -4,7 +4,7 @@ import path = require("node:path"); import { ensureSwankyProject, getSwankyConfig } from "@astar-network/swanky-core"; import globby from "globby"; import Mocha from "mocha"; -import { ensureDir, readdirSync } from "fs-extra"; +import { ensureDir } from "fs-extra"; import * as shell from "shelljs"; declare global { From 0189647ccc21cc57130c015085241866fa110678 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 27 Mar 2023 10:42:01 +0300 Subject: [PATCH 02/46] remove timestamp from compile step --- packages/core/src/lib/command-utils.ts | 104 +++++++++++++------------ 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/packages/core/src/lib/command-utils.ts b/packages/core/src/lib/command-utils.ts index d1c5c1eb..3934049e 100644 --- a/packages/core/src/lib/command-utils.ts +++ b/packages/core/src/lib/command-utils.ts @@ -48,17 +48,14 @@ export function resolveNetworkUrl(config: SwankyConfig, networkName: string): st export function getBuildCommandFor( language: ContractData["language"], contractPath: string, - release: boolean, -) : ChildProcessWithoutNullStreams { + release: boolean +): ChildProcessWithoutNullStreams { if (language === "ink") { - const args = ["contract", "build", "--manifest-path", `${contractPath}/Cargo.toml`] + const args = ["contract", "build", "--manifest-path", `${contractPath}/Cargo.toml`]; if (release) { - args.push("--release") + args.push("--release"); } - return spawn( - "cargo", - args - ) + return spawn("cargo", args); } if (language === "ask") { const args = ["asc", "--config", `${contractPath}/asconfig.json`, `${contractPath}/index.ts`]; @@ -66,11 +63,9 @@ export function getBuildCommandFor( args.push("-O"); args.push("--noAssert"); } - return spawn( - "npx", - args, - { env: { ...process.env, ASK_CONFIG: `${contractPath}/askconfig.json` } } - ); + return spawn("npx", args, { + env: { ...process.env, ASK_CONFIG: `${contractPath}/askconfig.json` }, + }); } throw new Error("Unsupported language!"); } @@ -85,54 +80,59 @@ export async function generateTypesFor( await Promise.all([ fs.copyFile( path.resolve(contractPath, "target", "ink", `${contractName}.contract`), - path.resolve(ARTIFACTS_PATH, `${contractName}.contract`), + path.resolve(ARTIFACTS_PATH, `${contractName}.contract`) ), fs.copyFile( path.resolve(contractPath, "target", "ink", `${contractName}.json`), - path.resolve(ARTIFACTS_PATH, `${contractName}.json`), - ) - ]) + path.resolve(ARTIFACTS_PATH, `${contractName}.json`) + ), + ]); } else if (language === "ask") { await Promise.all([ fs.copyFile( path.resolve(contractPath, "build", `${contractName}.wasm`), - path.resolve(ARTIFACTS_PATH, `${contractName}.wasm`), + path.resolve(ARTIFACTS_PATH, `${contractName}.wasm`) ), fs.copyFile( path.resolve(contractPath, "build", "metadata.json"), - path.resolve(ARTIFACTS_PATH, `${contractName}.json`), + path.resolve(ARTIFACTS_PATH, `${contractName}.json`) ), - ]) + ]); // Ask! build artifacts don't have `.contract` file which is just an combination of abi json and wasm blob // `.contract` will have .source.wasm field whose value is wasm blob hex representation. // If Ask! officially support .contract file, no need for this step. - const contract = JSON.parse(Files.readFileSync(path.resolve(ARTIFACTS_PATH, `${contractName}.json`)).toString()); + const contract = JSON.parse( + Files.readFileSync(path.resolve(ARTIFACTS_PATH, `${contractName}.json`)).toString() + ); const wasmBuf = Files.readFileSync(path.resolve(contractPath, "build", `${contractName}.wasm`)); - const prefix = "0x" + const prefix = "0x"; contract.source.wasm = prefix + wasmBuf.toString("hex"); - fs.writeFileSync(path.resolve(ARTIFACTS_PATH, `${contractName}.contract`), JSON.stringify(contract)); + fs.writeFileSync( + path.resolve(ARTIFACTS_PATH, `${contractName}.contract`), + JSON.stringify(contract) + ); fs.remove(path.resolve(ARTIFACTS_PATH, `${contractName}.wasm`)); } else { throw new Error("Unsupported language!"); } - await generateTypes(ARTIFACTS_PATH, TYPED_CONTRACT_PATH) + await generateTypes(ARTIFACTS_PATH, TYPED_CONTRACT_PATH); } -export async function moveArtifacts( - contractName: string, -): Promise { +export async function moveArtifacts(contractName: string): Promise { + const contractArtifactsPath = path.resolve(ARTIFACTS_PATH, contractName); + + // emptyDir also creates the directory if it doesn't exist + await fs.emptyDir(contractArtifactsPath); + const ts = Date.now(); - const fullPath = path.resolve(ARTIFACTS_PATH, contractName, ts.toString()); - const relativePath = path.relative(path.resolve(), fullPath); + const relativePath = path.relative(path.resolve(), contractArtifactsPath); const buildData = { - timestamp: ts, artifactsPath: relativePath, + timestamp: ts, }; - await fs.ensureDir(buildData.artifactsPath); - // copy artifacts/contract_name.contract and .json to artifactsPath .contract and .json try { await Promise.all([ @@ -147,9 +147,9 @@ export async function moveArtifacts( ]); // move both to test/contract_name/artifacts const testArtifacts = path.resolve("test", contractName, "artifacts"); - const testTypedContracts = path.resolve("test", contractName, "typedContract") + const testTypedContracts = path.resolve("test", contractName, "typedContract"); await fs.ensureDir(testArtifacts); - await fs.ensureDir(testTypedContracts) + await fs.ensureDir(testTypedContracts); await Promise.all([ fs.move( path.resolve(ARTIFACTS_PATH, `${contractName}.contract`), @@ -173,7 +173,7 @@ export async function moveArtifacts( } export async function printContractInfo(metadataPath: string) { - const abi = new Abi((await fs.readJson(metadataPath))); + const abi = new Abi(await fs.readJson(metadataPath)); // TODO: Use templating, colorize. @@ -183,34 +183,42 @@ export async function printContractInfo(metadataPath: string) { Hash: ${abi.info.source.hash} Language: ${abi.info.source.language} Compiler: ${abi.info.source.compiler} - `) + `); - console.log(` === Constructors ===\n`) + console.log(` === Constructors ===\n`); for (const constructor of abi.constructors) { console.log(` * ${constructor.method}: - Args: ${constructor.args.length > 0 ? constructor.args.map((arg) => { - return `\n - ${arg.name} (${arg.type.displayName})` - }) : "None"} + Args: ${ + constructor.args.length > 0 + ? constructor.args.map((arg) => { + return `\n - ${arg.name} (${arg.type.displayName})`; + }) + : "None" + } Description: ${constructor.docs.map((line) => { if (line != "") { - return `\n ` + line + return `\n ` + line; } })} - `) + `); } - console.log(` === Messages ===\n`) + console.log(` === Messages ===\n`); for (const message of abi.messages) { console.log(` * ${message.method}: Payable: ${message.isPayable} - Args: ${message.args.length > 0 ? message.args.map((arg) => { - return `\n - ${arg.name} (${arg.type.displayName})` - }) : "None"} + Args: ${ + message.args.length > 0 + ? message.args.map((arg) => { + return `\n - ${arg.name} (${arg.type.displayName})`; + }) + : "None" + } Description: ${message.docs.map((line) => { if (line != "") { - return `\n ` + line + return `\n ` + line; } })} - `) + `); } } From 37644c7b1f635f73b91bca42058367524d7699e9 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 27 Mar 2023 15:32:08 +0300 Subject: [PATCH 03/46] cleanup --- packages/core/src/lib/command-utils.ts | 3 +-- packages/core/src/lib/tasks.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/core/src/lib/command-utils.ts b/packages/core/src/lib/command-utils.ts index 3934049e..ebd9843f 100644 --- a/packages/core/src/lib/command-utils.ts +++ b/packages/core/src/lib/command-utils.ts @@ -126,11 +126,10 @@ export async function moveArtifacts(contractName: string): Promise { // emptyDir also creates the directory if it doesn't exist await fs.emptyDir(contractArtifactsPath); - const ts = Date.now(); const relativePath = path.relative(path.resolve(), contractArtifactsPath); const buildData = { artifactsPath: relativePath, - timestamp: ts, + timestamp: Date.now(), }; // copy artifacts/contract_name.contract and .json to artifactsPath .contract and .json diff --git a/packages/core/src/lib/tasks.ts b/packages/core/src/lib/tasks.ts index 279527d6..d1bf33a4 100644 --- a/packages/core/src/lib/tasks.ts +++ b/packages/core/src/lib/tasks.ts @@ -1,5 +1,5 @@ import execa from "execa"; -import { ensureDir, rename, copy, readFile, rm, writeFile, remove, pathExists } from "fs-extra"; +import { ensureDir, rename, copy, readFile, rm, writeFile, remove } from "fs-extra"; import path from "node:path"; import globby from "globby"; import handlebars from "handlebars"; From efe26019f7a85a5257ce55b07c38d7247024c5fc Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 27 Mar 2023 15:32:23 +0300 Subject: [PATCH 04/46] remove timestamp from test report path --- packages/cli/src/commands/contract/test.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/commands/contract/test.ts b/packages/cli/src/commands/contract/test.ts index 8ed0ee2f..61783c1b 100644 --- a/packages/cli/src/commands/contract/test.ts +++ b/packages/cli/src/commands/contract/test.ts @@ -4,7 +4,7 @@ import path = require("node:path"); import { ensureSwankyProject, getSwankyConfig } from "@astar-network/swanky-core"; import globby from "globby"; import Mocha from "mocha"; -import { ensureDir } from "fs-extra"; +import { emptyDir } from "fs-extra"; import * as shell from "shelljs"; declare global { @@ -59,13 +59,8 @@ export class TestContract extends Command { } const buildData = contractInfo.build; - const reportDir = path.resolve( - projectDir, - buildData.artifactsPath, - "testReports", - Date.now().toString() - ); - await ensureDir(reportDir); + const reportDir = path.resolve(projectDir, buildData.artifactsPath, "testReports"); + await emptyDir(reportDir); const mocha = new Mocha({ timeout: 200000, From aa5736de38b28f2bf85d0fe6ba97dc5d309ead7e Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 3 Apr 2023 09:37:20 +0300 Subject: [PATCH 05/46] init inherit BaseCommand --- packages/cli/src/commands/contract/explain.ts | 4 ++-- packages/cli/src/commands/init/index.ts | 7 ++++--- packages/cli/src/lib/baseCommand.ts | 4 ++-- packages/cli/src/lib/contractCall.ts | 4 +--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/cli/src/commands/contract/explain.ts b/packages/cli/src/commands/contract/explain.ts index 00045578..8f4f598f 100644 --- a/packages/cli/src/commands/contract/explain.ts +++ b/packages/cli/src/commands/contract/explain.ts @@ -5,8 +5,8 @@ import { readdirSync } from "node:fs"; import { printContractInfo } from "@astar-network/swanky-core"; import { Args } from "@oclif/core"; -export class ExplainContract extends BaseCommand { - static description = "Explain contract messages based on thier metadata"; +export class ExplainContract extends BaseCommand { + static description = "Explain contract messages based on the contracts' metadata"; static args = { contractName: Args.string({ diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 5e9b9336..371749ce 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -1,4 +1,4 @@ -import { Args, Command, Flags } from "@oclif/core"; +import { Args, Flags } from "@oclif/core"; import path = require("node:path"); import { ensureDir, writeJSON } from "fs-extra"; import execa = require("execa"); @@ -18,13 +18,14 @@ import { swankyNode, } from "@astar-network/swanky-core"; import { getAllTemplateNames, getTemplates } from "@astar-network/swanky-templates"; +import { BaseCommand } from "../../lib/baseCommand"; const { DEFAULT_ASTAR_NETWORK_URL, DEFAULT_NETWORK_URL, DEFAULT_SHIBUYA_NETWORK_URL, DEFAULT_SHIDEN_NETWORK_URL, } = consts; -export class Init extends Command { +export class Init extends BaseCommand { static description = "Generate a new smart contract environment"; static flags = { @@ -34,7 +35,7 @@ export class Init extends Command { char: "t", }), language: Flags.string({ options: ["ask", "ink"], char: "l" }), - verbose: Flags.boolean({ char: "v" }), + convert: Flags.boolean(), }; static args = { diff --git a/packages/cli/src/lib/baseCommand.ts b/packages/cli/src/lib/baseCommand.ts index c83aa258..f059f7d5 100644 --- a/packages/cli/src/lib/baseCommand.ts +++ b/packages/cli/src/lib/baseCommand.ts @@ -1,7 +1,7 @@ -import { Command, Flags, Interfaces } from "@oclif/core"; +import { Command, Flags } from "@oclif/core"; import { getSwankyConfig, Spinner, SwankyConfig } from "@astar-network/swanky-core"; -export abstract class BaseCommand extends Command { +export abstract class BaseCommand extends Command { protected spinner!: Spinner; protected swankyConfig!: SwankyConfig; diff --git a/packages/cli/src/lib/contractCall.ts b/packages/cli/src/lib/contractCall.ts index d5796fa3..a21a91bb 100644 --- a/packages/cli/src/lib/contractCall.ts +++ b/packages/cli/src/lib/contractCall.ts @@ -21,9 +21,7 @@ export type JoinedFlagsType = Interfaces.InferredFlags typeof BaseCommand["baseFlags"] & typeof ContractCall["baseFlags"] & T["flags"] >; -export abstract class ContractCall extends BaseCommand< - typeof ContractCall -> { +export abstract class ContractCall extends BaseCommand { static callArgs = { contractName: Args.string({ name: "Contract name", From 69fafb28534c537327fd2b71f89b30e4b8d32c13 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 3 Apr 2023 11:06:28 +0300 Subject: [PATCH 06/46] add NO_CONFIG_COMMANDS list --- packages/cli/src/lib/baseCommand.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/lib/baseCommand.ts b/packages/cli/src/lib/baseCommand.ts index f059f7d5..4366bf86 100644 --- a/packages/cli/src/lib/baseCommand.ts +++ b/packages/cli/src/lib/baseCommand.ts @@ -4,12 +4,21 @@ import { getSwankyConfig, Spinner, SwankyConfig } from "@astar-network/swanky-co export abstract class BaseCommand extends Command { protected spinner!: Spinner; protected swankyConfig!: SwankyConfig; - + static NO_CONFIG_COMMANDS = ["Init"]; public async init(): Promise { await super.init(); this.spinner = new Spinner(); - this.swankyConfig = await getSwankyConfig(); + try { + this.swankyConfig = await getSwankyConfig(); + } catch (error) { + if ( + error instanceof Error && + error.message.includes("swanky.config.json") && + !BaseCommand.NO_CONFIG_COMMANDS.includes(this.constructor.name) + ) + throw error; + } } protected async catch(err: Error & { exitCode?: number }): Promise { From 2a482c4142261b5353adb34a27ca21578efc2245 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 3 Apr 2023 11:06:38 +0300 Subject: [PATCH 07/46] take a path for convert --- packages/cli/src/commands/init/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 371749ce..439b1860 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -35,7 +35,10 @@ export class Init extends BaseCommand { char: "t", }), language: Flags.string({ options: ["ask", "ink"], char: "l" }), - convert: Flags.boolean(), + convert: Flags.string({ + char: "c", + description: "Converts an existing smart contract into a Swanky project", + }), }; static args = { From c36253ba3753b2b4ea44895e5a64458a08e99180 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 3 Apr 2023 11:24:30 +0300 Subject: [PATCH 08/46] add project dir check if empty --- packages/cli/src/commands/init/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 439b1860..bcabd31d 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -1,6 +1,6 @@ import { Args, Flags } from "@oclif/core"; import path = require("node:path"); -import { ensureDir, writeJSON } from "fs-extra"; +import { ensureDir, writeJSON, stat, readdir } from "fs-extra"; import execa = require("execa"); import { paramCase, pascalCase, snakeCase } from "change-case"; import inquirer = require("inquirer"); @@ -54,6 +54,17 @@ export class Init extends BaseCommand { const projectPath = path.resolve(args.projectName); + try { + const pathStat = await stat(projectPath); + + if (pathStat.isDirectory()) { + const files = await readdir(projectPath); + if (files.length > 0) throw new Error(`Directory ${args.projectName} is not empty!`); + } + } catch (error: unknown) { + if (error instanceof Error && !error.message.includes("ENOENT")) throw error; + } + const { contractLanguage } = await inquirer.prompt([pickLanguage()]); const templates = getTemplates(contractLanguage); From 9f9582baff1325ef29683ce402df4ea1039c9de0 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 3 Apr 2023 23:14:32 +0300 Subject: [PATCH 09/46] introduce task queue, extract generate --- packages/cli/src/commands/init/index.ts | 249 +++++++++++++++--------- 1 file changed, 157 insertions(+), 92 deletions(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index bcabd31d..eb4eaaa4 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -14,7 +14,6 @@ import { processTemplates, SwankyConfig, consts, - Spinner, swankyNode, } from "@astar-network/swanky-core"; import { getAllTemplateNames, getTemplates } from "@astar-network/swanky-templates"; @@ -25,6 +24,18 @@ const { DEFAULT_SHIBUYA_NETWORK_URL, DEFAULT_SHIDEN_NETWORK_URL, } = consts; + +type TaskFunction = (...args: any[]) => any; + +interface Task { + task: TaskFunction; + args: any[]; + runningMessage: string; + successMessage?: string; + failMessage?: string; + shouldExitOnError?: boolean; + callback?: (param: string) => void; +} export class Init extends BaseCommand { static description = "Generate a new smart contract environment"; @@ -49,22 +60,129 @@ export class Init extends BaseCommand { }), }; + projectPath = ""; + + configBuilder: Partial = { + node: { + localPath: "", + polkadotPalletVersions: swankyNode.polkadotPalletVersions, + supportedInk: swankyNode.supportedInk, + }, + accounts: [ + { + alias: "alice", + mnemonic: "//Alice", + isDev: true, + address: new ChainAccount("//Alice").pair.address, + }, + { + alias: "bob", + mnemonic: "//Bob", + isDev: true, + address: new ChainAccount("//Bob").pair.address, + }, + ], + networks: { + local: { url: DEFAULT_NETWORK_URL }, + astar: { url: DEFAULT_ASTAR_NETWORK_URL }, + shiden: { url: DEFAULT_SHIDEN_NETWORK_URL }, + shibuya: { url: DEFAULT_SHIBUYA_NETWORK_URL }, + }, + }; + + taskQueue: Task[] = []; + async run(): Promise { const { args, flags } = await this.parse(Init); - const projectPath = path.resolve(args.projectName); + this.projectPath = path.resolve(args.projectName); + // check if projectPath dir exists and is it empty try { - const pathStat = await stat(projectPath); - + const pathStat = await stat(this.projectPath); if (pathStat.isDirectory()) { - const files = await readdir(projectPath); + const files = await readdir(this.projectPath); if (files.length > 0) throw new Error(`Directory ${args.projectName} is not empty!`); } } catch (error: unknown) { - if (error instanceof Error && !error.message.includes("ENOENT")) throw error; + // ignore if it doesn't exist, it will be created + if (!(error instanceof Error) || !error.message.includes("ENOENT")) throw error; + } + + if (flags.convert) { + await this.convert(flags.convert); + } else { + await this.generate(args.projectName); } + this.taskQueue.push({ + task: installDeps, + args: [this.projectPath], + runningMessage: "Installing dependencies", + shouldExitOnError: false, + }); + + this.taskQueue.push({ + task: execa.command, + args: ["git init", { cwd: this.projectPath }], + runningMessage: "Initializing git", + }); + + if (!flags["swanky-node"]) { + const { useSwankyNode } = await inquirer.prompt([ + choice("useSwankyNode", "Do you want to download Swanky node?"), + ]); + if (useSwankyNode) { + this.taskQueue.push({ + task: downloadNode, + args: [this.projectPath, swankyNode, this.spinner], + runningMessage: "Downloading Swanky node", + callback: (result) => + this.configBuilder.node ? (this.configBuilder.node.localPath = result) : null, + }); + } + } + + Object.keys(this.configBuilder.contracts as typeof this.swankyConfig.contracts).forEach( + async (contractName) => { + await ensureDir(path.resolve(this.projectPath, "artifacts", contractName)); + await ensureDir(path.resolve(this.projectPath, "test", contractName)); + } + ); + + this.taskQueue.push({ + task: () => + writeJSON(path.resolve(this.projectPath, "swanky.config.json"), this.configBuilder, { + spaces: 2, + }), + args: [], + runningMessage: "Writing config", + }); + + for (const { + task, + args, + runningMessage, + successMessage, + failMessage, + shouldExitOnError, + callback, + } of this.taskQueue) { + const result = await this.spinner.runCommand( + () => task(...args), + runningMessage, + successMessage, + failMessage, + shouldExitOnError + ); + if (result && callback) { + callback(result as string); + } + } + this.log("🎉 😎 Swanky project successfully initialised! 😎 🎉"); + } + + async generate(projectName: string) { const { contractLanguage } = await inquirer.prompt([pickLanguage()]); const templates = getTemplates(contractLanguage); @@ -80,31 +198,31 @@ export class Init extends BaseCommand { email(), ]; - if (!flags["swanky-node"]) { - questions.push(choice("useSwankyNode", "Do you want to download Swanky node?")); - } - const answers = await inquirer.prompt(questions); - const spinner = new Spinner(flags.verbose); - - await spinner.runCommand(() => checkCliDependencies(spinner), "Checking dependencies"); - - await spinner.runCommand( - () => - copyTemplateFiles( - templates.templatesPath, - path.resolve(templates.contractTemplatesPath, answers.contractTemplate), - answers.contractName, - projectPath - ), - "Copying template files" - ); + this.taskQueue.push({ + task: checkCliDependencies, + args: [this.spinner], + runningMessage: "Checking dependencies", + }); + + this.taskQueue.push({ + task: copyTemplateFiles, + args: [ + templates.templatesPath, + path.resolve(templates.contractTemplatesPath, answers.contractTemplate), + answers.contractName, + this.projectPath, + ], + runningMessage: "Copying template files", + }); - await spinner.runCommand( - () => - processTemplates(projectPath, { - project_name: paramCase(args.projectName), + this.taskQueue.push({ + task: processTemplates, + args: [ + this.projectPath, + { + project_name: paramCase(projectName), author_name: answers.authorName, author_email: answers.email, swanky_version: this.config.pjson.version, @@ -112,74 +230,21 @@ export class Init extends BaseCommand { contract_name_snake: snakeCase(answers.contractName), contract_name_pascal: pascalCase(answers.contractName), contract_language: contractLanguage, - }), - "Processing templates" - ); - - await spinner.runCommand( - () => execa.command("git init", { cwd: projectPath }), - "Initializing git" - ); - - let nodePath = ""; - if (flags["swanky-node"] || answers.useSwankyNode) { - const taskResult = (await spinner.runCommand( - () => downloadNode(projectPath, swankyNode, spinner), - "Downloading Swanky node" - )) as string; - nodePath = path.relative(projectPath, taskResult); - } - - await ensureDir(path.resolve(projectPath, "artifacts", answers.contractName)); - await ensureDir(path.resolve(projectPath, "test", answers.contractName)); - - await spinner.runCommand( - () => installDeps(projectPath), - "Installing dependencies", - "", - "", - false - ); - - const config: SwankyConfig = { - node: { - localPath: nodePath, - polkadotPalletVersions: swankyNode.polkadotPalletVersions, - supportedInk: swankyNode.supportedInk, - }, - accounts: [ - { - alias: "alice", - mnemonic: "//Alice", - isDev: true, - address: new ChainAccount("//Alice").pair.address, - }, - { - alias: "bob", - mnemonic: "//Bob", - isDev: true, - address: new ChainAccount("//Bob").pair.address, }, ], - contracts: { - [answers.contractName as string]: { - name: answers.contractName as string, - deployments: [], - language: contractLanguage, - }, - }, - networks: { - local: { url: DEFAULT_NETWORK_URL }, - astar: { url: DEFAULT_ASTAR_NETWORK_URL }, - shiden: { url: DEFAULT_SHIDEN_NETWORK_URL }, - shibuya: { url: DEFAULT_SHIBUYA_NETWORK_URL }, + runningMessage: "Processing templates", + }); + + this.configBuilder.contracts = { + [answers.contractName as string]: { + name: answers.contractName as string, + deployments: [], + language: contractLanguage, }, }; - await spinner.runCommand( - () => writeJSON(path.resolve(projectPath, "swanky.config.json"), config, { spaces: 2 }), - "Writing config" - ); + } - this.log("🎉 😎 Swanky project successfully initialised! 😎 🎉"); + async convert(pathToProject: string) { + return; } } From 3931500cc35c6be89e16dacd3d8033497fb8af7a Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 3 Apr 2023 23:46:28 +0300 Subject: [PATCH 10/46] move test reports to test directory --- packages/cli/src/commands/contract/test.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/cli/src/commands/contract/test.ts b/packages/cli/src/commands/contract/test.ts index 61783c1b..087ccf44 100644 --- a/packages/cli/src/commands/contract/test.ts +++ b/packages/cli/src/commands/contract/test.ts @@ -40,26 +40,17 @@ export class TestContract extends Command { await ensureSwankyProject(); const config = await getSwankyConfig(); - const contractNames = []; - if (flags.all) { - for (const contractName of Object.keys(config.contracts)) { - console.log(`${contractName} contract is found`); - contractNames.push(contractName); - } - } else { - contractNames.push(args.contractName); - } + const contractNames = flags.all ? Object.keys(config.contracts) : args.contractName; - const projectDir = path.resolve(); const testDir = path.resolve("test"); for (const contractName of contractNames) { + console.log(`Testing contract: ${contractName}`); const contractInfo = config.contracts[contractName]; if (!contractInfo.build) { this.error(`Cannot find build data for ${contractName} contract in swanky.config.json`); } - const buildData = contractInfo.build; - const reportDir = path.resolve(projectDir, buildData.artifactsPath, "testReports"); + const reportDir = path.resolve(testDir, contractInfo.name, "testReports"); await emptyDir(reportDir); const mocha = new Mocha({ From 5a6ca70326ab785ccabb41acd23ecc5c7e8df5dd Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 3 Apr 2023 23:49:31 +0300 Subject: [PATCH 11/46] simplify contract name gathering --- packages/cli/src/commands/contract/compile.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/cli/src/commands/contract/compile.ts b/packages/cli/src/commands/contract/compile.ts index ef75a6e8..355c8e6d 100644 --- a/packages/cli/src/commands/contract/compile.ts +++ b/packages/cli/src/commands/contract/compile.ts @@ -52,15 +52,7 @@ export class CompileContract extends Command { await ensureSwankyProject(); const config = await getSwankyConfig(); - const contractNames = []; - if (flags.all) { - for (const contractName of Object.keys(config.contracts)) { - console.log(`${contractName} contract is found`); - contractNames.push(contractName); - } - } else { - contractNames.push(args.contractName); - } + const contractNames = flags.all ? Object.keys(config.contracts) : args.contractName; const spinner = new Spinner(); From 14dcbb3c0203feb76628e088bcff9dbed5cf4d34 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Thu, 13 Apr 2023 12:28:42 +0300 Subject: [PATCH 12/46] detect contracts from workspace in cargo.toml --- packages/cli/package.json | 1 + packages/cli/src/commands/init/index.ts | 62 +- yarn.lock | 758 ++++++++++-------------- 3 files changed, 359 insertions(+), 462 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 5c8eeb5d..80e272e5 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -32,6 +32,7 @@ "fs-extra": "10.1.0", "globby": "11", "inquirer": "8.2.5", + "js-toml": "^0.1.1", "listr2": "5.0.7", "mocha": "10.2.0", "mocha-suppress-logs": "0.3.1", diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index eb4eaaa4..8730e3d3 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -1,9 +1,10 @@ import { Args, Flags } from "@oclif/core"; import path = require("node:path"); -import { ensureDir, writeJSON, stat, readdir } from "fs-extra"; +import { ensureDir, writeJSON, stat, readdir, pathExists, readFile } from "fs-extra"; import execa = require("execa"); import { paramCase, pascalCase, snakeCase } from "change-case"; import inquirer = require("inquirer"); +import { load } from "js-toml"; import { choice, email, name, pickLanguage, pickTemplate } from "../../lib/prompts"; import { checkCliDependencies, @@ -18,6 +19,7 @@ import { } from "@astar-network/swanky-core"; import { getAllTemplateNames, getTemplates } from "@astar-network/swanky-templates"; import { BaseCommand } from "../../lib/baseCommand"; +import globby = require("globby"); const { DEFAULT_ASTAR_NETWORK_URL, DEFAULT_NETWORK_URL, @@ -111,6 +113,7 @@ export class Init extends BaseCommand { if (flags.convert) { await this.convert(flags.convert); + return; } else { await this.generate(args.projectName); } @@ -244,7 +247,60 @@ export class Init extends BaseCommand { }; } - async convert(pathToProject: string) { - return; + async convert(pathToExistingProject: string) { + try { + const pathStat = await stat(pathToExistingProject); + if (pathStat.isDirectory()) { + const files = await readdir(pathToExistingProject); + if (files.length < 1) + throw new Error(`Target project directory [${pathToExistingProject}] is empty!`); + } + } catch (error: unknown) { + if (error instanceof Error && error.message.includes("ENOENT")) + throw new Error(`Target project directory [${pathToExistingProject}] not found!`); + throw error; + } + + // 2. Look for cargo.toml with "workspace" field in the root + const rootToml = await getRootCargoToml(pathToExistingProject); + // 3a. Workspace found - use the glob in the "members field" to select directories to copy over + // 3b. workspace not found, use regex to find dir/dirs*/[cargo.toml, lib.rs] + // 3c. if not found, ask user for a path where contracts are -> [Ctrl+C to cancel] + // 4. make a list (checkbox) for user to confirm contracts to copy + // 5. add directories from Cargo.toml/exclude path to copy list + // 6. look for test/tests directory and add it to the list + // 7. copy all the selected directories/files and update the swanky.config + // 8. copy cargo.toml from the root, modify path if needed ( "uniswap-v2/contracts/**" -> "contracts/**") + // 9. keep log of all the steps and write it to file + // 10. Copy rust.toolchain and .rustfmt.toml if exists } } + +async function getRootCargoToml(targetPath: string) { + const rootTomlPath = path.resolve(targetPath, "Cargo.toml"); + + if (!(await pathExists(rootTomlPath))) return; + + const fileData = await readFile(rootTomlPath, "utf-8"); + const toml: { workspace?: { members?: string[]; exclude?: string[] } } = load(fileData); + + if (!toml.workspace?.members) return; + + const getGlobPaths = async (globList: string[]) => + globby( + globList.map((glob) => path.resolve(targetPath, glob)), + { + absolute: true, + onlyDirectories: true, + deep: 1, + objectMode: true, + } + ); + + const detectedPaths = { + contracts: await getGlobPaths(toml.workspace.members), + additionalPaths: toml.workspace.exclude ? await getGlobPaths(toml.workspace.exclude) : [], + }; + + return detectedPaths; +} diff --git a/yarn.lock b/yarn.lock index f660f39f..fa9956d0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23,13 +23,41 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/runtime@^7.20.13", "@babel/runtime@^7.20.6": +"@babel/runtime-corejs3@^7.16.5": version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673" - integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.21.0.tgz#6e4939d9d9789ff63e2dc58e88f13a3913a24eba" + integrity sha512-TDD4UJzos3JJtM+tHX+w2Uc+KWj7GV+VKKFdMVd2Rx8sdA19hcc3P3AHFYd5LVOw+pYuSd5lICC3gm52B6Rwxw== dependencies: + core-js-pure "^3.25.1" regenerator-runtime "^0.13.11" +"@chevrotain/cst-dts-gen@10.5.0": + version "10.5.0" + resolved "https://registry.yarnpkg.com/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.5.0.tgz#922ebd8cc59d97241bb01b1b17561a5c1ae0124e" + integrity sha512-lhmC/FyqQ2o7pGK4Om+hzuDrm9rhFYIJ/AXoQBeongmn870Xeb0L6oGEiuR8nohFNL5sMaQEJWCxr1oIVIVXrw== + dependencies: + "@chevrotain/gast" "10.5.0" + "@chevrotain/types" "10.5.0" + lodash "4.17.21" + +"@chevrotain/gast@10.5.0": + version "10.5.0" + resolved "https://registry.yarnpkg.com/@chevrotain/gast/-/gast-10.5.0.tgz#e4e614bc46d17a8892742f38e56cd33f1f3ad162" + integrity sha512-pXdMJ9XeDAbgOWKuD1Fldz4ieCs6+nLNmyVhe2gZVqoO7v8HXuHYs5OV2EzUtbuai37TlOAQHrTDvxMnvMJz3A== + dependencies: + "@chevrotain/types" "10.5.0" + lodash "4.17.21" + +"@chevrotain/types@10.5.0": + version "10.5.0" + resolved "https://registry.yarnpkg.com/@chevrotain/types/-/types-10.5.0.tgz#52a97d74a8cfbc197f054636d93ecd8912d33d21" + integrity sha512-f1MAia0x/pAVPWH/T73BJVyO2XU5tI4/iE7cnxb7tqdNTNhQI3Uq3XkqcoteTmD4t1aM0LbHCJOhgIDn07kl2A== + +"@chevrotain/utils@10.5.0": + version "10.5.0" + resolved "https://registry.yarnpkg.com/@chevrotain/utils/-/utils-10.5.0.tgz#0ee36f65b49b447fbac71b9e5af5c5c6c98ac057" + integrity sha512-hBzuU5+JjB2cqNZyszkDHZgOSrUUT8V3dhgRl8Q9Gp6dAj/H5+KILGjbhDpc3Iy9qmqlm/akuOI2ut9VUtzJxQ== + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -1455,100 +1483,91 @@ dependencies: esquery "^1.0.1" -"@polkadot/api-augment@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-9.14.2.tgz#2c49cdcfdf7057523db1dc8d7b0801391a8a2e69" - integrity sha512-19MmW8AHEcLkdcUIo3LLk0eCQgREWqNSxkUyOeWn7UiNMY1AhDOOwMStUBNCvrIDK6VL6GGc1sY7rkPCLMuKSw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/api-base" "9.14.2" - "@polkadot/rpc-augment" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-augment" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/api-base@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-9.14.2.tgz#605b44e3692a125bd8d97eed9cea8af9d0c454e2" - integrity sha512-ky9fmzG1Tnrjr/SBZ0aBB21l0TFr+CIyQenQczoUyVgiuxVaI/2Bp6R2SFrHhG28P+PW2/RcYhn2oIAR2Z2fZQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/rpc-core" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/util" "^10.4.2" +"@polkadot/api-augment@10.0.1", "@polkadot/api-augment@9.14.2": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-10.0.1.tgz#b8e7766e1d89e3ee753ae053e3edd21ddc0c780c" + integrity sha512-VOMkUurEZ/r27Sx5zeGACApm4wLZx5bsxo8sWxaVE1enZvob1JpzGuN12rTlMr0ej4Az8BxvlGbcT3fQYw275Q== + dependencies: + "@polkadot/api-base" "10.0.1" + "@polkadot/rpc-augment" "10.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/types-augment" "10.0.1" + "@polkadot/types-codec" "10.0.1" + "@polkadot/util" "^11.0.1" + tslib "^2.5.0" + +"@polkadot/api-base@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-10.0.1.tgz#c3f19b5ea483ba642e98724364b58c9e16ba26fe" + integrity sha512-yuCgHYQU7Tn32I4sNk5Qb/OwB85ICXCfWja95watbEP6os601IllI6s7JhFx3G4fjvfI94DzewOnOhhBHt+2SA== + dependencies: + "@polkadot/rpc-core" "10.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/util" "^11.0.1" rxjs "^7.8.0" + tslib "^2.5.0" -"@polkadot/api-contract@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-9.14.2.tgz#42ca46eecd6cef64b6c453b452bdb5d22a29b6a3" - integrity sha512-gAAHEh+tOIKuAJWxbAuB8Imo+Z8s0FHdICN6/q4JOxBhONJNA9beHB4wmqWSKvYqYmWrJvtv3HensLaITzAcrQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/api" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/types-create" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" +"@polkadot/api-contract@10.0.1", "@polkadot/api-contract@9.14.2": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-10.0.1.tgz#cc2ab107a4d78388ede7cab6018162f16e32cecb" + integrity sha512-VLMx3/2eCzuY76ExvEkxeKT0RWS4Fnsn5Shb1YumCWsLNocLO5p/XK6eRU0BaCs+X7zHD1YDF+/5tht/nhuiJA== + dependencies: + "@polkadot/api" "10.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/types-codec" "10.0.1" + "@polkadot/types-create" "10.0.1" + "@polkadot/util" "^11.0.1" + "@polkadot/util-crypto" "^11.0.1" rxjs "^7.8.0" + tslib "^2.5.0" -"@polkadot/api-derive@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-9.14.2.tgz#e8fcd4ee3f2b80b9fe34d4dec96169c3bdb4214d" - integrity sha512-yw9OXucmeggmFqBTMgza0uZwhNjPxS7MaT7lSCUIRKckl1GejdV+qMhL3XFxPFeYzXwzFpdPG11zWf+qJlalqw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/api" "9.14.2" - "@polkadot/api-augment" "9.14.2" - "@polkadot/api-base" "9.14.2" - "@polkadot/rpc-core" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" +"@polkadot/api-derive@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-10.0.1.tgz#fa62a5dc9301167fc628483a6bce65fd5f5a8adc" + integrity sha512-btiE/ATJybKqBBYQvjujXZ+WrMfzwNvKRGI84cbEYnX4OHIo47O/v+zGQ2nUhbOfcJFa8FBU6dB9fMTBRl2R5g== + dependencies: + "@polkadot/api" "10.0.1" + "@polkadot/api-augment" "10.0.1" + "@polkadot/api-base" "10.0.1" + "@polkadot/rpc-core" "10.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/types-codec" "10.0.1" + "@polkadot/util" "^11.0.1" + "@polkadot/util-crypto" "^11.0.1" rxjs "^7.8.0" + tslib "^2.5.0" -"@polkadot/api@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-9.14.2.tgz#d5cee02236654c6063d7c4b70c78c290db5aba8d" - integrity sha512-R3eYFj2JgY1zRb+OCYQxNlJXCs2FA+AU4uIEiVcXnVLmR3M55tkRNEwYAZmiFxx0pQmegGgPMc33q7TWGdw24A== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/api-augment" "9.14.2" - "@polkadot/api-base" "9.14.2" - "@polkadot/api-derive" "9.14.2" - "@polkadot/keyring" "^10.4.2" - "@polkadot/rpc-augment" "9.14.2" - "@polkadot/rpc-core" "9.14.2" - "@polkadot/rpc-provider" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-augment" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/types-create" "9.14.2" - "@polkadot/types-known" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" +"@polkadot/api@10.0.1", "@polkadot/api@9.14.2": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-10.0.1.tgz#ff3272e9f3d5d8c6d7c9e842f0a11c1c6a462265" + integrity sha512-XDJwGqtnFKWlY2kEGOCOAFhczgUxwNZ553zVbmkR65eK4gVlCwIMHLkU/rPlPf/QShrTCZXQhaS/HwIXeFHIvw== + dependencies: + "@polkadot/api-augment" "10.0.1" + "@polkadot/api-base" "10.0.1" + "@polkadot/api-derive" "10.0.1" + "@polkadot/keyring" "^11.0.1" + "@polkadot/rpc-augment" "10.0.1" + "@polkadot/rpc-core" "10.0.1" + "@polkadot/rpc-provider" "10.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/types-augment" "10.0.1" + "@polkadot/types-codec" "10.0.1" + "@polkadot/types-create" "10.0.1" + "@polkadot/types-known" "10.0.1" + "@polkadot/util" "^11.0.1" + "@polkadot/util-crypto" "^11.0.1" eventemitter3 "^5.0.0" rxjs "^7.8.0" + tslib "^2.5.0" -"@polkadot/keyring@10.4.2", "@polkadot/keyring@^10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-10.4.2.tgz#793377fdb9076df0af771df11388faa6be03c70d" - integrity sha512-7iHhJuXaHrRTG6cJDbZE9G+c1ts1dujp0qbO4RfAPmT7YUvphHvAtCKueN9UKPz5+TYDL+rP/jDEaSKU8jl/qQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/util" "10.4.2" - "@polkadot/util-crypto" "10.4.2" - -"@polkadot/networks@10.4.2", "@polkadot/networks@^10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-10.4.2.tgz#d7878c6aad8173c800a21140bfe5459261724456" - integrity sha512-FAh/znrEvWBiA/LbcT5GXHsCFUl//y9KqxLghSr/CreAmAergiJNT0MVUezC7Y36nkATgmsr4ylFwIxhVtuuCw== +"@polkadot/keyring@10.4.2", "@polkadot/keyring@11.0.1", "@polkadot/keyring@^11.0.1": + version "11.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-11.0.1.tgz#e03de854f15ae68b5797137604d5055e55412bac" + integrity sha512-ypQs9cYp/WsmHPvnv4RowbVyZTdOg8rIvcHj6Ols3sqJbQXVn9rfWZTS2l341d9z4kJtmqwbSdKAVV0GT+Mj1A== dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/util" "10.4.2" - "@substrate/ss58-registry" "^1.38.0" + "@polkadot/util" "11.0.1" + "@polkadot/util-crypto" "11.0.1" + tslib "^2.5.0" "@polkadot/networks@11.0.1": version "11.0.1" @@ -1559,129 +1578,121 @@ "@substrate/ss58-registry" "^1.39.0" tslib "^2.5.0" -"@polkadot/rpc-augment@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-9.14.2.tgz#eb70d5511463dab8d995faeb77d4edfe4952fe26" - integrity sha512-mOubRm3qbKZTbP9H01XRrfTk7k5it9WyzaWAg72DJBQBYdgPUUkGSgpPD/Srkk5/5GAQTWVWL1I2UIBKJ4TJjQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/rpc-core" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/rpc-core@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-9.14.2.tgz#26d4f00ac7abbf880f8280e9b96235880d35794b" - integrity sha512-krA/mtQ5t9nUQEsEVC1sjkttLuzN6z6gyJxK2IlpMS3S5ncy/R6w4FOpy+Q0H18Dn83JBo0p7ZtY7Y6XkK48Kw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/rpc-augment" "9.14.2" - "@polkadot/rpc-provider" "9.14.2" - "@polkadot/types" "9.14.2" - "@polkadot/util" "^10.4.2" +"@polkadot/networks@^11.0.1": + version "11.1.3" + resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-11.1.3.tgz#e113c98269328267962c2047dccca4d2790cc8a5" + integrity sha512-goLpX9SswAGGeh1jXB79wHEfWOF5rLIItMHYalujBmhQVxyAqbxP2tzQqPQXDLcnkWbgwkyYGLXaDD72GBqHZw== + dependencies: + "@polkadot/util" "11.1.3" + "@substrate/ss58-registry" "^1.39.0" + tslib "^2.5.0" + +"@polkadot/rpc-augment@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-10.0.1.tgz#f46a97543310837fd2feabc9419b9e8a6c68f9c0" + integrity sha512-DZK4V99qIhtSS9gaYL5BjsFoa5DxIunO3emxvc5V0jm3o5ZNejGDwRCZNL/atIt5tGyjosU6cYMmVvvgLuQbzg== + dependencies: + "@polkadot/rpc-core" "10.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/types-codec" "10.0.1" + "@polkadot/util" "^11.0.1" + tslib "^2.5.0" + +"@polkadot/rpc-core@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-10.0.1.tgz#f6644c9e61c4001c76db2cc5cf80443d83cef26a" + integrity sha512-HuWFttfQknSfB0Xff+svDP1rba5cwLyOhJ4EDPxz2QcyChTdOCzHBymD9GLKZJEaGp+IT4VOcUPwLDMml1TG1A== + dependencies: + "@polkadot/rpc-augment" "10.0.1" + "@polkadot/rpc-provider" "10.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/util" "^11.0.1" rxjs "^7.8.0" + tslib "^2.5.0" -"@polkadot/rpc-provider@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-9.14.2.tgz#0dea667f3a03bf530f202cba5cd360df19b32e30" - integrity sha512-YTSywjD5PF01V47Ru5tln2LlpUwJiSOdz6rlJXPpMaY53hUp7+xMU01FVAQ1bllSBNisSD1Msv/mYHq84Oai2g== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/keyring" "^10.4.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-support" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" - "@polkadot/x-fetch" "^10.4.2" - "@polkadot/x-global" "^10.4.2" - "@polkadot/x-ws" "^10.4.2" +"@polkadot/rpc-provider@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-10.0.1.tgz#ad94e2f0c357263a7ea5e1b6566f6e772ad0b38a" + integrity sha512-kv6uShbKgBZtoRcsxTVxpzkjRUqcd/cctG0lEqpy2BZU8koCnSu3XhooifcTm8jO17EUuC4Mm/wfM0DQKmojmQ== + dependencies: + "@polkadot/keyring" "^11.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/types-support" "10.0.1" + "@polkadot/util" "^11.0.1" + "@polkadot/util-crypto" "^11.0.1" + "@polkadot/x-fetch" "^11.0.1" + "@polkadot/x-global" "^11.0.1" + "@polkadot/x-ws" "^11.0.1" eventemitter3 "^5.0.0" mock-socket "^9.2.1" nock "^13.3.0" + tslib "^2.5.0" optionalDependencies: - "@substrate/connect" "0.7.19" - -"@polkadot/types-augment@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-9.14.2.tgz#1a478e18e713b04038f3e171287ee5abe908f0aa" - integrity sha512-WO9d7RJufUeY3iFgt2Wz762kOu1tjEiGBR5TT4AHtpEchVHUeosVTrN9eycC+BhleqYu52CocKz6u3qCT/jKLg== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/types-codec@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-9.14.2.tgz#d625c80495d7a68237b3d5c0a60ff10d206131fa" - integrity sha512-AJ4XF7W1no4PENLBRU955V6gDxJw0h++EN3YoDgThozZ0sj3OxyFupKgNBZcZb2V23H8JxQozzIad8k+nJbO1w== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/util" "^10.4.2" - "@polkadot/x-bigint" "^10.4.2" - -"@polkadot/types-create@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-9.14.2.tgz#aec515a2d3bc7e7b7802095cdd35ece48dc442bc" - integrity sha512-nSnKpBierlmGBQT8r6/SHf6uamBIzk4WmdMsAsR4uJKJF1PtbIqx2W5PY91xWSiMSNMzjkbCppHkwaDAMwLGaw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/types-codec" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/types-known@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-9.14.2.tgz#17fe5034a5b907bd006093a687f112b07edadf10" - integrity sha512-iM8WOCgguzJ3TLMqlm4K1gKQEwWm2zxEKT1HZZ1irs/lAbBk9MquDWDvebryiw3XsLB8xgrp3RTIBn2Q4FjB2A== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/networks" "^10.4.2" - "@polkadot/types" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/types-create" "9.14.2" - "@polkadot/util" "^10.4.2" - -"@polkadot/types-support@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-9.14.2.tgz#d25e8d4e5ec3deef914cb55fc8bc5448431ddd18" - integrity sha512-VWCOPgXDK3XtXT7wMLyIWeNDZxUbNcw/8Pn6n6vMogs7o/n4h6WGbGMeTIQhPWyn831/RmkVs5+2DUC+2LlOhw== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/util" "^10.4.2" - -"@polkadot/types@9.14.2": - version "9.14.2" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-9.14.2.tgz#5105f41eb9e8ea29938188d21497cbf1753268b8" - integrity sha512-hGLddTiJbvowhhUZJ3k+olmmBc1KAjWIQxujIUIYASih8FQ3/YJDKxaofGOzh0VygOKW3jxQBN2VZPofyDP9KQ== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/keyring" "^10.4.2" - "@polkadot/types-augment" "9.14.2" - "@polkadot/types-codec" "9.14.2" - "@polkadot/types-create" "9.14.2" - "@polkadot/util" "^10.4.2" - "@polkadot/util-crypto" "^10.4.2" - rxjs "^7.8.0" + "@substrate/connect" "0.7.20" -"@polkadot/util-crypto@10.4.2", "@polkadot/util-crypto@^10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-10.4.2.tgz#871fb69c65768bd48c57bb5c1f76a85d979fb8b5" - integrity sha512-RxZvF7C4+EF3fzQv8hZOLrYCBq5+wA+2LWv98nECkroChY3C2ZZvyWDqn8+aonNULt4dCVTWDZM0QIY6y4LUAQ== +"@polkadot/types-augment@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-10.0.1.tgz#5c3d40c2976510f893e11f6acde02d8fe0c40a8b" + integrity sha512-PK7CmZwamJiqIIuyeEfV2a1KsEKAuviTH7DkDZWb1aH8495hNkKx88JeTwotjTG6xrkaFZcEqF7UbhXCQs2zOA== dependencies: - "@babel/runtime" "^7.20.13" - "@noble/hashes" "1.2.0" - "@noble/secp256k1" "1.7.1" - "@polkadot/networks" "10.4.2" - "@polkadot/util" "10.4.2" - "@polkadot/wasm-crypto" "^6.4.1" - "@polkadot/x-bigint" "10.4.2" - "@polkadot/x-randomvalues" "10.4.2" - "@scure/base" "1.1.1" - ed2curve "^0.3.0" - tweetnacl "^1.0.3" + "@polkadot/types" "10.0.1" + "@polkadot/types-codec" "10.0.1" + "@polkadot/util" "^11.0.1" + tslib "^2.5.0" + +"@polkadot/types-codec@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-10.0.1.tgz#c9f4fd0142800fc5339de3c0d6c1611d7d0947d8" + integrity sha512-RrrEuc6PZID/VvIH+eZ6aqvpx7kjbFD58nsb/8ZQR57352EP4tVvR3arHsqh6j2WiM62uJ3zKT/rL8bCYVHjIw== + dependencies: + "@polkadot/util" "^11.0.1" + "@polkadot/x-bigint" "^11.0.1" + tslib "^2.5.0" + +"@polkadot/types-create@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-10.0.1.tgz#c94edbd181abc5b589a7807b20ccd16788eae2cd" + integrity sha512-Sr4BmswhFGj09e727XeS4nOnrvkWwWSSaXAwLenwVOCK9UaevYw+jmc28HcYypL5+i8kT4jKyU+1av7UtJyOzg== + dependencies: + "@polkadot/types-codec" "10.0.1" + "@polkadot/util" "^11.0.1" + tslib "^2.5.0" + +"@polkadot/types-known@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-10.0.1.tgz#0bbee8b8556d202549b2cacd7336122da9796492" + integrity sha512-GoHnDS1yKwLmsEQX7xjcMNR5SvaszxGV7E5Jkgl16VOF3QmO13Vs19jz1bdyv4Dw6soKFI5XAUEJY9PoA0DDMg== + dependencies: + "@polkadot/networks" "^11.0.1" + "@polkadot/types" "10.0.1" + "@polkadot/types-codec" "10.0.1" + "@polkadot/types-create" "10.0.1" + "@polkadot/util" "^11.0.1" + tslib "^2.5.0" + +"@polkadot/types-support@10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-10.0.1.tgz#301125e2e2840801e575cb969fe0cc2bb36df86a" + integrity sha512-J5i4BM08/HZGBNQhN2X29eWPS8+Ie7n6O8L0y8IZ3rS0hkXU1V2SFd9X4LO8ADPGvT3JvPpQKESsq0f/Z5UbYQ== + dependencies: + "@polkadot/util" "^11.0.1" + tslib "^2.5.0" + +"@polkadot/types@10.0.1", "@polkadot/types@9.14.2": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-10.0.1.tgz#54c636bbe6f151c5e4bc2c9220bb98bbb1fc428d" + integrity sha512-/ALKLIWulXJrK/nNEY8iXByZRwaq1uQiRzzFqwWgfGpnLVCHYljV5ZEi3QqeDjGJzywQYxqJB+bJSiUe0+iNvg== + dependencies: + "@polkadot/keyring" "^11.0.1" + "@polkadot/types-augment" "10.0.1" + "@polkadot/types-codec" "10.0.1" + "@polkadot/types-create" "10.0.1" + "@polkadot/util" "^11.0.1" + "@polkadot/util-crypto" "^11.0.1" + rxjs "^7.8.0" + tslib "^2.5.0" -"@polkadot/util-crypto@11.0.1": +"@polkadot/util-crypto@10.4.2", "@polkadot/util-crypto@11.0.1", "@polkadot/util-crypto@^11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-11.0.1.tgz#ec17ee499bf78262d1cc23963fb365aeb4ede34b" integrity sha512-IEircl43g6ZT9IqjzB1ttR7vK+/IaUar6l8yeU+Bn6x0TSS6tXyOJmXfVsXsqfLM58GIXY18mBZCTfhF/LwuKg== @@ -1698,20 +1709,7 @@ tslib "^2.5.0" tweetnacl "^1.0.3" -"@polkadot/util@10.4.2", "@polkadot/util@^10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-10.4.2.tgz#df41805cb27f46b2b4dad24c371fa2a68761baa1" - integrity sha512-0r5MGICYiaCdWnx+7Axlpvzisy/bi1wZGXgCSw5+ZTyPTOqvsYRqM2X879yxvMsGfibxzWqNzaiVjToz1jvUaA== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-bigint" "10.4.2" - "@polkadot/x-global" "10.4.2" - "@polkadot/x-textdecoder" "10.4.2" - "@polkadot/x-textencoder" "10.4.2" - "@types/bn.js" "^5.1.1" - bn.js "^5.2.1" - -"@polkadot/util@11.0.1": +"@polkadot/util@10.4.2", "@polkadot/util@11.0.1", "@polkadot/util@11.1.3", "@polkadot/util@^11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-11.0.1.tgz#04ce76339a7bd6ea2746173cbac119905330b47a" integrity sha512-IMk3hPxIGzlAW6fhOigVPMvaW0E+dTMzO1IKnEATdhAJFKjaqU4K9Pwj79fj93xgM5Y8PkHV5sUPJKuce+u+4A== @@ -1724,13 +1722,6 @@ bn.js "^5.2.1" tslib "^2.5.0" -"@polkadot/wasm-bridge@6.4.1": - version "6.4.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-6.4.1.tgz#e97915dd67ba543ec3381299c2a5b9330686e27e" - integrity sha512-QZDvz6dsUlbYsaMV5biZgZWkYH9BC5AfhT0f0/knv8+LrbAoQdP3Asbvddw8vyU9sbpuCHXrd4bDLBwUCRfrBQ== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-bridge@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-7.0.2.tgz#c906c12fa5a2ce40515c37d88a17637f467f6199" @@ -1738,13 +1729,6 @@ dependencies: tslib "^2.5.0" -"@polkadot/wasm-crypto-asmjs@6.4.1": - version "6.4.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-6.4.1.tgz#3cc76bbda5ea4a7a860982c64f9565907b312253" - integrity sha512-UxZTwuBZlnODGIQdCsE2Sn/jU0O2xrNQ/TkhRFELfkZXEXTNu4lw6NpaKq7Iey4L+wKd8h4lT3VPVkMcPBLOvA== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-crypto-asmjs@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.0.2.tgz#c7f807ee4f290c98d6b17b629f0b2cdcc4f8b186" @@ -1752,16 +1736,6 @@ dependencies: tslib "^2.5.0" -"@polkadot/wasm-crypto-init@6.4.1": - version "6.4.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-6.4.1.tgz#4d9ab0030db52cf177bf707ef8e77aa4ca721668" - integrity sha512-1ALagSi/nfkyFaH6JDYfy/QbicVbSn99K8PV9rctDUfxc7P06R7CoqbjGQ4OMPX6w1WYVPU7B4jPHGLYBlVuMw== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-bridge" "6.4.1" - "@polkadot/wasm-crypto-asmjs" "6.4.1" - "@polkadot/wasm-crypto-wasm" "6.4.1" - "@polkadot/wasm-crypto-init@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.0.2.tgz#e707c34ba6be9ee1419453eeceab2b441da7fef3" @@ -1772,14 +1746,6 @@ "@polkadot/wasm-crypto-wasm" "7.0.2" tslib "^2.5.0" -"@polkadot/wasm-crypto-wasm@6.4.1": - version "6.4.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-6.4.1.tgz#97180f80583b18f6a13c1054fa5f7e8da40b1028" - integrity sha512-3VV9ZGzh0ZY3SmkkSw+0TRXxIpiO0nB8lFwlRgcwaCihwrvLfRnH9GI8WE12mKsHVjWTEVR3ogzILJxccAUjDA== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-util" "6.4.1" - "@polkadot/wasm-crypto-wasm@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.0.2.tgz#6adecfd7ac7dec7967c427adcc18c9b6be09e566" @@ -1788,18 +1754,6 @@ "@polkadot/wasm-util" "7.0.2" tslib "^2.5.0" -"@polkadot/wasm-crypto@^6.4.1": - version "6.4.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-6.4.1.tgz#79310e23ad1ca62362ba893db6a8567154c2536a" - integrity sha512-FH+dcDPdhSLJvwL0pMLtn/LIPd62QDPODZRCmDyw+pFjLOMaRBc7raomWUOqyRWJTnqVf/iscc2rLVLNMyt7ag== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-bridge" "6.4.1" - "@polkadot/wasm-crypto-asmjs" "6.4.1" - "@polkadot/wasm-crypto-init" "6.4.1" - "@polkadot/wasm-crypto-wasm" "6.4.1" - "@polkadot/wasm-util" "6.4.1" - "@polkadot/wasm-crypto@^7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-7.0.2.tgz#44aa5f5322f3e8bdcacb1806e3e1a6543d20cbb4" @@ -1812,13 +1766,6 @@ "@polkadot/wasm-util" "7.0.2" tslib "^2.5.0" -"@polkadot/wasm-util@6.4.1": - version "6.4.1" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-6.4.1.tgz#74aecc85bec427a9225d9874685944ea3dc3ab76" - integrity sha512-Uwo+WpEsDmFExWC5kTNvsVhvqXMZEKf4gUHXFn4c6Xz4lmieRT5g+1bO1KJ21pl4msuIgdV3Bksfs/oiqMFqlw== - dependencies: - "@babel/runtime" "^7.20.6" - "@polkadot/wasm-util@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-7.0.2.tgz#1f3eaf048bd9134f08857e74325084ce129cd50c" @@ -1826,14 +1773,6 @@ dependencies: tslib "^2.5.0" -"@polkadot/x-bigint@10.4.2", "@polkadot/x-bigint@^10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-10.4.2.tgz#7eb2ec732259df48b5a00f07879a1331e05606ec" - integrity sha512-awRiox+/XSReLzimAU94fPldowiwnnMUkQJe8AebYhNocAj6SJU00GNoj6j6tAho6yleOwrTJXZaWFBaQVJQNg== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - "@polkadot/x-bigint@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-11.0.1.tgz#0a2c21f8fa76d1299a02111f8391d16593f456ae" @@ -1842,22 +1781,22 @@ "@polkadot/x-global" "11.0.1" tslib "^2.5.0" -"@polkadot/x-fetch@^10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-10.4.2.tgz#bc6ba70de71a252472fbe36180511ed920e05f05" - integrity sha512-Ubb64yaM4qwhogNP+4mZ3ibRghEg5UuCYRMNaCFoPgNAY8tQXuDKrHzeks3+frlmeH9YRd89o8wXLtWouwZIcw== +"@polkadot/x-bigint@^11.0.1": + version "11.1.3" + resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-11.1.3.tgz#37b09a12a9ed6df704e047e261f1b8b2ac978497" + integrity sha512-fRUUHfW9VFsXT7sLUUY7gSu8v+PvzNLRwvjnp+Ly8vFx9LTLuVGFCi+mpysuRTaPpqZZJlzBJ3fST7xTGh67Pg== dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - "@types/node-fetch" "^2.6.2" - node-fetch "^3.3.0" + "@polkadot/x-global" "11.1.3" + tslib "^2.5.0" -"@polkadot/x-global@10.4.2", "@polkadot/x-global@^10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-10.4.2.tgz#5662366e3deda0b4c8f024b2d902fa838f9e60a4" - integrity sha512-g6GXHD/ykZvHap3M6wh19dO70Zm43l4jEhlxf5LtTo5/0/UporFCXr2YJYZqfbn9JbQwl1AU+NroYio+vtJdiA== +"@polkadot/x-fetch@^11.0.1": + version "11.1.3" + resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-11.1.3.tgz#e39df53fc7fb6399d3883b45d03f6ef7f265a7f9" + integrity sha512-+Z0RxxsN7+l2ZmmDdHqOo0kgqvjXJ1bw8CwTVnq3t9nPgZKn2pC3Fq3xdj/sRWiLuf/UhgCxKfYfMmt5ek4kIg== dependencies: - "@babel/runtime" "^7.20.13" + "@polkadot/x-global" "11.1.3" + node-fetch "^3.3.1" + tslib "^2.5.0" "@polkadot/x-global@11.0.1": version "11.0.1" @@ -1866,13 +1805,12 @@ dependencies: tslib "^2.5.0" -"@polkadot/x-randomvalues@10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-10.4.2.tgz#895f1220d5a4522a83d8d5014e3c1e03b129893e" - integrity sha512-mf1Wbpe7pRZHO0V3V89isPLqZOy5XGX2bCqsfUWHgb1NvV1MMx5TjVjdaYyNlGTiOkAmJKlOHshcfPU2sYWpNg== +"@polkadot/x-global@11.1.3", "@polkadot/x-global@^11.0.1": + version "11.1.3" + resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-11.1.3.tgz#4086694f52373fea63910b62da999bf0981d7d86" + integrity sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg== dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" + tslib "^2.5.0" "@polkadot/x-randomvalues@11.0.1": version "11.0.1" @@ -1882,14 +1820,6 @@ "@polkadot/x-global" "11.0.1" tslib "^2.5.0" -"@polkadot/x-textdecoder@10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-10.4.2.tgz#93202f3e5ad0e7f75a3fa02d2b8a3343091b341b" - integrity sha512-d3ADduOKUTU+cliz839+KCFmi23pxTlabH7qh7Vs1GZQvXOELWdqFOqakdiAjtMn68n1KVF4O14Y+OUm7gp/zA== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - "@polkadot/x-textdecoder@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-11.0.1.tgz#4f42d41150ebf5c36a40adb0dfe7b7da530a21a5" @@ -1898,14 +1828,6 @@ "@polkadot/x-global" "11.0.1" tslib "^2.5.0" -"@polkadot/x-textencoder@10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-10.4.2.tgz#cd2e6c8a66b0b400a73f0164e99c510fb5c83501" - integrity sha512-mxcQuA1exnyv74Kasl5vxBq01QwckG088lYjc3KwmND6+pPrW2OWagbxFX5VFoDLDAE+UJtnUHsjdWyOTDhpQA== - dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - "@polkadot/x-textencoder@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-11.0.1.tgz#f95c7c3e06065862e3a2624ad873bbf0329c7d3b" @@ -1914,15 +1836,14 @@ "@polkadot/x-global" "11.0.1" tslib "^2.5.0" -"@polkadot/x-ws@^10.4.2": - version "10.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-10.4.2.tgz#4e9d88f37717570ccf942c6f4f63b06260f45025" - integrity sha512-3gHSTXAWQu1EMcMVTF5QDKHhEHzKxhAArweEyDXE7VsgKUP/ixxw4hVZBrkX122iI5l5mjSiooRSnp/Zl3xqDQ== +"@polkadot/x-ws@^11.0.1": + version "11.1.3" + resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-11.1.3.tgz#5a759bcbbbdceeecca53bcc74170e52cd3ca774b" + integrity sha512-omNU2mIVX997HiHm2YxEdJdyCFnv+oTyKWZd0+FdS47rdfhVwD+H9/bS+rtQ9lIqfhODdGmw3fG//gq1KpYJcw== dependencies: - "@babel/runtime" "^7.20.13" - "@polkadot/x-global" "10.4.2" - "@types/websocket" "^1.0.5" - websocket "^1.0.34" + "@polkadot/x-global" "11.1.3" + tslib "^2.5.0" + ws "^8.13.0" "@scure/base@1.1.1": version "1.1.1" @@ -1939,24 +1860,16 @@ resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.1.tgz#fa5738039586c648013caa6a0c95c43265dbe77d" integrity sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg== -"@substrate/connect@0.7.19": - version "0.7.19" - resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.19.tgz#7c879cb275bc7ac2fe9edbf797572d4ff8d8b86a" - integrity sha512-+DDRadc466gCmDU71sHrYOt1HcI2Cbhm7zdCFjZfFVHXhC/E8tOdrVSglAH2HDEHR0x2SiHRxtxOGC7ak2Zjog== +"@substrate/connect@0.7.20": + version "0.7.20" + resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.20.tgz#ce5647368be21199d608715bbd77bcb7c25a4227" + integrity sha512-f/sMgGUikJxDaNMkQXCU/1WaMy0MLJB+KS+P+CpsIhWyxj2dOcph5YXjAJiIlgrZqHImV28RJnraxXBD3AlmLQ== dependencies: "@substrate/connect-extension-protocol" "^1.0.1" - "@substrate/smoldot-light" "0.7.9" eventemitter3 "^4.0.7" + smoldot "0.7.11" -"@substrate/smoldot-light@0.7.9": - version "0.7.9" - resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.7.9.tgz#68449873a25558e547e9468289686ee228a9930f" - integrity sha512-HP8iP7sFYlpSgjjbo0lqHyU+gu9lL2hbDNce6dWk5/10mFFF9jKIFGfui4zCecUY808o/Go9pan/31kMJoLbug== - dependencies: - pako "^2.0.4" - ws "^8.8.1" - -"@substrate/ss58-registry@^1.38.0", "@substrate/ss58-registry@^1.39.0": +"@substrate/ss58-registry@^1.39.0": version "1.39.0" resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.39.0.tgz#eb916ff5fea7fa02e77745823fde21af979273d2" integrity sha512-qZYpuE6n+mwew+X71dOur/CbMXj6rNW27o63JeJwdQH/GvcSKm3JLNhd+bGzwUKg0D/zD30Qc6p4JykArzM+tA== @@ -2108,14 +2021,6 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.0.0.tgz#3205bcd15ada9bc681ac20bef64e9e6df88fd297" integrity sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA== -"@types/node-fetch@^2.6.2": - version "2.6.2" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.2.tgz#d1a9c5fd049d9415dce61571557104dec3ec81da" - integrity sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A== - dependencies: - "@types/node" "*" - form-data "^3.0.0" - "@types/node@*": version "18.14.6" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.14.6.tgz#ae1973dd2b1eeb1825695bb11ebfb746d27e3e93" @@ -2193,13 +2098,6 @@ "@types/expect" "^1.20.4" "@types/node" "*" -"@types/websocket@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.5.tgz#3fb80ed8e07f88e51961211cd3682a3a4a81569c" - integrity sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ== - dependencies: - "@types/node" "*" - "@typescript-eslint/eslint-plugin@5.35.1": version "5.35.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.35.1.tgz#0d822bfea7469904dfc1bb8f13cabd362b967c93" @@ -2773,13 +2671,6 @@ buffer@^5.2.1, buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" -bufferutil@^4.0.1: - version "4.0.7" - resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad" - integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw== - dependencies: - node-gyp-build "^4.3.0" - builtins@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" @@ -2989,6 +2880,18 @@ check-error@^1.0.2: resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== +chevrotain@^10.4.1: + version "10.5.0" + resolved "https://registry.yarnpkg.com/chevrotain/-/chevrotain-10.5.0.tgz#9c1dc62ef0753bb562dbe521b5f72d041bad624e" + integrity sha512-Pkv5rBY3+CsHOYfV5g/Vs5JY9WTHHDEKOlohI2XeygaZhUeqhAlldZ8Hz9cRmxu709bvS08YzxHdTPHhffc13A== + dependencies: + "@chevrotain/cst-dts-gen" "10.5.0" + "@chevrotain/gast" "10.5.0" + "@chevrotain/types" "10.5.0" + "@chevrotain/utils" "10.5.0" + lodash "4.17.21" + regexp-to-ast "0.5.0" + chokidar@3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" @@ -3371,6 +3274,11 @@ conventional-recommended-bump@^6.1.0: meow "^8.0.0" q "^1.5.1" +core-js-pure@^3.25.1: + version "3.30.0" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.30.0.tgz#41b6c42e5f363bd53d79999bd35093b17e42e1bf" + integrity sha512-+2KbMFGeBU0ln/csoPqTe0i/yfHbrd2EUhNMObsGtXMKS/RTtlkYyi+/3twLcevbgNR0yM/r0Psa3TEoQRpFMQ== + core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" @@ -3412,14 +3320,6 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" - dargs@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" @@ -3452,13 +3352,6 @@ debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, de dependencies: ms "2.1.2" -debug@^2.2.0: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -3752,32 +3645,6 @@ error@^10.4.0: resolved "https://registry.yarnpkg.com/error/-/error-10.4.0.tgz#6fcf0fd64bceb1e750f8ed9a3dd880f00e46a487" integrity sha512-YxIFEJuhgcICugOUvRx5th0UM+ActZ9sjY0QJmeVwsQdvosZ7kYzc9QqS0Da3R5iUmgU5meGIxh0xBeZpMVeLw== -es5-ext@^0.10.35, es5-ext@^0.10.50: - version "0.10.62" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" - integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - next-tick "^1.1.0" - -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -3961,13 +3828,6 @@ execa@5.1.1, execa@^5.0.0, execa@^5.1.1: signal-exit "^3.0.3" strip-final-newline "^2.0.0" -ext@^1.1.2: - version "1.7.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" - integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== - dependencies: - type "^2.7.2" - external-editor@^3.0.3: version "3.1.0" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" @@ -4185,15 +4045,6 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -5109,6 +4960,14 @@ js-sdsl@^4.1.4: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== +js-toml@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/js-toml/-/js-toml-0.1.1.tgz#c3173f8037b849cea611ae6823a6b03ecfebeb70" + integrity sha512-ETaJONe4lKpXqXml4AeiCrVWLTfyyYsUMDAUAwldT0z5lDg2tBLq4aIIqFOwQZIDUeIhS0ofQBABYvicwKhQIg== + dependencies: + chevrotain "^10.4.1" + xregexp "^5.1.1" + js-yaml@4.1.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -5394,7 +5253,7 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.21: +lodash@4.17.21, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -5884,11 +5743,6 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== - ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -5945,11 +5799,6 @@ neo-async@^2.6.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== - nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -5995,10 +5844,10 @@ node-fetch@^2.6.1, node-fetch@^2.6.7: dependencies: whatwg-url "^5.0.0" -node-fetch@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.0.tgz#37e71db4ecc257057af828d523a7243d651d91e4" - integrity sha512-BKwRP/O0UvoMKp7GNdwPlObhYGB5DQqwhEDQlNKuoqwVYSxkSZCSbHjnFFmUEtwSKRPU4kNK8PbDYYitwaE3QA== +node-fetch@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.1.tgz#b3eea7b54b3a48020e46f4f88b9c5a7430d20b2e" + integrity sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow== dependencies: data-uri-to-buffer "^4.0.0" fetch-blob "^3.1.4" @@ -7049,6 +6898,11 @@ regenerator-runtime@^0.13.11: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regexp-to-ast@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz#56c73856bee5e1fef7f73a00f1473452ab712a24" + integrity sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw== + regexpp@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" @@ -7324,6 +7178,14 @@ smart-buffer@^4.2.0: resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== +smoldot@0.7.11: + version "0.7.11" + resolved "https://registry.yarnpkg.com/smoldot/-/smoldot-0.7.11.tgz#8e39464f2cf7736eacff5f2a87819dd9f688b352" + integrity sha512-aE1led154FJ2/jrXKv2HLKdNIyvYJG6H2ZmKYFS++kW1OAcTQ6idDy3fzAI1VdydLDYK0YbKUsj7SJDmrjsS3g== + dependencies: + pako "^2.0.4" + ws "^8.8.1" + snake-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c" @@ -7911,16 +7773,6 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.7.2: - version "2.7.2" - resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" - integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== - typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" @@ -8038,13 +7890,6 @@ url@0.10.3: punycode "1.3.2" querystring "0.2.0" -utf-8-validate@^5.0.2: - version "5.0.10" - resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" - util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -8153,18 +7998,6 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -websocket@^1.0.34: - version "1.0.34" - resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" - integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== - dependencies: - bufferutil "^4.0.1" - debug "^2.2.0" - es5-ext "^0.10.50" - typedarray-to-buffer "^3.1.5" - utf-8-validate "^5.0.2" - yaeti "^0.0.6" - whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -8327,6 +8160,11 @@ write-pkg@^4.0.0: type-fest "^0.4.1" write-json-file "^3.2.0" +ws@^8.13.0: + version "8.13.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + ws@^8.8.1: version "8.12.1" resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.1.tgz#c51e583d79140b5e42e39be48c934131942d4a8f" @@ -8345,6 +8183,13 @@ xmlbuilder@~9.0.1: resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" integrity sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ== +xregexp@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-5.1.1.tgz#6d3fe18819e3143aaf52f9284d34f49a59583ebb" + integrity sha512-fKXeVorD+CzWvFs7VBuKTYIW63YD1e1osxwQ8caZ6o1jg6pDAbABDG54LCIq0j5cy7PjRvGIq6sef9DYPXpncg== + dependencies: + "@babel/runtime-corejs3" "^7.16.5" + xtend@^4.0.0, xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" @@ -8355,11 +8200,6 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yaeti@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" - integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== - yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" From b07136e77512a35322b925b6d97ee785bc07a1a5 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Tue, 18 Apr 2023 13:15:05 +0300 Subject: [PATCH 13/46] wip: parse workspace for contract list --- packages/cli/src/commands/init/index.ts | 27 +++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 8730e3d3..cb1b196c 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -262,10 +262,17 @@ export class Init extends BaseCommand { } // 2. Look for cargo.toml with "workspace" field in the root - const rootToml = await getRootCargoToml(pathToExistingProject); - // 3a. Workspace found - use the glob in the "members field" to select directories to copy over - // 3b. workspace not found, use regex to find dir/dirs*/[cargo.toml, lib.rs] - // 3c. if not found, ask user for a path where contracts are -> [Ctrl+C to cancel] + const rootTomlPath = path.resolve(pathToExistingProject, "Cargo.toml"); + if (await pathExists(rootTomlPath)) { + const rootTomlContracts = await getRootCargoToml(rootTomlPath); + // 3a. Workspace found - use the glob in the "members field" to select directories to copy over + console.log(rootTomlContracts); + } else { + // WILL NOT IMPLEMENT - too many variables 3b. workspace not found, use regex to find dir/dirs*/[cargo.toml, lib.rs] + // 3c. if not found, ask user for a path where contracts are -> [Ctrl+C to cancel] + // and optionally + } + // 4. make a list (checkbox) for user to confirm contracts to copy // 5. add directories from Cargo.toml/exclude path to copy list // 6. look for test/tests directory and add it to the list @@ -276,19 +283,17 @@ export class Init extends BaseCommand { } } -async function getRootCargoToml(targetPath: string) { - const rootTomlPath = path.resolve(targetPath, "Cargo.toml"); - - if (!(await pathExists(rootTomlPath))) return; +// async function copyWorkspaceContracts() {} +async function getRootCargoToml(rootTomlPath: string) { const fileData = await readFile(rootTomlPath, "utf-8"); const toml: { workspace?: { members?: string[]; exclude?: string[] } } = load(fileData); - if (!toml.workspace?.members) return; + if (!toml.workspace?.members) throw new Error(`No "workspace.members" field in Cargo.toml`); const getGlobPaths = async (globList: string[]) => globby( - globList.map((glob) => path.resolve(targetPath, glob)), + globList.map((glob) => path.resolve(path.dirname(rootTomlPath), glob)), { absolute: true, onlyDirectories: true, @@ -301,6 +306,6 @@ async function getRootCargoToml(targetPath: string) { contracts: await getGlobPaths(toml.workspace.members), additionalPaths: toml.workspace.exclude ? await getGlobPaths(toml.workspace.exclude) : [], }; - + console.log(toml); return detectedPaths; } From 7c1e0f0d1554609a6be9c5661e71b94772834143 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Thu, 27 Apr 2023 19:30:48 +0300 Subject: [PATCH 14/46] wip: add manual paths entry --- packages/cli/package.json | 1 + packages/cli/src/commands/init/index.ts | 134 ++++++++++++++++++------ yarn.lock | 22 +++- 3 files changed, 123 insertions(+), 34 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 80e272e5..c2557ca1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -32,6 +32,7 @@ "fs-extra": "10.1.0", "globby": "11", "inquirer": "8.2.5", + "inquirer-file-tree-selection-prompt": "^1", "js-toml": "^0.1.1", "listr2": "5.0.7", "mocha": "10.2.0", diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index cb1b196c..b43bdf1c 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -20,6 +20,7 @@ import { import { getAllTemplateNames, getTemplates } from "@astar-network/swanky-templates"; import { BaseCommand } from "../../lib/baseCommand"; import globby = require("globby"); +import inquirerFileTreeSelection from "inquirer-file-tree-selection-prompt"; const { DEFAULT_ASTAR_NETWORK_URL, DEFAULT_NETWORK_URL, @@ -38,6 +39,8 @@ interface Task { shouldExitOnError?: boolean; callback?: (param: string) => void; } + +inquirer.registerPrompt("file-tree-selection", inquirerFileTreeSelection); export class Init extends BaseCommand { static description = "Generate a new smart contract environment"; @@ -262,50 +265,117 @@ export class Init extends BaseCommand { } // 2. Look for cargo.toml with "workspace" field in the root - const rootTomlPath = path.resolve(pathToExistingProject, "Cargo.toml"); - if (await pathExists(rootTomlPath)) { - const rootTomlContracts = await getRootCargoToml(rootTomlPath); - // 3a. Workspace found - use the glob in the "members field" to select directories to copy over - console.log(rootTomlContracts); - } else { - // WILL NOT IMPLEMENT - too many variables 3b. workspace not found, use regex to find dir/dirs*/[cargo.toml, lib.rs] - // 3c. if not found, ask user for a path where contracts are -> [Ctrl+C to cancel] - // and optionally - } + let rootTomlPaths = await getRootCargoToml(pathToExistingProject); - // 4. make a list (checkbox) for user to confirm contracts to copy - // 5. add directories from Cargo.toml/exclude path to copy list - // 6. look for test/tests directory and add it to the list - // 7. copy all the selected directories/files and update the swanky.config - // 8. copy cargo.toml from the root, modify path if needed ( "uniswap-v2/contracts/**" -> "contracts/**") - // 9. keep log of all the steps and write it to file - // 10. Copy rust.toolchain and .rustfmt.toml if exists + if (rootTomlPaths) { + console.log("Workspaces detected in root Cargo.toml file."); + const { shouldKeepRootToml } = await inquirer.prompt([ + choice("shouldKeepRootToml", "Do you want to use it to automatically copy contracts?"), + ]); + rootTomlPaths = shouldKeepRootToml ? rootTomlPaths : null; + } + console.log(rootTomlPaths); + const candidatesList = rootTomlPaths + ? await getCopyCandidatesList(pathToExistingProject, rootTomlPaths) + : await getCopyCandidatesList( + pathToExistingProject, + await getManualPaths(pathToExistingProject) + ); + + console.log("Candidates list: ", candidatesList); } } // async function copyWorkspaceContracts() {} -async function getRootCargoToml(rootTomlPath: string) { +async function getRootCargoToml(pathToProject: string) { + const rootTomlPath = path.resolve(pathToProject, "Cargo.toml"); + if (!(await pathExists(rootTomlPath))) return null; + const fileData = await readFile(rootTomlPath, "utf-8"); const toml: { workspace?: { members?: string[]; exclude?: string[] } } = load(fileData); - if (!toml.workspace?.members) throw new Error(`No "workspace.members" field in Cargo.toml`); + if (!toml.workspace?.members) return null; - const getGlobPaths = async (globList: string[]) => - globby( - globList.map((glob) => path.resolve(path.dirname(rootTomlPath), glob)), - { - absolute: true, - onlyDirectories: true, - deep: 1, - objectMode: true, - } - ); + return { + contractsDirectories: toml.workspace.members, + cratesDirectories: toml.workspace.exclude, + }; +} +async function getManualPaths(pathToProject: string) { + console.log("No Cargo.toml found in the provided directory, or no workspace field within it."); + const { contractsDirectory, cratesDirectory, useCrateDirectory } = await inquirer.prompt([ + { + type: "file-tree-selection", + name: "contractsDirectory", + onlyShowDir: true, + root: pathToProject, + message: "Please enter the path to the contracts directory: ", + hideRoot: true, + }, + { + type: "confirm", + name: "useCrateDirectory", + message: "Do you have an extra the crate directory?", + default: false, + }, + { + when: (answers) => answers.useCrateDirectory, + type: "file-tree-selection", + name: "cratesDirectory", + onlyShowDir: true, + root: pathToProject, + message: "Please enter the path to the contracts directory: ", + }, + ]); + + return { + contractsDirectories: [contractsDirectory], + cratesDirectories: useCrateDirectory ? [cratesDirectory] : [], + }; +} + +async function getCopyCandidatesList( + projectPath: string, + pathsToCopy: { + contractsDirectories: string[]; + cratesDirectories?: string[]; + } +) { const detectedPaths = { - contracts: await getGlobPaths(toml.workspace.members), - additionalPaths: toml.workspace.exclude ? await getGlobPaths(toml.workspace.exclude) : [], + contracts: [ + ...(await getGlobPaths(projectPath, pathsToCopy.contractsDirectories, false)), + ...(await getGlobPaths(projectPath, pathsToCopy.contractsDirectories, true)), + ], + additionalPaths: + pathsToCopy.cratesDirectories && pathsToCopy.cratesDirectories.length > 0 + ? [ + ...(await getGlobPaths(projectPath, pathsToCopy.cratesDirectories, false)), + ...(await getGlobPaths(projectPath, pathsToCopy.cratesDirectories, true)), + ] + : [], }; - console.log(toml); + return detectedPaths; } + +async function getGlobPaths(projectPath: string, globList: string[], isDirOnly: boolean) { + return globby( + globList.map((glob) => path.resolve(projectPath, glob)), + { + absolute: true, + onlyDirectories: isDirOnly, + deep: 1, + objectMode: true, + } + ); +} + +// 4. make a list (checkbox) for user to confirm contracts to copy +// 5. add directories from Cargo.toml/exclude path to copy list +// 6. look for test/tests directory and add it to the list +// 7. copy all the selected directories/files and update the swanky.config +// 8. copy cargo.toml from the root, modify path if needed ( "uniswap-v2/contracts/**" -> "contracts/**") +// 9. keep log of all the steps and write it to file +// 10. Copy rust.toolchain and .rustfmt.toml if exists diff --git a/yarn.lock b/yarn.lock index fa9956d0..46634e05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2934,7 +2934,7 @@ cli-boxes@^1.0.0: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" integrity sha512-3Fo5wu8Ytle8q9iCzS4D2MWVL2X7JVWRiS1BnXbTFDhS9c/REkM9vd1AmabsoZoY5/dGi5TT9iKL8Kb6DeBRQg== -cli-cursor@3.1.0, cli-cursor@^3.1.0: +cli-cursor@3.1.0, cli-cursor@^3, cli-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== @@ -3927,7 +3927,7 @@ fetch-blob@^3.1.2, fetch-blob@^3.1.4: node-domexception "^1.0.0" web-streams-polyfill "^3.0.3" -figures@3.2.0, figures@^3.0.0: +figures@3.2.0, figures@^3, figures@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== @@ -4678,6 +4678,17 @@ init-package-json@^3.0.2: validate-npm-package-license "^3.0.4" validate-npm-package-name "^4.0.0" +inquirer-file-tree-selection-prompt@^1: + version "1.0.19" + resolved "https://registry.yarnpkg.com/inquirer-file-tree-selection-prompt/-/inquirer-file-tree-selection-prompt-1.0.19.tgz#40fa05991a6ab4bda4dad6116f07a8892627c3d2" + integrity sha512-aL01njANm5bJhQtUNBKWurniroUJ9I+rnJ20DBG3xY9gtKBxgpRFSRs0lzjx42iCRJ4J083IZ2SrN4t8ejPlEQ== + dependencies: + chalk "^4.0.0" + cli-cursor "^3" + figures "^3" + lodash "^4.17.11" + rxjs "^7.5.2" + inquirer@8.2.5, inquirer@^8.0.0, inquirer@^8.2.4: version "8.2.5" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.5.tgz#d8654a7542c35a9b9e069d27e2df4858784d54f8" @@ -7010,6 +7021,13 @@ rxjs@^7.0.0, rxjs@^7.5.5, rxjs@^7.8.0: dependencies: tslib "^2.1.0" +rxjs@^7.5.2: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" From 183b37393290e686504a331354dbfaa1461c9dbd Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Tue, 2 May 2023 15:32:57 +0300 Subject: [PATCH 15/46] use fuzzypath instead of tree selector --- packages/cli/package.json | 3 +- packages/cli/src/commands/init/index.ts | 22 ++-- yarn.lock | 157 +++++++++++++++++++++--- 3 files changed, 154 insertions(+), 28 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index c2557ca1..6eaa606c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -32,7 +32,7 @@ "fs-extra": "10.1.0", "globby": "11", "inquirer": "8.2.5", - "inquirer-file-tree-selection-prompt": "^1", + "inquirer-fuzzy-path": "^2.3.0", "js-toml": "^0.1.1", "listr2": "5.0.7", "mocha": "10.2.0", @@ -49,6 +49,7 @@ "@types/chai": "4", "@types/fs-extra": "9.0.13", "@types/inquirer": "8.2.5", + "@types/inquirer-fuzzy-path": "^2.3.6", "@types/mocha": "9.0.0", "@types/node": "18.11.9", "@types/semver": "7.3.10", diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index b43bdf1c..e1277f6c 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -20,7 +20,9 @@ import { import { getAllTemplateNames, getTemplates } from "@astar-network/swanky-templates"; import { BaseCommand } from "../../lib/baseCommand"; import globby = require("globby"); -import inquirerFileTreeSelection from "inquirer-file-tree-selection-prompt"; + +import inquirerFuzzyPath from "inquirer-fuzzy-path"; + const { DEFAULT_ASTAR_NETWORK_URL, DEFAULT_NETWORK_URL, @@ -40,7 +42,8 @@ interface Task { callback?: (param: string) => void; } -inquirer.registerPrompt("file-tree-selection", inquirerFileTreeSelection); +inquirer.registerPrompt("fuzzypath", inquirerFuzzyPath); + export class Init extends BaseCommand { static description = "Generate a new smart contract environment"; @@ -307,12 +310,12 @@ async function getManualPaths(pathToProject: string) { console.log("No Cargo.toml found in the provided directory, or no workspace field within it."); const { contractsDirectory, cratesDirectory, useCrateDirectory } = await inquirer.prompt([ { - type: "file-tree-selection", + type: "fuzzypath", name: "contractsDirectory", - onlyShowDir: true, - root: pathToProject, + itemType: "directory", + rootPath: pathToProject, message: "Please enter the path to the contracts directory: ", - hideRoot: true, + excludePath: (nodePath: string) => nodePath.startsWith("node_modules"), }, { type: "confirm", @@ -322,11 +325,12 @@ async function getManualPaths(pathToProject: string) { }, { when: (answers) => answers.useCrateDirectory, - type: "file-tree-selection", + type: "fuzzypath", name: "cratesDirectory", - onlyShowDir: true, - root: pathToProject, + itemType: "directory", + rootPath: pathToProject, message: "Please enter the path to the contracts directory: ", + excludePath: (nodePath: string) => nodePath.startsWith("node_modules"), }, ]); diff --git a/yarn.lock b/yarn.lock index 46634e05..5fc98f91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1972,6 +1972,21 @@ resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812" integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== +"@types/inquirer-autocomplete-prompt@^2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/inquirer-autocomplete-prompt/-/inquirer-autocomplete-prompt-2.0.0.tgz#8b60cab59bb6b4c2f1885cb86316f0aa82fa24c9" + integrity sha512-KgzR9j7R2hyhnLAdYjZ4EzjspnLENrcqZyKXphBAeN2/9qvHpd4lTxSWKkTuG8aeTPM9/5Fk0IGqSJCTkV+ZVw== + dependencies: + "@types/inquirer" "^8" + +"@types/inquirer-fuzzy-path@^2.3.6": + version "2.3.6" + resolved "https://registry.yarnpkg.com/@types/inquirer-fuzzy-path/-/inquirer-fuzzy-path-2.3.6.tgz#bc7a1e32c93ac7d60d1bd158b3843948b67a856e" + integrity sha512-O/XTBIu5rcPVO752pfvsIgf2AiZ7RlPjuVGzL9KIexPYAz0N2CD4CbcAebTlfVWsJ55kYOblXjz/7tnQYgi8yQ== + dependencies: + "@types/inquirer" "^8" + "@types/inquirer-autocomplete-prompt" "^2" + "@types/inquirer@8.2.5": version "8.2.5" resolved "https://registry.yarnpkg.com/@types/inquirer/-/inquirer-8.2.5.tgz#c508423bcc11126db278170ab07347783ac2300c" @@ -1979,6 +1994,14 @@ dependencies: "@types/through" "*" +"@types/inquirer@^8": + version "8.2.6" + resolved "https://registry.yarnpkg.com/@types/inquirer/-/inquirer-8.2.6.tgz#abd41a5fb689c7f1acb12933d787d4262a02a0ab" + integrity sha512-3uT88kxg8lNzY8ay2ZjP44DKcRaTGztqeIvN2zHvhzIBH/uAPaL75aBtdNRKbA7xXoMbBt5kX0M00VKAnfOYlA== + dependencies: + "@types/through" "*" + rxjs "^7.2.0" + "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" @@ -2358,12 +2381,12 @@ ansi-colors@^4.1.1: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== -ansi-escapes@^3.1.0: +ansi-escapes@^3.1.0, ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== -ansi-escapes@^4.2.1, ansi-escapes@^4.3.0, ansi-escapes@^4.3.2: +ansi-escapes@^4.2.1, ansi-escapes@^4.3.0, ansi-escapes@^4.3.1, ansi-escapes@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== @@ -2380,6 +2403,11 @@ ansi-regex@^3.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1" integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw== +ansi-regex@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" + integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -2843,7 +2871,7 @@ chalk@^1.0.0: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0: +chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2934,13 +2962,20 @@ cli-boxes@^1.0.0: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" integrity sha512-3Fo5wu8Ytle8q9iCzS4D2MWVL2X7JVWRiS1BnXbTFDhS9c/REkM9vd1AmabsoZoY5/dGi5TT9iKL8Kb6DeBRQg== -cli-cursor@3.1.0, cli-cursor@^3, cli-cursor@^3.1.0: +cli-cursor@3.1.0, cli-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== dependencies: restore-cursor "^3.1.0" +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw== + dependencies: + restore-cursor "^2.0.0" + cli-progress@^3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/cli-progress/-/cli-progress-3.12.0.tgz#807ee14b66bcc086258e444ad0f19e7d42577942" @@ -2973,6 +3008,11 @@ cli-truncate@^2.1.0: slice-ansi "^3.0.0" string-width "^4.2.0" +cli-width@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" + integrity sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw== + cli-width@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" @@ -3927,13 +3967,20 @@ fetch-blob@^3.1.2, fetch-blob@^3.1.4: node-domexception "^1.0.0" web-streams-polyfill "^3.0.3" -figures@3.2.0, figures@^3, figures@^3.0.0: +figures@3.2.0, figures@^3.0.0, figures@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== dependencies: escape-string-regexp "^1.0.5" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA== + dependencies: + escape-string-regexp "^1.0.5" + file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" @@ -4135,6 +4182,11 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== +fuzzy@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/fuzzy/-/fuzzy-0.1.3.tgz#4c76ec2ff0ac1a36a9dccf9a00df8623078d4ed8" + integrity sha512-/gZffu4ykarLrCiP3Ygsa86UAo1E5vEVlvTrpkKywXSbP9Xhln3oSp9QSV57gEq3JFFpGJ4GZ+5zdEp3FcUh4w== + gauge@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/gauge/-/gauge-3.0.2.tgz#03bf4441c044383908bcfa0656ad91803259b395" @@ -4678,16 +4730,27 @@ init-package-json@^3.0.2: validate-npm-package-license "^3.0.4" validate-npm-package-name "^4.0.0" -inquirer-file-tree-selection-prompt@^1: - version "1.0.19" - resolved "https://registry.yarnpkg.com/inquirer-file-tree-selection-prompt/-/inquirer-file-tree-selection-prompt-1.0.19.tgz#40fa05991a6ab4bda4dad6116f07a8892627c3d2" - integrity sha512-aL01njANm5bJhQtUNBKWurniroUJ9I+rnJ20DBG3xY9gtKBxgpRFSRs0lzjx42iCRJ4J083IZ2SrN4t8ejPlEQ== +inquirer-autocomplete-prompt@^1.0.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/inquirer-autocomplete-prompt/-/inquirer-autocomplete-prompt-1.4.0.tgz#e767592f747e3d5bb6336fe71fb4094352e4c317" + integrity sha512-qHgHyJmbULt4hI+kCmwX92MnSxDs/Yhdt4wPA30qnoa01OF6uTXV8yvH4hKXgdaTNmkZ9D01MHjqKYEuJN+ONw== dependencies: + ansi-escapes "^4.3.1" chalk "^4.0.0" - cli-cursor "^3" - figures "^3" - lodash "^4.17.11" - rxjs "^7.5.2" + figures "^3.2.0" + run-async "^2.4.0" + rxjs "^6.6.2" + +inquirer-fuzzy-path@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/inquirer-fuzzy-path/-/inquirer-fuzzy-path-2.3.0.tgz#9bc51dc47d7d9c7eb53daac7fd7c9e615eb040c5" + integrity sha512-zfHC/97GSkxKKM7IctZM22x1sVi+FYBh9oaHTmI7Er/GKFpNykUgtviTmqqpiFQs5yJoSowxbT0PHy6N+H+QRg== + dependencies: + ansi-styles "^3.2.1" + fuzzy "^0.1.3" + inquirer "^6.0.0" + inquirer-autocomplete-prompt "^1.0.2" + strip-ansi "^4.0.0" inquirer@8.2.5, inquirer@^8.0.0, inquirer@^8.2.4: version "8.2.5" @@ -4710,6 +4773,25 @@ inquirer@8.2.5, inquirer@^8.0.0, inquirer@^8.2.4: through "^2.3.6" wrap-ansi "^7.0.0" +inquirer@^6.0.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.12" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + interpret@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" @@ -5264,7 +5346,7 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@4.17.21, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.21: +lodash@4.17.21, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -5505,6 +5587,11 @@ mime-types@^2.1.12: dependencies: mime-db "1.52.0" +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -5775,6 +5862,11 @@ multimatch@^5.0.0: arrify "^2.0.1" minimatch "^3.0.4" +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ== + mute-stream@0.0.8, mute-stream@~0.0.4: version "0.0.8" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" @@ -6211,6 +6303,13 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ== + dependencies: + mimic-fn "^1.0.0" + onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" @@ -6972,6 +7071,14 @@ responselike@^2.0.0: dependencies: lowercase-keys "^2.0.0" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q== + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + restore-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" @@ -7002,7 +7109,7 @@ rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" -run-async@^2.0.0, run-async@^2.4.0: +run-async@^2.0.0, run-async@^2.2.0, run-async@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== @@ -7014,6 +7121,13 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +rxjs@^6.4.0, rxjs@^6.6.2: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + rxjs@^7.0.0, rxjs@^7.5.5, rxjs@^7.8.0: version "7.8.0" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4" @@ -7021,7 +7135,7 @@ rxjs@^7.0.0, rxjs@^7.5.5, rxjs@^7.8.0: dependencies: tslib "^2.1.0" -rxjs@^7.5.2: +rxjs@^7.2.0: version "7.8.1" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== @@ -7355,7 +7469,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^2.0.0: +string-width@^2.0.0, string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -7391,6 +7505,13 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +strip-ansi@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -7720,7 +7841,7 @@ tslib@2.5.0, tslib@^2, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, t resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== -tslib@^1.8.1: +tslib@^1.8.1, tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== From 6442522d63443dd471c1cfca1b7812e648ec8729 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Tue, 2 May 2023 22:30:56 +0300 Subject: [PATCH 16/46] add test detection --- packages/cli/src/commands/init/index.ts | 99 ++++++++++++++++++++----- 1 file changed, 80 insertions(+), 19 deletions(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index e1277f6c..03a26888 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -1,6 +1,6 @@ import { Args, Flags } from "@oclif/core"; import path = require("node:path"); -import { ensureDir, writeJSON, stat, readdir, pathExists, readFile } from "fs-extra"; +import { ensureDir, writeJSON, stat, readdir, pathExists, readFile, Dirent } from "fs-extra"; import execa = require("execa"); import { paramCase, pascalCase, snakeCase } from "change-case"; import inquirer = require("inquirer"); @@ -42,6 +42,18 @@ interface Task { callback?: (param: string) => void; } +type PathEntry = { + dirent: Dirent; + name: string; + path: string; +}; + +type CopyCandidates = { + contracts: PathEntry[]; + additionalPaths: PathEntry[]; + tests?: PathEntry[]; +}; + inquirer.registerPrompt("fuzzypath", inquirerFuzzyPath); export class Init extends BaseCommand { @@ -267,7 +279,6 @@ export class Init extends BaseCommand { throw error; } - // 2. Look for cargo.toml with "workspace" field in the root let rootTomlPaths = await getRootCargoToml(pathToExistingProject); if (rootTomlPaths) { @@ -277,14 +288,58 @@ export class Init extends BaseCommand { ]); rootTomlPaths = shouldKeepRootToml ? rootTomlPaths : null; } - console.log(rootTomlPaths); - const candidatesList = rootTomlPaths + + const candidatesList: CopyCandidates = rootTomlPaths ? await getCopyCandidatesList(pathToExistingProject, rootTomlPaths) : await getCopyCandidatesList( pathToExistingProject, await getManualPaths(pathToExistingProject) ); + const testDirNames = ["test", "tests", "spec", "specs"]; + + let testDir = undefined; + + for (const testDirName of testDirNames) { + const testDirCandidate = path.resolve(pathToExistingProject, testDirName); + const testDirExists = await pathExists(testDirCandidate); + if (testDirExists) { + testDir = testDirCandidate; + break; + } + } + + const { shouldOverwriteTestDir, manualTestDir } = await inquirer.prompt([ + { + type: "confirm", + name: "shouldOverwriteTestDir", + message: `${ + testDir + ? `Detected test directory [${path.basename( + testDir + )}] will be copied. Do you want to override and` + : "No test directory detected, do you want to" + } specify it manually?`, + default: false, + }, + { + when: (answers) => answers.shouldOverwriteTestDir, + type: "fuzzypath", + name: "manualTestDir", + itemType: "directory", + rootPath: pathToExistingProject, + message: "Please enter the path to the contracts directory: ", + excludePath: (nodePath: string) => nodePath.startsWith("node_modules"), + }, + ]); + if (shouldOverwriteTestDir) { + testDir = manualTestDir; + } + + candidatesList.tests = (await pathExists(testDir)) + ? await getDirsAndFiles(pathToExistingProject, [testDir]) + : []; + console.log("Candidates list: ", candidatesList); } } @@ -348,16 +403,10 @@ async function getCopyCandidatesList( } ) { const detectedPaths = { - contracts: [ - ...(await getGlobPaths(projectPath, pathsToCopy.contractsDirectories, false)), - ...(await getGlobPaths(projectPath, pathsToCopy.contractsDirectories, true)), - ], + contracts: await getDirsAndFiles(projectPath, pathsToCopy.contractsDirectories), additionalPaths: pathsToCopy.cratesDirectories && pathsToCopy.cratesDirectories.length > 0 - ? [ - ...(await getGlobPaths(projectPath, pathsToCopy.cratesDirectories, false)), - ...(await getGlobPaths(projectPath, pathsToCopy.cratesDirectories, true)), - ] + ? await getDirsAndFiles(projectPath, pathsToCopy.cratesDirectories) : [], }; @@ -376,10 +425,22 @@ async function getGlobPaths(projectPath: string, globList: string[], isDirOnly: ); } -// 4. make a list (checkbox) for user to confirm contracts to copy -// 5. add directories from Cargo.toml/exclude path to copy list -// 6. look for test/tests directory and add it to the list -// 7. copy all the selected directories/files and update the swanky.config -// 8. copy cargo.toml from the root, modify path if needed ( "uniswap-v2/contracts/**" -> "contracts/**") -// 9. keep log of all the steps and write it to file -// 10. Copy rust.toolchain and .rustfmt.toml if exists +async function getDirsAndFiles(projectPath: string, globList: string[]) { + return [ + ...(await getGlobPaths(projectPath, globList, false)), + ...(await getGlobPaths(projectPath, globList, true)), + ]; +} + +//[X] 1. Check if the project is a directory, or is it empty +//[X] 2. Look for cargo.toml with "workspace" field in the root +//[X] 3a. Workspace found - use the glob in the "members field" to select directories to copy over +//[X] 3b. if not found, ask user for a path where contracts are -> [Ctrl+C to cancel] +//[X] 4. add directories from Cargo.toml/exclude path to copy list +//[ ] 5. make a list (checkbox) for user to confirm contracts/crates/files to copy +//[X] 6. look for test/tests directory and add it to the list (also take manual input) +//[ ] 7. copy all the selected directories/files and update the swanky.config +//[ ] 8. copy cargo.toml from the root, modify path if needed ( "uniswap-v2/contracts/**" -> "contracts/**") +//[ ] 9. keep log of all the steps and write it to file +//[ ] 10. Copy rust.toolchain and .rustfmt.toml if exists +//[ ] 11. Merge package.json from imported project into the one generated from template From ea712e45269730ce23ebdad60278083030afc679 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Tue, 2 May 2023 23:52:07 +0300 Subject: [PATCH 17/46] confirmed files to copy --- packages/cli/src/commands/init/index.ts | 130 ++++++++++++++++-------- 1 file changed, 89 insertions(+), 41 deletions(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 03a26888..6a368954 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -296,56 +296,104 @@ export class Init extends BaseCommand { await getManualPaths(pathToExistingProject) ); - const testDirNames = ["test", "tests", "spec", "specs"]; - - let testDir = undefined; - - for (const testDirName of testDirNames) { - const testDirCandidate = path.resolve(pathToExistingProject, testDirName); - const testDirExists = await pathExists(testDirCandidate); - if (testDirExists) { - testDir = testDirCandidate; - break; - } - } - - const { shouldOverwriteTestDir, manualTestDir } = await inquirer.prompt([ - { - type: "confirm", - name: "shouldOverwriteTestDir", - message: `${ - testDir - ? `Detected test directory [${path.basename( - testDir - )}] will be copied. Do you want to override and` - : "No test directory detected, do you want to" - } specify it manually?`, - default: false, - }, - { - when: (answers) => answers.shouldOverwriteTestDir, - type: "fuzzypath", - name: "manualTestDir", - itemType: "directory", - rootPath: pathToExistingProject, - message: "Please enter the path to the contracts directory: ", - excludePath: (nodePath: string) => nodePath.startsWith("node_modules"), - }, - ]); - if (shouldOverwriteTestDir) { - testDir = manualTestDir; - } + const testDir = await detectTests(pathToExistingProject); candidatesList.tests = (await pathExists(testDir)) ? await getDirsAndFiles(pathToExistingProject, [testDir]) : []; - console.log("Candidates list: ", candidatesList); + const confirmedCopyList = await confirmCopyList(candidatesList); + console.log("Candidates list: ", confirmedCopyList); } } // async function copyWorkspaceContracts() {} +async function confirmCopyList(candidatesList: CopyCandidates) { + if (!candidatesList.tests) candidatesList.tests = []; + + const { confirmedCopyList } = await inquirer.prompt({ + message: "Please review the list of files and directories to copy:", + name: "confirmedCopyList", + type: "checkbox", + choices: [ + new inquirer.Separator("=====Contracts====="), + ...candidatesList.contracts.map((contract) => ({ + name: `${contract.name}${contract.dirent.isDirectory() ? "/" : ""}`, + value: { ...contract, group: "contracts" }, + checked: true, + })), + new inquirer.Separator("=====Crates====="), + ...candidatesList.additionalPaths.map((path) => ({ + name: `${path.name}${path.dirent.isDirectory() ? "/" : ""}`, + value: { ...path, group: "additionalPaths" }, + checked: true, + })), + new inquirer.Separator("=====Tests====="), + ...candidatesList.tests.map((test) => ({ + name: `${test.name}${test.dirent.isDirectory() ? "/" : ""}`, + value: { ...test, group: "tests" }, + checked: true, + })), + ], + }); + + const resultingList: CopyCandidates = { contracts: [], additionalPaths: [], tests: [] }; + confirmedCopyList.forEach( + ( + item: PathEntry & { + group: "contracts" | "additionalPaths" | "tests"; + } + ) => { + resultingList[item.group]?.push(item); + } + ); + return resultingList; +} + +async function detectTests(pathToExistingProject: string) { + const testDirNames = ["test", "tests", "spec", "specs"]; + + let testDir = undefined; + + for (const testDirName of testDirNames) { + const testDirCandidate = path.resolve(pathToExistingProject, testDirName); + const testDirExists = await pathExists(testDirCandidate); + if (testDirExists) { + testDir = testDirCandidate; + break; + } + } + + const { shouldOverwriteTestDir, manualTestDir } = await inquirer.prompt([ + { + type: "confirm", + name: "shouldOverwriteTestDir", + message: `${ + testDir + ? `Detected test directory [${path.basename( + testDir + )}] will be copied. Do you want to override and` + : "No test directory detected, do you want to" + } specify it manually?`, + default: false, + }, + { + when: (answers) => answers.shouldOverwriteTestDir, + type: "fuzzypath", + name: "manualTestDir", + itemType: "directory", + rootPath: pathToExistingProject, + message: "Please enter the path to the contracts directory: ", + excludePath: (nodePath: string) => nodePath.startsWith("node_modules"), + }, + ]); + if (shouldOverwriteTestDir) { + return manualTestDir; + } + return testDir; +} + async function getRootCargoToml(pathToProject: string) { const rootTomlPath = path.resolve(pathToProject, "Cargo.toml"); if (!(await pathExists(rootTomlPath))) return null; @@ -437,7 +485,7 @@ async function getDirsAndFiles(projectPath: string, globList: string[]) { //[X] 3a. Workspace found - use the glob in the "members field" to select directories to copy over //[X] 3b. if not found, ask user for a path where contracts are -> [Ctrl+C to cancel] //[X] 4. add directories from Cargo.toml/exclude path to copy list -//[ ] 5. make a list (checkbox) for user to confirm contracts/crates/files to copy +//[X] 5. make a list (checkbox) for user to confirm contracts/crates/files to copy //[X] 6. look for test/tests directory and add it to the list (also take manual input) //[ ] 7. copy all the selected directories/files and update the swanky.config //[ ] 8. copy cargo.toml from the root, modify path if needed ( "uniswap-v2/contracts/**" -> "contracts/**") From e58c56cfe3e6fae54ab99945862d7ee58faabc65 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 8 May 2023 08:11:50 +0300 Subject: [PATCH 18/46] wip: copy selected files and dirs --- packages/cli/src/commands/init/index.ts | 48 +++++++++++++++++++------ 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 6a368954..03347666 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -1,6 +1,6 @@ import { Args, Flags } from "@oclif/core"; import path = require("node:path"); -import { ensureDir, writeJSON, stat, readdir, pathExists, readFile, Dirent } from "fs-extra"; +import { ensureDir, writeJSON, stat, readdir, pathExists, readFile, Dirent, copy } from "fs-extra"; import execa = require("execa"); import { paramCase, pascalCase, snakeCase } from "change-case"; import inquirer = require("inquirer"); @@ -50,7 +50,7 @@ type PathEntry = { type CopyCandidates = { contracts: PathEntry[]; - additionalPaths: PathEntry[]; + crates: PathEntry[]; tests?: PathEntry[]; }; @@ -108,6 +108,7 @@ export class Init extends BaseCommand { shiden: { url: DEFAULT_SHIDEN_NETWORK_URL }, shibuya: { url: DEFAULT_SHIBUYA_NETWORK_URL }, }, + contracts: {}, }; taskQueue: Task[] = []; @@ -131,7 +132,6 @@ export class Init extends BaseCommand { if (flags.convert) { await this.convert(flags.convert); - return; } else { await this.generate(args.projectName); } @@ -303,17 +303,43 @@ export class Init extends BaseCommand { : []; const confirmedCopyList = await confirmCopyList(candidatesList); - console.log("Candidates list: ", confirmedCopyList); + + this.taskQueue.push({ + task: copyWorkspaceContracts, + args: [confirmedCopyList, this.projectPath], + runningMessage: "Copying existing project files", + successMessage: "Project files successfully copied", + failMessage: "Failed to copy project files", + shouldExitOnError: true, + callback: (result) => { + console.log(result); + }, + }); } } -// async function copyWorkspaceContracts() {} +async function copyWorkspaceContracts(copyList: CopyCandidates, projectPath: string) { + const copyPaths = async (group: "contracts" | "tests" | "crates") => { + const destDir = path.resolve(projectPath, group); + await ensureDir(destDir); + + for (const entry of copyList[group] as PathEntry[]) { + const basename = path.basename(entry.path); + const destPath = path.join(destDir, basename); + await copy(entry.path, destPath); + } + }; + + await copyPaths("contracts"); + await copyPaths("tests"); + await copyPaths("crates"); +} async function confirmCopyList(candidatesList: CopyCandidates) { if (!candidatesList.tests) candidatesList.tests = []; const { confirmedCopyList } = await inquirer.prompt({ - message: "Please review the list of files and directories to copy:", + message: "Please review the list of files and directories to copy:", name: "confirmedCopyList", type: "checkbox", choices: [ @@ -324,9 +350,9 @@ async function confirmCopyList(candidatesList: CopyCandidates) { checked: true, })), new inquirer.Separator("=====Crates====="), - ...candidatesList.additionalPaths.map((path) => ({ + ...candidatesList.crates.map((path) => ({ name: `${path.name}${path.dirent.isDirectory() ? "/" : ""}`, - value: { ...path, group: "additionalPaths" }, + value: { ...path, group: "crates" }, checked: true, })), new inquirer.Separator("=====Tests====="), @@ -338,11 +364,11 @@ async function confirmCopyList(candidatesList: CopyCandidates) { ], }); - const resultingList: CopyCandidates = { contracts: [], additionalPaths: [], tests: [] }; + const resultingList: CopyCandidates = { contracts: [], crates: [], tests: [] }; confirmedCopyList.forEach( ( item: PathEntry & { - group: "contracts" | "additionalPaths" | "tests"; + group: "contracts" | "crates" | "tests"; } ) => { resultingList[item.group]?.push(item); @@ -452,7 +478,7 @@ async function getCopyCandidatesList( ) { const detectedPaths = { contracts: await getDirsAndFiles(projectPath, pathsToCopy.contractsDirectories), - additionalPaths: + crates: pathsToCopy.cratesDirectories && pathsToCopy.cratesDirectories.length > 0 ? await getDirsAndFiles(projectPath, pathsToCopy.cratesDirectories) : [], From a3a64a013a2957eaceaf15b61b981149fb7a59b3 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 8 May 2023 10:45:45 +0300 Subject: [PATCH 19/46] replace TOML lib --- packages/cli/package.json | 5 +- packages/cli/src/commands/check/index.ts | 4 +- yarn.lock | 706 +++++++++++++++-------- 3 files changed, 480 insertions(+), 235 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 6eaa606c..b86cb42c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -19,13 +19,13 @@ "dependencies": { "@astar-network/swanky-core": "^2.0.0", "@astar-network/swanky-templates": "^2.0.0", + "@iarna/toml": "^2.2.5", "@oclif/core": "2.5.0", "@oclif/plugin-help": "5.2.7", "@oclif/plugin-plugins": "2.3.2", "@oclif/plugin-version": "1.2.1", "@polkadot/util": "11.0.1", "@polkadot/util-crypto": "11.0.1", - "@types/shelljs": "0.8.11", "chalk": "4", "change-case": "4.1.2", "execa": "5.1.1", @@ -40,7 +40,6 @@ "mochawesome": "7.1.3", "semver": "7.3.8", "shelljs": "0.8.5", - "toml": "3.0.0", "ts-mocha": "^10.0.0", "typescript": "4.9.5" }, @@ -48,11 +47,13 @@ "@oclif/test": "2.3.9", "@types/chai": "4", "@types/fs-extra": "9.0.13", + "@types/iarna__toml": "^2.0.2", "@types/inquirer": "8.2.5", "@types/inquirer-fuzzy-path": "^2.3.6", "@types/mocha": "9.0.0", "@types/node": "18.11.9", "@types/semver": "7.3.10", + "@types/shelljs": "0.8.11", "@typescript-eslint/eslint-plugin": "5.35.1", "@typescript-eslint/parser": "5.35.1", "chai": "4", diff --git a/packages/cli/src/commands/check/index.ts b/packages/cli/src/commands/check/index.ts index d5682ac4..09e1c056 100644 --- a/packages/cli/src/commands/check/index.ts +++ b/packages/cli/src/commands/check/index.ts @@ -3,7 +3,7 @@ import { Listr } from "listr2"; import { commandStdoutOrNull, ensureSwankyProject, SwankyConfig } from "@astar-network/swanky-core"; import fs = require("fs-extra"); import path = require("node:path"); -import toml = require("toml"); +import TOML from "@iarna/toml"; import semver = require("semver"); interface Ctx { @@ -78,7 +78,7 @@ export default class Check extends Command { encoding: "utf8", }); - const cargoToml = toml.parse(cargoTomlString); + const cargoToml = TOML.parse(cargoTomlString); const inkDependencies = Object.entries(cargoToml.dependencies) .filter((dependency) => dependency[0].includes("ink_")) diff --git a/yarn.lock b/yarn.lock index 5fc98f91..3a42ef2a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31,6 +31,13 @@ core-js-pure "^3.25.1" regenerator-runtime "^0.13.11" +"@babel/runtime@^7.20.13", "@babel/runtime@^7.20.6": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.5.tgz#8492dddda9644ae3bda3b45eabe87382caee7200" + integrity sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q== + dependencies: + regenerator-runtime "^0.13.11" + "@chevrotain/cst-dts-gen@10.5.0": version "10.5.0" resolved "https://registry.yarnpkg.com/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.5.0.tgz#922ebd8cc59d97241bb01b1b17561a5c1ae0124e" @@ -109,6 +116,11 @@ resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== +"@iarna/toml@^2.2.5": + version "2.2.5" + resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" + integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== + "@isaacs/string-locale-compare@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz#291c227e93fd407a96ecd59879a35809120e432b" @@ -1483,91 +1495,100 @@ dependencies: esquery "^1.0.1" -"@polkadot/api-augment@10.0.1", "@polkadot/api-augment@9.14.2": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-10.0.1.tgz#b8e7766e1d89e3ee753ae053e3edd21ddc0c780c" - integrity sha512-VOMkUurEZ/r27Sx5zeGACApm4wLZx5bsxo8sWxaVE1enZvob1JpzGuN12rTlMr0ej4Az8BxvlGbcT3fQYw275Q== - dependencies: - "@polkadot/api-base" "10.0.1" - "@polkadot/rpc-augment" "10.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/types-augment" "10.0.1" - "@polkadot/types-codec" "10.0.1" - "@polkadot/util" "^11.0.1" - tslib "^2.5.0" - -"@polkadot/api-base@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-10.0.1.tgz#c3f19b5ea483ba642e98724364b58c9e16ba26fe" - integrity sha512-yuCgHYQU7Tn32I4sNk5Qb/OwB85ICXCfWja95watbEP6os601IllI6s7JhFx3G4fjvfI94DzewOnOhhBHt+2SA== - dependencies: - "@polkadot/rpc-core" "10.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/util" "^11.0.1" +"@polkadot/api-augment@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-9.14.2.tgz#2c49cdcfdf7057523db1dc8d7b0801391a8a2e69" + integrity sha512-19MmW8AHEcLkdcUIo3LLk0eCQgREWqNSxkUyOeWn7UiNMY1AhDOOwMStUBNCvrIDK6VL6GGc1sY7rkPCLMuKSw== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/api-base" "9.14.2" + "@polkadot/rpc-augment" "9.14.2" + "@polkadot/types" "9.14.2" + "@polkadot/types-augment" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/util" "^10.4.2" + +"@polkadot/api-base@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-9.14.2.tgz#605b44e3692a125bd8d97eed9cea8af9d0c454e2" + integrity sha512-ky9fmzG1Tnrjr/SBZ0aBB21l0TFr+CIyQenQczoUyVgiuxVaI/2Bp6R2SFrHhG28P+PW2/RcYhn2oIAR2Z2fZQ== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/rpc-core" "9.14.2" + "@polkadot/types" "9.14.2" + "@polkadot/util" "^10.4.2" rxjs "^7.8.0" - tslib "^2.5.0" -"@polkadot/api-contract@10.0.1", "@polkadot/api-contract@9.14.2": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-10.0.1.tgz#cc2ab107a4d78388ede7cab6018162f16e32cecb" - integrity sha512-VLMx3/2eCzuY76ExvEkxeKT0RWS4Fnsn5Shb1YumCWsLNocLO5p/XK6eRU0BaCs+X7zHD1YDF+/5tht/nhuiJA== - dependencies: - "@polkadot/api" "10.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/types-codec" "10.0.1" - "@polkadot/types-create" "10.0.1" - "@polkadot/util" "^11.0.1" - "@polkadot/util-crypto" "^11.0.1" +"@polkadot/api-contract@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-9.14.2.tgz#42ca46eecd6cef64b6c453b452bdb5d22a29b6a3" + integrity sha512-gAAHEh+tOIKuAJWxbAuB8Imo+Z8s0FHdICN6/q4JOxBhONJNA9beHB4wmqWSKvYqYmWrJvtv3HensLaITzAcrQ== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/api" "9.14.2" + "@polkadot/types" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/types-create" "9.14.2" + "@polkadot/util" "^10.4.2" + "@polkadot/util-crypto" "^10.4.2" rxjs "^7.8.0" - tslib "^2.5.0" -"@polkadot/api-derive@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-10.0.1.tgz#fa62a5dc9301167fc628483a6bce65fd5f5a8adc" - integrity sha512-btiE/ATJybKqBBYQvjujXZ+WrMfzwNvKRGI84cbEYnX4OHIo47O/v+zGQ2nUhbOfcJFa8FBU6dB9fMTBRl2R5g== - dependencies: - "@polkadot/api" "10.0.1" - "@polkadot/api-augment" "10.0.1" - "@polkadot/api-base" "10.0.1" - "@polkadot/rpc-core" "10.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/types-codec" "10.0.1" - "@polkadot/util" "^11.0.1" - "@polkadot/util-crypto" "^11.0.1" +"@polkadot/api-derive@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-9.14.2.tgz#e8fcd4ee3f2b80b9fe34d4dec96169c3bdb4214d" + integrity sha512-yw9OXucmeggmFqBTMgza0uZwhNjPxS7MaT7lSCUIRKckl1GejdV+qMhL3XFxPFeYzXwzFpdPG11zWf+qJlalqw== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/api" "9.14.2" + "@polkadot/api-augment" "9.14.2" + "@polkadot/api-base" "9.14.2" + "@polkadot/rpc-core" "9.14.2" + "@polkadot/types" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/util" "^10.4.2" + "@polkadot/util-crypto" "^10.4.2" rxjs "^7.8.0" - tslib "^2.5.0" -"@polkadot/api@10.0.1", "@polkadot/api@9.14.2": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-10.0.1.tgz#ff3272e9f3d5d8c6d7c9e842f0a11c1c6a462265" - integrity sha512-XDJwGqtnFKWlY2kEGOCOAFhczgUxwNZ553zVbmkR65eK4gVlCwIMHLkU/rPlPf/QShrTCZXQhaS/HwIXeFHIvw== - dependencies: - "@polkadot/api-augment" "10.0.1" - "@polkadot/api-base" "10.0.1" - "@polkadot/api-derive" "10.0.1" - "@polkadot/keyring" "^11.0.1" - "@polkadot/rpc-augment" "10.0.1" - "@polkadot/rpc-core" "10.0.1" - "@polkadot/rpc-provider" "10.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/types-augment" "10.0.1" - "@polkadot/types-codec" "10.0.1" - "@polkadot/types-create" "10.0.1" - "@polkadot/types-known" "10.0.1" - "@polkadot/util" "^11.0.1" - "@polkadot/util-crypto" "^11.0.1" +"@polkadot/api@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-9.14.2.tgz#d5cee02236654c6063d7c4b70c78c290db5aba8d" + integrity sha512-R3eYFj2JgY1zRb+OCYQxNlJXCs2FA+AU4uIEiVcXnVLmR3M55tkRNEwYAZmiFxx0pQmegGgPMc33q7TWGdw24A== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/api-augment" "9.14.2" + "@polkadot/api-base" "9.14.2" + "@polkadot/api-derive" "9.14.2" + "@polkadot/keyring" "^10.4.2" + "@polkadot/rpc-augment" "9.14.2" + "@polkadot/rpc-core" "9.14.2" + "@polkadot/rpc-provider" "9.14.2" + "@polkadot/types" "9.14.2" + "@polkadot/types-augment" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/types-create" "9.14.2" + "@polkadot/types-known" "9.14.2" + "@polkadot/util" "^10.4.2" + "@polkadot/util-crypto" "^10.4.2" eventemitter3 "^5.0.0" rxjs "^7.8.0" - tslib "^2.5.0" -"@polkadot/keyring@10.4.2", "@polkadot/keyring@11.0.1", "@polkadot/keyring@^11.0.1": - version "11.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-11.0.1.tgz#e03de854f15ae68b5797137604d5055e55412bac" - integrity sha512-ypQs9cYp/WsmHPvnv4RowbVyZTdOg8rIvcHj6Ols3sqJbQXVn9rfWZTS2l341d9z4kJtmqwbSdKAVV0GT+Mj1A== +"@polkadot/keyring@10.4.2", "@polkadot/keyring@^10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-10.4.2.tgz#793377fdb9076df0af771df11388faa6be03c70d" + integrity sha512-7iHhJuXaHrRTG6cJDbZE9G+c1ts1dujp0qbO4RfAPmT7YUvphHvAtCKueN9UKPz5+TYDL+rP/jDEaSKU8jl/qQ== dependencies: - "@polkadot/util" "11.0.1" - "@polkadot/util-crypto" "11.0.1" - tslib "^2.5.0" + "@babel/runtime" "^7.20.13" + "@polkadot/util" "10.4.2" + "@polkadot/util-crypto" "10.4.2" + +"@polkadot/networks@10.4.2", "@polkadot/networks@^10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-10.4.2.tgz#d7878c6aad8173c800a21140bfe5459261724456" + integrity sha512-FAh/znrEvWBiA/LbcT5GXHsCFUl//y9KqxLghSr/CreAmAergiJNT0MVUezC7Y36nkATgmsr4ylFwIxhVtuuCw== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/util" "10.4.2" + "@substrate/ss58-registry" "^1.38.0" "@polkadot/networks@11.0.1": version "11.0.1" @@ -1578,121 +1599,129 @@ "@substrate/ss58-registry" "^1.39.0" tslib "^2.5.0" -"@polkadot/networks@^11.0.1": - version "11.1.3" - resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-11.1.3.tgz#e113c98269328267962c2047dccca4d2790cc8a5" - integrity sha512-goLpX9SswAGGeh1jXB79wHEfWOF5rLIItMHYalujBmhQVxyAqbxP2tzQqPQXDLcnkWbgwkyYGLXaDD72GBqHZw== - dependencies: - "@polkadot/util" "11.1.3" - "@substrate/ss58-registry" "^1.39.0" - tslib "^2.5.0" - -"@polkadot/rpc-augment@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-10.0.1.tgz#f46a97543310837fd2feabc9419b9e8a6c68f9c0" - integrity sha512-DZK4V99qIhtSS9gaYL5BjsFoa5DxIunO3emxvc5V0jm3o5ZNejGDwRCZNL/atIt5tGyjosU6cYMmVvvgLuQbzg== - dependencies: - "@polkadot/rpc-core" "10.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/types-codec" "10.0.1" - "@polkadot/util" "^11.0.1" - tslib "^2.5.0" - -"@polkadot/rpc-core@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-10.0.1.tgz#f6644c9e61c4001c76db2cc5cf80443d83cef26a" - integrity sha512-HuWFttfQknSfB0Xff+svDP1rba5cwLyOhJ4EDPxz2QcyChTdOCzHBymD9GLKZJEaGp+IT4VOcUPwLDMml1TG1A== - dependencies: - "@polkadot/rpc-augment" "10.0.1" - "@polkadot/rpc-provider" "10.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/util" "^11.0.1" +"@polkadot/rpc-augment@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-9.14.2.tgz#eb70d5511463dab8d995faeb77d4edfe4952fe26" + integrity sha512-mOubRm3qbKZTbP9H01XRrfTk7k5it9WyzaWAg72DJBQBYdgPUUkGSgpPD/Srkk5/5GAQTWVWL1I2UIBKJ4TJjQ== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/rpc-core" "9.14.2" + "@polkadot/types" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/util" "^10.4.2" + +"@polkadot/rpc-core@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-9.14.2.tgz#26d4f00ac7abbf880f8280e9b96235880d35794b" + integrity sha512-krA/mtQ5t9nUQEsEVC1sjkttLuzN6z6gyJxK2IlpMS3S5ncy/R6w4FOpy+Q0H18Dn83JBo0p7ZtY7Y6XkK48Kw== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/rpc-augment" "9.14.2" + "@polkadot/rpc-provider" "9.14.2" + "@polkadot/types" "9.14.2" + "@polkadot/util" "^10.4.2" rxjs "^7.8.0" - tslib "^2.5.0" -"@polkadot/rpc-provider@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-10.0.1.tgz#ad94e2f0c357263a7ea5e1b6566f6e772ad0b38a" - integrity sha512-kv6uShbKgBZtoRcsxTVxpzkjRUqcd/cctG0lEqpy2BZU8koCnSu3XhooifcTm8jO17EUuC4Mm/wfM0DQKmojmQ== - dependencies: - "@polkadot/keyring" "^11.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/types-support" "10.0.1" - "@polkadot/util" "^11.0.1" - "@polkadot/util-crypto" "^11.0.1" - "@polkadot/x-fetch" "^11.0.1" - "@polkadot/x-global" "^11.0.1" - "@polkadot/x-ws" "^11.0.1" +"@polkadot/rpc-provider@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-9.14.2.tgz#0dea667f3a03bf530f202cba5cd360df19b32e30" + integrity sha512-YTSywjD5PF01V47Ru5tln2LlpUwJiSOdz6rlJXPpMaY53hUp7+xMU01FVAQ1bllSBNisSD1Msv/mYHq84Oai2g== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/keyring" "^10.4.2" + "@polkadot/types" "9.14.2" + "@polkadot/types-support" "9.14.2" + "@polkadot/util" "^10.4.2" + "@polkadot/util-crypto" "^10.4.2" + "@polkadot/x-fetch" "^10.4.2" + "@polkadot/x-global" "^10.4.2" + "@polkadot/x-ws" "^10.4.2" eventemitter3 "^5.0.0" mock-socket "^9.2.1" nock "^13.3.0" - tslib "^2.5.0" optionalDependencies: - "@substrate/connect" "0.7.20" - -"@polkadot/types-augment@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-10.0.1.tgz#5c3d40c2976510f893e11f6acde02d8fe0c40a8b" - integrity sha512-PK7CmZwamJiqIIuyeEfV2a1KsEKAuviTH7DkDZWb1aH8495hNkKx88JeTwotjTG6xrkaFZcEqF7UbhXCQs2zOA== - dependencies: - "@polkadot/types" "10.0.1" - "@polkadot/types-codec" "10.0.1" - "@polkadot/util" "^11.0.1" - tslib "^2.5.0" - -"@polkadot/types-codec@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-10.0.1.tgz#c9f4fd0142800fc5339de3c0d6c1611d7d0947d8" - integrity sha512-RrrEuc6PZID/VvIH+eZ6aqvpx7kjbFD58nsb/8ZQR57352EP4tVvR3arHsqh6j2WiM62uJ3zKT/rL8bCYVHjIw== - dependencies: - "@polkadot/util" "^11.0.1" - "@polkadot/x-bigint" "^11.0.1" - tslib "^2.5.0" - -"@polkadot/types-create@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-10.0.1.tgz#c94edbd181abc5b589a7807b20ccd16788eae2cd" - integrity sha512-Sr4BmswhFGj09e727XeS4nOnrvkWwWSSaXAwLenwVOCK9UaevYw+jmc28HcYypL5+i8kT4jKyU+1av7UtJyOzg== - dependencies: - "@polkadot/types-codec" "10.0.1" - "@polkadot/util" "^11.0.1" - tslib "^2.5.0" - -"@polkadot/types-known@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-10.0.1.tgz#0bbee8b8556d202549b2cacd7336122da9796492" - integrity sha512-GoHnDS1yKwLmsEQX7xjcMNR5SvaszxGV7E5Jkgl16VOF3QmO13Vs19jz1bdyv4Dw6soKFI5XAUEJY9PoA0DDMg== - dependencies: - "@polkadot/networks" "^11.0.1" - "@polkadot/types" "10.0.1" - "@polkadot/types-codec" "10.0.1" - "@polkadot/types-create" "10.0.1" - "@polkadot/util" "^11.0.1" - tslib "^2.5.0" + "@substrate/connect" "0.7.19" + +"@polkadot/types-augment@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-9.14.2.tgz#1a478e18e713b04038f3e171287ee5abe908f0aa" + integrity sha512-WO9d7RJufUeY3iFgt2Wz762kOu1tjEiGBR5TT4AHtpEchVHUeosVTrN9eycC+BhleqYu52CocKz6u3qCT/jKLg== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/types" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/util" "^10.4.2" + +"@polkadot/types-codec@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-9.14.2.tgz#d625c80495d7a68237b3d5c0a60ff10d206131fa" + integrity sha512-AJ4XF7W1no4PENLBRU955V6gDxJw0h++EN3YoDgThozZ0sj3OxyFupKgNBZcZb2V23H8JxQozzIad8k+nJbO1w== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/util" "^10.4.2" + "@polkadot/x-bigint" "^10.4.2" + +"@polkadot/types-create@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-9.14.2.tgz#aec515a2d3bc7e7b7802095cdd35ece48dc442bc" + integrity sha512-nSnKpBierlmGBQT8r6/SHf6uamBIzk4WmdMsAsR4uJKJF1PtbIqx2W5PY91xWSiMSNMzjkbCppHkwaDAMwLGaw== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/types-codec" "9.14.2" + "@polkadot/util" "^10.4.2" + +"@polkadot/types-known@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-9.14.2.tgz#17fe5034a5b907bd006093a687f112b07edadf10" + integrity sha512-iM8WOCgguzJ3TLMqlm4K1gKQEwWm2zxEKT1HZZ1irs/lAbBk9MquDWDvebryiw3XsLB8xgrp3RTIBn2Q4FjB2A== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/networks" "^10.4.2" + "@polkadot/types" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/types-create" "9.14.2" + "@polkadot/util" "^10.4.2" + +"@polkadot/types-support@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-9.14.2.tgz#d25e8d4e5ec3deef914cb55fc8bc5448431ddd18" + integrity sha512-VWCOPgXDK3XtXT7wMLyIWeNDZxUbNcw/8Pn6n6vMogs7o/n4h6WGbGMeTIQhPWyn831/RmkVs5+2DUC+2LlOhw== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/util" "^10.4.2" + +"@polkadot/types@9.14.2": + version "9.14.2" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-9.14.2.tgz#5105f41eb9e8ea29938188d21497cbf1753268b8" + integrity sha512-hGLddTiJbvowhhUZJ3k+olmmBc1KAjWIQxujIUIYASih8FQ3/YJDKxaofGOzh0VygOKW3jxQBN2VZPofyDP9KQ== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/keyring" "^10.4.2" + "@polkadot/types-augment" "9.14.2" + "@polkadot/types-codec" "9.14.2" + "@polkadot/types-create" "9.14.2" + "@polkadot/util" "^10.4.2" + "@polkadot/util-crypto" "^10.4.2" + rxjs "^7.8.0" -"@polkadot/types-support@10.0.1": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-10.0.1.tgz#301125e2e2840801e575cb969fe0cc2bb36df86a" - integrity sha512-J5i4BM08/HZGBNQhN2X29eWPS8+Ie7n6O8L0y8IZ3rS0hkXU1V2SFd9X4LO8ADPGvT3JvPpQKESsq0f/Z5UbYQ== +"@polkadot/util-crypto@10.4.2", "@polkadot/util-crypto@^10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-10.4.2.tgz#871fb69c65768bd48c57bb5c1f76a85d979fb8b5" + integrity sha512-RxZvF7C4+EF3fzQv8hZOLrYCBq5+wA+2LWv98nECkroChY3C2ZZvyWDqn8+aonNULt4dCVTWDZM0QIY6y4LUAQ== dependencies: - "@polkadot/util" "^11.0.1" - tslib "^2.5.0" - -"@polkadot/types@10.0.1", "@polkadot/types@9.14.2": - version "10.0.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-10.0.1.tgz#54c636bbe6f151c5e4bc2c9220bb98bbb1fc428d" - integrity sha512-/ALKLIWulXJrK/nNEY8iXByZRwaq1uQiRzzFqwWgfGpnLVCHYljV5ZEi3QqeDjGJzywQYxqJB+bJSiUe0+iNvg== - dependencies: - "@polkadot/keyring" "^11.0.1" - "@polkadot/types-augment" "10.0.1" - "@polkadot/types-codec" "10.0.1" - "@polkadot/types-create" "10.0.1" - "@polkadot/util" "^11.0.1" - "@polkadot/util-crypto" "^11.0.1" - rxjs "^7.8.0" - tslib "^2.5.0" + "@babel/runtime" "^7.20.13" + "@noble/hashes" "1.2.0" + "@noble/secp256k1" "1.7.1" + "@polkadot/networks" "10.4.2" + "@polkadot/util" "10.4.2" + "@polkadot/wasm-crypto" "^6.4.1" + "@polkadot/x-bigint" "10.4.2" + "@polkadot/x-randomvalues" "10.4.2" + "@scure/base" "1.1.1" + ed2curve "^0.3.0" + tweetnacl "^1.0.3" -"@polkadot/util-crypto@10.4.2", "@polkadot/util-crypto@11.0.1", "@polkadot/util-crypto@^11.0.1": +"@polkadot/util-crypto@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-11.0.1.tgz#ec17ee499bf78262d1cc23963fb365aeb4ede34b" integrity sha512-IEircl43g6ZT9IqjzB1ttR7vK+/IaUar6l8yeU+Bn6x0TSS6tXyOJmXfVsXsqfLM58GIXY18mBZCTfhF/LwuKg== @@ -1709,7 +1738,20 @@ tslib "^2.5.0" tweetnacl "^1.0.3" -"@polkadot/util@10.4.2", "@polkadot/util@11.0.1", "@polkadot/util@11.1.3", "@polkadot/util@^11.0.1": +"@polkadot/util@10.4.2", "@polkadot/util@^10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-10.4.2.tgz#df41805cb27f46b2b4dad24c371fa2a68761baa1" + integrity sha512-0r5MGICYiaCdWnx+7Axlpvzisy/bi1wZGXgCSw5+ZTyPTOqvsYRqM2X879yxvMsGfibxzWqNzaiVjToz1jvUaA== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/x-bigint" "10.4.2" + "@polkadot/x-global" "10.4.2" + "@polkadot/x-textdecoder" "10.4.2" + "@polkadot/x-textencoder" "10.4.2" + "@types/bn.js" "^5.1.1" + bn.js "^5.2.1" + +"@polkadot/util@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-11.0.1.tgz#04ce76339a7bd6ea2746173cbac119905330b47a" integrity sha512-IMk3hPxIGzlAW6fhOigVPMvaW0E+dTMzO1IKnEATdhAJFKjaqU4K9Pwj79fj93xgM5Y8PkHV5sUPJKuce+u+4A== @@ -1722,6 +1764,13 @@ bn.js "^5.2.1" tslib "^2.5.0" +"@polkadot/wasm-bridge@6.4.1": + version "6.4.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-6.4.1.tgz#e97915dd67ba543ec3381299c2a5b9330686e27e" + integrity sha512-QZDvz6dsUlbYsaMV5biZgZWkYH9BC5AfhT0f0/knv8+LrbAoQdP3Asbvddw8vyU9sbpuCHXrd4bDLBwUCRfrBQ== + dependencies: + "@babel/runtime" "^7.20.6" + "@polkadot/wasm-bridge@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-7.0.2.tgz#c906c12fa5a2ce40515c37d88a17637f467f6199" @@ -1729,6 +1778,13 @@ dependencies: tslib "^2.5.0" +"@polkadot/wasm-crypto-asmjs@6.4.1": + version "6.4.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-6.4.1.tgz#3cc76bbda5ea4a7a860982c64f9565907b312253" + integrity sha512-UxZTwuBZlnODGIQdCsE2Sn/jU0O2xrNQ/TkhRFELfkZXEXTNu4lw6NpaKq7Iey4L+wKd8h4lT3VPVkMcPBLOvA== + dependencies: + "@babel/runtime" "^7.20.6" + "@polkadot/wasm-crypto-asmjs@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.0.2.tgz#c7f807ee4f290c98d6b17b629f0b2cdcc4f8b186" @@ -1736,6 +1792,16 @@ dependencies: tslib "^2.5.0" +"@polkadot/wasm-crypto-init@6.4.1": + version "6.4.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-6.4.1.tgz#4d9ab0030db52cf177bf707ef8e77aa4ca721668" + integrity sha512-1ALagSi/nfkyFaH6JDYfy/QbicVbSn99K8PV9rctDUfxc7P06R7CoqbjGQ4OMPX6w1WYVPU7B4jPHGLYBlVuMw== + dependencies: + "@babel/runtime" "^7.20.6" + "@polkadot/wasm-bridge" "6.4.1" + "@polkadot/wasm-crypto-asmjs" "6.4.1" + "@polkadot/wasm-crypto-wasm" "6.4.1" + "@polkadot/wasm-crypto-init@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.0.2.tgz#e707c34ba6be9ee1419453eeceab2b441da7fef3" @@ -1746,6 +1812,14 @@ "@polkadot/wasm-crypto-wasm" "7.0.2" tslib "^2.5.0" +"@polkadot/wasm-crypto-wasm@6.4.1": + version "6.4.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-6.4.1.tgz#97180f80583b18f6a13c1054fa5f7e8da40b1028" + integrity sha512-3VV9ZGzh0ZY3SmkkSw+0TRXxIpiO0nB8lFwlRgcwaCihwrvLfRnH9GI8WE12mKsHVjWTEVR3ogzILJxccAUjDA== + dependencies: + "@babel/runtime" "^7.20.6" + "@polkadot/wasm-util" "6.4.1" + "@polkadot/wasm-crypto-wasm@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.0.2.tgz#6adecfd7ac7dec7967c427adcc18c9b6be09e566" @@ -1754,6 +1828,18 @@ "@polkadot/wasm-util" "7.0.2" tslib "^2.5.0" +"@polkadot/wasm-crypto@^6.4.1": + version "6.4.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-6.4.1.tgz#79310e23ad1ca62362ba893db6a8567154c2536a" + integrity sha512-FH+dcDPdhSLJvwL0pMLtn/LIPd62QDPODZRCmDyw+pFjLOMaRBc7raomWUOqyRWJTnqVf/iscc2rLVLNMyt7ag== + dependencies: + "@babel/runtime" "^7.20.6" + "@polkadot/wasm-bridge" "6.4.1" + "@polkadot/wasm-crypto-asmjs" "6.4.1" + "@polkadot/wasm-crypto-init" "6.4.1" + "@polkadot/wasm-crypto-wasm" "6.4.1" + "@polkadot/wasm-util" "6.4.1" + "@polkadot/wasm-crypto@^7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-7.0.2.tgz#44aa5f5322f3e8bdcacb1806e3e1a6543d20cbb4" @@ -1766,6 +1852,13 @@ "@polkadot/wasm-util" "7.0.2" tslib "^2.5.0" +"@polkadot/wasm-util@6.4.1": + version "6.4.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-6.4.1.tgz#74aecc85bec427a9225d9874685944ea3dc3ab76" + integrity sha512-Uwo+WpEsDmFExWC5kTNvsVhvqXMZEKf4gUHXFn4c6Xz4lmieRT5g+1bO1KJ21pl4msuIgdV3Bksfs/oiqMFqlw== + dependencies: + "@babel/runtime" "^7.20.6" + "@polkadot/wasm-util@7.0.2": version "7.0.2" resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-7.0.2.tgz#1f3eaf048bd9134f08857e74325084ce129cd50c" @@ -1773,6 +1866,14 @@ dependencies: tslib "^2.5.0" +"@polkadot/x-bigint@10.4.2", "@polkadot/x-bigint@^10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-10.4.2.tgz#7eb2ec732259df48b5a00f07879a1331e05606ec" + integrity sha512-awRiox+/XSReLzimAU94fPldowiwnnMUkQJe8AebYhNocAj6SJU00GNoj6j6tAho6yleOwrTJXZaWFBaQVJQNg== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/x-global" "10.4.2" + "@polkadot/x-bigint@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-11.0.1.tgz#0a2c21f8fa76d1299a02111f8391d16593f456ae" @@ -1781,22 +1882,22 @@ "@polkadot/x-global" "11.0.1" tslib "^2.5.0" -"@polkadot/x-bigint@^11.0.1": - version "11.1.3" - resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-11.1.3.tgz#37b09a12a9ed6df704e047e261f1b8b2ac978497" - integrity sha512-fRUUHfW9VFsXT7sLUUY7gSu8v+PvzNLRwvjnp+Ly8vFx9LTLuVGFCi+mpysuRTaPpqZZJlzBJ3fST7xTGh67Pg== +"@polkadot/x-fetch@^10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-10.4.2.tgz#bc6ba70de71a252472fbe36180511ed920e05f05" + integrity sha512-Ubb64yaM4qwhogNP+4mZ3ibRghEg5UuCYRMNaCFoPgNAY8tQXuDKrHzeks3+frlmeH9YRd89o8wXLtWouwZIcw== dependencies: - "@polkadot/x-global" "11.1.3" - tslib "^2.5.0" + "@babel/runtime" "^7.20.13" + "@polkadot/x-global" "10.4.2" + "@types/node-fetch" "^2.6.2" + node-fetch "^3.3.0" -"@polkadot/x-fetch@^11.0.1": - version "11.1.3" - resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-11.1.3.tgz#e39df53fc7fb6399d3883b45d03f6ef7f265a7f9" - integrity sha512-+Z0RxxsN7+l2ZmmDdHqOo0kgqvjXJ1bw8CwTVnq3t9nPgZKn2pC3Fq3xdj/sRWiLuf/UhgCxKfYfMmt5ek4kIg== +"@polkadot/x-global@10.4.2", "@polkadot/x-global@^10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-10.4.2.tgz#5662366e3deda0b4c8f024b2d902fa838f9e60a4" + integrity sha512-g6GXHD/ykZvHap3M6wh19dO70Zm43l4jEhlxf5LtTo5/0/UporFCXr2YJYZqfbn9JbQwl1AU+NroYio+vtJdiA== dependencies: - "@polkadot/x-global" "11.1.3" - node-fetch "^3.3.1" - tslib "^2.5.0" + "@babel/runtime" "^7.20.13" "@polkadot/x-global@11.0.1": version "11.0.1" @@ -1805,12 +1906,13 @@ dependencies: tslib "^2.5.0" -"@polkadot/x-global@11.1.3", "@polkadot/x-global@^11.0.1": - version "11.1.3" - resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-11.1.3.tgz#4086694f52373fea63910b62da999bf0981d7d86" - integrity sha512-R3aqtIjgzFHJ3TyX6wavhp+59oLbZiqczIHkaas/nJe21+SVARqFmIII6BwS7ty7+8Uu4fHliA9re+ZSUp+rwg== +"@polkadot/x-randomvalues@10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-10.4.2.tgz#895f1220d5a4522a83d8d5014e3c1e03b129893e" + integrity sha512-mf1Wbpe7pRZHO0V3V89isPLqZOy5XGX2bCqsfUWHgb1NvV1MMx5TjVjdaYyNlGTiOkAmJKlOHshcfPU2sYWpNg== dependencies: - tslib "^2.5.0" + "@babel/runtime" "^7.20.13" + "@polkadot/x-global" "10.4.2" "@polkadot/x-randomvalues@11.0.1": version "11.0.1" @@ -1820,6 +1922,14 @@ "@polkadot/x-global" "11.0.1" tslib "^2.5.0" +"@polkadot/x-textdecoder@10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-10.4.2.tgz#93202f3e5ad0e7f75a3fa02d2b8a3343091b341b" + integrity sha512-d3ADduOKUTU+cliz839+KCFmi23pxTlabH7qh7Vs1GZQvXOELWdqFOqakdiAjtMn68n1KVF4O14Y+OUm7gp/zA== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/x-global" "10.4.2" + "@polkadot/x-textdecoder@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-11.0.1.tgz#4f42d41150ebf5c36a40adb0dfe7b7da530a21a5" @@ -1828,6 +1938,14 @@ "@polkadot/x-global" "11.0.1" tslib "^2.5.0" +"@polkadot/x-textencoder@10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-10.4.2.tgz#cd2e6c8a66b0b400a73f0164e99c510fb5c83501" + integrity sha512-mxcQuA1exnyv74Kasl5vxBq01QwckG088lYjc3KwmND6+pPrW2OWagbxFX5VFoDLDAE+UJtnUHsjdWyOTDhpQA== + dependencies: + "@babel/runtime" "^7.20.13" + "@polkadot/x-global" "10.4.2" + "@polkadot/x-textencoder@11.0.1": version "11.0.1" resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-11.0.1.tgz#f95c7c3e06065862e3a2624ad873bbf0329c7d3b" @@ -1836,14 +1954,15 @@ "@polkadot/x-global" "11.0.1" tslib "^2.5.0" -"@polkadot/x-ws@^11.0.1": - version "11.1.3" - resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-11.1.3.tgz#5a759bcbbbdceeecca53bcc74170e52cd3ca774b" - integrity sha512-omNU2mIVX997HiHm2YxEdJdyCFnv+oTyKWZd0+FdS47rdfhVwD+H9/bS+rtQ9lIqfhODdGmw3fG//gq1KpYJcw== +"@polkadot/x-ws@^10.4.2": + version "10.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-10.4.2.tgz#4e9d88f37717570ccf942c6f4f63b06260f45025" + integrity sha512-3gHSTXAWQu1EMcMVTF5QDKHhEHzKxhAArweEyDXE7VsgKUP/ixxw4hVZBrkX122iI5l5mjSiooRSnp/Zl3xqDQ== dependencies: - "@polkadot/x-global" "11.1.3" - tslib "^2.5.0" - ws "^8.13.0" + "@babel/runtime" "^7.20.13" + "@polkadot/x-global" "10.4.2" + "@types/websocket" "^1.0.5" + websocket "^1.0.34" "@scure/base@1.1.1": version "1.1.1" @@ -1860,14 +1979,27 @@ resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.1.tgz#fa5738039586c648013caa6a0c95c43265dbe77d" integrity sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg== -"@substrate/connect@0.7.20": - version "0.7.20" - resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.20.tgz#ce5647368be21199d608715bbd77bcb7c25a4227" - integrity sha512-f/sMgGUikJxDaNMkQXCU/1WaMy0MLJB+KS+P+CpsIhWyxj2dOcph5YXjAJiIlgrZqHImV28RJnraxXBD3AlmLQ== +"@substrate/connect@0.7.19": + version "0.7.19" + resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.19.tgz#7c879cb275bc7ac2fe9edbf797572d4ff8d8b86a" + integrity sha512-+DDRadc466gCmDU71sHrYOt1HcI2Cbhm7zdCFjZfFVHXhC/E8tOdrVSglAH2HDEHR0x2SiHRxtxOGC7ak2Zjog== dependencies: "@substrate/connect-extension-protocol" "^1.0.1" + "@substrate/smoldot-light" "0.7.9" eventemitter3 "^4.0.7" - smoldot "0.7.11" + +"@substrate/smoldot-light@0.7.9": + version "0.7.9" + resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.7.9.tgz#68449873a25558e547e9468289686ee228a9930f" + integrity sha512-HP8iP7sFYlpSgjjbo0lqHyU+gu9lL2hbDNce6dWk5/10mFFF9jKIFGfui4zCecUY808o/Go9pan/31kMJoLbug== + dependencies: + pako "^2.0.4" + ws "^8.8.1" + +"@substrate/ss58-registry@^1.38.0": + version "1.40.0" + resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.40.0.tgz#2223409c496271df786c1ca8496898896595441e" + integrity sha512-QuU2nBql3J4KCnOWtWDw4n1K4JU0T79j54ZZvm/9nhsX6AIar13FyhsaBfs6QkJ2ixTQAnd7TocJIoJRWbqMZA== "@substrate/ss58-registry@^1.39.0": version "1.39.0" @@ -1972,6 +2104,13 @@ resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812" integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== +"@types/iarna__toml@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@types/iarna__toml/-/iarna__toml-2.0.2.tgz#2e61b079e50760b477bc70e4df1fe5b633ef6c63" + integrity sha512-Q3obxKhBLVVbEQ8zsAmsQVobAAZhi8dFFFjF0q5xKXiaHvH8IkSxcbM27e46M9feUMieR03SPpmp5CtaNzpdBg== + dependencies: + "@types/node" "*" + "@types/inquirer-autocomplete-prompt@^2": version "2.0.0" resolved "https://registry.yarnpkg.com/@types/inquirer-autocomplete-prompt/-/inquirer-autocomplete-prompt-2.0.0.tgz#8b60cab59bb6b4c2f1885cb86316f0aa82fa24c9" @@ -2044,6 +2183,14 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.0.0.tgz#3205bcd15ada9bc681ac20bef64e9e6df88fd297" integrity sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA== +"@types/node-fetch@^2.6.2": + version "2.6.3" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.3.tgz#175d977f5e24d93ad0f57602693c435c57ad7e80" + integrity sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w== + dependencies: + "@types/node" "*" + form-data "^3.0.0" + "@types/node@*": version "18.14.6" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.14.6.tgz#ae1973dd2b1eeb1825695bb11ebfb746d27e3e93" @@ -2121,6 +2268,13 @@ "@types/expect" "^1.20.4" "@types/node" "*" +"@types/websocket@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.5.tgz#3fb80ed8e07f88e51961211cd3682a3a4a81569c" + integrity sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ== + dependencies: + "@types/node" "*" + "@typescript-eslint/eslint-plugin@5.35.1": version "5.35.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.35.1.tgz#0d822bfea7469904dfc1bb8f13cabd362b967c93" @@ -2699,6 +2853,13 @@ buffer@^5.2.1, buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" +bufferutil@^4.0.1: + version "4.0.7" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad" + integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw== + dependencies: + node-gyp-build "^4.3.0" + builtins@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" @@ -3360,6 +3521,14 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + dargs@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" @@ -3392,6 +3561,13 @@ debug@4, debug@4.3.4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, de dependencies: ms "2.1.2" +debug@^2.2.0: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" @@ -3685,6 +3861,32 @@ error@^10.4.0: resolved "https://registry.yarnpkg.com/error/-/error-10.4.0.tgz#6fcf0fd64bceb1e750f8ed9a3dd880f00e46a487" integrity sha512-YxIFEJuhgcICugOUvRx5th0UM+ActZ9sjY0QJmeVwsQdvosZ7kYzc9QqS0Da3R5iUmgU5meGIxh0xBeZpMVeLw== +es5-ext@^0.10.35, es5-ext@^0.10.50: + version "0.10.62" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" + integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== + dependencies: + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + next-tick "^1.1.0" + +es6-iterator@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-symbol@^3.1.1, es6-symbol@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -3868,6 +4070,13 @@ execa@5.1.1, execa@^5.0.0, execa@^5.1.1: signal-exit "^3.0.3" strip-final-newline "^2.0.0" +ext@^1.1.2: + version "1.7.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" + integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== + dependencies: + type "^2.7.2" + external-editor@^3.0.3: version "3.1.0" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" @@ -4092,6 +4301,15 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -5841,6 +6059,11 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== + ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -5902,6 +6125,11 @@ neo-async@^2.6.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -5947,7 +6175,7 @@ node-fetch@^2.6.1, node-fetch@^2.6.7: dependencies: whatwg-url "^5.0.0" -node-fetch@^3.3.1: +node-fetch@^3.3.0: version "3.3.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.1.tgz#b3eea7b54b3a48020e46f4f88b9c5a7430d20b2e" integrity sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow== @@ -7310,14 +7538,6 @@ smart-buffer@^4.2.0: resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== -smoldot@0.7.11: - version "0.7.11" - resolved "https://registry.yarnpkg.com/smoldot/-/smoldot-0.7.11.tgz#8e39464f2cf7736eacff5f2a87819dd9f688b352" - integrity sha512-aE1led154FJ2/jrXKv2HLKdNIyvYJG6H2ZmKYFS++kW1OAcTQ6idDy3fzAI1VdydLDYK0YbKUsj7SJDmrjsS3g== - dependencies: - pako "^2.0.4" - ws "^8.8.1" - snake-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c" @@ -7745,11 +7965,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -toml@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" - integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== - tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -7912,6 +8127,16 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.7.2: + version "2.7.2" + resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" + integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" @@ -8029,6 +8254,13 @@ url@0.10.3: punycode "1.3.2" querystring "0.2.0" +utf-8-validate@^5.0.2: + version "5.0.10" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" + integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== + dependencies: + node-gyp-build "^4.3.0" + util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -8137,6 +8369,18 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== +websocket@^1.0.34: + version "1.0.34" + resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" + integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== + dependencies: + bufferutil "^4.0.1" + debug "^2.2.0" + es5-ext "^0.10.50" + typedarray-to-buffer "^3.1.5" + utf-8-validate "^5.0.2" + yaeti "^0.0.6" + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -8299,11 +8543,6 @@ write-pkg@^4.0.0: type-fest "^0.4.1" write-json-file "^3.2.0" -ws@^8.13.0: - version "8.13.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== - ws@^8.8.1: version "8.12.1" resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.1.tgz#c51e583d79140b5e42e39be48c934131942d4a8f" @@ -8339,6 +8578,11 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== +yaeti@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + integrity sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug== + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" From 318f139a63bc9f45b9b0a66e422bcf07fbeabf72 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 8 May 2023 10:46:25 +0300 Subject: [PATCH 20/46] wip: copy toolchain files --- packages/cli/src/commands/init/index.ts | 85 +++++++++++++++++++++---- 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 03347666..18e1a99d 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -1,10 +1,20 @@ import { Args, Flags } from "@oclif/core"; import path = require("node:path"); -import { ensureDir, writeJSON, stat, readdir, pathExists, readFile, Dirent, copy } from "fs-extra"; +import { + ensureDir, + writeJSON, + stat, + readdir, + pathExists, + readFile, + Dirent, + copy, + outputFile, +} from "fs-extra"; import execa = require("execa"); import { paramCase, pascalCase, snakeCase } from "change-case"; import inquirer = require("inquirer"); -import { load } from "js-toml"; +import TOML from "@iarna/toml"; import { choice, email, name, pickLanguage, pickTemplate } from "../../lib/prompts"; import { checkCliDependencies, @@ -279,7 +289,7 @@ export class Init extends BaseCommand { throw error; } - let rootTomlPaths = await getRootCargoToml(pathToExistingProject); + let rootTomlPaths = await getRootCargoTomlPaths(pathToExistingProject); if (rootTomlPaths) { console.log("Workspaces detected in root Cargo.toml file."); @@ -315,6 +325,47 @@ export class Init extends BaseCommand { console.log(result); }, }); + + if (!this.configBuilder.contracts) this.configBuilder.contracts = {}; + + for (const contract of confirmedCopyList.contracts) { + this.configBuilder.contracts[contract.name] = { + name: contract.name, + deployments: [], + language: "ink", + }; + } + + let rootToml = await readRootCargoToml(pathToExistingProject); + + if (!rootToml) rootToml = { workspace: {} }; + + rootToml.workspace.members = ["contracts/*"]; + rootToml.workspace.exclude = ["crates/*"]; + + this.taskQueue.push({ + task: async (tomlObject, projectPath) => { + const tomlString = TOML.stringify(tomlObject); + const rootTomlPath = path.resolve(projectPath, "Cargo.toml"); + await outputFile(rootTomlPath, tomlString); + }, + args: [rootToml, this.projectPath], + runningMessage: "Writing Cargo.toml", + }); + + this.taskQueue.push({ + task: async (pathToExistingProject, projectPath) => { + const fileList = ["rust-toolchain.toml", ".rustfmt.toml"]; + for (const fileName of fileList) { + const filePath = await path.resolve(pathToExistingProject, fileName); + if (await pathExists(filePath)) { + await copy(filePath, path.resolve(projectPath, fileName)); + } + } + }, + args: [pathToExistingProject, this.projectPath], + runningMessage: "Copying workspace files", + }); } } @@ -420,14 +471,10 @@ async function detectTests(pathToExistingProject: string) { return testDir; } -async function getRootCargoToml(pathToProject: string) { - const rootTomlPath = path.resolve(pathToProject, "Cargo.toml"); - if (!(await pathExists(rootTomlPath))) return null; +async function getRootCargoTomlPaths(pathToProject: string) { + const toml = await readRootCargoToml(pathToProject); - const fileData = await readFile(rootTomlPath, "utf-8"); - const toml: { workspace?: { members?: string[]; exclude?: string[] } } = load(fileData); - - if (!toml.workspace?.members) return null; + if (!toml?.workspace.members) return null; return { contractsDirectories: toml.workspace.members, @@ -435,6 +482,17 @@ async function getRootCargoToml(pathToProject: string) { }; } +async function readRootCargoToml(pathToProject: string) { + const rootTomlPath = path.resolve(pathToProject, "Cargo.toml"); + if (!(await pathExists(rootTomlPath))) return null; + const fileData = await readFile(rootTomlPath, "utf-8"); + const toml: any = TOML.parse(fileData); + + if (!toml.workspace) toml.workspace = {}; + + return toml; +} + async function getManualPaths(pathToProject: string) { console.log("No Cargo.toml found in the provided directory, or no workspace field within it."); const { contractsDirectory, cratesDirectory, useCrateDirectory } = await inquirer.prompt([ @@ -513,8 +571,9 @@ async function getDirsAndFiles(projectPath: string, globList: string[]) { //[X] 4. add directories from Cargo.toml/exclude path to copy list //[X] 5. make a list (checkbox) for user to confirm contracts/crates/files to copy //[X] 6. look for test/tests directory and add it to the list (also take manual input) -//[ ] 7. copy all the selected directories/files and update the swanky.config -//[ ] 8. copy cargo.toml from the root, modify path if needed ( "uniswap-v2/contracts/**" -> "contracts/**") +//[X] 7. copy all the selected directories/files +//[X] 7a. update the swanky.config +//[X] 8. copy cargo.toml from the root, modify path if needed ( "uniswap-v2/contracts/**" -> "contracts/**") //[ ] 9. keep log of all the steps and write it to file -//[ ] 10. Copy rust.toolchain and .rustfmt.toml if exists +//[X] 10. Copy rust.toolchain and .rustfmt.toml if exists //[ ] 11. Merge package.json from imported project into the one generated from template From fbb90bed13f0269c0bfae4ede694c5e9f9fef495 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 8 May 2023 11:22:09 +0300 Subject: [PATCH 21/46] separate common and contract template processing --- packages/cli/package.json | 1 + packages/cli/src/commands/init/index.ts | 29 ++++++++++++++++++++----- packages/core/src/lib/tasks.ts | 8 +------ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index b86cb42c..7c1e445e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -35,6 +35,7 @@ "inquirer-fuzzy-path": "^2.3.0", "js-toml": "^0.1.1", "listr2": "5.0.7", + "lodash": "^4.17.21", "mocha": "10.2.0", "mocha-suppress-logs": "0.3.1", "mochawesome": "7.1.3", diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index 18e1a99d..dc778331 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -18,7 +18,8 @@ import TOML from "@iarna/toml"; import { choice, email, name, pickLanguage, pickTemplate } from "../../lib/prompts"; import { checkCliDependencies, - copyTemplateFiles, + copyCommonTemplateFiles, + copyContractTemplateFiles, downloadNode, installDeps, ChainAccount, @@ -30,7 +31,7 @@ import { import { getAllTemplateNames, getTemplates } from "@astar-network/swanky-templates"; import { BaseCommand } from "../../lib/baseCommand"; import globby = require("globby"); - +import { merge } from "lodash"; import inquirerFuzzyPath from "inquirer-fuzzy-path"; const { @@ -146,6 +147,23 @@ export class Init extends BaseCommand { await this.generate(args.projectName); } + const templates = getTemplates("ink"); + this.taskQueue.push({ + task: copyCommonTemplateFiles, + args: [templates.templatesPath, this.projectPath], + runningMessage: "Copying common template files", + }); + + this.taskQueue.push({ + task: processTemplates, + args: [ + this.projectPath, + { + project_name: paramCase(args.projectName), + }, + ], + runningMessage: "Processing common templates", + }); this.taskQueue.push({ task: installDeps, args: [this.projectPath], @@ -238,14 +256,13 @@ export class Init extends BaseCommand { }); this.taskQueue.push({ - task: copyTemplateFiles, + task: copyContractTemplateFiles, args: [ - templates.templatesPath, path.resolve(templates.contractTemplatesPath, answers.contractTemplate), answers.contractName, this.projectPath, ], - runningMessage: "Copying template files", + runningMessage: "Copying contract template files", }); this.taskQueue.push({ @@ -263,7 +280,7 @@ export class Init extends BaseCommand { contract_language: contractLanguage, }, ], - runningMessage: "Processing templates", + runningMessage: "Processing contract template", }); this.configBuilder.contracts = { diff --git a/packages/core/src/lib/tasks.ts b/packages/core/src/lib/tasks.ts index d1bf33a4..d500e3fe 100644 --- a/packages/core/src/lib/tasks.ts +++ b/packages/core/src/lib/tasks.ts @@ -25,12 +25,7 @@ export async function checkCliDependencies(spinner: Spinner) { } } -export async function copyTemplateFiles( - templatesPath: string, - contractTemplatePath: string, - contractName: string, - projectPath: string -) { +export async function copyCommonTemplateFiles(templatesPath: string, projectPath: string) { await ensureDir(projectPath); const commonFiles = await globby(`*`, { cwd: templatesPath }); await Promise.all( @@ -39,7 +34,6 @@ export async function copyTemplateFiles( }) ); await rename(path.resolve(projectPath, "gitignore"), path.resolve(projectPath, ".gitignore")); - await copyContractTemplateFiles(contractTemplatePath, contractName, projectPath); } export async function copyContractTemplateFiles( From ede5dd10c8d6abc917261f2b107ad23218c9b6d6 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 8 May 2023 11:40:11 +0300 Subject: [PATCH 22/46] merge package.json --- packages/cli/src/commands/init/index.ts | 33 ++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/commands/init/index.ts b/packages/cli/src/commands/init/index.ts index dc778331..ea374c3d 100644 --- a/packages/cli/src/commands/init/index.ts +++ b/packages/cli/src/commands/init/index.ts @@ -10,6 +10,9 @@ import { Dirent, copy, outputFile, + readJSON, + writeJson, + remove, } from "fs-extra"; import execa = require("execa"); import { paramCase, pascalCase, snakeCase } from "change-case"; @@ -141,12 +144,6 @@ export class Init extends BaseCommand { if (!(error instanceof Error) || !error.message.includes("ENOENT")) throw error; } - if (flags.convert) { - await this.convert(flags.convert); - } else { - await this.generate(args.projectName); - } - const templates = getTemplates("ink"); this.taskQueue.push({ task: copyCommonTemplateFiles, @@ -164,6 +161,13 @@ export class Init extends BaseCommand { ], runningMessage: "Processing common templates", }); + + if (flags.convert) { + await this.convert(flags.convert); + } else { + await this.generate(args.projectName); + } + this.taskQueue.push({ task: installDeps, args: [this.projectPath], @@ -383,6 +387,23 @@ export class Init extends BaseCommand { args: [pathToExistingProject, this.projectPath], runningMessage: "Copying workspace files", }); + + const existingPJsonPath = path.resolve(pathToExistingProject, "package.json"); + if (await pathExists(existingPJsonPath)) { + this.taskQueue.push({ + task: async (pJsonPath, projectPath) => { + const existingPJson = await readJSON(pJsonPath); + const templatePJsonPath = path.resolve(projectPath, "package.json"); + const templatePJson = await readJSON(templatePJsonPath); + const mergedJson = merge(templatePJson, existingPJson); + console.log(existingPJson, templatePJson, mergedJson); + await remove(templatePJsonPath); + await writeJson(templatePJsonPath, mergedJson, { spaces: 2 }); + }, + args: [existingPJsonPath, this.projectPath], + runningMessage: "Merging package.json", + }); + } } } From 72d73a11bf58e3ff93d1e8723dba10800f55c7c6 Mon Sep 17 00:00:00 2001 From: codespool <4625220+codespool@users.noreply.github.com> Date: Mon, 8 May 2023 11:44:25 +0300 Subject: [PATCH 23/46] v2.2.0-alpha.0 --- lerna.json | 2 +- packages/cli/README.md | 23 ++++++++++++----------- packages/cli/package.json | 4 ++-- packages/core/package.json | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lerna.json b/lerna.json index 3ac10006..09edd122 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "2.1.0", + "version": "2.2.0-alpha.0", "npmClient": "yarn" } diff --git a/packages/cli/README.md b/packages/cli/README.md index 907e3fdc..a12911c2 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -17,7 +17,7 @@ $ npm install -g @astar-network/swanky-cli $ swanky COMMAND running command... $ swanky (--version|-V|-v) -@astar-network/swanky-cli/2.1.0 darwin-x64 node-v18.2.0 +@astar-network/swanky-cli/2.2.0-alpha.0 darwin-x64 node-v18.2.0 $ swanky --help [COMMAND] USAGE $ swanky COMMAND @@ -37,7 +37,7 @@ USAGE * [`swanky contract explain CONTRACTNAME`](#swanky-contract-explain-contractname) * [`swanky contract new CONTRACTNAME`](#swanky-contract-new-contractname) * [`swanky contract query CONTRACTNAME MESSAGENAME`](#swanky-contract-query-contractname-messagename) -* [`swanky contract test CONTRACTNAME`](#swanky-contract-test-contractname) +* [`swanky contract test [CONTRACTNAME]`](#swanky-contract-test-contractname) * [`swanky contract tx CONTRACTNAME MESSAGENAME`](#swanky-contract-tx-contractname-messagename) * [`swanky contract typegen CONTRACTNAME`](#swanky-contract-typegen-contractname) * [`swanky help [COMMANDS]`](#swanky-help-commands) @@ -113,7 +113,7 @@ DESCRIPTION Check installed package versions and compatibility ``` -_See code: [dist/commands/check/index.js](https://github.com/AstarNetwork/swanky-cli/blob/v2.1.0/dist/commands/check/index.js)_ +_See code: [dist/commands/check/index.js](https://github.com/AstarNetwork/swanky-cli/blob/v2.2.0-alpha.0/dist/commands/check/index.js)_ ## `swanky contract compile [CONTRACTNAME]` @@ -159,7 +159,7 @@ DESCRIPTION ## `swanky contract explain CONTRACTNAME` -Explain contract messages based on thier metadata +Explain contract messages based on the contracts' metadata ``` USAGE @@ -172,7 +172,7 @@ FLAGS -v, --verbose Display more info in the result logs DESCRIPTION - Explain contract messages based on thier metadata + Explain contract messages based on the contracts' metadata ``` ## `swanky contract new CONTRACTNAME` @@ -217,13 +217,13 @@ FLAGS --address= Target specific address, defaults to last deployed. (--addr, --add) ``` -## `swanky contract test CONTRACTNAME` +## `swanky contract test [CONTRACTNAME]` Run tests for a given contact ``` USAGE - $ swanky contract test CONTRACTNAME [-a] + $ swanky contract test [CONTRACTNAME] [-a] ARGUMENTS CONTRACTNAME Name of the contract to test @@ -299,23 +299,24 @@ Generate a new smart contract environment ``` USAGE - $ swanky init PROJECTNAME [--swanky-node] [-t blank|erc20token|flipper|blank|flipper|psp22] [-l ask|ink] - [-v] + $ swanky init PROJECTNAME [-v] [--swanky-node] [-t blank|erc20token|flipper|blank|flipper|psp22] [-l + ask|ink] [-c ] ARGUMENTS PROJECTNAME directory name of new project FLAGS + -c, --convert= Converts an existing smart contract into a Swanky project -l, --language=