zkcloudworker 0.11.7 → 0.11.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,33 +1,27 @@
1
1
  export { blockchain, MinaNetwork, networks, Mainnet, Devnet, Zeko, Lightnet, Local, };
2
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
3
+ * blockchain is the type for the chain ID.
10
4
  */
11
- type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko" | "mainnet";
5
+ type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko";
12
6
  /**
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
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.
22
8
  */
23
9
  interface MinaNetwork {
10
+ /** The Mina endpoints */
24
11
  mina: string[];
12
+ /** The archive endpoints */
25
13
  archive: string[];
14
+ /** The chain ID */
26
15
  chainId: blockchain;
16
+ /** The name of the network (optional) */
27
17
  name?: string;
18
+ /** The account manager for Lightnet (optional) */
28
19
  accountManager?: string;
20
+ /** The explorer account URL (optional) */
29
21
  explorerAccountUrl?: string;
22
+ /** The explorer transaction URL (optional) */
30
23
  explorerTransactionUrl?: string;
24
+ /** The faucet URL (optional) */
31
25
  faucet?: string;
32
26
  }
33
27
  declare const Mainnet: MinaNetwork;
@@ -4,26 +4,27 @@ import { JobData } from "./job";
4
4
  import { TransactionMetadata } from "./transaction";
5
5
  /**
6
6
  * Interface for the deployer key pair
7
- * Used to get the public and private keys of the deployer for test networks only
8
- * Devnet and Zeko are supported
9
- * @param publicKey: the public key of the deployer
10
- * @param privateKey: the private key of the deployer
7
+ * Used to get the public and private keys of the deployer for test networks only.
8
+ * Devnet and Zeko are supported.
11
9
  */
12
10
  export interface DeployerKeyPair {
11
+ /** The public key of the deployer */
13
12
  publicKey: string;
13
+ /** The private key of the deployer */
14
14
  privateKey: string;
15
15
  }
16
16
  /**
17
17
  * Interface for the cloud transaction
18
18
  * Used to get the transaction id, the transaction, and the time received
19
- * @param txId: the transaction id
20
- * @param transaction: the transaction
21
- * @param timeReceived: the time received
22
19
  */
23
20
  export interface CloudTransaction {
21
+ /** The transaction id */
24
22
  txId: string;
23
+ /** The transaction */
25
24
  transaction: string;
25
+ /** The time received */
26
26
  timeReceived: number;
27
+ /** The status of the transaction */
27
28
  status: string;
28
29
  }
29
30
  export declare abstract class Cloud {
@@ -1,85 +1,87 @@
1
1
  import { blockchain } from "../networks";
2
2
  export type JobStatus = "created" | "started" | "finished" | "failed" | "used" | "restarted";
3
3
  /**
4
- * LogStream is a subset of the log stream data returned by AWS CloudWatch Logs when running the worker
5
- * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/GetLogEventsCommand/
6
- * example:
4
+ * LogStream is a subset of the log stream data returned by AWS CloudWatch Logs when running the worker.
5
+ * @see {@link https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cloudwatch-logs/command/GetLogEventsCommand/}
6
+ *
7
+ * Example:
8
+ * ```
7
9
  * {
8
- * logGroupName: '/aws/lambda/zkcloudworker-dev-test',
9
- * logStreamName: '2024/05/09/[$LATEST]52d048f64e894d2e8ba2800df93629c5'
10
- * awsRequestId: '581d0d45-9165-47e8-84d9-678599938811',
10
+ * logGroupName: '/aws/lambda/zkcloudworker-dev-test',
11
+ * logStreamName: '2024/05/09/[$LATEST]52d048f64e894d2e8ba2800df93629c5',
12
+ * awsRequestId: '581d0d45-9165-47e8-84d9-678599938811'
11
13
  * }
12
- * @param logGroupName the log group name
13
- * @param logStreamName the log stream name
14
- * @param awsRequestId the AWS request ID
14
+ * ```
15
15
  */
16
16
  export interface LogStream {
17
+ /** The log group name */
17
18
  logGroupName: string;
19
+ /** The log stream name */
18
20
  logStreamName: string;
21
+ /** The AWS request ID */
19
22
  awsRequestId: string;
20
23
  }
21
24
  /**
22
- * JobData is the data structure for a job, keeping track of the job status, result, logs, and metadata
23
- * @param id the id of the user
24
- * @param jobId the id of the job
25
- * @param taskId the id of the task
26
- *
27
- * @param developer the developer of the repo executing the job
28
- * @param repo the repo executing the job
29
- *
30
- * @param task the task to execute
31
- * @param userId the id of the user
32
- * @param args the arguments for the job
33
- * @param metadata the metadata for the job
34
- * @param chain the blockchain to execute the job on
35
- * @param filename the filename where transactions data is stored
36
- * @param txNumber the number of transactions
37
- * @param timeCreated the time the job was created
38
- * @param timeStarted the time the job was started
39
- * @param timeFinished the time the job was finished
40
- * @param timeFailed the time the job failed
41
- * @param timeUsed the time the job result was used
42
- * @param jobStatus the status of the job
43
- * @param billedDuration the duration the job was billed for in ms
44
- * @param logStreams the log streams of the job
45
- * @param logs the logs of the job
46
- * @param isFullLog whether the logs are full
25
+ * JobData is the data structure for a job, keeping track of the job status, result, logs, and metadata.
47
26
  */
48
27
  export interface JobData {
28
+ /** The ID of the user */
49
29
  id: string;
30
+ /** The ID of the job */
50
31
  jobId: string;
32
+ /** The ID of the task (optional) */
51
33
  taskId?: string;
34
+ /** The developer of the repo executing the job */
52
35
  developer: string;
36
+ /** The repo executing the job */
53
37
  repo: string;
38
+ /** The task to execute (optional) */
54
39
  task?: string;
40
+ /** The ID of the user (optional) */
55
41
  userId?: string;
42
+ /** The arguments for the job (optional) */
56
43
  args?: string;
44
+ /** The metadata for the job (optional) */
57
45
  metadata?: string;
46
+ /** The blockchain to execute the job on */
58
47
  chain: blockchain;
48
+ /** The filename where transactions data is stored (optional) */
59
49
  filename?: string;
50
+ /** The number of transactions */
60
51
  txNumber: number;
52
+ /** The time the job was created */
61
53
  timeCreated: number;
54
+ /** The time the job was started (optional) */
62
55
  timeStarted?: number;
56
+ /** The time the job was finished (optional) */
63
57
  timeFinished?: number;
58
+ /** The time the job failed (optional) */
64
59
  timeFailed?: number;
60
+ /** The time the job result was used (optional) */
65
61
  timeUsed?: number;
62
+ /** The status of the job */
66
63
  jobStatus: JobStatus;
64
+ /** The duration the job was billed for in ms (optional) */
67
65
  billedDuration?: number;
66
+ /** The result of the job (optional) */
68
67
  result?: string;
68
+ /** The log streams of the job (optional) */
69
69
  logStreams?: LogStream[];
70
+ /** The logs of the job (optional) */
70
71
  logs?: string[];
72
+ /** Whether the logs are full (optional) */
71
73
  isFullLog?: boolean;
72
74
  }
73
75
  /**
74
- * JobData is the data structure for a job, keeping track of the job status, result, logs, and metadata
75
- * @param jobId the id of the job
76
- * @param eventTime the time the event occurred
77
- * @param jobStatus the status of the job
78
- * @param result the result of the job
76
+ * JobEvent is the data structure for a job events, keeping track of the job status changes.
79
77
  */
80
78
  export interface JobEvent {
79
+ /** The ID of the job */
81
80
  jobId: string;
81
+ /** The time the event occurred */
82
82
  eventTime: number;
83
+ /** The status of the job */
83
84
  jobStatus: JobStatus;
85
+ /** The result of the job (optional) */
84
86
  result?: string;
85
87
  }
@@ -1,34 +1,32 @@
1
1
  import { blockchain } from "../networks";
2
2
  /**
3
- * TaskData is the data structure for a task, keeping track of the task status, result, logs, and metadata
4
- * @param id the id of the user
5
- * @param taskId the id of the task
6
- *
7
- * @param startTime the time the task was started
8
- * @param timeCreated the time the task was created
9
- * @param maxAttempts the maximum number of attempts
10
- * @param attempts the number of attempts
11
- *
12
- * @param developer the developer of the repo executing the task
13
- * @param repo the repo executing the task
14
- * @param task the task to execute
15
- * @param userId the id of the user
16
- * @param args the arguments for the task
17
- * @param metadata the metadata for the task
18
- * @param chain the blockchain to execute the task on
3
+ * TaskData is the data structure for a task, keeping track of the task status, result, logs, and metadata.
19
4
  */
20
5
  export interface TaskData {
6
+ /** The ID of the user */
21
7
  id: string;
8
+ /** The ID of the task */
22
9
  taskId: string;
10
+ /** The time the task was started (optional) */
23
11
  startTime?: number;
12
+ /** The time the task was created */
24
13
  timeCreated: number;
14
+ /** The maximum number of attempts (default is 5) (optional) */
25
15
  maxAttempts?: number;
16
+ /** The number of attempts */
26
17
  attempts: number;
18
+ /** The developer of the repo executing the task */
27
19
  developer: string;
20
+ /** The repo executing the task */
28
21
  repo: string;
22
+ /** The task to execute */
29
23
  task: string;
24
+ /** The ID of the user (optional) */
30
25
  userId?: string;
26
+ /** The arguments for the task (optional) */
31
27
  args?: string;
28
+ /** The metadata for the task (optional) */
32
29
  metadata?: string;
30
+ /** The blockchain to execute the task on */
33
31
  chain: blockchain;
34
32
  }
@@ -3,9 +3,9 @@ import { Cloud, CloudTransaction } from "./cloud";
3
3
  * Abstract class for the zkCloudWorker
4
4
  * Used to define the zkCloudWorker methods and properties
5
5
  * Should be implemented for by the developer for the zkCloudWorker in the cloud
6
- * @param cloud: the cloud
7
6
  */
8
7
  export declare abstract class zkCloudWorker {
8
+ /** cloud: the cloud instance */
9
9
  readonly cloud: Cloud;
10
10
  /**
11
11
  * Constructor for the zkCloudWorker class
@@ -5,7 +5,6 @@ exports.zkCloudWorker = void 0;
5
5
  * Abstract class for the zkCloudWorker
6
6
  * Used to define the zkCloudWorker methods and properties
7
7
  * Should be implemented for by the developer for the zkCloudWorker in the cloud
8
- * @param cloud: the cloud
9
8
  */
10
9
  class zkCloudWorker {
11
10
  /**
@@ -223,41 +223,45 @@ export declare class LocalCloud extends Cloud {
223
223
  forceWorkerRestart(): Promise<void>;
224
224
  }
225
225
  /**
226
- * LocalStorage is a local storage for the local cloud
227
- * It stores jobs, tasks, transactions, and data
228
- * It can be used to test the cloud functionality without deploying to the cloud
229
- * @param jobs the jobs
230
- * @param data the data
231
- * @param transactions the transactions
232
- * @param tasks the tasks
226
+ * LocalStorage is a local storage for the local cloud.
227
+ * It stores jobs, tasks, transactions, and data.
228
+ * It can be used to test the cloud functionality without deploying to the cloud.
233
229
  */
234
230
  export declare class LocalStorage {
231
+ /** The jobs */
235
232
  static jobs: {
236
233
  [key: string]: JobData;
237
234
  };
235
+ /** The job events */
238
236
  static jobEvents: {
239
237
  [key: string]: JobEvent;
240
238
  };
239
+ /** The data */
241
240
  static data: {
242
241
  [key: string]: string;
243
242
  };
243
+ /** The files */
244
244
  static files: {
245
245
  [key: string]: Buffer;
246
246
  };
247
+ /** The transactions */
247
248
  static transactions: {
248
249
  [key: string]: CloudTransaction;
249
250
  };
251
+ /** The tasks */
250
252
  static tasks: {
251
253
  [key: string]: TaskData;
252
254
  };
253
255
  /**
254
- * Saves the data
255
- * @param name the name to save the data
256
+ * Saves the data.
257
+ * @param name The name to save the data under.
258
+ * @throws Error Method not implemented to keep web compatibility.
256
259
  */
257
260
  static saveData(name: string): Promise<void>;
258
261
  /**
259
- * Loads the data
260
- * @param name the name to load the data
262
+ * Loads the data.
263
+ * @param name The name to load the data from.
264
+ * @throws Error Method not implemented to keep web compatibility.
261
265
  */
262
266
  static loadData(name: string): Promise<void>;
263
267
  }
@@ -446,18 +446,15 @@ class LocalCloud extends cloud_1.Cloud {
446
446
  }
447
447
  exports.LocalCloud = LocalCloud;
448
448
  /**
449
- * LocalStorage is a local storage for the local cloud
450
- * It stores jobs, tasks, transactions, and data
451
- * It can be used to test the cloud functionality without deploying to the cloud
452
- * @param jobs the jobs
453
- * @param data the data
454
- * @param transactions the transactions
455
- * @param tasks the tasks
449
+ * LocalStorage is a local storage for the local cloud.
450
+ * It stores jobs, tasks, transactions, and data.
451
+ * It can be used to test the cloud functionality without deploying to the cloud.
456
452
  */
457
453
  class LocalStorage {
458
454
  /**
459
- * Saves the data
460
- * @param name the name to save the data
455
+ * Saves the data.
456
+ * @param name The name to save the data under.
457
+ * @throws Error Method not implemented to keep web compatibility.
461
458
  */
462
459
  static async saveData(name) {
463
460
  throw new Error("Method not implemented to keep web compatibility.");
@@ -468,11 +465,12 @@ class LocalStorage {
468
465
  tasks: LocalStorage.tasks,
469
466
  };
470
467
  const filename = name + ".cloud";
471
- //await saveFile({ data, filename });
468
+ // await saveFile({ data, filename });
472
469
  }
473
470
  /**
474
- * Loads the data
475
- * @param name the name to load the data
471
+ * Loads the data.
472
+ * @param name The name to load the data from.
473
+ * @throws Error Method not implemented to keep web compatibility.
476
474
  */
477
475
  static async loadData(name) {
478
476
  throw new Error("Method not implemented to keep web compatibility.");
@@ -488,9 +486,15 @@ class LocalStorage {
488
486
  }
489
487
  }
490
488
  exports.LocalStorage = LocalStorage;
489
+ /** The jobs */
491
490
  LocalStorage.jobs = {};
491
+ /** The job events */
492
492
  LocalStorage.jobEvents = {};
493
+ /** The data */
493
494
  LocalStorage.data = {};
495
+ /** The files */
494
496
  LocalStorage.files = {};
497
+ /** The transactions */
495
498
  LocalStorage.transactions = {};
499
+ /** The tasks */
496
500
  LocalStorage.tasks = {};
@@ -2,14 +2,14 @@ export { initBlockchain, accountBalance, accountBalanceMina, MinaNetworkInstance
2
2
  import { Mina, PublicKey, UInt64, Field } from "o1js";
3
3
  import { blockchain, MinaNetwork } from "../../cloud";
4
4
  /**
5
- * MinaNetworkInstance is the data structure for a Mina network instance, keeping track of the keys, network, and network id hash
6
- * @param keys the keys for the deployers
7
- * @param network the network
8
- * @param networkIdHash the network id hash
5
+ * MinaNetworkInstance is the data structure for a Mina network instance, keeping track of the keys, network, and network ID hash.
9
6
  */
10
7
  interface MinaNetworkInstance {
8
+ /** The keys for the deployers */
11
9
  keys: Mina.TestPublicKey[];
10
+ /** The network */
12
11
  network: MinaNetwork;
12
+ /** The network ID hash */
13
13
  networkIdHash: Field;
14
14
  }
15
15
  declare let currentNetwork: MinaNetworkInstance | undefined;
@@ -7,6 +7,7 @@ import { SmartContract } from "o1js";
7
7
  * programDependencies: The zk programs that need to be compiled before verification.
8
8
  * address: The address of the smart contract on the blockchain.
9
9
  * chain: The blockchain on which the smart contract is deployed.
10
+ * image: The logo of the smart contract (public url)
10
11
  *
11
12
  * Contract, contractDependencies, and programDependencies should be exported from the repo
12
13
  */
@@ -16,4 +17,5 @@ export interface VerificationData {
16
17
  programDependencies?: any[];
17
18
  address: string;
18
19
  chain: blockchain;
20
+ image?: string;
19
21
  }