zkcloudworker 0.11.7 → 0.11.9
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.
- package/lib/ts/src/cloud/networks.d.ts +11 -17
- package/lib/ts/src/cloud/utils/base64.js +6 -7
- package/lib/ts/src/cloud/utils/graphql.js +3 -3
- package/lib/ts/src/cloud/utils/utils.js +4 -4
- package/lib/ts/src/cloud/worker/cloud.d.ts +8 -8
- package/lib/ts/src/cloud/worker/job.d.ts +41 -39
- package/lib/ts/src/cloud/worker/task.d.ts +14 -16
- package/lib/ts/src/cloud/worker/worker.d.ts +1 -1
- package/lib/ts/src/cloud/worker/worker.js +0 -1
- package/lib/ts/src/mina/encryption/client.js +2 -3
- package/lib/ts/src/mina/encryption/messages.js +3 -4
- package/lib/ts/src/mina/local/local.d.ts +15 -12
- package/lib/ts/src/mina/local/local.js +16 -12
- package/lib/ts/src/mina/utils/base64.js +4 -5
- package/lib/ts/src/mina/utils/fee.js +1 -2
- package/lib/ts/src/mina/utils/fetch.js +3 -4
- package/lib/ts/src/mina/utils/fields.js +2 -3
- package/lib/ts/src/mina/utils/mina.d.ts +4 -4
- package/lib/ts/src/mina/utils/mina.js +8 -7
- package/lib/ts/src/mina/verification/verification.d.ts +2 -0
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/cloud/networks.d.ts +11 -17
- package/lib/web/src/cloud/networks.js.map +1 -1
- package/lib/web/src/cloud/worker/cloud.d.ts +8 -8
- package/lib/web/src/cloud/worker/cloud.js.map +1 -1
- package/lib/web/src/cloud/worker/job.d.ts +41 -39
- package/lib/web/src/cloud/worker/task.d.ts +14 -16
- package/lib/web/src/cloud/worker/worker.d.ts +1 -1
- package/lib/web/src/cloud/worker/worker.js +0 -1
- package/lib/web/src/cloud/worker/worker.js.map +1 -1
- package/lib/web/src/mina/local/local.d.ts +15 -12
- package/lib/web/src/mina/local/local.js +16 -12
- package/lib/web/src/mina/local/local.js.map +1 -1
- package/lib/web/src/mina/utils/mina.d.ts +4 -4
- package/lib/web/src/mina/utils/mina.js +1 -0
- package/lib/web/src/mina/utils/mina.js.map +1 -1
- package/lib/web/src/mina/verification/verification.d.ts +2 -0
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -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
|
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"
|
5
|
+
type blockchain = "local" | "devnet" | "lightnet" | "mainnet" | "zeko";
|
12
6
|
/**
|
13
|
-
* MinaNetwork is the data structure for a Mina network, keeping track of the
|
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;
|
@@ -1,6 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.bigintToBase56 = bigintToBase56;
|
4
|
+
exports.bigintFromBase56 = bigintFromBase56;
|
5
|
+
exports.bigintToBase64 = bigintToBase64;
|
6
|
+
exports.bigintFromBase64 = bigintFromBase64;
|
7
|
+
exports.fromBase = fromBase;
|
8
|
+
exports.toBase = toBase;
|
4
9
|
// URL friendly base64 encoding
|
5
10
|
const TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
6
11
|
function bigintToBase56(value) {
|
@@ -10,13 +15,11 @@ function bigintToBase56(value) {
|
|
10
15
|
//console.log("str:", str);
|
11
16
|
return str;
|
12
17
|
}
|
13
|
-
exports.bigintToBase56 = bigintToBase56;
|
14
18
|
function bigintFromBase56(str) {
|
15
19
|
const base56Digits = str.split("").map((x) => BigInt(TABLE.indexOf(x)));
|
16
20
|
const x = fromBase(base56Digits, 56n);
|
17
21
|
return x;
|
18
22
|
}
|
19
|
-
exports.bigintFromBase56 = bigintFromBase56;
|
20
23
|
function bigintToBase64(value) {
|
21
24
|
const digits = toBase(value, 64n);
|
22
25
|
//console.log("digits:", digits);
|
@@ -24,13 +27,11 @@ function bigintToBase64(value) {
|
|
24
27
|
//console.log("str:", str);
|
25
28
|
return str;
|
26
29
|
}
|
27
|
-
exports.bigintToBase64 = bigintToBase64;
|
28
30
|
function bigintFromBase64(str) {
|
29
31
|
const base64Digits = str.split("").map((x) => BigInt(TABLE.indexOf(x)));
|
30
32
|
const x = fromBase(base64Digits, 64n);
|
31
33
|
return x;
|
32
34
|
}
|
33
|
-
exports.bigintFromBase64 = bigintFromBase64;
|
34
35
|
function fromBase(digits, base) {
|
35
36
|
if (base <= 0n)
|
36
37
|
throw Error("fromBase: base must be positive");
|
@@ -57,7 +58,6 @@ function fromBase(digits, base) {
|
|
57
58
|
let [digit] = digits;
|
58
59
|
return digit;
|
59
60
|
}
|
60
|
-
exports.fromBase = fromBase;
|
61
61
|
function toBase(x, base) {
|
62
62
|
if (base <= 0n)
|
63
63
|
throw Error("toBase: base must be positive");
|
@@ -88,4 +88,3 @@ function toBase(x, base) {
|
|
88
88
|
}
|
89
89
|
return digits;
|
90
90
|
}
|
91
|
-
exports.toBase = toBase;
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.defaultToken = void 0;
|
4
|
+
exports.getBalanceFromGraphQL = getBalanceFromGraphQL;
|
5
|
+
exports.getAccountFromGraphQL = getAccountFromGraphQL;
|
4
6
|
exports.defaultToken = "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf";
|
5
7
|
async function getBalanceFromGraphQL(params) {
|
6
8
|
const { publicKey, mina } = params;
|
@@ -17,7 +19,6 @@ async function getBalanceFromGraphQL(params) {
|
|
17
19
|
const balance = account?.account?.balance?.total;
|
18
20
|
return balance ? BigInt(balance) : 0n;
|
19
21
|
}
|
20
|
-
exports.getBalanceFromGraphQL = getBalanceFromGraphQL;
|
21
22
|
async function getAccountFromGraphQL(params) {
|
22
23
|
const { publicKey, mina } = params;
|
23
24
|
const tokenId = params.tokenId ?? exports.defaultToken;
|
@@ -31,7 +32,6 @@ async function getAccountFromGraphQL(params) {
|
|
31
32
|
});
|
32
33
|
return account?.account;
|
33
34
|
}
|
34
|
-
exports.getAccountFromGraphQL = getAccountFromGraphQL;
|
35
35
|
async function fetchAccountInternal(params) {
|
36
36
|
const { publicKey, tokenId, mina, timeout, queryType } = params;
|
37
37
|
const query = queryType === "balance"
|
@@ -1,10 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Memory =
|
3
|
+
exports.Memory = void 0;
|
4
|
+
exports.sleep = sleep;
|
5
|
+
exports.makeString = makeString;
|
6
|
+
exports.formatTime = formatTime;
|
4
7
|
function sleep(ms) {
|
5
8
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
6
9
|
}
|
7
|
-
exports.sleep = sleep;
|
8
10
|
function makeString(length) {
|
9
11
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
10
12
|
let outString = ``;
|
@@ -15,7 +17,6 @@ function makeString(length) {
|
|
15
17
|
}
|
16
18
|
return outString;
|
17
19
|
}
|
18
|
-
exports.makeString = makeString;
|
19
20
|
function formatTime(ms) {
|
20
21
|
if (ms === undefined)
|
21
22
|
return "";
|
@@ -34,7 +35,6 @@ function formatTime(ms) {
|
|
34
35
|
return hours.toString() + " h " + minutes.toString() + " min";
|
35
36
|
}
|
36
37
|
}
|
37
|
-
exports.formatTime = formatTime;
|
38
38
|
class Memory {
|
39
39
|
constructor() {
|
40
40
|
Memory.rss = 0;
|
@@ -1,29 +1,29 @@
|
|
1
|
-
/// <reference types="node" />
|
2
1
|
import { blockchain } from "../networks";
|
3
2
|
import { JobData } from "./job";
|
4
3
|
import { TransactionMetadata } from "./transaction";
|
5
4
|
/**
|
6
5
|
* 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
|
6
|
+
* Used to get the public and private keys of the deployer for test networks only.
|
7
|
+
* Devnet and Zeko are supported.
|
11
8
|
*/
|
12
9
|
export interface DeployerKeyPair {
|
10
|
+
/** The public key of the deployer */
|
13
11
|
publicKey: string;
|
12
|
+
/** The private key of the deployer */
|
14
13
|
privateKey: string;
|
15
14
|
}
|
16
15
|
/**
|
17
16
|
* Interface for the cloud transaction
|
18
17
|
* 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
18
|
*/
|
23
19
|
export interface CloudTransaction {
|
20
|
+
/** The transaction id */
|
24
21
|
txId: string;
|
22
|
+
/** The transaction */
|
25
23
|
transaction: string;
|
24
|
+
/** The time received */
|
26
25
|
timeReceived: number;
|
26
|
+
/** The status of the transaction */
|
27
27
|
status: string;
|
28
28
|
}
|
29
29
|
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
|
-
*
|
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
|
-
*
|
9
|
-
*
|
10
|
-
*
|
10
|
+
* logGroupName: '/aws/lambda/zkcloudworker-dev-test',
|
11
|
+
* logStreamName: '2024/05/09/[$LATEST]52d048f64e894d2e8ba2800df93629c5',
|
12
|
+
* awsRequestId: '581d0d45-9165-47e8-84d9-678599938811'
|
11
13
|
* }
|
12
|
-
*
|
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
|
-
*
|
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
|
/**
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.NATSClient = NATSClient;
|
4
|
+
exports.listen = listen;
|
4
5
|
const o1js_1 = require("o1js");
|
5
6
|
const nats_1 = require("nats");
|
6
7
|
const o1js_2 = require("o1js");
|
@@ -21,7 +22,6 @@ async function NATSClient(callme) {
|
|
21
22
|
callme: callme,
|
22
23
|
};
|
23
24
|
}
|
24
|
-
exports.NATSClient = NATSClient;
|
25
25
|
async function listen(subject, callme) {
|
26
26
|
// Create a JSON codec for encoding and decoding messages
|
27
27
|
const codec = (0, nats_1.JSONCodec)();
|
@@ -124,7 +124,6 @@ async function listen(subject, callme) {
|
|
124
124
|
}
|
125
125
|
})();
|
126
126
|
}
|
127
|
-
exports.listen = listen;
|
128
127
|
/*
|
129
128
|
async function main(args: string[]) {
|
130
129
|
const nc = await connect({ servers: NATS_SERVER });
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.postOptionsMessage = postOptionsMessage;
|
4
|
+
exports.postReadyMessage = postReadyMessage;
|
5
|
+
exports.postDoneMessage = postDoneMessage;
|
4
6
|
const nats_1 = require("nats");
|
5
7
|
const connections_1 = require("./connections");
|
6
8
|
const codec = (0, nats_1.JSONCodec)();
|
@@ -17,7 +19,6 @@ async function postOptionsMessage(clientAddress, workerAddress) {
|
|
17
19
|
await nc.drain();
|
18
20
|
return response;
|
19
21
|
}
|
20
|
-
exports.postOptionsMessage = postOptionsMessage;
|
21
22
|
;
|
22
23
|
async function postReadyMessage(clientAddress, workerAddress) {
|
23
24
|
// connect to the NATS server and send a 'ready' request
|
@@ -32,7 +33,6 @@ async function postReadyMessage(clientAddress, workerAddress) {
|
|
32
33
|
await nc.drain();
|
33
34
|
return response;
|
34
35
|
}
|
35
|
-
exports.postReadyMessage = postReadyMessage;
|
36
36
|
;
|
37
37
|
async function postDoneMessage(clientAddress, encrypted) {
|
38
38
|
// connect to the NATS server and send a 'ready' request
|
@@ -47,5 +47,4 @@ async function postDoneMessage(clientAddress, encrypted) {
|
|
47
47
|
await nc.drain();
|
48
48
|
return response;
|
49
49
|
}
|
50
|
-
exports.postDoneMessage = postDoneMessage;
|
51
50
|
;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="node" />
|
2
1
|
import { blockchain, TransactionMetadata, CloudTransaction, DeployerKeyPair, TaskData, JobData, JobEvent, Cloud, zkCloudWorker } from "../../cloud";
|
3
2
|
import { ApiCommand } from "../api/api";
|
4
3
|
/**
|
@@ -223,41 +222,45 @@ export declare class LocalCloud extends Cloud {
|
|
223
222
|
forceWorkerRestart(): Promise<void>;
|
224
223
|
}
|
225
224
|
/**
|
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
|
225
|
+
* LocalStorage is a local storage for the local cloud.
|
226
|
+
* It stores jobs, tasks, transactions, and data.
|
227
|
+
* It can be used to test the cloud functionality without deploying to the cloud.
|
233
228
|
*/
|
234
229
|
export declare class LocalStorage {
|
230
|
+
/** The jobs */
|
235
231
|
static jobs: {
|
236
232
|
[key: string]: JobData;
|
237
233
|
};
|
234
|
+
/** The job events */
|
238
235
|
static jobEvents: {
|
239
236
|
[key: string]: JobEvent;
|
240
237
|
};
|
238
|
+
/** The data */
|
241
239
|
static data: {
|
242
240
|
[key: string]: string;
|
243
241
|
};
|
242
|
+
/** The files */
|
244
243
|
static files: {
|
245
244
|
[key: string]: Buffer;
|
246
245
|
};
|
246
|
+
/** The transactions */
|
247
247
|
static transactions: {
|
248
248
|
[key: string]: CloudTransaction;
|
249
249
|
};
|
250
|
+
/** The tasks */
|
250
251
|
static tasks: {
|
251
252
|
[key: string]: TaskData;
|
252
253
|
};
|
253
254
|
/**
|
254
|
-
* Saves the data
|
255
|
-
* @param name
|
255
|
+
* Saves the data.
|
256
|
+
* @param name The name to save the data under.
|
257
|
+
* @throws Error Method not implemented to keep web compatibility.
|
256
258
|
*/
|
257
259
|
static saveData(name: string): Promise<void>;
|
258
260
|
/**
|
259
|
-
* Loads the data
|
260
|
-
* @param name
|
261
|
+
* Loads the data.
|
262
|
+
* @param name The name to load the data from.
|
263
|
+
* @throws Error Method not implemented to keep web compatibility.
|
261
264
|
*/
|
262
265
|
static loadData(name: string): Promise<void>;
|
263
266
|
}
|
@@ -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
|
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
|
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 = {};
|
@@ -1,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.fieldToBase56 = fieldToBase56;
|
4
|
+
exports.fieldFromBase56 = fieldFromBase56;
|
5
|
+
exports.fieldToBase64 = fieldToBase64;
|
6
|
+
exports.fieldFromBase64 = fieldFromBase64;
|
4
7
|
const o1js_1 = require("o1js");
|
5
8
|
const base64_1 = require("../../cloud/utils/base64");
|
6
9
|
// URL friendly base64 encoding
|
@@ -12,13 +15,11 @@ function fieldToBase56(field) {
|
|
12
15
|
//console.log("str:", str);
|
13
16
|
return str;
|
14
17
|
}
|
15
|
-
exports.fieldToBase56 = fieldToBase56;
|
16
18
|
function fieldFromBase56(str) {
|
17
19
|
const base56Digits = str.split("").map((x) => BigInt(TABLE.indexOf(x)));
|
18
20
|
const x = (0, base64_1.fromBase)(base56Digits, 56n);
|
19
21
|
return (0, o1js_1.Field)(x);
|
20
22
|
}
|
21
|
-
exports.fieldFromBase56 = fieldFromBase56;
|
22
23
|
function fieldToBase64(field) {
|
23
24
|
const digits = (0, base64_1.toBase)(field.toBigInt(), 64n);
|
24
25
|
//console.log("digits:", digits);
|
@@ -26,10 +27,8 @@ function fieldToBase64(field) {
|
|
26
27
|
//console.log("str:", str);
|
27
28
|
return str;
|
28
29
|
}
|
29
|
-
exports.fieldToBase64 = fieldToBase64;
|
30
30
|
function fieldFromBase64(str) {
|
31
31
|
const base64Digits = str.split("").map((x) => BigInt(TABLE.indexOf(x)));
|
32
32
|
const x = (0, base64_1.fromBase)(base64Digits, 64n);
|
33
33
|
return (0, o1js_1.Field)(x);
|
34
34
|
}
|
35
|
-
exports.fieldFromBase64 = fieldFromBase64;
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.fee =
|
6
|
+
exports.fee = fee;
|
7
7
|
const o1js_1 = require("o1js");
|
8
8
|
const config_1 = __importDefault(require("../../cloud/config"));
|
9
9
|
/**
|
@@ -14,4 +14,3 @@ async function fee() {
|
|
14
14
|
//TODO: update after mainnet launch and resolution of the issue https://github.com/o1-labs/o1js/issues/1626
|
15
15
|
return o1js_1.UInt64.fromJSON(config_1.default.MINAFEE);
|
16
16
|
}
|
17
|
-
exports.fee = fee;
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.fetchMinaAccount = fetchMinaAccount;
|
4
|
+
exports.fetchMinaActions = fetchMinaActions;
|
5
|
+
exports.checkMinaZkappTransaction = checkMinaZkappTransaction;
|
4
6
|
const o1js_1 = require("o1js");
|
5
7
|
const cloud_1 = require("../../cloud");
|
6
8
|
/**
|
@@ -55,7 +57,6 @@ async function fetchMinaAccount(params) {
|
|
55
57
|
console.log("fetchMinaAccount timeout", typeof publicKey === "string" ? publicKey : publicKey.toBase58(), tokenId?.toString(), force);
|
56
58
|
return result;
|
57
59
|
}
|
58
|
-
exports.fetchMinaAccount = fetchMinaAccount;
|
59
60
|
/**
|
60
61
|
* Fetches the Mina actions for a given public key with error handling
|
61
62
|
* @param publicKey the public key of the contract
|
@@ -85,7 +86,6 @@ async function fetchMinaActions(publicKey, fromActionState, endActionState) {
|
|
85
86
|
console.log("Timeout in fetchMinaActions");
|
86
87
|
return undefined;
|
87
88
|
}
|
88
|
-
exports.fetchMinaActions = fetchMinaActions;
|
89
89
|
/**
|
90
90
|
* Fetches the Mina transaction for a given hash with error handling
|
91
91
|
* @param hash the hash of the transaction
|
@@ -101,4 +101,3 @@ async function checkMinaZkappTransaction(hash) {
|
|
101
101
|
return { success: false };
|
102
102
|
}
|
103
103
|
}
|
104
|
-
exports.checkMinaZkappTransaction = checkMinaZkappTransaction;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.serializeFields = serializeFields;
|
4
|
+
exports.deserializeFields = deserializeFields;
|
4
5
|
const o1js_1 = require("o1js");
|
5
6
|
const base64_1 = require("./base64");
|
6
7
|
/**
|
@@ -14,7 +15,6 @@ function serializeFields(fields) {
|
|
14
15
|
//return value.map((f) => f.toBigInt().toString(36)).join(".");
|
15
16
|
return value.map((f) => (0, base64_1.fieldToBase64)(f)).join(".");
|
16
17
|
}
|
17
|
-
exports.serializeFields = serializeFields;
|
18
18
|
/**
|
19
19
|
* Deserialize fields from a string using base64 URL-friendly encoding
|
20
20
|
* @param s the string to deserialize
|
@@ -40,4 +40,3 @@ function deserializeFields(s) {
|
|
40
40
|
throw new Error(`deserializeFields: invalid string: ${s}: ${e}`);
|
41
41
|
}
|
42
42
|
}
|
43
|
-
exports.deserializeFields = deserializeFields;
|