@ton/sandbox 0.42.0 → 0.43.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 (35) hide show
  1. package/dist/blockchain/Blockchain.d.ts +1 -6
  2. package/dist/blockchain/Blockchain.js +0 -15
  3. package/dist/blockchain/SmartContract.d.ts +0 -3
  4. package/dist/blockchain/SmartContract.js +1 -39
  5. package/dist/config/config.tlb-gen.d.ts +69 -18
  6. package/dist/config/config.tlb-gen.js +273 -53
  7. package/dist/config/defaultConfig.d.ts +2 -2
  8. package/dist/config/defaultConfig.js +2 -2
  9. package/dist/config/slimConfig.d.ts +2 -2
  10. package/dist/config/slimConfig.js +2 -2
  11. package/dist/executor/Executor.d.ts +1 -37
  12. package/dist/executor/Executor.js +3 -160
  13. package/dist/executor/emulator-emscripten.js +1 -1
  14. package/dist/executor/emulator-emscripten.wasm.js +1 -1
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +1 -3
  17. package/package.json +3 -5
  18. package/dist/debugger/DebugContext.d.ts +0 -14
  19. package/dist/debugger/DebugContext.js +0 -29
  20. package/dist/debugger/DebugInfoCache.d.ts +0 -9
  21. package/dist/debugger/DebugInfoCache.js +0 -87
  22. package/dist/debugger/Debuggee.d.ts +0 -147
  23. package/dist/debugger/Debuggee.js +0 -451
  24. package/dist/debugger/TVMDebugSession.d.ts +0 -26
  25. package/dist/debugger/TVMDebugSession.js +0 -272
  26. package/dist/debugger/debug.d.ts +0 -4
  27. package/dist/debugger/debug.js +0 -76
  28. package/dist/debugger/index.d.ts +0 -1
  29. package/dist/debugger/index.js +0 -5
  30. package/dist/debugger/marks.d.ts +0 -2
  31. package/dist/debugger/marks.js +0 -127
  32. package/dist/executor/emulator-emscripten.debugger.bpatch.gzip.js +0 -1
  33. package/dist/executor/emulator-emscripten.debugger.js +0 -20
  34. package/dist/utils/bpatch.d.ts +0 -9
  35. package/dist/utils/bpatch.js +0 -52
package/dist/index.d.ts CHANGED
@@ -15,5 +15,4 @@ export { internal } from './utils/message';
15
15
  export { fetchConfig, setGlobalVersion } from './utils/config';
16
16
  export { ExtraCurrency } from './utils/ec';
17
17
  export * from './metric';
18
- export { registerCompiledContract } from './debugger/DebugInfoCache';
19
18
  export { generateCoverageSummary, mergeCoverages, collectAsmCoverage, generateHtmlReport, generateTextReport, coverageFromJson, coverageToJson, CoverageSummary, CoverageData, Line, Covered, Skipped, Uncovered, Coverage, } from './coverage';
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Coverage = exports.coverageToJson = exports.coverageFromJson = exports.generateTextReport = exports.generateHtmlReport = exports.collectAsmCoverage = exports.mergeCoverages = exports.generateCoverageSummary = exports.registerCompiledContract = exports.setGlobalVersion = exports.fetchConfig = exports.internal = exports.printTransactionFees = exports.prettyLogTransactions = exports.prettyLogTransaction = exports.TreasuryContract = exports.updateConfig = exports.loadConfig = exports.Executor = exports.snapshotFromSerializable = exports.snapshotToSerializable = exports.EmulationError = exports.TimeError = exports.GetMethodError = exports.createShardAccount = exports.createEmptyShardAccount = exports.SmartContract = exports.wrapTonClient4ForRemote = exports.RemoteBlockchainStorage = exports.LocalBlockchainStorage = exports.BlockchainSender = exports.BlockchainContractProvider = exports.toSandboxContract = exports.Blockchain = exports.defaultConfigSeqno = exports.defaultConfig = void 0;
17
+ exports.Coverage = exports.coverageToJson = exports.coverageFromJson = exports.generateTextReport = exports.generateHtmlReport = exports.collectAsmCoverage = exports.mergeCoverages = exports.generateCoverageSummary = exports.setGlobalVersion = exports.fetchConfig = exports.internal = exports.printTransactionFees = exports.prettyLogTransactions = exports.prettyLogTransaction = exports.TreasuryContract = exports.updateConfig = exports.loadConfig = exports.Executor = exports.snapshotFromSerializable = exports.snapshotToSerializable = exports.EmulationError = exports.TimeError = exports.GetMethodError = exports.createShardAccount = exports.createEmptyShardAccount = exports.SmartContract = exports.wrapTonClient4ForRemote = exports.RemoteBlockchainStorage = exports.LocalBlockchainStorage = exports.BlockchainSender = exports.BlockchainContractProvider = exports.toSandboxContract = exports.Blockchain = exports.defaultConfigSeqno = exports.defaultConfig = void 0;
18
18
  var defaultConfig_1 = require("./config/defaultConfig");
19
19
  Object.defineProperty(exports, "defaultConfig", { enumerable: true, get: function () { return defaultConfig_1.defaultConfig; } });
20
20
  Object.defineProperty(exports, "defaultConfigSeqno", { enumerable: true, get: function () { return defaultConfig_1.defaultConfigSeqno; } });
@@ -57,8 +57,6 @@ var config_1 = require("./utils/config");
57
57
  Object.defineProperty(exports, "fetchConfig", { enumerable: true, get: function () { return config_1.fetchConfig; } });
58
58
  Object.defineProperty(exports, "setGlobalVersion", { enumerable: true, get: function () { return config_1.setGlobalVersion; } });
59
59
  __exportStar(require("./metric"), exports);
60
- var DebugInfoCache_1 = require("./debugger/DebugInfoCache");
61
- Object.defineProperty(exports, "registerCompiledContract", { enumerable: true, get: function () { return DebugInfoCache_1.registerCompiledContract; } });
62
60
  var coverage_1 = require("./coverage");
63
61
  Object.defineProperty(exports, "generateCoverageSummary", { enumerable: true, get: function () { return coverage_1.generateCoverageSummary; } });
64
62
  Object.defineProperty(exports, "mergeCoverages", { enumerable: true, get: function () { return coverage_1.mergeCoverages; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/sandbox",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "TON transaction emulator",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/ton-org/sandbox"
15
+ "url": "git+https://github.com/ton-org/sandbox.git"
16
16
  },
17
17
  "prettier": "@ton/toolchain/prettier",
18
18
  "devDependencies": {
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "scripts": {
53
53
  "wasm:pack": "ts-node ./scripts/pack-wasm.ts",
54
- "wasm:copy": "cp src/executor/emulator-emscripten.js src/executor/emulator-emscripten.wasm.js src/executor/emulator-emscripten.debugger.js src/executor/emulator-emscripten.debugger.bpatch.gzip.js ./dist/executor",
54
+ "wasm:copy": "cp src/executor/emulator-emscripten.js src/executor/emulator-emscripten.wasm.js ./dist/executor",
55
55
  "test": "yarn wasm:pack && yarn jest src",
56
56
  "build": "rm -rf dist && yarn wasm:pack && tsc && yarn wasm:copy",
57
57
  "bt": "yarn build && yarn test",
@@ -61,9 +61,7 @@
61
61
  },
62
62
  "packageManager": "yarn@4.9.2",
63
63
  "dependencies": {
64
- "@vscode/debugadapter": "^1.68.0",
65
64
  "chalk": "^4.1.2",
66
- "fflate": "^0.8.2",
67
65
  "table": "^6.9.0",
68
66
  "ton-assembly": "0.6.1"
69
67
  }
@@ -1,14 +0,0 @@
1
- import type { ShardAccount } from '@ton/core';
2
- import type { EmulationResult, Executor, GetMethodArgs, GetMethodResult, RunTransactionArgs } from '../executor/Executor';
3
- import type { DebugInfo } from './Debuggee';
4
- declare class DebugContext {
5
- constructor();
6
- getDebugInfo: (account: ShardAccount) => {
7
- uninitialized: boolean;
8
- debugInfo: DebugInfo | undefined;
9
- };
10
- debugGetMethod: (executor: Executor, args: GetMethodArgs, debugInfo: DebugInfo) => Promise<GetMethodResult>;
11
- debugTransaction: (executor: Executor, args: RunTransactionArgs, debugInfo: DebugInfo) => Promise<EmulationResult>;
12
- }
13
- export declare function getDebugContext(): DebugContext;
14
- export {};
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDebugContext = getDebugContext;
4
- const environment_1 = require("../utils/environment");
5
- // only this class is allowed to use outside the 'debugger' directory for browser support
6
- class DebugContext {
7
- constructor() {
8
- // eslint-disable-next-line @typescript-eslint/no-require-imports
9
- const { debugGetMethod, debugTransaction } = require('./debug');
10
- // eslint-disable-next-line @typescript-eslint/no-require-imports
11
- const { getDebugInfo } = require('./DebugInfoCache');
12
- this.debugGetMethod = debugGetMethod;
13
- this.debugTransaction = debugTransaction;
14
- this.getDebugInfo = getDebugInfo;
15
- }
16
- getDebugInfo;
17
- debugGetMethod;
18
- debugTransaction;
19
- }
20
- let debugContext = undefined;
21
- function getDebugContext() {
22
- if ((0, environment_1.isBrowser)()) {
23
- throw new Error('Debug feature is not supported in browser environment');
24
- }
25
- if (!debugContext) {
26
- debugContext = new DebugContext();
27
- }
28
- return debugContext;
29
- }
@@ -1,9 +0,0 @@
1
- import { Cell, type ShardAccount } from '@ton/core';
2
- import { DebugInfo as FuncDebugInfo } from '@ton-community/func-js';
3
- import type { DebugInfo } from './Debuggee';
4
- export type DebugInfoCache = Map<string, DebugInfo>;
5
- export declare function getDebugInfo(acc: ShardAccount): {
6
- uninitialized: boolean;
7
- debugInfo: DebugInfo | undefined;
8
- };
9
- export declare function registerCompiledContract(code: Cell, debugInfo: FuncDebugInfo, marks: Cell): Cell;
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDebugInfo = getDebugInfo;
4
- exports.registerCompiledContract = registerCompiledContract;
5
- const marks_1 = require("./marks");
6
- const environment_1 = require("../utils/environment");
7
- const defaultDebugInfoCache = new Map();
8
- function getDebugInfo(acc) {
9
- if (acc.account === undefined || acc.account === null) {
10
- return { uninitialized: true, debugInfo: undefined };
11
- }
12
- if (acc.account.storage.state.type !== 'active') {
13
- return { uninitialized: true, debugInfo: undefined };
14
- }
15
- const code = acc.account.storage.state.state.code;
16
- if (code === undefined || code === null) {
17
- return { uninitialized: true, debugInfo: undefined };
18
- }
19
- const debugInfo = defaultDebugInfoCache.get(code.hash().toString('base64'));
20
- return { uninitialized: false, debugInfo };
21
- }
22
- function registerCompiledContract(code, debugInfo, marks) {
23
- if ((0, environment_1.isBrowser)()) {
24
- throw new Error('Debug feature is not supported in browser environment');
25
- }
26
- const parsedMarks = (0, marks_1.parseMarks)(marks, code);
27
- const { locations, globals } = debugInfo;
28
- const sm = {};
29
- for (let i = 0; i < locations.length; i++) {
30
- const di = locations[i];
31
- const common = {
32
- // eslint-disable-next-line @typescript-eslint/no-require-imports
33
- path: require('node:path').resolve(di.file),
34
- line: di.line,
35
- function: di.func,
36
- contextId: di.ctx_id,
37
- requireContextId: di.req_ctx_id,
38
- };
39
- if (di.ret) {
40
- sm[i] = {
41
- ...common,
42
- type: 'return',
43
- };
44
- }
45
- else if (di.try_catch_ctx_id !== undefined) {
46
- sm[i] = {
47
- ...common,
48
- type: 'try_begin',
49
- catchContextId: di.try_catch_ctx_id,
50
- };
51
- }
52
- else if (di.is_try_end) {
53
- sm[i] = {
54
- ...common,
55
- type: 'try_end',
56
- };
57
- }
58
- else if (di.vars !== undefined) {
59
- sm[i] = {
60
- ...common,
61
- type: 'statement',
62
- variables: di.vars ?? [],
63
- firstStatement: di.first_stmt,
64
- };
65
- }
66
- else if (di.branch_true_ctx_id !== undefined) {
67
- sm[i] = {
68
- ...common,
69
- type: 'branch',
70
- trueContextId: di.branch_true_ctx_id,
71
- falseContextId: di.branch_false_ctx_id,
72
- };
73
- }
74
- else {
75
- sm[i] = {
76
- ...common,
77
- type: 'context',
78
- };
79
- }
80
- }
81
- defaultDebugInfoCache.set(code.hash().toString('base64'), {
82
- sourceMap: sm,
83
- globals,
84
- marks: parsedMarks,
85
- });
86
- return code;
87
- }
@@ -1,147 +0,0 @@
1
- import EventEmitter from 'node:events';
2
- import { TupleItem } from '@ton/core';
3
- import { Executor, GetMethodArgs, RunTransactionArgs } from '../executor/Executor';
4
- export type SourceMapEntry = {
5
- path: string;
6
- line: number;
7
- function: string;
8
- contextId: number;
9
- requireContextId?: number;
10
- } & ({
11
- type: 'statement';
12
- variables: string[];
13
- firstStatement?: true;
14
- } | {
15
- type: 'return';
16
- } | {
17
- type: 'try_begin';
18
- catchContextId: number;
19
- } | {
20
- type: 'try_end';
21
- } | {
22
- type: 'context';
23
- } | {
24
- type: 'branch';
25
- trueContextId: number;
26
- falseContextId?: number;
27
- });
28
- export type DebugMarks = Map<string, Map<number, number[]>>;
29
- export type SourceMap = {
30
- [k: number]: SourceMapEntry;
31
- };
32
- export type GlobalEntry = {
33
- name: string;
34
- };
35
- export type DebugInfo = {
36
- sourceMap: SourceMap;
37
- globals: GlobalEntry[];
38
- marks: DebugMarks;
39
- };
40
- type Breakpoint = {
41
- id: number;
42
- line: number;
43
- verified: boolean;
44
- };
45
- export type Variable = {
46
- name: string;
47
- value: TupleItem;
48
- };
49
- type StackFrame = {
50
- function: string;
51
- path: string;
52
- line: number;
53
- nextContextId: number;
54
- contextId: number;
55
- shouldTryNoStep: boolean;
56
- stepped: boolean;
57
- };
58
- type StepUntil = {
59
- type: 'breakpoint';
60
- } | {
61
- type: 'any-line';
62
- stopEvent: 'stopOnBreakpoint' | 'stopOnStep';
63
- } | {
64
- type: 'next-line';
65
- depth: number;
66
- } | {
67
- type: 'out';
68
- depth: number;
69
- };
70
- type TryContext = {
71
- contextId: number;
72
- frameDepth: number;
73
- };
74
- export declare class Debuggee extends EventEmitter {
75
- executor: Executor;
76
- ptr: number;
77
- debugType: 'get' | 'tx';
78
- sourceMap: SourceMap;
79
- availableLines: {
80
- [k: string]: number[];
81
- };
82
- breakpoints: Map<string, Breakpoint[]>;
83
- breakpointID: number;
84
- frames: StackFrame[];
85
- globals: GlobalEntry[];
86
- debugMarks: DebugMarks;
87
- tryContexts: TryContext[];
88
- finishedCallback: (v: unknown) => void;
89
- constructor(executor: Executor, finishedCallback: (v: unknown) => void);
90
- setDebugInfo(debugInfo: DebugInfo): void;
91
- setDebugMarks(marks: DebugMarks): void;
92
- setSourceMap(sourceMap: SourceMap): void;
93
- setGlobals(globals: GlobalEntry[]): void;
94
- getAvailableSourcePaths(): string[];
95
- getAvailableLines(path: string): number[];
96
- isLineAvailable(path: string, line: number): boolean;
97
- continue(): void;
98
- stepIn(): void;
99
- stepOver(): void;
100
- stepOut(): void;
101
- startGetMethod(args: GetMethodArgs): void;
102
- startTransaction(args: RunTransactionArgs): void;
103
- getC7(): TupleItem;
104
- vmStep(): boolean;
105
- codePos(): {
106
- hash: string;
107
- offset: number;
108
- };
109
- getStack(): TupleItem[];
110
- getContDistinguisher(): number;
111
- setContDistinguishers(distinguisher: number, trueDistinguisher: number, falseDistinguisher: number): void;
112
- getContDistinguisherTriggered(): boolean;
113
- setTryParams(primed: number, triggered: number): void;
114
- getTriggeredTryParam(): number;
115
- getLocalVariables(): Variable[] | undefined;
116
- getGlobalVariables(): Variable[] | undefined;
117
- currentDebugMarks(): number[] | undefined;
118
- currentSourceMapEntry(honorStepped: boolean): SourceMapEntry | undefined;
119
- breakpointKey(path: string, line: number): string;
120
- splitBreakpointKey(k: string): {
121
- path: string;
122
- line: number;
123
- };
124
- clearBreakpoints(path: string): void;
125
- hasBreakpoint(path: string, line: number): boolean;
126
- setBreakpoint(path: string, line: number): Breakpoint;
127
- sendEvent(event: string, ...args: unknown[]): void;
128
- onFinished(): void;
129
- stackFrames(): StackFrame[];
130
- applySourceMapEntry(sme: SourceMapEntry, until: StepUntil): {
131
- stopStepping: boolean;
132
- };
133
- stepUntil(what: {
134
- type: 'breakpoint';
135
- } | {
136
- type: 'any-line';
137
- stopEvent: 'stopOnBreakpoint' | 'stopOnStep';
138
- } | {
139
- type: 'next-line';
140
- } | {
141
- type: 'out';
142
- }): void;
143
- prepareGetMethod(args: GetMethodArgs, debugInfo: DebugInfo): void;
144
- prepareTransaction(args: RunTransactionArgs, debugInfo: DebugInfo): void;
145
- start(debug: boolean, stopOnEntry: boolean): void;
146
- }
147
- export {};