@silvana-one/prover 0.2.0

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 (98) hide show
  1. package/README.md +1 -0
  2. package/dist/node/config.d.ts +8 -0
  3. package/dist/node/config.js +9 -0
  4. package/dist/node/config.js.map +1 -0
  5. package/dist/node/index.cjs +551 -0
  6. package/dist/node/index.d.ts +4 -0
  7. package/dist/node/index.js +5 -0
  8. package/dist/node/index.js.map +1 -0
  9. package/dist/node/networks.d.ts +32 -0
  10. package/dist/node/networks.js +81 -0
  11. package/dist/node/networks.js.map +1 -0
  12. package/dist/node/utils/base64.d.ts +6 -0
  13. package/dist/node/utils/base64.js +83 -0
  14. package/dist/node/utils/base64.js.map +1 -0
  15. package/dist/node/utils/graphql.d.ts +11 -0
  16. package/dist/node/utils/graphql.js +225 -0
  17. package/dist/node/utils/graphql.js.map +1 -0
  18. package/dist/node/utils/index.d.ts +3 -0
  19. package/dist/node/utils/index.js +4 -0
  20. package/dist/node/utils/index.js.map +1 -0
  21. package/dist/node/utils/utils.d.ts +8 -0
  22. package/dist/node/utils/utils.js +61 -0
  23. package/dist/node/utils/utils.js.map +1 -0
  24. package/dist/node/worker/cloud.d.ts +250 -0
  25. package/dist/node/worker/cloud.js +54 -0
  26. package/dist/node/worker/cloud.js.map +1 -0
  27. package/dist/node/worker/index.d.ts +5 -0
  28. package/dist/node/worker/index.js +6 -0
  29. package/dist/node/worker/index.js.map +1 -0
  30. package/dist/node/worker/job.d.ts +87 -0
  31. package/dist/node/worker/job.js +2 -0
  32. package/dist/node/worker/job.js.map +1 -0
  33. package/dist/node/worker/task.d.ts +32 -0
  34. package/dist/node/worker/task.js +2 -0
  35. package/dist/node/worker/task.js.map +1 -0
  36. package/dist/node/worker/transaction.d.ts +11 -0
  37. package/dist/node/worker/transaction.js +8 -0
  38. package/dist/node/worker/transaction.js.map +1 -0
  39. package/dist/node/worker/worker.d.ts +40 -0
  40. package/dist/node/worker/worker.js +53 -0
  41. package/dist/node/worker/worker.js.map +1 -0
  42. package/dist/tsconfig.tsbuildinfo +1 -0
  43. package/dist/tsconfig.web.tsbuildinfo +1 -0
  44. package/dist/web/config.d.ts +8 -0
  45. package/dist/web/config.js +9 -0
  46. package/dist/web/config.js.map +1 -0
  47. package/dist/web/index.d.ts +4 -0
  48. package/dist/web/index.js +5 -0
  49. package/dist/web/index.js.map +1 -0
  50. package/dist/web/networks.d.ts +32 -0
  51. package/dist/web/networks.js +81 -0
  52. package/dist/web/networks.js.map +1 -0
  53. package/dist/web/utils/base64.d.ts +6 -0
  54. package/dist/web/utils/base64.js +83 -0
  55. package/dist/web/utils/base64.js.map +1 -0
  56. package/dist/web/utils/graphql.d.ts +11 -0
  57. package/dist/web/utils/graphql.js +225 -0
  58. package/dist/web/utils/graphql.js.map +1 -0
  59. package/dist/web/utils/index.d.ts +3 -0
  60. package/dist/web/utils/index.js +4 -0
  61. package/dist/web/utils/index.js.map +1 -0
  62. package/dist/web/utils/utils.d.ts +8 -0
  63. package/dist/web/utils/utils.js +61 -0
  64. package/dist/web/utils/utils.js.map +1 -0
  65. package/dist/web/worker/cloud.d.ts +250 -0
  66. package/dist/web/worker/cloud.js +54 -0
  67. package/dist/web/worker/cloud.js.map +1 -0
  68. package/dist/web/worker/index.d.ts +5 -0
  69. package/dist/web/worker/index.js +6 -0
  70. package/dist/web/worker/index.js.map +1 -0
  71. package/dist/web/worker/job.d.ts +87 -0
  72. package/dist/web/worker/job.js +2 -0
  73. package/dist/web/worker/job.js.map +1 -0
  74. package/dist/web/worker/task.d.ts +32 -0
  75. package/dist/web/worker/task.js +2 -0
  76. package/dist/web/worker/task.js.map +1 -0
  77. package/dist/web/worker/transaction.d.ts +11 -0
  78. package/dist/web/worker/transaction.js +8 -0
  79. package/dist/web/worker/transaction.js.map +1 -0
  80. package/dist/web/worker/worker.d.ts +40 -0
  81. package/dist/web/worker/worker.js +53 -0
  82. package/dist/web/worker/worker.js.map +1 -0
  83. package/package.json +59 -0
  84. package/src/LICENSE +201 -0
  85. package/src/README.md +77 -0
  86. package/src/config.ts +10 -0
  87. package/src/index.ts +4 -0
  88. package/src/networks.ts +130 -0
  89. package/src/utils/base64.ts +87 -0
  90. package/src/utils/graphql.ts +252 -0
  91. package/src/utils/index.ts +3 -0
  92. package/src/utils/utils.ts +79 -0
  93. package/src/worker/cloud.ts +326 -0
  94. package/src/worker/index.ts +5 -0
  95. package/src/worker/job.ts +123 -0
  96. package/src/worker/task.ts +45 -0
  97. package/src/worker/transaction.ts +12 -0
  98. package/src/worker/worker.ts +62 -0
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # Silvana Prover
@@ -0,0 +1,8 @@
1
+ declare const config: {
2
+ MINAFEE: string;
3
+ ZKCLOUDWORKER_AUTH: string;
4
+ ZKCLOUDWORKER_API: string;
5
+ ZKCLOUDWORKER_NATS: string;
6
+ ZKCLOUDWORKER_NATS_WS: string;
7
+ };
8
+ export { config };
@@ -0,0 +1,9 @@
1
+ const config = {
2
+ MINAFEE: "200000000",
3
+ ZKCLOUDWORKER_AUTH: "M6t4jtbBAFFXhLERHQWyEB9JA9xi4cWqmYduaCXtbrFjb7yaY7TyaXDunKDJNiUTBEcyUomNXJgC",
4
+ ZKCLOUDWORKER_API: "https://api.zkcloudworker.com/v1/",
5
+ ZKCLOUDWORKER_NATS: "https://cloud.zkcloudworker.com:4222",
6
+ ZKCLOUDWORKER_NATS_WS: "wss://cloud.zkcloudworker.com:4223",
7
+ };
8
+ export { config };
9
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,WAAW;IACpB,kBAAkB,EAChB,8EAA8E;IAChF,iBAAiB,EAAE,mCAAmC;IACtD,kBAAkB,EAAE,sCAAsC;IAC1D,qBAAqB,EAAE,oCAAoC;CAC5D,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,551 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // dist/node/index.js
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Cloud: () => Cloud,
24
+ Devnet: () => Devnet,
25
+ Lightnet: () => Lightnet,
26
+ Local: () => Local,
27
+ Mainnet: () => Mainnet,
28
+ Memory: () => Memory,
29
+ Zeko: () => Zeko,
30
+ bigintFromBase56: () => bigintFromBase56,
31
+ bigintFromBase64: () => bigintFromBase64,
32
+ bigintToBase56: () => bigintToBase56,
33
+ bigintToBase64: () => bigintToBase64,
34
+ config: () => config,
35
+ defaultToken: () => defaultToken,
36
+ formatTime: () => formatTime,
37
+ fromBase: () => fromBase,
38
+ getAccountFromGraphQL: () => getAccountFromGraphQL,
39
+ getBalanceFromGraphQL: () => getBalanceFromGraphQL,
40
+ makeString: () => makeString,
41
+ networks: () => networks,
42
+ sleep: () => sleep,
43
+ toBase: () => toBase,
44
+ zkCloudWorker: () => zkCloudWorker
45
+ });
46
+ module.exports = __toCommonJS(index_exports);
47
+
48
+ // dist/node/utils/graphql.js
49
+ var defaultToken = "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf";
50
+ async function getBalanceFromGraphQL(params) {
51
+ const { publicKey, mina } = params;
52
+ const tokenId = params.tokenId ?? defaultToken;
53
+ if (mina.length === 0)
54
+ throw new Error("no mina endpoints provided");
55
+ const account = await fetchAccountInternal({
56
+ publicKey,
57
+ tokenId,
58
+ mina,
59
+ queryType: "balance"
60
+ });
61
+ const balance = account?.account?.balance?.total;
62
+ return balance ? BigInt(balance) : 0n;
63
+ }
64
+ async function getAccountFromGraphQL(params) {
65
+ const { publicKey, mina } = params;
66
+ const tokenId = params.tokenId ?? defaultToken;
67
+ if (mina.length === 0)
68
+ throw new Error("no mina endpoints provided");
69
+ const account = await fetchAccountInternal({
70
+ publicKey,
71
+ tokenId,
72
+ mina,
73
+ queryType: "account"
74
+ });
75
+ return account?.account;
76
+ }
77
+ async function fetchAccountInternal(params) {
78
+ const { publicKey, tokenId, mina, timeout, queryType } = params;
79
+ const query = queryType === "balance" ? balanceQuery(publicKey, tokenId) : accountQuery(publicKey, tokenId);
80
+ let [response, error] = await makeGraphqlRequest({
81
+ query,
82
+ mina,
83
+ timeout
84
+ });
85
+ if (error !== void 0)
86
+ return { account: void 0, error };
87
+ const account = response?.data?.account;
88
+ if (!account) {
89
+ return {
90
+ account: void 0,
91
+ error: {
92
+ statusCode: 404,
93
+ statusText: `fetchAccount: Account with public key ${publicKey} does not exist.`
94
+ }
95
+ };
96
+ }
97
+ return {
98
+ account,
99
+ error: void 0
100
+ };
101
+ }
102
+ async function makeGraphqlRequest(params) {
103
+ const defaultTimeout = 5 * 60 * 1e3;
104
+ const timeout = params.timeout ?? defaultTimeout;
105
+ const { query, mina } = params;
106
+ const graphqlEndpoint = mina[0];
107
+ const fallbackEndpoints = mina.slice(1);
108
+ if (graphqlEndpoint === "none")
109
+ throw Error("Should have made a graphql request, but don't know to which endpoint.");
110
+ let timeouts = [];
111
+ const clearTimeouts = () => {
112
+ timeouts.forEach((t) => clearTimeout(t));
113
+ timeouts = [];
114
+ };
115
+ const makeRequest = async (url) => {
116
+ const controller = new AbortController();
117
+ const timer = setTimeout(() => controller.abort(), timeout);
118
+ timeouts.push(timer);
119
+ let body = JSON.stringify({
120
+ operationName: null,
121
+ query,
122
+ variables: {}
123
+ });
124
+ try {
125
+ let response = await fetch(url, {
126
+ method: "POST",
127
+ headers: { "Content-Type": "application/json" },
128
+ body,
129
+ signal: controller.signal
130
+ });
131
+ return checkResponseStatus(response);
132
+ } finally {
133
+ clearTimeouts();
134
+ }
135
+ };
136
+ let timeoutErrors = [];
137
+ let urls = [graphqlEndpoint, ...fallbackEndpoints];
138
+ for (let i = 0; i < urls.length; i += 2) {
139
+ let url1 = urls[i];
140
+ let url2 = urls[i + 1];
141
+ if (url2 === void 0) {
142
+ try {
143
+ return await makeRequest(url1);
144
+ } catch (error) {
145
+ return [void 0, inferError(error)];
146
+ }
147
+ }
148
+ try {
149
+ return await Promise.race([makeRequest(url1), makeRequest(url2)]);
150
+ } catch (unknownError) {
151
+ let error = inferError(unknownError);
152
+ if (error.statusCode === 408) {
153
+ timeoutErrors.push({ url1, url2, error });
154
+ } else {
155
+ return [void 0, error];
156
+ }
157
+ }
158
+ }
159
+ const statusText = timeoutErrors.map(({ url1, url2, error }) => `Request to ${url1} and ${url2} timed out. Error: ${error}`).join("\n");
160
+ return [void 0, { statusCode: 408, statusText }];
161
+ }
162
+ function inferError(error) {
163
+ let errorMessage = JSON.stringify(error);
164
+ if (error instanceof AbortSignal) {
165
+ return { statusCode: 408, statusText: `Request Timeout: ${errorMessage}` };
166
+ } else {
167
+ return {
168
+ statusCode: 500,
169
+ statusText: `Unknown Error: ${errorMessage}`
170
+ };
171
+ }
172
+ }
173
+ async function checkResponseStatus(response) {
174
+ if (response.ok) {
175
+ const jsonResponse = await response.json();
176
+ if (jsonResponse.errors && jsonResponse.errors.length > 0) {
177
+ return [
178
+ void 0,
179
+ {
180
+ statusCode: response.status,
181
+ statusText: jsonResponse.errors.map((error) => error.message).join("\n")
182
+ }
183
+ ];
184
+ } else if (jsonResponse.data === void 0) {
185
+ return [
186
+ void 0,
187
+ {
188
+ statusCode: response.status,
189
+ statusText: `GraphQL response data is undefined`
190
+ }
191
+ ];
192
+ }
193
+ return [jsonResponse, void 0];
194
+ } else {
195
+ return [
196
+ void 0,
197
+ {
198
+ statusCode: response.status,
199
+ statusText: response.statusText
200
+ }
201
+ ];
202
+ }
203
+ }
204
+ var balanceQuery = (publicKey, tokenId) => `{
205
+ account(publicKey: "${publicKey}", token: "${tokenId}") {
206
+ balance { total }
207
+ }
208
+ }
209
+ `;
210
+ var accountQuery = (publicKey, tokenId) => `{
211
+ account(publicKey: "${publicKey}", token: "${tokenId}") {
212
+ publicKey
213
+ token
214
+ nonce
215
+ balance { total }
216
+ tokenSymbol
217
+ receiptChainHash
218
+ timing {
219
+ initialMinimumBalance
220
+ cliffTime
221
+ cliffAmount
222
+ vestingPeriod
223
+ vestingIncrement
224
+ }
225
+ permissions {
226
+ editState
227
+ access
228
+ send
229
+ receive
230
+ setDelegate
231
+ setPermissions
232
+ setVerificationKey {
233
+ auth
234
+ txnVersion
235
+ }
236
+ setZkappUri
237
+ editActionState
238
+ setTokenSymbol
239
+ incrementNonce
240
+ setVotingFor
241
+ setTiming
242
+ }
243
+ delegateAccount { publicKey }
244
+ votingFor
245
+ zkappState
246
+ verificationKey {
247
+ verificationKey
248
+ hash
249
+ }
250
+ actionState
251
+ provedState
252
+ zkappUri
253
+ }
254
+ }
255
+ `;
256
+
257
+ // dist/node/utils/utils.js
258
+ function sleep(ms) {
259
+ return new Promise((resolve) => setTimeout(resolve, ms));
260
+ }
261
+ function makeString(length) {
262
+ let outString = ``;
263
+ const inOptions = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`;
264
+ for (let i = 0; i < length; i++) {
265
+ outString += inOptions.charAt(Math.floor(Math.random() * inOptions.length));
266
+ }
267
+ return outString;
268
+ }
269
+ function formatTime(ms) {
270
+ if (ms === void 0)
271
+ return "";
272
+ if (ms < 1e3)
273
+ return ms.toString() + " ms";
274
+ if (ms < 60 * 1e3)
275
+ return parseInt((ms / 1e3).toString()).toString() + " sec";
276
+ if (ms < 60 * 60 * 1e3) {
277
+ const minutes = parseInt((ms / 1e3 / 60).toString());
278
+ const seconds = parseInt(((ms - minutes * 60 * 1e3) / 1e3).toString());
279
+ return minutes.toString() + " min " + seconds.toString() + " sec";
280
+ } else {
281
+ const hours = parseInt((ms / 1e3 / 60 / 60).toString());
282
+ const minutes = parseInt(((ms - hours * 60 * 60 * 1e3) / 1e3 / 60).toString());
283
+ return hours.toString() + " h " + minutes.toString() + " min";
284
+ }
285
+ }
286
+ var _Memory = class _Memory {
287
+ constructor() {
288
+ _Memory.rss = 0;
289
+ }
290
+ // eslint-disable-next-line @typescript-eslint/no-inferrable-types
291
+ static info(description = ``, fullInfo = false) {
292
+ const memoryData = process.memoryUsage();
293
+ const formatMemoryUsage = (data) => `${Math.round(data / 1024 / 1024)} MB`;
294
+ const oldRSS = _Memory.rss;
295
+ _Memory.rss = Math.round(memoryData.rss / 1024 / 1024);
296
+ const memoryUsage = fullInfo ? {
297
+ step: `${description}:`,
298
+ rssDelta: `${(oldRSS === 0 ? 0 : _Memory.rss - oldRSS).toString()} MB -> Resident Set Size memory change`,
299
+ rss: `${formatMemoryUsage(memoryData.rss)} -> Resident Set Size - total memory allocated`,
300
+ heapTotal: `${formatMemoryUsage(memoryData.heapTotal)} -> total size of the allocated heap`,
301
+ heapUsed: `${formatMemoryUsage(memoryData.heapUsed)} -> actual memory used during the execution`,
302
+ external: `${formatMemoryUsage(memoryData.external)} -> V8 external memory`
303
+ } : `RSS memory ${description}: ${formatMemoryUsage(memoryData.rss)}${oldRSS === 0 ? `` : `, changed by ` + (_Memory.rss - oldRSS).toString() + ` MB`}`;
304
+ console.log(memoryUsage);
305
+ }
306
+ };
307
+ _Memory.rss = 0;
308
+ var Memory = _Memory;
309
+
310
+ // dist/node/utils/base64.js
311
+ var TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
312
+ function bigintToBase56(value) {
313
+ const digits = toBase(value, 56n);
314
+ const str = digits.map((x) => TABLE[Number(x)]).join("");
315
+ return str;
316
+ }
317
+ function bigintFromBase56(str) {
318
+ const base56Digits = str.split("").map((x2) => BigInt(TABLE.indexOf(x2)));
319
+ const x = fromBase(base56Digits, 56n);
320
+ return x;
321
+ }
322
+ function bigintToBase64(value) {
323
+ const digits = toBase(value, 64n);
324
+ const str = digits.map((x) => TABLE[Number(x)]).join("");
325
+ return str;
326
+ }
327
+ function bigintFromBase64(str) {
328
+ const base64Digits = str.split("").map((x2) => BigInt(TABLE.indexOf(x2)));
329
+ const x = fromBase(base64Digits, 64n);
330
+ return x;
331
+ }
332
+ function fromBase(digits, base) {
333
+ if (base <= 0n)
334
+ throw Error("fromBase: base must be positive");
335
+ let basePowers = [];
336
+ for (let power = base, n = 1; n < digits.length; power **= 2n, n *= 2) {
337
+ basePowers.push(power);
338
+ }
339
+ let k = basePowers.length;
340
+ digits = digits.concat(Array(2 ** k - digits.length).fill(0n));
341
+ for (let i = 0; i < k; i++) {
342
+ let newDigits = Array(digits.length >> 1);
343
+ let basePower = basePowers[i];
344
+ for (let j = 0; j < newDigits.length; j++) {
345
+ newDigits[j] = digits[2 * j] + basePower * digits[2 * j + 1];
346
+ }
347
+ digits = newDigits;
348
+ }
349
+ console.assert(digits.length === 1);
350
+ let [digit] = digits;
351
+ return digit;
352
+ }
353
+ function toBase(x, base) {
354
+ if (base <= 0n)
355
+ throw Error("toBase: base must be positive");
356
+ let basePowers = [];
357
+ for (let power = base; power <= x; power **= 2n) {
358
+ basePowers.push(power);
359
+ }
360
+ let digits = [x];
361
+ let k = basePowers.length;
362
+ for (let i = 0; i < k; i++) {
363
+ let newDigits = Array(2 * digits.length);
364
+ let basePower = basePowers[k - 1 - i];
365
+ for (let j = 0; j < digits.length; j++) {
366
+ let x2 = digits[j];
367
+ let high = x2 / basePower;
368
+ newDigits[2 * j + 1] = high;
369
+ newDigits[2 * j] = x2 - high * basePower;
370
+ }
371
+ digits = newDigits;
372
+ }
373
+ while (digits[digits.length - 1] === 0n) {
374
+ digits.pop();
375
+ }
376
+ return digits;
377
+ }
378
+
379
+ // dist/node/worker/cloud.js
380
+ var Cloud = class {
381
+ /**
382
+ * Constructor for the Cloud class
383
+ * @param params the parameters for the Cloud class
384
+ * @param params.id the id of the user
385
+ * @param params.jobId the job id
386
+ * @param params.stepId the step id
387
+ * @param params.taskId the task id
388
+ * @param params.cache the cache folder. Use it to get the Cache object: cache = Cache.FileSystem(this.cloud.cache);
389
+ * @param params.developer the developer id
390
+ * @param params.repo the repo id
391
+ * @param params.task the task id
392
+ * @param params.userId the user id
393
+ * @param params.args the arguments, should be a string or serialized JSON
394
+ * @param params.metadata the metadata, should be a string or serialized JSON
395
+ * @param params.chain the blockchain network
396
+ * @param params.isLocalCloud a boolean to check if the cloud is local or not
397
+ */
398
+ constructor(params) {
399
+ const { id, jobId, stepId, taskId, cache, developer, repo, task, userId, args, metadata, isLocalCloud, chain } = params;
400
+ this.id = id;
401
+ this.jobId = jobId;
402
+ this.stepId = stepId;
403
+ this.taskId = taskId;
404
+ this.cache = cache;
405
+ this.developer = developer;
406
+ this.repo = repo;
407
+ this.task = task;
408
+ this.userId = userId;
409
+ this.args = args;
410
+ this.metadata = metadata;
411
+ this.isLocalCloud = isLocalCloud ?? false;
412
+ this.chain = chain;
413
+ }
414
+ };
415
+
416
+ // dist/node/worker/worker.js
417
+ var zkCloudWorker = class {
418
+ /**
419
+ * Constructor for the zkCloudWorker class
420
+ * @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
421
+ */
422
+ constructor(cloud) {
423
+ this.cloud = cloud;
424
+ }
425
+ // Those methods should be implemented for recursive proofs calculations
426
+ /**
427
+ * Creates a new proof from a transaction
428
+ * @param transaction the transaction
429
+ * @returns the serialized proof
430
+ */
431
+ async create(transaction) {
432
+ return void 0;
433
+ }
434
+ /**
435
+ * Merges two proofs
436
+ * @param proof1 the first proof
437
+ * @param proof2 the second proof
438
+ * @returns the merged proof
439
+ */
440
+ async merge(proof1, proof2) {
441
+ return void 0;
442
+ }
443
+ // Those methods should be implemented for anything except for recursive proofs
444
+ /**
445
+ * Executes the transactions
446
+ * @param transactions the transactions, can be empty list
447
+ * @returns the result
448
+ */
449
+ async execute(transactions) {
450
+ return void 0;
451
+ }
452
+ /* Process the transactions received by the cloud
453
+ * @param transactions: the transactions
454
+ */
455
+ async processTransactions(transactions) {
456
+ }
457
+ /**
458
+ * process the task defined by the developer
459
+ * @returns the result
460
+ */
461
+ async task() {
462
+ return void 0;
463
+ }
464
+ };
465
+
466
+ // dist/node/config.js
467
+ var config = {
468
+ MINAFEE: "200000000",
469
+ ZKCLOUDWORKER_AUTH: "M6t4jtbBAFFXhLERHQWyEB9JA9xi4cWqmYduaCXtbrFjb7yaY7TyaXDunKDJNiUTBEcyUomNXJgC",
470
+ ZKCLOUDWORKER_API: "https://api.zkcloudworker.com/v1/",
471
+ ZKCLOUDWORKER_NATS: "https://cloud.zkcloudworker.com:4222",
472
+ ZKCLOUDWORKER_NATS_WS: "wss://cloud.zkcloudworker.com:4223"
473
+ };
474
+
475
+ // dist/node/networks.js
476
+ var Mainnet = {
477
+ mina: [
478
+ //"https://proxy.devnet.minaexplorer.com/graphql",
479
+ "https://api.minascan.io/node/mainnet/v1/graphql"
480
+ ],
481
+ archive: [
482
+ "https://api.minascan.io/archive/mainnet/v1/graphql"
483
+ //"https://archive.devnet.minaexplorer.com",
484
+ ],
485
+ explorerAccountUrl: "https://minascan.io/mainnet/account/",
486
+ explorerTransactionUrl: "https://minascan.io/mainnet/tx/",
487
+ chainId: "mainnet",
488
+ name: "Mainnet"
489
+ };
490
+ var Local = {
491
+ mina: [],
492
+ archive: [],
493
+ chainId: "local"
494
+ };
495
+ var Devnet = {
496
+ mina: [
497
+ "https://api.minascan.io/node/devnet/v1/graphql"
498
+ //"https://proxy.devnet.minaexplorer.com/graphql",
499
+ ],
500
+ archive: [
501
+ "https://api.minascan.io/archive/devnet/v1/graphql"
502
+ //"https://archive.devnet.minaexplorer.com",
503
+ ],
504
+ explorerAccountUrl: "https://minascan.io/devnet/account/",
505
+ explorerTransactionUrl: "https://minascan.io/devnet/tx/",
506
+ chainId: "devnet",
507
+ name: "Devnet",
508
+ faucet: "https://faucet.minaprotocol.com"
509
+ };
510
+ var Zeko = {
511
+ mina: ["https://devnet.zeko.io/graphql"],
512
+ archive: ["https://devnet.zeko.io/graphql"],
513
+ explorerAccountUrl: "https://zekoscan.io/devnet/account/",
514
+ explorerTransactionUrl: "https://zekoscan.io/devnet/tx/",
515
+ chainId: "zeko",
516
+ name: "Zeko",
517
+ faucet: "https://zeko.io/faucet"
518
+ };
519
+ var Lightnet = {
520
+ mina: ["http://localhost:8080/graphql"],
521
+ archive: ["http://localhost:8282"],
522
+ accountManager: "http://localhost:8181",
523
+ chainId: "lightnet",
524
+ name: "Lightnet"
525
+ };
526
+ var networks = [Mainnet, Local, Devnet, Zeko, Lightnet];
527
+ // Annotate the CommonJS export names for ESM import in node:
528
+ 0 && (module.exports = {
529
+ Cloud,
530
+ Devnet,
531
+ Lightnet,
532
+ Local,
533
+ Mainnet,
534
+ Memory,
535
+ Zeko,
536
+ bigintFromBase56,
537
+ bigintFromBase64,
538
+ bigintToBase56,
539
+ bigintToBase64,
540
+ config,
541
+ defaultToken,
542
+ formatTime,
543
+ fromBase,
544
+ getAccountFromGraphQL,
545
+ getBalanceFromGraphQL,
546
+ makeString,
547
+ networks,
548
+ sleep,
549
+ toBase,
550
+ zkCloudWorker
551
+ });
@@ -0,0 +1,4 @@
1
+ export * from "./utils/index.js";
2
+ export * from "./worker/index.js";
3
+ export * from "./config.js";
4
+ export * from "./networks.js";
@@ -0,0 +1,5 @@
1
+ export * from "./utils/index.js";
2
+ export * from "./worker/index.js";
3
+ export * from "./config.js";
4
+ export * from "./networks.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,32 @@
1
+ export { blockchain, MinaNetwork, networks, Mainnet, Devnet, Zeko, Lightnet, Local, };
2
+ /**
3
+ * blockchain is the type for the chain ID.
4
+ */
5
+ type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko";
6
+ /**
7
+ * MinaNetwork is the data structure for a Mina network, keeping track of the Mina and archive endpoints, chain ID, name, account manager, explorer account URL, explorer transaction URL, and faucet.
8
+ */
9
+ interface MinaNetwork {
10
+ /** The Mina endpoints */
11
+ mina: string[];
12
+ /** The archive endpoints */
13
+ archive: string[];
14
+ /** The chain ID */
15
+ chainId: blockchain;
16
+ /** The name of the network (optional) */
17
+ name?: string;
18
+ /** The account manager for Lightnet (optional) */
19
+ accountManager?: string;
20
+ /** The explorer account URL (optional) */
21
+ explorerAccountUrl?: string;
22
+ /** The explorer transaction URL (optional) */
23
+ explorerTransactionUrl?: string;
24
+ /** The faucet URL (optional) */
25
+ faucet?: string;
26
+ }
27
+ declare const Mainnet: MinaNetwork;
28
+ declare const Local: MinaNetwork;
29
+ declare const Devnet: MinaNetwork;
30
+ declare const Zeko: MinaNetwork;
31
+ declare const Lightnet: MinaNetwork;
32
+ declare const networks: MinaNetwork[];