zkcloudworker 0.7.3 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/cloud/index.d.ts +4 -5
- package/lib/ts/src/cloud/index.js +4 -5
- package/lib/ts/src/cloud/utils/index.d.ts +3 -0
- package/lib/ts/src/cloud/utils/index.js +19 -0
- package/lib/{web/src/cloud → ts/src/cloud/worker}/cloud.d.ts +51 -50
- package/lib/ts/src/cloud/{cloud.js → worker/cloud.js} +33 -32
- package/lib/ts/src/cloud/worker/index.d.ts +3 -0
- package/lib/ts/src/cloud/worker/index.js +19 -0
- package/lib/ts/src/index.d.ts +1 -4
- package/lib/ts/src/index.js +1 -4
- package/lib/ts/src/{api → mina/api}/api.d.ts +7 -6
- package/lib/ts/src/{api → mina/api}/api.js +8 -7
- package/lib/ts/src/mina/index.d.ts +4 -0
- package/lib/ts/src/mina/index.js +20 -0
- package/lib/{web/src/cloud → ts/src/mina/local}/local.d.ts +10 -10
- package/lib/ts/src/{cloud → mina/local}/local.js +13 -13
- package/lib/ts/src/{utils → mina/utils}/fee.js +1 -1
- package/lib/ts/src/{utils → mina/utils}/fetch.js +3 -3
- package/lib/ts/src/{utils → mina/utils}/index.d.ts +0 -2
- package/lib/ts/src/{utils → mina/utils}/index.js +0 -2
- package/lib/ts/src/{utils → mina/utils}/mina.d.ts +1 -1
- package/lib/ts/src/{utils → mina/utils}/mina.js +3 -3
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/cloud/config.js.map +1 -0
- package/lib/web/src/cloud/index.d.ts +4 -5
- package/lib/web/src/cloud/index.js +4 -5
- package/lib/web/src/cloud/index.js.map +1 -1
- package/lib/web/src/cloud/networks.js.map +1 -0
- package/lib/web/src/cloud/utils/files.js.map +1 -0
- package/lib/web/src/cloud/utils/graphql.js.map +1 -0
- package/lib/web/src/cloud/utils/index.d.ts +3 -0
- package/lib/web/src/cloud/utils/index.js +4 -0
- package/lib/web/src/cloud/utils/index.js.map +1 -0
- package/lib/web/src/cloud/utils/utils.js.map +1 -0
- package/lib/{ts/src/cloud → web/src/cloud/worker}/cloud.d.ts +51 -50
- package/lib/web/src/cloud/{cloud.js → worker/cloud.js} +33 -32
- package/lib/web/src/cloud/worker/cloud.js.map +1 -0
- package/lib/web/src/cloud/worker/index.d.ts +3 -0
- package/lib/web/src/cloud/worker/index.js +4 -0
- package/lib/web/src/cloud/worker/index.js.map +1 -0
- package/lib/web/src/cloud/{job.js.map → worker/job.js.map} +1 -1
- package/lib/web/src/cloud/{task.js.map → worker/task.js.map} +1 -1
- package/lib/web/src/index.d.ts +1 -4
- package/lib/web/src/index.js +1 -4
- package/lib/web/src/index.js.map +1 -1
- package/lib/web/src/{api → mina/api}/api.d.ts +7 -6
- package/lib/web/src/{api → mina/api}/api.js +8 -7
- package/lib/web/src/mina/api/api.js.map +1 -0
- package/lib/web/src/mina/encryption/client.js.map +1 -0
- package/lib/web/src/mina/encryption/connections.js.map +1 -0
- package/lib/web/src/mina/encryption/encryption.js.map +1 -0
- package/lib/web/src/mina/encryption/index.js.map +1 -0
- package/lib/web/src/mina/encryption/messages.js.map +1 -0
- package/lib/web/src/mina/index.d.ts +4 -0
- package/lib/web/src/mina/index.js +5 -0
- package/lib/web/src/mina/index.js.map +1 -0
- package/lib/{ts/src/cloud → web/src/mina/local}/local.d.ts +10 -10
- package/lib/web/src/{cloud → mina/local}/local.js +8 -8
- package/lib/web/src/mina/local/local.js.map +1 -0
- package/lib/web/src/mina/utils/base64.js.map +1 -0
- package/lib/web/src/{utils → mina/utils}/fee.js +1 -1
- package/lib/web/src/mina/utils/fee.js.map +1 -0
- package/lib/web/src/{utils → mina/utils}/fetch.js +1 -1
- package/lib/web/src/mina/utils/fetch.js.map +1 -0
- package/lib/web/src/mina/utils/fields.js.map +1 -0
- package/lib/web/src/{utils → mina/utils}/index.d.ts +0 -2
- package/lib/web/src/{utils → mina/utils}/index.js +0 -2
- package/lib/web/src/mina/utils/index.js.map +1 -0
- package/lib/web/src/{utils → mina/utils}/mina.d.ts +1 -1
- package/lib/web/src/{utils → mina/utils}/mina.js +1 -1
- package/lib/web/src/mina/utils/mina.js.map +1 -0
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/web/src/api/api.js.map +0 -1
- package/lib/web/src/cloud/cloud.js.map +0 -1
- package/lib/web/src/cloud/files.js.map +0 -1
- package/lib/web/src/cloud/local.js.map +0 -1
- package/lib/web/src/config.js.map +0 -1
- package/lib/web/src/encryption/client.js.map +0 -1
- package/lib/web/src/encryption/connections.js.map +0 -1
- package/lib/web/src/encryption/encryption.js.map +0 -1
- package/lib/web/src/encryption/index.js.map +0 -1
- package/lib/web/src/encryption/messages.js.map +0 -1
- package/lib/web/src/networks.js.map +0 -1
- package/lib/web/src/utils/base64.js.map +0 -1
- package/lib/web/src/utils/fee.js.map +0 -1
- package/lib/web/src/utils/fetch.js.map +0 -1
- package/lib/web/src/utils/fields.js.map +0 -1
- package/lib/web/src/utils/graphql.js.map +0 -1
- package/lib/web/src/utils/index.js.map +0 -1
- package/lib/web/src/utils/mina.js.map +0 -1
- package/lib/web/src/utils/utils.js.map +0 -1
- /package/lib/ts/src/{config.d.ts → cloud/config.d.ts} +0 -0
- /package/lib/ts/src/{config.js → cloud/config.js} +0 -0
- /package/lib/ts/src/{networks.d.ts → cloud/networks.d.ts} +0 -0
- /package/lib/ts/src/{networks.js → cloud/networks.js} +0 -0
- /package/lib/ts/src/cloud/{files.d.ts → utils/files.d.ts} +0 -0
- /package/lib/ts/src/cloud/{files.js → utils/files.js} +0 -0
- /package/lib/ts/src/{utils → cloud/utils}/graphql.d.ts +0 -0
- /package/lib/ts/src/{utils → cloud/utils}/graphql.js +0 -0
- /package/lib/ts/src/{utils → cloud/utils}/utils.d.ts +0 -0
- /package/lib/ts/src/{utils → cloud/utils}/utils.js +0 -0
- /package/lib/ts/src/cloud/{job.d.ts → worker/job.d.ts} +0 -0
- /package/lib/ts/src/cloud/{job.js → worker/job.js} +0 -0
- /package/lib/ts/src/cloud/{task.d.ts → worker/task.d.ts} +0 -0
- /package/lib/ts/src/cloud/{task.js → worker/task.js} +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/client.d.ts +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/client.js +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/connections.d.ts +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/connections.js +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/encryption.d.ts +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/encryption.js +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/index.d.ts +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/index.js +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/messages.d.ts +0 -0
- /package/lib/ts/src/{encryption → mina/encryption}/messages.js +0 -0
- /package/lib/ts/src/{utils → mina/utils}/base64.d.ts +0 -0
- /package/lib/ts/src/{utils → mina/utils}/base64.js +0 -0
- /package/lib/ts/src/{utils → mina/utils}/fee.d.ts +0 -0
- /package/lib/ts/src/{utils → mina/utils}/fetch.d.ts +0 -0
- /package/lib/ts/src/{utils → mina/utils}/fields.d.ts +0 -0
- /package/lib/ts/src/{utils → mina/utils}/fields.js +0 -0
- /package/lib/web/src/{config.d.ts → cloud/config.d.ts} +0 -0
- /package/lib/web/src/{config.js → cloud/config.js} +0 -0
- /package/lib/web/src/{networks.d.ts → cloud/networks.d.ts} +0 -0
- /package/lib/web/src/{networks.js → cloud/networks.js} +0 -0
- /package/lib/web/src/cloud/{files.d.ts → utils/files.d.ts} +0 -0
- /package/lib/web/src/cloud/{files.js → utils/files.js} +0 -0
- /package/lib/web/src/{utils → cloud/utils}/graphql.d.ts +0 -0
- /package/lib/web/src/{utils → cloud/utils}/graphql.js +0 -0
- /package/lib/web/src/{utils → cloud/utils}/utils.d.ts +0 -0
- /package/lib/web/src/{utils → cloud/utils}/utils.js +0 -0
- /package/lib/web/src/cloud/{job.d.ts → worker/job.d.ts} +0 -0
- /package/lib/web/src/cloud/{job.js → worker/job.js} +0 -0
- /package/lib/web/src/cloud/{task.d.ts → worker/task.d.ts} +0 -0
- /package/lib/web/src/cloud/{task.js → worker/task.js} +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/client.d.ts +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/client.js +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/connections.d.ts +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/connections.js +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/encryption.d.ts +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/encryption.js +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/index.d.ts +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/index.js +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/messages.d.ts +0 -0
- /package/lib/web/src/{encryption → mina/encryption}/messages.js +0 -0
- /package/lib/web/src/{utils → mina/utils}/base64.d.ts +0 -0
- /package/lib/web/src/{utils → mina/utils}/base64.js +0 -0
- /package/lib/web/src/{utils → mina/utils}/fee.d.ts +0 -0
- /package/lib/web/src/{utils → mina/utils}/fetch.d.ts +0 -0
- /package/lib/web/src/{utils → mina/utils}/fields.d.ts +0 -0
- /package/lib/web/src/{utils → mina/utils}/fields.js +0 -0
@@ -1,5 +1,4 @@
|
|
1
|
-
export * from "./
|
2
|
-
export * from "./
|
3
|
-
export * from "./
|
4
|
-
export * from "./
|
5
|
-
export * from "./local";
|
1
|
+
export * from "./utils";
|
2
|
+
export * from "./worker";
|
3
|
+
export * from "./config";
|
4
|
+
export * from "./networks";
|
@@ -14,8 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./
|
18
|
-
__exportStar(require("./
|
19
|
-
__exportStar(require("./
|
20
|
-
__exportStar(require("./
|
21
|
-
__exportStar(require("./local"), exports);
|
17
|
+
__exportStar(require("./utils"), exports);
|
18
|
+
__exportStar(require("./worker"), exports);
|
19
|
+
__exportStar(require("./config"), exports);
|
20
|
+
__exportStar(require("./networks"), exports);
|
@@ -0,0 +1,19 @@
|
|
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("./files"), exports);
|
18
|
+
__exportStar(require("./graphql"), exports);
|
19
|
+
__exportStar(require("./utils"), exports);
|
@@ -60,19 +60,20 @@ export declare abstract class Cloud {
|
|
60
60
|
readonly isLocalCloud: boolean;
|
61
61
|
/**
|
62
62
|
* Constructor for the Cloud class
|
63
|
-
* @param
|
64
|
-
* @param
|
65
|
-
* @param
|
66
|
-
* @param
|
67
|
-
* @param
|
68
|
-
* @param
|
69
|
-
* @param
|
70
|
-
* @param
|
71
|
-
* @param
|
72
|
-
* @param
|
73
|
-
* @param
|
74
|
-
* @param
|
75
|
-
* @param
|
63
|
+
* @param params the parameters for the Cloud class
|
64
|
+
* @param params.id the id of the user
|
65
|
+
* @param params.jobId the job id
|
66
|
+
* @param params.stepId the step id
|
67
|
+
* @param params.taskId the task id
|
68
|
+
* @param params.cache the cache folder. Use it to get the Cache object: cache = Cache.FileSystem(this.cloud.cache);
|
69
|
+
* @param params.developer the developer id
|
70
|
+
* @param params.repo the repo id
|
71
|
+
* @param params.task the task id
|
72
|
+
* @param params.userId the user id
|
73
|
+
* @param params.args the arguments, should be a string or serialized JSON
|
74
|
+
* @param params.metadata the metadata, should be a string or serialized JSON
|
75
|
+
* @param params.chain the blockchain network
|
76
|
+
* @param params.isLocalCloud a boolean to check if the cloud is local or not
|
76
77
|
*/
|
77
78
|
constructor(params: {
|
78
79
|
id: string;
|
@@ -98,10 +99,10 @@ export declare abstract class Cloud {
|
|
98
99
|
abstract getDeployer(): Promise<DeployerKeyPair | undefined>;
|
99
100
|
/**
|
100
101
|
* Abstract method to release the deployer
|
101
|
-
* @param params
|
102
|
+
* @param params the public key of the deployer and the transactions hashes
|
102
103
|
* Used to release the deployer after the transactions are sent to the blockchain
|
103
|
-
* @param publicKey
|
104
|
-
* @param txsHashes
|
104
|
+
* @param params.publicKey the public key of the deployer
|
105
|
+
* @param params.txsHashes the transactions hashes
|
105
106
|
*/
|
106
107
|
abstract releaseDeployer(params: {
|
107
108
|
publicKey: string;
|
@@ -110,46 +111,46 @@ export declare abstract class Cloud {
|
|
110
111
|
/**
|
111
112
|
* Abstract method to get the data by key
|
112
113
|
* Used to get the data by key from the cloud storage
|
113
|
-
* @param key
|
114
|
+
* @param key the key
|
114
115
|
* @returns the value of the key
|
115
116
|
*/
|
116
117
|
abstract getDataByKey(key: string): Promise<string | undefined>;
|
117
118
|
/**
|
118
119
|
* Abstract method to save the data by key
|
119
120
|
* Used to save the data by key to the cloud storage
|
120
|
-
* @param key
|
121
|
-
* @param value
|
121
|
+
* @param key the key
|
122
|
+
* @param value the value
|
122
123
|
*/
|
123
124
|
abstract saveDataByKey(key: string, value: string | undefined): Promise<void>;
|
124
125
|
/**
|
125
126
|
* Abstract method to save the file
|
126
127
|
* Used to save the file to the cloud storage
|
127
|
-
* @param filename
|
128
|
-
* @param value
|
128
|
+
* @param filename the filename
|
129
|
+
* @param value the value
|
129
130
|
*/
|
130
131
|
abstract saveFile(filename: string, value: Buffer): Promise<void>;
|
131
132
|
/**
|
132
133
|
* Abstract method to load the file
|
133
134
|
* Used to load the file from the cloud storage
|
134
|
-
* @param filename
|
135
|
+
* @param filename the filename
|
135
136
|
* @returns the value of the file
|
136
137
|
*/
|
137
138
|
abstract loadFile(filename: string): Promise<Buffer | undefined>;
|
138
139
|
/**
|
139
140
|
* Abstract method to load the environment
|
140
141
|
* Used to load the environment from the cloud storage
|
141
|
-
* @param password
|
142
|
+
* @param password the password
|
142
143
|
*/
|
143
144
|
abstract loadEnvironment(password: string): Promise<void>;
|
144
145
|
/**
|
145
146
|
* Abstract method to calculate the recursive proof
|
146
147
|
* Used to calculate the recursive proof
|
147
|
-
* @param data
|
148
|
-
* @param data.transactions
|
149
|
-
* @param data.task
|
150
|
-
* @param data.userId
|
151
|
-
* @param data.args
|
152
|
-
* @param data.metadata
|
148
|
+
* @param data the data
|
149
|
+
* @param data.transactions the transactions
|
150
|
+
* @param data.task the task
|
151
|
+
* @param data.userId the user id
|
152
|
+
* @param data.args the arguments
|
153
|
+
* @param data.metadata the metadata
|
153
154
|
* @returns the proof
|
154
155
|
*/
|
155
156
|
abstract recursiveProof(data: {
|
@@ -162,12 +163,12 @@ export declare abstract class Cloud {
|
|
162
163
|
/**
|
163
164
|
* Abstract method to execute the transactions
|
164
165
|
* Used to execute the transactions
|
165
|
-
* @param data
|
166
|
-
* @param data.transactions
|
167
|
-
* @param data.task
|
168
|
-
* @param data.userId
|
169
|
-
* @param data.args
|
170
|
-
* @param data.metadata
|
166
|
+
* @param data the data
|
167
|
+
* @param data.transactions the transactions
|
168
|
+
* @param data.task the task
|
169
|
+
* @param data.userId the user id
|
170
|
+
* @param data.args the arguments
|
171
|
+
* @param data.metadata the metadata
|
171
172
|
* @returns the result
|
172
173
|
*/
|
173
174
|
abstract execute(data: {
|
@@ -180,13 +181,13 @@ export declare abstract class Cloud {
|
|
180
181
|
/**
|
181
182
|
* Abstract method to add the task
|
182
183
|
* Used to add the task
|
183
|
-
* @param data
|
184
|
-
* @param data.task
|
185
|
-
* @param data.startTime
|
186
|
-
* @param data.userId
|
187
|
-
* @param data.args
|
188
|
-
* @param data.metadata
|
189
|
-
* @param data.maxAttempts
|
184
|
+
* @param data the data
|
185
|
+
* @param data.task the task
|
186
|
+
* @param data.startTime the start time
|
187
|
+
* @param data.userId the user id
|
188
|
+
* @param data.args the arguments
|
189
|
+
* @param data.metadata the metadata
|
190
|
+
* @param data.maxAttempts the maximum attempts
|
190
191
|
* @returns the task id
|
191
192
|
*/
|
192
193
|
abstract addTask(data: {
|
@@ -200,7 +201,7 @@ export declare abstract class Cloud {
|
|
200
201
|
/**
|
201
202
|
* Abstract method to delete the transaction
|
202
203
|
* Used to delete the transaction
|
203
|
-
* @param txId
|
204
|
+
* @param txId the transaction id
|
204
205
|
*/
|
205
206
|
abstract deleteTransaction(txId: string): Promise<void>;
|
206
207
|
/**
|
@@ -212,7 +213,7 @@ export declare abstract class Cloud {
|
|
212
213
|
/**
|
213
214
|
* Abstract method to delete the task
|
214
215
|
* Used to delete the task
|
215
|
-
* @param taskId
|
216
|
+
* @param taskId the task id
|
216
217
|
*/
|
217
218
|
abstract deleteTask(taskId: string): Promise<void>;
|
218
219
|
/**
|
@@ -222,7 +223,7 @@ export declare abstract class Cloud {
|
|
222
223
|
/**
|
223
224
|
* Abstract method to get the job result
|
224
225
|
* Used to get the job result
|
225
|
-
* @param jobId
|
226
|
+
* @param jobId the job id
|
226
227
|
* @returns the job result
|
227
228
|
*/
|
228
229
|
abstract jobResult(jobId: string): Promise<JobData | undefined>;
|
@@ -237,7 +238,7 @@ export declare abstract class zkCloudWorker {
|
|
237
238
|
readonly cloud: Cloud;
|
238
239
|
/**
|
239
240
|
* Constructor for the zkCloudWorker class
|
240
|
-
* @param cloud
|
241
|
+
* @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
|
241
242
|
*/
|
242
243
|
constructor(cloud: Cloud);
|
243
244
|
/**
|
@@ -247,20 +248,20 @@ export declare abstract class zkCloudWorker {
|
|
247
248
|
deployedContracts(): Promise<DeployedSmartContract[]>;
|
248
249
|
/**
|
249
250
|
* Creates a new proof from a transaction
|
250
|
-
* @param transaction
|
251
|
+
* @param transaction the transaction
|
251
252
|
* @returns the serialized proof
|
252
253
|
*/
|
253
254
|
create(transaction: string): Promise<string | undefined>;
|
254
255
|
/**
|
255
256
|
* Merges two proofs
|
256
|
-
* @param proof1
|
257
|
-
* @param proof2
|
257
|
+
* @param proof1 the first proof
|
258
|
+
* @param proof2 the second proof
|
258
259
|
* @returns the merged proof
|
259
260
|
*/
|
260
261
|
merge(proof1: string, proof2: string): Promise<string | undefined>;
|
261
262
|
/**
|
262
263
|
* Executes the transactions
|
263
|
-
* @param transactions
|
264
|
+
* @param transactions the transactions, can be empty list
|
264
265
|
* @returns the result
|
265
266
|
*/
|
266
267
|
execute(transactions: string[]): Promise<string | undefined>;
|
@@ -2,39 +2,40 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.zkCloudWorker = exports.Cloud = void 0;
|
4
4
|
/*
|
5
|
-
* Abstract class for the cloud
|
5
|
+
* Abstract class for the cloud service
|
6
6
|
* Used to define the cloud methods and properties
|
7
7
|
* Should be implemented by for local testing and for the zkCloudWorker in the cloud
|
8
|
-
* @param id
|
9
|
-
* @param jobId
|
10
|
-
* @param stepId
|
11
|
-
* @param taskId
|
12
|
-
* @param cache
|
13
|
-
* @param developer
|
14
|
-
* @param repo
|
15
|
-
* @param task
|
16
|
-
* @param userId
|
17
|
-
* @param args
|
18
|
-
* @param metadata
|
19
|
-
* @param chain
|
20
|
-
* @param isLocalCloud
|
8
|
+
* @param id the id of the user
|
9
|
+
* @param jobId the job id
|
10
|
+
* @param stepId the step id
|
11
|
+
* @param taskId the task id
|
12
|
+
* @param cache the cache folder. Use it to get the Cache object: cache = Cache.FileSystem(this.cloud.cache);
|
13
|
+
* @param developer the developer id
|
14
|
+
* @param repo the repo id
|
15
|
+
* @param task the task id
|
16
|
+
* @param userId the user id
|
17
|
+
* @param args the arguments, should be a string or serialized JSON
|
18
|
+
* @param metadata the metadata, should be a string or serialized JSON
|
19
|
+
* @param chain the blockchain network
|
20
|
+
* @param isLocalCloud a boolean to check if the cloud is local or not
|
21
21
|
*/
|
22
22
|
class Cloud {
|
23
23
|
/**
|
24
24
|
* Constructor for the Cloud class
|
25
|
-
* @param
|
26
|
-
* @param
|
27
|
-
* @param
|
28
|
-
* @param
|
29
|
-
* @param
|
30
|
-
* @param
|
31
|
-
* @param
|
32
|
-
* @param
|
33
|
-
* @param
|
34
|
-
* @param
|
35
|
-
* @param
|
36
|
-
* @param
|
37
|
-
* @param
|
25
|
+
* @param params the parameters for the Cloud class
|
26
|
+
* @param params.id the id of the user
|
27
|
+
* @param params.jobId the job id
|
28
|
+
* @param params.stepId the step id
|
29
|
+
* @param params.taskId the task id
|
30
|
+
* @param params.cache the cache folder. Use it to get the Cache object: cache = Cache.FileSystem(this.cloud.cache);
|
31
|
+
* @param params.developer the developer id
|
32
|
+
* @param params.repo the repo id
|
33
|
+
* @param params.task the task id
|
34
|
+
* @param params.userId the user id
|
35
|
+
* @param params.args the arguments, should be a string or serialized JSON
|
36
|
+
* @param params.metadata the metadata, should be a string or serialized JSON
|
37
|
+
* @param params.chain the blockchain network
|
38
|
+
* @param params.isLocalCloud a boolean to check if the cloud is local or not
|
38
39
|
*/
|
39
40
|
constructor(params) {
|
40
41
|
const { id, jobId, stepId, taskId, cache, developer, repo, task, userId, args, metadata, isLocalCloud, chain, } = params;
|
@@ -63,7 +64,7 @@ exports.Cloud = Cloud;
|
|
63
64
|
class zkCloudWorker {
|
64
65
|
/**
|
65
66
|
* Constructor for the zkCloudWorker class
|
66
|
-
* @param cloud
|
67
|
+
* @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
|
67
68
|
*/
|
68
69
|
constructor(cloud) {
|
69
70
|
this.cloud = cloud;
|
@@ -78,7 +79,7 @@ class zkCloudWorker {
|
|
78
79
|
// Those methods should be implemented for recursive proofs calculations
|
79
80
|
/**
|
80
81
|
* Creates a new proof from a transaction
|
81
|
-
* @param transaction
|
82
|
+
* @param transaction the transaction
|
82
83
|
* @returns the serialized proof
|
83
84
|
*/
|
84
85
|
async create(transaction) {
|
@@ -86,8 +87,8 @@ class zkCloudWorker {
|
|
86
87
|
}
|
87
88
|
/**
|
88
89
|
* Merges two proofs
|
89
|
-
* @param proof1
|
90
|
-
* @param proof2
|
90
|
+
* @param proof1 the first proof
|
91
|
+
* @param proof2 the second proof
|
91
92
|
* @returns the merged proof
|
92
93
|
*/
|
93
94
|
async merge(proof1, proof2) {
|
@@ -96,7 +97,7 @@ class zkCloudWorker {
|
|
96
97
|
// Those methods should be implemented for anything except for recursive proofs
|
97
98
|
/**
|
98
99
|
* Executes the transactions
|
99
|
-
* @param transactions
|
100
|
+
* @param transactions the transactions, can be empty list
|
100
101
|
* @returns the result
|
101
102
|
*/
|
102
103
|
async execute(transactions) {
|
@@ -0,0 +1,19 @@
|
|
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("./cloud"), exports);
|
18
|
+
__exportStar(require("./job"), exports);
|
19
|
+
__exportStar(require("./task"), exports);
|
package/lib/ts/src/index.d.ts
CHANGED
package/lib/ts/src/index.js
CHANGED
@@ -14,8 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./api/api"), exports);
|
18
17
|
__exportStar(require("./cloud"), exports);
|
19
|
-
__exportStar(require("./
|
20
|
-
__exportStar(require("./encryption"), exports);
|
21
|
-
__exportStar(require("./utils"), exports);
|
18
|
+
__exportStar(require("./mina"), exports);
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { zkCloudWorker, Cloud } from "
|
2
|
-
import { blockchain } from "
|
1
|
+
import { zkCloudWorker, Cloud } from "../../cloud/worker";
|
2
|
+
import { blockchain } from "../../cloud/networks";
|
3
3
|
/**
|
4
4
|
* The APICommand type for interacting with the zkCloudWorker
|
5
5
|
* @typedef { "recursiveProof" | "execute" | "sendTransactions" | "jobResult" | "deploy" | "getBalance" | "queryBilling" } ApiCommand
|
@@ -28,10 +28,11 @@ export declare class zkCloudWorkerClient {
|
|
28
28
|
readonly localWorker?: (cloud: Cloud) => Promise<zkCloudWorker>;
|
29
29
|
/**
|
30
30
|
* Constructor for the API class
|
31
|
-
* @param
|
32
|
-
* @param
|
33
|
-
* @param
|
34
|
-
* @param
|
31
|
+
* @param params the parameters for the API class
|
32
|
+
* @param params.jwt The jwt token for authentication, get it at https://t.me/minanft_bot?start=auth
|
33
|
+
* @param params.zkcloudworker The local worker for the serverless api to test the code locally
|
34
|
+
* @param params.chain The blockchain network to use
|
35
|
+
* @param params.webhook The webhook for the serverless api to get the results
|
35
36
|
*/
|
36
37
|
constructor(params: {
|
37
38
|
jwt: string;
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.zkCloudWorkerClient = void 0;
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
9
|
-
const utils_1 = require("
|
10
|
-
const local_1 = require("../
|
11
|
-
const config_1 = __importDefault(require("
|
9
|
+
const utils_1 = require("../../cloud/utils");
|
10
|
+
const local_1 = require("../local/local");
|
11
|
+
const config_1 = __importDefault(require("../../cloud/config"));
|
12
12
|
const { ZKCLOUDWORKER_AUTH, ZKCLOUDWORKER_API } = config_1.default;
|
13
13
|
/**
|
14
14
|
* API class for interacting with the zkCloudWorker
|
@@ -21,10 +21,11 @@ const { ZKCLOUDWORKER_AUTH, ZKCLOUDWORKER_API } = config_1.default;
|
|
21
21
|
class zkCloudWorkerClient {
|
22
22
|
/**
|
23
23
|
* Constructor for the API class
|
24
|
-
* @param
|
25
|
-
* @param
|
26
|
-
* @param
|
27
|
-
* @param
|
24
|
+
* @param params the parameters for the API class
|
25
|
+
* @param params.jwt The jwt token for authentication, get it at https://t.me/minanft_bot?start=auth
|
26
|
+
* @param params.zkcloudworker The local worker for the serverless api to test the code locally
|
27
|
+
* @param params.chain The blockchain network to use
|
28
|
+
* @param params.webhook The webhook for the serverless api to get the results
|
28
29
|
*/
|
29
30
|
constructor(params) {
|
30
31
|
const { jwt, zkcloudworker, chain, webhook } = params;
|
@@ -0,0 +1,20 @@
|
|
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("./api/api"), exports);
|
18
|
+
__exportStar(require("./encryption"), exports);
|
19
|
+
__exportStar(require("./utils"), exports);
|
20
|
+
__exportStar(require("./local/local"), exports);
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import { Cloud, zkCloudWorker } from "
|
3
|
-
import { JobData } from "
|
4
|
-
import { TaskData } from "
|
5
|
-
import { blockchain } from "
|
6
|
-
import { CloudTransaction, DeployerKeyPair } from "
|
2
|
+
import { Cloud, zkCloudWorker } from "../../cloud";
|
3
|
+
import { JobData } from "../../cloud";
|
4
|
+
import { TaskData } from "../../cloud";
|
5
|
+
import { blockchain } from "../../cloud";
|
6
|
+
import { CloudTransaction, DeployerKeyPair } from "../../cloud";
|
7
7
|
import { ApiCommand } from "../api/api";
|
8
8
|
/**
|
9
9
|
* LocalCloud is a cloud that runs on the local machine for testing and development
|
@@ -17,11 +17,11 @@ export declare class LocalCloud extends Cloud {
|
|
17
17
|
/**
|
18
18
|
* Constructor for LocalCloud
|
19
19
|
* @param params the parameters to create the LocalCloud
|
20
|
-
* @param job the job data
|
21
|
-
* @param chain the blockchain to execute the job on, can be any blockchain, not only local
|
22
|
-
* @param cache the cache folder
|
23
|
-
* @param stepId the step id
|
24
|
-
* @param localWorker the worker to execute the tasks
|
20
|
+
* @param params.job the job data
|
21
|
+
* @param params.chain the blockchain to execute the job on, can be any blockchain, not only local
|
22
|
+
* @param params.cache the cache folder
|
23
|
+
* @param params.stepId the step id
|
24
|
+
* @param params.localWorker the worker to execute the tasks
|
25
25
|
*/
|
26
26
|
constructor(params: {
|
27
27
|
job: JobData;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.LocalStorage = exports.LocalCloud = void 0;
|
4
|
-
const cloud_1 = require("
|
5
|
-
const
|
6
|
-
const
|
4
|
+
const cloud_1 = require("../../cloud");
|
5
|
+
const cloud_2 = require("../../cloud");
|
6
|
+
const cloud_3 = require("../../cloud");
|
7
7
|
/**
|
8
8
|
* LocalCloud is a cloud that runs on the local machine for testing and development
|
9
9
|
* It uses LocalStorage to store jobs, tasks, transactions, and data
|
@@ -15,11 +15,11 @@ class LocalCloud extends cloud_1.Cloud {
|
|
15
15
|
/**
|
16
16
|
* Constructor for LocalCloud
|
17
17
|
* @param params the parameters to create the LocalCloud
|
18
|
-
* @param job the job data
|
19
|
-
* @param chain the blockchain to execute the job on, can be any blockchain, not only local
|
20
|
-
* @param cache the cache folder
|
21
|
-
* @param stepId the step id
|
22
|
-
* @param localWorker the worker to execute the tasks
|
18
|
+
* @param params.job the job data
|
19
|
+
* @param params.chain the blockchain to execute the job on, can be any blockchain, not only local
|
20
|
+
* @param params.cache the cache folder
|
21
|
+
* @param params.stepId the step id
|
22
|
+
* @param params.localWorker the worker to execute the tasks
|
23
23
|
*/
|
24
24
|
constructor(params) {
|
25
25
|
const { job, chain, cache, stepId, localWorker } = params;
|
@@ -93,7 +93,7 @@ class LocalCloud extends cloud_1.Cloud {
|
|
93
93
|
* @param value the value to save
|
94
94
|
*/
|
95
95
|
async saveFile(filename, value) {
|
96
|
-
await (0,
|
96
|
+
await (0, cloud_3.saveBinaryFile)({ data: value, filename });
|
97
97
|
}
|
98
98
|
/**
|
99
99
|
* Loads the file
|
@@ -101,7 +101,7 @@ class LocalCloud extends cloud_1.Cloud {
|
|
101
101
|
* @returns the file data
|
102
102
|
*/
|
103
103
|
async loadFile(filename) {
|
104
|
-
const data = await (0,
|
104
|
+
const data = await (0, cloud_3.loadBinaryFile)(filename);
|
105
105
|
return data;
|
106
106
|
}
|
107
107
|
/**
|
@@ -116,7 +116,7 @@ class LocalCloud extends cloud_1.Cloud {
|
|
116
116
|
* @returns generated unique id
|
117
117
|
*/
|
118
118
|
static generateId() {
|
119
|
-
return "local." + Date.now().toString() + "." + (0,
|
119
|
+
return "local." + Date.now().toString() + "." + (0, cloud_2.makeString)(32);
|
120
120
|
}
|
121
121
|
/**
|
122
122
|
* Adds transactions to the local cloud
|
@@ -440,7 +440,7 @@ class LocalStorage {
|
|
440
440
|
tasks: LocalStorage.tasks,
|
441
441
|
};
|
442
442
|
const filename = name + ".cloud";
|
443
|
-
await (0,
|
443
|
+
await (0, cloud_3.saveFile)({ data, filename });
|
444
444
|
}
|
445
445
|
/**
|
446
446
|
* Loads the data
|
@@ -448,7 +448,7 @@ class LocalStorage {
|
|
448
448
|
*/
|
449
449
|
static async loadData(name) {
|
450
450
|
const filename = name + ".cloud";
|
451
|
-
const data = await (0,
|
451
|
+
const data = await (0, cloud_3.loadFile)(filename);
|
452
452
|
if (data === undefined)
|
453
453
|
return;
|
454
454
|
LocalStorage.jobs = data.jobs;
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.fee = void 0;
|
7
7
|
const o1js_1 = require("o1js");
|
8
|
-
const config_1 = __importDefault(require("
|
8
|
+
const config_1 = __importDefault(require("../../cloud/config"));
|
9
9
|
/**
|
10
10
|
* Calculate the fee for a transaction
|
11
11
|
* @returns the fee for a transaction
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.checkMinaZkappTransaction = exports.fetchMinaActions = exports.fetchMinaAccount = void 0;
|
4
4
|
const o1js_1 = require("o1js");
|
5
|
-
const
|
5
|
+
const cloud_1 = require("../../cloud");
|
6
6
|
/**
|
7
7
|
* Fetches the Mina account for a given public key with error handling
|
8
8
|
* @param params the parameters for fetching the account
|
@@ -42,7 +42,7 @@ async function fetchMinaAccount(params) {
|
|
42
42
|
return result;
|
43
43
|
}
|
44
44
|
}
|
45
|
-
await (0,
|
45
|
+
await (0, cloud_1.sleep)(1000 * 5);
|
46
46
|
}
|
47
47
|
if (force === true)
|
48
48
|
throw new Error(`fetchMinaAccount timeout
|
@@ -80,7 +80,7 @@ async function fetchMinaActions(publicKey, fromActionState, endActionState) {
|
|
80
80
|
catch (error) {
|
81
81
|
console.log("Error in fetchMinaActions", error.toString().substring(0, 300));
|
82
82
|
}
|
83
|
-
await (0,
|
83
|
+
await (0, cloud_1.sleep)(1000 * 60 * 2);
|
84
84
|
}
|
85
85
|
console.log("Timeout in fetchMinaActions");
|
86
86
|
return undefined;
|