zkcloudworker 0.7.2 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/api/api.d.ts +39 -27
- package/lib/ts/src/api/api.js +28 -27
- package/lib/ts/src/cloud/cloud.d.ts +176 -0
- package/lib/ts/src/cloud/cloud.js +72 -3
- package/lib/ts/src/cloud/job.d.ts +47 -0
- package/lib/ts/src/cloud/local.d.ts +157 -1
- package/lib/ts/src/cloud/local.js +157 -3
- package/lib/ts/src/cloud/task.d.ts +18 -0
- package/lib/ts/src/networks.d.ts +20 -0
- package/lib/ts/src/utils/fee.d.ts +4 -0
- package/lib/ts/src/utils/fee.js +5 -1
- package/lib/ts/src/utils/fetch.d.ts +20 -0
- package/lib/ts/src/utils/fetch.js +20 -0
- package/lib/ts/src/utils/fields.d.ts +10 -0
- package/lib/ts/src/utils/fields.js +10 -0
- package/lib/ts/src/utils/mina.d.ts +24 -0
- package/lib/ts/src/utils/mina.js +18 -0
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/api/api.d.ts +39 -27
- package/lib/web/src/api/api.js +28 -27
- package/lib/web/src/api/api.js.map +1 -1
- package/lib/web/src/cloud/cloud.d.ts +176 -0
- package/lib/web/src/cloud/cloud.js +72 -3
- package/lib/web/src/cloud/cloud.js.map +1 -1
- package/lib/web/src/cloud/job.d.ts +47 -0
- package/lib/web/src/cloud/local.d.ts +157 -1
- package/lib/web/src/cloud/local.js +157 -3
- package/lib/web/src/cloud/local.js.map +1 -1
- package/lib/web/src/cloud/task.d.ts +18 -0
- package/lib/web/src/networks.d.ts +20 -0
- package/lib/web/src/networks.js.map +1 -1
- package/lib/web/src/utils/fee.d.ts +4 -0
- package/lib/web/src/utils/fee.js +5 -1
- package/lib/web/src/utils/fee.js.map +1 -1
- package/lib/web/src/utils/fetch.d.ts +20 -0
- package/lib/web/src/utils/fetch.js +20 -0
- package/lib/web/src/utils/fetch.js.map +1 -1
- package/lib/web/src/utils/fields.d.ts +10 -0
- package/lib/web/src/utils/fields.js +10 -0
- package/lib/web/src/utils/fields.js.map +1 -1
- package/lib/web/src/utils/mina.d.ts +24 -0
- package/lib/web/src/utils/mina.js +18 -0
- package/lib/web/src/utils/mina.js.map +1 -1
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -5,8 +5,24 @@ import { TaskData } from "./task";
|
|
5
5
|
import { blockchain } from "../networks";
|
6
6
|
import { CloudTransaction, DeployerKeyPair } from "./cloud";
|
7
7
|
import { ApiCommand } from "../api/api";
|
8
|
+
/**
|
9
|
+
* LocalCloud is a cloud that runs on the local machine for testing and development
|
10
|
+
* It uses LocalStorage to store jobs, tasks, transactions, and data
|
11
|
+
* It uses a localWorker to execute the tasks
|
12
|
+
* It can be used to test the cloud functionality without deploying to the cloud
|
13
|
+
* @param localWorker the worker to execute the tasks
|
14
|
+
*/
|
8
15
|
export declare class LocalCloud extends Cloud {
|
9
16
|
readonly localWorker: (cloud: Cloud) => Promise<zkCloudWorker>;
|
17
|
+
/**
|
18
|
+
* Constructor for LocalCloud
|
19
|
+
* @param params the parameters to create the LocalCloud
|
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
|
+
*/
|
10
26
|
constructor(params: {
|
11
27
|
job: JobData;
|
12
28
|
chain: blockchain;
|
@@ -14,21 +30,80 @@ export declare class LocalCloud extends Cloud {
|
|
14
30
|
stepId?: string;
|
15
31
|
localWorker: (cloud: Cloud) => Promise<zkCloudWorker>;
|
16
32
|
});
|
33
|
+
/**
|
34
|
+
* Provides the deployer key pair for testing and development
|
35
|
+
* @returns the deployer key pair
|
36
|
+
*/
|
17
37
|
getDeployer(): Promise<DeployerKeyPair | undefined>;
|
38
|
+
/**
|
39
|
+
* Releases the deployer key pair
|
40
|
+
*/
|
18
41
|
releaseDeployer(params: {
|
19
42
|
publicKey: string;
|
20
43
|
txsHashes: string[];
|
21
44
|
}): Promise<void>;
|
22
|
-
|
45
|
+
/**
|
46
|
+
* Gets the data by key
|
47
|
+
* @param key the key to get the data
|
48
|
+
* @returns the data
|
49
|
+
*/
|
23
50
|
getDataByKey(key: string): Promise<string | undefined>;
|
51
|
+
/**
|
52
|
+
* Saves the data by key
|
53
|
+
* @param key the key to save the data
|
54
|
+
* @param value the value to save
|
55
|
+
*/
|
24
56
|
saveDataByKey(key: string, value: string | undefined): Promise<void>;
|
57
|
+
/**
|
58
|
+
* Saves the file
|
59
|
+
* @param filename the filename to save
|
60
|
+
* @param value the value to save
|
61
|
+
*/
|
25
62
|
saveFile(filename: string, value: Buffer): Promise<void>;
|
63
|
+
/**
|
64
|
+
* Loads the file
|
65
|
+
* @param filename
|
66
|
+
* @returns the file data
|
67
|
+
*/
|
26
68
|
loadFile(filename: string): Promise<Buffer | undefined>;
|
69
|
+
/**
|
70
|
+
* Loads the environment
|
71
|
+
* @param password
|
72
|
+
*/
|
27
73
|
loadEnvironment(password: string): Promise<void>;
|
74
|
+
/**
|
75
|
+
* Generates an id for local cloud
|
76
|
+
* @returns generated unique id
|
77
|
+
*/
|
28
78
|
private static generateId;
|
79
|
+
/**
|
80
|
+
* Adds transactions to the local cloud
|
81
|
+
* @param transactions the transactions to add
|
82
|
+
* @returns the transaction ids
|
83
|
+
*/
|
29
84
|
static addTransactions(transactions: string[]): Promise<string[]>;
|
85
|
+
/**
|
86
|
+
* Deletes a transaction from the local cloud
|
87
|
+
* @param txId the transaction id to delete
|
88
|
+
*/
|
30
89
|
deleteTransaction(txId: string): Promise<void>;
|
31
90
|
getTransactions(): Promise<CloudTransaction[]>;
|
91
|
+
/**
|
92
|
+
* Runs the worker in the local cloud
|
93
|
+
* @param params the parameters to run the worker
|
94
|
+
* @param params.command the command to run
|
95
|
+
* @param params.data the data to use
|
96
|
+
* @param params.data.developer the developer of the repo
|
97
|
+
* @param params.data.repo the repo
|
98
|
+
* @param params.data.transactions the transactions to process
|
99
|
+
* @param params.data.task the task to execute
|
100
|
+
* @param params.data.userId the user id
|
101
|
+
* @param params.data.args the arguments for the job
|
102
|
+
* @param params.data.metadata the metadata for the job
|
103
|
+
* @param params.chain the blockchain to execute the job on
|
104
|
+
* @param params.localWorker the worker to execute the tasks
|
105
|
+
* @returns the job id
|
106
|
+
*/
|
32
107
|
static run(params: {
|
33
108
|
command: ApiCommand;
|
34
109
|
data: {
|
@@ -43,6 +118,16 @@ export declare class LocalCloud extends Cloud {
|
|
43
118
|
chain: blockchain;
|
44
119
|
localWorker: (cloud: Cloud) => Promise<zkCloudWorker>;
|
45
120
|
}): Promise<string>;
|
121
|
+
/**
|
122
|
+
* Runs the recursive proof in the local cloud
|
123
|
+
* @param data the data to use
|
124
|
+
* @param data.transactions the transactions to process
|
125
|
+
* @param data.task the task to execute
|
126
|
+
* @param data.userId the user id
|
127
|
+
* @param data.args the arguments for the job
|
128
|
+
* @param data.metadata the metadata for the job
|
129
|
+
* @returns the job id
|
130
|
+
*/
|
46
131
|
recursiveProof(data: {
|
47
132
|
transactions: string[];
|
48
133
|
task?: string;
|
@@ -50,6 +135,16 @@ export declare class LocalCloud extends Cloud {
|
|
50
135
|
args?: string;
|
51
136
|
metadata?: string;
|
52
137
|
}): Promise<string>;
|
138
|
+
/**
|
139
|
+
* Executes the task in the local cloud
|
140
|
+
* @param data the data to use
|
141
|
+
* @param data.transactions the transactions to process
|
142
|
+
* @param data.task the task to execute
|
143
|
+
* @param data.userId the user id
|
144
|
+
* @param data.args the arguments for the job
|
145
|
+
* @param data.metadata the metadata for the job
|
146
|
+
* @returns the job id
|
147
|
+
*/
|
53
148
|
execute(data: {
|
54
149
|
transactions: string[];
|
55
150
|
task: string;
|
@@ -57,7 +152,22 @@ export declare class LocalCloud extends Cloud {
|
|
57
152
|
args?: string;
|
58
153
|
metadata?: string;
|
59
154
|
}): Promise<string>;
|
155
|
+
/**
|
156
|
+
* Gets the job result
|
157
|
+
* @param jobId the job id
|
158
|
+
* @returns the job data
|
159
|
+
*/
|
60
160
|
jobResult(jobId: string): Promise<JobData | undefined>;
|
161
|
+
/**
|
162
|
+
* Adds a task to the local cloud
|
163
|
+
* @param data the data to use
|
164
|
+
* @param data.task the task to execute
|
165
|
+
* @param data.startTime the start time for the task
|
166
|
+
* @param data.userId the user id
|
167
|
+
* @param data.args the arguments for the job
|
168
|
+
* @param data.metadata the metadata for the job
|
169
|
+
* @returns the task id
|
170
|
+
*/
|
61
171
|
addTask(data: {
|
62
172
|
task: string;
|
63
173
|
startTime?: number;
|
@@ -65,14 +175,43 @@ export declare class LocalCloud extends Cloud {
|
|
65
175
|
args?: string;
|
66
176
|
metadata?: string;
|
67
177
|
}): Promise<string>;
|
178
|
+
/**
|
179
|
+
* Deletes a task from the local cloud
|
180
|
+
* @param taskId the task id to delete
|
181
|
+
*/
|
68
182
|
deleteTask(taskId: string): Promise<void>;
|
183
|
+
/**
|
184
|
+
* Processes the tasks in the local cloud
|
185
|
+
*/
|
69
186
|
processTasks(): Promise<void>;
|
187
|
+
/**
|
188
|
+
* Processes the local tasks
|
189
|
+
* @param params the parameters to process the local tasks
|
190
|
+
* @param params.developer the developer of the repo
|
191
|
+
* @param params.repo the repo
|
192
|
+
* @param params.localWorker the worker to execute the tasks
|
193
|
+
* @param params.chain the blockchain to execute the job on
|
194
|
+
*/
|
70
195
|
static processLocalTasks(params: {
|
71
196
|
developer: string;
|
72
197
|
repo: string;
|
73
198
|
localWorker: (cloud: Cloud) => Promise<zkCloudWorker>;
|
74
199
|
chain: blockchain;
|
75
200
|
}): Promise<number>;
|
201
|
+
/**
|
202
|
+
* Runs the sequencer in the local cloud
|
203
|
+
* @param params the parameters to run the sequencer
|
204
|
+
* @param params.worker the worker to execute the tasks
|
205
|
+
* @param params.data the data to use
|
206
|
+
* @param params.data.developer the developer of the repo
|
207
|
+
* @param params.data.repo the repo
|
208
|
+
* @param params.data.transactions the transactions to process
|
209
|
+
* @param params.data.task the task to execute
|
210
|
+
* @param params.data.userId the user id
|
211
|
+
* @param params.data.args the arguments for the job
|
212
|
+
* @param params.data.metadata the metadata for the job
|
213
|
+
* @returns the proof
|
214
|
+
*/
|
76
215
|
static sequencer(params: {
|
77
216
|
worker: zkCloudWorker;
|
78
217
|
data: {
|
@@ -86,6 +225,15 @@ export declare class LocalCloud extends Cloud {
|
|
86
225
|
};
|
87
226
|
}): Promise<string>;
|
88
227
|
}
|
228
|
+
/**
|
229
|
+
* LocalStorage is a local storage for the local cloud
|
230
|
+
* It stores jobs, tasks, transactions, and data
|
231
|
+
* It can be used to test the cloud functionality without deploying to the cloud
|
232
|
+
* @param jobs the jobs
|
233
|
+
* @param data the data
|
234
|
+
* @param transactions the transactions
|
235
|
+
* @param tasks the tasks
|
236
|
+
*/
|
89
237
|
export declare class LocalStorage {
|
90
238
|
static jobs: {
|
91
239
|
[key: string]: JobData;
|
@@ -102,6 +250,14 @@ export declare class LocalStorage {
|
|
102
250
|
static tasks: {
|
103
251
|
[key: string]: TaskData;
|
104
252
|
};
|
253
|
+
/**
|
254
|
+
* Saves the data
|
255
|
+
* @param name the name to save the data
|
256
|
+
*/
|
105
257
|
static saveData(name: string): Promise<void>;
|
258
|
+
/**
|
259
|
+
* Loads the data
|
260
|
+
* @param name the name to load the data
|
261
|
+
*/
|
106
262
|
static loadData(name: string): Promise<void>;
|
107
263
|
}
|
@@ -1,7 +1,23 @@
|
|
1
1
|
import { Cloud } from "./cloud";
|
2
2
|
import { makeString } from "../utils/utils";
|
3
3
|
import { saveFile, loadFile, saveBinaryFile, loadBinaryFile } from "./files";
|
4
|
+
/**
|
5
|
+
* LocalCloud is a cloud that runs on the local machine for testing and development
|
6
|
+
* It uses LocalStorage to store jobs, tasks, transactions, and data
|
7
|
+
* It uses a localWorker to execute the tasks
|
8
|
+
* It can be used to test the cloud functionality without deploying to the cloud
|
9
|
+
* @param localWorker the worker to execute the tasks
|
10
|
+
*/
|
4
11
|
export class LocalCloud extends Cloud {
|
12
|
+
/**
|
13
|
+
* Constructor for LocalCloud
|
14
|
+
* @param params the parameters to create the LocalCloud
|
15
|
+
* @param params.job the job data
|
16
|
+
* @param params.chain the blockchain to execute the job on, can be any blockchain, not only local
|
17
|
+
* @param params.cache the cache folder
|
18
|
+
* @param params.stepId the step id
|
19
|
+
* @param params.localWorker the worker to execute the tasks
|
20
|
+
*/
|
5
21
|
constructor(params) {
|
6
22
|
const { job, chain, cache, stepId, localWorker } = params;
|
7
23
|
const { id, jobId, developer, repo, task, userId, args, metadata, taskId } = job;
|
@@ -22,6 +38,10 @@ export class LocalCloud extends Cloud {
|
|
22
38
|
});
|
23
39
|
this.localWorker = localWorker;
|
24
40
|
}
|
41
|
+
/**
|
42
|
+
* Provides the deployer key pair for testing and development
|
43
|
+
* @returns the deployer key pair
|
44
|
+
*/
|
25
45
|
async getDeployer() {
|
26
46
|
const privateKey = process.env.DEPLOYER_PRIVATE_KEY;
|
27
47
|
const publicKey = process.env.DEPLOYER_PUBLIC_KEY;
|
@@ -38,35 +58,68 @@ export class LocalCloud extends Cloud {
|
|
38
58
|
return undefined;
|
39
59
|
}
|
40
60
|
}
|
61
|
+
/**
|
62
|
+
* Releases the deployer key pair
|
63
|
+
*/
|
41
64
|
async releaseDeployer(params) {
|
42
65
|
console.log("LocalCloud: releaseDeployer", params);
|
43
66
|
}
|
44
|
-
|
45
|
-
|
46
|
-
|
67
|
+
/**
|
68
|
+
* Gets the data by key
|
69
|
+
* @param key the key to get the data
|
70
|
+
* @returns the data
|
71
|
+
*/
|
47
72
|
async getDataByKey(key) {
|
48
73
|
const value = LocalStorage.data[key];
|
49
74
|
return value;
|
50
75
|
}
|
76
|
+
/**
|
77
|
+
* Saves the data by key
|
78
|
+
* @param key the key to save the data
|
79
|
+
* @param value the value to save
|
80
|
+
*/
|
51
81
|
async saveDataByKey(key, value) {
|
52
82
|
if (value !== undefined)
|
53
83
|
LocalStorage.data[key] = value;
|
54
84
|
else
|
55
85
|
delete LocalStorage.data[key];
|
56
86
|
}
|
87
|
+
/**
|
88
|
+
* Saves the file
|
89
|
+
* @param filename the filename to save
|
90
|
+
* @param value the value to save
|
91
|
+
*/
|
57
92
|
async saveFile(filename, value) {
|
58
93
|
await saveBinaryFile({ data: value, filename });
|
59
94
|
}
|
95
|
+
/**
|
96
|
+
* Loads the file
|
97
|
+
* @param filename
|
98
|
+
* @returns the file data
|
99
|
+
*/
|
60
100
|
async loadFile(filename) {
|
61
101
|
const data = await loadBinaryFile(filename);
|
62
102
|
return data;
|
63
103
|
}
|
104
|
+
/**
|
105
|
+
* Loads the environment
|
106
|
+
* @param password
|
107
|
+
*/
|
64
108
|
async loadEnvironment(password) {
|
65
109
|
throw new Error("Method not implemented.");
|
66
110
|
}
|
111
|
+
/**
|
112
|
+
* Generates an id for local cloud
|
113
|
+
* @returns generated unique id
|
114
|
+
*/
|
67
115
|
static generateId() {
|
68
116
|
return "local." + Date.now().toString() + "." + makeString(32);
|
69
117
|
}
|
118
|
+
/**
|
119
|
+
* Adds transactions to the local cloud
|
120
|
+
* @param transactions the transactions to add
|
121
|
+
* @returns the transaction ids
|
122
|
+
*/
|
70
123
|
static async addTransactions(transactions) {
|
71
124
|
const timeReceived = Date.now();
|
72
125
|
const txId = [];
|
@@ -77,6 +130,10 @@ export class LocalCloud extends Cloud {
|
|
77
130
|
});
|
78
131
|
return txId;
|
79
132
|
}
|
133
|
+
/**
|
134
|
+
* Deletes a transaction from the local cloud
|
135
|
+
* @param txId the transaction id to delete
|
136
|
+
*/
|
80
137
|
async deleteTransaction(txId) {
|
81
138
|
if (LocalStorage.transactions[txId] === undefined)
|
82
139
|
throw new Error(`deleteTransaction: Transaction ${txId} not found`);
|
@@ -93,6 +150,22 @@ export class LocalCloud extends Cloud {
|
|
93
150
|
});
|
94
151
|
return txs;
|
95
152
|
}
|
153
|
+
/**
|
154
|
+
* Runs the worker in the local cloud
|
155
|
+
* @param params the parameters to run the worker
|
156
|
+
* @param params.command the command to run
|
157
|
+
* @param params.data the data to use
|
158
|
+
* @param params.data.developer the developer of the repo
|
159
|
+
* @param params.data.repo the repo
|
160
|
+
* @param params.data.transactions the transactions to process
|
161
|
+
* @param params.data.task the task to execute
|
162
|
+
* @param params.data.userId the user id
|
163
|
+
* @param params.data.args the arguments for the job
|
164
|
+
* @param params.data.metadata the metadata for the job
|
165
|
+
* @param params.chain the blockchain to execute the job on
|
166
|
+
* @param params.localWorker the worker to execute the tasks
|
167
|
+
* @returns the job id
|
168
|
+
*/
|
96
169
|
static async run(params) {
|
97
170
|
const { command, data, chain, localWorker } = params;
|
98
171
|
const { developer, repo, transactions, task, userId, args, metadata } = data;
|
@@ -145,6 +218,16 @@ export class LocalCloud extends Cloud {
|
|
145
218
|
LocalStorage.jobs[jobId] = job;
|
146
219
|
return jobId;
|
147
220
|
}
|
221
|
+
/**
|
222
|
+
* Runs the recursive proof in the local cloud
|
223
|
+
* @param data the data to use
|
224
|
+
* @param data.transactions the transactions to process
|
225
|
+
* @param data.task the task to execute
|
226
|
+
* @param data.userId the user id
|
227
|
+
* @param data.args the arguments for the job
|
228
|
+
* @param data.metadata the metadata for the job
|
229
|
+
* @returns the job id
|
230
|
+
*/
|
148
231
|
async recursiveProof(data) {
|
149
232
|
return await LocalCloud.run({
|
150
233
|
command: "recursiveProof",
|
@@ -161,6 +244,16 @@ export class LocalCloud extends Cloud {
|
|
161
244
|
localWorker: this.localWorker,
|
162
245
|
});
|
163
246
|
}
|
247
|
+
/**
|
248
|
+
* Executes the task in the local cloud
|
249
|
+
* @param data the data to use
|
250
|
+
* @param data.transactions the transactions to process
|
251
|
+
* @param data.task the task to execute
|
252
|
+
* @param data.userId the user id
|
253
|
+
* @param data.args the arguments for the job
|
254
|
+
* @param data.metadata the metadata for the job
|
255
|
+
* @returns the job id
|
256
|
+
*/
|
164
257
|
async execute(data) {
|
165
258
|
return await LocalCloud.run({
|
166
259
|
command: "execute",
|
@@ -177,9 +270,24 @@ export class LocalCloud extends Cloud {
|
|
177
270
|
localWorker: this.localWorker,
|
178
271
|
});
|
179
272
|
}
|
273
|
+
/**
|
274
|
+
* Gets the job result
|
275
|
+
* @param jobId the job id
|
276
|
+
* @returns the job data
|
277
|
+
*/
|
180
278
|
async jobResult(jobId) {
|
181
279
|
return LocalStorage.jobs[jobId];
|
182
280
|
}
|
281
|
+
/**
|
282
|
+
* Adds a task to the local cloud
|
283
|
+
* @param data the data to use
|
284
|
+
* @param data.task the task to execute
|
285
|
+
* @param data.startTime the start time for the task
|
286
|
+
* @param data.userId the user id
|
287
|
+
* @param data.args the arguments for the job
|
288
|
+
* @param data.metadata the metadata for the job
|
289
|
+
* @returns the task id
|
290
|
+
*/
|
183
291
|
async addTask(data) {
|
184
292
|
const taskId = LocalCloud.generateId();
|
185
293
|
LocalStorage.tasks[taskId] = {
|
@@ -193,11 +301,18 @@ export class LocalCloud extends Cloud {
|
|
193
301
|
};
|
194
302
|
return taskId;
|
195
303
|
}
|
304
|
+
/**
|
305
|
+
* Deletes a task from the local cloud
|
306
|
+
* @param taskId the task id to delete
|
307
|
+
*/
|
196
308
|
async deleteTask(taskId) {
|
197
309
|
if (LocalStorage.tasks[taskId] === undefined)
|
198
310
|
throw new Error(`deleteTask: Task ${taskId} not found`);
|
199
311
|
delete LocalStorage.tasks[taskId];
|
200
312
|
}
|
313
|
+
/**
|
314
|
+
* Processes the tasks in the local cloud
|
315
|
+
*/
|
201
316
|
async processTasks() {
|
202
317
|
await LocalCloud.processLocalTasks({
|
203
318
|
developer: this.developer,
|
@@ -206,6 +321,14 @@ export class LocalCloud extends Cloud {
|
|
206
321
|
chain: this.chain,
|
207
322
|
});
|
208
323
|
}
|
324
|
+
/**
|
325
|
+
* Processes the local tasks
|
326
|
+
* @param params the parameters to process the local tasks
|
327
|
+
* @param params.developer the developer of the repo
|
328
|
+
* @param params.repo the repo
|
329
|
+
* @param params.localWorker the worker to execute the tasks
|
330
|
+
* @param params.chain the blockchain to execute the job on
|
331
|
+
*/
|
209
332
|
static async processLocalTasks(params) {
|
210
333
|
const { developer, repo, localWorker, chain } = params;
|
211
334
|
for (const taskId in LocalStorage.tasks) {
|
@@ -255,6 +378,20 @@ export class LocalCloud extends Cloud {
|
|
255
378
|
count++;
|
256
379
|
return count;
|
257
380
|
}
|
381
|
+
/**
|
382
|
+
* Runs the sequencer in the local cloud
|
383
|
+
* @param params the parameters to run the sequencer
|
384
|
+
* @param params.worker the worker to execute the tasks
|
385
|
+
* @param params.data the data to use
|
386
|
+
* @param params.data.developer the developer of the repo
|
387
|
+
* @param params.data.repo the repo
|
388
|
+
* @param params.data.transactions the transactions to process
|
389
|
+
* @param params.data.task the task to execute
|
390
|
+
* @param params.data.userId the user id
|
391
|
+
* @param params.data.args the arguments for the job
|
392
|
+
* @param params.data.metadata the metadata for the job
|
393
|
+
* @returns the proof
|
394
|
+
*/
|
258
395
|
static async sequencer(params) {
|
259
396
|
const { worker, data } = params;
|
260
397
|
const { transactions } = data;
|
@@ -277,7 +414,20 @@ export class LocalCloud extends Cloud {
|
|
277
414
|
return proof;
|
278
415
|
}
|
279
416
|
}
|
417
|
+
/**
|
418
|
+
* LocalStorage is a local storage for the local cloud
|
419
|
+
* It stores jobs, tasks, transactions, and data
|
420
|
+
* It can be used to test the cloud functionality without deploying to the cloud
|
421
|
+
* @param jobs the jobs
|
422
|
+
* @param data the data
|
423
|
+
* @param transactions the transactions
|
424
|
+
* @param tasks the tasks
|
425
|
+
*/
|
280
426
|
export class LocalStorage {
|
427
|
+
/**
|
428
|
+
* Saves the data
|
429
|
+
* @param name the name to save the data
|
430
|
+
*/
|
281
431
|
static async saveData(name) {
|
282
432
|
const data = {
|
283
433
|
jobs: LocalStorage.jobs,
|
@@ -288,6 +438,10 @@ export class LocalStorage {
|
|
288
438
|
const filename = name + ".cloud";
|
289
439
|
await saveFile({ data, filename });
|
290
440
|
}
|
441
|
+
/**
|
442
|
+
* Loads the data
|
443
|
+
* @param name the name to load the data
|
444
|
+
*/
|
291
445
|
static async loadData(name) {
|
292
446
|
const filename = name + ".cloud";
|
293
447
|
const data = await loadFile(filename);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../../../src/cloud/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI7E,MAAM,OAAO,UAAW,SAAQ,KAAK;
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../../../src/cloud/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI7E;;;;;;GAMG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAGnC;;;;;;;;OAQG;IACH,YAAY,MAMX;QACC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;QAE1D,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GACxE,GAAG,CAAC;QACN,KAAK,CAAC;YACJ,EAAE,EAAE,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM,IAAI,QAAQ;YAC1B,MAAM,EAAE,MAAM,IAAI,QAAQ;YAC1B,KAAK,EAAE,KAAK,IAAI,SAAS;YACzB,SAAS,EAAE,SAAS;YACpB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YAC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GAAG,IAAI,GAAG,QAAQ,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtC,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO;QAC/B,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC9B,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC9B,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAC9C,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAClC,CAAC;;AAlCM,iBAAI,GAA+B,EAAE,CAAC;AACtC,iBAAI,GAA8B,EAAE,CAAC;AACrC,yBAAY,GAEf,EAAE,CAAC;AACA,kBAAK,GAAgC,EAAE,CAAC"}
|
@@ -1,4 +1,22 @@
|
|
1
1
|
import { blockchain } from "../networks";
|
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
|
19
|
+
*/
|
2
20
|
export interface TaskData {
|
3
21
|
id: string;
|
4
22
|
taskId: string;
|
@@ -1,5 +1,25 @@
|
|
1
1
|
export { blockchain, MinaNetwork, networks, Mainnet, Devnet, Zeko, Lightnet, Local, };
|
2
|
+
/**
|
3
|
+
* blockchain is the type for the chain id
|
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
|
10
|
+
*/
|
2
11
|
type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko" | "mainnet";
|
12
|
+
/**
|
13
|
+
* 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
|
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
|
22
|
+
*/
|
3
23
|
interface MinaNetwork {
|
4
24
|
mina: string[];
|
5
25
|
archive: string[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../../../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,CAAC;
|
1
|
+
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../../../../src/networks.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,CAAC;AAyCF,MAAM,OAAO,GAAgB;IAC3B,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,MAAM,KAAK,GAAgB;IACzB,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,OAAO;CACjB,CAAC;AAEF,MAAM,MAAM,GAAgB;IAC1B,IAAI,EAAE;QACJ,gDAAgD;QAChD,kDAAkD;KACnD;IACD,OAAO,EAAE;QACP,mDAAmD;QACnD,4CAA4C;KAC7C;IACD,kBAAkB,EAAE,qCAAqC;IACzD,sBAAsB,EAAE,gCAAgC;IACxD,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,iCAAiC;CAC1C,CAAC;AAEF,MAAM,IAAI,GAAgB;IACxB,IAAI,EAAE,CAAC,gCAAgC,CAAC;IACxC,OAAO,EAAE,EAAE;IACX,kBAAkB,EAAE,qCAAqC;IACzD,sBAAsB,EAAE,gCAAgC;IACxD,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,wBAAwB;CACjC,CAAC;AAEF,MAAM,QAAQ,GAAgB;IAC5B,IAAI,EAAE,CAAC,+BAA+B,CAAC;IACvC,OAAO,EAAE,CAAC,uBAAuB,CAAC;IAClC,cAAc,EAAE,uBAAuB;IACvC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,MAAM,QAAQ,GAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BE"}
|
package/lib/web/src/utils/fee.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
import { UInt64 } from "o1js";
|
2
2
|
import config from "../config";
|
3
|
+
/**
|
4
|
+
* Calculate the fee for a transaction
|
5
|
+
* @returns the fee for a transaction
|
6
|
+
*/
|
3
7
|
export async function fee() {
|
4
|
-
//TODO: update after mainnet launch
|
8
|
+
//TODO: update after mainnet launch and resolution of the issue https://github.com/o1-labs/o1js/issues/1626
|
5
9
|
return UInt64.fromJSON(config.MINAFEE);
|
6
10
|
}
|
7
11
|
//# sourceMappingURL=fee.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fee.js","sourceRoot":"","sources":["../../../../../src/utils/fee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,
|
1
|
+
{"version":3,"file":"fee.js","sourceRoot":"","sources":["../../../../../src/utils/fee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,2GAA2G;IAC3G,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
|