@ton/blueprint 0.28.0 → 0.30.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,22 @@ 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.30.0] - 2025-04-08
9
+
10
+ ### Fixed
11
+
12
+ - Fixed Tact compilation
13
+
14
+ ### Changed
15
+
16
+ - Updated Tact templates and `@tact-lang/compiler` dependency to v1.6.5
17
+
18
+ ## [0.29.0] - 2025-03-02
19
+
20
+ ### Changed
21
+
22
+ - Tolk's stderr is now printed on successful builds
23
+
8
24
  ## [0.28.0] - 2025-01-17
9
25
 
10
26
  ### Changed
@@ -193,18 +209,18 @@ This release contains a breaking change.
193
209
 
194
210
  ### Fixed
195
211
 
196
- - Fixed TACT imports
212
+ - Fixed Tact imports
197
213
  - Fixed missing newlines when printing error messages while building contracts
198
214
 
199
215
  ## [0.11.0] - 2023-07-03
200
216
 
201
217
  ### Added
202
218
 
203
- - Added an `options` field to the `tact` variant of `CompilerConfig`, which is of the same type as the `options` of the TACT compiler, and includes fields such as `debug`, `experimental`, etc
219
+ - Added an `options` field to the `tact` variant of `CompilerConfig`, which is of the same type as the `options` of the Tact compiler, and includes fields such as `debug`, `experimental`, etc
204
220
 
205
221
  ### Changed
206
222
 
207
- - Updated TACT to 1.1.3
223
+ - Updated Tact to 1.1.3
208
224
 
209
225
  ## [0.10.0] - 2023-06-06
210
226
 
@@ -220,7 +236,7 @@ This release contains a breaking change.
220
236
 
221
237
  ### Changed
222
238
 
223
- - Updated dependencies, of note: func-js to use func 0.4.3, TACT to 1.1.1
239
+ - Updated dependencies, of note: func-js to use func 0.4.3, Tact to 1.1.1
224
240
 
225
241
  ## [0.8.0] - 2023-04-07
226
242
 
@@ -249,7 +265,7 @@ This release contains a breaking change.
249
265
 
250
266
  ### Added
251
267
 
252
- - Added support for [TACT](https://github.com/tact-lang/tact), including TACT smart contract templates
268
+ - Added support for [Tact](https://github.com/tact-lang/tact), including Tact smart contract templates
253
269
  - Added `--all` option for `build` command
254
270
 
255
271
  ### Changed
package/README.md CHANGED
@@ -60,7 +60,7 @@ Blueprint is an all-in-one development environment designed to enhance the proce
60
60
 
61
61
  * [Node.js](https://nodejs.org) with a recent version like v18. Version can be verified with `node -v`
62
62
  * IDE with TON support:
63
- * [Visual Studio Code](https://code.visualstudio.com/) with the [FunC plugin](https://marketplace.visualstudio.com/items?itemName=tonwhales.func-vscode) or [Tolk plugin](https://marketplace.visualstudio.com/items?itemName=ton-core.tolk-vscode)
63
+ * [Visual Studio Code](https://code.visualstudio.com/) with the [FunC plugin](https://marketplace.visualstudio.com/items?itemName=tonwhales.func-vscode), [Tolk plugin](https://marketplace.visualstudio.com/items?itemName=ton-core.tolk-vscode) or [Tact plugin](https://marketplace.visualstudio.com/items?itemName=tonstudio.vscode-tact)
64
64
  * [IntelliJ IDEA](https://www.jetbrains.com/idea/) with the [TON Development plugin](https://plugins.jetbrains.com/plugin/23382-ton)
65
65
 
66
66
  ## Features overview
package/dist/build.js CHANGED
@@ -39,6 +39,9 @@ async function buildOne(contract, ui) {
39
39
  hex: cell.toBoc().toString('hex'),
40
40
  };
41
41
  ui?.clearActionPrompt();
42
+ if (result.lang === 'tolk') {
43
+ ui?.write(`\n${result.stderr}`);
44
+ }
42
45
  ui?.write('\n✅ Compiled successfully! Cell BOC result:\n\n');
43
46
  ui?.write(JSON.stringify(res, null, 2));
44
47
  await promises_1.default.mkdir(paths_1.BUILD_DIR, { recursive: true });
@@ -11,7 +11,7 @@ exports.templateTypes = [
11
11
  value: 'tolk-empty',
12
12
  },
13
13
  {
14
- name: 'An empty contract (TACT)',
14
+ name: 'An empty contract (Tact)',
15
15
  value: 'tact-empty',
16
16
  },
17
17
  {
@@ -23,7 +23,7 @@ exports.templateTypes = [
23
23
  value: 'tolk-counter',
24
24
  },
25
25
  {
26
- name: 'A simple counter contract (TACT)',
26
+ name: 'A simple counter contract (Tact)',
27
27
  value: 'tact-counter',
28
28
  },
29
29
  ];
@@ -70,7 +70,7 @@ Flags:
70
70
  --tonscan, --tonviewer, --toncx, --dton - specifies the network explorer to use when displaying links to the deployed contracts. Default: tonviewer.`,
71
71
  build: `Usage: blueprint build [contract name] [flags]
72
72
 
73
- Builds the specified contract according to the respective .compile.ts file. If the contract is written in TACT, all TACT-generated files (wrapper class, etc) will be placed in the build/<contract name> folder.
73
+ Builds the specified contract according to the respective .compile.ts file. If the contract is written in Tact, all Tact-generated files (wrapper class, etc) will be placed in the build/<contract name> folder.
74
74
 
75
75
  If contract name is not specified on the command line, the buildable contracts (that have the respective .compile.ts files under wrappers directory) will be presented interactively, unless --all flag is specified.
76
76
 
@@ -1,6 +1,6 @@
1
1
  import { SourceResolver, SourcesMap, SourcesArray } from '@ton-community/func-js';
2
2
  import { Cell } from '@ton/core';
3
- import { ConfigProject } from '@tact-lang/compiler';
3
+ import { Options } from '@tact-lang/compiler';
4
4
  export type HookParams = {
5
5
  userData?: any;
6
6
  };
@@ -11,7 +11,7 @@ export type CommonCompilerConfig = {
11
11
  export type TactCompilerConfig = {
12
12
  lang: 'tact';
13
13
  target: string;
14
- options?: ConfigProject['options'];
14
+ options?: Options;
15
15
  };
16
16
  export type FuncCompilerConfig = {
17
17
  lang?: 'func';
@@ -128,7 +128,7 @@ async function doCompileTact(config, name) {
128
128
  project: fs,
129
129
  };
130
130
  const res = await Tact.build(buildConfig);
131
- if (!res) {
131
+ if (!res.ok) {
132
132
  throw new Error('Could not compile tact');
133
133
  }
134
134
  const code = findTactBoc(fs.overwrites);
@@ -1,25 +1,30 @@
1
1
  {{snakeName}}.tact
2
- import "@stdlib/deploy";
3
-
4
2
  message Add {
5
- queryId: Int as uint64;
6
3
  amount: Int as uint32;
7
4
  }
8
5
 
9
- contract {{name}} with Deployable {
10
- id: Int as uint32;
11
- counter: Int as uint32;
12
-
13
- init(id: Int) {
14
- self.id = id;
15
- self.counter = 0;
6
+ contract {{name}}(
7
+ // Persistent state variables declared via the
8
+ // contract parameters syntax, which was introduced in v1.6.0
9
+ //
10
+ // See: https://docs.tact-lang.org/book/contracts/#parameters
11
+ id: Int as uint32,
12
+ counter: Int as uint32,
13
+ ) {
14
+ // Empty receiver for the deployment,
15
+ // which expects the `null` message body
16
+ receive() {
17
+ // Forward the remaining value in the
18
+ // incoming message back to the sender
19
+ cashback(sender());
16
20
  }
17
21
 
18
22
  receive(msg: Add) {
19
23
  self.counter += msg.amount;
20
24
 
21
- // Notify the caller that the receiver was executed and forward remaining value back
22
- self.notify("Cashback".asComment());
25
+ // Forward the remaining value in the
26
+ // incoming message back to the sender
27
+ cashback(sender());
23
28
  }
24
29
 
25
30
  get fun counter(): Int {
@@ -4,17 +4,14 @@ import { {{name}} } from '../wrappers/{{name}}';
4
4
  import { NetworkProvider } from '@ton/blueprint';
5
5
 
6
6
  export async function run(provider: NetworkProvider) {
7
- const {{loweredName}} = provider.open(await {{name}}.fromInit(BigInt(Math.floor(Math.random() * 10000))));
7
+ const {{loweredName}} = provider.open(await {{name}}.fromInit(BigInt(Math.floor(Math.random() * 10000))), 0n);
8
8
 
9
9
  await {{loweredName}}.send(
10
10
  provider.sender(),
11
11
  {
12
12
  value: toNano('0.05'),
13
13
  },
14
- {
15
- $$type: 'Deploy',
16
- queryId: 0n,
17
- }
14
+ null,
18
15
  );
19
16
 
20
17
  await provider.waitForDeploy({{loweredName}}.address);
@@ -24,7 +24,6 @@ export async function run(provider: NetworkProvider, args: string[]) {
24
24
  },
25
25
  {
26
26
  $$type: 'Add',
27
- queryId: 0n,
28
27
  amount: 1n,
29
28
  }
30
29
  );
@@ -12,7 +12,7 @@ describe('{{name}}', () => {
12
12
  beforeEach(async () => {
13
13
  blockchain = await Blockchain.create();
14
14
 
15
- {{loweredName}} = blockchain.openContract(await {{name}}.fromInit(0n));
15
+ {{loweredName}} = blockchain.openContract(await {{name}}.fromInit(0n, 0n));
16
16
 
17
17
  deployer = await blockchain.treasury('deployer');
18
18
 
@@ -21,10 +21,7 @@ describe('{{name}}', () => {
21
21
  {
22
22
  value: toNano('0.05'),
23
23
  },
24
- {
25
- $$type: 'Deploy',
26
- queryId: 0n,
27
- }
24
+ null,
28
25
  );
29
26
 
30
27
  expect(deployResult.transactions).toHaveTransaction({
@@ -62,7 +59,6 @@ describe('{{name}}', () => {
62
59
  },
63
60
  {
64
61
  $$type: 'Add',
65
- queryId: 0n,
66
62
  amount: increaseBy,
67
63
  }
68
64
  );
@@ -1,9 +1,19 @@
1
1
  {{snakeName}}.tact
2
- import "@stdlib/deploy";
3
-
4
- contract {{name}} with Deployable {
5
- // Empty init() function is present by default in all Tact contracts
6
- // since v1.3.0, so the following may be omitted:
7
- //
8
- // init() {}
2
+ // Since v1.6.0, Tact has a contract parameters syntax that can supersede
3
+ // lazy initialization by init() for all contracts that do not require specific on-chain
4
+ // deployment logic that must be run only once in the `init()` function.
5
+ //
6
+ // Note that the empty parameter list above is still a parameter list,
7
+ // meaning that the contract won't have an implicit or explicit `init(){:tact}` function
8
+ // and will enjoy storage write optimizations and use less gas overall.
9
+ //
10
+ // See: https://docs.tact-lang.org/book/contracts/#parameters
11
+ contract {{name}}() {
12
+ // Empty receiver for the deployment,
13
+ // which expects the `null` message body
14
+ receive() {
15
+ // Forward the remaining value in the
16
+ // incoming message back to the sender
17
+ cashback(sender());
18
+ }
9
19
  }
@@ -11,10 +11,7 @@ export async function run(provider: NetworkProvider) {
11
11
  {
12
12
  value: toNano('0.05'),
13
13
  },
14
- {
15
- $$type: 'Deploy',
16
- queryId: 0n,
17
- }
14
+ null,
18
15
  );
19
16
 
20
17
  await provider.waitForDeploy({{loweredName}}.address);
@@ -21,10 +21,7 @@ describe('{{name}}', () => {
21
21
  {
22
22
  value: toNano('0.05'),
23
23
  },
24
- {
25
- $$type: 'Deploy',
26
- queryId: 0n,
27
- }
24
+ null,
28
25
  );
29
26
 
30
27
  expect(deployResult.transactions).toHaveTransaction({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ton/blueprint",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "description": "Framework for development of TON smart contracts",
5
5
  "main": "dist/index.js",
6
6
  "bin": "./dist/cli/cli.js",
@@ -19,7 +19,7 @@
19
19
  "format": "prettier --write src"
20
20
  },
21
21
  "devDependencies": {
22
- "@tact-lang/compiler": "^1.5.3",
22
+ "@tact-lang/compiler": "^1.6.5",
23
23
  "@ton-community/func-js": "^0.9.0",
24
24
  "@ton/core": "^0.59.0",
25
25
  "@ton/crypto": "^3.3.0",
@@ -32,7 +32,7 @@
32
32
  "typescript": "^4.9.5"
33
33
  },
34
34
  "peerDependencies": {
35
- "@tact-lang/compiler": ">=1.5.3",
35
+ "@tact-lang/compiler": ">=1.6.5",
36
36
  "@ton-community/func-js": ">=0.9.0",
37
37
  "@ton/core": ">=0.59.0",
38
38
  "@ton/crypto": ">=3.3.0",