@ton/sandbox 0.30.0 → 0.32.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.
- package/CHANGELOG.md +17 -1
- package/README.md +104 -0
- package/dist/blockchain/Blockchain.d.ts +16 -2
- package/dist/blockchain/Blockchain.js +31 -13
- package/dist/blockchain/SmartContract.js +2 -0
- package/dist/executor/Executor.d.ts +14 -0
- package/dist/executor/Executor.js +34 -1
- package/dist/executor/emulator-emscripten.js +1 -1
- package/dist/executor/emulator-emscripten.wasm.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +15 -0
- package/dist/jest/BenchmarkCommand.d.ts +10 -0
- package/dist/jest/BenchmarkCommand.js +14 -0
- package/dist/jest/BenchmarkEnvironment.d.ts +19 -0
- package/dist/jest/BenchmarkEnvironment.js +46 -0
- package/dist/jest/BenchmarkReporter.d.ts +45 -0
- package/dist/jest/BenchmarkReporter.js +207 -0
- package/dist/meta/ContractsMeta.d.ts +10 -0
- package/dist/meta/ContractsMeta.js +2 -0
- package/dist/metric/ContractDatabase.d.ts +21 -0
- package/dist/metric/ContractDatabase.js +111 -0
- package/dist/metric/collectMetric.d.ts +106 -0
- package/dist/metric/collectMetric.js +217 -0
- package/dist/metric/defaultColor.d.ts +2 -0
- package/dist/metric/defaultColor.js +45 -0
- package/dist/metric/deltaResult.d.ts +39 -0
- package/dist/metric/deltaResult.js +210 -0
- package/dist/metric/gasReportTable.d.ts +2 -0
- package/dist/metric/gasReportTable.js +112 -0
- package/dist/metric/index.d.ts +6 -0
- package/dist/metric/index.js +22 -0
- package/dist/metric/readSnapshots.d.ts +2 -0
- package/dist/metric/readSnapshots.js +33 -0
- package/dist/utils/readJsonl.d.ts +1 -0
- package/dist/utils/readJsonl.js +25 -0
- package/jest-environment.js +1 -0
- package/jest-reporter.js +1 -0
- package/package.json +24 -5
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readSnapshots = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
async function readSnapshots(snapshotDir) {
|
|
7
|
+
const list = {};
|
|
8
|
+
if (!(0, fs_1.existsSync)(snapshotDir)) {
|
|
9
|
+
return list;
|
|
10
|
+
}
|
|
11
|
+
const snapshotFiles = (0, fs_1.readdirSync)(snapshotDir).filter((f) => f.endsWith('.json'));
|
|
12
|
+
for (const snapshotFile of snapshotFiles) {
|
|
13
|
+
const data = (0, fs_1.readFileSync)((0, path_1.join)(snapshotDir, snapshotFile), 'utf-8');
|
|
14
|
+
try {
|
|
15
|
+
const raw = JSON.parse(data);
|
|
16
|
+
const snapshot = {
|
|
17
|
+
...raw,
|
|
18
|
+
createdAt: new Date(raw.createdAt),
|
|
19
|
+
};
|
|
20
|
+
if (!list[snapshot.label]) {
|
|
21
|
+
list[snapshot.label] = {
|
|
22
|
+
name: snapshotFile,
|
|
23
|
+
content: snapshot,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (_) {
|
|
28
|
+
throw new Error(`Can not parse snapshot file: ${snapshotFile}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return list;
|
|
32
|
+
}
|
|
33
|
+
exports.readSnapshots = readSnapshots;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readJsonl<T>(filePath: string): Promise<T[]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readJsonl = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const readline_1 = require("readline");
|
|
6
|
+
async function readJsonl(filePath) {
|
|
7
|
+
const input = (0, fs_1.createReadStream)(filePath, { encoding: 'utf8' });
|
|
8
|
+
const readLine = (0, readline_1.createInterface)({
|
|
9
|
+
input,
|
|
10
|
+
crlfDelay: Infinity,
|
|
11
|
+
});
|
|
12
|
+
const result = [];
|
|
13
|
+
for await (const line of readLine) {
|
|
14
|
+
if (!line.trim())
|
|
15
|
+
continue;
|
|
16
|
+
try {
|
|
17
|
+
result.push(JSON.parse(line));
|
|
18
|
+
}
|
|
19
|
+
catch (_) {
|
|
20
|
+
throw new Error(`Could not parse line: ${line}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
exports.readJsonl = readJsonl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./dist/jest/BenchmarkEnvironment").default;
|
package/jest-reporter.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./dist/jest/BenchmarkReporter").default;
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ton/sandbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "TON transaction emulator",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "TonTech",
|
|
8
8
|
"files": [
|
|
9
|
+
"jest-environment.js",
|
|
10
|
+
"jest-reporter.js",
|
|
9
11
|
"dist/**/*"
|
|
10
12
|
],
|
|
11
13
|
"repository": {
|
|
@@ -15,24 +17,41 @@
|
|
|
15
17
|
"devDependencies": {
|
|
16
18
|
"@ton/core": "^0.60.1",
|
|
17
19
|
"@ton/crypto": "3.3.0",
|
|
18
|
-
"@ton/test-utils": "^0.
|
|
20
|
+
"@ton/test-utils": "^0.7.0",
|
|
21
|
+
"@ton/tolk-js": "^0.13.0",
|
|
19
22
|
"@ton/ton": "^15.2.1",
|
|
20
23
|
"@types/jest": "^29.5.0",
|
|
21
24
|
"@types/node": "^18.15.11",
|
|
22
25
|
"jest": "^29.5.0",
|
|
26
|
+
"jest-config": "^29.7.0",
|
|
27
|
+
"jest-environment-node": "^29.7.0",
|
|
23
28
|
"ts-jest": "^29.0.5",
|
|
24
29
|
"ts-node": "^10.9.1",
|
|
25
30
|
"typescript": "^4.9.5"
|
|
26
31
|
},
|
|
27
32
|
"peerDependencies": {
|
|
28
|
-
"@ton/crypto": ">=3.3.0"
|
|
33
|
+
"@ton/crypto": ">=3.3.0",
|
|
34
|
+
"@ton/test-utils": ">=0.7.0",
|
|
35
|
+
"jest": "^29.5.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@ton/test-utils": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
41
|
+
"jest": {
|
|
42
|
+
"optional": true
|
|
43
|
+
}
|
|
29
44
|
},
|
|
30
45
|
"scripts": {
|
|
46
|
+
"metric": "BENCH_NEW=\"@ton/sandbox v$(npm view @ton/sandbox version)\" jest",
|
|
31
47
|
"wasm:pack": "ts-node ./scripts/pack-wasm.ts",
|
|
32
48
|
"wasm:copy": "cp src/executor/emulator-emscripten.js src/executor/emulator-emscripten.wasm.js ./dist/executor",
|
|
33
49
|
"test": "yarn wasm:pack && yarn jest src",
|
|
34
|
-
"build": "rm -rf dist && yarn wasm:pack && yarn test &&
|
|
50
|
+
"build": "rm -rf dist && yarn wasm:pack && tsc && yarn test && yarn wasm:copy",
|
|
35
51
|
"config:pack": "ts-node ./scripts/pack-config.ts"
|
|
36
52
|
},
|
|
37
|
-
"packageManager": "yarn@3.6.1"
|
|
53
|
+
"packageManager": "yarn@3.6.1",
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"table": "^6.9.0"
|
|
56
|
+
}
|
|
38
57
|
}
|