@ton/sandbox 0.12.0 → 0.13.1
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 +12 -0
- package/dist/blockchain/Blockchain.js +10 -3
- package/dist/blockchain/SmartContract.d.ts +6 -0
- package/dist/blockchain/SmartContract.js +11 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ 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.13.1] - 2023-10-10
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- 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
|
|
13
|
+
|
|
14
|
+
## [0.13.0] - 2023-10-05
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- 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
|
|
19
|
+
|
|
8
20
|
## [0.12.0] - 2023-10-03
|
|
9
21
|
|
|
10
22
|
### Added
|
|
@@ -318,9 +318,16 @@ class Blockchain {
|
|
|
318
318
|
return promise;
|
|
319
319
|
}
|
|
320
320
|
async getContract(address) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
try {
|
|
322
|
+
const contract = await this.startFetchingContract(address);
|
|
323
|
+
return contract;
|
|
324
|
+
}
|
|
325
|
+
catch (e) {
|
|
326
|
+
throw e;
|
|
327
|
+
}
|
|
328
|
+
finally {
|
|
329
|
+
this.contractFetches.delete(address.toRawString());
|
|
330
|
+
}
|
|
324
331
|
}
|
|
325
332
|
get verbosity() {
|
|
326
333
|
return this.logsVerbosity;
|
|
@@ -55,6 +55,12 @@ export declare class TimeError extends Error {
|
|
|
55
55
|
currentTime: number;
|
|
56
56
|
constructor(address: Address, previousTxTime: number, currentTime: number);
|
|
57
57
|
}
|
|
58
|
+
export declare class EmulationError extends Error {
|
|
59
|
+
error: string;
|
|
60
|
+
vmLogs?: string | undefined;
|
|
61
|
+
exitCode?: number | undefined;
|
|
62
|
+
constructor(error: string, vmLogs?: string | undefined, exitCode?: number | undefined);
|
|
63
|
+
}
|
|
58
64
|
export type SmartContractSnapshot = {
|
|
59
65
|
address: Address;
|
|
60
66
|
account: ShardAccount;
|
|
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
};
|
|
13
13
|
var _SmartContract_account, _SmartContract_parsedAccount, _SmartContract_lastTxTime, _SmartContract_verbosity;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.SmartContract = exports.TimeError = exports.GetMethodError = exports.createEmptyShardAccount = exports.createShardAccount = void 0;
|
|
15
|
+
exports.SmartContract = exports.EmulationError = exports.TimeError = exports.GetMethodError = exports.createEmptyShardAccount = exports.createShardAccount = void 0;
|
|
16
16
|
const core_1 = require("@ton/core");
|
|
17
17
|
const selector_1 = require("../utils/selector");
|
|
18
18
|
function createShardAccount(args) {
|
|
@@ -98,6 +98,15 @@ class TimeError extends Error {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
exports.TimeError = TimeError;
|
|
101
|
+
class EmulationError extends Error {
|
|
102
|
+
constructor(error, vmLogs, exitCode) {
|
|
103
|
+
super(`Error while executing transaction: ${error}`);
|
|
104
|
+
this.error = error;
|
|
105
|
+
this.vmLogs = vmLogs;
|
|
106
|
+
this.exitCode = exitCode;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.EmulationError = EmulationError;
|
|
101
110
|
class SmartContract {
|
|
102
111
|
constructor(shardAccount, blockchain) {
|
|
103
112
|
_SmartContract_account.set(this, void 0);
|
|
@@ -203,8 +212,7 @@ class SmartContract {
|
|
|
203
212
|
console.log(res.logs);
|
|
204
213
|
}
|
|
205
214
|
if (!res.result.success) {
|
|
206
|
-
|
|
207
|
-
throw new Error('Error executing transaction');
|
|
215
|
+
throw new EmulationError(res.result.error, res.result.vmResults?.vmLog, res.result.vmResults?.vmExitCode);
|
|
208
216
|
}
|
|
209
217
|
if (this.verbosity.print && this.verbosity.vmLogs !== 'none' && res.result.vmLog.length > 0) {
|
|
210
218
|
console.log(res.result.vmLog);
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { Blockchain, SendMessageResult, BlockchainTransaction, PendingMessage, S
|
|
|
3
3
|
export { BlockchainContractProvider, SandboxContractProvider, } from './blockchain/BlockchainContractProvider';
|
|
4
4
|
export { BlockchainSender, } from './blockchain/BlockchainSender';
|
|
5
5
|
export { BlockchainStorage, LocalBlockchainStorage, RemoteBlockchainStorage, RemoteBlockchainStorageClient, wrapTonClient4ForRemote, } from './blockchain/BlockchainStorage';
|
|
6
|
-
export { Verbosity, LogsVerbosity, SmartContract, SmartContractTransaction, MessageParams, GetMethodParams, GetMethodResult, createEmptyShardAccount, createShardAccount, GetMethodError, TimeError, SmartContractSnapshot, } from './blockchain/SmartContract';
|
|
6
|
+
export { Verbosity, LogsVerbosity, SmartContract, SmartContractTransaction, MessageParams, GetMethodParams, GetMethodResult, createEmptyShardAccount, createShardAccount, GetMethodError, TimeError, SmartContractSnapshot, EmulationError, } from './blockchain/SmartContract';
|
|
7
7
|
export { TickOrTock, } from './executor/Executor';
|
|
8
8
|
export { Event, EventAccountCreated, EventAccountDestroyed, EventMessageSent, } from './event/Event';
|
|
9
9
|
export { Treasury, TreasuryContract, } from './treasury/Treasury';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.internal = exports.printTransactionFees = exports.prettyLogTransactions = exports.prettyLogTransaction = exports.TreasuryContract = exports.TimeError = exports.GetMethodError = exports.createShardAccount = exports.createEmptyShardAccount = exports.SmartContract = exports.wrapTonClient4ForRemote = exports.RemoteBlockchainStorage = exports.LocalBlockchainStorage = exports.BlockchainSender = exports.BlockchainContractProvider = exports.Blockchain = exports.defaultConfigSeqno = exports.defaultConfig = void 0;
|
|
3
|
+
exports.internal = exports.printTransactionFees = exports.prettyLogTransactions = exports.prettyLogTransaction = exports.TreasuryContract = exports.EmulationError = exports.TimeError = exports.GetMethodError = exports.createShardAccount = exports.createEmptyShardAccount = exports.SmartContract = exports.wrapTonClient4ForRemote = exports.RemoteBlockchainStorage = exports.LocalBlockchainStorage = exports.BlockchainSender = exports.BlockchainContractProvider = exports.Blockchain = exports.defaultConfigSeqno = exports.defaultConfig = void 0;
|
|
4
4
|
var defaultConfig_1 = require("./config/defaultConfig");
|
|
5
5
|
Object.defineProperty(exports, "defaultConfig", { enumerable: true, get: function () { return defaultConfig_1.defaultConfig; } });
|
|
6
6
|
Object.defineProperty(exports, "defaultConfigSeqno", { enumerable: true, get: function () { return defaultConfig_1.defaultConfigSeqno; } });
|
|
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "createEmptyShardAccount", { enumerable: true, ge
|
|
|
20
20
|
Object.defineProperty(exports, "createShardAccount", { enumerable: true, get: function () { return SmartContract_1.createShardAccount; } });
|
|
21
21
|
Object.defineProperty(exports, "GetMethodError", { enumerable: true, get: function () { return SmartContract_1.GetMethodError; } });
|
|
22
22
|
Object.defineProperty(exports, "TimeError", { enumerable: true, get: function () { return SmartContract_1.TimeError; } });
|
|
23
|
+
Object.defineProperty(exports, "EmulationError", { enumerable: true, get: function () { return SmartContract_1.EmulationError; } });
|
|
23
24
|
var Treasury_1 = require("./treasury/Treasury");
|
|
24
25
|
Object.defineProperty(exports, "TreasuryContract", { enumerable: true, get: function () { return Treasury_1.TreasuryContract; } });
|
|
25
26
|
var prettyLogTransaction_1 = require("./utils/prettyLogTransaction");
|