zkcloudworker 0.11.5 → 0.11.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/lib/ts/src/cloud/networks.d.ts +11 -17
  2. package/lib/ts/src/cloud/worker/cloud.d.ts +19 -46
  3. package/lib/ts/src/cloud/worker/cloud.js +1 -55
  4. package/lib/ts/src/cloud/worker/index.d.ts +2 -0
  5. package/lib/ts/src/cloud/worker/index.js +2 -0
  6. package/lib/ts/src/cloud/worker/job.d.ts +41 -39
  7. package/lib/ts/src/cloud/worker/task.d.ts +14 -16
  8. package/lib/ts/src/cloud/worker/transaction.d.ts +11 -0
  9. package/lib/ts/src/cloud/worker/transaction.js +8 -0
  10. package/lib/ts/src/cloud/worker/worker.d.ts +40 -0
  11. package/lib/ts/src/cloud/worker/worker.js +56 -0
  12. package/lib/ts/src/mina/index.d.ts +1 -1
  13. package/lib/ts/src/mina/index.js +1 -1
  14. package/lib/ts/src/mina/local/local.d.ts +26 -16
  15. package/lib/ts/src/mina/local/local.js +26 -14
  16. package/lib/ts/src/mina/utils/mina.d.ts +4 -4
  17. package/lib/ts/src/mina/verification/index.d.ts +1 -0
  18. package/lib/ts/src/mina/verification/index.js +17 -0
  19. package/lib/ts/src/mina/verification/verification.d.ts +2 -0
  20. package/lib/ts/tsconfig.tsbuildinfo +1 -1
  21. package/lib/web/src/cloud/networks.d.ts +11 -17
  22. package/lib/web/src/cloud/networks.js.map +1 -1
  23. package/lib/web/src/cloud/worker/cloud.d.ts +19 -46
  24. package/lib/web/src/cloud/worker/cloud.js +0 -53
  25. package/lib/web/src/cloud/worker/cloud.js.map +1 -1
  26. package/lib/web/src/cloud/worker/index.d.ts +2 -0
  27. package/lib/web/src/cloud/worker/index.js +2 -0
  28. package/lib/web/src/cloud/worker/index.js.map +1 -1
  29. package/lib/web/src/cloud/worker/job.d.ts +41 -39
  30. package/lib/web/src/cloud/worker/task.d.ts +14 -16
  31. package/lib/web/src/cloud/worker/transaction.d.ts +11 -0
  32. package/lib/web/src/cloud/worker/transaction.js +8 -0
  33. package/lib/web/src/cloud/worker/transaction.js.map +1 -0
  34. package/lib/web/src/cloud/worker/worker.d.ts +40 -0
  35. package/lib/web/src/cloud/worker/worker.js +53 -0
  36. package/lib/web/src/cloud/worker/worker.js.map +1 -0
  37. package/lib/web/src/mina/index.d.ts +1 -1
  38. package/lib/web/src/mina/index.js +1 -1
  39. package/lib/web/src/mina/index.js.map +1 -1
  40. package/lib/web/src/mina/local/local.d.ts +26 -16
  41. package/lib/web/src/mina/local/local.js +26 -14
  42. package/lib/web/src/mina/local/local.js.map +1 -1
  43. package/lib/web/src/mina/utils/mina.d.ts +4 -4
  44. package/lib/web/src/mina/utils/mina.js.map +1 -1
  45. package/lib/web/src/mina/verification/index.d.ts +1 -0
  46. package/lib/web/src/mina/verification/index.js +2 -0
  47. package/lib/web/src/mina/verification/index.js.map +1 -0
  48. package/lib/web/src/mina/verification/verification.d.ts +2 -0
  49. package/lib/web/tsconfig.web.tsbuildinfo +1 -1
  50. package/package.json +1 -1
@@ -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
- }
@@ -51,57 +51,4 @@ export class Cloud {
51
51
  this.chain = chain;
52
52
  }
53
53
  }
54
- /**
55
- * Abstract class for the zkCloudWorker
56
- * Used to define the zkCloudWorker methods and properties
57
- * Should be implemented for by the developer for the zkCloudWorker in the cloud
58
- * @param cloud: the cloud
59
- */
60
- export class zkCloudWorker {
61
- /**
62
- * Constructor for the zkCloudWorker class
63
- * @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
64
- */
65
- constructor(cloud) {
66
- this.cloud = cloud;
67
- }
68
- // Those methods should be implemented for recursive proofs calculations
69
- /**
70
- * Creates a new proof from a transaction
71
- * @param transaction the transaction
72
- * @returns the serialized proof
73
- */
74
- async create(transaction) {
75
- return undefined;
76
- }
77
- /**
78
- * Merges two proofs
79
- * @param proof1 the first proof
80
- * @param proof2 the second proof
81
- * @returns the merged proof
82
- */
83
- async merge(proof1, proof2) {
84
- return undefined;
85
- }
86
- // Those methods should be implemented for anything except for recursive proofs
87
- /**
88
- * Executes the transactions
89
- * @param transactions the transactions, can be empty list
90
- * @returns the result
91
- */
92
- async execute(transactions) {
93
- return undefined;
94
- }
95
- /* Process the transactions received by the cloud
96
- * @param transactions: the transactions
97
- */
98
- async processTransactions(transactions) { }
99
- /**
100
- * process the task defined by the developer
101
- * @returns the result
102
- */
103
- async task() {
104
- return undefined;
105
- }
106
- }
107
54
  //# sourceMappingURL=cloud.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloud.js","sourceRoot":"","sources":["../../../../../../src/cloud/worker/cloud.ts"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAgB,KAAK;IAezB;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,MAcX;QACC,MAAM,EACJ,EAAE,EACF,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,KAAK,GACN,GAAG,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,KAAK,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CAgKF;AAED;;;;;GAKG;AACH,MAAM,OAAgB,aAAa;IAGjC;;;OAGG;IACH,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,wEAAwE;IACxE;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,MAAc;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,+EAA+E;IAC/E;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,YAAsB;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,YAAgC,IAAkB,CAAC;IAE7E;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
1
+ {"version":3,"file":"cloud.js","sourceRoot":"","sources":["../../../../../../src/cloud/worker/cloud.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAgB,KAAK;IAezB;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,MAcX;QACC,MAAM,EACJ,EAAE,EACF,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,KAAK,GACN,GAAG,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,KAAK,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CA2KF"}
@@ -1,3 +1,5 @@
1
1
  export * from "./cloud";
2
2
  export * from "./job";
3
3
  export * from "./task";
4
+ export * from "./transaction";
5
+ export * from "./worker";
@@ -1,4 +1,6 @@
1
1
  export * from "./cloud";
2
2
  export * from "./job";
3
3
  export * from "./task";
4
+ export * from "./transaction";
5
+ export * from "./worker";
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/cloud/worker/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/cloud/worker/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
@@ -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
- * example:
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
- * logGroupName: '/aws/lambda/zkcloudworker-dev-test',
9
- * logStreamName: '2024/05/09/[$LATEST]52d048f64e894d2e8ba2800df93629c5'
10
- * awsRequestId: '581d0d45-9165-47e8-84d9-678599938811',
10
+ * logGroupName: '/aws/lambda/zkcloudworker-dev-test',
11
+ * logStreamName: '2024/05/09/[$LATEST]52d048f64e894d2e8ba2800df93629c5',
12
+ * awsRequestId: '581d0d45-9165-47e8-84d9-678599938811'
11
13
  * }
12
- * @param logGroupName the log group name
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
- * JobData is the data structure for a job, keeping track of the job status, result, logs, and metadata
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,8 @@
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 {};
8
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../../../../src/cloud/worker/transaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -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,53 @@
1
+ /**
2
+ * Abstract class for the zkCloudWorker
3
+ * Used to define the zkCloudWorker methods and properties
4
+ * Should be implemented for by the developer for the zkCloudWorker in the cloud
5
+ */
6
+ export class zkCloudWorker {
7
+ /**
8
+ * Constructor for the zkCloudWorker class
9
+ * @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
10
+ */
11
+ constructor(cloud) {
12
+ this.cloud = cloud;
13
+ }
14
+ // Those methods should be implemented for recursive proofs calculations
15
+ /**
16
+ * Creates a new proof from a transaction
17
+ * @param transaction the transaction
18
+ * @returns the serialized proof
19
+ */
20
+ async create(transaction) {
21
+ return undefined;
22
+ }
23
+ /**
24
+ * Merges two proofs
25
+ * @param proof1 the first proof
26
+ * @param proof2 the second proof
27
+ * @returns the merged proof
28
+ */
29
+ async merge(proof1, proof2) {
30
+ return undefined;
31
+ }
32
+ // Those methods should be implemented for anything except for recursive proofs
33
+ /**
34
+ * Executes the transactions
35
+ * @param transactions the transactions, can be empty list
36
+ * @returns the result
37
+ */
38
+ async execute(transactions) {
39
+ return undefined;
40
+ }
41
+ /* Process the transactions received by the cloud
42
+ * @param transactions: the transactions
43
+ */
44
+ async processTransactions(transactions) { }
45
+ /**
46
+ * process the task defined by the developer
47
+ * @returns the result
48
+ */
49
+ async task() {
50
+ return undefined;
51
+ }
52
+ }
53
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../../../../src/cloud/worker/worker.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAgB,aAAa;IAIjC;;;OAGG;IACH,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,wEAAwE;IACxE;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,MAAc;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,+EAA+E;IAC/E;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,YAAsB;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,YAAgC,IAAkB,CAAC;IAE7E;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
@@ -2,4 +2,4 @@ export * from "./api/api";
2
2
  export * from "./encryption";
3
3
  export * from "./utils";
4
4
  export * from "./local/local";
5
- export * from "./verification/verification";
5
+ export * from "./verification";
@@ -2,5 +2,5 @@ export * from "./api/api";
2
2
  export * from "./encryption";
3
3
  export * from "./utils";
4
4
  export * from "./local/local";
5
- export * from "./verification/verification";
5
+ export * from "./verification";
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/mina/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/mina/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -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 the name to save the data
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 the name to load the data
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
  }
@@ -1,5 +1,4 @@
1
- import { Cloud } from "../../cloud";
2
- import { makeString } from "../../cloud";
1
+ import { makeString, Cloud, } from "../../cloud";
3
2
  /**
4
3
  * LocalCloud is a cloud that runs on the local machine for testing and development
5
4
  * It uses LocalStorage to store jobs, tasks, transactions, and data
@@ -164,6 +163,15 @@ export class LocalCloud extends Cloud {
164
163
  });
165
164
  return txs;
166
165
  }
166
+ /**
167
+ * Publish the transaction metadata in human-readable format
168
+ * @param params
169
+ * @param params.txId the transaction id
170
+ * @param params.metadata the metadata
171
+ */
172
+ async publishTransactionMetadata(params) {
173
+ console.log("publishTransactionMetadata:", params);
174
+ }
167
175
  /**
168
176
  * Runs the worker in the local cloud
169
177
  * @param params the parameters to run the worker
@@ -434,18 +442,15 @@ export class LocalCloud extends Cloud {
434
442
  }
435
443
  }
436
444
  /**
437
- * LocalStorage is a local storage for the local cloud
438
- * It stores jobs, tasks, transactions, and data
439
- * It can be used to test the cloud functionality without deploying to the cloud
440
- * @param jobs the jobs
441
- * @param data the data
442
- * @param transactions the transactions
443
- * @param tasks the tasks
445
+ * LocalStorage is a local storage for the local cloud.
446
+ * It stores jobs, tasks, transactions, and data.
447
+ * It can be used to test the cloud functionality without deploying to the cloud.
444
448
  */
445
449
  export class LocalStorage {
446
450
  /**
447
- * Saves the data
448
- * @param name the name to save the data
451
+ * Saves the data.
452
+ * @param name The name to save the data under.
453
+ * @throws Error Method not implemented to keep web compatibility.
449
454
  */
450
455
  static async saveData(name) {
451
456
  throw new Error("Method not implemented to keep web compatibility.");
@@ -456,11 +461,12 @@ export class LocalStorage {
456
461
  tasks: LocalStorage.tasks,
457
462
  };
458
463
  const filename = name + ".cloud";
459
- //await saveFile({ data, filename });
464
+ // await saveFile({ data, filename });
460
465
  }
461
466
  /**
462
- * Loads the data
463
- * @param name the name to load the data
467
+ * Loads the data.
468
+ * @param name The name to load the data from.
469
+ * @throws Error Method not implemented to keep web compatibility.
464
470
  */
465
471
  static async loadData(name) {
466
472
  throw new Error("Method not implemented to keep web compatibility.");
@@ -475,10 +481,16 @@ export class LocalStorage {
475
481
  */
476
482
  }
477
483
  }
484
+ /** The jobs */
478
485
  LocalStorage.jobs = {};
486
+ /** The job events */
479
487
  LocalStorage.jobEvents = {};
488
+ /** The data */
480
489
  LocalStorage.data = {};
490
+ /** The files */
481
491
  LocalStorage.files = {};
492
+ /** The transactions */
482
493
  LocalStorage.transactions = {};
494
+ /** The tasks */
483
495
  LocalStorage.tasks = {};
484
496
  //# sourceMappingURL=local.js.map