@ton/sandbox 0.21.0 → 0.22.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
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.22.0] - 2024-09-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- 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
|
|
13
|
+
|
|
8
14
|
## [0.21.0] - 2024-09-16
|
|
9
15
|
|
|
10
16
|
### Added
|
|
@@ -26,6 +26,8 @@ export type BlockchainTransaction = Transaction & {
|
|
|
26
26
|
parent?: BlockchainTransaction;
|
|
27
27
|
children: BlockchainTransaction[];
|
|
28
28
|
externals: ExternalOut[];
|
|
29
|
+
oldStorage?: Cell;
|
|
30
|
+
newStorage?: Cell;
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* @type SendMessageResult Represents the result of sending a message.
|
|
@@ -98,6 +100,7 @@ export declare class Blockchain {
|
|
|
98
100
|
protected lock: AsyncLock;
|
|
99
101
|
protected contractFetches: Map<string, Promise<SmartContract>>;
|
|
100
102
|
protected nextCreateWalletIndex: number;
|
|
103
|
+
protected shouldRecordStorage: boolean;
|
|
101
104
|
readonly executor: IExecutor;
|
|
102
105
|
/**
|
|
103
106
|
* Saves snapshot of current blockchain.
|
|
@@ -115,6 +118,8 @@ export declare class Blockchain {
|
|
|
115
118
|
* @param snapshot Snapshot of blockchain
|
|
116
119
|
*/
|
|
117
120
|
loadFrom(snapshot: BlockchainSnapshot): Promise<void>;
|
|
121
|
+
get recordStorage(): boolean;
|
|
122
|
+
set recordStorage(v: boolean);
|
|
118
123
|
/**
|
|
119
124
|
* @returns Current time in blockchain
|
|
120
125
|
*/
|
|
@@ -81,6 +81,12 @@ class Blockchain {
|
|
|
81
81
|
this.globalLibs = snapshot.libs;
|
|
82
82
|
this.nextCreateWalletIndex = snapshot.nextCreateWalletIndex;
|
|
83
83
|
}
|
|
84
|
+
get recordStorage() {
|
|
85
|
+
return this.shouldRecordStorage;
|
|
86
|
+
}
|
|
87
|
+
set recordStorage(v) {
|
|
88
|
+
this.shouldRecordStorage = v;
|
|
89
|
+
}
|
|
84
90
|
/**
|
|
85
91
|
* @returns Current time in blockchain
|
|
86
92
|
*/
|
|
@@ -112,6 +118,7 @@ class Blockchain {
|
|
|
112
118
|
this.lock = new AsyncLock_1.AsyncLock();
|
|
113
119
|
this.contractFetches = new Map();
|
|
114
120
|
this.nextCreateWalletIndex = 0;
|
|
121
|
+
this.shouldRecordStorage = false;
|
|
115
122
|
this.networkConfig = blockchainConfigToBase64(opts.config);
|
|
116
123
|
this.executor = opts.executor;
|
|
117
124
|
this.storage = opts.storage;
|
|
@@ -222,6 +222,10 @@ class SmartContract {
|
|
|
222
222
|
}));
|
|
223
223
|
}
|
|
224
224
|
async runCommon(run) {
|
|
225
|
+
let oldStorage = undefined;
|
|
226
|
+
if (this.blockchain.recordStorage && this.account.account?.storage.state.type === 'active') {
|
|
227
|
+
oldStorage = this.account.account?.storage.state.state.data ?? undefined;
|
|
228
|
+
}
|
|
225
229
|
const res = await run();
|
|
226
230
|
if (this.verbosity.print && this.verbosity.blockchainLogs && res.logs.length > 0) {
|
|
227
231
|
console.log(res.logs);
|
|
@@ -239,11 +243,17 @@ class SmartContract {
|
|
|
239
243
|
__classPrivateFieldSet(this, _SmartContract_account, res.result.shardAccount, "f");
|
|
240
244
|
__classPrivateFieldSet(this, _SmartContract_parsedAccount, undefined, "f");
|
|
241
245
|
__classPrivateFieldSet(this, _SmartContract_lastTxTime, tx.now, "f");
|
|
246
|
+
let newStorage = undefined;
|
|
247
|
+
if (this.blockchain.recordStorage && this.account.account?.storage.state.type === 'active') {
|
|
248
|
+
newStorage = this.account.account?.storage.state.state.data ?? undefined;
|
|
249
|
+
}
|
|
242
250
|
return {
|
|
243
251
|
...tx,
|
|
244
252
|
blockchainLogs: res.logs,
|
|
245
253
|
vmLogs: res.result.vmLog,
|
|
246
254
|
debugLogs: res.debugLogs,
|
|
255
|
+
oldStorage,
|
|
256
|
+
newStorage,
|
|
247
257
|
};
|
|
248
258
|
}
|
|
249
259
|
async get(method, stack = [], params) {
|