From b0a1e3c7e2932f4f61f64bd9b55daa6ef7fcba1d Mon Sep 17 00:00:00 2001 From: prxgr4mm3r Date: Wed, 8 Nov 2023 18:59:44 +0200 Subject: [PATCH 1/4] Add ability to chose what version of swanky node. Add node version command. Fix node start command. Add node version to check command. --- src/commands/check/index.ts | 7 ++ src/commands/init/index.ts | 22 ++++-- src/commands/node/install.ts | 33 +++++++-- src/commands/node/start.ts | 6 +- src/commands/node/version.ts | 12 ++++ src/lib/consts.ts | 16 +++++ src/lib/nodeInfo.ts | 132 +++++++++++++++++++++++++++++++---- src/lib/prompts.ts | 10 +++ src/types/index.ts | 3 +- 9 files changed, 217 insertions(+), 24 deletions(-) create mode 100644 src/commands/node/version.ts diff --git a/src/commands/check/index.ts b/src/commands/check/index.ts index 9d1d27fa..8af906ae 100644 --- a/src/commands/check/index.ts +++ b/src/commands/check/index.ts @@ -18,6 +18,7 @@ interface Ctx { cargoContract?: string | null; }; contracts: Record>; + node?: string | null; }; swankyConfig?: SwankyConfig; mismatchedVersions?: Record; @@ -59,6 +60,12 @@ export default class Check extends SwankyCommand { ctx.versions.tools.cargoContract = await commandStdoutOrNull("cargo contract -V"); }, }, + { + title: "Check swanky node", + task: async (ctx) => { + ctx.versions.node = this.swankyConfig.node.version !== "" ? this.swankyConfig.node.version : null; + }, + }, { title: "Read ink dependencies", task: async (ctx) => { diff --git a/src/commands/init/index.ts b/src/commands/init/index.ts index 45177372..dcadba43 100644 --- a/src/commands/init/index.ts +++ b/src/commands/init/index.ts @@ -6,7 +6,7 @@ import { execaCommand, execaCommandSync } from "execa"; import { paramCase, pascalCase, snakeCase } from "change-case"; import inquirer from "inquirer"; import TOML from "@iarna/toml"; -import { choice, email, name, pickTemplate } from "../../lib/prompts.js"; +import { choice, email, name, pickNodeVersion, pickTemplate } from "../../lib/prompts.js"; import { checkCliDependencies, copyCommonTemplateFiles, @@ -20,7 +20,7 @@ import { } from "../../lib/index.js"; import { DEFAULT_ASTAR_NETWORK_URL, - DEFAULT_NETWORK_URL, + DEFAULT_NETWORK_URL, DEFAULT_NODE_INFO, DEFAULT_SHIBUYA_NETWORK_URL, DEFAULT_SHIDEN_NETWORK_URL, } from "../../lib/consts.js"; @@ -93,11 +93,13 @@ export class Init extends SwankyCommand { } projectPath = ""; + configBuilder: Partial = { node: { localPath: "", - polkadotPalletVersions: swankyNode.polkadotPalletVersions, - supportedInk: swankyNode.supportedInk, + polkadotPalletVersions: "", + supportedInk: "", + version: "", }, accounts: [], networks: { @@ -161,9 +163,19 @@ export class Init extends SwankyCommand { choice("useSwankyNode", "Do you want to download Swanky node?"), ]); if (useSwankyNode) { + const versions = Array.from(swankyNode.keys()); + let nodeVersion = DEFAULT_NODE_INFO.version; + await inquirer.prompt([ + pickNodeVersion(versions), + ]).then((answers) => { + nodeVersion = answers.version; + }); + + const nodeInfo = swankyNode.get(nodeVersion)!; + this.taskQueue.push({ task: downloadNode, - args: [this.projectPath, swankyNode, this.spinner], + args: [this.projectPath, nodeInfo, this.spinner], runningMessage: "Downloading Swanky node", callback: (result) => this.configBuilder.node ? (this.configBuilder.node.localPath = result) : null, diff --git a/src/commands/node/install.ts b/src/commands/node/install.ts index 8d9beb5e..58c50cdf 100644 --- a/src/commands/node/install.ts +++ b/src/commands/node/install.ts @@ -1,17 +1,38 @@ import { SwankyCommand } from "../../lib/swankyCommand.js"; -import { ux } from "@oclif/core"; +import { ux, Flags } from "@oclif/core"; import { downloadNode, swankyNode } from "../../lib/index.js"; import path from "node:path"; import { writeJSON } from "fs-extra/esm"; +import inquirer from "inquirer"; +import { DEFAULT_NODE_INFO } from "../../lib/consts.js"; +import { pickNodeVersion } from "../../lib/prompts.js"; export class InstallNode extends SwankyCommand { static description = "Install swanky node binary"; + static flags = { + "set-version": Flags.string({ + description: "Specify version of swanky node to install", + required: false, + }), + } async run(): Promise { const { flags } = await this.parse(InstallNode); if (flags.verbose) { this.spinner.verbose = true; } + let nodeVersion= DEFAULT_NODE_INFO.version; + + if (flags.specifyVersion) { + nodeVersion = flags.specifyVersion; + } else { + const versions = Array.from(swankyNode.keys()); + await inquirer.prompt([ + pickNodeVersion(versions), + ]).then((answers) => { + nodeVersion = answers.version; + }); + } const projectPath = path.resolve(); @@ -24,16 +45,20 @@ export class InstallNode extends SwankyCommand { } } + const nodeInfo = swankyNode.get(nodeVersion)!; + const taskResult = (await this.spinner.runCommand( - () => downloadNode(projectPath, swankyNode, this.spinner), + () => downloadNode(projectPath, nodeInfo, this.spinner), "Downloading Swanky node" )) as string; const nodePath = path.relative(projectPath, taskResult); + this.swankyConfig.node = { localPath: nodePath, - polkadotPalletVersions: swankyNode.polkadotPalletVersions, - supportedInk: swankyNode.supportedInk, + polkadotPalletVersions: nodeInfo.polkadotPalletVersions, + supportedInk: nodeInfo.supportedInk, + version: nodeInfo.version, }; await this.spinner.runCommand( diff --git a/src/commands/node/start.ts b/src/commands/node/start.ts index cb976870..097becc7 100644 --- a/src/commands/node/start.ts +++ b/src/commands/node/start.ts @@ -28,11 +28,15 @@ export class StartNode extends SwankyCommand { async run(): Promise { const { flags } = await this.parse(StartNode); + if (this.swankyConfig.node.version === "") { + this.log("Node is not installed"); + return; + } // Run persistent mode by default. non-persistent mode in case flag is provided. // Non-Persistent mode (`--dev`) allows all CORS origin, without `--dev`, users need to specify origins by `--rpc-cors`. await execaCommand( `${this.swankyConfig.node.localPath} \ - --finalize-delay-sec ${flags.finalizeDelaySec} \ + ${this.swankyConfig.node.version === "1.6.0" ? `--finalize-delay-sec ${flags.finalizeDelaySec}` : ""} \ ${flags.tmp ? "--dev" : `--rpc-cors ${flags.rpcCors}`}`, { stdio: "inherit", diff --git a/src/commands/node/version.ts b/src/commands/node/version.ts new file mode 100644 index 00000000..b34a0305 --- /dev/null +++ b/src/commands/node/version.ts @@ -0,0 +1,12 @@ +import { SwankyCommand } from "../../lib/swankyCommand.js"; +export class NodeVersion extends SwankyCommand { + static description = "Show swanky node version"; + async run(): Promise { + if(this.swankyConfig.node.version === ""){ + this.log("Node is not installed"); + } + else { + this.log(`Node version: ${this.swankyConfig.node.version}`); + } + } +} diff --git a/src/lib/consts.ts b/src/lib/consts.ts index d48b2b67..b4d996d4 100644 --- a/src/lib/consts.ts +++ b/src/lib/consts.ts @@ -5,3 +5,19 @@ export const DEFAULT_SHIBUYA_NETWORK_URL = "wss://shibuya.public.blastapi.io"; export const ARTIFACTS_PATH = "artifacts"; export const TYPED_CONTRACTS_PATH = "typedContracts"; + +export const DEFAULT_NODE_INFO = { + version: "1.6.0", + polkadotPalletVersions: "polkadot-v0.9.39", + supportedInk: "v4.2.0", + downloadUrl: { + darwin: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-macOS-universal.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-macOS-universal.tar.gz" + }, + linux: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-ubuntu-aarch64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-ubuntu-x86_64.tar.gz", + } + } +} diff --git a/src/lib/nodeInfo.ts b/src/lib/nodeInfo.ts index 3064488a..696feeb1 100644 --- a/src/lib/nodeInfo.ts +++ b/src/lib/nodeInfo.ts @@ -1,17 +1,123 @@ -export type nodeInfo = typeof swankyNode; - -export const swankyNode = { - version: "1.6.0", - polkadotPalletVersions: "polkadot-v0.9.39", - supportedInk: "v4.2.0", +export interface nodeInfo { + version: string; + polkadotPalletVersions: string; + supportedInk: string; downloadUrl: { darwin: { - "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-macOS-universal.tar.gz", - "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-macOS-universal.tar.gz" - }, + "arm64"?: string; + "x64"?: string; + }; linux: { - "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-ubuntu-aarch64.tar.gz", - "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-ubuntu-x86_64.tar.gz", + "arm64"?: string; + "x64"?: string; + }; + }; +} + +export const swankyNode = new Map([ + ["1.6.0", { + version: "1.6.0", + polkadotPalletVersions: "polkadot-v0.9.39", + supportedInk: "v4.2.0", + downloadUrl: { + darwin: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-macOS-universal.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-macOS-universal.tar.gz" + }, + linux: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-ubuntu-aarch64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-ubuntu-x86_64.tar.gz", + } + } + }], + ["1.5.0", { + version: "1.5.0", + polkadotPalletVersions: "polkadot-v0.9.39", + supportedInk: "v4.0.0", + downloadUrl: { + darwin: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.5.0/swanky-node-v1.5.0-macOS-universal.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.5.0/swanky-node-v1.5.0-macOS-universal.tar.gz" + }, + linux: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.5.0/swanky-node-v1.5.0-ubuntu-aarch64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.5.0/swanky-node-v1.5.0-ubuntu-x86_64.tar.gz", + } + } + }], + ["1.4.0", { + version: "1.4.0", + polkadotPalletVersions: "polkadot-v0.9.37", + supportedInk: "v4.0.0", + downloadUrl: { + darwin: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.4.0/swanky-node-v1.4.0-macOS-universal.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.4.0/swanky-node-v1.4.0-macOS-universal.tar.gz" + }, + linux: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.4.0/swanky-node-v1.4.0-ubuntu-aarch64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.4.0/swanky-node-v1.4.0-ubuntu-x86_64.tar.gz", + } + } + }], + ["1.3.0", { + version: "1.3.0", + polkadotPalletVersions: "polkadot-v0.9.37", + supportedInk: "v4.0.0", + downloadUrl: { + darwin: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.3.0/swanky-node-v1.3.0-macOS-universal.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.3.0/swanky-node-v1.3.0-macOS-universal.tar.gz" + }, + linux: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.3.0/swanky-node-v1.3.0-ubuntu-aarch64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.3.0/swanky-node-v1.3.0-ubuntu-x86_64.tar.gz", + } + } + }], + ["1.2.0", { + version: "1.2.0", + polkadotPalletVersions: "polkadot-v0.9.37", + supportedInk: "v4.0.0", + downloadUrl: { + darwin: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.2.0/swanky-node-v1.2.0-macOS-universal.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.2.0/swanky-node-v1.2.0-macOS-universal.tar.gz" + }, + linux: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.2.0/swanky-node-v1.2.0-ubuntu-aarch64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.2.0/swanky-node-v1.2.0-ubuntu-x86_64.tar.gz", + } + } + }], + ["1.1.0", { + version: "1.1.0", + polkadotPalletVersions: "polkadot-v0.9.37", + supportedInk: "v4.0.0", + downloadUrl: { + darwin: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.1.0/swanky-node-v1.1.0-macOS-x86_64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.1.0/swanky-node-v1.1.0-macOS-x86_64.tar.gz" + }, + linux: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.1.0/swanky-node-v1.1.0-ubuntu-x86_64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.1.0/swanky-node-v1.1.0-ubuntu-x86_64.tar.gz", + } + } + }], + ["1.0.0", { + version: "1.0.0", + polkadotPalletVersions: "polkadot-v0.9.30", + supportedInk: "v3.4.0", + downloadUrl: { + darwin: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.0.0/swanky-node-v1.0.0-macOS-x86_64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.0.0/swanky-node-v1.0.0-macOS-x86_64.tar.gz" + }, + linux: { + "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.0.0/swanky-node-v1.0.0-ubuntu-x86_64.tar.gz", + "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.0.0/swanky-node-v1.0.0-ubuntu-x86_64.tar.gz", + } } - }, -}; + }] +]); diff --git a/src/lib/prompts.ts b/src/lib/prompts.ts index 259c45a9..3ee17625 100644 --- a/src/lib/prompts.ts +++ b/src/lib/prompts.ts @@ -11,6 +11,16 @@ export function pickTemplate(templateList: string[]): ListQuestion { }; } +export function pickNodeVersion(nodeVersions: string[]): ListQuestion { + if (!nodeVersions?.length) throw new ConfigError("Node version list is empty!"); + return { + name: "version", + type: "list", + choices: nodeVersions, + message: "Which node version should we use?", + }; +} + export function name( subject: string, initial?: (answers: Answers) => string, diff --git a/src/types/index.ts b/src/types/index.ts index aa13a0df..7ff5b9f6 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -11,7 +11,7 @@ export interface ChainProperty { export type ExtrinsicPayload = SubmittableExtrinsic<"promise">; -export interface Encrypted { iv: string; data: string }; +export interface Encrypted { iv: string; data: string } export interface AccountData { isDev: boolean; @@ -43,6 +43,7 @@ export interface SwankyConfig { polkadotPalletVersions: string; localPath: string; supportedInk: string; + version: string; }; accounts: AccountData[]; contracts: Record | Record; From 40e2c396df8f4ddd2df5a060da5953ced7342624 Mon Sep 17 00:00:00 2001 From: prxgr4mm3r Date: Thu, 9 Nov 2023 11:12:43 +0200 Subject: [PATCH 2/4] Fix SwankyConfig update while downloading node --- src/commands/init/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/commands/init/index.ts b/src/commands/init/index.ts index dcadba43..6c8d758d 100644 --- a/src/commands/init/index.ts +++ b/src/commands/init/index.ts @@ -177,8 +177,14 @@ export class Init extends SwankyCommand { task: downloadNode, args: [this.projectPath, nodeInfo, this.spinner], runningMessage: "Downloading Swanky node", - callback: (result) => - this.configBuilder.node ? (this.configBuilder.node.localPath = result) : null, + callback: (result) => { + this.configBuilder.node = { + supportedInk: nodeInfo.supportedInk, + polkadotPalletVersions: nodeInfo.polkadotPalletVersions, + version: nodeInfo.version, + localPath: result, + }; + } }); } } From c0602b64fbf776893e5c6a8630acad6b663e567e Mon Sep 17 00:00:00 2001 From: prxgr4mm3r Date: Thu, 18 Jan 2024 22:56:46 +0200 Subject: [PATCH 3/4] Fixes --- src/commands/init/index.ts | 7 +++---- src/commands/node/install.ts | 16 ++++++++++------ src/commands/node/start.ts | 3 ++- src/commands/node/version.ts | 4 ++-- src/lib/consts.ts | 18 +++--------------- src/lib/nodeInfo.ts | 2 +- 6 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/commands/init/index.ts b/src/commands/init/index.ts index 6c8d758d..e7141b40 100644 --- a/src/commands/init/index.ts +++ b/src/commands/init/index.ts @@ -15,8 +15,7 @@ import { installDeps, ChainAccount, processTemplates, - swankyNode, - getTemplates, + getTemplates, swankyNodeVersions, } from "../../lib/index.js"; import { DEFAULT_ASTAR_NETWORK_URL, @@ -163,7 +162,7 @@ export class Init extends SwankyCommand { choice("useSwankyNode", "Do you want to download Swanky node?"), ]); if (useSwankyNode) { - const versions = Array.from(swankyNode.keys()); + const versions = Array.from(swankyNodeVersions.keys()); let nodeVersion = DEFAULT_NODE_INFO.version; await inquirer.prompt([ pickNodeVersion(versions), @@ -171,7 +170,7 @@ export class Init extends SwankyCommand { nodeVersion = answers.version; }); - const nodeInfo = swankyNode.get(nodeVersion)!; + const nodeInfo = swankyNodeVersions.get(nodeVersion)!; this.taskQueue.push({ task: downloadNode, diff --git a/src/commands/node/install.ts b/src/commands/node/install.ts index 58c50cdf..af90048c 100644 --- a/src/commands/node/install.ts +++ b/src/commands/node/install.ts @@ -1,18 +1,19 @@ import { SwankyCommand } from "../../lib/swankyCommand.js"; import { ux, Flags } from "@oclif/core"; -import { downloadNode, swankyNode } from "../../lib/index.js"; +import { downloadNode, swankyNodeVersions } from "../../lib/index.js"; import path from "node:path"; import { writeJSON } from "fs-extra/esm"; import inquirer from "inquirer"; import { DEFAULT_NODE_INFO } from "../../lib/consts.js"; import { pickNodeVersion } from "../../lib/prompts.js"; +import { InputError } from "../../lib/errors.js"; export class InstallNode extends SwankyCommand { static description = "Install swanky node binary"; static flags = { "set-version": Flags.string({ - description: "Specify version of swanky node to install", + description: "Specify version of swanky node to install. \n List of supported versions: " + Array.from(swankyNodeVersions.keys()).join(", "), required: false, }), } @@ -23,10 +24,13 @@ export class InstallNode extends SwankyCommand { } let nodeVersion= DEFAULT_NODE_INFO.version; - if (flags.specifyVersion) { - nodeVersion = flags.specifyVersion; + if (flags["set-version"]) { + nodeVersion = flags["set-version"]; + if(!swankyNodeVersions.has(nodeVersion)) { + throw new InputError(`Version ${nodeVersion} is not supported.\n List of supported versions: ${Array.from(swankyNodeVersions.keys()).join(", ")}`); + } } else { - const versions = Array.from(swankyNode.keys()); + const versions = Array.from(swankyNodeVersions.keys()); await inquirer.prompt([ pickNodeVersion(versions), ]).then((answers) => { @@ -45,7 +49,7 @@ export class InstallNode extends SwankyCommand { } } - const nodeInfo = swankyNode.get(nodeVersion)!; + const nodeInfo = swankyNodeVersions.get(nodeVersion)!; const taskResult = (await this.spinner.runCommand( () => downloadNode(projectPath, nodeInfo, this.spinner), diff --git a/src/commands/node/start.ts b/src/commands/node/start.ts index 097becc7..a0984998 100644 --- a/src/commands/node/start.ts +++ b/src/commands/node/start.ts @@ -1,6 +1,7 @@ import { Flags } from "@oclif/core"; import { execaCommand } from "execa"; import { SwankyCommand } from "../../lib/swankyCommand.js"; +import semver from "semver"; export class StartNode extends SwankyCommand { static description = "Start a local node"; @@ -36,7 +37,7 @@ export class StartNode extends SwankyCommand { // Non-Persistent mode (`--dev`) allows all CORS origin, without `--dev`, users need to specify origins by `--rpc-cors`. await execaCommand( `${this.swankyConfig.node.localPath} \ - ${this.swankyConfig.node.version === "1.6.0" ? `--finalize-delay-sec ${flags.finalizeDelaySec}` : ""} \ + ${ semver.gt(this.swankyConfig.node.version, "1.6.0") ? `--finalize-delay-sec ${flags.finalizeDelaySec}` : ""} \ ${flags.tmp ? "--dev" : `--rpc-cors ${flags.rpcCors}`}`, { stdio: "inherit", diff --git a/src/commands/node/version.ts b/src/commands/node/version.ts index b34a0305..a6937d09 100644 --- a/src/commands/node/version.ts +++ b/src/commands/node/version.ts @@ -3,10 +3,10 @@ export class NodeVersion extends SwankyCommand { static description = "Show swanky node version"; async run(): Promise { if(this.swankyConfig.node.version === ""){ - this.log("Node is not installed"); + this.log("Swanky node is not installed"); } else { - this.log(`Node version: ${this.swankyConfig.node.version}`); + this.log(`Swanky node version: ${this.swankyConfig.node.version}`); } } } diff --git a/src/lib/consts.ts b/src/lib/consts.ts index b4d996d4..ed9e063b 100644 --- a/src/lib/consts.ts +++ b/src/lib/consts.ts @@ -1,3 +1,5 @@ +import { swankyNodeVersions } from "./nodeInfo.js"; + export const DEFAULT_NETWORK_URL = "ws://127.0.0.1:9944"; export const DEFAULT_ASTAR_NETWORK_URL = "wss://rpc.astar.network"; export const DEFAULT_SHIDEN_NETWORK_URL = "wss://rpc.shiden.astar.network"; @@ -6,18 +8,4 @@ export const DEFAULT_SHIBUYA_NETWORK_URL = "wss://shibuya.public.blastapi.io"; export const ARTIFACTS_PATH = "artifacts"; export const TYPED_CONTRACTS_PATH = "typedContracts"; -export const DEFAULT_NODE_INFO = { - version: "1.6.0", - polkadotPalletVersions: "polkadot-v0.9.39", - supportedInk: "v4.2.0", - downloadUrl: { - darwin: { - "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-macOS-universal.tar.gz", - "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-macOS-universal.tar.gz" - }, - linux: { - "arm64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-ubuntu-aarch64.tar.gz", - "x64": "https://github.com/AstarNetwork/swanky-node/releases/download/v1.6.0/swanky-node-v1.6.0-ubuntu-x86_64.tar.gz", - } - } -} +export const DEFAULT_NODE_INFO = swankyNodeVersions.get("1.6.0")!; diff --git a/src/lib/nodeInfo.ts b/src/lib/nodeInfo.ts index 696feeb1..60a6d1f0 100644 --- a/src/lib/nodeInfo.ts +++ b/src/lib/nodeInfo.ts @@ -14,7 +14,7 @@ export interface nodeInfo { }; } -export const swankyNode = new Map([ +export const swankyNodeVersions = new Map([ ["1.6.0", { version: "1.6.0", polkadotPalletVersions: "polkadot-v0.9.39", From 28e374fff7d35b16f374ec24ee15b2f081cdc5ea Mon Sep 17 00:00:00 2001 From: Igor Papandinas Date: Tue, 23 Jan 2024 18:33:30 +0100 Subject: [PATCH 4/4] fix: Greater or equal to 1.6.0 versions are supported --- src/commands/node/start.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/node/start.ts b/src/commands/node/start.ts index a0984998..e92e65e6 100644 --- a/src/commands/node/start.ts +++ b/src/commands/node/start.ts @@ -37,7 +37,7 @@ export class StartNode extends SwankyCommand { // Non-Persistent mode (`--dev`) allows all CORS origin, without `--dev`, users need to specify origins by `--rpc-cors`. await execaCommand( `${this.swankyConfig.node.localPath} \ - ${ semver.gt(this.swankyConfig.node.version, "1.6.0") ? `--finalize-delay-sec ${flags.finalizeDelaySec}` : ""} \ + ${ semver.gte(this.swankyConfig.node.version, "1.6.0") ? `--finalize-delay-sec ${flags.finalizeDelaySec}` : ""} \ ${flags.tmp ? "--dev" : `--rpc-cors ${flags.rpcCors}`}`, { stdio: "inherit",