@ton/sandbox 0.41.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 (36) 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 +4 -6
  18. package/CHANGELOG.md +0 -531
  19. package/dist/debugger/DebugContext.d.ts +0 -14
  20. package/dist/debugger/DebugContext.js +0 -29
  21. package/dist/debugger/DebugInfoCache.d.ts +0 -9
  22. package/dist/debugger/DebugInfoCache.js +0 -87
  23. package/dist/debugger/Debuggee.d.ts +0 -147
  24. package/dist/debugger/Debuggee.js +0 -451
  25. package/dist/debugger/TVMDebugSession.d.ts +0 -26
  26. package/dist/debugger/TVMDebugSession.js +0 -272
  27. package/dist/debugger/debug.d.ts +0 -4
  28. package/dist/debugger/debug.js +0 -76
  29. package/dist/debugger/index.d.ts +0 -1
  30. package/dist/debugger/index.js +0 -5
  31. package/dist/debugger/marks.d.ts +0 -2
  32. package/dist/debugger/marks.js +0 -127
  33. package/dist/executor/emulator-emscripten.debugger.bpatch.gzip.js +0 -1
  34. package/dist/executor/emulator-emscripten.debugger.js +0 -20
  35. package/dist/utils/bpatch.d.ts +0 -9
  36. 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.41.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,10 +61,8 @@
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
  }
70
- }
68
+ }
package/CHANGELOG.md DELETED
@@ -1,531 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [0.41.0] - 2025-12-05
9
-
10
- ### Changed
11
-
12
- - Updated emulator WASM binary
13
- - Debug logs are now extracted from VM logs (due to emulator changes), which interacts in subtle ways with the verbosity settings
14
-
15
- ## [0.40.0] - 2025-12-04
16
-
17
- ### Added
18
-
19
- - Sandbox UI support
20
-
21
- ### Changed
22
-
23
- - Updated emulator WASM binary
24
- - Updated dependencies
25
- - `Blockchain` now allows null code and data in state init
26
-
27
- ### Fixed
28
-
29
- - Fixed `@ton/test-utils` import
30
-
31
- ## [0.39.0] - 2025-10-29
32
-
33
- ### Changed
34
-
35
- - Updated emulator WASM binary
36
-
37
- ## [0.38.0] - 2025-10-15
38
-
39
- ### Added
40
-
41
- - Added support for TVM v12
42
-
43
- ### Changed
44
-
45
- - Failed actions are now partially handled when parsing send modes for transactions
46
-
47
- ## [0.37.2] - 2025-09-23
48
-
49
- ### Fixed
50
-
51
- - Fixed coverage by updating `ton-assembly`
52
- - Fixed `requireOptional` typing
53
-
54
- ## [0.37.1] - 2025-09-03
55
-
56
- ### Fixed
57
-
58
- - Made `@ton/test-utils` import optional, preventing errors in environments where it's not installed.
59
-
60
- ## [0.37.0] - 2025-08-18
61
-
62
- ### Added
63
-
64
- - Added `snapshotToSerializable` and `snapshotFromSerializable` utilities to enable snapshot serialization (e.g., to JSON), allowing snapshots to be saved, transferred, and restored easily.
65
-
66
- ### Changed
67
-
68
- - Switched to Jest 30
69
-
70
- ## [0.36.0] - 2025-08-04
71
-
72
- ### Added
73
-
74
- - Added `Blockchain.getTransactions` method to fetch transactions
75
- - Added coverage
76
- - Added `allowParallel` flag to `Blockchain.sendMessageIter` method, allowing for testing MITM attack
77
- - Added `autoDeployLibs` flag, that allow to detect libraries, deployed by contract in masterchain automatically
78
-
79
- ### Changed
80
-
81
- - Added `@ton-community/func-js` to `peerDependencies` to fix missing module error in downstream TypeScript projects
82
-
83
- ### Fixed
84
-
85
- - Fixed `SmartContract.loadFrom()` comparing addresses by reference
86
-
87
- ## [0.35.1] - 2025-07-08
88
-
89
- ### Fixed
90
-
91
- - Fixed sandbox not running in browser environment
92
-
93
- ## [0.35.0] - 2025-07-07
94
-
95
- ### Changed
96
-
97
- - Updated config to match update https://t.me/tonstatus/171
98
-
99
- ## [0.34.0] - 2025-06-26
100
-
101
- ### Added
102
-
103
- - Added debugger
104
- - Added `outActions` and `mode` fields to transactions
105
-
106
- ## [0.33.0] - 2025-06-16
107
-
108
- ### Added
109
-
110
- - Added `fetchConfig` and `setGlobalVersion` utility functions
111
- - Added `blockchain.randomSeed` property
112
- - Added `prevBlocksInfo` to snapshot
113
- - Add possibility to update blockchain config
114
-
115
- ### Fixed
116
-
117
- - Fixed `now` not updating when running transaction through `blockchain.sendMessageIter`
118
- - Fixed `is` methods type and code mismatch
119
- - Fixed `Blockchain.snapshot()` returning mutable references to internal blockchain state
120
-
121
- ## [0.32.2] - 2025-06-10
122
-
123
- ### Changed
124
-
125
- - Added missing `@ton/core` peer dependency
126
-
127
- ### Fixed
128
-
129
- - Fixed missing `storageExtra` field when creating accounts
130
-
131
- ## [0.32.1] - 2025-06-05
132
-
133
- ### Fixed
134
-
135
- - Fixed missing `chalk` dependency
136
-
137
- ## [0.32.0] - 2025-06-02
138
-
139
- ### Added
140
-
141
- - Added contract meta gathering via meta field in blockchain
142
- - Added ability to set `PREVBLOCKS` information
143
-
144
- ## [0.31.0] - 2025-05-20
145
-
146
- ### Added
147
-
148
- - Added methods to collect metrics of contracts
149
- - Added `@ton/sandbox/jest-environment` and `@ton/sandbox/jest-reporter` to write metric snapshots from test run results
150
- - Added contract method ABI auto-mapping mechanism for detailed benchmark metrics
151
- - Added methods to generate delta reports from metrics of contracts
152
-
153
- ## [0.30.0] - 2025-05-12
154
-
155
- ### Changed
156
-
157
- - Updated config
158
-
159
- ## [0.29.0] - 2025-04-30
160
-
161
- ### Changed
162
-
163
- - Updated API docs
164
- - Updated emulator WASM binary (TON v2025.04)
165
-
166
- ## [0.28.0] - 2025-04-01
167
-
168
- ### Added
169
-
170
- - Added `getVersion` method to `Executor`
171
-
172
- ### Changed
173
-
174
- - Updated emulator WASM binary (TON v2025.03)
175
- - Updated config
176
-
177
- ## [0.27.1] - 2025-02-25
178
-
179
- ### Fixed
180
-
181
- - Fixed a bug pertaining to blockchain snapshot loading
182
-
183
- ## [0.27.0] - 2025-02-20
184
-
185
- ### Added
186
-
187
- - Added better extra currency support
188
-
189
- ### Changed
190
-
191
- - Updated dependencies
192
-
193
- ## [0.26.0] - 2025-02-12
194
-
195
- ### Changed
196
-
197
- - Updated emulator WASM binary (TON v2025.02)
198
-
199
- ## [0.25.0] - 2025-01-30
200
-
201
- ### Changed
202
-
203
- - Extra currencies are now available in get methods
204
-
205
- ## [0.24.0] - 2025-01-17
206
-
207
- ### Added
208
-
209
- - Added `SmartContract.ec` getter and setter to work with extra currencies
210
- - Added an optional `ec` parameter to `internal` helper to set extra currencies
211
-
212
- ## [0.23.0] - 2024-12-18
213
-
214
- ### Updated
215
-
216
- - Updated emulator WASM binary
217
-
218
- ## [0.22.0] - 2024-09-17
219
-
220
- ### Added
221
-
222
- - Added `blockchain.recordStorage` flag. If set to `true`, `BlockchainTransaction` will have `oldStorage` and `newStorage` fields. Note that enabling this flag will disable a certain optimization, which will slow down contract emulation
223
-
224
- ## [0.21.0] - 2024-09-16
225
-
226
- ### Added
227
-
228
- - `SandboxContract` now wraps methods starting with `is` (having the same semantics as `get`) as well as `send` and `get`
229
-
230
- ### Changed
231
-
232
- - Updated dependencies
233
-
234
- ## [0.20.0] - 2024-05-31
235
-
236
- ### Added
237
-
238
- - Added the ability to create `Blockchain` using a custom `IExecutor` instead of the default `Executor`
239
- - Added more information to `EmulationError`, extended its error message
240
-
241
- ## [0.19.0] - 2024-04-27
242
-
243
- ### Fixed
244
-
245
- - Fixed a bug in the emulator that caused send mode 16 to not properly work
246
-
247
- ## [0.18.0] - 2024-04-23
248
-
249
- ### Changed
250
-
251
- - Changed the default and slim configs to use the latest config at the time of release, which reduces gas fees by a factor of 2.5x
252
-
253
- ## [0.17.0] - 2024-03-27
254
-
255
- ### Changed
256
-
257
- - Updated emulator WASM binary
258
- - Changed the default and slim configs to use the latest config at the time of release, which enables TVM v6 opcodes
259
-
260
- ## [0.16.0] - 2024-03-01
261
-
262
- This release contains a breaking change.
263
-
264
- ### Added
265
-
266
- - Added `IExecutor` interface with the prospect of creating custom executor
267
- - Added `open` and `getTransactions` to sandbox's `ContractProvider`
268
- - Added `toSandboxContract` helper function to cast `OpenedContract<T>` to `SandboxContract<T>` when applicable
269
-
270
- ### Changed
271
-
272
- - Changed the default executor to have `async` methods (it still has sync nature)
273
- - Improved get method return object
274
-
275
- ## [0.15.0] - 2023-12-24
276
-
277
- ### Changed
278
-
279
- - Changed the default and slim configs to use the latest config at the time of release, which enables new TVM opcodes
280
-
281
- ## [0.14.0] - 2023-12-04
282
-
283
- ### Changed
284
-
285
- - Updated emulator WASM binary
286
-
287
- ## [0.13.1] - 2023-10-10
288
-
289
- ### Fixed
290
-
291
- - Fixed a bug in `Blockchain` that led to storage fetch errors (for example, network errors in `RemoteBlockchainStorage`) being cached and breaking that contract address forever
292
-
293
- ## [0.13.0] - 2023-10-05
294
-
295
- ### Changed
296
-
297
- - On transaction emulation error, an `EmulationError` is now thrown that has an `error` string, `vmLogs`, and `exitCode` (the latter two being optional). The error is no longer being dumped into console
298
-
299
- ## [0.12.0] - 2023-10-03
300
-
301
- ### Added
302
-
303
- - Step by step execution (`blockchain.sendMessageIter`)
304
- - Better docs
305
-
306
- ### Fixed
307
-
308
- - `now` from `Blockchain` is now honored in `SmartContract.receiveMessage`
309
- - Exit code 1 is now counted as success in get methods
310
-
311
- ## [0.11.1] - 2023-07-26
312
-
313
- ### Changed
314
-
315
- - Migrated dependencies to @ton organization packages
316
- - Bumped @ton/test-utils version to 0.3.1
317
-
318
- ## [0.11.0] - 2023-05-11
319
-
320
- ### Added
321
-
322
- - Added the ability to emulate ticktock transactions. There are 3 ways to do that: `blockchain.runTickTock(Address | Address[], TickOrTock, MessageParams?)`, `smartContract.runTickTock(TickOrTock, MessageParams?)`, or you can change `ContractProvider` in your wrapper classes to be `SandboxContractProvider` and invoke `tickTock(TickOrTock)` on it. `TickOrTock` is a union type `'tick' | 'tock'`
323
- - Added new verbosity levels: `'vm_logs_location'` (same as `'vm_logs'` but also display code cell hash and offset), `'vm_logs_gas'` (same as `'vm_logs_location'` but also display gas remaining), `'vm_logs_verbose'` (same as `'vm_logs_full'` but display stack values in a more verbose way)
324
-
325
- ### Changed
326
-
327
- - Changed emulator WASM binary
328
-
329
- ## [0.10.0] - 2023-05-04
330
-
331
- ### Changed
332
-
333
- - Changed emulator WASM binary
334
- - Changed treasury code
335
-
336
- ### Fixed
337
-
338
- - Fixed certain interactions between snapshots and treasuries
339
-
340
- ## [0.9.0] - 2023-04-27
341
-
342
- ### Added
343
-
344
- - Added `printTransactionFees` helper for easier calculation of fees of different operations
345
- - Added `blockchain.snapshot`, `blockchain.loadFrom`, `smartContract.snapshot`, `smartContract.loadFrom` methods to create state snapshots of the respective objects and restore from them at a later point in time. They return and accept new types, `BlockchainSnapshot` and `SmartContractSnapshot`
346
-
347
- ## [0.8.0] - 2023-04-07
348
-
349
- This release contains a breaking change.
350
-
351
- ### Added
352
-
353
- - Added `blockchain.createWallets` method which accepts a number `n` and optional `TreasuryParams`. It creates `n` treasuries and returns them as an array
354
-
355
- ### Changed
356
-
357
- - `RemoteBlockchainStorage` now requires a `RemoteBlockchainStorageClient` instead of `TonClient4`. There is a helper function, `wrapTonClient4ForRemote`, to wrap a `TonClient4` into `RemoteBlockchainStorageClient`. This is a breaking change
358
- - Updated default config
359
- - `Blockchain.create` now accepts an optional `BlockchainConfig = Cell | 'default' | 'slim'` as the config. If nothing or `'default'` is specified, the default config is used, if `'slim'` is specified, the slim config is used (it is much smaller than the default config, which improves performance), if a `Cell` is passed, then it is used as the config
360
-
361
- ### Removed
362
-
363
- - Removed ton as a peer dependency
364
-
365
- ## [0.7.0] - 2023-03-27
366
-
367
- ### Added
368
-
369
- - Added `externals: ExternalOut[]` field to `BlockchainTransaction` and `SendMessageResult`. `ExternalOut` is a specialized type for external out messages compatible with `Message` from ton-core
370
-
371
- ### Changed
372
-
373
- - Get methods now throw a specialized error type `GetMethodError` when exit code is not 0
374
- - Smart contracts now throw a specialized error type `TimeError` when trying to run a transaction at a unix timestamp that is less than the unix timestamp of the last transaction
375
- - Get methods now return `gasUsed` and `logs` from the `ContractProvider` on opened contracts
376
-
377
- ### Other
378
-
379
- - Consecutive transaction emulations have been optimized
380
-
381
- ## [0.6.1] - 2023-03-16
382
-
383
- ### Fixed
384
-
385
- - Fixed `blockchain.now` override for get methods in opened contracts
386
-
387
- ## [0.6.0] - 2023-03-13
388
-
389
- ### Added
390
-
391
- - Added `treasury.getBalance` method
392
- - Added `blockchain.now` getter and setter to override current unix time as seen during contract execution (both transactions and get methods). Note that this is unix timestamp, not JS timestamp, so you need to use `Math.floor(Date.now() / 1000)` instead of `Date.now()` to set current time
393
-
394
- ### Changed
395
-
396
- - `RemoteBlockchainStorage` constructor now accepts a second optional parameter, `blockSeqno?: number`. If passed, all accounts will be pulled from that block number instead of the latest one
397
-
398
- ## [0.5.1] - 2023-03-02
399
-
400
- ### Changed
401
-
402
- - Changed ton and ton-core dev and peer dependencies to versions 13.4.1 and 0.48.0 respectively
403
-
404
- ### Fixed
405
-
406
- - Fixed typos in `SendMode.PAY_GAS_SEPARATLY` (missing E) from ton-core
407
-
408
- ## [0.5.0] - 2023-02-22
409
-
410
- This release contains multiple breaking changes.
411
-
412
- ### Added
413
-
414
- - Added `blockchain.libs: Cell | undefined` getter and setter for global libraries dictionary (as a `Cell`)
415
-
416
- ### Changed
417
-
418
- - `blockchain.treasury` now accepts an optional `TreasuryParams` argument (see below for definition) instead of the old optional `workchain?: number` argument. This is a breaking change
419
- ```typescript
420
- export type TreasuryParams = Partial<{
421
- workchain: number
422
- predeploy: boolean
423
- balance: bigint
424
- resetBalanceIfZero: boolean
425
- }>
426
- ```
427
- - `OpenedContract` was renamed to `SandboxContract`. This is a breaking change
428
- - `LogsVerbosity` now has a new field, `print: boolean` (defaults to `true` on the `Blockchain` instance), which controls whether to `console.log` any logs at all (both from transactions and get methods). This is a breaking change
429
- - `smartContract.get` and `blockchain.runGetMethod` now return `GetMethodResult` (see below for definition). The differences from the previous return type are as follows:
430
- - `logs` renamed to `vmLogs`. This is a breaking change
431
- - `gasUsed` is now of type `bigint`. This is a breaking change
432
- - `blockchainLogs: string` and `debugLogs: string` were added
433
- ```typescript
434
- export type GetMethodResult = {
435
- stack: TupleItem[]
436
- stackReader: TupleReader
437
- exitCode: number
438
- gasUsed: bigint
439
- blockchainLogs: string
440
- vmLogs: string
441
- debugLogs: string
442
- }
443
- ```
444
- - Properties `storage` and `messageQueue` on `Blockchain` are now protected. This is a breaking change
445
- - All properties and methods of `Blockchain` that were private are now protected to improve extensibility. Note that any invariants expected by `Blockchain` must be upheld
446
- - `blockchain.sendMessage` and `smartContract.receiveMessage` now accept an optional `MessageParams` argument (see below for definition). These parameters are used for every transaction in the chain in case of `blockchain.sendMessage`
447
- ```typescript
448
- export type MessageParams = Partial<{
449
- now: number
450
- randomSeed: Buffer
451
- ignoreChksig: boolean
452
- }>
453
- ```
454
- - `blockchain.runGetMethod` and `smartContract.get` now accept an optional `GetMethodParams` argument (see below for definition)
455
- ```typescript
456
- export type GetMethodParams = Partial<{
457
- now: number
458
- randomSeed: Buffer
459
- gasLimit: bigint
460
- }>
461
- ```
462
- - `SendMessageResult` now has `transactions: BlockchainTransaction[]` instead of `transactions: Transaction[]`. Definition of `BlockchainTransaction`:
463
- ```typescript
464
- export type BlockchainTransaction = Transaction & {
465
- blockchainLogs: string
466
- vmLogs: string
467
- debugLogs: string
468
- events: Event[]
469
- parent?: BlockchainTransaction
470
- children: BlockchainTransaction[]
471
- }
472
- ```
473
- - `smartContract.receiveMessage` now returns `SmartContractTransaction` (see below for definition)
474
- ```typescript
475
- export type SmartContractTransaction = Transaction & {
476
- blockchainLogs: string
477
- vmLogs: string
478
- debugLogs: string
479
- }
480
- ```
481
- - Emulator WASM binary has been updated
482
-
483
- ### Fixed
484
-
485
- - Fixed empty message bodies in bounced messages. This fix is contained in the emulator WASM binary
486
-
487
- ## [0.4.0] - 2023-02-09
488
-
489
- ### Changed
490
-
491
- - Treasuries obtained by `blockchain.treasury` calls are now initialized during this call and will no longer produce an extra transaction when first sending a message
492
- - Transaction processing loop now prefetches contracts, which should provide a performance boost in some scenarios
493
-
494
- ## [0.3.0] - 2023-02-05
495
-
496
- ### Changed
497
-
498
- - `Blockchain` and `SmartContract` now use `LogsVerbosity` (see below for definition) as the verbosity type, which allows for more control over what kinds of logs are printed. Logs from TVM debug primitives are now enabled by default, again. (You can disable them globally by setting verbosity with `debugLogs: false` on the `Blockchain` instance)
499
-
500
- Definition of `LogsVerbosity`:
501
- ```typescript
502
- type LogsVerbosity = {
503
- blockchainLogs: boolean
504
- vmLogs: Verbosity
505
- debugLogs: boolean
506
- }
507
- ```
508
-
509
- ## [0.2.2] - 2023-02-03
510
-
511
- ### Added
512
-
513
- - Added `blockchain.runGetMethod(address, method, stack)` to run a get method on the specified address
514
- - Added `blockchain.setShardAccount(address, account)` to directly set the state of smart contracts
515
- - Added `account: ShardAccount` getter and setter to `SmartContract`
516
- - Exported helper methods `createEmptyShardAccount`, `createShardAccount` for use with `blockchain.setShardAccount` and `smartContract.account` setter
517
- - Added the ability to pass `Cell`s into `blockchain.sendMessage`
518
-
519
- ### Changed
520
-
521
- - Removed unnecessary `async` modifiers from `smartContract.receiveMessage` and `smartContract.get`
522
- - Logs from TVM debug primitives (for example, `DUMP` and `STRDUMP` with corresponding FunC functions `~dump()` and `~strdump()`) now respect the `verbosity` parameter and will only work when it is not `none`
523
- - Logs from TVM debug primitives are now printed using a single `console.log` call per one TVM execution to avoid cluttering the terminal during unit tests
524
-
525
- ### Fixed
526
-
527
- - Fixed potential race conditions between execution of different transaction chains on the same `Blockchain` instance by use of an `AsyncLock`
528
-
529
- ### Removed
530
-
531
- - Changed `blockchain.pushMessage`, `blockchain.processQueue`, `blockchain.runQueue` to be private
@@ -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;