zkcloudworker 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/api/api.js +3 -3
- package/lib/ts/src/cloud/cache.d.ts +97 -0
- package/lib/ts/src/cloud/cache.js +98 -0
- package/lib/ts/src/cloud/cloud.d.ts +1 -1
- package/lib/ts/src/cloud/index.d.ts +1 -0
- package/lib/ts/src/cloud/index.js +1 -0
- package/lib/ts/src/cloud/local.d.ts +1 -1
- package/lib/ts/src/cloud/local.js +4 -3
- package/lib/ts/src/utils/fetch.d.ts +2 -2
- package/lib/ts/src/utils/fetch.js +3 -3
- package/lib/ts/src/utils/index.d.ts +1 -0
- package/lib/ts/src/utils/index.js +1 -0
- package/lib/ts/src/utils/mina.d.ts +1 -9
- package/lib/ts/src/utils/mina.js +1 -65
- package/lib/ts/src/utils/utils.d.ts +8 -0
- package/lib/ts/src/utils/utils.js +67 -0
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/api/api.js +1 -1
- package/lib/web/src/api/api.js.map +1 -1
- package/lib/web/src/cloud/cache.d.ts +97 -0
- package/lib/web/src/cloud/cache.js +97 -0
- package/lib/web/src/cloud/cache.js.map +1 -0
- package/lib/web/src/cloud/cloud.d.ts +1 -1
- package/lib/web/src/cloud/index.d.ts +1 -0
- package/lib/web/src/cloud/index.js +1 -0
- package/lib/web/src/cloud/index.js.map +1 -1
- package/lib/web/src/cloud/local.d.ts +1 -1
- package/lib/web/src/cloud/local.js +3 -2
- package/lib/web/src/cloud/local.js.map +1 -1
- package/lib/web/src/utils/fetch.d.ts +2 -2
- package/lib/web/src/utils/fetch.js +1 -1
- package/lib/web/src/utils/fetch.js.map +1 -1
- package/lib/web/src/utils/index.d.ts +1 -0
- package/lib/web/src/utils/index.js +1 -0
- package/lib/web/src/utils/index.js.map +1 -1
- package/lib/web/src/utils/mina.d.ts +1 -9
- package/lib/web/src/utils/mina.js +1 -61
- package/lib/web/src/utils/mina.js.map +1 -1
- package/lib/web/src/utils/utils.d.ts +8 -0
- package/lib/web/src/utils/utils.js +61 -0
- package/lib/web/src/utils/utils.js.map +1 -0
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cloud/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cloud/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { PrivateKey } from "o1js";
|
2
|
+
import { Cache } from "./cache";
|
2
3
|
import { Cloud } from "./cloud";
|
3
|
-
import { makeString } from "../utils/
|
4
|
+
import { makeString } from "../utils/utils";
|
4
5
|
import { saveFile, loadFile, saveBinaryFile, loadBinaryFile } from "./files";
|
5
6
|
export class LocalCloud extends Cloud {
|
6
7
|
constructor(params) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../../../src/cloud/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../../../src/cloud/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EA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K,CAAC;IACf,CAAC;CACF;AAED,MAAM,OAAO,YAAY;IAQvB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAY;QAChC,MAAM,IAAI,GAAG;YACX,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,YAAY,EAAE,YAAY,CAAC,YAAY;YACvC,KAAK,EAAE,YAAY,CAAC,KAAK;SAC1B,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC;QACjC,MAAM,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAY;QAChC,MAAM,QAAQ,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;;AA1BM,iBAAI,GAA+B,EAAE,CAAC;AACtC,iBAAI,GAA8B,EAAE,CAAC;AACrC,yBAAY,GAEf,EAAE,CAAC;AACA,kBAAK,GAAgC,EAAE,CAAC"}
|
@@ -4,10 +4,10 @@ export declare function fetchMinaAccount(params: {
|
|
4
4
|
tokenId?: string | Field | undefined;
|
5
5
|
force?: boolean;
|
6
6
|
}): Promise<{
|
7
|
+
account: undefined;
|
8
|
+
} | {
|
7
9
|
account: import("o1js/dist/node/bindings/mina-transaction/gen/transaction").Account;
|
8
10
|
error: undefined;
|
9
|
-
} | {
|
10
|
-
account: undefined;
|
11
11
|
}>;
|
12
12
|
export declare function fetchMinaActions(publicKey: PublicKey, fromActionState: Field, endActionState?: Field): Promise<{
|
13
13
|
actions: string[][];
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Mina, fetchAccount, checkZkappTransaction, } from "o1js";
|
2
|
-
import { sleep } from "./
|
2
|
+
import { sleep } from "./utils";
|
3
3
|
export async function fetchMinaAccount(params) {
|
4
4
|
const { publicKey, tokenId, force } = params;
|
5
5
|
const timeout = 1000 * 60 * 2; // 2 minutes
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EACJ,YAAY,EACZ,qBAAqB,GACtB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EACJ,YAAY,EACZ,qBAAqB,GACtB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAItC;IACC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC7C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,YAAY;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,IAAI,MAAM,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACpC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;gBAChC,SAAS;gBACT,OAAO;aACR,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;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":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { initBlockchain,
|
1
|
+
export { initBlockchain, accountBalance, accountBalanceMina, MinaNetworkInstance, currentNetwork, getNetworkIdHash, getCurrentNetwork, getDeployer, };
|
2
2
|
import { Mina, PublicKey, UInt64, Field } from "o1js";
|
3
3
|
import { blockchain, MinaNetwork } from "../networks";
|
4
4
|
interface MinaNetworkInstance {
|
@@ -13,11 +13,3 @@ declare function getDeployer(): Mina.TestPublicKey | undefined;
|
|
13
13
|
declare function initBlockchain(instance: blockchain, deployersNumber?: number): Promise<MinaNetworkInstance>;
|
14
14
|
declare function accountBalance(address: PublicKey): Promise<UInt64>;
|
15
15
|
declare function accountBalanceMina(address: PublicKey): Promise<number>;
|
16
|
-
declare function sleep(ms: number): Promise<unknown>;
|
17
|
-
declare function makeString(length: number): string;
|
18
|
-
declare function formatTime(ms: number): string;
|
19
|
-
declare class Memory {
|
20
|
-
static rss: number;
|
21
|
-
constructor();
|
22
|
-
static info(description?: string, fullInfo?: boolean): void;
|
23
|
-
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { initBlockchain,
|
1
|
+
export { initBlockchain, accountBalance, accountBalanceMina, currentNetwork, getNetworkIdHash, getCurrentNetwork, getDeployer, };
|
2
2
|
import { Mina, PrivateKey, UInt64, fetchAccount, Encoding, Poseidon, Lightnet, } from "o1js";
|
3
3
|
import { networks, Local } from "../networks";
|
4
4
|
let currentNetwork = undefined;
|
@@ -99,64 +99,4 @@ async function accountBalance(address) {
|
|
99
99
|
async function accountBalanceMina(address) {
|
100
100
|
return Number((await accountBalance(address)).toBigInt()) / 1e9;
|
101
101
|
}
|
102
|
-
function sleep(ms) {
|
103
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
104
|
-
}
|
105
|
-
function makeString(length) {
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
107
|
-
let outString = ``;
|
108
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
109
|
-
const inOptions = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`;
|
110
|
-
for (let i = 0; i < length; i++) {
|
111
|
-
outString += inOptions.charAt(Math.floor(Math.random() * inOptions.length));
|
112
|
-
}
|
113
|
-
return outString;
|
114
|
-
}
|
115
|
-
function formatTime(ms) {
|
116
|
-
if (ms === undefined)
|
117
|
-
return "";
|
118
|
-
if (ms < 1000)
|
119
|
-
return ms.toString() + " ms";
|
120
|
-
if (ms < 60 * 1000)
|
121
|
-
return parseInt((ms / 1000).toString()).toString() + " sec";
|
122
|
-
if (ms < 60 * 60 * 1000) {
|
123
|
-
const minutes = parseInt((ms / 1000 / 60).toString());
|
124
|
-
const seconds = parseInt(((ms - minutes * 60 * 1000) / 1000).toString());
|
125
|
-
return minutes.toString() + " min " + seconds.toString() + " sec";
|
126
|
-
}
|
127
|
-
else {
|
128
|
-
const hours = parseInt((ms / 1000 / 60 / 60).toString());
|
129
|
-
const minutes = parseInt(((ms - hours * 60 * 60 * 1000) / 1000 / 60).toString());
|
130
|
-
return hours.toString() + " h " + minutes.toString() + " min";
|
131
|
-
}
|
132
|
-
}
|
133
|
-
class Memory {
|
134
|
-
constructor() {
|
135
|
-
Memory.rss = 0;
|
136
|
-
}
|
137
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
138
|
-
static info(description = ``, fullInfo = false) {
|
139
|
-
const memoryData = process.memoryUsage();
|
140
|
-
const formatMemoryUsage = (data) => `${Math.round(data / 1024 / 1024)} MB`;
|
141
|
-
const oldRSS = Memory.rss;
|
142
|
-
Memory.rss = Math.round(memoryData.rss / 1024 / 1024);
|
143
|
-
const memoryUsage = fullInfo
|
144
|
-
? {
|
145
|
-
step: `${description}:`,
|
146
|
-
rssDelta: `${(oldRSS === 0
|
147
|
-
? 0
|
148
|
-
: Memory.rss - oldRSS).toString()} MB -> Resident Set Size memory change`,
|
149
|
-
rss: `${formatMemoryUsage(memoryData.rss)} -> Resident Set Size - total memory allocated`,
|
150
|
-
heapTotal: `${formatMemoryUsage(memoryData.heapTotal)} -> total size of the allocated heap`,
|
151
|
-
heapUsed: `${formatMemoryUsage(memoryData.heapUsed)} -> actual memory used during the execution`,
|
152
|
-
external: `${formatMemoryUsage(memoryData.external)} -> V8 external memory`,
|
153
|
-
}
|
154
|
-
: `RSS memory ${description}: ${formatMemoryUsage(memoryData.rss)}${oldRSS === 0
|
155
|
-
? ``
|
156
|
-
: `, changed by ` + (Memory.rss - oldRSS).toString() + ` MB`}`;
|
157
|
-
console.log(memoryUsage);
|
158
|
-
}
|
159
|
-
}
|
160
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
161
|
-
Memory.rss = 0;
|
162
102
|
//# sourceMappingURL=mina.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mina.js","sourceRoot":"","sources":["../../../../../src/utils/mina.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,
|
1
|
+
{"version":3,"file":"mina.js","sourceRoot":"","sources":["../../../../../src/utils/mina.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EAElB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,CAAC;AAEF,OAAO,EACL,IAAI,EAEJ,UAAU,EACV,MAAM,EACN,YA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AQ,EAAE,CAAC,GAAG,GAAG,CAAC;AAClE,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
2
|
+
export declare function makeString(length: number): string;
|
3
|
+
export declare function formatTime(ms: number): string;
|
4
|
+
export declare class Memory {
|
5
|
+
static rss: number;
|
6
|
+
constructor();
|
7
|
+
static info(description?: string, fullInfo?: boolean): void;
|
8
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
export function sleep(ms) {
|
2
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
3
|
+
}
|
4
|
+
export function makeString(length) {
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
6
|
+
let outString = ``;
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
8
|
+
const inOptions = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`;
|
9
|
+
for (let i = 0; i < length; i++) {
|
10
|
+
outString += inOptions.charAt(Math.floor(Math.random() * inOptions.length));
|
11
|
+
}
|
12
|
+
return outString;
|
13
|
+
}
|
14
|
+
export function formatTime(ms) {
|
15
|
+
if (ms === undefined)
|
16
|
+
return "";
|
17
|
+
if (ms < 1000)
|
18
|
+
return ms.toString() + " ms";
|
19
|
+
if (ms < 60 * 1000)
|
20
|
+
return parseInt((ms / 1000).toString()).toString() + " sec";
|
21
|
+
if (ms < 60 * 60 * 1000) {
|
22
|
+
const minutes = parseInt((ms / 1000 / 60).toString());
|
23
|
+
const seconds = parseInt(((ms - minutes * 60 * 1000) / 1000).toString());
|
24
|
+
return minutes.toString() + " min " + seconds.toString() + " sec";
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
const hours = parseInt((ms / 1000 / 60 / 60).toString());
|
28
|
+
const minutes = parseInt(((ms - hours * 60 * 60 * 1000) / 1000 / 60).toString());
|
29
|
+
return hours.toString() + " h " + minutes.toString() + " min";
|
30
|
+
}
|
31
|
+
}
|
32
|
+
export class Memory {
|
33
|
+
constructor() {
|
34
|
+
Memory.rss = 0;
|
35
|
+
}
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
37
|
+
static info(description = ``, fullInfo = false) {
|
38
|
+
const memoryData = process.memoryUsage();
|
39
|
+
const formatMemoryUsage = (data) => `${Math.round(data / 1024 / 1024)} MB`;
|
40
|
+
const oldRSS = Memory.rss;
|
41
|
+
Memory.rss = Math.round(memoryData.rss / 1024 / 1024);
|
42
|
+
const memoryUsage = fullInfo
|
43
|
+
? {
|
44
|
+
step: `${description}:`,
|
45
|
+
rssDelta: `${(oldRSS === 0
|
46
|
+
? 0
|
47
|
+
: Memory.rss - oldRSS).toString()} MB -> Resident Set Size memory change`,
|
48
|
+
rss: `${formatMemoryUsage(memoryData.rss)} -> Resident Set Size - total memory allocated`,
|
49
|
+
heapTotal: `${formatMemoryUsage(memoryData.heapTotal)} -> total size of the allocated heap`,
|
50
|
+
heapUsed: `${formatMemoryUsage(memoryData.heapUsed)} -> actual memory used during the execution`,
|
51
|
+
external: `${formatMemoryUsage(memoryData.external)} -> V8 external memory`,
|
52
|
+
}
|
53
|
+
: `RSS memory ${description}: ${formatMemoryUsage(memoryData.rss)}${oldRSS === 0
|
54
|
+
? ``
|
55
|
+
: `, changed by ` + (Memory.rss - oldRSS).toString() + ` MB`}`;
|
56
|
+
console.log(memoryUsage);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
60
|
+
Memory.rss = 0;
|
61
|
+
//# sourceMappingURL=utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3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