clients/js: Add command to start evm validator (ganache)
commit-id:42791bce
This commit is contained in:
parent
c4f4652f35
commit
b37efa4c1b
|
@ -11,7 +11,7 @@ exports.builder = function(y: typeof yargs) {
|
||||||
array: true,
|
array: true,
|
||||||
default: [],
|
default: [],
|
||||||
describe: "Additional args to validator",
|
describe: "Additional args to validator",
|
||||||
}).command("aptos", "Start a local aptos validator", (yargs) => {
|
}).command("aptos", "Start a local aptos validator", (_yargs) => {
|
||||||
}, (argv) => {
|
}, (argv) => {
|
||||||
const dir = `${config.wormholeDir}/aptos`;
|
const dir = `${config.wormholeDir}/aptos`;
|
||||||
// check if aptos is installed
|
// check if aptos is installed
|
||||||
|
@ -21,9 +21,19 @@ exports.builder = function(y: typeof yargs) {
|
||||||
console.error(`See ${dir}/README.md for instructions.`);
|
console.error(`See ${dir}/README.md for instructions.`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
const args = argv['validator-args'].map(a => `"${a}"`).join(" ");
|
const cmd = `cd ${dir} && aptos node run-local-testnet --with-faucet --force-restart --assume-yes`;
|
||||||
const cmd = `cd ${dir} && aptos node run-local-testnet --with-faucet --force-restart --assume-yes ${args}`;
|
runCommand(cmd, argv['validator-args']);
|
||||||
console.log("\x1b[33m%s\x1b[0m", cmd);
|
}).command("evm", "Start a local EVM validator", (_yargs) => {
|
||||||
spawnSync(cmd, { shell: true, stdio: "inherit" });
|
}, (argv) => {
|
||||||
|
const dir = `${config.wormholeDir}/ethereum`;
|
||||||
|
const cmd = `cd ${dir} && npx ganache-cli -e 10000 --deterministic --time="1970-01-01T00:00:00+00:00"`;
|
||||||
|
runCommand(cmd, argv['validator-args']);
|
||||||
}).strict().demandCommand();
|
}).strict().demandCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function runCommand(baseCmd: string, args: string[]) {
|
||||||
|
const args_string = args.map(a => `"${a}"`).join(" ");
|
||||||
|
const cmd = `${baseCmd} ${args_string}`;
|
||||||
|
console.log("\x1b[33m%s\x1b[0m", cmd);
|
||||||
|
spawnSync(cmd, { shell: true, stdio: "inherit" });
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue