From d1af453700ef96829a966ea5b6e2b1e508263cb4 Mon Sep 17 00:00:00 2001 From: rhaoio Date: Mon, 3 Jun 2024 13:43:21 +1000 Subject: [PATCH 1/4] add reduced task --- dist/cjs/helper/task.d.ts | 3 +- dist/cjs/helper/task.js | 46 ++++++++++++++++++++++++++ dist/cjs/index.d.ts | 4 +-- dist/cjs/interface/interface.d.ts | 11 +++++++ dist/mjs/helper/task.d.ts | 3 +- dist/mjs/helper/task.js | 44 +++++++++++++++++++++++++ dist/mjs/index.d.ts | 4 +-- dist/mjs/interface/interface.d.ts | 11 +++++++ src/helper/task.ts | 54 +++++++++++++++++++++++++++++++ src/index.ts | 2 ++ src/interface/interface.ts | 12 +++++++ 11 files changed, 188 insertions(+), 6 deletions(-) diff --git a/dist/cjs/helper/task.d.ts b/dist/cjs/helper/task.d.ts index a1cee621..42462d62 100644 --- a/dist/cjs/helper/task.d.ts +++ b/dist/cjs/helper/task.d.ts @@ -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 } 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, ReducedTask } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; export declare class ZkWasmServiceHelper { endpoint: ZkWasmServiceEndpoint; @@ -12,6 +12,7 @@ export declare class ZkWasmServiceHelper { queryConfig(): Promise; loadStatistics(): Promise; loadTasks(query: QueryParams): Promise>; + loadTaskList(query: QueryParams): Promise>; queryRound1BatchProofs(query: PaginatedQuery): Promise>; queryRound2BatchProofs(query: PaginatedQuery): Promise>; queryFinalBatchProofs(query: PaginatedQuery): Promise>; diff --git a/dist/cjs/helper/task.js b/dist/cjs/helper/task.js index 59fd012a..9f7fee38 100644 --- a/dist/cjs/helper/task.js +++ b/dist/cjs/helper/task.js @@ -169,6 +169,52 @@ class ZkWasmServiceHelper { return tasks; }); } + loadTaskList(query) { + return __awaiter(this, void 0, void 0, function* () { + let headers = { "Content-Type": "application/json" }; + let queryJson = JSON.parse("{}"); + // Validate query params + if (query.start != null && query.start < 0) { + throw new Error("start must be positive"); + } + if (query.total != null && query.total <= 0) { + throw new Error("total must be positive"); + } + if (query.id != null && query.id != "") { + // Validate it is a hex string (mongodb objectid) + if (!util_js_1.ZkWasmUtil.isHexString(query.id)) { + throw new Error("id must be a hex string or "); + } + } + if (query.user_address != null && query.user_address != "") { + // Validate it is a hex string (ethereum address) + if (!ethers_1.ethers.isAddress(query.user_address)) { + throw new Error("user_address must be a valid ethereum address"); + } + } + if (query.md5 != null && query.md5 != "") { + // Validate it is a hex string (md5) + if (!util_js_1.ZkWasmUtil.isHexString(query.md5)) { + throw new Error("md5 must be a hex string"); + } + } + //build query JSON + let objKeys = Object.keys(query); + objKeys.forEach((key) => { + if (query[key] != "" && query[key] != null) + queryJson[key] = query[key]; + }); + if (this.endpoint.enable_logs) { + console.log("params:", query); + console.log("json", queryJson); + } + let tasks = yield this.endpoint.invokeRequest("GET", `/tasks`, queryJson); + if (this.endpoint.enable_logs) { + console.log("loading task board!"); + } + return tasks; + }); + } queryRound1BatchProofs(query) { return __awaiter(this, void 0, void 0, function* () { let proofData = yield this.endpoint.invokeRequest("GET", TaskEndpoint.ROUND_1_BATCH, JSON.parse(JSON.stringify(query))); diff --git a/dist/cjs/index.d.ts b/dist/cjs/index.d.ts index 9f6f193e..7007bce8 100644 --- a/dist/cjs/index.d.ts +++ b/dist/cjs/index.d.ts @@ -1,6 +1,6 @@ -import { Task, 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, ReducedTask, 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 { ZkWasmUtil } from "./helper/util.js"; import { ZkWasmServiceEndpoint } from "./helper/endpoint.js"; import { ZkWasmServiceHelper } from "./helper/task.js"; export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, InputContextType, AutoSubmitStatus, Round1BatchProofStatus, Round2BatchProofStatus, FinalProofStatus, ProofSubmitMode, ProvePaymentSrc, }; -export type { Task, 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, ReducedTask, 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, }; diff --git a/dist/cjs/interface/interface.d.ts b/dist/cjs/interface/interface.d.ts index 16aa6de3..bf34e1f2 100644 --- a/dist/cjs/interface/interface.d.ts +++ b/dist/cjs/interface/interface.d.ts @@ -41,6 +41,17 @@ export interface Task { batch_proof_data?: BatchProofData; auto_submit_status?: AutoSubmitStatus; } +export interface ReducedTask { + id: any; + md5: string; + task_type: string; + status: TaskStatus; + submit_time: string; + process_started?: string; + process_finished?: string; + proof_submit_mode?: ProofSubmitMode; + auto_submit_status?: AutoSubmitStatus; +} export interface AutoSubmitBatchMetadata { chain_id: number; id: string; diff --git a/dist/mjs/helper/task.d.ts b/dist/mjs/helper/task.d.ts index a1cee621..42462d62 100644 --- a/dist/mjs/helper/task.d.ts +++ b/dist/mjs/helper/task.d.ts @@ -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 } 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, ReducedTask } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; export declare class ZkWasmServiceHelper { endpoint: ZkWasmServiceEndpoint; @@ -12,6 +12,7 @@ export declare class ZkWasmServiceHelper { queryConfig(): Promise; loadStatistics(): Promise; loadTasks(query: QueryParams): Promise>; + loadTaskList(query: QueryParams): Promise>; queryRound1BatchProofs(query: PaginatedQuery): Promise>; queryRound2BatchProofs(query: PaginatedQuery): Promise>; queryFinalBatchProofs(query: PaginatedQuery): Promise>; diff --git a/dist/mjs/helper/task.js b/dist/mjs/helper/task.js index 68046612..cf3960c3 100644 --- a/dist/mjs/helper/task.js +++ b/dist/mjs/helper/task.js @@ -126,6 +126,50 @@ export class ZkWasmServiceHelper { } return tasks; } + async loadTaskList(query) { + let headers = { "Content-Type": "application/json" }; + let queryJson = JSON.parse("{}"); + // Validate query params + if (query.start != null && query.start < 0) { + throw new Error("start must be positive"); + } + if (query.total != null && query.total <= 0) { + throw new Error("total must be positive"); + } + if (query.id != null && query.id != "") { + // Validate it is a hex string (mongodb objectid) + if (!ZkWasmUtil.isHexString(query.id)) { + throw new Error("id must be a hex string or "); + } + } + if (query.user_address != null && query.user_address != "") { + // Validate it is a hex string (ethereum address) + if (!ethers.isAddress(query.user_address)) { + throw new Error("user_address must be a valid ethereum address"); + } + } + if (query.md5 != null && query.md5 != "") { + // Validate it is a hex string (md5) + if (!ZkWasmUtil.isHexString(query.md5)) { + throw new Error("md5 must be a hex string"); + } + } + //build query JSON + let objKeys = Object.keys(query); + objKeys.forEach((key) => { + if (query[key] != "" && query[key] != null) + queryJson[key] = query[key]; + }); + if (this.endpoint.enable_logs) { + console.log("params:", query); + console.log("json", queryJson); + } + let tasks = await this.endpoint.invokeRequest("GET", `/tasks`, queryJson); + if (this.endpoint.enable_logs) { + console.log("loading task board!"); + } + return tasks; + } async queryRound1BatchProofs(query) { let proofData = await this.endpoint.invokeRequest("GET", TaskEndpoint.ROUND_1_BATCH, JSON.parse(JSON.stringify(query))); if (this.endpoint.enable_logs) { diff --git a/dist/mjs/index.d.ts b/dist/mjs/index.d.ts index 9f6f193e..7007bce8 100644 --- a/dist/mjs/index.d.ts +++ b/dist/mjs/index.d.ts @@ -1,6 +1,6 @@ -import { Task, 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, ReducedTask, 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 { ZkWasmUtil } from "./helper/util.js"; import { ZkWasmServiceEndpoint } from "./helper/endpoint.js"; import { ZkWasmServiceHelper } from "./helper/task.js"; export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, InputContextType, AutoSubmitStatus, Round1BatchProofStatus, Round2BatchProofStatus, FinalProofStatus, ProofSubmitMode, ProvePaymentSrc, }; -export type { Task, 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, ReducedTask, 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, }; diff --git a/dist/mjs/interface/interface.d.ts b/dist/mjs/interface/interface.d.ts index 16aa6de3..bf34e1f2 100644 --- a/dist/mjs/interface/interface.d.ts +++ b/dist/mjs/interface/interface.d.ts @@ -41,6 +41,17 @@ export interface Task { batch_proof_data?: BatchProofData; auto_submit_status?: AutoSubmitStatus; } +export interface ReducedTask { + id: any; + md5: string; + task_type: string; + status: TaskStatus; + submit_time: string; + process_started?: string; + process_finished?: string; + proof_submit_mode?: ProofSubmitMode; + auto_submit_status?: AutoSubmitStatus; +} export interface AutoSubmitBatchMetadata { chain_id: number; id: string; diff --git a/src/helper/task.ts b/src/helper/task.ts index 0c63f3a5..c41f1ddb 100644 --- a/src/helper/task.ts +++ b/src/helper/task.ts @@ -30,6 +30,7 @@ import { Round1BatchProof, FinalBatchProofQuery, FinalBatchProof, + ReducedTask, } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; import { ethers } from "ethers"; @@ -207,6 +208,59 @@ export class ZkWasmServiceHelper { return tasks; } + async loadTaskList( + query: QueryParams + ): Promise> { + let headers = { "Content-Type": "application/json" }; + let queryJson = JSON.parse("{}"); + + // Validate query params + if (query.start != null && query.start < 0) { + throw new Error("start must be positive"); + } + if (query.total != null && query.total <= 0) { + throw new Error("total must be positive"); + } + + if (query.id != null && query.id != "") { + // Validate it is a hex string (mongodb objectid) + if (!ZkWasmUtil.isHexString(query.id)) { + throw new Error("id must be a hex string or "); + } + } + + if (query.user_address != null && query.user_address != "") { + // Validate it is a hex string (ethereum address) + if (!ethers.isAddress(query.user_address)) { + throw new Error("user_address must be a valid ethereum address"); + } + } + + if (query.md5 != null && query.md5 != "") { + // Validate it is a hex string (md5) + if (!ZkWasmUtil.isHexString(query.md5)) { + throw new Error("md5 must be a hex string"); + } + } + + //build query JSON + let objKeys = Object.keys(query) as Array; + objKeys.forEach((key) => { + if (query[key] != "" && query[key] != null) queryJson[key] = query[key]; + }); + + if (this.endpoint.enable_logs) { + console.log("params:", query); + console.log("json", queryJson); + } + + let tasks = await this.endpoint.invokeRequest("GET", `/tasks`, queryJson); + if (this.endpoint.enable_logs) { + console.log("loading task board!"); + } + return tasks; + } + async queryRound1BatchProofs( query: PaginatedQuery ): Promise> { diff --git a/src/index.ts b/src/index.ts index 7b47f874..5faa4330 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ import { Task, + ReducedTask, ProvingParams, DeployParams, QueryParams, @@ -74,6 +75,7 @@ export { export type { Task, + ReducedTask, ProvingParams, DeployParams, QueryParams, diff --git a/src/interface/interface.ts b/src/interface/interface.ts index e05fd25e..7d20d92c 100644 --- a/src/interface/interface.ts +++ b/src/interface/interface.ts @@ -45,6 +45,18 @@ export interface Task { auto_submit_status?: AutoSubmitStatus; } +export interface ReducedTask { + id: any; + md5: string; + task_type: string; + status: TaskStatus; + submit_time: string; + process_started?: string; + process_finished?: string; + proof_submit_mode?: ProofSubmitMode; + auto_submit_status?: AutoSubmitStatus; +} + export interface AutoSubmitBatchMetadata { chain_id: number; id: string; From 8125f12386c8b4e58d21151c815e77cfffa49bf2 Mon Sep 17 00:00:00 2001 From: rhaoio Date: Mon, 3 Jun 2024 14:17:07 +1000 Subject: [PATCH 2/4] add user addr --- dist/cjs/interface/interface.d.ts | 3 ++- dist/mjs/interface/interface.d.ts | 3 ++- src/interface/interface.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dist/cjs/interface/interface.d.ts b/dist/cjs/interface/interface.d.ts index bf34e1f2..359bb39b 100644 --- a/dist/cjs/interface/interface.d.ts +++ b/dist/cjs/interface/interface.d.ts @@ -42,7 +42,8 @@ export interface Task { auto_submit_status?: AutoSubmitStatus; } export interface ReducedTask { - id: any; + _id: any; + user_address: string; md5: string; task_type: string; status: TaskStatus; diff --git a/dist/mjs/interface/interface.d.ts b/dist/mjs/interface/interface.d.ts index bf34e1f2..359bb39b 100644 --- a/dist/mjs/interface/interface.d.ts +++ b/dist/mjs/interface/interface.d.ts @@ -42,7 +42,8 @@ export interface Task { auto_submit_status?: AutoSubmitStatus; } export interface ReducedTask { - id: any; + _id: any; + user_address: string; md5: string; task_type: string; status: TaskStatus; diff --git a/src/interface/interface.ts b/src/interface/interface.ts index 7d20d92c..b2cc10ab 100644 --- a/src/interface/interface.ts +++ b/src/interface/interface.ts @@ -46,7 +46,8 @@ export interface Task { } export interface ReducedTask { - id: any; + _id: any; + user_address: string; md5: string; task_type: string; status: TaskStatus; From 68418e8cd5716c9a1e87d72e00b68c21ec6adc0f Mon Sep 17 00:00:00 2001 From: rhaoio Date: Mon, 3 Jun 2024 14:50:59 +1000 Subject: [PATCH 3/4] separate endpoint --- dist/cjs/helper/task.js | 2 +- dist/mjs/helper/task.js | 2 +- src/helper/task.ts | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dist/cjs/helper/task.js b/dist/cjs/helper/task.js index 9f7fee38..98dfdf8b 100644 --- a/dist/cjs/helper/task.js +++ b/dist/cjs/helper/task.js @@ -208,7 +208,7 @@ class ZkWasmServiceHelper { console.log("params:", query); console.log("json", queryJson); } - let tasks = yield this.endpoint.invokeRequest("GET", `/tasks`, queryJson); + let tasks = yield this.endpoint.invokeRequest("GET", `/tasklist`, queryJson); if (this.endpoint.enable_logs) { console.log("loading task board!"); } diff --git a/dist/mjs/helper/task.js b/dist/mjs/helper/task.js index cf3960c3..a84aeed1 100644 --- a/dist/mjs/helper/task.js +++ b/dist/mjs/helper/task.js @@ -164,7 +164,7 @@ export class ZkWasmServiceHelper { console.log("params:", query); console.log("json", queryJson); } - let tasks = await this.endpoint.invokeRequest("GET", `/tasks`, queryJson); + let tasks = await this.endpoint.invokeRequest("GET", `/tasklist`, queryJson); if (this.endpoint.enable_logs) { console.log("loading task board!"); } diff --git a/src/helper/task.ts b/src/helper/task.ts index c41f1ddb..9bf16a41 100644 --- a/src/helper/task.ts +++ b/src/helper/task.ts @@ -254,7 +254,11 @@ export class ZkWasmServiceHelper { console.log("json", queryJson); } - let tasks = await this.endpoint.invokeRequest("GET", `/tasks`, queryJson); + let tasks = await this.endpoint.invokeRequest( + "GET", + `/tasklist`, + queryJson + ); if (this.endpoint.enable_logs) { console.log("loading task board!"); } From eb64b38778e1d124242ebc6462e68eceec59d66e Mon Sep 17 00:00:00 2001 From: rhaoio Date: Mon, 3 Jun 2024 15:43:48 +1000 Subject: [PATCH 4/4] rename --- dist/cjs/helper/task.d.ts | 4 ++-- dist/cjs/index.d.ts | 4 ++-- dist/cjs/interface/interface.d.ts | 2 +- dist/mjs/helper/task.d.ts | 4 ++-- dist/mjs/index.d.ts | 4 ++-- dist/mjs/interface/interface.d.ts | 2 +- src/helper/task.ts | 4 ++-- src/index.ts | 4 ++-- src/interface/interface.ts | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dist/cjs/helper/task.d.ts b/dist/cjs/helper/task.d.ts index 42462d62..a89c66b2 100644 --- a/dist/cjs/helper/task.d.ts +++ b/dist/cjs/helper/task.d.ts @@ -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, ReducedTask } 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 } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; export declare class ZkWasmServiceHelper { endpoint: ZkWasmServiceEndpoint; @@ -12,7 +12,7 @@ export declare class ZkWasmServiceHelper { queryConfig(): Promise; loadStatistics(): Promise; loadTasks(query: QueryParams): Promise>; - loadTaskList(query: QueryParams): Promise>; + loadTaskList(query: QueryParams): Promise>; queryRound1BatchProofs(query: PaginatedQuery): Promise>; queryRound2BatchProofs(query: PaginatedQuery): Promise>; queryFinalBatchProofs(query: PaginatedQuery): Promise>; diff --git a/dist/cjs/index.d.ts b/dist/cjs/index.d.ts index 7007bce8..a3fd21be 100644 --- a/dist/cjs/index.d.ts +++ b/dist/cjs/index.d.ts @@ -1,6 +1,6 @@ -import { Task, ReducedTask, 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 } from "./interface/interface.js"; import { ZkWasmUtil } from "./helper/util.js"; import { ZkWasmServiceEndpoint } from "./helper/endpoint.js"; import { ZkWasmServiceHelper } from "./helper/task.js"; export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, InputContextType, AutoSubmitStatus, Round1BatchProofStatus, Round2BatchProofStatus, FinalProofStatus, ProofSubmitMode, ProvePaymentSrc, }; -export type { Task, ReducedTask, 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, }; diff --git a/dist/cjs/interface/interface.d.ts b/dist/cjs/interface/interface.d.ts index 359bb39b..3fff752b 100644 --- a/dist/cjs/interface/interface.d.ts +++ b/dist/cjs/interface/interface.d.ts @@ -41,7 +41,7 @@ export interface Task { batch_proof_data?: BatchProofData; auto_submit_status?: AutoSubmitStatus; } -export interface ReducedTask { +export interface ConciseTask { _id: any; user_address: string; md5: string; diff --git a/dist/mjs/helper/task.d.ts b/dist/mjs/helper/task.d.ts index 42462d62..a89c66b2 100644 --- a/dist/mjs/helper/task.d.ts +++ b/dist/mjs/helper/task.d.ts @@ -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, ReducedTask } 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 } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; export declare class ZkWasmServiceHelper { endpoint: ZkWasmServiceEndpoint; @@ -12,7 +12,7 @@ export declare class ZkWasmServiceHelper { queryConfig(): Promise; loadStatistics(): Promise; loadTasks(query: QueryParams): Promise>; - loadTaskList(query: QueryParams): Promise>; + loadTaskList(query: QueryParams): Promise>; queryRound1BatchProofs(query: PaginatedQuery): Promise>; queryRound2BatchProofs(query: PaginatedQuery): Promise>; queryFinalBatchProofs(query: PaginatedQuery): Promise>; diff --git a/dist/mjs/index.d.ts b/dist/mjs/index.d.ts index 7007bce8..a3fd21be 100644 --- a/dist/mjs/index.d.ts +++ b/dist/mjs/index.d.ts @@ -1,6 +1,6 @@ -import { Task, ReducedTask, 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 } from "./interface/interface.js"; import { ZkWasmUtil } from "./helper/util.js"; import { ZkWasmServiceEndpoint } from "./helper/endpoint.js"; import { ZkWasmServiceHelper } from "./helper/task.js"; export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, InputContextType, AutoSubmitStatus, Round1BatchProofStatus, Round2BatchProofStatus, FinalProofStatus, ProofSubmitMode, ProvePaymentSrc, }; -export type { Task, ReducedTask, 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, }; diff --git a/dist/mjs/interface/interface.d.ts b/dist/mjs/interface/interface.d.ts index 359bb39b..3fff752b 100644 --- a/dist/mjs/interface/interface.d.ts +++ b/dist/mjs/interface/interface.d.ts @@ -41,7 +41,7 @@ export interface Task { batch_proof_data?: BatchProofData; auto_submit_status?: AutoSubmitStatus; } -export interface ReducedTask { +export interface ConciseTask { _id: any; user_address: string; md5: string; diff --git a/src/helper/task.ts b/src/helper/task.ts index 9bf16a41..965fb361 100644 --- a/src/helper/task.ts +++ b/src/helper/task.ts @@ -30,7 +30,7 @@ import { Round1BatchProof, FinalBatchProofQuery, FinalBatchProof, - ReducedTask, + ConciseTask, } from "../interface/interface.js"; import { ZkWasmServiceEndpoint } from "./endpoint.js"; import { ethers } from "ethers"; @@ -210,7 +210,7 @@ export class ZkWasmServiceHelper { async loadTaskList( query: QueryParams - ): Promise> { + ): Promise> { let headers = { "Content-Type": "application/json" }; let queryJson = JSON.parse("{}"); diff --git a/src/index.ts b/src/index.ts index 5faa4330..c06d6596 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { Task, - ReducedTask, + ConciseTask, ProvingParams, DeployParams, QueryParams, @@ -75,7 +75,7 @@ export { export type { Task, - ReducedTask, + ConciseTask, ProvingParams, DeployParams, QueryParams, diff --git a/src/interface/interface.ts b/src/interface/interface.ts index b2cc10ab..7eaa1b3d 100644 --- a/src/interface/interface.ts +++ b/src/interface/interface.ts @@ -45,7 +45,7 @@ export interface Task { auto_submit_status?: AutoSubmitStatus; } -export interface ReducedTask { +export interface ConciseTask { _id: any; user_address: string; md5: string;