zkCloudWorkerClient
Index
Constructors
constructor
Constructor for the API class
Parameters
params: { chain?: blockchain; jwt: string; webhook?: string; zkcloudworker?: (cloud: Cloud) => Promise<zkCloudWorker> }
the parameters for the API class
Returns zkCloudWorkerClient
Properties
readonlychain
The blockchain network to use
optionalreadonlyendpoint
The endpoint of the serverless api
readonlyjwt
The jwt token for authentication, get it at https://t.me/minanft_bot?start=auth
optionalreadonlylocalWorker
The local worker for the serverless api to test the code locally
Type declaration
Parameters
cloud: Cloud
Returns Promise<zkCloudWorker>
optionalreadonlywebhook
The webhook for the serverless api to get the results
Methods
publicdeploy
Deploys the code to the cloud using serverless api call
Parameters
data: { developer: string; packageManager: string; repo: string }
the data for the deploy call
Returns Promise<{ error?: string; jobId?: string; success: boolean }>
where jobId is the jobId of the job
publicexecute
Starts a new job for the function call using serverless api call
Parameters
data: { args?: string; developer: string; metadata?: string; mode?: string; repo: string; task: string; transactions: string[]; userId?: string }
the data for the proof call
Returns Promise<{ error?: string; jobId?: string; result?: any; success: boolean }>
where jonId is the jobId of the job (for async calls), result is the result of the job (for sync calls)
publicgetBalance
Gets the remaining balance
Returns Promise<{ error?: string; result?: any; success: boolean }>
where result is the balance
publicjobResult
Gets the result of the job using serverless api call
Parameters
data: { includeLogs?: boolean; jobId: string }
the data for the jobResult call
Returns Promise<{ error?: string; result?: any; success: boolean }>
where result is the result of the job if the job is not finished yet, the result will be undefined if the job failed, the result will be undefined and error will be set if the job is finished, the result will be set and error will be undefined if the job is not found, the result will be undefined and error will be set
publicqueryBilling
Gets the billing report for the jobs sent using JWT
Returns Promise<{ error?: string; result?: any; success: boolean }>
where result is the billing report
publicrecursiveProof
Starts a new job for the proof calculation using serverless api call
Parameters
data: { args?: string; developer: string; metadata?: string; repo: string; task?: string; transactions: string[]; userId?: string; webhook?: string }
the data for the proof call
Returns Promise<{ error?: string; jobId?: string; success: boolean }>
where jonId is the jobId of the job
The developers repo should provide a zkcloudworker function that can be called with the given parameters, see the examples
publicsendTransactions
Sends transactions to the blockchain using serverless api call
Parameters
data: { developer: string; repo: string; transactions: string[] }
the data for the proof call
Returns Promise<{ error?: string; success: boolean; txId?: string[] }>
where txId is the transaction id of the transaction, in the sequence of the input transactions
publicwaitForJobResult
Waits for the job to finish
Parameters
data: { interval?: number; jobId: string; maxAttempts?: number; maxErrors?: number; printLogs?: boolean }
the data for the waitForJobResult call
Returns Promise<{ error?: string; result?: any; success: boolean }>
where result is the result of the job
API class for interacting with the zkCloudWorker