Skip to content

Commit

Permalink
Feature/sept2024 (#110)
Browse files Browse the repository at this point in the history
* ZKWAS-359: add Compression Type in interface for UI (#101)

* ZKWAS-349: big image fee endpoint updates (#102)

* ZKWAS-353: add example of compression type (#104)

---------

Co-authored-by: Oscar Downing <[email protected]>
  • Loading branch information
yymone and qozymandias authored Nov 1, 2024
1 parent 52d1ab3 commit 9d86d77
Show file tree
Hide file tree
Showing 18 changed files with 1,363 additions and 1,397 deletions.
8 changes: 7 additions & 1 deletion dist/cjs/helper/task.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<<<<<<< HEAD
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, ProverNodesSummary } 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, EstimatedProofFeeParams, EstimatedProofFee } from "../interface/interface.js";
>>>>>>> ZKWAS-349: big image fee endpoint updates (#102)
import { ZkWasmServiceEndpoint } from "./endpoint.js";
export declare class ZkWasmServiceHelper {
endpoint: ZkWasmServiceEndpoint;
Expand Down Expand Up @@ -27,6 +31,7 @@ export declare class ZkWasmServiceHelper {
addResetTask(task: WithSignature<ResetImageParams>): Promise<any>;
modifyImage(data: WithSignature<ModifyImageParams>): Promise<any>;
setMaintenanceMode(req: WithSignature<SetMaintenanceModeParams>): Promise<any>;
queryEstimateProofFee(query: EstimatedProofFeeParams): Promise<EstimatedProofFee>;
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 @@ -44,5 +49,6 @@ export declare enum TaskEndpoint {
LOGS = "/logs",
ROUND_1_BATCH = "/round1_batch_proofs",
ROUND_2_BATCH = "/round2_batch_proofs",
FINAL_BATCH = "/final_batch_proofs"
FINAL_BATCH = "/final_batch_proofs",
GET_ESTIMATED_PROOF_FEE = "/estimated_proof_fee"
}
10 changes: 10 additions & 0 deletions dist/cjs/helper/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,15 @@ class ZkWasmServiceHelper {
return response;
});
}
queryEstimateProofFee(query) {
return __awaiter(this, void 0, void 0, function* () {
const config = yield this.endpoint.invokeRequest("GET", TaskEndpoint.GET_ESTIMATED_PROOF_FEE, JSON.parse(JSON.stringify(query)));
if (this.endpoint.enable_logs) {
console.log("get queryEstimateProofFee response.");
}
return config;
});
}
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 @@ -407,4 +416,5 @@ var TaskEndpoint;
TaskEndpoint["ROUND_1_BATCH"] = "/round1_batch_proofs";
TaskEndpoint["ROUND_2_BATCH"] = "/round2_batch_proofs";
TaskEndpoint["FINAL_BATCH"] = "/final_batch_proofs";
TaskEndpoint["GET_ESTIMATED_PROOF_FEE"] = "/estimated_proof_fee";
})(TaskEndpoint = exports.TaskEndpoint || (exports.TaskEndpoint = {}));
13 changes: 11 additions & 2 deletions dist/cjs/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
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, ServerVersionInfo, ProverLevel, ProverNodesSummary } from "./interface/interface.js";
<<<<<<< HEAD
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, ServerVersionInfo, ProverLevel, ProverNodesSummary, CompressionType } 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, ServerVersionInfo, CompressionType, EstimatedProofFeeParams, EstimatedProofFee } from "./interface/interface.js";
>>>>>>> ZKWAS-349: big image fee endpoint updates (#102)
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, MaintenanceModeType, AdminRequestType, ProverLevel, };
<<<<<<< HEAD
export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, ProverLevel, CompressionType, };
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, ServerVersionInfo, ProverNodesSummary, };
=======
export { ZkWasmServiceEndpoint, ZkWasmServiceHelper, ZkWasmUtil, ERC20Lib, InputContextType, AutoSubmitStatus, AutoSubmitProofStatus, Round1Status, Round2Status, ProofSubmitMode, ProvePaymentSrc, MaintenanceModeType, AdminRequestType, CompressionType, };
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, ServerVersionInfo, EstimatedProofFeeParams, EstimatedProofFee, };
>>>>>>> ZKWAS-349: big image fee endpoint updates (#102)
3 changes: 2 additions & 1 deletion dist/cjs/index.js

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

16 changes: 16 additions & 0 deletions dist/cjs/interface/interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export declare enum InputContextType {
ImageInitial = "ImageInitial",
ImageCurrent = "ImageCurrent"
}
export declare enum CompressionType {
None = "None",
GZip = "GZip"
}
export type ContextHexString = string;
export interface Task {
user_address: string;
Expand Down Expand Up @@ -85,6 +89,7 @@ export interface Task {
proof_submit_mode?: ProofSubmitMode;
batch_proof_data?: BatchProofData;
auto_submit_status?: AutoSubmitStatus;
compression?: CompressionType;
}
export type ObjectId = {
$oid: string;
Expand Down Expand Up @@ -489,6 +494,7 @@ export interface User {
*/
balance: Uint8Array;
credits: string;
credit_deficit: string;
}
export interface TransactionInfo {
txhash: string;
Expand All @@ -510,3 +516,13 @@ export interface SetMaintenanceModeParams {
request_type: AdminRequestType;
user_address: string;
}
export interface EstimatedProofFeeParams {
user_address: string;
md5: string;
proof_submit_mode: ProofSubmitMode;
}
export interface EstimatedProofFee {
min?: number;
max?: number;
msg: string;
}
7 changes: 6 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.AdminRequestType = exports.MaintenanceModeType = exports.ProofSubmitMode = exports.ProvePaymentSrc = exports.AutoSubmitStatus = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.InputContextType = exports.ProverLevel = void 0;
exports.AdminRequestType = exports.MaintenanceModeType = exports.ProofSubmitMode = exports.ProvePaymentSrc = exports.AutoSubmitStatus = exports.Round2Status = exports.Round1Status = exports.AutoSubmitProofStatus = exports.CompressionType = exports.InputContextType = exports.ProverLevel = void 0;
var ProverLevel;
(function (ProverLevel) {
ProverLevel["Inactive"] = "Inactive";
Expand All @@ -14,6 +14,11 @@ var InputContextType;
InputContextType["ImageInitial"] = "ImageInitial";
InputContextType["ImageCurrent"] = "ImageCurrent";
})(InputContextType = exports.InputContextType || (exports.InputContextType = {}));
var CompressionType;
(function (CompressionType) {
CompressionType["None"] = "None";
CompressionType["GZip"] = "GZip";
})(CompressionType = exports.CompressionType || (exports.CompressionType = {}));
var AutoSubmitProofStatus;
(function (AutoSubmitProofStatus) {
AutoSubmitProofStatus["Pending"] = "Pending";
Expand Down
8 changes: 7 additions & 1 deletion dist/mjs/helper/task.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<<<<<<< HEAD
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, ProverNodesSummary } 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, EstimatedProofFeeParams, EstimatedProofFee } from "../interface/interface.js";
>>>>>>> ZKWAS-349: big image fee endpoint updates (#102)
import { ZkWasmServiceEndpoint } from "./endpoint.js";
export declare class ZkWasmServiceHelper {
endpoint: ZkWasmServiceEndpoint;
Expand Down Expand Up @@ -27,6 +31,7 @@ export declare class ZkWasmServiceHelper {
addResetTask(task: WithSignature<ResetImageParams>): Promise<any>;
modifyImage(data: WithSignature<ModifyImageParams>): Promise<any>;
setMaintenanceMode(req: WithSignature<SetMaintenanceModeParams>): Promise<any>;
queryEstimateProofFee(query: EstimatedProofFeeParams): Promise<EstimatedProofFee>;
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 @@ -44,5 +49,6 @@ export declare enum TaskEndpoint {
LOGS = "/logs",
ROUND_1_BATCH = "/round1_batch_proofs",
ROUND_2_BATCH = "/round2_batch_proofs",
FINAL_BATCH = "/final_batch_proofs"
FINAL_BATCH = "/final_batch_proofs",
GET_ESTIMATED_PROOF_FEE = "/estimated_proof_fee"
}
8 changes: 8 additions & 0 deletions dist/mjs/helper/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,13 @@ export class ZkWasmServiceHelper {
}
return response;
}
async queryEstimateProofFee(query) {
const config = await this.endpoint.invokeRequest("GET", TaskEndpoint.GET_ESTIMATED_PROOF_FEE, JSON.parse(JSON.stringify(query)));
if (this.endpoint.enable_logs) {
console.log("get queryEstimateProofFee response.");
}
return config;
}
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 @@ -331,4 +338,5 @@ export var TaskEndpoint;
TaskEndpoint["ROUND_1_BATCH"] = "/round1_batch_proofs";
TaskEndpoint["ROUND_2_BATCH"] = "/round2_batch_proofs";
TaskEndpoint["FINAL_BATCH"] = "/final_batch_proofs";
TaskEndpoint["GET_ESTIMATED_PROOF_FEE"] = "/estimated_proof_fee";
})(TaskEndpoint || (TaskEndpoint = {}));
Loading

0 comments on commit 9d86d77

Please sign in to comment.