zkcloudworker 0.11.5 → 0.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ts/src/cloud/networks.d.ts +11 -17
- package/lib/ts/src/cloud/worker/cloud.d.ts +19 -46
- package/lib/ts/src/cloud/worker/cloud.js +1 -55
- package/lib/ts/src/cloud/worker/index.d.ts +2 -0
- package/lib/ts/src/cloud/worker/index.js +2 -0
- package/lib/ts/src/cloud/worker/job.d.ts +41 -39
- package/lib/ts/src/cloud/worker/task.d.ts +14 -16
- package/lib/ts/src/cloud/worker/transaction.d.ts +11 -0
- package/lib/ts/src/cloud/worker/transaction.js +8 -0
- package/lib/ts/src/cloud/worker/worker.d.ts +40 -0
- package/lib/ts/src/cloud/worker/worker.js +56 -0
- package/lib/ts/src/mina/index.d.ts +1 -1
- package/lib/ts/src/mina/index.js +1 -1
- package/lib/ts/src/mina/local/local.d.ts +26 -16
- package/lib/ts/src/mina/local/local.js +26 -14
- package/lib/ts/src/mina/utils/mina.d.ts +4 -4
- package/lib/ts/src/mina/verification/index.d.ts +1 -0
- package/lib/ts/src/mina/verification/index.js +17 -0
- package/lib/ts/src/mina/verification/verification.d.ts +2 -0
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/cloud/networks.d.ts +11 -17
- package/lib/web/src/cloud/networks.js.map +1 -1
- package/lib/web/src/cloud/worker/cloud.d.ts +19 -46
- package/lib/web/src/cloud/worker/cloud.js +0 -53
- package/lib/web/src/cloud/worker/cloud.js.map +1 -1
- package/lib/web/src/cloud/worker/index.d.ts +2 -0
- package/lib/web/src/cloud/worker/index.js +2 -0
- package/lib/web/src/cloud/worker/index.js.map +1 -1
- package/lib/web/src/cloud/worker/job.d.ts +41 -39
- package/lib/web/src/cloud/worker/task.d.ts +14 -16
- package/lib/web/src/cloud/worker/transaction.d.ts +11 -0
- package/lib/web/src/cloud/worker/transaction.js +8 -0
- package/lib/web/src/cloud/worker/transaction.js.map +1 -0
- package/lib/web/src/cloud/worker/worker.d.ts +40 -0
- package/lib/web/src/cloud/worker/worker.js +53 -0
- package/lib/web/src/cloud/worker/worker.js.map +1 -0
- package/lib/web/src/mina/index.d.ts +1 -1
- package/lib/web/src/mina/index.js +1 -1
- package/lib/web/src/mina/index.js.map +1 -1
- package/lib/web/src/mina/local/local.d.ts +26 -16
- package/lib/web/src/mina/local/local.js +26 -14
- package/lib/web/src/mina/local/local.js.map +1 -1
- package/lib/web/src/mina/utils/mina.d.ts +4 -4
- package/lib/web/src/mina/utils/mina.js.map +1 -1
- package/lib/web/src/mina/verification/index.d.ts +1 -0
- package/lib/web/src/mina/verification/index.js +2 -0
- package/lib/web/src/mina/verification/index.js.map +1 -0
- package/lib/web/src/mina/verification/verification.d.ts +2 -0
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1,33 +1,27 @@
|
|
1
1
|
export { blockchain, MinaNetwork, networks, Mainnet, Devnet, Zeko, Lightnet, Local, };
|
2
2
|
/**
|
3
|
-
* blockchain is the type for the chain
|
4
|
-
* @param local the local chain id
|
5
|
-
* @param devnet the devnet chain id
|
6
|
-
* @param lightnet the lightnet chain id
|
7
|
-
* @param mainnet the mainnet chain id
|
8
|
-
* @param zeko the zeko chain id
|
9
|
-
* @param mainnet the mainnet chain id
|
3
|
+
* blockchain is the type for the chain ID.
|
10
4
|
*/
|
11
|
-
type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko"
|
5
|
+
type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko";
|
12
6
|
/**
|
13
|
-
* MinaNetwork is the data structure for a Mina network, keeping track of the
|
14
|
-
* @param mina the mina endpoints
|
15
|
-
* @param archive the archive endpoints
|
16
|
-
* @param chainId the chain id
|
17
|
-
* @param name the name of the network
|
18
|
-
* @param accountManager the account manager for Lightnet
|
19
|
-
* @param explorerAccountUrl the explorer account url
|
20
|
-
* @param explorerTransactionUrl the explorer transaction url
|
21
|
-
* @param faucet the faucet url
|
7
|
+
* MinaNetwork is the data structure for a Mina network, keeping track of the Mina and archive endpoints, chain ID, name, account manager, explorer account URL, explorer transaction URL, and faucet.
|
22
8
|
*/
|
23
9
|
interface MinaNetwork {
|
10
|
+
/** The Mina endpoints */
|
24
11
|
mina: string[];
|
12
|
+
/** The archive endpoints */
|
25
13
|
archive: string[];
|
14
|
+
/** The chain ID */
|
26
15
|
chainId: blockchain;
|
16
|
+
/** The name of the network (optional) */
|
27
17
|
name?: string;
|
18
|
+
/** The account manager for Lightnet (optional) */
|
28
19
|
accountManager?: string;
|
20
|
+
/** The explorer account URL (optional) */
|
29
21
|
explorerAccountUrl?: string;
|
22
|
+
/** The explorer transaction URL (optional) */
|
30
23
|
explorerTransactionUrl?: string;
|
24
|
+
/** The faucet URL (optional) */
|
31
25
|
faucet?: string;
|
32
26
|
}
|
33
27
|
declare const Mainnet: MinaNetwork;
|
@@ -1,28 +1,30 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { blockchain } from "../networks";
|
3
3
|
import { JobData } from "./job";
|
4
|
+
import { TransactionMetadata } from "./transaction";
|
4
5
|
/**
|
5
6
|
* Interface for the deployer key pair
|
6
|
-
* Used to get the public and private keys of the deployer for test networks only
|
7
|
-
* Devnet and Zeko are supported
|
8
|
-
* @param publicKey: the public key of the deployer
|
9
|
-
* @param privateKey: the private key of the deployer
|
7
|
+
* Used to get the public and private keys of the deployer for test networks only.
|
8
|
+
* Devnet and Zeko are supported.
|
10
9
|
*/
|
11
10
|
export interface DeployerKeyPair {
|
11
|
+
/** The public key of the deployer */
|
12
12
|
publicKey: string;
|
13
|
+
/** The private key of the deployer */
|
13
14
|
privateKey: string;
|
14
15
|
}
|
15
16
|
/**
|
16
17
|
* Interface for the cloud transaction
|
17
18
|
* Used to get the transaction id, the transaction, and the time received
|
18
|
-
* @param txId: the transaction id
|
19
|
-
* @param transaction: the transaction
|
20
|
-
* @param timeReceived: the time received
|
21
19
|
*/
|
22
20
|
export interface CloudTransaction {
|
21
|
+
/** The transaction id */
|
23
22
|
txId: string;
|
23
|
+
/** The transaction */
|
24
24
|
transaction: string;
|
25
|
+
/** The time received */
|
25
26
|
timeReceived: number;
|
27
|
+
/** The status of the transaction */
|
26
28
|
status: string;
|
27
29
|
}
|
28
30
|
export declare abstract class Cloud {
|
@@ -190,6 +192,16 @@ export declare abstract class Cloud {
|
|
190
192
|
* @returns the transactions
|
191
193
|
*/
|
192
194
|
abstract getTransactions(): Promise<CloudTransaction[]>;
|
195
|
+
/**
|
196
|
+
* Publish the transaction metadata in human-readable format
|
197
|
+
* @param params
|
198
|
+
* @param params.txId the transaction id
|
199
|
+
* @param params.metadata the metadata
|
200
|
+
*/
|
201
|
+
abstract publishTransactionMetadata(params: {
|
202
|
+
txId: string;
|
203
|
+
metadata: TransactionMetadata;
|
204
|
+
}): Promise<void>;
|
193
205
|
/**
|
194
206
|
* Abstract method to delete the task
|
195
207
|
* Used to delete the task
|
@@ -213,42 +225,3 @@ export declare abstract class Cloud {
|
|
213
225
|
*/
|
214
226
|
abstract forceWorkerRestart(): Promise<void>;
|
215
227
|
}
|
216
|
-
/**
|
217
|
-
* Abstract class for the zkCloudWorker
|
218
|
-
* Used to define the zkCloudWorker methods and properties
|
219
|
-
* Should be implemented for by the developer for the zkCloudWorker in the cloud
|
220
|
-
* @param cloud: the cloud
|
221
|
-
*/
|
222
|
-
export declare abstract class zkCloudWorker {
|
223
|
-
readonly cloud: Cloud;
|
224
|
-
/**
|
225
|
-
* Constructor for the zkCloudWorker class
|
226
|
-
* @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
|
227
|
-
*/
|
228
|
-
constructor(cloud: Cloud);
|
229
|
-
/**
|
230
|
-
* Creates a new proof from a transaction
|
231
|
-
* @param transaction the transaction
|
232
|
-
* @returns the serialized proof
|
233
|
-
*/
|
234
|
-
create(transaction: string): Promise<string | undefined>;
|
235
|
-
/**
|
236
|
-
* Merges two proofs
|
237
|
-
* @param proof1 the first proof
|
238
|
-
* @param proof2 the second proof
|
239
|
-
* @returns the merged proof
|
240
|
-
*/
|
241
|
-
merge(proof1: string, proof2: string): Promise<string | undefined>;
|
242
|
-
/**
|
243
|
-
* Executes the transactions
|
244
|
-
* @param transactions the transactions, can be empty list
|
245
|
-
* @returns the result
|
246
|
-
*/
|
247
|
-
execute(transactions: string[]): Promise<string | undefined>;
|
248
|
-
processTransactions(transactions: CloudTransaction[]): Promise<void>;
|
249
|
-
/**
|
250
|
-
* process the task defined by the developer
|
251
|
-
* @returns the result
|
252
|
-
*/
|
253
|
-
task(): Promise<string | undefined>;
|
254
|
-
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.Cloud = void 0;
|
4
4
|
/*
|
5
5
|
* Abstract class for the cloud service
|
6
6
|
* Used to define the cloud methods and properties
|
@@ -55,57 +55,3 @@ class Cloud {
|
|
55
55
|
}
|
56
56
|
}
|
57
57
|
exports.Cloud = Cloud;
|
58
|
-
/**
|
59
|
-
* Abstract class for the zkCloudWorker
|
60
|
-
* Used to define the zkCloudWorker methods and properties
|
61
|
-
* Should be implemented for by the developer for the zkCloudWorker in the cloud
|
62
|
-
* @param cloud: the cloud
|
63
|
-
*/
|
64
|
-
class zkCloudWorker {
|
65
|
-
/**
|
66
|
-
* Constructor for the zkCloudWorker class
|
67
|
-
* @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
|
68
|
-
*/
|
69
|
-
constructor(cloud) {
|
70
|
-
this.cloud = cloud;
|
71
|
-
}
|
72
|
-
// Those methods should be implemented for recursive proofs calculations
|
73
|
-
/**
|
74
|
-
* Creates a new proof from a transaction
|
75
|
-
* @param transaction the transaction
|
76
|
-
* @returns the serialized proof
|
77
|
-
*/
|
78
|
-
async create(transaction) {
|
79
|
-
return undefined;
|
80
|
-
}
|
81
|
-
/**
|
82
|
-
* Merges two proofs
|
83
|
-
* @param proof1 the first proof
|
84
|
-
* @param proof2 the second proof
|
85
|
-
* @returns the merged proof
|
86
|
-
*/
|
87
|
-
async merge(proof1, proof2) {
|
88
|
-
return undefined;
|
89
|
-
}
|
90
|
-
// Those methods should be implemented for anything except for recursive proofs
|
91
|
-
/**
|
92
|
-
* Executes the transactions
|
93
|
-
* @param transactions the transactions, can be empty list
|
94
|
-
* @returns the result
|
95
|
-
*/
|
96
|
-
async execute(transactions) {
|
97
|
-
return undefined;
|
98
|
-
}
|
99
|
-
/* Process the transactions received by the cloud
|
100
|
-
* @param transactions: the transactions
|
101
|
-
*/
|
102
|
-
async processTransactions(transactions) { }
|
103
|
-
/**
|
104
|
-
* process the task defined by the developer
|
105
|
-
* @returns the result
|
106
|
-
*/
|
107
|
-
async task() {
|
108
|
-
return undefined;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
exports.zkCloudWorker = zkCloudWorker;
|
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./cloud"), exports);
|
18
18
|
__exportStar(require("./job"), exports);
|
19
19
|
__exportStar(require("./task"), exports);
|
20
|
+
__exportStar(require("./transaction"), exports);
|
21
|
+
__exportStar(require("./worker"), exports);
|
@@ -1,85 +1,87 @@
|
|
1
1
|
import { blockchain } from "../networks";
|
2
2
|
export type JobStatus = "created" | "started" | "finished" | "failed" | "used" | "restarted";
|
3
3
|
/**
|
4
|
-
* LogStream is a subset of the log stream data returned by AWS CloudWatch Logs when running the worker
|
5
|
-
* https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/GetLogEventsCommand/
|
6
|
-
*
|
4
|
+
* LogStream is a subset of the log stream data returned by AWS CloudWatch Logs when running the worker.
|
5
|
+
* @see {@link https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/GetLogEventsCommand/}
|
6
|
+
*
|
7
|
+
* Example:
|
8
|
+
* ```
|
7
9
|
* {
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
10
|
+
* logGroupName: '/aws/lambda/zkcloudworker-dev-test',
|
11
|
+
* logStreamName: '2024/05/09/[$LATEST]52d048f64e894d2e8ba2800df93629c5',
|
12
|
+
* awsRequestId: '581d0d45-9165-47e8-84d9-678599938811'
|
11
13
|
* }
|
12
|
-
*
|
13
|
-
* @param logStreamName the log stream name
|
14
|
-
* @param awsRequestId the AWS request ID
|
14
|
+
* ```
|
15
15
|
*/
|
16
16
|
export interface LogStream {
|
17
|
+
/** The log group name */
|
17
18
|
logGroupName: string;
|
19
|
+
/** The log stream name */
|
18
20
|
logStreamName: string;
|
21
|
+
/** The AWS request ID */
|
19
22
|
awsRequestId: string;
|
20
23
|
}
|
21
24
|
/**
|
22
|
-
* JobData is the data structure for a job, keeping track of the job status, result, logs, and metadata
|
23
|
-
* @param id the id of the user
|
24
|
-
* @param jobId the id of the job
|
25
|
-
* @param taskId the id of the task
|
26
|
-
*
|
27
|
-
* @param developer the developer of the repo executing the job
|
28
|
-
* @param repo the repo executing the job
|
29
|
-
*
|
30
|
-
* @param task the task to execute
|
31
|
-
* @param userId the id of the user
|
32
|
-
* @param args the arguments for the job
|
33
|
-
* @param metadata the metadata for the job
|
34
|
-
* @param chain the blockchain to execute the job on
|
35
|
-
* @param filename the filename where transactions data is stored
|
36
|
-
* @param txNumber the number of transactions
|
37
|
-
* @param timeCreated the time the job was created
|
38
|
-
* @param timeStarted the time the job was started
|
39
|
-
* @param timeFinished the time the job was finished
|
40
|
-
* @param timeFailed the time the job failed
|
41
|
-
* @param timeUsed the time the job result was used
|
42
|
-
* @param jobStatus the status of the job
|
43
|
-
* @param billedDuration the duration the job was billed for in ms
|
44
|
-
* @param logStreams the log streams of the job
|
45
|
-
* @param logs the logs of the job
|
46
|
-
* @param isFullLog whether the logs are full
|
25
|
+
* JobData is the data structure for a job, keeping track of the job status, result, logs, and metadata.
|
47
26
|
*/
|
48
27
|
export interface JobData {
|
28
|
+
/** The ID of the user */
|
49
29
|
id: string;
|
30
|
+
/** The ID of the job */
|
50
31
|
jobId: string;
|
32
|
+
/** The ID of the task (optional) */
|
51
33
|
taskId?: string;
|
34
|
+
/** The developer of the repo executing the job */
|
52
35
|
developer: string;
|
36
|
+
/** The repo executing the job */
|
53
37
|
repo: string;
|
38
|
+
/** The task to execute (optional) */
|
54
39
|
task?: string;
|
40
|
+
/** The ID of the user (optional) */
|
55
41
|
userId?: string;
|
42
|
+
/** The arguments for the job (optional) */
|
56
43
|
args?: string;
|
44
|
+
/** The metadata for the job (optional) */
|
57
45
|
metadata?: string;
|
46
|
+
/** The blockchain to execute the job on */
|
58
47
|
chain: blockchain;
|
48
|
+
/** The filename where transactions data is stored (optional) */
|
59
49
|
filename?: string;
|
50
|
+
/** The number of transactions */
|
60
51
|
txNumber: number;
|
52
|
+
/** The time the job was created */
|
61
53
|
timeCreated: number;
|
54
|
+
/** The time the job was started (optional) */
|
62
55
|
timeStarted?: number;
|
56
|
+
/** The time the job was finished (optional) */
|
63
57
|
timeFinished?: number;
|
58
|
+
/** The time the job failed (optional) */
|
64
59
|
timeFailed?: number;
|
60
|
+
/** The time the job result was used (optional) */
|
65
61
|
timeUsed?: number;
|
62
|
+
/** The status of the job */
|
66
63
|
jobStatus: JobStatus;
|
64
|
+
/** The duration the job was billed for in ms (optional) */
|
67
65
|
billedDuration?: number;
|
66
|
+
/** The result of the job (optional) */
|
68
67
|
result?: string;
|
68
|
+
/** The log streams of the job (optional) */
|
69
69
|
logStreams?: LogStream[];
|
70
|
+
/** The logs of the job (optional) */
|
70
71
|
logs?: string[];
|
72
|
+
/** Whether the logs are full (optional) */
|
71
73
|
isFullLog?: boolean;
|
72
74
|
}
|
73
75
|
/**
|
74
|
-
*
|
75
|
-
* @param jobId the id of the job
|
76
|
-
* @param eventTime the time the event occurred
|
77
|
-
* @param jobStatus the status of the job
|
78
|
-
* @param result the result of the job
|
76
|
+
* JobEvent is the data structure for a job events, keeping track of the job status changes.
|
79
77
|
*/
|
80
78
|
export interface JobEvent {
|
79
|
+
/** The ID of the job */
|
81
80
|
jobId: string;
|
81
|
+
/** The time the event occurred */
|
82
82
|
eventTime: number;
|
83
|
+
/** The status of the job */
|
83
84
|
jobStatus: JobStatus;
|
85
|
+
/** The result of the job (optional) */
|
84
86
|
result?: string;
|
85
87
|
}
|
@@ -1,34 +1,32 @@
|
|
1
1
|
import { blockchain } from "../networks";
|
2
2
|
/**
|
3
|
-
* TaskData is the data structure for a task, keeping track of the task status, result, logs, and metadata
|
4
|
-
* @param id the id of the user
|
5
|
-
* @param taskId the id of the task
|
6
|
-
*
|
7
|
-
* @param startTime the time the task was started
|
8
|
-
* @param timeCreated the time the task was created
|
9
|
-
* @param maxAttempts the maximum number of attempts
|
10
|
-
* @param attempts the number of attempts
|
11
|
-
*
|
12
|
-
* @param developer the developer of the repo executing the task
|
13
|
-
* @param repo the repo executing the task
|
14
|
-
* @param task the task to execute
|
15
|
-
* @param userId the id of the user
|
16
|
-
* @param args the arguments for the task
|
17
|
-
* @param metadata the metadata for the task
|
18
|
-
* @param chain the blockchain to execute the task on
|
3
|
+
* TaskData is the data structure for a task, keeping track of the task status, result, logs, and metadata.
|
19
4
|
*/
|
20
5
|
export interface TaskData {
|
6
|
+
/** The ID of the user */
|
21
7
|
id: string;
|
8
|
+
/** The ID of the task */
|
22
9
|
taskId: string;
|
10
|
+
/** The time the task was started (optional) */
|
23
11
|
startTime?: number;
|
12
|
+
/** The time the task was created */
|
24
13
|
timeCreated: number;
|
14
|
+
/** The maximum number of attempts (default is 5) (optional) */
|
25
15
|
maxAttempts?: number;
|
16
|
+
/** The number of attempts */
|
26
17
|
attempts: number;
|
18
|
+
/** The developer of the repo executing the task */
|
27
19
|
developer: string;
|
20
|
+
/** The repo executing the task */
|
28
21
|
repo: string;
|
22
|
+
/** The task to execute */
|
29
23
|
task: string;
|
24
|
+
/** The ID of the user (optional) */
|
30
25
|
userId?: string;
|
26
|
+
/** The arguments for the task (optional) */
|
31
27
|
args?: string;
|
28
|
+
/** The metadata for the task (optional) */
|
32
29
|
metadata?: string;
|
30
|
+
/** The blockchain to execute the task on */
|
33
31
|
chain: blockchain;
|
34
32
|
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Human-readable transaction metadata
|
3
|
+
* events: the events
|
4
|
+
* actions: the actions
|
5
|
+
* custom: the custom metadata defined by the developer
|
6
|
+
*/
|
7
|
+
export interface TransactionMetadata {
|
8
|
+
events: object[];
|
9
|
+
actions: object[];
|
10
|
+
custom: object;
|
11
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { Cloud, CloudTransaction } from "./cloud";
|
2
|
+
/**
|
3
|
+
* Abstract class for the zkCloudWorker
|
4
|
+
* Used to define the zkCloudWorker methods and properties
|
5
|
+
* Should be implemented for by the developer for the zkCloudWorker in the cloud
|
6
|
+
*/
|
7
|
+
export declare abstract class zkCloudWorker {
|
8
|
+
/** cloud: the cloud instance */
|
9
|
+
readonly cloud: Cloud;
|
10
|
+
/**
|
11
|
+
* Constructor for the zkCloudWorker class
|
12
|
+
* @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
|
13
|
+
*/
|
14
|
+
constructor(cloud: Cloud);
|
15
|
+
/**
|
16
|
+
* Creates a new proof from a transaction
|
17
|
+
* @param transaction the transaction
|
18
|
+
* @returns the serialized proof
|
19
|
+
*/
|
20
|
+
create(transaction: string): Promise<string | undefined>;
|
21
|
+
/**
|
22
|
+
* Merges two proofs
|
23
|
+
* @param proof1 the first proof
|
24
|
+
* @param proof2 the second proof
|
25
|
+
* @returns the merged proof
|
26
|
+
*/
|
27
|
+
merge(proof1: string, proof2: string): Promise<string | undefined>;
|
28
|
+
/**
|
29
|
+
* Executes the transactions
|
30
|
+
* @param transactions the transactions, can be empty list
|
31
|
+
* @returns the result
|
32
|
+
*/
|
33
|
+
execute(transactions: string[]): Promise<string | undefined>;
|
34
|
+
processTransactions(transactions: CloudTransaction[]): Promise<void>;
|
35
|
+
/**
|
36
|
+
* process the task defined by the developer
|
37
|
+
* @returns the result
|
38
|
+
*/
|
39
|
+
task(): Promise<string | undefined>;
|
40
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.zkCloudWorker = void 0;
|
4
|
+
/**
|
5
|
+
* Abstract class for the zkCloudWorker
|
6
|
+
* Used to define the zkCloudWorker methods and properties
|
7
|
+
* Should be implemented for by the developer for the zkCloudWorker in the cloud
|
8
|
+
*/
|
9
|
+
class zkCloudWorker {
|
10
|
+
/**
|
11
|
+
* Constructor for the zkCloudWorker class
|
12
|
+
* @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
|
13
|
+
*/
|
14
|
+
constructor(cloud) {
|
15
|
+
this.cloud = cloud;
|
16
|
+
}
|
17
|
+
// Those methods should be implemented for recursive proofs calculations
|
18
|
+
/**
|
19
|
+
* Creates a new proof from a transaction
|
20
|
+
* @param transaction the transaction
|
21
|
+
* @returns the serialized proof
|
22
|
+
*/
|
23
|
+
async create(transaction) {
|
24
|
+
return undefined;
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* Merges two proofs
|
28
|
+
* @param proof1 the first proof
|
29
|
+
* @param proof2 the second proof
|
30
|
+
* @returns the merged proof
|
31
|
+
*/
|
32
|
+
async merge(proof1, proof2) {
|
33
|
+
return undefined;
|
34
|
+
}
|
35
|
+
// Those methods should be implemented for anything except for recursive proofs
|
36
|
+
/**
|
37
|
+
* Executes the transactions
|
38
|
+
* @param transactions the transactions, can be empty list
|
39
|
+
* @returns the result
|
40
|
+
*/
|
41
|
+
async execute(transactions) {
|
42
|
+
return undefined;
|
43
|
+
}
|
44
|
+
/* Process the transactions received by the cloud
|
45
|
+
* @param transactions: the transactions
|
46
|
+
*/
|
47
|
+
async processTransactions(transactions) { }
|
48
|
+
/**
|
49
|
+
* process the task defined by the developer
|
50
|
+
* @returns the result
|
51
|
+
*/
|
52
|
+
async task() {
|
53
|
+
return undefined;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
exports.zkCloudWorker = zkCloudWorker;
|
package/lib/ts/src/mina/index.js
CHANGED
@@ -18,4 +18,4 @@ __exportStar(require("./api/api"), exports);
|
|
18
18
|
__exportStar(require("./encryption"), exports);
|
19
19
|
__exportStar(require("./utils"), exports);
|
20
20
|
__exportStar(require("./local/local"), exports);
|
21
|
-
__exportStar(require("./verification
|
21
|
+
__exportStar(require("./verification"), exports);
|
@@ -1,9 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import { Cloud, zkCloudWorker } from "../../cloud";
|
3
|
-
import { JobData, JobEvent } from "../../cloud";
|
4
|
-
import { TaskData } from "../../cloud";
|
5
|
-
import { blockchain } from "../../cloud";
|
6
|
-
import { CloudTransaction, DeployerKeyPair } from "../../cloud";
|
2
|
+
import { blockchain, TransactionMetadata, CloudTransaction, DeployerKeyPair, TaskData, JobData, JobEvent, Cloud, zkCloudWorker } from "../../cloud";
|
7
3
|
import { ApiCommand } from "../api/api";
|
8
4
|
/**
|
9
5
|
* LocalCloud is a cloud that runs on the local machine for testing and development
|
@@ -89,6 +85,16 @@ export declare class LocalCloud extends Cloud {
|
|
89
85
|
*/
|
90
86
|
deleteTransaction(txId: string): Promise<void>;
|
91
87
|
getTransactions(): Promise<CloudTransaction[]>;
|
88
|
+
/**
|
89
|
+
* Publish the transaction metadata in human-readable format
|
90
|
+
* @param params
|
91
|
+
* @param params.txId the transaction id
|
92
|
+
* @param params.metadata the metadata
|
93
|
+
*/
|
94
|
+
publishTransactionMetadata(params: {
|
95
|
+
txId: string;
|
96
|
+
metadata: TransactionMetadata;
|
97
|
+
}): Promise<void>;
|
92
98
|
/**
|
93
99
|
* Runs the worker in the local cloud
|
94
100
|
* @param params the parameters to run the worker
|
@@ -217,41 +223,45 @@ export declare class LocalCloud extends Cloud {
|
|
217
223
|
forceWorkerRestart(): Promise<void>;
|
218
224
|
}
|
219
225
|
/**
|
220
|
-
* LocalStorage is a local storage for the local cloud
|
221
|
-
* It stores jobs, tasks, transactions, and data
|
222
|
-
* It can be used to test the cloud functionality without deploying to the cloud
|
223
|
-
* @param jobs the jobs
|
224
|
-
* @param data the data
|
225
|
-
* @param transactions the transactions
|
226
|
-
* @param tasks the tasks
|
226
|
+
* LocalStorage is a local storage for the local cloud.
|
227
|
+
* It stores jobs, tasks, transactions, and data.
|
228
|
+
* It can be used to test the cloud functionality without deploying to the cloud.
|
227
229
|
*/
|
228
230
|
export declare class LocalStorage {
|
231
|
+
/** The jobs */
|
229
232
|
static jobs: {
|
230
233
|
[key: string]: JobData;
|
231
234
|
};
|
235
|
+
/** The job events */
|
232
236
|
static jobEvents: {
|
233
237
|
[key: string]: JobEvent;
|
234
238
|
};
|
239
|
+
/** The data */
|
235
240
|
static data: {
|
236
241
|
[key: string]: string;
|
237
242
|
};
|
243
|
+
/** The files */
|
238
244
|
static files: {
|
239
245
|
[key: string]: Buffer;
|
240
246
|
};
|
247
|
+
/** The transactions */
|
241
248
|
static transactions: {
|
242
249
|
[key: string]: CloudTransaction;
|
243
250
|
};
|
251
|
+
/** The tasks */
|
244
252
|
static tasks: {
|
245
253
|
[key: string]: TaskData;
|
246
254
|
};
|
247
255
|
/**
|
248
|
-
* Saves the data
|
249
|
-
* @param name
|
256
|
+
* Saves the data.
|
257
|
+
* @param name The name to save the data under.
|
258
|
+
* @throws Error Method not implemented to keep web compatibility.
|
250
259
|
*/
|
251
260
|
static saveData(name: string): Promise<void>;
|
252
261
|
/**
|
253
|
-
* Loads the data
|
254
|
-
* @param name
|
262
|
+
* Loads the data.
|
263
|
+
* @param name The name to load the data from.
|
264
|
+
* @throws Error Method not implemented to keep web compatibility.
|
255
265
|
*/
|
256
266
|
static loadData(name: string): Promise<void>;
|
257
267
|
}
|