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
4 changes: 3 additions & 1 deletion dist/cjs/helper/task.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QueryParams, ProvingParams, DeployParams, Statistics, AddImageParams, WithSignature, UserQueryParams, PaymentParams, TxHistoryQueryParams, LogQuery, ResetImageParams, PaginationResult, Task, Image, TransactionInfo, AppConfig, OmitSignature, ModifyImageParams, SubscriptionRequest, ERC20DepositInfo, User, Subscription, PaginatedQuery, AutoSubmitProofQuery, Round1InfoQuery, Round1Info, Round2Info, Round2InfoQuery, AutoSubmitProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams } from "../interface/interface.js";
import { QueryParams, ProvingParams, DeployParams, Statistics, AddImageParams, WithSignature, UserQueryParams, PaymentParams, TxHistoryQueryParams, LogQuery, ResetImageParams, PaginationResult, Task, Image, TransactionInfo, AppConfig, OmitSignature, ModifyImageParams, SubscriptionRequest, ERC20DepositInfo, User, Subscription, PaginatedQuery, AutoSubmitProofQuery, Round1InfoQuery, Round1Info, Round2Info, Round2InfoQuery, AutoSubmitProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams } from "../interface/interface.js";
import { ZkWasmServiceEndpoint } from "./endpoint.js";
export declare class ZkWasmServiceHelper {
endpoint: ZkWasmServiceEndpoint;
Expand All @@ -25,6 +25,7 @@ export declare class ZkWasmServiceHelper {
addDeployTask(task: WithSignature<DeployParams>): Promise<any>;
addResetTask(task: WithSignature<ResetImageParams>): Promise<any>;
modifyImage(data: WithSignature<ModifyImageParams>): Promise<any>;
setMaintenanceMode(req: WithSignature<SetMaintenanceModeParams>): Promise<any>;
sendRequestWithSignature<T>(method: "GET" | "POST", path: TaskEndpoint, task: WithSignature<T>, isFormData?: boolean): Promise<any>;
createHeaders<T>(task: WithSignature<T>): Record<string, string>;
omitSignature<T>(task: WithSignature<T>): OmitSignature<T>;
Expand All @@ -37,6 +38,7 @@ export declare enum TaskEndpoint {
RESET = "/reset",
MODIFY = "/modify",
PAY = "/pay",
SET_MAINTENANCE_MODE = "/admin/set_maintenance_mode",
SUBSCRIBE = "/subscribe",
LOGS = "/logs",
ROUND_1_BATCH = "/round1_batch_proofs",
Expand Down
10 changes: 10 additions & 0 deletions dist/cjs/helper/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ class ZkWasmServiceHelper {
return response;
});
}
setMaintenanceMode(req) {
return __awaiter(this, void 0, void 0, function* () {
let response = yield this.sendRequestWithSignature("POST", TaskEndpoint.SET_MAINTENANCE_MODE, req, true);
if (this.endpoint.enable_logs) {
console.log("setMaintenanceMode response:", response.toString());
}
return response;
});
}
sendRequestWithSignature(method, path, task, isFormData = false) {
return __awaiter(this, void 0, void 0, function* () {
// TODO: create return types for tasks using this method
Expand Down Expand Up @@ -376,6 +385,7 @@ var TaskEndpoint;
TaskEndpoint["RESET"] = "/reset";
TaskEndpoint["MODIFY"] = "/modify";
TaskEndpoint["PAY"] = "/pay";
TaskEndpoint["SET_MAINTENANCE_MODE"] = "/admin/set_maintenance_mode";
TaskEndpoint["SUBSCRIBE"] = "/subscribe";
TaskEndpoint["LOGS"] = "/logs";
TaskEndpoint["ROUND_1_BATCH"] = "/round1_batch_proofs";
Expand Down
3 changes: 2 additions & 1 deletion dist/cjs/helper/util.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="node" />
import BN from "bn.js";
import { AddImageParams, ProvingParams, DeployParams, ResetImageParams, ModifyImageParams, VerifyProofParams, LogQuery, ContextHexString, VerifyBatchProofParams } from "../interface/interface.js";
import { AddImageParams, ProvingParams, DeployParams, ResetImageParams, ModifyImageParams, VerifyProofParams, SetMaintenanceModeParams, LogQuery, ContextHexString, VerifyBatchProofParams } from "../interface/interface.js";
import { Contract, Signer } from "ethers";
import { DelphinusWalletConnector, DelphinusBrowserConnector } from "web3subscriber/src/provider.js";
export declare class ZkWasmUtil {
Expand Down Expand Up @@ -78,6 +78,7 @@ export declare class ZkWasmUtil {
static convertAmount(balance: Uint8Array): string;
static createLogsMesssage(params: LogQuery): string;
static createAddImageSignMessage(params: AddImageParams): string;
static createSetMaintenanceModeSignMessage(params: SetMaintenanceModeParams): string;
static createProvingSignMessage(params: ProvingParams): string;
static createDeploySignMessage(params: DeployParams): string;
static createResetImageMessage(params: ResetImageParams): string;
Expand Down
8 changes: 8 additions & 0 deletions dist/cjs/helper/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ class ZkWasmUtil {
}
return message;
}
static createSetMaintenanceModeSignMessage(params) {
let message = "";
message += params.mode;
message += params.nonce;
message += params.request_type;
message += params.user_address;
return message;
}
static createProvingSignMessage(params) {
// No need to sign the file itself, just the md5
let message = "";
Expand Down
6 changes: 3 additions & 3 deletions dist/cjs/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, WithSignature, User, UserQueryParams, PaymentParams, SubscriptionParams, Subscription, SubscriptionType, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, TaskStatus, TaskType, AppConfig, PaginationResult, ResetImageParams, LogQuery, ModifyImageParams, ChainDetails, InputContextType, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProofStatus, Round1Status, Round2Status, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc, NodeStatistics, NodeStatisticsQueryParams } from "./interface/interface.js";
import { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, WithSignature, User, UserQueryParams, PaymentParams, SubscriptionParams, Subscription, SubscriptionType, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, TaskStatus, TaskType, AppConfig, PaginationResult, ResetImageParams, LogQuery, ModifyImageParams, ChainDetails, InputContextType, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProofStatus, Round1Status, Round2Status, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc, NodeStatistics, NodeStatisticsQueryParams, MaintenanceModeType, SetMaintenanceModeParams, AdminRequestType } from "./interface/interface.js";
import { ZkWasmUtil } from "./helper/util.js";
import { ZkWasmServiceEndpoint } from "./helper/endpoint.js";
import { ZkWasmServiceHelper } from "./helper/task.js";
import { ERC20Lib } from "./abi/ERC20.js";
export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, };
export type { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, TaskStatus, TaskType, WithSignature, User, UserQueryParams, Subscription, SubscriptionType, PaymentParams, SubscriptionParams, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, ResetImageParams, AppConfig, PaginationResult, LogQuery, ModifyImageParams, ChainDetails, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, NodeStatistics, NodeStatisticsQueryParams, };
export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, };
export type { Task, ConciseTask, ProvingParams, DeployParams, QueryParams, VerifyProofParams, VerifyData, StatusState, DeploymentInfo, Image, Statistics, AddImageParams, TaskStatus, TaskType, WithSignature, User, UserQueryParams, Subscription, SubscriptionType, PaymentParams, SubscriptionParams, SubscriptionRequest, TxHistoryQueryParams, TransactionInfo, ResetImageParams, AppConfig, PaginationResult, LogQuery, ModifyImageParams, ChainDetails, ContextHexString, WithCustomInputContextType, WithInitialContext, WithNonCustomInputContextType, WithResetContext, WithoutInitialContext, WithoutInputContextType, WithoutResetContext, AutoSubmitProof, Round1Info, Round2Info, AutoSubmitProofQuery, Round1InfoQuery, Round2InfoQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams, };
4 changes: 3 additions & 1 deletion dist/cjs/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProvePaymentSrc = exports.ProofSubmitMode = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.AutoSubmitStatus = exports.InputContextType = exports.ERC20Lib = exports.ZkWasmUtil = exports.ZkWasmServiceHelper = exports.ZkWasmServiceEndpoint = void 0;
exports.AdminRequestType = exports.MaintenanceModeType = exports.ProvePaymentSrc = exports.ProofSubmitMode = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.AutoSubmitStatus = exports.InputContextType = exports.ERC20Lib = exports.ZkWasmUtil = exports.ZkWasmServiceHelper = exports.ZkWasmServiceEndpoint = void 0;
const interface_js_1 = require("./interface/interface.js");
Object.defineProperty(exports, "InputContextType", { enumerable: true, get: function () { return interface_js_1.InputContextType; } });
Object.defineProperty(exports, "AutoSubmitProofStatus", { enumerable: true, get: function () { return interface_js_1.AutoSubmitProofStatus; } });
Expand All @@ -9,6 +9,8 @@ Object.defineProperty(exports, "Round2Status", { enumerable: true, get: function
Object.defineProperty(exports, "AutoSubmitStatus", { enumerable: true, get: function () { return interface_js_1.AutoSubmitStatus; } });
Object.defineProperty(exports, "ProofSubmitMode", { enumerable: true, get: function () { return interface_js_1.ProofSubmitMode; } });
Object.defineProperty(exports, "ProvePaymentSrc", { enumerable: true, get: function () { return interface_js_1.ProvePaymentSrc; } });
Object.defineProperty(exports, "MaintenanceModeType", { enumerable: true, get: function () { return interface_js_1.MaintenanceModeType; } });
Object.defineProperty(exports, "AdminRequestType", { enumerable: true, get: function () { return interface_js_1.AdminRequestType; } });
const util_js_1 = require("./helper/util.js");
Object.defineProperty(exports, "ZkWasmUtil", { enumerable: true, get: function () { return util_js_1.ZkWasmUtil; } });
const endpoint_js_1 = require("./helper/endpoint.js");
Expand Down
14 changes: 14 additions & 0 deletions dist/cjs/interface/interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,17 @@ export interface TransactionInfo {
user_address: string;
receiver_address: string;
}
export declare enum MaintenanceModeType {
Disabled = "Disabled",
Enabled = "Enabled"
}
export declare enum AdminRequestType {
Default = "Default",
MaintenanceMode = "MaintenanceMode"
}
export interface SetMaintenanceModeParams {
mode: MaintenanceModeType;
nonce: number;
request_type: AdminRequestType;
user_address: string;
}
12 changes: 11 additions & 1 deletion dist/cjs/interface/interface.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProofSubmitMode = exports.ProvePaymentSrc = exports.AutoSubmitStatus = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.InputContextType = void 0;
exports.AdminRequestType = exports.MaintenanceModeType = exports.ProofSubmitMode = exports.ProvePaymentSrc = exports.AutoSubmitStatus = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.InputContextType = void 0;
var InputContextType;
(function (InputContextType) {
InputContextType["Custom"] = "Custom";
Expand Down Expand Up @@ -42,3 +42,13 @@ var ProofSubmitMode;
ProofSubmitMode["Manual"] = "Manual";
ProofSubmitMode["Auto"] = "Auto";
})(ProofSubmitMode = exports.ProofSubmitMode || (exports.ProofSubmitMode = {}));
var MaintenanceModeType;
(function (MaintenanceModeType) {
MaintenanceModeType["Disabled"] = "Disabled";
MaintenanceModeType["Enabled"] = "Enabled";
})(MaintenanceModeType = exports.MaintenanceModeType || (exports.MaintenanceModeType = {}));
var AdminRequestType;
(function (AdminRequestType) {
AdminRequestType["Default"] = "Default";
AdminRequestType["MaintenanceMode"] = "MaintenanceMode";
})(AdminRequestType = exports.AdminRequestType || (exports.AdminRequestType = {}));
4 changes: 3 additions & 1 deletion dist/mjs/helper/task.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QueryParams, ProvingParams, DeployParams, Statistics, AddImageParams, WithSignature, UserQueryParams, PaymentParams, TxHistoryQueryParams, LogQuery, ResetImageParams, PaginationResult, Task, Image, TransactionInfo, AppConfig, OmitSignature, ModifyImageParams, SubscriptionRequest, ERC20DepositInfo, User, Subscription, PaginatedQuery, AutoSubmitProofQuery, Round1InfoQuery, Round1Info, Round2Info, Round2InfoQuery, AutoSubmitProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams } from "../interface/interface.js";
import { QueryParams, ProvingParams, DeployParams, Statistics, AddImageParams, WithSignature, UserQueryParams, PaymentParams, TxHistoryQueryParams, LogQuery, ResetImageParams, PaginationResult, Task, Image, TransactionInfo, AppConfig, OmitSignature, ModifyImageParams, SubscriptionRequest, ERC20DepositInfo, User, Subscription, PaginatedQuery, AutoSubmitProofQuery, Round1InfoQuery, Round1Info, Round2Info, Round2InfoQuery, AutoSubmitProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams, SetMaintenanceModeParams } from "../interface/interface.js";
import { ZkWasmServiceEndpoint } from "./endpoint.js";
export declare class ZkWasmServiceHelper {
endpoint: ZkWasmServiceEndpoint;
Expand All @@ -25,6 +25,7 @@ export declare class ZkWasmServiceHelper {
addDeployTask(task: WithSignature<DeployParams>): Promise<any>;
addResetTask(task: WithSignature<ResetImageParams>): Promise<any>;
modifyImage(data: WithSignature<ModifyImageParams>): Promise<any>;
setMaintenanceMode(req: WithSignature<SetMaintenanceModeParams>): Promise<any>;
sendRequestWithSignature<T>(method: "GET" | "POST", path: TaskEndpoint, task: WithSignature<T>, isFormData?: boolean): Promise<any>;
createHeaders<T>(task: WithSignature<T>): Record<string, string>;
omitSignature<T>(task: WithSignature<T>): OmitSignature<T>;
Expand All @@ -37,6 +38,7 @@ export declare enum TaskEndpoint {
RESET = "/reset",
MODIFY = "/modify",
PAY = "/pay",
SET_MAINTENANCE_MODE = "/admin/set_maintenance_mode",
SUBSCRIBE = "/subscribe",
LOGS = "/logs",
ROUND_1_BATCH = "/round1_batch_proofs",
Expand Down
8 changes: 8 additions & 0 deletions dist/mjs/helper/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ export class ZkWasmServiceHelper {
}
return response;
}
async setMaintenanceMode(req) {
let response = await this.sendRequestWithSignature("POST", TaskEndpoint.SET_MAINTENANCE_MODE, req, true);
if (this.endpoint.enable_logs) {
console.log("setMaintenanceMode response:", response.toString());
}
return response;
}
async sendRequestWithSignature(method, path, task, isFormData = false) {
// TODO: create return types for tasks using this method
let headers = this.createHeaders(task);
Expand Down Expand Up @@ -304,6 +311,7 @@ export var TaskEndpoint;
TaskEndpoint["RESET"] = "/reset";
TaskEndpoint["MODIFY"] = "/modify";
TaskEndpoint["PAY"] = "/pay";
TaskEndpoint["SET_MAINTENANCE_MODE"] = "/admin/set_maintenance_mode";
TaskEndpoint["SUBSCRIBE"] = "/subscribe";
TaskEndpoint["LOGS"] = "/logs";
TaskEndpoint["ROUND_1_BATCH"] = "/round1_batch_proofs";
Expand Down
3 changes: 2 additions & 1 deletion dist/mjs/helper/util.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="node" />
import BN from "bn.js";
import { AddImageParams, ProvingParams, DeployParams, ResetImageParams, ModifyImageParams, VerifyProofParams, LogQuery, ContextHexString, VerifyBatchProofParams } from "../interface/interface.js";
import { AddImageParams, ProvingParams, DeployParams, ResetImageParams, ModifyImageParams, VerifyProofParams, SetMaintenanceModeParams, LogQuery, ContextHexString, VerifyBatchProofParams } from "../interface/interface.js";
import { Contract, Signer } from "ethers";
import { DelphinusWalletConnector, DelphinusBrowserConnector } from "web3subscriber/src/provider.js";
export declare class ZkWasmUtil {
Expand Down Expand Up @@ -78,6 +78,7 @@ export declare class ZkWasmUtil {
static convertAmount(balance: Uint8Array): string;
static createLogsMesssage(params: LogQuery): string;
static createAddImageSignMessage(params: AddImageParams): string;
static createSetMaintenanceModeSignMessage(params: SetMaintenanceModeParams): string;
static createProvingSignMessage(params: ProvingParams): string;
static createDeploySignMessage(params: DeployParams): string;
static createResetImageMessage(params: ResetImageParams): string;
Expand Down
8 changes: 8 additions & 0 deletions dist/mjs/helper/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,14 @@ export class ZkWasmUtil {
}
return message;
}
static createSetMaintenanceModeSignMessage(params) {
let message = "";
message += params.mode;
message += params.nonce;
message += params.request_type;
message += params.user_address;
return message;
}
static createProvingSignMessage(params) {
// No need to sign the file itself, just the md5
let message = "";
Expand Down
Loading