zkcloudworker 0.11.4 → 0.11.7

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.
Files changed (40) hide show
  1. package/lib/ts/src/cloud/worker/cloud.d.ts +11 -39
  2. package/lib/ts/src/cloud/worker/cloud.js +1 -55
  3. package/lib/ts/src/cloud/worker/index.d.ts +2 -0
  4. package/lib/ts/src/cloud/worker/index.js +2 -0
  5. package/lib/ts/src/cloud/worker/transaction.d.ts +11 -0
  6. package/lib/ts/src/cloud/worker/transaction.js +8 -0
  7. package/lib/ts/src/cloud/worker/worker.d.ts +40 -0
  8. package/lib/ts/src/cloud/worker/worker.js +57 -0
  9. package/lib/ts/src/mina/index.d.ts +1 -1
  10. package/lib/ts/src/mina/index.js +1 -1
  11. package/lib/ts/src/mina/local/local.d.ts +11 -5
  12. package/lib/ts/src/mina/local/local.js +10 -2
  13. package/lib/ts/src/mina/verification/index.d.ts +1 -0
  14. package/lib/ts/src/mina/verification/index.js +17 -0
  15. package/lib/ts/src/mina/verification/verification.d.ts +2 -2
  16. package/lib/ts/tsconfig.tsbuildinfo +1 -1
  17. package/lib/web/src/cloud/worker/cloud.d.ts +11 -39
  18. package/lib/web/src/cloud/worker/cloud.js +0 -53
  19. package/lib/web/src/cloud/worker/cloud.js.map +1 -1
  20. package/lib/web/src/cloud/worker/index.d.ts +2 -0
  21. package/lib/web/src/cloud/worker/index.js +2 -0
  22. package/lib/web/src/cloud/worker/index.js.map +1 -1
  23. package/lib/web/src/cloud/worker/transaction.d.ts +11 -0
  24. package/lib/web/src/cloud/worker/transaction.js +8 -0
  25. package/lib/web/src/cloud/worker/transaction.js.map +1 -0
  26. package/lib/web/src/cloud/worker/worker.d.ts +40 -0
  27. package/lib/web/src/cloud/worker/worker.js +54 -0
  28. package/lib/web/src/cloud/worker/worker.js.map +1 -0
  29. package/lib/web/src/mina/index.d.ts +1 -1
  30. package/lib/web/src/mina/index.js +1 -1
  31. package/lib/web/src/mina/index.js.map +1 -1
  32. package/lib/web/src/mina/local/local.d.ts +11 -5
  33. package/lib/web/src/mina/local/local.js +10 -2
  34. package/lib/web/src/mina/local/local.js.map +1 -1
  35. package/lib/web/src/mina/verification/index.d.ts +1 -0
  36. package/lib/web/src/mina/verification/index.js +2 -0
  37. package/lib/web/src/mina/verification/index.js.map +1 -0
  38. package/lib/web/src/mina/verification/verification.d.ts +2 -2
  39. package/lib/web/tsconfig.web.tsbuildinfo +1 -1
  40. package/package.json +1 -1
@@ -1,6 +1,7 @@
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
7
  * Used to get the public and private keys of the deployer for test networks only
@@ -190,6 +191,16 @@ export declare abstract class Cloud {
190
191
  * @returns the transactions
191
192
  */
192
193
  abstract getTransactions(): Promise<CloudTransaction[]>;
194
+ /**
195
+ * Publish the transaction metadata in human-readable format
196
+ * @param params
197
+ * @param params.txId the transaction id
198
+ * @param params.metadata the metadata
199
+ */
200
+ abstract publishTransactionMetadata(params: {
201
+ txId: string;
202
+ metadata: TransactionMetadata;
203
+ }): Promise<void>;
193
204
  /**
194
205
  * Abstract method to delete the task
195
206
  * Used to delete the task
@@ -213,42 +224,3 @@ export declare abstract class Cloud {
213
224
  */
214
225
  abstract forceWorkerRestart(): Promise<void>;
215
226
  }
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.zkCloudWorker = exports.Cloud = void 0;
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;
@@ -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";
@@ -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);
@@ -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
+ "use strict";
2
+ /**
3
+ * Human-readable transaction metadata
4
+ * events: the events
5
+ * actions: the actions
6
+ * custom: the custom metadata defined by the developer
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
+ * @param cloud: the cloud
7
+ */
8
+ export declare abstract class zkCloudWorker {
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,57 @@
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
+ * @param cloud: the cloud
9
+ */
10
+ class zkCloudWorker {
11
+ /**
12
+ * Constructor for the zkCloudWorker class
13
+ * @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
14
+ */
15
+ constructor(cloud) {
16
+ this.cloud = cloud;
17
+ }
18
+ // Those methods should be implemented for recursive proofs calculations
19
+ /**
20
+ * Creates a new proof from a transaction
21
+ * @param transaction the transaction
22
+ * @returns the serialized proof
23
+ */
24
+ async create(transaction) {
25
+ return undefined;
26
+ }
27
+ /**
28
+ * Merges two proofs
29
+ * @param proof1 the first proof
30
+ * @param proof2 the second proof
31
+ * @returns the merged proof
32
+ */
33
+ async merge(proof1, proof2) {
34
+ return undefined;
35
+ }
36
+ // Those methods should be implemented for anything except for recursive proofs
37
+ /**
38
+ * Executes the transactions
39
+ * @param transactions the transactions, can be empty list
40
+ * @returns the result
41
+ */
42
+ async execute(transactions) {
43
+ return undefined;
44
+ }
45
+ /* Process the transactions received by the cloud
46
+ * @param transactions: the transactions
47
+ */
48
+ async processTransactions(transactions) { }
49
+ /**
50
+ * process the task defined by the developer
51
+ * @returns the result
52
+ */
53
+ async task() {
54
+ return undefined;
55
+ }
56
+ }
57
+ exports.zkCloudWorker = zkCloudWorker;
@@ -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";
@@ -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/verification"), exports);
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
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LocalStorage = exports.LocalCloud = void 0;
4
4
  const cloud_1 = require("../../cloud");
5
- const cloud_2 = require("../../cloud");
6
5
  /**
7
6
  * LocalCloud is a cloud that runs on the local machine for testing and development
8
7
  * It uses LocalStorage to store jobs, tasks, transactions, and data
@@ -115,7 +114,7 @@ class LocalCloud extends cloud_1.Cloud {
115
114
  //const data =
116
115
  // tx ?? JSON.stringify({ time: Date.now(), data: makeString(32) });
117
116
  //return stringHash(data);
118
- return Date.now() + "." + (0, cloud_2.makeString)(32);
117
+ return Date.now() + "." + (0, cloud_1.makeString)(32);
119
118
  }
120
119
  /**
121
120
  * Send transactions to the local cloud
@@ -167,6 +166,15 @@ class LocalCloud extends cloud_1.Cloud {
167
166
  });
168
167
  return txs;
169
168
  }
169
+ /**
170
+ * Publish the transaction metadata in human-readable format
171
+ * @param params
172
+ * @param params.txId the transaction id
173
+ * @param params.metadata the metadata
174
+ */
175
+ async publishTransactionMetadata(params) {
176
+ console.log("publishTransactionMetadata:", params);
177
+ }
170
178
  /**
171
179
  * Runs the worker in the local cloud
172
180
  * @param params the parameters to run the worker
@@ -0,0 +1 @@
1
+ export * from "./verification";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./verification"), exports);
@@ -12,8 +12,8 @@ import { SmartContract } from "o1js";
12
12
  */
13
13
  export interface VerificationData {
14
14
  contract: typeof SmartContract;
15
- contractDependencies: (typeof SmartContract)[];
16
- programDependencies: any[];
15
+ contractDependencies?: (typeof SmartContract)[];
16
+ programDependencies?: any[];
17
17
  address: string;
18
18
  chain: blockchain;
19
19
  }