Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/cli/src/commands/node/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export class InstallNode extends BaseCommand<typeof InstallNode> {
async run(): Promise<void> {
await ensureSwankyProject();

const { flags } = await this.parse(InstallNode);
if (flags.verbose) {
this.spinner.verbose = true;
}

const projectPath = path.resolve();

if (this.swankyConfig.node.localPath !== "") {
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/commands/node/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export class StartNode extends Command {
Without it, you may need to specify by comma separated string.
By default, 'http://localhost:*,http://127.0.0.1:*,https://localhost:*,https://127.0.0.1:*,https://polkadot.js.org,https://contracts-ui.substrate.io/' is set.`,
}),
finalizeDelaySec: Flags.integer({
required: false,
default: 0, // 0 means instant finalitization
description: "Delay time in seconds after blocks being sealed",
})
};

async run(): Promise<void> {
Expand All @@ -30,6 +35,7 @@ export class StartNode extends Command {
// Non-Persistent mode (`--dev`) allows all CORS origin, without `--dev`, users need to specify origins by `--rpc-cors`.
await execa.command(
`${config.node.localPath} \
--finalize-delay-sec ${flags.finalizeDelaySec} \
${flags.tmp ? "--dev" : `--rpc-cors ${flags.rpcCors}`}`,
{
stdio: "inherit",
Expand Down
18 changes: 11 additions & 7 deletions packages/core/src/lib/nodeInfo.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
export type nodeInfo = typeof swankyNode;

export const swankyNode = {
version: "1.1.0",
polkadotPalletVersions: "polkadot-v0.9.37",
supportedInk: "v4.0.0",
version: "1.6.0",
polkadotPalletVersions: "polkadot-v0.9.39",
supportedInk: "v4.2.0",
downloadUrl: {
darwin:
"https://github.com/AstarNetwork/swanky-node/releases/download/v1.1.0/swanky-node-v1.1.0-macOS-x86_64.tar.gz",
linux:
"https://github.com/AstarNetwork/swanky-node/releases/download/v1.1.0/swanky-node-v1.1.0-ubuntu-x86_64.tar.gz",
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",
}
},
};
9 changes: 7 additions & 2 deletions packages/core/src/lib/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ export async function processTemplates(projectPath: string, templateData: Record
export async function downloadNode(projectPath: string, nodeInfo: nodeInfo, spinner: Spinner) {
const binPath = path.resolve(projectPath, "bin");
await ensureDir(binPath);
const dlUrl = nodeInfo.downloadUrl[process.platform];

if (!dlUrl)
const platformDlUrls = nodeInfo.downloadUrl[process.platform];
if (!platformDlUrls)
throw new Error(`Could not download swanky-node. Platform ${process.platform} not supported!`);

const dlUrl = platformDlUrls[process.arch];
if (!dlUrl)
throw new Error(`Could not download swanky-node. Platform ${process.platform} Arch ${process.arch} not supported!`);

const dlFileDetails = await new Promise<DownloadEndedStats>((resolve, reject) => {
const dl = new DownloaderHelper(dlUrl, binPath);

Expand Down