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