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
3 changes: 2 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, Round1BatchProofQuery, Round2BatchProofQuery, Round2BatchProof, Round1BatchProof, FinalBatchProofQuery, FinalBatchProof, ConciseTask } 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, Round1BatchProofQuery, Round2BatchProofQuery, Round2BatchProof, Round1BatchProof, FinalBatchProofQuery, FinalBatchProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams } from "../interface/interface.js";
import { ZkWasmServiceEndpoint } from "./endpoint.js";
export declare class ZkWasmServiceHelper {
endpoint: ZkWasmServiceEndpoint;
Expand All @@ -11,6 +11,7 @@ export declare class ZkWasmServiceHelper {
queryDepositHistory(history_query: TxHistoryQueryParams): Promise<PaginationResult<ERC20DepositInfo[]>>;
queryConfig(): Promise<AppConfig>;
loadStatistics(): Promise<Statistics>;
queryNodeStatistics(query: NodeStatisticsQueryParams): Promise<NodeStatistics[]>;
loadTasks(query: QueryParams): Promise<PaginationResult<Task[]>>;
loadTaskList(query: QueryParams): Promise<PaginationResult<ConciseTask[]>>;
queryRound1BatchProofs(query: PaginatedQuery<Round1BatchProofQuery>): Promise<PaginationResult<Round1BatchProof[]>>;
Expand Down
11 changes: 11 additions & 0 deletions dist/cjs/helper/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ class ZkWasmServiceHelper {
};
});
}
queryNodeStatistics(query) {
return __awaiter(this, void 0, void 0, function* () {
let headers = { "Content-Type": "application/json" };
let queryJson = JSON.parse(JSON.stringify(query));
let res = yield this.endpoint.invokeRequest("GET", `/node_statistics`, queryJson);
if (this.endpoint.enable_logs) {
console.log("loading node statistics");
}
return res;
});
}
loadTasks(query) {
return __awaiter(this, void 0, void 0, function* () {
let headers = { "Content-Type": "application/json" };
Expand Down
4 changes: 2 additions & 2 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, Round1BatchProof, Round2BatchProof, FinalBatchProof, Round1BatchProofStatus, Round2BatchProofStatus, Round1BatchProofQuery, Round2BatchProofQuery, FinalBatchProofQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, FinalProofStatus, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc } 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, Round1BatchProof, Round2BatchProof, FinalBatchProof, Round1BatchProofStatus, Round2BatchProofStatus, Round1BatchProofQuery, Round2BatchProofQuery, FinalBatchProofQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, FinalProofStatus, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc, NodeStatistics, NodeStatisticsQueryParams } 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, Round1BatchProofStatus, Round2BatchProofStatus, FinalProofStatus, 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, Round1BatchProof, Round2BatchProof, FinalBatchProof, Round1BatchProofQuery, Round2BatchProofQuery, FinalBatchProofQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, };
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, Round1BatchProof, Round2BatchProof, FinalBatchProof, Round1BatchProofQuery, Round2BatchProofQuery, FinalBatchProofQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, NodeStatistics, NodeStatisticsQueryParams, };
17 changes: 17 additions & 0 deletions dist/cjs/interface/interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ export interface Statistics {
totalTasks: number;
totalDeployed: number;
}
export interface NodeStatistics {
address: string;
statistics: {
successful_tasks: number;
failed_tasks: number;
total_tasks: number;
timed_out_count: number;
last_timed_out: string;
last_successful_proof_task_time: string;
last_successful_proof_processing_time: number;
};
}
export interface NodeStatisticsQueryParams {
address?: string;
start?: number;
total?: number;
}
export declare enum InputContextType {
Custom = "Custom",
ImageInitial = "ImageInitial",
Expand Down
3 changes: 2 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, Round1BatchProofQuery, Round2BatchProofQuery, Round2BatchProof, Round1BatchProof, FinalBatchProofQuery, FinalBatchProof, ConciseTask } 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, Round1BatchProofQuery, Round2BatchProofQuery, Round2BatchProof, Round1BatchProof, FinalBatchProofQuery, FinalBatchProof, ConciseTask, NodeStatistics, NodeStatisticsQueryParams } from "../interface/interface.js";
import { ZkWasmServiceEndpoint } from "./endpoint.js";
export declare class ZkWasmServiceHelper {
endpoint: ZkWasmServiceEndpoint;
Expand All @@ -11,6 +11,7 @@ export declare class ZkWasmServiceHelper {
queryDepositHistory(history_query: TxHistoryQueryParams): Promise<PaginationResult<ERC20DepositInfo[]>>;
queryConfig(): Promise<AppConfig>;
loadStatistics(): Promise<Statistics>;
queryNodeStatistics(query: NodeStatisticsQueryParams): Promise<NodeStatistics[]>;
loadTasks(query: QueryParams): Promise<PaginationResult<Task[]>>;
loadTaskList(query: QueryParams): Promise<PaginationResult<ConciseTask[]>>;
queryRound1BatchProofs(query: PaginatedQuery<Round1BatchProofQuery>): Promise<PaginationResult<Round1BatchProof[]>>;
Expand Down
9 changes: 9 additions & 0 deletions dist/mjs/helper/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ export class ZkWasmServiceHelper {
totalDeployed: st.total_deployed,
};
}
async queryNodeStatistics(query) {
let headers = { "Content-Type": "application/json" };
let queryJson = JSON.parse(JSON.stringify(query));
let res = await this.endpoint.invokeRequest("GET", `/node_statistics`, queryJson);
if (this.endpoint.enable_logs) {
console.log("loading node statistics");
}
return res;
}
async loadTasks(query) {
let headers = { "Content-Type": "application/json" };
let queryJson = JSON.parse("{}");
Expand Down
4 changes: 2 additions & 2 deletions dist/mjs/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, Round1BatchProof, Round2BatchProof, FinalBatchProof, Round1BatchProofStatus, Round2BatchProofStatus, Round1BatchProofQuery, Round2BatchProofQuery, FinalBatchProofQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, FinalProofStatus, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc } 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, Round1BatchProof, Round2BatchProof, FinalBatchProof, Round1BatchProofStatus, Round2BatchProofStatus, Round1BatchProofQuery, Round2BatchProofQuery, FinalBatchProofQuery, PaginatedQuery, PaginationQuery, AutoSubmitStatus, VerifyBatchProofParams, FinalProofStatus, AutoSubmitBatchMetadata, ProofSubmitMode, ProvePaymentSrc, NodeStatistics, NodeStatisticsQueryParams } 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, Round1BatchProofStatus, Round2BatchProofStatus, FinalProofStatus, 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, Round1BatchProof, Round2BatchProof, FinalBatchProof, Round1BatchProofQuery, Round2BatchProofQuery, FinalBatchProofQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, };
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, Round1BatchProof, Round2BatchProof, FinalBatchProof, Round1BatchProofQuery, Round2BatchProofQuery, FinalBatchProofQuery, PaginatedQuery, PaginationQuery, VerifyBatchProofParams, AutoSubmitBatchMetadata, NodeStatistics, NodeStatisticsQueryParams, };
17 changes: 17 additions & 0 deletions dist/mjs/interface/interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ export interface Statistics {
totalTasks: number;
totalDeployed: number;
}
export interface NodeStatistics {
address: string;
statistics: {
successful_tasks: number;
failed_tasks: number;
total_tasks: number;
timed_out_count: number;
last_timed_out: string;
last_successful_proof_task_time: string;
last_successful_proof_processing_time: number;
};
}
export interface NodeStatisticsQueryParams {
address?: string;
start?: number;
total?: number;
}
export declare enum InputContextType {
Custom = "Custom",
ImageInitial = "ImageInitial",
Expand Down
20 changes: 20 additions & 0 deletions src/helper/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {
FinalBatchProofQuery,
FinalBatchProof,
ConciseTask,
NodeStatistics,
NodeStatisticsQueryParams,
} from "../interface/interface.js";
import { ZkWasmServiceEndpoint } from "./endpoint.js";
import { ethers } from "ethers";
Expand Down Expand Up @@ -157,6 +159,24 @@ export class ZkWasmServiceHelper {
};
}

async queryNodeStatistics(
query: NodeStatisticsQueryParams
): Promise<NodeStatistics[]> {
let headers = { "Content-Type": "application/json" };
let queryJson = JSON.parse(JSON.stringify(query));

let res = await this.endpoint.invokeRequest(
"GET",
`/node_statistics`,
queryJson
);
if (this.endpoint.enable_logs) {
console.log("loading node statistics");
}

return res as NodeStatistics[];
}

async loadTasks(query: QueryParams): Promise<PaginationResult<Task[]>> {
let headers = { "Content-Type": "application/json" };
let queryJson = JSON.parse("{}");
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ import {
AutoSubmitBatchMetadata,
ProofSubmitMode,
ProvePaymentSrc,
NodeStatistics,
NodeStatisticsQueryParams,
} from "./interface/interface.js";

import { ZkWasmUtil } from "./helper/util.js";
Expand Down Expand Up @@ -124,4 +126,6 @@ export type {
PaginationQuery,
VerifyBatchProofParams,
AutoSubmitBatchMetadata,
NodeStatistics,
NodeStatisticsQueryParams,
};
19 changes: 19 additions & 0 deletions src/interface/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ export interface Statistics {
totalDeployed: number;
}

export interface NodeStatistics {
address: string;
statistics: {
successful_tasks: number;
failed_tasks: number;
total_tasks: number;
timed_out_count: number;
last_timed_out: string;
last_successful_proof_task_time: string;
last_successful_proof_processing_time: number;
};
}

export interface NodeStatisticsQueryParams {
address?: string;
start?: number;
total?: number;
}

export enum InputContextType {
Custom = "Custom",
ImageInitial = "ImageInitial",
Expand Down