Skip to content
Open
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"ethers": "^6.2.3",
"form-data": "^4.0.0",
"yargs": "17.6.2",
"zkwasm-service-helper": "git+https://github.com/DelphinusLab/zkWasm-service-helper.git"
"zkwasm-service-helper": "git+https://github.com/DelphinusLab/zkWasm-service-helper.git#zkwas-323"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
1 change: 1 addition & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function createCLI() {
.command(commands.queryTask)
.command(commands.pressureTest)
.command(commands.proverProfile)
.command(commands.setMaintenanceMode)
// Add other commands here as they are implemented
.example(
'node dist/index.js addimage -r "http://127.0.0.1:8080" -p "/home/username/arith.wasm" -u "0x278847f04E166451182dd30E33e09667bA31e6a8" -x "xxxxxxx" -n "myfirstimage" -d "My First Image" -c 18',
Expand Down
1 change: 1 addition & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * as addPayment from "./addPayment";
export * as queryTask from "./queryTask";
export * as pressureTest from "./pressureTest";
export * as proverProfile from "./proverProfile";
export * as setMaintenanceMode from "./setMaintenanceMode";
2 changes: 1 addition & 1 deletion src/commands/proverProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const handler = async (argv: Arguments) => {
let stats = helper
.queryNodeStatistics(args)
.then((res) => {
return res;
return res.data;
})
.catch((err) => {
console.log("Error fetching Current node statistics", err);
Expand Down
41 changes: 41 additions & 0 deletions src/commands/setMaintenanceMode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Arguments, Argv } from "yargs";

import { setMaintenanceMode } from "../task";

export const command = "setmaintenancemode";
export const desc = "Set maintenance mode for server.";

export const builder = (yargs: Argv) => {
return (
yargs
.option("r", {
alias: "rest-url",
describe: "REST API URL",
type: "string",
demandOption: "The REST server url",
})
// private key
.option("x", {
alias: "private-key",
describe: "Private key",
type: "string",
demandOption: "The private key is required",
})
// maintenance mode
.option("active", {
alias: "active",
describe: "Maintenance mode",
type: "boolean",
demandOption: "The maintenance mode is required",
})
);
};

export const handler = async (argv: Arguments) => {
console.log("Setting maintenance mode...");
await setMaintenanceMode(
argv.r as string,
argv.x as string,
argv.active as boolean
);
};
Loading