@ton/blueprint 0.31.1 → 0.32.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 +22 -0
- package/README.md +4 -0
- package/dist/build.d.ts +1 -0
- package/dist/build.js +15 -3
- package/dist/cli/Runner.d.ts +1 -0
- package/dist/cli/Runner.js +4 -0
- package/dist/cli/build.d.ts +3 -5
- package/dist/cli/build.js +33 -9
- package/dist/cli/cli.js +17 -7
- package/dist/cli/create.js +9 -5
- package/dist/cli/help.js +2 -2
- package/dist/cli/verify.js +3 -2
- package/dist/compile/OverwritableVirtualFileSystem.d.ts +0 -1
- package/dist/compile/compile.d.ts +9 -2
- package/dist/compile/compile.js +55 -15
- package/dist/config/utils.js +19 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/network/createNetworkProvider.js +2 -2
- package/dist/network/send/MnemonicProvider.d.ts +0 -1
- package/dist/template.js +2 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/object.utils.js +1 -2
- package/dist/utils/selection.utils.js +21 -12
- package/dist/utils/string.utils.d.ts +2 -0
- package/dist/utils/string.utils.js +15 -0
- package/dist/utils/timer.utils.js +1 -2
- package/dist/utils/ton.utils.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,28 @@ 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.32.1] - 2025-05-06
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fix unexpected code duplication on parralel compile
|
|
13
|
+
|
|
14
|
+
## [0.32.0] - 2025-05-02
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Compiler version is now shown during contract build
|
|
19
|
+
- Added 'All Contracts' option to build wizard
|
|
20
|
+
- Added function to build all tact contracts, required for rebuilding before tests
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Made error of non-PascalCase contract names nicer
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- `blueprint build --all` now exits with a non-zero exit code on failure
|
|
29
|
+
|
|
8
30
|
## [0.31.1] - 2025-04-24
|
|
9
31
|
|
|
10
32
|
### Fixed
|
package/README.md
CHANGED
|
@@ -122,6 +122,10 @@ export async function run(provider: NetworkProvider) {
|
|
|
122
122
|
|
|
123
123
|
FunC version can be updated using `npx/yarn blueprint set func` command
|
|
124
124
|
|
|
125
|
+
### Updating Tact version
|
|
126
|
+
|
|
127
|
+
Tact version can be updated to the latest using `npm update/yarn upgrade @tact-lang/compiler` command
|
|
128
|
+
|
|
125
129
|
### Help and additional commands
|
|
126
130
|
|
|
127
131
|
Run in terminal: `npx blueprint help` or `yarn blueprint help`
|
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.buildOne = buildOne;
|
|
7
|
+
exports.buildAll = buildAll;
|
|
8
|
+
exports.buildAllTact = buildAllTact;
|
|
7
9
|
const path_1 = __importDefault(require("path"));
|
|
8
10
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
11
|
const compile_1 = require("./compile/compile");
|
|
@@ -18,6 +20,9 @@ async function buildOne(contract, ui) {
|
|
|
18
20
|
catch (e) { }
|
|
19
21
|
ui?.setActionPrompt('⏳ Compiling...');
|
|
20
22
|
try {
|
|
23
|
+
const config = await (0, compile_1.getCompilerConfigForContract)(contract);
|
|
24
|
+
const compilerOptions = await (0, compile_1.getCompilerOptions)(config);
|
|
25
|
+
ui?.write(`🔧 Using ${compilerOptions.lang} version ${compilerOptions.version}...`);
|
|
21
26
|
const result = await (0, compile_1.doCompile)(contract);
|
|
22
27
|
if (result.lang === 'tact') {
|
|
23
28
|
for (const [k, v] of result.fs) {
|
|
@@ -64,10 +69,17 @@ async function buildOne(contract, ui) {
|
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
|
-
exports.buildOne = buildOne;
|
|
68
72
|
async function buildAll(ui) {
|
|
69
73
|
for (const file of await (0, utils_1.findCompiles)()) {
|
|
70
74
|
await buildOne(file.name, ui);
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
|
-
|
|
77
|
+
async function buildAllTact(ui) {
|
|
78
|
+
// TODO: when tact config introduced rewrite to use it
|
|
79
|
+
for (const file of await (0, utils_1.findCompiles)()) {
|
|
80
|
+
const config = (0, compile_1.extractCompileConfig)(file.path);
|
|
81
|
+
if (config.lang === 'tact') {
|
|
82
|
+
await buildOne(file.name, ui);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
package/dist/cli/Runner.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { UIProvider } from '../ui/UIProvider';
|
|
|
3
3
|
import { Config } from '../config/Config';
|
|
4
4
|
export declare const argSpec: {};
|
|
5
5
|
export type Args = arg.Result<typeof argSpec>;
|
|
6
|
+
export declare function extractFirstArg(args: Args): string | undefined;
|
|
6
7
|
export type RunnerContext = {
|
|
7
8
|
config?: Config;
|
|
8
9
|
};
|
package/dist/cli/Runner.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.argSpec = void 0;
|
|
4
|
+
exports.extractFirstArg = extractFirstArg;
|
|
4
5
|
exports.argSpec = {};
|
|
6
|
+
function extractFirstArg(args) {
|
|
7
|
+
return args._.length > 1 && args._[1].trim().length > 0 ? args._[1].trim() : undefined;
|
|
8
|
+
}
|
package/dist/cli/build.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Args, Runner } from './Runner';
|
|
2
2
|
import { UIProvider } from '../ui/UIProvider';
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
path: string;
|
|
7
|
-
}>;
|
|
3
|
+
export declare function extractBuildFile(args: Args): string | undefined;
|
|
4
|
+
export declare function selectContract(ui: UIProvider, hint?: string): Promise<string>;
|
|
5
|
+
export declare function selectContract(ui: UIProvider, hint?: string, withAllOption?: boolean): Promise<string | string[]>;
|
|
8
6
|
export declare const build: Runner;
|
package/dist/cli/build.js
CHANGED
|
@@ -3,19 +3,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.build =
|
|
6
|
+
exports.build = void 0;
|
|
7
|
+
exports.extractBuildFile = extractBuildFile;
|
|
8
|
+
exports.selectContract = selectContract;
|
|
7
9
|
const utils_1 = require("../utils");
|
|
8
10
|
const arg_1 = __importDefault(require("arg"));
|
|
9
11
|
const build_1 = require("../build");
|
|
10
12
|
const constants_1 = require("./constants");
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
+
function extractBuildFile(args) {
|
|
14
|
+
return args._.length > 1 && args._[1].length > 0 ? args._[1] : undefined;
|
|
15
|
+
}
|
|
16
|
+
async function selectContract(ui, hint, withAllOption = false) {
|
|
17
|
+
const compiles = await (0, utils_1.findCompiles)();
|
|
18
|
+
const contracts = compiles.map(compile => compile.name);
|
|
19
|
+
const options = contracts.map((contract) => ({ name: contract, value: contract }));
|
|
20
|
+
const allContractsValue = 'all_contracts';
|
|
21
|
+
if (withAllOption) {
|
|
22
|
+
const allContractsOption = {
|
|
23
|
+
name: 'All Contracts',
|
|
24
|
+
value: allContractsValue,
|
|
25
|
+
};
|
|
26
|
+
options.push(allContractsOption);
|
|
27
|
+
}
|
|
28
|
+
const selectedOption = await (0, utils_1.selectOption)(options, {
|
|
29
|
+
msg: 'Select contract to use',
|
|
13
30
|
ui,
|
|
14
|
-
hint
|
|
15
|
-
import: false,
|
|
31
|
+
hint,
|
|
16
32
|
});
|
|
33
|
+
if (selectedOption.value === allContractsValue) {
|
|
34
|
+
return contracts;
|
|
35
|
+
}
|
|
36
|
+
return selectedOption.value;
|
|
17
37
|
}
|
|
18
|
-
exports.selectCompile = selectCompile;
|
|
19
38
|
const build = async (args, ui) => {
|
|
20
39
|
const localArgs = (0, arg_1.default)({
|
|
21
40
|
'--all': Boolean,
|
|
@@ -26,11 +45,16 @@ const build = async (args, ui) => {
|
|
|
26
45
|
return;
|
|
27
46
|
}
|
|
28
47
|
if (localArgs['--all']) {
|
|
29
|
-
await (0, build_1.buildAll)();
|
|
48
|
+
await (0, build_1.buildAll)(ui);
|
|
30
49
|
}
|
|
31
50
|
else {
|
|
32
|
-
const
|
|
33
|
-
|
|
51
|
+
const selected = await selectContract(ui, extractBuildFile(args), true);
|
|
52
|
+
if (typeof selected === 'string') {
|
|
53
|
+
await (0, build_1.buildOne)(selected, ui);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
await (0, build_1.buildAll)(ui);
|
|
57
|
+
}
|
|
34
58
|
}
|
|
35
59
|
};
|
|
36
60
|
exports.build = build;
|
package/dist/cli/cli.js
CHANGED
|
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
16
16
|
}) : function(o, v) {
|
|
17
17
|
o["default"] = v;
|
|
18
18
|
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
26
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
38
|
};
|
package/dist/cli/create.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.create = void 0;
|
|
7
|
+
const Runner_1 = require("./Runner");
|
|
7
8
|
const promises_1 = require("fs/promises");
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const template_1 = require("../template");
|
|
@@ -56,13 +57,16 @@ const create = async (args, ui) => {
|
|
|
56
57
|
ui.write(constants_1.helpMessages['create']);
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
const name =
|
|
60
|
-
|
|
61
|
-
: await ui.input('Contract name (PascalCase)');
|
|
60
|
+
const name = (0, Runner_1.extractFirstArg)(localArgs)
|
|
61
|
+
?? await ui.input('Contract name (PascalCase)');
|
|
62
62
|
if (name.length === 0)
|
|
63
63
|
throw new Error(`Cannot create a contract with an empty name`);
|
|
64
|
-
if (name.toLowerCase() === 'contract'
|
|
65
|
-
throw new Error(`Cannot create a contract with the name '
|
|
64
|
+
if (name.toLowerCase() === 'contract') {
|
|
65
|
+
throw new Error(`Cannot create a contract with the reserved name 'contract'. Please choose a different name.`);
|
|
66
|
+
}
|
|
67
|
+
if (!(0, utils_1.isPascalCase)(name)) {
|
|
68
|
+
throw new Error(`Contract name '${name}' is not in PascalCase. Please try ${(0, utils_1.toPascalCase)(name)}.`);
|
|
69
|
+
}
|
|
66
70
|
const which = (await (0, utils_1.selectOption)(constants_1.templateTypes, {
|
|
67
71
|
ui,
|
|
68
72
|
msg: 'What type of contract do you want to create?',
|
package/dist/cli/help.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.help = exports.
|
|
3
|
+
exports.help = exports.additionalHelpMessages = void 0;
|
|
4
|
+
exports.buildHelpMessage = buildHelpMessage;
|
|
4
5
|
const constants_1 = require("./constants");
|
|
5
6
|
exports.additionalHelpMessages = {};
|
|
6
7
|
function buildHelpMessage(cmd = '') {
|
|
@@ -13,7 +14,6 @@ function buildHelpMessage(cmd = '') {
|
|
|
13
14
|
}
|
|
14
15
|
return cmd in effectiveHelpMessages ? effectiveHelpMessages[cmd] : effectiveHelpMessages['help'];
|
|
15
16
|
}
|
|
16
|
-
exports.buildHelpMessage = buildHelpMessage;
|
|
17
17
|
const help = async (args, ui) => {
|
|
18
18
|
const cmd = args._.length >= 2 ? args._[1].toLowerCase() : '';
|
|
19
19
|
const helpMessage = buildHelpMessage(cmd);
|
package/dist/cli/verify.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.verify = void 0;
|
|
7
7
|
const core_1 = require("@ton/core");
|
|
8
8
|
const compile_1 = require("../compile/compile");
|
|
9
|
+
const Runner_1 = require("./Runner");
|
|
9
10
|
const path_1 = __importDefault(require("path"));
|
|
10
11
|
const createNetworkProvider_1 = require("../network/createNetworkProvider");
|
|
11
12
|
const build_1 = require("./build");
|
|
@@ -126,7 +127,7 @@ const verify = async (args, ui, context) => {
|
|
|
126
127
|
ui.write(constants_1.helpMessages['verify']);
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
|
-
const
|
|
130
|
+
const selectedContract = await (0, build_1.selectContract)(ui, (0, Runner_1.extractFirstArg)(localArgs));
|
|
130
131
|
const networkProvider = await (0, createNetworkProvider_1.createNetworkProvider)(ui, localArgs, context.config, false);
|
|
131
132
|
const sender = networkProvider.sender();
|
|
132
133
|
const senderAddress = sender.address;
|
|
@@ -137,7 +138,7 @@ const verify = async (args, ui, context) => {
|
|
|
137
138
|
if (network === 'custom') {
|
|
138
139
|
throw new Error('Cannot use custom network');
|
|
139
140
|
}
|
|
140
|
-
const result = await (0, compile_1.doCompile)(
|
|
141
|
+
const result = await (0, compile_1.doCompile)(selectedContract);
|
|
141
142
|
const resHash = result.code.hash();
|
|
142
143
|
ui.write(`Compiled code hash hex: ${resHash.toString('hex')}`);
|
|
143
144
|
ui.write('We can look up the address with such code hash in the blockchain automatically');
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Cell } from '@ton/core';
|
|
3
|
-
import { TactCompilerConfig } from './CompilerConfig';
|
|
2
|
+
import { CompilerConfig, TactCompilerConfig } from './CompilerConfig';
|
|
4
3
|
export declare function getCompilablesDirectory(): Promise<string>;
|
|
5
4
|
export declare const COMPILE_END = ".compile.ts";
|
|
5
|
+
export declare function extractCompileConfig(path: string): CompilerConfig;
|
|
6
|
+
export declare function getCompilerConfigForContract(name: string): Promise<CompilerConfig>;
|
|
6
7
|
export type SourceSnapshot = {
|
|
7
8
|
filename: string;
|
|
8
9
|
content: string;
|
|
@@ -28,8 +29,14 @@ export type TactCompileResult = {
|
|
|
28
29
|
fs: Map<string, Buffer>;
|
|
29
30
|
code: Cell;
|
|
30
31
|
options?: TactCompilerConfig['options'];
|
|
32
|
+
version: string;
|
|
31
33
|
};
|
|
34
|
+
export declare function getTactVersion(): Promise<any>;
|
|
32
35
|
export type CompileResult = TactCompileResult | FuncCompileResult | TolkCompileResult;
|
|
36
|
+
export declare function getCompilerOptions(config: CompilerConfig): Promise<{
|
|
37
|
+
lang: 'tact' | 'tolk' | 'func';
|
|
38
|
+
version: string;
|
|
39
|
+
}>;
|
|
33
40
|
export declare function doCompile(name: string, opts?: CompileOpts): Promise<CompileResult>;
|
|
34
41
|
/**
|
|
35
42
|
* Optional compilation settings, including user data passed to hooks
|
package/dist/compile/compile.js
CHANGED
|
@@ -15,18 +15,35 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
39
|
+
exports.COMPILE_END = void 0;
|
|
40
|
+
exports.getCompilablesDirectory = getCompilablesDirectory;
|
|
41
|
+
exports.extractCompileConfig = extractCompileConfig;
|
|
42
|
+
exports.getCompilerConfigForContract = getCompilerConfigForContract;
|
|
43
|
+
exports.getTactVersion = getTactVersion;
|
|
44
|
+
exports.getCompilerOptions = getCompilerOptions;
|
|
45
|
+
exports.doCompile = doCompile;
|
|
46
|
+
exports.compile = compile;
|
|
30
47
|
const func_js_1 = require("@ton-community/func-js");
|
|
31
48
|
const fs_1 = require("fs");
|
|
32
49
|
const path_1 = __importDefault(require("path"));
|
|
@@ -43,17 +60,18 @@ async function getCompilablesDirectory() {
|
|
|
43
60
|
}
|
|
44
61
|
return paths_1.WRAPPERS_DIR;
|
|
45
62
|
}
|
|
46
|
-
exports.getCompilablesDirectory = getCompilablesDirectory;
|
|
47
63
|
exports.COMPILE_END = '.compile.ts';
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const compilablesDirectory = await getCompilablesDirectory();
|
|
51
|
-
const mod = await (_a = path_1.default.join(compilablesDirectory, name + exports.COMPILE_END), Promise.resolve().then(() => __importStar(require(_a))));
|
|
64
|
+
function extractCompileConfig(path) {
|
|
65
|
+
const mod = require(path);
|
|
52
66
|
if (typeof mod.compile !== 'object') {
|
|
53
67
|
throw new Error(`Object 'compile' is missing`);
|
|
54
68
|
}
|
|
55
69
|
return mod.compile;
|
|
56
70
|
}
|
|
71
|
+
async function getCompilerConfigForContract(name) {
|
|
72
|
+
const compilablesDirectory = await getCompilablesDirectory();
|
|
73
|
+
return extractCompileConfig(path_1.default.join(compilablesDirectory, name + exports.COMPILE_END));
|
|
74
|
+
}
|
|
57
75
|
async function doCompileTolk(config) {
|
|
58
76
|
const res = await (0, tolk_js_1.runTolkCompiler)(config);
|
|
59
77
|
if (res.status === 'error') {
|
|
@@ -116,6 +134,11 @@ function getRootTactConfigOptionsForContract(name) {
|
|
|
116
134
|
}
|
|
117
135
|
return undefined;
|
|
118
136
|
}
|
|
137
|
+
async function getTactVersion() {
|
|
138
|
+
const packageJsonPath = require.resolve('@tact-lang/compiler/package.json');
|
|
139
|
+
const { version } = await Promise.resolve(`${packageJsonPath}`).then(s => __importStar(require(s)));
|
|
140
|
+
return version;
|
|
141
|
+
}
|
|
119
142
|
async function doCompileTact(config, name) {
|
|
120
143
|
const rootConfigOptions = getRootTactConfigOptionsForContract(name);
|
|
121
144
|
const fs = new OverwritableVirtualFileSystem_1.OverwritableVirtualFileSystem(process.cwd());
|
|
@@ -139,6 +162,7 @@ async function doCompileTact(config, name) {
|
|
|
139
162
|
fs: fs.overwrites,
|
|
140
163
|
code,
|
|
141
164
|
options: buildConfig.config.options,
|
|
165
|
+
version: await getTactVersion(),
|
|
142
166
|
};
|
|
143
167
|
}
|
|
144
168
|
async function doCompileInner(name, config) {
|
|
@@ -160,6 +184,24 @@ async function doCompileInner(name, config) {
|
|
|
160
184
|
optLevel: config.optLevel,
|
|
161
185
|
});
|
|
162
186
|
}
|
|
187
|
+
function getCompilerName(config) {
|
|
188
|
+
return config.lang ?? 'func';
|
|
189
|
+
}
|
|
190
|
+
async function getCompilerVersion(config) {
|
|
191
|
+
if (config.lang === 'tact') {
|
|
192
|
+
return getTactVersion();
|
|
193
|
+
}
|
|
194
|
+
if (config.lang === 'tolk') {
|
|
195
|
+
return (0, tolk_js_1.getTolkCompilerVersion)();
|
|
196
|
+
}
|
|
197
|
+
return (await (0, func_js_1.compilerVersion)()).funcVersion;
|
|
198
|
+
}
|
|
199
|
+
async function getCompilerOptions(config) {
|
|
200
|
+
return {
|
|
201
|
+
lang: getCompilerName(config),
|
|
202
|
+
version: await getCompilerVersion(config),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
163
205
|
async function doCompile(name, opts) {
|
|
164
206
|
const config = await getCompilerConfigForContract(name);
|
|
165
207
|
if (config.preCompileHook !== undefined) {
|
|
@@ -175,7 +217,6 @@ async function doCompile(name, opts) {
|
|
|
175
217
|
}
|
|
176
218
|
return res;
|
|
177
219
|
}
|
|
178
|
-
exports.doCompile = doCompile;
|
|
179
220
|
/**
|
|
180
221
|
* Compiles a contract using the specified configuration for `tact`, `func`, or `tolk` languages.
|
|
181
222
|
*
|
|
@@ -203,4 +244,3 @@ async function compile(name, opts) {
|
|
|
203
244
|
const result = await doCompile(name, opts);
|
|
204
245
|
return result.code;
|
|
205
246
|
}
|
|
206
|
-
exports.compile = compile;
|
package/dist/config/utils.js
CHANGED
|
@@ -15,16 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
26
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.getConfig =
|
|
36
|
+
exports.getConfig = getConfig;
|
|
28
37
|
const paths_1 = require("../paths");
|
|
29
38
|
let config;
|
|
30
39
|
async function getConfig() {
|
|
@@ -32,7 +41,7 @@ async function getConfig() {
|
|
|
32
41
|
return config;
|
|
33
42
|
}
|
|
34
43
|
try {
|
|
35
|
-
const configModule = await (
|
|
44
|
+
const configModule = await Promise.resolve(`${paths_1.BLUEPRINT_CONFIG}`).then(s => __importStar(require(s)));
|
|
36
45
|
if (!('config' in configModule) || typeof configModule.config !== 'object') {
|
|
37
46
|
return undefined;
|
|
38
47
|
}
|
|
@@ -43,4 +52,3 @@ async function getConfig() {
|
|
|
43
52
|
return undefined;
|
|
44
53
|
}
|
|
45
54
|
}
|
|
46
|
-
exports.getConfig = getConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export { Config } from './config/Config';
|
|
|
8
8
|
export { Args, Runner, RunnerContext } from './cli/Runner';
|
|
9
9
|
export { PluginRunner, Plugin } from './config/Plugin';
|
|
10
10
|
export { CustomNetwork } from './config/CustomNetwork';
|
|
11
|
-
export { buildOne, buildAll } from './build';
|
|
11
|
+
export { buildOne, buildAll, buildAllTact } from './build';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildAll = exports.buildOne = exports.compile = exports.createNetworkProvider = exports.sleep = exports.tonDeepLink = void 0;
|
|
3
|
+
exports.buildAllTact = exports.buildAll = exports.buildOne = exports.compile = exports.createNetworkProvider = exports.sleep = exports.tonDeepLink = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
Object.defineProperty(exports, "tonDeepLink", { enumerable: true, get: function () { return utils_1.tonDeepLink; } });
|
|
6
6
|
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return utils_1.sleep; } });
|
|
@@ -11,3 +11,4 @@ Object.defineProperty(exports, "compile", { enumerable: true, get: function () {
|
|
|
11
11
|
var build_1 = require("./build");
|
|
12
12
|
Object.defineProperty(exports, "buildOne", { enumerable: true, get: function () { return build_1.buildOne; } });
|
|
13
13
|
Object.defineProperty(exports, "buildAll", { enumerable: true, get: function () { return build_1.buildAll; } });
|
|
14
|
+
Object.defineProperty(exports, "buildAllTact", { enumerable: true, get: function () { return build_1.buildAllTact; } });
|
|
@@ -15,7 +15,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
var _SendProviderSender_provider, _WrappedContractProvider_address, _WrappedContractProvider_provider, _WrappedContractProvider_init, _WrappedContractProvider_factory, _NetworkProviderImpl_tc, _NetworkProviderImpl_sender, _NetworkProviderImpl_network, _NetworkProviderImpl_explorer, _NetworkProviderImpl_ui;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.argSpec = void 0;
|
|
19
|
+
exports.createNetworkProvider = createNetworkProvider;
|
|
19
20
|
const utils_1 = require("../utils");
|
|
20
21
|
const DeeplinkProvider_1 = require("./send/DeeplinkProvider");
|
|
21
22
|
const TonConnectProvider_1 = require("./send/TonConnectProvider");
|
|
@@ -396,4 +397,3 @@ class NetworkProviderBuilder {
|
|
|
396
397
|
async function createNetworkProvider(ui, args, config, allowCustom = true) {
|
|
397
398
|
return await new NetworkProviderBuilder(args, ui, config, allowCustom).build();
|
|
398
399
|
}
|
|
399
|
-
exports.createNetworkProvider = createNetworkProvider;
|
package/dist/template.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.TEMPLATES_DIR = void 0;
|
|
7
|
+
exports.executeTemplate = executeTemplate;
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
exports.TEMPLATES_DIR = path_1.default.join(__dirname, 'templates');
|
|
9
10
|
function executeTemplate(contents, replaces) {
|
|
@@ -12,4 +13,3 @@ function executeTemplate(contents, replaces) {
|
|
|
12
13
|
}
|
|
13
14
|
return contents;
|
|
14
15
|
}
|
|
15
|
-
exports.executeTemplate = executeTemplate;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oneOrZeroOf =
|
|
3
|
+
exports.oneOrZeroOf = oneOrZeroOf;
|
|
4
4
|
function oneOrZeroOf(options) {
|
|
5
5
|
let opt = undefined;
|
|
6
6
|
for (const k in options) {
|
|
@@ -15,4 +15,3 @@ function oneOrZeroOf(options) {
|
|
|
15
15
|
}
|
|
16
16
|
return opt;
|
|
17
17
|
}
|
|
18
|
-
exports.oneOrZeroOf = oneOrZeroOf;
|
|
@@ -15,19 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
|
-
var _a;
|
|
29
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.
|
|
39
|
+
exports.findScripts = exports.findCompiles = void 0;
|
|
40
|
+
exports.selectOption = selectOption;
|
|
41
|
+
exports.selectFile = selectFile;
|
|
31
42
|
const path_1 = __importDefault(require("path"));
|
|
32
43
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
33
44
|
const paths_1 = require("../paths");
|
|
@@ -65,7 +76,6 @@ async function selectOption(options, opts) {
|
|
|
65
76
|
return await opts.ui.choose(opts.msg, options, (o) => o.name);
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
|
-
exports.selectOption = selectOption;
|
|
69
79
|
async function selectFile(files, opts) {
|
|
70
80
|
let selected;
|
|
71
81
|
if (opts.hint) {
|
|
@@ -87,7 +97,6 @@ async function selectFile(files, opts) {
|
|
|
87
97
|
}
|
|
88
98
|
return {
|
|
89
99
|
...selected,
|
|
90
|
-
module: opts.import !== false ? await (
|
|
100
|
+
module: opts.import !== false ? await Promise.resolve(`${selected.path}`).then(s => __importStar(require(s))) : undefined,
|
|
91
101
|
};
|
|
92
102
|
}
|
|
93
|
-
exports.selectFile = selectFile;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPascalCase = isPascalCase;
|
|
4
|
+
exports.toPascalCase = toPascalCase;
|
|
5
|
+
function isPascalCase(str) {
|
|
6
|
+
return /^[A-Z][a-zA-Z0-9]*$/.test(str);
|
|
7
|
+
}
|
|
8
|
+
function toPascalCase(str) {
|
|
9
|
+
return str
|
|
10
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2') // Splits camelCase words into separate words
|
|
11
|
+
.replace(/[^a-zA-Z0-9]+/g, ' ') // Replaces all characters that are not allowed with spaces
|
|
12
|
+
.toLowerCase() // Converts the entire string to lowercase
|
|
13
|
+
.replace(/(?:^|\s)(\p{L})/gu, (_, letter) => letter.toUpperCase()) // Capitalizes the first letter of each word
|
|
14
|
+
.replace(/\s+/g, ''); // Removes all spaces
|
|
15
|
+
}
|
package/dist/utils/ton.utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.tonDeepLink = void 0;
|
|
4
|
+
exports.getExplorerLink = getExplorerLink;
|
|
4
5
|
/**
|
|
5
6
|
* Generates a TON deep link for transfer.
|
|
6
7
|
*
|
|
@@ -49,4 +50,3 @@ function getExplorerLink(address, network, explorer) {
|
|
|
49
50
|
return `https://${networkPrefix}tonviewer.com/${address}`;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
exports.getExplorerLink = getExplorerLink;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ton/blueprint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"description": "Framework for development of TON smart contracts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "./dist/cli/cli.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@types/node": "^20.2.5",
|
|
30
30
|
"@types/qrcode-terminal": "^0.12.0",
|
|
31
31
|
"prettier": "^3.0.3",
|
|
32
|
-
"typescript": "^
|
|
32
|
+
"typescript": "^5.8.3"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@tact-lang/compiler": ">=1.6.5",
|